@daoyi/nmtl-ui 2.0.1-beta.13 → 2.0.1-beta.130

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