@daoyi/nmtl-ui 2.0.1-beta.59 → 2.0.1-beta.60

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 (59) hide show
  1. package/lib/components/{Autocomplete-ed66ea1e.js → Autocomplete-d826e57f.js} +64 -69
  2. package/lib/components/Autocomplete.js +4 -4
  3. package/lib/components/Avatar.js +5 -3
  4. package/lib/components/BackTop.js +4 -4
  5. package/lib/components/BarChart.js +1 -1
  6. package/lib/components/Breadcrumbs.js +1 -1
  7. package/lib/components/{Button-3d002693.js → Button-433372aa.js} +1 -1
  8. package/lib/components/Button.js +2 -2
  9. package/lib/components/Carousel.js +2 -2
  10. package/lib/components/Checkbox.js +1 -1
  11. package/lib/components/CollapseContent.js +3 -3
  12. package/lib/components/{ContactModal-5af70002.js → ContactModal-aabf02d5.js} +5 -5
  13. package/lib/components/ContactModal.js +10 -10
  14. package/lib/components/{Drawer-47f9967c.js → Drawer-bfcfd292.js} +2 -2
  15. package/lib/components/Drawer.js +5 -5
  16. package/lib/components/Dropdown.js +2 -2
  17. package/lib/components/{Empty-b674a51e.js → Empty-7318f658.js} +1 -1
  18. package/lib/components/Empty.js +2 -2
  19. package/lib/components/ExportButton.js +3 -3
  20. package/lib/components/{ExtraTools-97665703.js → ExtraTools-aa5bc12d.js} +4 -4
  21. package/lib/components/ExtraTools.js +5 -5
  22. package/lib/components/Filter.js +3 -3
  23. package/lib/components/Footer.js +10 -10
  24. package/lib/components/{ForwardLink-02ae24fb.js → ForwardLink-2912e106.js} +2 -2
  25. package/lib/components/ForwardLink.js +3 -3
  26. package/lib/components/Header.js +7 -7
  27. package/lib/components/Image.js +2 -2
  28. package/lib/components/Input.js +1 -1
  29. package/lib/components/InputMethod.js +2 -2
  30. package/lib/components/{KeywordSearch-52526414.js → KeywordSearch-4b7ace9c.js} +3 -3
  31. package/lib/components/KeywordSearch.js +5 -5
  32. package/lib/components/KeywordTicker.js +4 -4
  33. package/lib/components/Keywords.js +7 -7
  34. package/lib/components/Loading.js +1 -1
  35. package/lib/components/MUITheme.js +3 -6
  36. package/lib/components/{Modal-1e6d1b61.js → Modal-64c4ab0d.js} +3 -3
  37. package/lib/components/Modal.js +4 -4
  38. package/lib/components/{MoreButton-a001648b.js → MoreButton-6654cc5b.js} +1 -1
  39. package/lib/components/MoreButton.js +2 -2
  40. package/lib/components/NmtlPagination.js +3702 -0
  41. package/lib/components/Radio.js +1 -1
  42. package/lib/components/SNA.js +5 -5
  43. package/lib/components/{Select-a607a0d4.js → Select-f3014e5a.js} +3 -3
  44. package/lib/components/Select.js +4 -4
  45. package/lib/components/{Spin-a5ff6ede.js → Spin-8a5a600d.js} +1 -1
  46. package/lib/components/Spin.js +2 -2
  47. package/lib/components/Table.js +1 -1
  48. package/lib/components/{Tooltip-f1cd39ef.js → Tooltip-fdee6235.js} +2 -2
  49. package/lib/components/Tooltip.js +3 -3
  50. package/lib/components/{_rollupPluginBabelHelpers-7eb4ffba.js → _rollupPluginBabelHelpers-a52356f6.js} +1 -1
  51. package/lib/components/{createSvgIcon-b7f70edc.js → createSvgIcon-db8e8306.js} +2 -2
  52. package/lib/components/{dataExport-04b77185.js → dataExport-d55d6fa3.js} +30 -31
  53. package/lib/components/{defaultTheme-19a14721.js → defaultTheme-5839b9b3.js} +21 -1
  54. package/lib/components/withTheme-4417822c.js +6 -0
  55. package/lib/index.d.ts +1 -0
  56. package/lib/index.js +1 -0
  57. package/package.json +1 -1
  58. /package/lib/components/{index-8aa477f6.js → index-66babe67.js} +0 -0
  59. /package/lib/components/{index-b1cfc87c.js → index-fdcc884e.js} +0 -0
@@ -0,0 +1,3702 @@
1
+ import * as React$2 from 'react';
2
+ import React__default, { Children, isValidElement, cloneElement } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { d as defaultTheme, a as _objectWithoutProperties, _ as _extends, b as _objectWithoutPropertiesLoose, c as alpha, f as formatMuiErrorMessage } from './defaultTheme-5839b9b3.js';
5
+ import { u as useControlled, c as clsx, b as useEventCallback, w as withStyles, d as useIsFocusVisible, e as useForkRef, f as createSvgIcon, g as capitalize, h as debounce, r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-db8e8306.js';
6
+ import 'react-is';
7
+ import { useTheme as useTheme$1 } from '@material-ui/styles';
8
+ import './withTheme-4417822c.js';
9
+ import * as ReactDOM from 'react-dom';
10
+ import ReactDOM__default from 'react-dom';
11
+ import { c as classNames } from './index-66babe67.js';
12
+ import { useMediaQuery, IconButton } from '@material-ui/core';
13
+ import { s as styleInject } from './style-inject.es-1f59c1d0.js';
14
+ import './_commonjsHelpers-70de2c37.js';
15
+
16
+ function _arrayLikeToArray(arr, len) {
17
+ if (len == null || len > arr.length) len = arr.length;
18
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
19
+ arr2[i] = arr[i];
20
+ }
21
+ return arr2;
22
+ }
23
+
24
+ function _arrayWithoutHoles(arr) {
25
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
26
+ }
27
+
28
+ function _iterableToArray(iter) {
29
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
30
+ }
31
+
32
+ function _unsupportedIterableToArray(o, minLen) {
33
+ if (!o) return;
34
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
35
+ var n = Object.prototype.toString.call(o).slice(8, -1);
36
+ if (n === "Object" && o.constructor) n = o.constructor.name;
37
+ if (n === "Map" || n === "Set") return Array.from(o);
38
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
39
+ }
40
+
41
+ function _nonIterableSpread() {
42
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
43
+ }
44
+
45
+ function _toConsumableArray(arr) {
46
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
47
+ }
48
+
49
+ function _arrayWithHoles(arr) {
50
+ if (Array.isArray(arr)) return arr;
51
+ }
52
+
53
+ function _iterableToArrayLimit(arr, i) {
54
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
55
+ if (_i == null) return;
56
+ var _arr = [];
57
+ var _n = true;
58
+ var _d = false;
59
+ var _s, _e;
60
+ try {
61
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
62
+ _arr.push(_s.value);
63
+ if (i && _arr.length === i) break;
64
+ }
65
+ } catch (err) {
66
+ _d = true;
67
+ _e = err;
68
+ } finally {
69
+ try {
70
+ if (!_n && _i["return"] != null) _i["return"]();
71
+ } finally {
72
+ if (_d) throw _e;
73
+ }
74
+ }
75
+ return _arr;
76
+ }
77
+
78
+ function _nonIterableRest() {
79
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
80
+ }
81
+
82
+ function _slicedToArray(arr, i) {
83
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
84
+ }
85
+
86
+ function useTheme() {
87
+ var theme = useTheme$1() || defaultTheme;
88
+
89
+ return theme;
90
+ }
91
+
92
+ function usePagination() {
93
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
94
+
95
+ // keep default values in sync with @default tags in Pagination.propTypes
96
+ var _props$boundaryCount = props.boundaryCount,
97
+ boundaryCount = _props$boundaryCount === void 0 ? 1 : _props$boundaryCount,
98
+ _props$componentName = props.componentName,
99
+ componentName = _props$componentName === void 0 ? 'usePagination' : _props$componentName,
100
+ _props$count = props.count,
101
+ count = _props$count === void 0 ? 1 : _props$count,
102
+ _props$defaultPage = props.defaultPage,
103
+ defaultPage = _props$defaultPage === void 0 ? 1 : _props$defaultPage,
104
+ _props$disabled = props.disabled,
105
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
106
+ _props$hideNextButton = props.hideNextButton,
107
+ hideNextButton = _props$hideNextButton === void 0 ? false : _props$hideNextButton,
108
+ _props$hidePrevButton = props.hidePrevButton,
109
+ hidePrevButton = _props$hidePrevButton === void 0 ? false : _props$hidePrevButton,
110
+ handleChange = props.onChange,
111
+ pageProp = props.page,
112
+ _props$showFirstButto = props.showFirstButton,
113
+ showFirstButton = _props$showFirstButto === void 0 ? false : _props$showFirstButto,
114
+ _props$showLastButton = props.showLastButton,
115
+ showLastButton = _props$showLastButton === void 0 ? false : _props$showLastButton,
116
+ _props$siblingCount = props.siblingCount,
117
+ siblingCount = _props$siblingCount === void 0 ? 1 : _props$siblingCount,
118
+ other = _objectWithoutProperties(props, ["boundaryCount", "componentName", "count", "defaultPage", "disabled", "hideNextButton", "hidePrevButton", "onChange", "page", "showFirstButton", "showLastButton", "siblingCount"]);
119
+
120
+ var _useControlled = useControlled({
121
+ controlled: pageProp,
122
+ default: defaultPage,
123
+ name: componentName,
124
+ state: 'page'
125
+ }),
126
+ _useControlled2 = _slicedToArray(_useControlled, 2),
127
+ page = _useControlled2[0],
128
+ setPageState = _useControlled2[1];
129
+
130
+ var handleClick = function handleClick(event, value) {
131
+ if (!pageProp) {
132
+ setPageState(value);
133
+ }
134
+
135
+ if (handleChange) {
136
+ handleChange(event, value);
137
+ }
138
+ }; // https://dev.to/namirsab/comment/2050
139
+
140
+
141
+ var range = function range(start, end) {
142
+ var length = end - start + 1;
143
+ return Array.from({
144
+ length: length
145
+ }, function (_, i) {
146
+ return start + i;
147
+ });
148
+ };
149
+
150
+ var startPages = range(1, Math.min(boundaryCount, count));
151
+ var endPages = range(Math.max(count - boundaryCount + 1, boundaryCount + 1), count);
152
+ var siblingsStart = Math.max(Math.min( // Natural start
153
+ page - siblingCount, // Lower boundary when page is high
154
+ count - boundaryCount - siblingCount * 2 - 1), // Greater than startPages
155
+ boundaryCount + 2);
156
+ var siblingsEnd = Math.min(Math.max( // Natural end
157
+ page + siblingCount, // Upper boundary when page is low
158
+ boundaryCount + siblingCount * 2 + 2), // Less than endPages
159
+ endPages[0] - 2); // Basic list of items to render
160
+ // e.g. itemList = ['first', 'previous', 1, 'ellipsis', 4, 5, 6, 'ellipsis', 10, 'next', 'last']
161
+
162
+ var itemList = [].concat(_toConsumableArray(showFirstButton ? ['first'] : []), _toConsumableArray(hidePrevButton ? [] : ['previous']), _toConsumableArray(startPages), _toConsumableArray(siblingsStart > boundaryCount + 2 ? ['start-ellipsis'] : boundaryCount + 1 < count - boundaryCount ? [boundaryCount + 1] : []), _toConsumableArray(range(siblingsStart, siblingsEnd)), _toConsumableArray(siblingsEnd < count - boundaryCount - 1 ? ['end-ellipsis'] : count - boundaryCount > boundaryCount ? [count - boundaryCount] : []), _toConsumableArray(endPages), _toConsumableArray(hideNextButton ? [] : ['next']), _toConsumableArray(showLastButton ? ['last'] : [])); // Map the button type to its page number
163
+
164
+ var buttonPage = function buttonPage(type) {
165
+ switch (type) {
166
+ case 'first':
167
+ return 1;
168
+
169
+ case 'previous':
170
+ return page - 1;
171
+
172
+ case 'next':
173
+ return page + 1;
174
+
175
+ case 'last':
176
+ return count;
177
+
178
+ default:
179
+ return null;
180
+ }
181
+ }; // Convert the basic item list to PaginationItem props objects
182
+
183
+
184
+ var items = itemList.map(function (item) {
185
+ return typeof item === 'number' ? {
186
+ onClick: function onClick(event) {
187
+ handleClick(event, item);
188
+ },
189
+ type: 'page',
190
+ page: item,
191
+ selected: item === page,
192
+ disabled: disabled,
193
+ 'aria-current': item === page ? 'true' : undefined
194
+ } : {
195
+ onClick: function onClick(event) {
196
+ handleClick(event, buttonPage(item));
197
+ },
198
+ type: item,
199
+ page: buttonPage(item),
200
+ selected: false,
201
+ disabled: disabled || item.indexOf('ellipsis') === -1 && (item === 'next' || item === 'last' ? page >= count : page <= 1)
202
+ };
203
+ });
204
+ return _extends({
205
+ items: items
206
+ }, other);
207
+ }
208
+
209
+ function _setPrototypeOf(o, p) {
210
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
211
+ o.__proto__ = p;
212
+ return o;
213
+ };
214
+ return _setPrototypeOf(o, p);
215
+ }
216
+
217
+ function _inheritsLoose(subClass, superClass) {
218
+ subClass.prototype = Object.create(superClass.prototype);
219
+ subClass.prototype.constructor = subClass;
220
+ _setPrototypeOf(subClass, superClass);
221
+ }
222
+
223
+ /**
224
+ * Checks if a given element has a CSS class.
225
+ *
226
+ * @param element the element
227
+ * @param className the CSS class name
228
+ */
229
+ function hasClass(element, className) {
230
+ if (element.classList) return !!className && element.classList.contains(className);
231
+ return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
232
+ }
233
+
234
+ /**
235
+ * Adds a CSS class to a given element.
236
+ *
237
+ * @param element the element
238
+ * @param className the CSS class name
239
+ */
240
+
241
+ function addClass(element, className) {
242
+ if (element.classList) element.classList.add(className);else if (!hasClass(element, className)) if (typeof element.className === 'string') element.className = element.className + " " + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + " " + className);
243
+ }
244
+
245
+ function replaceClassName(origClass, classToRemove) {
246
+ return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
247
+ }
248
+ /**
249
+ * Removes a CSS class from a given element.
250
+ *
251
+ * @param element the element
252
+ * @param className the CSS class name
253
+ */
254
+
255
+
256
+ function removeClass$1(element, className) {
257
+ if (element.classList) {
258
+ element.classList.remove(className);
259
+ } else if (typeof element.className === 'string') {
260
+ element.className = replaceClassName(element.className, className);
261
+ } else {
262
+ element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
263
+ }
264
+ }
265
+
266
+ var config = {
267
+ disabled: false
268
+ };
269
+
270
+ var TransitionGroupContext = React__default.createContext(null);
271
+
272
+ var forceReflow = function forceReflow(node) {
273
+ return node.scrollTop;
274
+ };
275
+
276
+ var UNMOUNTED = 'unmounted';
277
+ var EXITED = 'exited';
278
+ var ENTERING = 'entering';
279
+ var ENTERED = 'entered';
280
+ var EXITING = 'exiting';
281
+ /**
282
+ * The Transition component lets you describe a transition from one component
283
+ * state to another _over time_ with a simple declarative API. Most commonly
284
+ * it's used to animate the mounting and unmounting of a component, but can also
285
+ * be used to describe in-place transition states as well.
286
+ *
287
+ * ---
288
+ *
289
+ * **Note**: `Transition` is a platform-agnostic base component. If you're using
290
+ * transitions in CSS, you'll probably want to use
291
+ * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)
292
+ * instead. It inherits all the features of `Transition`, but contains
293
+ * additional features necessary to play nice with CSS transitions (hence the
294
+ * name of the component).
295
+ *
296
+ * ---
297
+ *
298
+ * By default the `Transition` component does not alter the behavior of the
299
+ * component it renders, it only tracks "enter" and "exit" states for the
300
+ * components. It's up to you to give meaning and effect to those states. For
301
+ * example we can add styles to a component when it enters or exits:
302
+ *
303
+ * ```jsx
304
+ * import { Transition } from 'react-transition-group';
305
+ *
306
+ * const duration = 300;
307
+ *
308
+ * const defaultStyle = {
309
+ * transition: `opacity ${duration}ms ease-in-out`,
310
+ * opacity: 0,
311
+ * }
312
+ *
313
+ * const transitionStyles = {
314
+ * entering: { opacity: 1 },
315
+ * entered: { opacity: 1 },
316
+ * exiting: { opacity: 0 },
317
+ * exited: { opacity: 0 },
318
+ * };
319
+ *
320
+ * const Fade = ({ in: inProp }) => (
321
+ * <Transition in={inProp} timeout={duration}>
322
+ * {state => (
323
+ * <div style={{
324
+ * ...defaultStyle,
325
+ * ...transitionStyles[state]
326
+ * }}>
327
+ * I'm a fade Transition!
328
+ * </div>
329
+ * )}
330
+ * </Transition>
331
+ * );
332
+ * ```
333
+ *
334
+ * There are 4 main states a Transition can be in:
335
+ * - `'entering'`
336
+ * - `'entered'`
337
+ * - `'exiting'`
338
+ * - `'exited'`
339
+ *
340
+ * Transition state is toggled via the `in` prop. When `true` the component
341
+ * begins the "Enter" stage. During this stage, the component will shift from
342
+ * its current transition state, to `'entering'` for the duration of the
343
+ * transition and then to the `'entered'` stage once it's complete. Let's take
344
+ * the following example (we'll use the
345
+ * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):
346
+ *
347
+ * ```jsx
348
+ * function App() {
349
+ * const [inProp, setInProp] = useState(false);
350
+ * return (
351
+ * <div>
352
+ * <Transition in={inProp} timeout={500}>
353
+ * {state => (
354
+ * // ...
355
+ * )}
356
+ * </Transition>
357
+ * <button onClick={() => setInProp(true)}>
358
+ * Click to Enter
359
+ * </button>
360
+ * </div>
361
+ * );
362
+ * }
363
+ * ```
364
+ *
365
+ * When the button is clicked the component will shift to the `'entering'` state
366
+ * and stay there for 500ms (the value of `timeout`) before it finally switches
367
+ * to `'entered'`.
368
+ *
369
+ * When `in` is `false` the same thing happens except the state moves from
370
+ * `'exiting'` to `'exited'`.
371
+ */
372
+
373
+ var Transition = /*#__PURE__*/function (_React$Component) {
374
+ _inheritsLoose(Transition, _React$Component);
375
+
376
+ function Transition(props, context) {
377
+ var _this;
378
+
379
+ _this = _React$Component.call(this, props, context) || this;
380
+ var parentGroup = context; // In the context of a TransitionGroup all enters are really appears
381
+
382
+ var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
383
+ var initialStatus;
384
+ _this.appearStatus = null;
385
+
386
+ if (props.in) {
387
+ if (appear) {
388
+ initialStatus = EXITED;
389
+ _this.appearStatus = ENTERING;
390
+ } else {
391
+ initialStatus = ENTERED;
392
+ }
393
+ } else {
394
+ if (props.unmountOnExit || props.mountOnEnter) {
395
+ initialStatus = UNMOUNTED;
396
+ } else {
397
+ initialStatus = EXITED;
398
+ }
399
+ }
400
+
401
+ _this.state = {
402
+ status: initialStatus
403
+ };
404
+ _this.nextCallback = null;
405
+ return _this;
406
+ }
407
+
408
+ Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
409
+ var nextIn = _ref.in;
410
+
411
+ if (nextIn && prevState.status === UNMOUNTED) {
412
+ return {
413
+ status: EXITED
414
+ };
415
+ }
416
+
417
+ return null;
418
+ } // getSnapshotBeforeUpdate(prevProps) {
419
+ // let nextStatus = null
420
+ // if (prevProps !== this.props) {
421
+ // const { status } = this.state
422
+ // if (this.props.in) {
423
+ // if (status !== ENTERING && status !== ENTERED) {
424
+ // nextStatus = ENTERING
425
+ // }
426
+ // } else {
427
+ // if (status === ENTERING || status === ENTERED) {
428
+ // nextStatus = EXITING
429
+ // }
430
+ // }
431
+ // }
432
+ // return { nextStatus }
433
+ // }
434
+ ;
435
+
436
+ var _proto = Transition.prototype;
437
+
438
+ _proto.componentDidMount = function componentDidMount() {
439
+ this.updateStatus(true, this.appearStatus);
440
+ };
441
+
442
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
443
+ var nextStatus = null;
444
+
445
+ if (prevProps !== this.props) {
446
+ var status = this.state.status;
447
+
448
+ if (this.props.in) {
449
+ if (status !== ENTERING && status !== ENTERED) {
450
+ nextStatus = ENTERING;
451
+ }
452
+ } else {
453
+ if (status === ENTERING || status === ENTERED) {
454
+ nextStatus = EXITING;
455
+ }
456
+ }
457
+ }
458
+
459
+ this.updateStatus(false, nextStatus);
460
+ };
461
+
462
+ _proto.componentWillUnmount = function componentWillUnmount() {
463
+ this.cancelNextCallback();
464
+ };
465
+
466
+ _proto.getTimeouts = function getTimeouts() {
467
+ var timeout = this.props.timeout;
468
+ var exit, enter, appear;
469
+ exit = enter = appear = timeout;
470
+
471
+ if (timeout != null && typeof timeout !== 'number') {
472
+ exit = timeout.exit;
473
+ enter = timeout.enter; // TODO: remove fallback for next major
474
+
475
+ appear = timeout.appear !== undefined ? timeout.appear : enter;
476
+ }
477
+
478
+ return {
479
+ exit: exit,
480
+ enter: enter,
481
+ appear: appear
482
+ };
483
+ };
484
+
485
+ _proto.updateStatus = function updateStatus(mounting, nextStatus) {
486
+ if (mounting === void 0) {
487
+ mounting = false;
488
+ }
489
+
490
+ if (nextStatus !== null) {
491
+ // nextStatus will always be ENTERING or EXITING.
492
+ this.cancelNextCallback();
493
+
494
+ if (nextStatus === ENTERING) {
495
+ if (this.props.unmountOnExit || this.props.mountOnEnter) {
496
+ var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM__default.findDOMNode(this); // https://github.com/reactjs/react-transition-group/pull/749
497
+ // With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.
498
+ // To make the animation happen, we have to separate each rendering and avoid being processed as batched.
499
+
500
+ if (node) forceReflow(node);
501
+ }
502
+
503
+ this.performEnter(mounting);
504
+ } else {
505
+ this.performExit();
506
+ }
507
+ } else if (this.props.unmountOnExit && this.state.status === EXITED) {
508
+ this.setState({
509
+ status: UNMOUNTED
510
+ });
511
+ }
512
+ };
513
+
514
+ _proto.performEnter = function performEnter(mounting) {
515
+ var _this2 = this;
516
+
517
+ var enter = this.props.enter;
518
+ var appearing = this.context ? this.context.isMounting : mounting;
519
+
520
+ var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM__default.findDOMNode(this), appearing],
521
+ maybeNode = _ref2[0],
522
+ maybeAppearing = _ref2[1];
523
+
524
+ var timeouts = this.getTimeouts();
525
+ var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED
526
+ // if we are mounting and running this it means appear _must_ be set
527
+
528
+ if (!mounting && !enter || config.disabled) {
529
+ this.safeSetState({
530
+ status: ENTERED
531
+ }, function () {
532
+ _this2.props.onEntered(maybeNode);
533
+ });
534
+ return;
535
+ }
536
+
537
+ this.props.onEnter(maybeNode, maybeAppearing);
538
+ this.safeSetState({
539
+ status: ENTERING
540
+ }, function () {
541
+ _this2.props.onEntering(maybeNode, maybeAppearing);
542
+
543
+ _this2.onTransitionEnd(enterTimeout, function () {
544
+ _this2.safeSetState({
545
+ status: ENTERED
546
+ }, function () {
547
+ _this2.props.onEntered(maybeNode, maybeAppearing);
548
+ });
549
+ });
550
+ });
551
+ };
552
+
553
+ _proto.performExit = function performExit() {
554
+ var _this3 = this;
555
+
556
+ var exit = this.props.exit;
557
+ var timeouts = this.getTimeouts();
558
+ var maybeNode = this.props.nodeRef ? undefined : ReactDOM__default.findDOMNode(this); // no exit animation skip right to EXITED
559
+
560
+ if (!exit || config.disabled) {
561
+ this.safeSetState({
562
+ status: EXITED
563
+ }, function () {
564
+ _this3.props.onExited(maybeNode);
565
+ });
566
+ return;
567
+ }
568
+
569
+ this.props.onExit(maybeNode);
570
+ this.safeSetState({
571
+ status: EXITING
572
+ }, function () {
573
+ _this3.props.onExiting(maybeNode);
574
+
575
+ _this3.onTransitionEnd(timeouts.exit, function () {
576
+ _this3.safeSetState({
577
+ status: EXITED
578
+ }, function () {
579
+ _this3.props.onExited(maybeNode);
580
+ });
581
+ });
582
+ });
583
+ };
584
+
585
+ _proto.cancelNextCallback = function cancelNextCallback() {
586
+ if (this.nextCallback !== null) {
587
+ this.nextCallback.cancel();
588
+ this.nextCallback = null;
589
+ }
590
+ };
591
+
592
+ _proto.safeSetState = function safeSetState(nextState, callback) {
593
+ // This shouldn't be necessary, but there are weird race conditions with
594
+ // setState callbacks and unmounting in testing, so always make sure that
595
+ // we can cancel any pending setState callbacks after we unmount.
596
+ callback = this.setNextCallback(callback);
597
+ this.setState(nextState, callback);
598
+ };
599
+
600
+ _proto.setNextCallback = function setNextCallback(callback) {
601
+ var _this4 = this;
602
+
603
+ var active = true;
604
+
605
+ this.nextCallback = function (event) {
606
+ if (active) {
607
+ active = false;
608
+ _this4.nextCallback = null;
609
+ callback(event);
610
+ }
611
+ };
612
+
613
+ this.nextCallback.cancel = function () {
614
+ active = false;
615
+ };
616
+
617
+ return this.nextCallback;
618
+ };
619
+
620
+ _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) {
621
+ this.setNextCallback(handler);
622
+ var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM__default.findDOMNode(this);
623
+ var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
624
+
625
+ if (!node || doesNotHaveTimeoutOrListener) {
626
+ setTimeout(this.nextCallback, 0);
627
+ return;
628
+ }
629
+
630
+ if (this.props.addEndListener) {
631
+ var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback],
632
+ maybeNode = _ref3[0],
633
+ maybeNextCallback = _ref3[1];
634
+
635
+ this.props.addEndListener(maybeNode, maybeNextCallback);
636
+ }
637
+
638
+ if (timeout != null) {
639
+ setTimeout(this.nextCallback, timeout);
640
+ }
641
+ };
642
+
643
+ _proto.render = function render() {
644
+ var status = this.state.status;
645
+
646
+ if (status === UNMOUNTED) {
647
+ return null;
648
+ }
649
+
650
+ var _this$props = this.props,
651
+ children = _this$props.children;
652
+ _this$props.in;
653
+ _this$props.mountOnEnter;
654
+ _this$props.unmountOnExit;
655
+ _this$props.appear;
656
+ _this$props.enter;
657
+ _this$props.exit;
658
+ _this$props.timeout;
659
+ _this$props.addEndListener;
660
+ _this$props.onEnter;
661
+ _this$props.onEntering;
662
+ _this$props.onEntered;
663
+ _this$props.onExit;
664
+ _this$props.onExiting;
665
+ _this$props.onExited;
666
+ _this$props.nodeRef;
667
+ var childProps = _objectWithoutPropertiesLoose(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
668
+
669
+ return (
670
+ /*#__PURE__*/
671
+ // allows for nested Transitions
672
+ React__default.createElement(TransitionGroupContext.Provider, {
673
+ value: null
674
+ }, typeof children === 'function' ? children(status, childProps) : React__default.cloneElement(React__default.Children.only(children), childProps))
675
+ );
676
+ };
677
+
678
+ return Transition;
679
+ }(React__default.Component);
680
+
681
+ Transition.contextType = TransitionGroupContext;
682
+ Transition.propTypes = {}; // Name the function so it is clearer in the documentation
683
+
684
+ function noop() {}
685
+
686
+ Transition.defaultProps = {
687
+ in: false,
688
+ mountOnEnter: false,
689
+ unmountOnExit: false,
690
+ appear: false,
691
+ enter: true,
692
+ exit: true,
693
+ onEnter: noop,
694
+ onEntering: noop,
695
+ onEntered: noop,
696
+ onExit: noop,
697
+ onExiting: noop,
698
+ onExited: noop
699
+ };
700
+ Transition.UNMOUNTED = UNMOUNTED;
701
+ Transition.EXITED = EXITED;
702
+ Transition.ENTERING = ENTERING;
703
+ Transition.ENTERED = ENTERED;
704
+ Transition.EXITING = EXITING;
705
+
706
+ var _addClass = function addClass$1(node, classes) {
707
+ return node && classes && classes.split(' ').forEach(function (c) {
708
+ return addClass(node, c);
709
+ });
710
+ };
711
+
712
+ var removeClass = function removeClass(node, classes) {
713
+ return node && classes && classes.split(' ').forEach(function (c) {
714
+ return removeClass$1(node, c);
715
+ });
716
+ };
717
+ /**
718
+ * A transition component inspired by the excellent
719
+ * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should
720
+ * use it if you're using CSS transitions or animations. It's built upon the
721
+ * [`Transition`](https://reactcommunity.org/react-transition-group/transition)
722
+ * component, so it inherits all of its props.
723
+ *
724
+ * `CSSTransition` applies a pair of class names during the `appear`, `enter`,
725
+ * and `exit` states of the transition. The first class is applied and then a
726
+ * second `*-active` class in order to activate the CSS transition. After the
727
+ * transition, matching `*-done` class names are applied to persist the
728
+ * transition state.
729
+ *
730
+ * ```jsx
731
+ * function App() {
732
+ * const [inProp, setInProp] = useState(false);
733
+ * return (
734
+ * <div>
735
+ * <CSSTransition in={inProp} timeout={200} classNames="my-node">
736
+ * <div>
737
+ * {"I'll receive my-node-* classes"}
738
+ * </div>
739
+ * </CSSTransition>
740
+ * <button type="button" onClick={() => setInProp(true)}>
741
+ * Click to Enter
742
+ * </button>
743
+ * </div>
744
+ * );
745
+ * }
746
+ * ```
747
+ *
748
+ * When the `in` prop is set to `true`, the child component will first receive
749
+ * the class `example-enter`, then the `example-enter-active` will be added in
750
+ * the next tick. `CSSTransition` [forces a
751
+ * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)
752
+ * between before adding the `example-enter-active`. This is an important trick
753
+ * because it allows us to transition between `example-enter` and
754
+ * `example-enter-active` even though they were added immediately one after
755
+ * another. Most notably, this is what makes it possible for us to animate
756
+ * _appearance_.
757
+ *
758
+ * ```css
759
+ * .my-node-enter {
760
+ * opacity: 0;
761
+ * }
762
+ * .my-node-enter-active {
763
+ * opacity: 1;
764
+ * transition: opacity 200ms;
765
+ * }
766
+ * .my-node-exit {
767
+ * opacity: 1;
768
+ * }
769
+ * .my-node-exit-active {
770
+ * opacity: 0;
771
+ * transition: opacity 200ms;
772
+ * }
773
+ * ```
774
+ *
775
+ * `*-active` classes represent which styles you want to animate **to**, so it's
776
+ * important to add `transition` declaration only to them, otherwise transitions
777
+ * might not behave as intended! This might not be obvious when the transitions
778
+ * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in
779
+ * the example above (minus `transition`), but it becomes apparent in more
780
+ * complex transitions.
781
+ *
782
+ * **Note**: If you're using the
783
+ * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)
784
+ * prop, make sure to define styles for `.appear-*` classes as well.
785
+ */
786
+
787
+
788
+ var CSSTransition = /*#__PURE__*/function (_React$Component) {
789
+ _inheritsLoose(CSSTransition, _React$Component);
790
+
791
+ function CSSTransition() {
792
+ var _this;
793
+
794
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
795
+ args[_key] = arguments[_key];
796
+ }
797
+
798
+ _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
799
+ _this.appliedClasses = {
800
+ appear: {},
801
+ enter: {},
802
+ exit: {}
803
+ };
804
+
805
+ _this.onEnter = function (maybeNode, maybeAppearing) {
806
+ var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing),
807
+ node = _this$resolveArgument[0],
808
+ appearing = _this$resolveArgument[1];
809
+
810
+ _this.removeClasses(node, 'exit');
811
+
812
+ _this.addClass(node, appearing ? 'appear' : 'enter', 'base');
813
+
814
+ if (_this.props.onEnter) {
815
+ _this.props.onEnter(maybeNode, maybeAppearing);
816
+ }
817
+ };
818
+
819
+ _this.onEntering = function (maybeNode, maybeAppearing) {
820
+ var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing),
821
+ node = _this$resolveArgument2[0],
822
+ appearing = _this$resolveArgument2[1];
823
+
824
+ var type = appearing ? 'appear' : 'enter';
825
+
826
+ _this.addClass(node, type, 'active');
827
+
828
+ if (_this.props.onEntering) {
829
+ _this.props.onEntering(maybeNode, maybeAppearing);
830
+ }
831
+ };
832
+
833
+ _this.onEntered = function (maybeNode, maybeAppearing) {
834
+ var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing),
835
+ node = _this$resolveArgument3[0],
836
+ appearing = _this$resolveArgument3[1];
837
+
838
+ var type = appearing ? 'appear' : 'enter';
839
+
840
+ _this.removeClasses(node, type);
841
+
842
+ _this.addClass(node, type, 'done');
843
+
844
+ if (_this.props.onEntered) {
845
+ _this.props.onEntered(maybeNode, maybeAppearing);
846
+ }
847
+ };
848
+
849
+ _this.onExit = function (maybeNode) {
850
+ var _this$resolveArgument4 = _this.resolveArguments(maybeNode),
851
+ node = _this$resolveArgument4[0];
852
+
853
+ _this.removeClasses(node, 'appear');
854
+
855
+ _this.removeClasses(node, 'enter');
856
+
857
+ _this.addClass(node, 'exit', 'base');
858
+
859
+ if (_this.props.onExit) {
860
+ _this.props.onExit(maybeNode);
861
+ }
862
+ };
863
+
864
+ _this.onExiting = function (maybeNode) {
865
+ var _this$resolveArgument5 = _this.resolveArguments(maybeNode),
866
+ node = _this$resolveArgument5[0];
867
+
868
+ _this.addClass(node, 'exit', 'active');
869
+
870
+ if (_this.props.onExiting) {
871
+ _this.props.onExiting(maybeNode);
872
+ }
873
+ };
874
+
875
+ _this.onExited = function (maybeNode) {
876
+ var _this$resolveArgument6 = _this.resolveArguments(maybeNode),
877
+ node = _this$resolveArgument6[0];
878
+
879
+ _this.removeClasses(node, 'exit');
880
+
881
+ _this.addClass(node, 'exit', 'done');
882
+
883
+ if (_this.props.onExited) {
884
+ _this.props.onExited(maybeNode);
885
+ }
886
+ };
887
+
888
+ _this.resolveArguments = function (maybeNode, maybeAppearing) {
889
+ return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing`
890
+ : [maybeNode, maybeAppearing];
891
+ };
892
+
893
+ _this.getClassNames = function (type) {
894
+ var classNames = _this.props.classNames;
895
+ var isStringClassNames = typeof classNames === 'string';
896
+ var prefix = isStringClassNames && classNames ? classNames + "-" : '';
897
+ var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type];
898
+ var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"];
899
+ var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"];
900
+ return {
901
+ baseClassName: baseClassName,
902
+ activeClassName: activeClassName,
903
+ doneClassName: doneClassName
904
+ };
905
+ };
906
+
907
+ return _this;
908
+ }
909
+
910
+ var _proto = CSSTransition.prototype;
911
+
912
+ _proto.addClass = function addClass(node, type, phase) {
913
+ var className = this.getClassNames(type)[phase + "ClassName"];
914
+
915
+ var _this$getClassNames = this.getClassNames('enter'),
916
+ doneClassName = _this$getClassNames.doneClassName;
917
+
918
+ if (type === 'appear' && phase === 'done' && doneClassName) {
919
+ className += " " + doneClassName;
920
+ } // This is to force a repaint,
921
+ // which is necessary in order to transition styles when adding a class name.
922
+
923
+
924
+ if (phase === 'active') {
925
+ if (node) forceReflow(node);
926
+ }
927
+
928
+ if (className) {
929
+ this.appliedClasses[type][phase] = className;
930
+
931
+ _addClass(node, className);
932
+ }
933
+ };
934
+
935
+ _proto.removeClasses = function removeClasses(node, type) {
936
+ var _this$appliedClasses$ = this.appliedClasses[type],
937
+ baseClassName = _this$appliedClasses$.base,
938
+ activeClassName = _this$appliedClasses$.active,
939
+ doneClassName = _this$appliedClasses$.done;
940
+ this.appliedClasses[type] = {};
941
+
942
+ if (baseClassName) {
943
+ removeClass(node, baseClassName);
944
+ }
945
+
946
+ if (activeClassName) {
947
+ removeClass(node, activeClassName);
948
+ }
949
+
950
+ if (doneClassName) {
951
+ removeClass(node, doneClassName);
952
+ }
953
+ };
954
+
955
+ _proto.render = function render() {
956
+ var _this$props = this.props;
957
+ _this$props.classNames;
958
+ var props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]);
959
+
960
+ return /*#__PURE__*/React__default.createElement(Transition, _extends({}, props, {
961
+ onEnter: this.onEnter,
962
+ onEntered: this.onEntered,
963
+ onEntering: this.onEntering,
964
+ onExit: this.onExit,
965
+ onExiting: this.onExiting,
966
+ onExited: this.onExited
967
+ }));
968
+ };
969
+
970
+ return CSSTransition;
971
+ }(React__default.Component);
972
+
973
+ CSSTransition.defaultProps = {
974
+ classNames: ''
975
+ };
976
+ CSSTransition.propTypes = {};
977
+
978
+ function _assertThisInitialized(self) {
979
+ if (self === void 0) {
980
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
981
+ }
982
+ return self;
983
+ }
984
+
985
+ /**
986
+ * Given `this.props.children`, return an object mapping key to child.
987
+ *
988
+ * @param {*} children `this.props.children`
989
+ * @return {object} Mapping of key to child
990
+ */
991
+
992
+ function getChildMapping(children, mapFn) {
993
+ var mapper = function mapper(child) {
994
+ return mapFn && isValidElement(child) ? mapFn(child) : child;
995
+ };
996
+
997
+ var result = Object.create(null);
998
+ if (children) Children.map(children, function (c) {
999
+ return c;
1000
+ }).forEach(function (child) {
1001
+ // run the map function here instead so that the key is the computed one
1002
+ result[child.key] = mapper(child);
1003
+ });
1004
+ return result;
1005
+ }
1006
+ /**
1007
+ * When you're adding or removing children some may be added or removed in the
1008
+ * same render pass. We want to show *both* since we want to simultaneously
1009
+ * animate elements in and out. This function takes a previous set of keys
1010
+ * and a new set of keys and merges them with its best guess of the correct
1011
+ * ordering. In the future we may expose some of the utilities in
1012
+ * ReactMultiChild to make this easy, but for now React itself does not
1013
+ * directly have this concept of the union of prevChildren and nextChildren
1014
+ * so we implement it here.
1015
+ *
1016
+ * @param {object} prev prev children as returned from
1017
+ * `ReactTransitionChildMapping.getChildMapping()`.
1018
+ * @param {object} next next children as returned from
1019
+ * `ReactTransitionChildMapping.getChildMapping()`.
1020
+ * @return {object} a key set that contains all keys in `prev` and all keys
1021
+ * in `next` in a reasonable order.
1022
+ */
1023
+
1024
+ function mergeChildMappings(prev, next) {
1025
+ prev = prev || {};
1026
+ next = next || {};
1027
+
1028
+ function getValueForKey(key) {
1029
+ return key in next ? next[key] : prev[key];
1030
+ } // For each key of `next`, the list of keys to insert before that key in
1031
+ // the combined list
1032
+
1033
+
1034
+ var nextKeysPending = Object.create(null);
1035
+ var pendingKeys = [];
1036
+
1037
+ for (var prevKey in prev) {
1038
+ if (prevKey in next) {
1039
+ if (pendingKeys.length) {
1040
+ nextKeysPending[prevKey] = pendingKeys;
1041
+ pendingKeys = [];
1042
+ }
1043
+ } else {
1044
+ pendingKeys.push(prevKey);
1045
+ }
1046
+ }
1047
+
1048
+ var i;
1049
+ var childMapping = {};
1050
+
1051
+ for (var nextKey in next) {
1052
+ if (nextKeysPending[nextKey]) {
1053
+ for (i = 0; i < nextKeysPending[nextKey].length; i++) {
1054
+ var pendingNextKey = nextKeysPending[nextKey][i];
1055
+ childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
1056
+ }
1057
+ }
1058
+
1059
+ childMapping[nextKey] = getValueForKey(nextKey);
1060
+ } // Finally, add the keys which didn't appear before any key in `next`
1061
+
1062
+
1063
+ for (i = 0; i < pendingKeys.length; i++) {
1064
+ childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
1065
+ }
1066
+
1067
+ return childMapping;
1068
+ }
1069
+
1070
+ function getProp(child, prop, props) {
1071
+ return props[prop] != null ? props[prop] : child.props[prop];
1072
+ }
1073
+
1074
+ function getInitialChildMapping(props, onExited) {
1075
+ return getChildMapping(props.children, function (child) {
1076
+ return cloneElement(child, {
1077
+ onExited: onExited.bind(null, child),
1078
+ in: true,
1079
+ appear: getProp(child, 'appear', props),
1080
+ enter: getProp(child, 'enter', props),
1081
+ exit: getProp(child, 'exit', props)
1082
+ });
1083
+ });
1084
+ }
1085
+ function getNextChildMapping(nextProps, prevChildMapping, onExited) {
1086
+ var nextChildMapping = getChildMapping(nextProps.children);
1087
+ var children = mergeChildMappings(prevChildMapping, nextChildMapping);
1088
+ Object.keys(children).forEach(function (key) {
1089
+ var child = children[key];
1090
+ if (!isValidElement(child)) return;
1091
+ var hasPrev = (key in prevChildMapping);
1092
+ var hasNext = (key in nextChildMapping);
1093
+ var prevChild = prevChildMapping[key];
1094
+ var isLeaving = isValidElement(prevChild) && !prevChild.props.in; // item is new (entering)
1095
+
1096
+ if (hasNext && (!hasPrev || isLeaving)) {
1097
+ // console.log('entering', key)
1098
+ children[key] = cloneElement(child, {
1099
+ onExited: onExited.bind(null, child),
1100
+ in: true,
1101
+ exit: getProp(child, 'exit', nextProps),
1102
+ enter: getProp(child, 'enter', nextProps)
1103
+ });
1104
+ } else if (!hasNext && hasPrev && !isLeaving) {
1105
+ // item is old (exiting)
1106
+ // console.log('leaving', key)
1107
+ children[key] = cloneElement(child, {
1108
+ in: false
1109
+ });
1110
+ } else if (hasNext && hasPrev && isValidElement(prevChild)) {
1111
+ // item hasn't changed transition states
1112
+ // copy over the last transition props;
1113
+ // console.log('unchanged', key)
1114
+ children[key] = cloneElement(child, {
1115
+ onExited: onExited.bind(null, child),
1116
+ in: prevChild.props.in,
1117
+ exit: getProp(child, 'exit', nextProps),
1118
+ enter: getProp(child, 'enter', nextProps)
1119
+ });
1120
+ }
1121
+ });
1122
+ return children;
1123
+ }
1124
+
1125
+ var values = Object.values || function (obj) {
1126
+ return Object.keys(obj).map(function (k) {
1127
+ return obj[k];
1128
+ });
1129
+ };
1130
+
1131
+ var defaultProps = {
1132
+ component: 'div',
1133
+ childFactory: function childFactory(child) {
1134
+ return child;
1135
+ }
1136
+ };
1137
+ /**
1138
+ * The `<TransitionGroup>` component manages a set of transition components
1139
+ * (`<Transition>` and `<CSSTransition>`) in a list. Like with the transition
1140
+ * components, `<TransitionGroup>` is a state machine for managing the mounting
1141
+ * and unmounting of components over time.
1142
+ *
1143
+ * Consider the example below. As items are removed or added to the TodoList the
1144
+ * `in` prop is toggled automatically by the `<TransitionGroup>`.
1145
+ *
1146
+ * Note that `<TransitionGroup>` does not define any animation behavior!
1147
+ * Exactly _how_ a list item animates is up to the individual transition
1148
+ * component. This means you can mix and match animations across different list
1149
+ * items.
1150
+ */
1151
+
1152
+ var TransitionGroup = /*#__PURE__*/function (_React$Component) {
1153
+ _inheritsLoose(TransitionGroup, _React$Component);
1154
+
1155
+ function TransitionGroup(props, context) {
1156
+ var _this;
1157
+
1158
+ _this = _React$Component.call(this, props, context) || this;
1159
+
1160
+ var handleExited = _this.handleExited.bind(_assertThisInitialized(_this)); // Initial children should all be entering, dependent on appear
1161
+
1162
+
1163
+ _this.state = {
1164
+ contextValue: {
1165
+ isMounting: true
1166
+ },
1167
+ handleExited: handleExited,
1168
+ firstRender: true
1169
+ };
1170
+ return _this;
1171
+ }
1172
+
1173
+ var _proto = TransitionGroup.prototype;
1174
+
1175
+ _proto.componentDidMount = function componentDidMount() {
1176
+ this.mounted = true;
1177
+ this.setState({
1178
+ contextValue: {
1179
+ isMounting: false
1180
+ }
1181
+ });
1182
+ };
1183
+
1184
+ _proto.componentWillUnmount = function componentWillUnmount() {
1185
+ this.mounted = false;
1186
+ };
1187
+
1188
+ TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
1189
+ var prevChildMapping = _ref.children,
1190
+ handleExited = _ref.handleExited,
1191
+ firstRender = _ref.firstRender;
1192
+ return {
1193
+ children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),
1194
+ firstRender: false
1195
+ };
1196
+ } // node is `undefined` when user provided `nodeRef` prop
1197
+ ;
1198
+
1199
+ _proto.handleExited = function handleExited(child, node) {
1200
+ var currentChildMapping = getChildMapping(this.props.children);
1201
+ if (child.key in currentChildMapping) return;
1202
+
1203
+ if (child.props.onExited) {
1204
+ child.props.onExited(node);
1205
+ }
1206
+
1207
+ if (this.mounted) {
1208
+ this.setState(function (state) {
1209
+ var children = _extends({}, state.children);
1210
+
1211
+ delete children[child.key];
1212
+ return {
1213
+ children: children
1214
+ };
1215
+ });
1216
+ }
1217
+ };
1218
+
1219
+ _proto.render = function render() {
1220
+ var _this$props = this.props,
1221
+ Component = _this$props.component,
1222
+ childFactory = _this$props.childFactory,
1223
+ props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
1224
+
1225
+ var contextValue = this.state.contextValue;
1226
+ var children = values(this.state.children).map(childFactory);
1227
+ delete props.appear;
1228
+ delete props.enter;
1229
+ delete props.exit;
1230
+
1231
+ if (Component === null) {
1232
+ return /*#__PURE__*/React__default.createElement(TransitionGroupContext.Provider, {
1233
+ value: contextValue
1234
+ }, children);
1235
+ }
1236
+
1237
+ return /*#__PURE__*/React__default.createElement(TransitionGroupContext.Provider, {
1238
+ value: contextValue
1239
+ }, /*#__PURE__*/React__default.createElement(Component, props, children));
1240
+ };
1241
+
1242
+ return TransitionGroup;
1243
+ }(React__default.Component);
1244
+
1245
+ TransitionGroup.propTypes = {};
1246
+ TransitionGroup.defaultProps = defaultProps;
1247
+
1248
+ /**
1249
+ * The `<ReplaceTransition>` component is a specialized `Transition` component
1250
+ * that animates between two children.
1251
+ *
1252
+ * ```jsx
1253
+ * <ReplaceTransition in>
1254
+ * <Fade><div>I appear first</div></Fade>
1255
+ * <Fade><div>I replace the above</div></Fade>
1256
+ * </ReplaceTransition>
1257
+ * ```
1258
+ */
1259
+
1260
+ var ReplaceTransition = /*#__PURE__*/function (_React$Component) {
1261
+ _inheritsLoose(ReplaceTransition, _React$Component);
1262
+
1263
+ function ReplaceTransition() {
1264
+ var _this;
1265
+
1266
+ for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
1267
+ _args[_key] = arguments[_key];
1268
+ }
1269
+
1270
+ _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
1271
+
1272
+ _this.handleEnter = function () {
1273
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1274
+ args[_key2] = arguments[_key2];
1275
+ }
1276
+
1277
+ return _this.handleLifecycle('onEnter', 0, args);
1278
+ };
1279
+
1280
+ _this.handleEntering = function () {
1281
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1282
+ args[_key3] = arguments[_key3];
1283
+ }
1284
+
1285
+ return _this.handleLifecycle('onEntering', 0, args);
1286
+ };
1287
+
1288
+ _this.handleEntered = function () {
1289
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1290
+ args[_key4] = arguments[_key4];
1291
+ }
1292
+
1293
+ return _this.handleLifecycle('onEntered', 0, args);
1294
+ };
1295
+
1296
+ _this.handleExit = function () {
1297
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1298
+ args[_key5] = arguments[_key5];
1299
+ }
1300
+
1301
+ return _this.handleLifecycle('onExit', 1, args);
1302
+ };
1303
+
1304
+ _this.handleExiting = function () {
1305
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
1306
+ args[_key6] = arguments[_key6];
1307
+ }
1308
+
1309
+ return _this.handleLifecycle('onExiting', 1, args);
1310
+ };
1311
+
1312
+ _this.handleExited = function () {
1313
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
1314
+ args[_key7] = arguments[_key7];
1315
+ }
1316
+
1317
+ return _this.handleLifecycle('onExited', 1, args);
1318
+ };
1319
+
1320
+ return _this;
1321
+ }
1322
+
1323
+ var _proto = ReplaceTransition.prototype;
1324
+
1325
+ _proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
1326
+ var _child$props;
1327
+
1328
+ var children = this.props.children;
1329
+ var child = React__default.Children.toArray(children)[idx];
1330
+ if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
1331
+
1332
+ if (this.props[handler]) {
1333
+ var maybeNode = child.props.nodeRef ? undefined : ReactDOM__default.findDOMNode(this);
1334
+ this.props[handler](maybeNode);
1335
+ }
1336
+ };
1337
+
1338
+ _proto.render = function render() {
1339
+ var _this$props = this.props,
1340
+ children = _this$props.children,
1341
+ inProp = _this$props.in,
1342
+ props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]);
1343
+
1344
+ var _React$Children$toArr = React__default.Children.toArray(children),
1345
+ first = _React$Children$toArr[0],
1346
+ second = _React$Children$toArr[1];
1347
+
1348
+ delete props.onEnter;
1349
+ delete props.onEntering;
1350
+ delete props.onEntered;
1351
+ delete props.onExit;
1352
+ delete props.onExiting;
1353
+ delete props.onExited;
1354
+ return /*#__PURE__*/React__default.createElement(TransitionGroup, props, inProp ? React__default.cloneElement(first, {
1355
+ key: 'first',
1356
+ onEnter: this.handleEnter,
1357
+ onEntering: this.handleEntering,
1358
+ onEntered: this.handleEntered
1359
+ }) : React__default.cloneElement(second, {
1360
+ key: 'second',
1361
+ onEnter: this.handleExit,
1362
+ onEntering: this.handleExiting,
1363
+ onEntered: this.handleExited
1364
+ }));
1365
+ };
1366
+
1367
+ return ReplaceTransition;
1368
+ }(React__default.Component);
1369
+
1370
+ ReplaceTransition.propTypes = {};
1371
+
1372
+ var _leaveRenders, _enterRenders;
1373
+
1374
+ function areChildrenDifferent(oldChildren, newChildren) {
1375
+ if (oldChildren === newChildren) return false;
1376
+
1377
+ if (React__default.isValidElement(oldChildren) && React__default.isValidElement(newChildren) && oldChildren.key != null && oldChildren.key === newChildren.key) {
1378
+ return false;
1379
+ }
1380
+
1381
+ return true;
1382
+ }
1383
+ /**
1384
+ * Enum of modes for SwitchTransition component
1385
+ * @enum { string }
1386
+ */
1387
+
1388
+
1389
+ var modes = {
1390
+ out: 'out-in',
1391
+ in: 'in-out'
1392
+ };
1393
+
1394
+ var callHook = function callHook(element, name, cb) {
1395
+ return function () {
1396
+ var _element$props;
1397
+
1398
+ element.props[name] && (_element$props = element.props)[name].apply(_element$props, arguments);
1399
+ cb();
1400
+ };
1401
+ };
1402
+
1403
+ var leaveRenders = (_leaveRenders = {}, _leaveRenders[modes.out] = function (_ref) {
1404
+ var current = _ref.current,
1405
+ changeState = _ref.changeState;
1406
+ return React__default.cloneElement(current, {
1407
+ in: false,
1408
+ onExited: callHook(current, 'onExited', function () {
1409
+ changeState(ENTERING, null);
1410
+ })
1411
+ });
1412
+ }, _leaveRenders[modes.in] = function (_ref2) {
1413
+ var current = _ref2.current,
1414
+ changeState = _ref2.changeState,
1415
+ children = _ref2.children;
1416
+ return [current, React__default.cloneElement(children, {
1417
+ in: true,
1418
+ onEntered: callHook(children, 'onEntered', function () {
1419
+ changeState(ENTERING);
1420
+ })
1421
+ })];
1422
+ }, _leaveRenders);
1423
+ var enterRenders = (_enterRenders = {}, _enterRenders[modes.out] = function (_ref3) {
1424
+ var children = _ref3.children,
1425
+ changeState = _ref3.changeState;
1426
+ return React__default.cloneElement(children, {
1427
+ in: true,
1428
+ onEntered: callHook(children, 'onEntered', function () {
1429
+ changeState(ENTERED, React__default.cloneElement(children, {
1430
+ in: true
1431
+ }));
1432
+ })
1433
+ });
1434
+ }, _enterRenders[modes.in] = function (_ref4) {
1435
+ var current = _ref4.current,
1436
+ children = _ref4.children,
1437
+ changeState = _ref4.changeState;
1438
+ return [React__default.cloneElement(current, {
1439
+ in: false,
1440
+ onExited: callHook(current, 'onExited', function () {
1441
+ changeState(ENTERED, React__default.cloneElement(children, {
1442
+ in: true
1443
+ }));
1444
+ })
1445
+ }), React__default.cloneElement(children, {
1446
+ in: true
1447
+ })];
1448
+ }, _enterRenders);
1449
+ /**
1450
+ * A transition component inspired by the [vue transition modes](https://vuejs.org/v2/guide/transitions.html#Transition-Modes).
1451
+ * You can use it when you want to control the render between state transitions.
1452
+ * Based on the selected mode and the child's key which is the `Transition` or `CSSTransition` component, the `SwitchTransition` makes a consistent transition between them.
1453
+ *
1454
+ * If the `out-in` mode is selected, the `SwitchTransition` waits until the old child leaves and then inserts a new child.
1455
+ * If the `in-out` mode is selected, the `SwitchTransition` inserts a new child first, waits for the new child to enter and then removes the old child.
1456
+ *
1457
+ * **Note**: If you want the animation to happen simultaneously
1458
+ * (that is, to have the old child removed and a new child inserted **at the same time**),
1459
+ * you should use
1460
+ * [`TransitionGroup`](https://reactcommunity.org/react-transition-group/transition-group)
1461
+ * instead.
1462
+ *
1463
+ * ```jsx
1464
+ * function App() {
1465
+ * const [state, setState] = useState(false);
1466
+ * return (
1467
+ * <SwitchTransition>
1468
+ * <CSSTransition
1469
+ * key={state ? "Goodbye, world!" : "Hello, world!"}
1470
+ * addEndListener={(node, done) => node.addEventListener("transitionend", done, false)}
1471
+ * classNames='fade'
1472
+ * >
1473
+ * <button onClick={() => setState(state => !state)}>
1474
+ * {state ? "Goodbye, world!" : "Hello, world!"}
1475
+ * </button>
1476
+ * </CSSTransition>
1477
+ * </SwitchTransition>
1478
+ * );
1479
+ * }
1480
+ * ```
1481
+ *
1482
+ * ```css
1483
+ * .fade-enter{
1484
+ * opacity: 0;
1485
+ * }
1486
+ * .fade-exit{
1487
+ * opacity: 1;
1488
+ * }
1489
+ * .fade-enter-active{
1490
+ * opacity: 1;
1491
+ * }
1492
+ * .fade-exit-active{
1493
+ * opacity: 0;
1494
+ * }
1495
+ * .fade-enter-active,
1496
+ * .fade-exit-active{
1497
+ * transition: opacity 500ms;
1498
+ * }
1499
+ * ```
1500
+ */
1501
+
1502
+ var SwitchTransition = /*#__PURE__*/function (_React$Component) {
1503
+ _inheritsLoose(SwitchTransition, _React$Component);
1504
+
1505
+ function SwitchTransition() {
1506
+ var _this;
1507
+
1508
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1509
+ args[_key] = arguments[_key];
1510
+ }
1511
+
1512
+ _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
1513
+ _this.state = {
1514
+ status: ENTERED,
1515
+ current: null
1516
+ };
1517
+ _this.appeared = false;
1518
+
1519
+ _this.changeState = function (status, current) {
1520
+ if (current === void 0) {
1521
+ current = _this.state.current;
1522
+ }
1523
+
1524
+ _this.setState({
1525
+ status: status,
1526
+ current: current
1527
+ });
1528
+ };
1529
+
1530
+ return _this;
1531
+ }
1532
+
1533
+ var _proto = SwitchTransition.prototype;
1534
+
1535
+ _proto.componentDidMount = function componentDidMount() {
1536
+ this.appeared = true;
1537
+ };
1538
+
1539
+ SwitchTransition.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
1540
+ if (props.children == null) {
1541
+ return {
1542
+ current: null
1543
+ };
1544
+ }
1545
+
1546
+ if (state.status === ENTERING && props.mode === modes.in) {
1547
+ return {
1548
+ status: ENTERING
1549
+ };
1550
+ }
1551
+
1552
+ if (state.current && areChildrenDifferent(state.current, props.children)) {
1553
+ return {
1554
+ status: EXITING
1555
+ };
1556
+ }
1557
+
1558
+ return {
1559
+ current: React__default.cloneElement(props.children, {
1560
+ in: true
1561
+ })
1562
+ };
1563
+ };
1564
+
1565
+ _proto.render = function render() {
1566
+ var _this$props = this.props,
1567
+ children = _this$props.children,
1568
+ mode = _this$props.mode,
1569
+ _this$state = this.state,
1570
+ status = _this$state.status,
1571
+ current = _this$state.current;
1572
+ var data = {
1573
+ children: children,
1574
+ current: current,
1575
+ changeState: this.changeState,
1576
+ status: status
1577
+ };
1578
+ var component;
1579
+
1580
+ switch (status) {
1581
+ case ENTERING:
1582
+ component = enterRenders[mode](data);
1583
+ break;
1584
+
1585
+ case EXITING:
1586
+ component = leaveRenders[mode](data);
1587
+ break;
1588
+
1589
+ case ENTERED:
1590
+ component = current;
1591
+ }
1592
+
1593
+ return /*#__PURE__*/React__default.createElement(TransitionGroupContext.Provider, {
1594
+ value: {
1595
+ isMounting: !this.appeared
1596
+ }
1597
+ }, component);
1598
+ };
1599
+
1600
+ return SwitchTransition;
1601
+ }(React__default.Component);
1602
+
1603
+ SwitchTransition.propTypes = {};
1604
+ SwitchTransition.defaultProps = {
1605
+ mode: modes.out
1606
+ };
1607
+
1608
+ var useEnhancedEffect$2 = typeof window === 'undefined' ? React$2.useEffect : React$2.useLayoutEffect;
1609
+ /**
1610
+ * @ignore - internal component.
1611
+ */
1612
+
1613
+ function Ripple(props) {
1614
+ var classes = props.classes,
1615
+ _props$pulsate = props.pulsate,
1616
+ pulsate = _props$pulsate === void 0 ? false : _props$pulsate,
1617
+ rippleX = props.rippleX,
1618
+ rippleY = props.rippleY,
1619
+ rippleSize = props.rippleSize,
1620
+ inProp = props.in,
1621
+ _props$onExited = props.onExited,
1622
+ onExited = _props$onExited === void 0 ? function () {} : _props$onExited,
1623
+ timeout = props.timeout;
1624
+
1625
+ var _React$useState = React$2.useState(false),
1626
+ leaving = _React$useState[0],
1627
+ setLeaving = _React$useState[1];
1628
+
1629
+ var rippleClassName = clsx(classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);
1630
+ var rippleStyles = {
1631
+ width: rippleSize,
1632
+ height: rippleSize,
1633
+ top: -(rippleSize / 2) + rippleY,
1634
+ left: -(rippleSize / 2) + rippleX
1635
+ };
1636
+ var childClassName = clsx(classes.child, leaving && classes.childLeaving, pulsate && classes.childPulsate);
1637
+ var handleExited = useEventCallback(onExited); // Ripple is used for user feedback (e.g. click or press) so we want to apply styles with the highest priority
1638
+
1639
+ useEnhancedEffect$2(function () {
1640
+ if (!inProp) {
1641
+ // react-transition-group#onExit
1642
+ setLeaving(true); // react-transition-group#onExited
1643
+
1644
+ var timeoutId = setTimeout(handleExited, timeout);
1645
+ return function () {
1646
+ clearTimeout(timeoutId);
1647
+ };
1648
+ }
1649
+
1650
+ return undefined;
1651
+ }, [handleExited, inProp, timeout]);
1652
+ return /*#__PURE__*/React$2.createElement("span", {
1653
+ className: rippleClassName,
1654
+ style: rippleStyles
1655
+ }, /*#__PURE__*/React$2.createElement("span", {
1656
+ className: childClassName
1657
+ }));
1658
+ }
1659
+
1660
+ var DURATION = 550;
1661
+ var DELAY_RIPPLE = 80;
1662
+ var styles$7 = function styles(theme) {
1663
+ return {
1664
+ /* Styles applied to the root element. */
1665
+ root: {
1666
+ overflow: 'hidden',
1667
+ pointerEvents: 'none',
1668
+ position: 'absolute',
1669
+ zIndex: 0,
1670
+ top: 0,
1671
+ right: 0,
1672
+ bottom: 0,
1673
+ left: 0,
1674
+ borderRadius: 'inherit'
1675
+ },
1676
+
1677
+ /* Styles applied to the internal `Ripple` components `ripple` class. */
1678
+ ripple: {
1679
+ opacity: 0,
1680
+ position: 'absolute'
1681
+ },
1682
+
1683
+ /* Styles applied to the internal `Ripple` components `rippleVisible` class. */
1684
+ rippleVisible: {
1685
+ opacity: 0.3,
1686
+ transform: 'scale(1)',
1687
+ animation: "$enter ".concat(DURATION, "ms ").concat(theme.transitions.easing.easeInOut)
1688
+ },
1689
+
1690
+ /* Styles applied to the internal `Ripple` components `ripplePulsate` class. */
1691
+ ripplePulsate: {
1692
+ animationDuration: "".concat(theme.transitions.duration.shorter, "ms")
1693
+ },
1694
+
1695
+ /* Styles applied to the internal `Ripple` components `child` class. */
1696
+ child: {
1697
+ opacity: 1,
1698
+ display: 'block',
1699
+ width: '100%',
1700
+ height: '100%',
1701
+ borderRadius: '50%',
1702
+ backgroundColor: 'currentColor'
1703
+ },
1704
+
1705
+ /* Styles applied to the internal `Ripple` components `childLeaving` class. */
1706
+ childLeaving: {
1707
+ opacity: 0,
1708
+ animation: "$exit ".concat(DURATION, "ms ").concat(theme.transitions.easing.easeInOut)
1709
+ },
1710
+
1711
+ /* Styles applied to the internal `Ripple` components `childPulsate` class. */
1712
+ childPulsate: {
1713
+ position: 'absolute',
1714
+ left: 0,
1715
+ top: 0,
1716
+ animation: "$pulsate 2500ms ".concat(theme.transitions.easing.easeInOut, " 200ms infinite")
1717
+ },
1718
+ '@keyframes enter': {
1719
+ '0%': {
1720
+ transform: 'scale(0)',
1721
+ opacity: 0.1
1722
+ },
1723
+ '100%': {
1724
+ transform: 'scale(1)',
1725
+ opacity: 0.3
1726
+ }
1727
+ },
1728
+ '@keyframes exit': {
1729
+ '0%': {
1730
+ opacity: 1
1731
+ },
1732
+ '100%': {
1733
+ opacity: 0
1734
+ }
1735
+ },
1736
+ '@keyframes pulsate': {
1737
+ '0%': {
1738
+ transform: 'scale(1)'
1739
+ },
1740
+ '50%': {
1741
+ transform: 'scale(0.92)'
1742
+ },
1743
+ '100%': {
1744
+ transform: 'scale(1)'
1745
+ }
1746
+ }
1747
+ };
1748
+ };
1749
+ /**
1750
+ * @ignore - internal component.
1751
+ *
1752
+ * TODO v5: Make private
1753
+ */
1754
+
1755
+ var TouchRipple = /*#__PURE__*/React$2.forwardRef(function TouchRipple(props, ref) {
1756
+ var _props$center = props.center,
1757
+ centerProp = _props$center === void 0 ? false : _props$center,
1758
+ classes = props.classes,
1759
+ className = props.className,
1760
+ other = _objectWithoutProperties(props, ["center", "classes", "className"]);
1761
+
1762
+ var _React$useState = React$2.useState([]),
1763
+ ripples = _React$useState[0],
1764
+ setRipples = _React$useState[1];
1765
+
1766
+ var nextKey = React$2.useRef(0);
1767
+ var rippleCallback = React$2.useRef(null);
1768
+ React$2.useEffect(function () {
1769
+ if (rippleCallback.current) {
1770
+ rippleCallback.current();
1771
+ rippleCallback.current = null;
1772
+ }
1773
+ }, [ripples]); // Used to filter out mouse emulated events on mobile.
1774
+
1775
+ var ignoringMouseDown = React$2.useRef(false); // We use a timer in order to only show the ripples for touch "click" like events.
1776
+ // We don't want to display the ripple for touch scroll events.
1777
+
1778
+ var startTimer = React$2.useRef(null); // This is the hook called once the previous timeout is ready.
1779
+
1780
+ var startTimerCommit = React$2.useRef(null);
1781
+ var container = React$2.useRef(null);
1782
+ React$2.useEffect(function () {
1783
+ return function () {
1784
+ clearTimeout(startTimer.current);
1785
+ };
1786
+ }, []);
1787
+ var startCommit = React$2.useCallback(function (params) {
1788
+ var pulsate = params.pulsate,
1789
+ rippleX = params.rippleX,
1790
+ rippleY = params.rippleY,
1791
+ rippleSize = params.rippleSize,
1792
+ cb = params.cb;
1793
+ setRipples(function (oldRipples) {
1794
+ return [].concat(_toConsumableArray(oldRipples), [/*#__PURE__*/React$2.createElement(Ripple, {
1795
+ key: nextKey.current,
1796
+ classes: classes,
1797
+ timeout: DURATION,
1798
+ pulsate: pulsate,
1799
+ rippleX: rippleX,
1800
+ rippleY: rippleY,
1801
+ rippleSize: rippleSize
1802
+ })]);
1803
+ });
1804
+ nextKey.current += 1;
1805
+ rippleCallback.current = cb;
1806
+ }, [classes]);
1807
+ var start = React$2.useCallback(function () {
1808
+ var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1809
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1810
+ var cb = arguments.length > 2 ? arguments[2] : undefined;
1811
+ var _options$pulsate = options.pulsate,
1812
+ pulsate = _options$pulsate === void 0 ? false : _options$pulsate,
1813
+ _options$center = options.center,
1814
+ center = _options$center === void 0 ? centerProp || options.pulsate : _options$center,
1815
+ _options$fakeElement = options.fakeElement,
1816
+ fakeElement = _options$fakeElement === void 0 ? false : _options$fakeElement;
1817
+
1818
+ if (event.type === 'mousedown' && ignoringMouseDown.current) {
1819
+ ignoringMouseDown.current = false;
1820
+ return;
1821
+ }
1822
+
1823
+ if (event.type === 'touchstart') {
1824
+ ignoringMouseDown.current = true;
1825
+ }
1826
+
1827
+ var element = fakeElement ? null : container.current;
1828
+ var rect = element ? element.getBoundingClientRect() : {
1829
+ width: 0,
1830
+ height: 0,
1831
+ left: 0,
1832
+ top: 0
1833
+ }; // Get the size of the ripple
1834
+
1835
+ var rippleX;
1836
+ var rippleY;
1837
+ var rippleSize;
1838
+
1839
+ if (center || event.clientX === 0 && event.clientY === 0 || !event.clientX && !event.touches) {
1840
+ rippleX = Math.round(rect.width / 2);
1841
+ rippleY = Math.round(rect.height / 2);
1842
+ } else {
1843
+ var _ref = event.touches ? event.touches[0] : event,
1844
+ clientX = _ref.clientX,
1845
+ clientY = _ref.clientY;
1846
+
1847
+ rippleX = Math.round(clientX - rect.left);
1848
+ rippleY = Math.round(clientY - rect.top);
1849
+ }
1850
+
1851
+ if (center) {
1852
+ rippleSize = Math.sqrt((2 * Math.pow(rect.width, 2) + Math.pow(rect.height, 2)) / 3); // For some reason the animation is broken on Mobile Chrome if the size if even.
1853
+
1854
+ if (rippleSize % 2 === 0) {
1855
+ rippleSize += 1;
1856
+ }
1857
+ } else {
1858
+ var sizeX = Math.max(Math.abs((element ? element.clientWidth : 0) - rippleX), rippleX) * 2 + 2;
1859
+ var sizeY = Math.max(Math.abs((element ? element.clientHeight : 0) - rippleY), rippleY) * 2 + 2;
1860
+ rippleSize = Math.sqrt(Math.pow(sizeX, 2) + Math.pow(sizeY, 2));
1861
+ } // Touche devices
1862
+
1863
+
1864
+ if (event.touches) {
1865
+ // check that this isn't another touchstart due to multitouch
1866
+ // otherwise we will only clear a single timer when unmounting while two
1867
+ // are running
1868
+ if (startTimerCommit.current === null) {
1869
+ // Prepare the ripple effect.
1870
+ startTimerCommit.current = function () {
1871
+ startCommit({
1872
+ pulsate: pulsate,
1873
+ rippleX: rippleX,
1874
+ rippleY: rippleY,
1875
+ rippleSize: rippleSize,
1876
+ cb: cb
1877
+ });
1878
+ }; // Delay the execution of the ripple effect.
1879
+
1880
+
1881
+ startTimer.current = setTimeout(function () {
1882
+ if (startTimerCommit.current) {
1883
+ startTimerCommit.current();
1884
+ startTimerCommit.current = null;
1885
+ }
1886
+ }, DELAY_RIPPLE); // We have to make a tradeoff with this value.
1887
+ }
1888
+ } else {
1889
+ startCommit({
1890
+ pulsate: pulsate,
1891
+ rippleX: rippleX,
1892
+ rippleY: rippleY,
1893
+ rippleSize: rippleSize,
1894
+ cb: cb
1895
+ });
1896
+ }
1897
+ }, [centerProp, startCommit]);
1898
+ var pulsate = React$2.useCallback(function () {
1899
+ start({}, {
1900
+ pulsate: true
1901
+ });
1902
+ }, [start]);
1903
+ var stop = React$2.useCallback(function (event, cb) {
1904
+ clearTimeout(startTimer.current); // The touch interaction occurs too quickly.
1905
+ // We still want to show ripple effect.
1906
+
1907
+ if (event.type === 'touchend' && startTimerCommit.current) {
1908
+ event.persist();
1909
+ startTimerCommit.current();
1910
+ startTimerCommit.current = null;
1911
+ startTimer.current = setTimeout(function () {
1912
+ stop(event, cb);
1913
+ });
1914
+ return;
1915
+ }
1916
+
1917
+ startTimerCommit.current = null;
1918
+ setRipples(function (oldRipples) {
1919
+ if (oldRipples.length > 0) {
1920
+ return oldRipples.slice(1);
1921
+ }
1922
+
1923
+ return oldRipples;
1924
+ });
1925
+ rippleCallback.current = cb;
1926
+ }, []);
1927
+ React$2.useImperativeHandle(ref, function () {
1928
+ return {
1929
+ pulsate: pulsate,
1930
+ start: start,
1931
+ stop: stop
1932
+ };
1933
+ }, [pulsate, start, stop]);
1934
+ return /*#__PURE__*/React$2.createElement("span", _extends({
1935
+ className: clsx(classes.root, className),
1936
+ ref: container
1937
+ }, other), /*#__PURE__*/React$2.createElement(TransitionGroup, {
1938
+ component: null,
1939
+ exit: true
1940
+ }, ripples));
1941
+ });
1942
+ var TouchRipple$1 = withStyles(styles$7, {
1943
+ flip: false,
1944
+ name: 'MuiTouchRipple'
1945
+ })( /*#__PURE__*/React$2.memo(TouchRipple));
1946
+
1947
+ var styles$6 = {
1948
+ /* Styles applied to the root element. */
1949
+ root: {
1950
+ display: 'inline-flex',
1951
+ alignItems: 'center',
1952
+ justifyContent: 'center',
1953
+ position: 'relative',
1954
+ WebkitTapHighlightColor: 'transparent',
1955
+ backgroundColor: 'transparent',
1956
+ // Reset default value
1957
+ // We disable the focus ring for mouse, touch and keyboard users.
1958
+ outline: 0,
1959
+ border: 0,
1960
+ margin: 0,
1961
+ // Remove the margin in Safari
1962
+ borderRadius: 0,
1963
+ padding: 0,
1964
+ // Remove the padding in Firefox
1965
+ cursor: 'pointer',
1966
+ userSelect: 'none',
1967
+ verticalAlign: 'middle',
1968
+ '-moz-appearance': 'none',
1969
+ // Reset
1970
+ '-webkit-appearance': 'none',
1971
+ // Reset
1972
+ textDecoration: 'none',
1973
+ // So we take precedent over the style of a native <a /> element.
1974
+ color: 'inherit',
1975
+ '&::-moz-focus-inner': {
1976
+ borderStyle: 'none' // Remove Firefox dotted outline.
1977
+
1978
+ },
1979
+ '&$disabled': {
1980
+ pointerEvents: 'none',
1981
+ // Disable link interactions
1982
+ cursor: 'default'
1983
+ },
1984
+ '@media print': {
1985
+ colorAdjust: 'exact'
1986
+ }
1987
+ },
1988
+
1989
+ /* Pseudo-class applied to the root element if `disabled={true}`. */
1990
+ disabled: {},
1991
+
1992
+ /* Pseudo-class applied to the root element if keyboard focused. */
1993
+ focusVisible: {}
1994
+ };
1995
+ /**
1996
+ * `ButtonBase` contains as few styles as possible.
1997
+ * It aims to be a simple building block for creating a button.
1998
+ * It contains a load of style reset and some focus/ripple logic.
1999
+ */
2000
+
2001
+ var ButtonBase = /*#__PURE__*/React$2.forwardRef(function ButtonBase(props, ref) {
2002
+ var action = props.action,
2003
+ buttonRefProp = props.buttonRef,
2004
+ _props$centerRipple = props.centerRipple,
2005
+ centerRipple = _props$centerRipple === void 0 ? false : _props$centerRipple,
2006
+ children = props.children,
2007
+ classes = props.classes,
2008
+ className = props.className,
2009
+ _props$component = props.component,
2010
+ component = _props$component === void 0 ? 'button' : _props$component,
2011
+ _props$disabled = props.disabled,
2012
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
2013
+ _props$disableRipple = props.disableRipple,
2014
+ disableRipple = _props$disableRipple === void 0 ? false : _props$disableRipple,
2015
+ _props$disableTouchRi = props.disableTouchRipple,
2016
+ disableTouchRipple = _props$disableTouchRi === void 0 ? false : _props$disableTouchRi,
2017
+ _props$focusRipple = props.focusRipple,
2018
+ focusRipple = _props$focusRipple === void 0 ? false : _props$focusRipple,
2019
+ focusVisibleClassName = props.focusVisibleClassName,
2020
+ onBlur = props.onBlur,
2021
+ onClick = props.onClick,
2022
+ onFocus = props.onFocus,
2023
+ onFocusVisible = props.onFocusVisible,
2024
+ onKeyDown = props.onKeyDown,
2025
+ onKeyUp = props.onKeyUp,
2026
+ onMouseDown = props.onMouseDown,
2027
+ onMouseLeave = props.onMouseLeave,
2028
+ onMouseUp = props.onMouseUp,
2029
+ onTouchEnd = props.onTouchEnd,
2030
+ onTouchMove = props.onTouchMove,
2031
+ onTouchStart = props.onTouchStart,
2032
+ onDragLeave = props.onDragLeave,
2033
+ _props$tabIndex = props.tabIndex,
2034
+ tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,
2035
+ TouchRippleProps = props.TouchRippleProps,
2036
+ _props$type = props.type,
2037
+ type = _props$type === void 0 ? 'button' : _props$type,
2038
+ other = _objectWithoutProperties(props, ["action", "buttonRef", "centerRipple", "children", "classes", "className", "component", "disabled", "disableRipple", "disableTouchRipple", "focusRipple", "focusVisibleClassName", "onBlur", "onClick", "onFocus", "onFocusVisible", "onKeyDown", "onKeyUp", "onMouseDown", "onMouseLeave", "onMouseUp", "onTouchEnd", "onTouchMove", "onTouchStart", "onDragLeave", "tabIndex", "TouchRippleProps", "type"]);
2039
+
2040
+ var buttonRef = React$2.useRef(null);
2041
+
2042
+ function getButtonNode() {
2043
+ // #StrictMode ready
2044
+ return ReactDOM.findDOMNode(buttonRef.current);
2045
+ }
2046
+
2047
+ var rippleRef = React$2.useRef(null);
2048
+
2049
+ var _React$useState = React$2.useState(false),
2050
+ focusVisible = _React$useState[0],
2051
+ setFocusVisible = _React$useState[1];
2052
+
2053
+ if (disabled && focusVisible) {
2054
+ setFocusVisible(false);
2055
+ }
2056
+
2057
+ var _useIsFocusVisible = useIsFocusVisible(),
2058
+ isFocusVisible = _useIsFocusVisible.isFocusVisible,
2059
+ onBlurVisible = _useIsFocusVisible.onBlurVisible,
2060
+ focusVisibleRef = _useIsFocusVisible.ref;
2061
+
2062
+ React$2.useImperativeHandle(action, function () {
2063
+ return {
2064
+ focusVisible: function focusVisible() {
2065
+ setFocusVisible(true);
2066
+ buttonRef.current.focus();
2067
+ }
2068
+ };
2069
+ }, []);
2070
+ React$2.useEffect(function () {
2071
+ if (focusVisible && focusRipple && !disableRipple) {
2072
+ rippleRef.current.pulsate();
2073
+ }
2074
+ }, [disableRipple, focusRipple, focusVisible]);
2075
+
2076
+ function useRippleHandler(rippleAction, eventCallback) {
2077
+ var skipRippleAction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : disableTouchRipple;
2078
+ return useEventCallback(function (event) {
2079
+ if (eventCallback) {
2080
+ eventCallback(event);
2081
+ }
2082
+
2083
+ var ignore = skipRippleAction;
2084
+
2085
+ if (!ignore && rippleRef.current) {
2086
+ rippleRef.current[rippleAction](event);
2087
+ }
2088
+
2089
+ return true;
2090
+ });
2091
+ }
2092
+
2093
+ var handleMouseDown = useRippleHandler('start', onMouseDown);
2094
+ var handleDragLeave = useRippleHandler('stop', onDragLeave);
2095
+ var handleMouseUp = useRippleHandler('stop', onMouseUp);
2096
+ var handleMouseLeave = useRippleHandler('stop', function (event) {
2097
+ if (focusVisible) {
2098
+ event.preventDefault();
2099
+ }
2100
+
2101
+ if (onMouseLeave) {
2102
+ onMouseLeave(event);
2103
+ }
2104
+ });
2105
+ var handleTouchStart = useRippleHandler('start', onTouchStart);
2106
+ var handleTouchEnd = useRippleHandler('stop', onTouchEnd);
2107
+ var handleTouchMove = useRippleHandler('stop', onTouchMove);
2108
+ var handleBlur = useRippleHandler('stop', function (event) {
2109
+ if (focusVisible) {
2110
+ onBlurVisible(event);
2111
+ setFocusVisible(false);
2112
+ }
2113
+
2114
+ if (onBlur) {
2115
+ onBlur(event);
2116
+ }
2117
+ }, false);
2118
+ var handleFocus = useEventCallback(function (event) {
2119
+ // Fix for https://github.com/facebook/react/issues/7769
2120
+ if (!buttonRef.current) {
2121
+ buttonRef.current = event.currentTarget;
2122
+ }
2123
+
2124
+ if (isFocusVisible(event)) {
2125
+ setFocusVisible(true);
2126
+
2127
+ if (onFocusVisible) {
2128
+ onFocusVisible(event);
2129
+ }
2130
+ }
2131
+
2132
+ if (onFocus) {
2133
+ onFocus(event);
2134
+ }
2135
+ });
2136
+
2137
+ var isNonNativeButton = function isNonNativeButton() {
2138
+ var button = getButtonNode();
2139
+ return component && component !== 'button' && !(button.tagName === 'A' && button.href);
2140
+ };
2141
+ /**
2142
+ * IE 11 shim for https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
2143
+ */
2144
+
2145
+
2146
+ var keydownRef = React$2.useRef(false);
2147
+ var handleKeyDown = useEventCallback(function (event) {
2148
+ // Check if key is already down to avoid repeats being counted as multiple activations
2149
+ if (focusRipple && !keydownRef.current && focusVisible && rippleRef.current && event.key === ' ') {
2150
+ keydownRef.current = true;
2151
+ event.persist();
2152
+ rippleRef.current.stop(event, function () {
2153
+ rippleRef.current.start(event);
2154
+ });
2155
+ }
2156
+
2157
+ if (event.target === event.currentTarget && isNonNativeButton() && event.key === ' ') {
2158
+ event.preventDefault();
2159
+ }
2160
+
2161
+ if (onKeyDown) {
2162
+ onKeyDown(event);
2163
+ } // Keyboard accessibility for non interactive elements
2164
+
2165
+
2166
+ if (event.target === event.currentTarget && isNonNativeButton() && event.key === 'Enter' && !disabled) {
2167
+ event.preventDefault();
2168
+
2169
+ if (onClick) {
2170
+ onClick(event);
2171
+ }
2172
+ }
2173
+ });
2174
+ var handleKeyUp = useEventCallback(function (event) {
2175
+ // calling preventDefault in keyUp on a <button> will not dispatch a click event if Space is pressed
2176
+ // https://codesandbox.io/s/button-keyup-preventdefault-dn7f0
2177
+ if (focusRipple && event.key === ' ' && rippleRef.current && focusVisible && !event.defaultPrevented) {
2178
+ keydownRef.current = false;
2179
+ event.persist();
2180
+ rippleRef.current.stop(event, function () {
2181
+ rippleRef.current.pulsate(event);
2182
+ });
2183
+ }
2184
+
2185
+ if (onKeyUp) {
2186
+ onKeyUp(event);
2187
+ } // Keyboard accessibility for non interactive elements
2188
+
2189
+
2190
+ if (onClick && event.target === event.currentTarget && isNonNativeButton() && event.key === ' ' && !event.defaultPrevented) {
2191
+ onClick(event);
2192
+ }
2193
+ });
2194
+ var ComponentProp = component;
2195
+
2196
+ if (ComponentProp === 'button' && other.href) {
2197
+ ComponentProp = 'a';
2198
+ }
2199
+
2200
+ var buttonProps = {};
2201
+
2202
+ if (ComponentProp === 'button') {
2203
+ buttonProps.type = type;
2204
+ buttonProps.disabled = disabled;
2205
+ } else {
2206
+ if (ComponentProp !== 'a' || !other.href) {
2207
+ buttonProps.role = 'button';
2208
+ }
2209
+
2210
+ buttonProps['aria-disabled'] = disabled;
2211
+ }
2212
+
2213
+ var handleUserRef = useForkRef(buttonRefProp, ref);
2214
+ var handleOwnRef = useForkRef(focusVisibleRef, buttonRef);
2215
+ var handleRef = useForkRef(handleUserRef, handleOwnRef);
2216
+
2217
+ var _React$useState2 = React$2.useState(false),
2218
+ mountedState = _React$useState2[0],
2219
+ setMountedState = _React$useState2[1];
2220
+
2221
+ React$2.useEffect(function () {
2222
+ setMountedState(true);
2223
+ }, []);
2224
+ var enableTouchRipple = mountedState && !disableRipple && !disabled;
2225
+
2226
+ return /*#__PURE__*/React$2.createElement(ComponentProp, _extends({
2227
+ className: clsx(classes.root, className, focusVisible && [classes.focusVisible, focusVisibleClassName], disabled && classes.disabled),
2228
+ onBlur: handleBlur,
2229
+ onClick: onClick,
2230
+ onFocus: handleFocus,
2231
+ onKeyDown: handleKeyDown,
2232
+ onKeyUp: handleKeyUp,
2233
+ onMouseDown: handleMouseDown,
2234
+ onMouseLeave: handleMouseLeave,
2235
+ onMouseUp: handleMouseUp,
2236
+ onDragLeave: handleDragLeave,
2237
+ onTouchEnd: handleTouchEnd,
2238
+ onTouchMove: handleTouchMove,
2239
+ onTouchStart: handleTouchStart,
2240
+ ref: handleRef,
2241
+ tabIndex: disabled ? -1 : tabIndex
2242
+ }, buttonProps, other), children, enableTouchRipple ?
2243
+ /*#__PURE__*/
2244
+
2245
+ /* TouchRipple is only needed client-side, x2 boost on the server. */
2246
+ React$2.createElement(TouchRipple$1, _extends({
2247
+ ref: rippleRef,
2248
+ center: centerRipple
2249
+ }, TouchRippleProps)) : null);
2250
+ });
2251
+ var ButtonBase$1 = withStyles(styles$6, {
2252
+ name: 'MuiButtonBase'
2253
+ })(ButtonBase);
2254
+
2255
+ /**
2256
+ * @ignore - internal component.
2257
+ */
2258
+
2259
+ var FirstPageIcon = createSvgIcon( /*#__PURE__*/React$2.createElement("path", {
2260
+ d: "M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"
2261
+ }));
2262
+
2263
+ /**
2264
+ * @ignore - internal component.
2265
+ */
2266
+
2267
+ var LastPageIcon = createSvgIcon( /*#__PURE__*/React$2.createElement("path", {
2268
+ d: "M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"
2269
+ }));
2270
+
2271
+ /**
2272
+ * @ignore - internal component.
2273
+ */
2274
+
2275
+ var NavigateBeforeIcon = createSvgIcon( /*#__PURE__*/React$2.createElement("path", {
2276
+ d: "M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"
2277
+ }));
2278
+
2279
+ /**
2280
+ * @ignore - internal component.
2281
+ */
2282
+
2283
+ var NavigateNextIcon = createSvgIcon( /*#__PURE__*/React$2.createElement("path", {
2284
+ d: "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"
2285
+ }));
2286
+
2287
+ var styles$5 = function styles(theme) {
2288
+ return {
2289
+ /* Styles applied to the root element. */
2290
+ root: _extends({}, theme.typography.body2, {
2291
+ borderRadius: 32 / 2,
2292
+ textAlign: 'center',
2293
+ boxSizing: 'border-box',
2294
+ minWidth: 32,
2295
+ height: 32,
2296
+ padding: '0 6px',
2297
+ margin: '0 3px',
2298
+ color: theme.palette.text.primary
2299
+ }),
2300
+
2301
+ /* Styles applied to the root element if `type="page"`. */
2302
+ page: {
2303
+ transition: theme.transitions.create(['color', 'background-color'], {
2304
+ duration: theme.transitions.duration.short
2305
+ }),
2306
+ '&:hover': {
2307
+ backgroundColor: theme.palette.action.hover,
2308
+ // Reset on touch devices, it doesn't add specificity
2309
+ '@media (hover: none)': {
2310
+ backgroundColor: 'transparent'
2311
+ }
2312
+ },
2313
+ '&$focusVisible': {
2314
+ backgroundColor: theme.palette.action.focus
2315
+ },
2316
+ '&$selected': {
2317
+ backgroundColor: theme.palette.action.selected,
2318
+ '&:hover, &$focusVisible': {
2319
+ backgroundColor: alpha(theme.palette.action.selected, theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity),
2320
+ // Reset on touch devices, it doesn't add specificity
2321
+ '@media (hover: none)': {
2322
+ backgroundColor: theme.palette.action.selected
2323
+ }
2324
+ },
2325
+ '&$disabled': {
2326
+ opacity: 1,
2327
+ color: theme.palette.action.disabled,
2328
+ backgroundColor: theme.palette.action.selected
2329
+ }
2330
+ },
2331
+ '&$disabled': {
2332
+ opacity: theme.palette.action.disabledOpacity
2333
+ }
2334
+ },
2335
+
2336
+ /* Styles applied applied to the root element if `size="small"`. */
2337
+ sizeSmall: {
2338
+ minWidth: 26,
2339
+ height: 26,
2340
+ borderRadius: 26 / 2,
2341
+ margin: '0 1px',
2342
+ padding: '0 4px',
2343
+ '& $icon': {
2344
+ fontSize: theme.typography.pxToRem(18)
2345
+ }
2346
+ },
2347
+
2348
+ /* Styles applied applied to the root element if `size="large"`. */
2349
+ sizeLarge: {
2350
+ minWidth: 40,
2351
+ height: 40,
2352
+ borderRadius: 40 / 2,
2353
+ padding: '0 10px',
2354
+ fontSize: theme.typography.pxToRem(15),
2355
+ '& $icon': {
2356
+ fontSize: theme.typography.pxToRem(22)
2357
+ }
2358
+ },
2359
+
2360
+ /* Styles applied to the root element if `variant="text"` and `color="primary"`. */
2361
+ textPrimary: {
2362
+ '&$selected': {
2363
+ color: theme.palette.primary.contrastText,
2364
+ backgroundColor: theme.palette.primary.main,
2365
+ '&:hover, &$focusVisible': {
2366
+ backgroundColor: theme.palette.primary.dark,
2367
+ // Reset on touch devices, it doesn't add specificity
2368
+ '@media (hover: none)': {
2369
+ backgroundColor: theme.palette.primary.main
2370
+ }
2371
+ },
2372
+ '&$disabled': {
2373
+ color: theme.palette.action.disabled
2374
+ }
2375
+ }
2376
+ },
2377
+
2378
+ /* Styles applied to the root element if `variant="text"` and `color="secondary"`. */
2379
+ textSecondary: {
2380
+ '&$selected': {
2381
+ color: theme.palette.secondary.contrastText,
2382
+ backgroundColor: theme.palette.secondary.main,
2383
+ '&:hover, &$focusVisible': {
2384
+ backgroundColor: theme.palette.secondary.dark,
2385
+ // Reset on touch devices, it doesn't add specificity
2386
+ '@media (hover: none)': {
2387
+ backgroundColor: theme.palette.secondary.main
2388
+ }
2389
+ },
2390
+ '&$disabled': {
2391
+ color: theme.palette.action.disabled
2392
+ }
2393
+ }
2394
+ },
2395
+
2396
+ /* Styles applied to the root element if `outlined="true"`. */
2397
+ outlined: {
2398
+ border: "1px solid ".concat(theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'),
2399
+ '&$selected': {
2400
+ '&$disabled': {
2401
+ border: "1px solid ".concat(theme.palette.action.disabledBackground)
2402
+ }
2403
+ }
2404
+ },
2405
+
2406
+ /* Styles applied to the root element if `variant="outlined"` and `color="primary"`. */
2407
+ outlinedPrimary: {
2408
+ '&$selected': {
2409
+ color: theme.palette.primary.main,
2410
+ border: "1px solid ".concat(alpha(theme.palette.primary.main, 0.5)),
2411
+ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.activatedOpacity),
2412
+ '&:hover, &$focusVisible': {
2413
+ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.activatedOpacity + theme.palette.action.hoverOpacity),
2414
+ // Reset on touch devices, it doesn't add specificity
2415
+ '@media (hover: none)': {
2416
+ backgroundColor: 'transparent'
2417
+ }
2418
+ },
2419
+ '&$disabled': {
2420
+ color: theme.palette.action.disabled
2421
+ }
2422
+ }
2423
+ },
2424
+
2425
+ /* Styles applied to the root element if `variant="outlined"` and `color="secondary"`. */
2426
+ outlinedSecondary: {
2427
+ '&$selected': {
2428
+ color: theme.palette.secondary.main,
2429
+ border: "1px solid ".concat(alpha(theme.palette.secondary.main, 0.5)),
2430
+ backgroundColor: alpha(theme.palette.secondary.main, theme.palette.action.activatedOpacity),
2431
+ '&:hover, &$focusVisible': {
2432
+ backgroundColor: alpha(theme.palette.secondary.main, theme.palette.action.activatedOpacity + theme.palette.action.hoverOpacity),
2433
+ // Reset on touch devices, it doesn't add specificity
2434
+ '@media (hover: none)': {
2435
+ backgroundColor: 'transparent'
2436
+ }
2437
+ },
2438
+ '&$disabled': {
2439
+ color: theme.palette.action.disabled
2440
+ }
2441
+ }
2442
+ },
2443
+
2444
+ /* Styles applied to the root element if `rounded="true"`. */
2445
+ rounded: {
2446
+ borderRadius: theme.shape.borderRadius
2447
+ },
2448
+
2449
+ /* Styles applied to the root element if `type="start-ellipsis"` or `type="end-ellipsis"`. */
2450
+ ellipsis: {
2451
+ height: 'auto',
2452
+ '&$disabled': {
2453
+ opacity: theme.palette.action.disabledOpacity
2454
+ }
2455
+ },
2456
+
2457
+ /* Pseudo-class applied to the root element if keyboard focused. */
2458
+ focusVisible: {},
2459
+
2460
+ /* Pseudo-class applied to the root element if `disabled={true}`. */
2461
+ disabled: {},
2462
+
2463
+ /* Pseudo-class applied to the root element if `selected={true}`. */
2464
+ selected: {},
2465
+
2466
+ /* Styles applied to the icon element. */
2467
+ icon: {
2468
+ fontSize: theme.typography.pxToRem(20),
2469
+ margin: '0 -8px'
2470
+ }
2471
+ };
2472
+ };
2473
+ var PaginationItem = /*#__PURE__*/React$2.forwardRef(function PaginationItem(props, ref) {
2474
+ var classes = props.classes,
2475
+ className = props.className,
2476
+ _props$color = props.color,
2477
+ color = _props$color === void 0 ? 'standard' : _props$color,
2478
+ component = props.component,
2479
+ _props$disabled = props.disabled,
2480
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
2481
+ page = props.page,
2482
+ _props$selected = props.selected,
2483
+ selected = _props$selected === void 0 ? false : _props$selected,
2484
+ _props$shape = props.shape,
2485
+ shape = _props$shape === void 0 ? 'round' : _props$shape,
2486
+ _props$size = props.size,
2487
+ size = _props$size === void 0 ? 'medium' : _props$size,
2488
+ _props$type = props.type,
2489
+ type = _props$type === void 0 ? 'page' : _props$type,
2490
+ _props$variant = props.variant,
2491
+ variant = _props$variant === void 0 ? 'text' : _props$variant,
2492
+ other = _objectWithoutProperties(props, ["classes", "className", "color", "component", "disabled", "page", "selected", "shape", "size", "type", "variant"]);
2493
+
2494
+ var theme = useTheme();
2495
+ var normalizedIcons = theme.direction === 'rtl' ? {
2496
+ previous: NavigateNextIcon,
2497
+ next: NavigateBeforeIcon,
2498
+ last: FirstPageIcon,
2499
+ first: LastPageIcon
2500
+ } : {
2501
+ previous: NavigateBeforeIcon,
2502
+ next: NavigateNextIcon,
2503
+ first: FirstPageIcon,
2504
+ last: LastPageIcon
2505
+ };
2506
+ var Icon = normalizedIcons[type];
2507
+ return type === 'start-ellipsis' || type === 'end-ellipsis' ? /*#__PURE__*/React$2.createElement("div", {
2508
+ ref: ref,
2509
+ className: clsx(classes.root, classes.ellipsis, disabled && classes.disabled, size !== 'medium' && classes["size".concat(capitalize(size))])
2510
+ }, "\u2026") : /*#__PURE__*/React$2.createElement(ButtonBase$1, _extends({
2511
+ ref: ref,
2512
+ component: component,
2513
+ disabled: disabled,
2514
+ focusVisibleClassName: classes.focusVisible,
2515
+ className: clsx(classes.root, classes.page, classes[variant], classes[shape], className, color !== 'standard' && classes["".concat(variant).concat(capitalize(color))], disabled && classes.disabled, selected && classes.selected, size !== 'medium' && classes["size".concat(capitalize(size))])
2516
+ }, other), type === 'page' && page, Icon ? /*#__PURE__*/React$2.createElement(Icon, {
2517
+ className: classes.icon
2518
+ }) : null);
2519
+ });
2520
+ var PaginationItem$1 = withStyles(styles$5, {
2521
+ name: 'MuiPaginationItem'
2522
+ })(PaginationItem);
2523
+
2524
+ var styles$4 = {
2525
+ /* Styles applied to the root element. */
2526
+ root: {},
2527
+
2528
+ /* Styles applied to the ul element. */
2529
+ ul: {
2530
+ display: 'flex',
2531
+ flexWrap: 'wrap',
2532
+ alignItems: 'center',
2533
+ padding: 0,
2534
+ margin: 0,
2535
+ listStyle: 'none'
2536
+ }
2537
+ };
2538
+
2539
+ function defaultGetAriaLabel(type, page, selected) {
2540
+ if (type === 'page') {
2541
+ return "".concat(selected ? '' : 'Go to ', "page ").concat(page);
2542
+ }
2543
+
2544
+ return "Go to ".concat(type, " page");
2545
+ }
2546
+
2547
+ var Pagination = /*#__PURE__*/React$2.forwardRef(function Pagination(props, ref) {
2548
+ props.boundaryCount;
2549
+ var classes = props.classes,
2550
+ className = props.className,
2551
+ _props$color = props.color,
2552
+ color = _props$color === void 0 ? 'standard' : _props$color;
2553
+ props.count;
2554
+ props.defaultPage;
2555
+ props.disabled;
2556
+ var _props$getItemAriaLab = props.getItemAriaLabel,
2557
+ getItemAriaLabel = _props$getItemAriaLab === void 0 ? defaultGetAriaLabel : _props$getItemAriaLab;
2558
+ props.hideNextButton;
2559
+ props.hidePrevButton;
2560
+ props.onChange;
2561
+ props.page;
2562
+ var _props$renderItem = props.renderItem,
2563
+ renderItem = _props$renderItem === void 0 ? function (item) {
2564
+ return /*#__PURE__*/React$2.createElement(PaginationItem$1, item);
2565
+ } : _props$renderItem,
2566
+ _props$shape = props.shape,
2567
+ shape = _props$shape === void 0 ? 'round' : _props$shape;
2568
+ props.showFirstButton;
2569
+ props.showLastButton;
2570
+ props.siblingCount;
2571
+ var _props$size = props.size,
2572
+ size = _props$size === void 0 ? 'medium' : _props$size,
2573
+ _props$variant = props.variant,
2574
+ variant = _props$variant === void 0 ? 'text' : _props$variant,
2575
+ other = _objectWithoutProperties(props, ["boundaryCount", "classes", "className", "color", "count", "defaultPage", "disabled", "getItemAriaLabel", "hideNextButton", "hidePrevButton", "onChange", "page", "renderItem", "shape", "showFirstButton", "showLastButton", "siblingCount", "size", "variant"]);
2576
+
2577
+ var _usePagination = usePagination(_extends({}, props, {
2578
+ componentName: 'Pagination'
2579
+ })),
2580
+ items = _usePagination.items;
2581
+
2582
+ return /*#__PURE__*/React$2.createElement("nav", _extends({
2583
+ "aria-label": "pagination navigation",
2584
+ className: clsx(classes.root, className),
2585
+ ref: ref
2586
+ }, other), /*#__PURE__*/React$2.createElement("ul", {
2587
+ className: classes.ul
2588
+ }, items.map(function (item, index) {
2589
+ return /*#__PURE__*/React$2.createElement("li", {
2590
+ key: index
2591
+ }, renderItem(_extends({}, item, {
2592
+ color: color,
2593
+ 'aria-label': getItemAriaLabel(item.type, item.page, item.selected),
2594
+ shape: shape,
2595
+ size: size,
2596
+ variant: variant
2597
+ })));
2598
+ })));
2599
+ }); // @default tags synced with default values from usePagination
2600
+ var Pagination$1 = withStyles(styles$4, {
2601
+ name: 'MuiPagination'
2602
+ })(Pagination);
2603
+
2604
+ /**
2605
+ * @ignore - internal component.
2606
+ */
2607
+
2608
+ var NativeSelectInput = /*#__PURE__*/React$2.forwardRef(function NativeSelectInput(props, ref) {
2609
+ var classes = props.classes,
2610
+ className = props.className,
2611
+ disabled = props.disabled,
2612
+ IconComponent = props.IconComponent,
2613
+ inputRef = props.inputRef,
2614
+ _props$variant = props.variant,
2615
+ variant = _props$variant === void 0 ? 'standard' : _props$variant,
2616
+ other = _objectWithoutProperties(props, ["classes", "className", "disabled", "IconComponent", "inputRef", "variant"]);
2617
+
2618
+ return /*#__PURE__*/React$2.createElement(React$2.Fragment, null, /*#__PURE__*/React$2.createElement("select", _extends({
2619
+ className: clsx(classes.root, // TODO v5: merge root and select
2620
+ classes.select, classes[variant], className, disabled && classes.disabled),
2621
+ disabled: disabled,
2622
+ ref: inputRef || ref
2623
+ }, other)), props.multiple ? null : /*#__PURE__*/React$2.createElement(IconComponent, {
2624
+ className: clsx(classes.icon, classes["icon".concat(capitalize(variant))], disabled && classes.disabled)
2625
+ }));
2626
+ });
2627
+
2628
+ function formControlState(_ref) {
2629
+ var props = _ref.props,
2630
+ states = _ref.states,
2631
+ muiFormControl = _ref.muiFormControl;
2632
+ return states.reduce(function (acc, state) {
2633
+ acc[state] = props[state];
2634
+
2635
+ if (muiFormControl) {
2636
+ if (typeof props[state] === 'undefined') {
2637
+ acc[state] = muiFormControl[state];
2638
+ }
2639
+ }
2640
+
2641
+ return acc;
2642
+ }, {});
2643
+ }
2644
+
2645
+ /**
2646
+ * @ignore - internal component.
2647
+ */
2648
+
2649
+ var FormControlContext = React$2.createContext();
2650
+
2651
+ function useFormControl$1() {
2652
+ return React$2.useContext(FormControlContext);
2653
+ }
2654
+
2655
+ function useFormControl() {
2656
+ return React$2.useContext(FormControlContext);
2657
+ }
2658
+
2659
+ /**
2660
+ * @ignore - internal component.
2661
+ */
2662
+
2663
+ var ArrowDropDownIcon = createSvgIcon( /*#__PURE__*/React$2.createElement("path", {
2664
+ d: "M7 10l5 5 5-5z"
2665
+ }));
2666
+
2667
+ function getStyleValue(computedStyle, property) {
2668
+ return parseInt(computedStyle[property], 10) || 0;
2669
+ }
2670
+
2671
+ var useEnhancedEffect$1 = typeof window !== 'undefined' ? React$2.useLayoutEffect : React$2.useEffect;
2672
+ var styles$3 = {
2673
+ /* Styles applied to the shadow textarea element. */
2674
+ shadow: {
2675
+ // Visibility needed to hide the extra text area on iPads
2676
+ visibility: 'hidden',
2677
+ // Remove from the content flow
2678
+ position: 'absolute',
2679
+ // Ignore the scrollbar width
2680
+ overflow: 'hidden',
2681
+ height: 0,
2682
+ top: 0,
2683
+ left: 0,
2684
+ // Create a new layer, increase the isolation of the computed values
2685
+ transform: 'translateZ(0)'
2686
+ }
2687
+ };
2688
+ var TextareaAutosize = /*#__PURE__*/React$2.forwardRef(function TextareaAutosize(props, ref) {
2689
+ var onChange = props.onChange,
2690
+ rows = props.rows,
2691
+ rowsMax = props.rowsMax,
2692
+ rowsMinProp = props.rowsMin,
2693
+ maxRowsProp = props.maxRows,
2694
+ _props$minRows = props.minRows,
2695
+ minRowsProp = _props$minRows === void 0 ? 1 : _props$minRows,
2696
+ style = props.style,
2697
+ value = props.value,
2698
+ other = _objectWithoutProperties(props, ["onChange", "rows", "rowsMax", "rowsMin", "maxRows", "minRows", "style", "value"]);
2699
+
2700
+ var maxRows = maxRowsProp || rowsMax;
2701
+ var minRows = rows || rowsMinProp || minRowsProp;
2702
+
2703
+ var _React$useRef = React$2.useRef(value != null),
2704
+ isControlled = _React$useRef.current;
2705
+
2706
+ var inputRef = React$2.useRef(null);
2707
+ var handleRef = useForkRef(ref, inputRef);
2708
+ var shadowRef = React$2.useRef(null);
2709
+ var renders = React$2.useRef(0);
2710
+
2711
+ var _React$useState = React$2.useState({}),
2712
+ state = _React$useState[0],
2713
+ setState = _React$useState[1];
2714
+
2715
+ var syncHeight = React$2.useCallback(function () {
2716
+ var input = inputRef.current;
2717
+ var computedStyle = window.getComputedStyle(input);
2718
+ var inputShallow = shadowRef.current;
2719
+ inputShallow.style.width = computedStyle.width;
2720
+ inputShallow.value = input.value || props.placeholder || 'x';
2721
+
2722
+ if (inputShallow.value.slice(-1) === '\n') {
2723
+ // Certain fonts which overflow the line height will cause the textarea
2724
+ // to report a different scrollHeight depending on whether the last line
2725
+ // is empty. Make it non-empty to avoid this issue.
2726
+ inputShallow.value += ' ';
2727
+ }
2728
+
2729
+ var boxSizing = computedStyle['box-sizing'];
2730
+ var padding = getStyleValue(computedStyle, 'padding-bottom') + getStyleValue(computedStyle, 'padding-top');
2731
+ var border = getStyleValue(computedStyle, 'border-bottom-width') + getStyleValue(computedStyle, 'border-top-width'); // The height of the inner content
2732
+
2733
+ var innerHeight = inputShallow.scrollHeight - padding; // Measure height of a textarea with a single row
2734
+
2735
+ inputShallow.value = 'x';
2736
+ var singleRowHeight = inputShallow.scrollHeight - padding; // The height of the outer content
2737
+
2738
+ var outerHeight = innerHeight;
2739
+
2740
+ if (minRows) {
2741
+ outerHeight = Math.max(Number(minRows) * singleRowHeight, outerHeight);
2742
+ }
2743
+
2744
+ if (maxRows) {
2745
+ outerHeight = Math.min(Number(maxRows) * singleRowHeight, outerHeight);
2746
+ }
2747
+
2748
+ outerHeight = Math.max(outerHeight, singleRowHeight); // Take the box sizing into account for applying this value as a style.
2749
+
2750
+ var outerHeightStyle = outerHeight + (boxSizing === 'border-box' ? padding + border : 0);
2751
+ var overflow = Math.abs(outerHeight - innerHeight) <= 1;
2752
+ setState(function (prevState) {
2753
+ // Need a large enough difference to update the height.
2754
+ // This prevents infinite rendering loop.
2755
+ if (renders.current < 20 && (outerHeightStyle > 0 && Math.abs((prevState.outerHeightStyle || 0) - outerHeightStyle) > 1 || prevState.overflow !== overflow)) {
2756
+ renders.current += 1;
2757
+ return {
2758
+ overflow: overflow,
2759
+ outerHeightStyle: outerHeightStyle
2760
+ };
2761
+ }
2762
+
2763
+ return prevState;
2764
+ });
2765
+ }, [maxRows, minRows, props.placeholder]);
2766
+ React$2.useEffect(function () {
2767
+ var handleResize = debounce(function () {
2768
+ renders.current = 0;
2769
+ syncHeight();
2770
+ });
2771
+ window.addEventListener('resize', handleResize);
2772
+ return function () {
2773
+ handleResize.clear();
2774
+ window.removeEventListener('resize', handleResize);
2775
+ };
2776
+ }, [syncHeight]);
2777
+ useEnhancedEffect$1(function () {
2778
+ syncHeight();
2779
+ });
2780
+ React$2.useEffect(function () {
2781
+ renders.current = 0;
2782
+ }, [value]);
2783
+
2784
+ var handleChange = function handleChange(event) {
2785
+ renders.current = 0;
2786
+
2787
+ if (!isControlled) {
2788
+ syncHeight();
2789
+ }
2790
+
2791
+ if (onChange) {
2792
+ onChange(event);
2793
+ }
2794
+ };
2795
+
2796
+ return /*#__PURE__*/React$2.createElement(React$2.Fragment, null, /*#__PURE__*/React$2.createElement("textarea", _extends({
2797
+ value: value,
2798
+ onChange: handleChange,
2799
+ ref: handleRef // Apply the rows prop to get a "correct" first SSR paint
2800
+ ,
2801
+ rows: minRows,
2802
+ style: _extends({
2803
+ height: state.outerHeightStyle,
2804
+ // Need a large enough difference to allow scrolling.
2805
+ // This prevents infinite rendering loop.
2806
+ overflow: state.overflow ? 'hidden' : null
2807
+ }, style)
2808
+ }, other)), /*#__PURE__*/React$2.createElement("textarea", {
2809
+ "aria-hidden": true,
2810
+ className: props.className,
2811
+ readOnly: true,
2812
+ ref: shadowRef,
2813
+ tabIndex: -1,
2814
+ style: _extends({}, styles$3.shadow, style)
2815
+ }));
2816
+ });
2817
+
2818
+ // Supports determination of isControlled().
2819
+ // Controlled input accepts its current value as a prop.
2820
+ //
2821
+ // @see https://facebook.github.io/react/docs/forms.html#controlled-components
2822
+ // @param value
2823
+ // @returns {boolean} true if string (including '') or number (including zero)
2824
+ function hasValue(value) {
2825
+ return value != null && !(Array.isArray(value) && value.length === 0);
2826
+ } // Determine if field is empty or filled.
2827
+ // Response determines if label is presented above field or as placeholder.
2828
+ //
2829
+ // @param obj
2830
+ // @param SSR
2831
+ // @returns {boolean} False when not present or empty string.
2832
+ // True when any number or string with length.
2833
+
2834
+ function isFilled(obj) {
2835
+ var SSR = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2836
+ return obj && (hasValue(obj.value) && obj.value !== '' || SSR && hasValue(obj.defaultValue) && obj.defaultValue !== '');
2837
+ } // Determine if an Input is adorned on start.
2838
+
2839
+ var styles$2 = function styles(theme) {
2840
+ var light = theme.palette.type === 'light';
2841
+ var placeholder = {
2842
+ color: 'currentColor',
2843
+ opacity: light ? 0.42 : 0.5,
2844
+ transition: theme.transitions.create('opacity', {
2845
+ duration: theme.transitions.duration.shorter
2846
+ })
2847
+ };
2848
+ var placeholderHidden = {
2849
+ opacity: '0 !important'
2850
+ };
2851
+ var placeholderVisible = {
2852
+ opacity: light ? 0.42 : 0.5
2853
+ };
2854
+ return {
2855
+ '@global': {
2856
+ '@keyframes mui-auto-fill': {},
2857
+ '@keyframes mui-auto-fill-cancel': {}
2858
+ },
2859
+
2860
+ /* Styles applied to the root element. */
2861
+ root: _extends({}, theme.typography.body1, {
2862
+ color: theme.palette.text.primary,
2863
+ lineHeight: '1.1876em',
2864
+ // Reset (19px), match the native input line-height
2865
+ boxSizing: 'border-box',
2866
+ // Prevent padding issue with fullWidth.
2867
+ position: 'relative',
2868
+ cursor: 'text',
2869
+ display: 'inline-flex',
2870
+ alignItems: 'center',
2871
+ '&$disabled': {
2872
+ color: theme.palette.text.disabled,
2873
+ cursor: 'default'
2874
+ }
2875
+ }),
2876
+
2877
+ /* Styles applied to the root element if the component is a descendant of `FormControl`. */
2878
+ formControl: {},
2879
+
2880
+ /* Styles applied to the root element if the component is focused. */
2881
+ focused: {},
2882
+
2883
+ /* Styles applied to the root element if `disabled={true}`. */
2884
+ disabled: {},
2885
+
2886
+ /* Styles applied to the root element if `startAdornment` is provided. */
2887
+ adornedStart: {},
2888
+
2889
+ /* Styles applied to the root element if `endAdornment` is provided. */
2890
+ adornedEnd: {},
2891
+
2892
+ /* Pseudo-class applied to the root element if `error={true}`. */
2893
+ error: {},
2894
+
2895
+ /* Styles applied to the `input` element if `margin="dense"`. */
2896
+ marginDense: {},
2897
+
2898
+ /* Styles applied to the root element if `multiline={true}`. */
2899
+ multiline: {
2900
+ padding: "".concat(8 - 2, "px 0 ").concat(8 - 1, "px"),
2901
+ '&$marginDense': {
2902
+ paddingTop: 4 - 1
2903
+ }
2904
+ },
2905
+
2906
+ /* Styles applied to the root element if the color is secondary. */
2907
+ colorSecondary: {},
2908
+
2909
+ /* Styles applied to the root element if `fullWidth={true}`. */
2910
+ fullWidth: {
2911
+ width: '100%'
2912
+ },
2913
+
2914
+ /* Styles applied to the `input` element. */
2915
+ input: {
2916
+ font: 'inherit',
2917
+ letterSpacing: 'inherit',
2918
+ color: 'currentColor',
2919
+ padding: "".concat(8 - 2, "px 0 ").concat(8 - 1, "px"),
2920
+ border: 0,
2921
+ boxSizing: 'content-box',
2922
+ background: 'none',
2923
+ height: '1.1876em',
2924
+ // Reset (19px), match the native input line-height
2925
+ margin: 0,
2926
+ // Reset for Safari
2927
+ WebkitTapHighlightColor: 'transparent',
2928
+ display: 'block',
2929
+ // Make the flex item shrink with Firefox
2930
+ minWidth: 0,
2931
+ width: '100%',
2932
+ // Fix IE 11 width issue
2933
+ animationName: 'mui-auto-fill-cancel',
2934
+ animationDuration: '10ms',
2935
+ '&::-webkit-input-placeholder': placeholder,
2936
+ '&::-moz-placeholder': placeholder,
2937
+ // Firefox 19+
2938
+ '&:-ms-input-placeholder': placeholder,
2939
+ // IE 11
2940
+ '&::-ms-input-placeholder': placeholder,
2941
+ // Edge
2942
+ '&:focus': {
2943
+ outline: 0
2944
+ },
2945
+ // Reset Firefox invalid required input style
2946
+ '&:invalid': {
2947
+ boxShadow: 'none'
2948
+ },
2949
+ '&::-webkit-search-decoration': {
2950
+ // Remove the padding when type=search.
2951
+ '-webkit-appearance': 'none'
2952
+ },
2953
+ // Show and hide the placeholder logic
2954
+ 'label[data-shrink=false] + $formControl &': {
2955
+ '&::-webkit-input-placeholder': placeholderHidden,
2956
+ '&::-moz-placeholder': placeholderHidden,
2957
+ // Firefox 19+
2958
+ '&:-ms-input-placeholder': placeholderHidden,
2959
+ // IE 11
2960
+ '&::-ms-input-placeholder': placeholderHidden,
2961
+ // Edge
2962
+ '&:focus::-webkit-input-placeholder': placeholderVisible,
2963
+ '&:focus::-moz-placeholder': placeholderVisible,
2964
+ // Firefox 19+
2965
+ '&:focus:-ms-input-placeholder': placeholderVisible,
2966
+ // IE 11
2967
+ '&:focus::-ms-input-placeholder': placeholderVisible // Edge
2968
+
2969
+ },
2970
+ '&$disabled': {
2971
+ opacity: 1 // Reset iOS opacity
2972
+
2973
+ },
2974
+ '&:-webkit-autofill': {
2975
+ animationDuration: '5000s',
2976
+ animationName: 'mui-auto-fill'
2977
+ }
2978
+ },
2979
+
2980
+ /* Styles applied to the `input` element if `margin="dense"`. */
2981
+ inputMarginDense: {
2982
+ paddingTop: 4 - 1
2983
+ },
2984
+
2985
+ /* Styles applied to the `input` element if `multiline={true}`. */
2986
+ inputMultiline: {
2987
+ height: 'auto',
2988
+ resize: 'none',
2989
+ padding: 0
2990
+ },
2991
+
2992
+ /* Styles applied to the `input` element if `type="search"`. */
2993
+ inputTypeSearch: {
2994
+ // Improve type search style.
2995
+ '-moz-appearance': 'textfield',
2996
+ '-webkit-appearance': 'textfield'
2997
+ },
2998
+
2999
+ /* Styles applied to the `input` element if `startAdornment` is provided. */
3000
+ inputAdornedStart: {},
3001
+
3002
+ /* Styles applied to the `input` element if `endAdornment` is provided. */
3003
+ inputAdornedEnd: {},
3004
+
3005
+ /* Styles applied to the `input` element if `hiddenLabel={true}`. */
3006
+ inputHiddenLabel: {}
3007
+ };
3008
+ };
3009
+ var useEnhancedEffect = typeof window === 'undefined' ? React$2.useEffect : React$2.useLayoutEffect;
3010
+ /**
3011
+ * `InputBase` contains as few styles as possible.
3012
+ * It aims to be a simple building block for creating an input.
3013
+ * It contains a load of style reset and some state logic.
3014
+ */
3015
+
3016
+ var InputBase = /*#__PURE__*/React$2.forwardRef(function InputBase(props, ref) {
3017
+ var ariaDescribedby = props['aria-describedby'],
3018
+ autoComplete = props.autoComplete,
3019
+ autoFocus = props.autoFocus,
3020
+ classes = props.classes,
3021
+ className = props.className;
3022
+ props.color;
3023
+ var defaultValue = props.defaultValue,
3024
+ disabled = props.disabled,
3025
+ endAdornment = props.endAdornment;
3026
+ props.error;
3027
+ var _props$fullWidth = props.fullWidth,
3028
+ fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
3029
+ id = props.id,
3030
+ _props$inputComponent = props.inputComponent,
3031
+ inputComponent = _props$inputComponent === void 0 ? 'input' : _props$inputComponent,
3032
+ _props$inputProps = props.inputProps,
3033
+ inputPropsProp = _props$inputProps === void 0 ? {} : _props$inputProps,
3034
+ inputRefProp = props.inputRef;
3035
+ props.margin;
3036
+ var _props$multiline = props.multiline,
3037
+ multiline = _props$multiline === void 0 ? false : _props$multiline,
3038
+ name = props.name,
3039
+ onBlur = props.onBlur,
3040
+ onChange = props.onChange,
3041
+ onClick = props.onClick,
3042
+ onFocus = props.onFocus,
3043
+ onKeyDown = props.onKeyDown,
3044
+ onKeyUp = props.onKeyUp,
3045
+ placeholder = props.placeholder,
3046
+ readOnly = props.readOnly,
3047
+ renderSuffix = props.renderSuffix,
3048
+ rows = props.rows,
3049
+ rowsMax = props.rowsMax,
3050
+ rowsMin = props.rowsMin,
3051
+ maxRows = props.maxRows,
3052
+ minRows = props.minRows,
3053
+ startAdornment = props.startAdornment,
3054
+ _props$type = props.type,
3055
+ type = _props$type === void 0 ? 'text' : _props$type,
3056
+ valueProp = props.value,
3057
+ other = _objectWithoutProperties(props, ["aria-describedby", "autoComplete", "autoFocus", "classes", "className", "color", "defaultValue", "disabled", "endAdornment", "error", "fullWidth", "id", "inputComponent", "inputProps", "inputRef", "margin", "multiline", "name", "onBlur", "onChange", "onClick", "onFocus", "onKeyDown", "onKeyUp", "placeholder", "readOnly", "renderSuffix", "rows", "rowsMax", "rowsMin", "maxRows", "minRows", "startAdornment", "type", "value"]);
3058
+
3059
+ var value = inputPropsProp.value != null ? inputPropsProp.value : valueProp;
3060
+
3061
+ var _React$useRef = React$2.useRef(value != null),
3062
+ isControlled = _React$useRef.current;
3063
+
3064
+ var inputRef = React$2.useRef();
3065
+ var handleInputRefWarning = React$2.useCallback(function (instance) {
3066
+ }, []);
3067
+ var handleInputPropsRefProp = useForkRef(inputPropsProp.ref, handleInputRefWarning);
3068
+ var handleInputRefProp = useForkRef(inputRefProp, handleInputPropsRefProp);
3069
+ var handleInputRef = useForkRef(inputRef, handleInputRefProp);
3070
+
3071
+ var _React$useState = React$2.useState(false),
3072
+ focused = _React$useState[0],
3073
+ setFocused = _React$useState[1];
3074
+
3075
+ var muiFormControl = useFormControl$1();
3076
+
3077
+ var fcs = formControlState({
3078
+ props: props,
3079
+ muiFormControl: muiFormControl,
3080
+ states: ['color', 'disabled', 'error', 'hiddenLabel', 'margin', 'required', 'filled']
3081
+ });
3082
+ fcs.focused = muiFormControl ? muiFormControl.focused : focused; // The blur won't fire when the disabled state is set on a focused input.
3083
+ // We need to book keep the focused state manually.
3084
+
3085
+ React$2.useEffect(function () {
3086
+ if (!muiFormControl && disabled && focused) {
3087
+ setFocused(false);
3088
+
3089
+ if (onBlur) {
3090
+ onBlur();
3091
+ }
3092
+ }
3093
+ }, [muiFormControl, disabled, focused, onBlur]);
3094
+ var onFilled = muiFormControl && muiFormControl.onFilled;
3095
+ var onEmpty = muiFormControl && muiFormControl.onEmpty;
3096
+ var checkDirty = React$2.useCallback(function (obj) {
3097
+ if (isFilled(obj)) {
3098
+ if (onFilled) {
3099
+ onFilled();
3100
+ }
3101
+ } else if (onEmpty) {
3102
+ onEmpty();
3103
+ }
3104
+ }, [onFilled, onEmpty]);
3105
+ useEnhancedEffect(function () {
3106
+ if (isControlled) {
3107
+ checkDirty({
3108
+ value: value
3109
+ });
3110
+ }
3111
+ }, [value, checkDirty, isControlled]);
3112
+
3113
+ var handleFocus = function handleFocus(event) {
3114
+ // Fix a bug with IE 11 where the focus/blur events are triggered
3115
+ // while the input is disabled.
3116
+ if (fcs.disabled) {
3117
+ event.stopPropagation();
3118
+ return;
3119
+ }
3120
+
3121
+ if (onFocus) {
3122
+ onFocus(event);
3123
+ }
3124
+
3125
+ if (inputPropsProp.onFocus) {
3126
+ inputPropsProp.onFocus(event);
3127
+ }
3128
+
3129
+ if (muiFormControl && muiFormControl.onFocus) {
3130
+ muiFormControl.onFocus(event);
3131
+ } else {
3132
+ setFocused(true);
3133
+ }
3134
+ };
3135
+
3136
+ var handleBlur = function handleBlur(event) {
3137
+ if (onBlur) {
3138
+ onBlur(event);
3139
+ }
3140
+
3141
+ if (inputPropsProp.onBlur) {
3142
+ inputPropsProp.onBlur(event);
3143
+ }
3144
+
3145
+ if (muiFormControl && muiFormControl.onBlur) {
3146
+ muiFormControl.onBlur(event);
3147
+ } else {
3148
+ setFocused(false);
3149
+ }
3150
+ };
3151
+
3152
+ var handleChange = function handleChange(event) {
3153
+ if (!isControlled) {
3154
+ var element = event.target || inputRef.current;
3155
+
3156
+ if (element == null) {
3157
+ throw new Error(formatMuiErrorMessage(1));
3158
+ }
3159
+
3160
+ checkDirty({
3161
+ value: element.value
3162
+ });
3163
+ }
3164
+
3165
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3166
+ args[_key - 1] = arguments[_key];
3167
+ }
3168
+
3169
+ if (inputPropsProp.onChange) {
3170
+ inputPropsProp.onChange.apply(inputPropsProp, [event].concat(args));
3171
+ } // Perform in the willUpdate
3172
+
3173
+
3174
+ if (onChange) {
3175
+ onChange.apply(void 0, [event].concat(args));
3176
+ }
3177
+ }; // Check the input state on mount, in case it was filled by the user
3178
+ // or auto filled by the browser before the hydration (for SSR).
3179
+
3180
+
3181
+ React$2.useEffect(function () {
3182
+ checkDirty(inputRef.current);
3183
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
3184
+
3185
+ var handleClick = function handleClick(event) {
3186
+ if (inputRef.current && event.currentTarget === event.target) {
3187
+ inputRef.current.focus();
3188
+ }
3189
+
3190
+ if (onClick) {
3191
+ onClick(event);
3192
+ }
3193
+ };
3194
+
3195
+ var InputComponent = inputComponent;
3196
+
3197
+ var inputProps = _extends({}, inputPropsProp, {
3198
+ ref: handleInputRef
3199
+ });
3200
+
3201
+ if (typeof InputComponent !== 'string') {
3202
+ inputProps = _extends({
3203
+ // Rename ref to inputRef as we don't know the
3204
+ // provided `inputComponent` structure.
3205
+ inputRef: handleInputRef,
3206
+ type: type
3207
+ }, inputProps, {
3208
+ ref: null
3209
+ });
3210
+ } else if (multiline) {
3211
+ if (rows && !maxRows && !minRows && !rowsMax && !rowsMin) {
3212
+ InputComponent = 'textarea';
3213
+ } else {
3214
+ inputProps = _extends({
3215
+ minRows: rows || minRows,
3216
+ rowsMax: rowsMax,
3217
+ maxRows: maxRows
3218
+ }, inputProps);
3219
+ InputComponent = TextareaAutosize;
3220
+ }
3221
+ } else {
3222
+ inputProps = _extends({
3223
+ type: type
3224
+ }, inputProps);
3225
+ }
3226
+
3227
+ var handleAutoFill = function handleAutoFill(event) {
3228
+ // Provide a fake value as Chrome might not let you access it for security reasons.
3229
+ checkDirty(event.animationName === 'mui-auto-fill-cancel' ? inputRef.current : {
3230
+ value: 'x'
3231
+ });
3232
+ };
3233
+
3234
+ React$2.useEffect(function () {
3235
+ if (muiFormControl) {
3236
+ muiFormControl.setAdornedStart(Boolean(startAdornment));
3237
+ }
3238
+ }, [muiFormControl, startAdornment]);
3239
+ return /*#__PURE__*/React$2.createElement("div", _extends({
3240
+ className: clsx(classes.root, classes["color".concat(capitalize(fcs.color || 'primary'))], className, fcs.disabled && classes.disabled, fcs.error && classes.error, fullWidth && classes.fullWidth, fcs.focused && classes.focused, muiFormControl && classes.formControl, multiline && classes.multiline, startAdornment && classes.adornedStart, endAdornment && classes.adornedEnd, fcs.margin === 'dense' && classes.marginDense),
3241
+ onClick: handleClick,
3242
+ ref: ref
3243
+ }, other), startAdornment, /*#__PURE__*/React$2.createElement(FormControlContext.Provider, {
3244
+ value: null
3245
+ }, /*#__PURE__*/React$2.createElement(InputComponent, _extends({
3246
+ "aria-invalid": fcs.error,
3247
+ "aria-describedby": ariaDescribedby,
3248
+ autoComplete: autoComplete,
3249
+ autoFocus: autoFocus,
3250
+ defaultValue: defaultValue,
3251
+ disabled: fcs.disabled,
3252
+ id: id,
3253
+ onAnimationStart: handleAutoFill,
3254
+ name: name,
3255
+ placeholder: placeholder,
3256
+ readOnly: readOnly,
3257
+ required: fcs.required,
3258
+ rows: rows,
3259
+ value: value,
3260
+ onKeyDown: onKeyDown,
3261
+ onKeyUp: onKeyUp
3262
+ }, inputProps, {
3263
+ className: clsx(classes.input, inputPropsProp.className, fcs.disabled && classes.disabled, multiline && classes.inputMultiline, fcs.hiddenLabel && classes.inputHiddenLabel, startAdornment && classes.inputAdornedStart, endAdornment && classes.inputAdornedEnd, type === 'search' && classes.inputTypeSearch, fcs.margin === 'dense' && classes.inputMarginDense),
3264
+ onBlur: handleBlur,
3265
+ onChange: handleChange,
3266
+ onFocus: handleFocus
3267
+ }))), endAdornment, renderSuffix ? renderSuffix(_extends({}, fcs, {
3268
+ startAdornment: startAdornment
3269
+ })) : null);
3270
+ });
3271
+ var InputBase$1 = withStyles(styles$2, {
3272
+ name: 'MuiInputBase'
3273
+ })(InputBase);
3274
+
3275
+ var styles$1 = function styles(theme) {
3276
+ var light = theme.palette.type === 'light';
3277
+ var bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
3278
+ return {
3279
+ /* Styles applied to the root element. */
3280
+ root: {
3281
+ position: 'relative'
3282
+ },
3283
+
3284
+ /* Styles applied to the root element if the component is a descendant of `FormControl`. */
3285
+ formControl: {
3286
+ 'label + &': {
3287
+ marginTop: 16
3288
+ }
3289
+ },
3290
+
3291
+ /* Styles applied to the root element if the component is focused. */
3292
+ focused: {},
3293
+
3294
+ /* Styles applied to the root element if `disabled={true}`. */
3295
+ disabled: {},
3296
+
3297
+ /* Styles applied to the root element if color secondary. */
3298
+ colorSecondary: {
3299
+ '&$underline:after': {
3300
+ borderBottomColor: theme.palette.secondary.main
3301
+ }
3302
+ },
3303
+
3304
+ /* Styles applied to the root element if `disableUnderline={false}`. */
3305
+ underline: {
3306
+ '&:after': {
3307
+ borderBottom: "2px solid ".concat(theme.palette.primary.main),
3308
+ left: 0,
3309
+ bottom: 0,
3310
+ // Doing the other way around crash on IE 11 "''" https://github.com/cssinjs/jss/issues/242
3311
+ content: '""',
3312
+ position: 'absolute',
3313
+ right: 0,
3314
+ transform: 'scaleX(0)',
3315
+ transition: theme.transitions.create('transform', {
3316
+ duration: theme.transitions.duration.shorter,
3317
+ easing: theme.transitions.easing.easeOut
3318
+ }),
3319
+ pointerEvents: 'none' // Transparent to the hover style.
3320
+
3321
+ },
3322
+ '&$focused:after': {
3323
+ transform: 'scaleX(1)'
3324
+ },
3325
+ '&$error:after': {
3326
+ borderBottomColor: theme.palette.error.main,
3327
+ transform: 'scaleX(1)' // error is always underlined in red
3328
+
3329
+ },
3330
+ '&:before': {
3331
+ borderBottom: "1px solid ".concat(bottomLineColor),
3332
+ left: 0,
3333
+ bottom: 0,
3334
+ // Doing the other way around crash on IE 11 "''" https://github.com/cssinjs/jss/issues/242
3335
+ content: '"\\00a0"',
3336
+ position: 'absolute',
3337
+ right: 0,
3338
+ transition: theme.transitions.create('border-bottom-color', {
3339
+ duration: theme.transitions.duration.shorter
3340
+ }),
3341
+ pointerEvents: 'none' // Transparent to the hover style.
3342
+
3343
+ },
3344
+ '&:hover:not($disabled):before': {
3345
+ borderBottom: "2px solid ".concat(theme.palette.text.primary),
3346
+ // Reset on touch devices, it doesn't add specificity
3347
+ '@media (hover: none)': {
3348
+ borderBottom: "1px solid ".concat(bottomLineColor)
3349
+ }
3350
+ },
3351
+ '&$disabled:before': {
3352
+ borderBottomStyle: 'dotted'
3353
+ }
3354
+ },
3355
+
3356
+ /* Pseudo-class applied to the root element if `error={true}`. */
3357
+ error: {},
3358
+
3359
+ /* Styles applied to the `input` element if `margin="dense"`. */
3360
+ marginDense: {},
3361
+
3362
+ /* Styles applied to the root element if `multiline={true}`. */
3363
+ multiline: {},
3364
+
3365
+ /* Styles applied to the root element if `fullWidth={true}`. */
3366
+ fullWidth: {},
3367
+
3368
+ /* Styles applied to the `input` element. */
3369
+ input: {},
3370
+
3371
+ /* Styles applied to the `input` element if `margin="dense"`. */
3372
+ inputMarginDense: {},
3373
+
3374
+ /* Styles applied to the `input` element if `multiline={true}`. */
3375
+ inputMultiline: {},
3376
+
3377
+ /* Styles applied to the `input` element if `type="search"`. */
3378
+ inputTypeSearch: {}
3379
+ };
3380
+ };
3381
+ var Input = /*#__PURE__*/React$2.forwardRef(function Input(props, ref) {
3382
+ var disableUnderline = props.disableUnderline,
3383
+ classes = props.classes,
3384
+ _props$fullWidth = props.fullWidth,
3385
+ fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
3386
+ _props$inputComponent = props.inputComponent,
3387
+ inputComponent = _props$inputComponent === void 0 ? 'input' : _props$inputComponent,
3388
+ _props$multiline = props.multiline,
3389
+ multiline = _props$multiline === void 0 ? false : _props$multiline,
3390
+ _props$type = props.type,
3391
+ type = _props$type === void 0 ? 'text' : _props$type,
3392
+ other = _objectWithoutProperties(props, ["disableUnderline", "classes", "fullWidth", "inputComponent", "multiline", "type"]);
3393
+
3394
+ return /*#__PURE__*/React$2.createElement(InputBase$1, _extends({
3395
+ classes: _extends({}, classes, {
3396
+ root: clsx(classes.root, !disableUnderline && classes.underline),
3397
+ underline: null
3398
+ }),
3399
+ fullWidth: fullWidth,
3400
+ inputComponent: inputComponent,
3401
+ multiline: multiline,
3402
+ ref: ref,
3403
+ type: type
3404
+ }, other));
3405
+ });
3406
+ Input.muiName = 'Input';
3407
+ var Input$1 = withStyles(styles$1, {
3408
+ name: 'MuiInput'
3409
+ })(Input);
3410
+
3411
+ var styles = function styles(theme) {
3412
+ return {
3413
+ /* Styles applied to the select component `root` class. */
3414
+ root: {},
3415
+
3416
+ /* Styles applied to the select component `select` class. */
3417
+ select: {
3418
+ '-moz-appearance': 'none',
3419
+ // Reset
3420
+ '-webkit-appearance': 'none',
3421
+ // Reset
3422
+ // When interacting quickly, the text can end up selected.
3423
+ // Native select can't be selected either.
3424
+ userSelect: 'none',
3425
+ borderRadius: 0,
3426
+ // Reset
3427
+ minWidth: 16,
3428
+ // So it doesn't collapse.
3429
+ cursor: 'pointer',
3430
+ '&:focus': {
3431
+ // Show that it's not an text input
3432
+ backgroundColor: theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.05)' : 'rgba(255, 255, 255, 0.05)',
3433
+ borderRadius: 0 // Reset Chrome style
3434
+
3435
+ },
3436
+ // Remove IE 11 arrow
3437
+ '&::-ms-expand': {
3438
+ display: 'none'
3439
+ },
3440
+ '&$disabled': {
3441
+ cursor: 'default'
3442
+ },
3443
+ '&[multiple]': {
3444
+ height: 'auto'
3445
+ },
3446
+ '&:not([multiple]) option, &:not([multiple]) optgroup': {
3447
+ backgroundColor: theme.palette.background.paper
3448
+ },
3449
+ '&&': {
3450
+ paddingRight: 24
3451
+ }
3452
+ },
3453
+
3454
+ /* Styles applied to the select component if `variant="filled"`. */
3455
+ filled: {
3456
+ '&&': {
3457
+ paddingRight: 32
3458
+ }
3459
+ },
3460
+
3461
+ /* Styles applied to the select component if `variant="outlined"`. */
3462
+ outlined: {
3463
+ borderRadius: theme.shape.borderRadius,
3464
+ '&&': {
3465
+ paddingRight: 32
3466
+ }
3467
+ },
3468
+
3469
+ /* Styles applied to the select component `selectMenu` class. */
3470
+ selectMenu: {
3471
+ height: 'auto',
3472
+ // Resets for multpile select with chips
3473
+ minHeight: '1.1876em',
3474
+ // Required for select\text-field height consistency
3475
+ textOverflow: 'ellipsis',
3476
+ whiteSpace: 'nowrap',
3477
+ overflow: 'hidden'
3478
+ },
3479
+
3480
+ /* Pseudo-class applied to the select component `disabled` class. */
3481
+ disabled: {},
3482
+
3483
+ /* Styles applied to the icon component. */
3484
+ icon: {
3485
+ // We use a position absolute over a flexbox in order to forward the pointer events
3486
+ // to the input and to support wrapping tags..
3487
+ position: 'absolute',
3488
+ right: 0,
3489
+ top: 'calc(50% - 12px)',
3490
+ // Center vertically
3491
+ pointerEvents: 'none',
3492
+ // Don't block pointer events on the select under the icon.
3493
+ color: theme.palette.action.active,
3494
+ '&$disabled': {
3495
+ color: theme.palette.action.disabled
3496
+ }
3497
+ },
3498
+
3499
+ /* Styles applied to the icon component if the popup is open. */
3500
+ iconOpen: {
3501
+ transform: 'rotate(180deg)'
3502
+ },
3503
+
3504
+ /* Styles applied to the icon component if `variant="filled"`. */
3505
+ iconFilled: {
3506
+ right: 7
3507
+ },
3508
+
3509
+ /* Styles applied to the icon component if `variant="outlined"`. */
3510
+ iconOutlined: {
3511
+ right: 7
3512
+ },
3513
+
3514
+ /* Styles applied to the underlying native input component. */
3515
+ nativeInput: {
3516
+ bottom: 0,
3517
+ left: 0,
3518
+ position: 'absolute',
3519
+ opacity: 0,
3520
+ pointerEvents: 'none',
3521
+ width: '100%'
3522
+ }
3523
+ };
3524
+ };
3525
+ var defaultInput = /*#__PURE__*/React$2.createElement(Input$1, null);
3526
+ /**
3527
+ * An alternative to `<Select native />` with a much smaller bundle size footprint.
3528
+ */
3529
+
3530
+ var NativeSelect = /*#__PURE__*/React$2.forwardRef(function NativeSelect(props, ref) {
3531
+ var children = props.children,
3532
+ classes = props.classes,
3533
+ _props$IconComponent = props.IconComponent,
3534
+ IconComponent = _props$IconComponent === void 0 ? ArrowDropDownIcon : _props$IconComponent,
3535
+ _props$input = props.input,
3536
+ input = _props$input === void 0 ? defaultInput : _props$input,
3537
+ inputProps = props.inputProps;
3538
+ props.variant;
3539
+ var other = _objectWithoutProperties(props, ["children", "classes", "IconComponent", "input", "inputProps", "variant"]);
3540
+
3541
+ var muiFormControl = useFormControl();
3542
+ var fcs = formControlState({
3543
+ props: props,
3544
+ muiFormControl: muiFormControl,
3545
+ states: ['variant']
3546
+ });
3547
+ return /*#__PURE__*/React$2.cloneElement(input, _extends({
3548
+ // Most of the logic is implemented in `NativeSelectInput`.
3549
+ // The `Select` component is a simple API wrapper to expose something better to play with.
3550
+ inputComponent: NativeSelectInput,
3551
+ inputProps: _extends({
3552
+ children: children,
3553
+ classes: classes,
3554
+ IconComponent: IconComponent,
3555
+ variant: fcs.variant,
3556
+ type: undefined
3557
+ }, inputProps, input ? input.props.inputProps : {}),
3558
+ ref: ref
3559
+ }, other));
3560
+ });
3561
+ NativeSelect.muiName = 'Select';
3562
+ var NativeSelect$1 = withStyles(styles, {
3563
+ name: 'MuiNativeSelect'
3564
+ })(NativeSelect);
3565
+
3566
+ var ArrowLeft = {};
3567
+
3568
+ var _interopRequireDefault$1 = interopRequireDefault.exports;
3569
+
3570
+ var _interopRequireWildcard$1 = interopRequireWildcard.exports;
3571
+
3572
+ Object.defineProperty(ArrowLeft, "__esModule", {
3573
+ value: true
3574
+ });
3575
+ var default_1$1 = ArrowLeft.default = void 0;
3576
+
3577
+ var React$1 = _interopRequireWildcard$1(React__default);
3578
+
3579
+ var _createSvgIcon$1 = _interopRequireDefault$1(requireCreateSvgIcon());
3580
+
3581
+ var _default$1 = (0, _createSvgIcon$1.default)( /*#__PURE__*/React$1.createElement("path", {
3582
+ d: "M14 7l-5 5 5 5V7z"
3583
+ }), 'ArrowLeft');
3584
+
3585
+ default_1$1 = ArrowLeft.default = _default$1;
3586
+
3587
+ var ArrowRight = {};
3588
+
3589
+ var _interopRequireDefault = interopRequireDefault.exports;
3590
+
3591
+ var _interopRequireWildcard = interopRequireWildcard.exports;
3592
+
3593
+ Object.defineProperty(ArrowRight, "__esModule", {
3594
+ value: true
3595
+ });
3596
+ var default_1 = ArrowRight.default = void 0;
3597
+
3598
+ var React = _interopRequireWildcard(React__default);
3599
+
3600
+ var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
3601
+
3602
+ var _default = (0, _createSvgIcon.default)( /*#__PURE__*/React.createElement("path", {
3603
+ d: "M10 17l5-5-5-5v10z"
3604
+ }), 'ArrowRight');
3605
+
3606
+ default_1 = ArrowRight.default = _default;
3607
+
3608
+ var css_248z = ".ntmlPagination__center {\n display: flex;\n justify-content: center; }\n .ntmlPagination__center .MuiSvgIcon-colorSecondary {\n color: #509891; }\n\n.ntmlPagination__rightSide {\n position: relative;\n float: right;\n top: -36px; }\n .ntmlPagination__rightSide-showTotal {\n display: flex;\n align-items: center; }\n .ntmlPagination__rightSide-showTotal .MuiInput-root {\n width: 90px;\n height: 34px;\n margin: 0 8px;\n padding: 2px 8px 3px 20px;\n border-radius: 17px;\n background-color: rgba(222, 219, 202, 0.4);\n border: 0px; }\n .ntmlPagination__rightSide-showTotal .MuiNativeSelect-icon {\n color: #509891; }\n .ntmlPagination__rightSide-showTotal .MuiNativeSelect-select:not([multiple]) option,\n .ntmlPagination__rightSide-showTotal .MuiNativeSelect-select:not([multiple]) optgroup {\n background-color: rgba(222, 219, 202, 0.4); }\n\n@media only screen and (max-width: 480px) {\n .ntmlPagination__center-page {\n width: 48px;\n height: 48px;\n display: flex;\n background-color: rgba(222, 219, 202, 0.4);\n border-radius: 50%;\n align-items: center;\n justify-content: center; }\n .ntmlPagination__rightSide {\n position: relative;\n float: initial;\n top: 0;\n display: flex;\n justify-content: center;\n margin-top: 28px; } }\n";
3609
+ styleInject(css_248z);
3610
+
3611
+ var NmtlPagination = function NmtlPagination(_ref) {
3612
+ var className = _ref.className,
3613
+ current = _ref.current,
3614
+ defaultCurrent = _ref.defaultCurrent,
3615
+ pageSize = _ref.pageSize,
3616
+ total = _ref.total,
3617
+ _onChange = _ref.onChange;
3618
+ var isMobile = useMediaQuery('(max-width:480px)');
3619
+ var count = Math.ceil(total / pageSize);
3620
+ var pages = Array.from(Array(count).keys(), function (x) {
3621
+ return x + 1;
3622
+ });
3623
+ var handlePageSelected = function handlePageSelected(event) {
3624
+ var page = event.target.value;
3625
+ _onChange(page);
3626
+ };
3627
+ return /*#__PURE__*/React__default.createElement("div", {
3628
+ className: classNames('ntmlPagination', className)
3629
+ }, /*#__PURE__*/React__default.createElement("div", {
3630
+ className: "ntmlPagination__center"
3631
+ }, /*#__PURE__*/React__default.createElement("div", {
3632
+ style: {
3633
+ display: 'flex',
3634
+ alignItems: 'center'
3635
+ }
3636
+ }, /*#__PURE__*/React__default.createElement(IconButton, {
3637
+ disabled: current === 1,
3638
+ onClick: function onClick() {
3639
+ return _onChange(current - 1);
3640
+ }
3641
+ }, /*#__PURE__*/React__default.createElement(default_1$1, {
3642
+ color: "secondary"
3643
+ })), isMobile ? /*#__PURE__*/React__default.createElement("div", {
3644
+ className: "ntmlPagination__center-page"
3645
+ }, current) : /*#__PURE__*/React__default.createElement(Pagination$1, {
3646
+ color: "secondary",
3647
+ count: count,
3648
+ boundaryCount: 1,
3649
+ siblingCount: 0,
3650
+ page: current,
3651
+ defaultPage: defaultCurrent,
3652
+ hideNextButton: true,
3653
+ hidePrevButton: true,
3654
+ onChange: function onChange(event, value) {
3655
+ return _onChange(value);
3656
+ }
3657
+ }), /*#__PURE__*/React__default.createElement(IconButton, {
3658
+ disabled: current === count,
3659
+ onClick: function onClick() {
3660
+ return _onChange(current + 1);
3661
+ }
3662
+ }, /*#__PURE__*/React__default.createElement(default_1, {
3663
+ color: "secondary"
3664
+ })))), /*#__PURE__*/React__default.createElement("div", {
3665
+ className: "ntmlPagination__rightSide"
3666
+ }, /*#__PURE__*/React__default.createElement("div", {
3667
+ className: "ntmlPagination__rightSide-showTotal"
3668
+ }, /*#__PURE__*/React__default.createElement("span", null, "\u76EE\u524D\u5728\u7B2C"), /*#__PURE__*/React__default.createElement(NativeSelect$1, {
3669
+ value: current,
3670
+ onChange: handlePageSelected
3671
+ }, pages.map(function (page) {
3672
+ return /*#__PURE__*/React__default.createElement("option", {
3673
+ value: page
3674
+ }, page);
3675
+ })), /*#__PURE__*/React__default.createElement("span", null, "\u9801\uFF0C\u5171"), count, /*#__PURE__*/React__default.createElement("span", null, "\u9801"))));
3676
+ };
3677
+ NmtlPagination.defaultProps = {
3678
+ className: undefined,
3679
+ current: undefined,
3680
+ defaultCurrent: 1,
3681
+ pageSize: 10,
3682
+ total: undefined,
3683
+ onChange: undefined
3684
+ };
3685
+
3686
+ /* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
3687
+ NmtlPagination.propTypes = {
3688
+ /** Css Name */
3689
+ className: PropTypes.string,
3690
+ /** 当前页数 */
3691
+ current: PropTypes.number,
3692
+ /** 默认的当前页数 */
3693
+ defaultCurrent: PropTypes.number,
3694
+ /** 每页条数 */
3695
+ pageSize: PropTypes.number,
3696
+ /** 数据总数 */
3697
+ total: PropTypes.number,
3698
+ /** 页码或 pageSize 改变的回调,参数是改变后的页码及每页条数 */
3699
+ onChange: PropTypes.func
3700
+ };
3701
+
3702
+ export { NmtlPagination as default };