@codejq/react-simple-snackbar 1.2.0
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.
- package/LICENSE.md +8 -0
- package/README.md +339 -0
- package/dist/index.es.js +15 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/package.json +103 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
Copyright (c) 2019 - Evandro Macedo
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
5
|
+
|
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./Logo.png" alt="React Simple Snackbar Logo">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a
|
|
7
|
+
href="https://www.npmjs.com/package/react-simple-snackbar"
|
|
8
|
+
title="NPM Version"
|
|
9
|
+
target="blank"
|
|
10
|
+
>
|
|
11
|
+
<img
|
|
12
|
+
src="https://img.shields.io/npm/v/react-simple-snackbar"
|
|
13
|
+
alt="NPM Version"
|
|
14
|
+
/>
|
|
15
|
+
</a>
|
|
16
|
+
<a
|
|
17
|
+
href="https://github.com/codejq/react-simple-snackbar/actions/workflows/npm-publish.yml"
|
|
18
|
+
title="CI Status"
|
|
19
|
+
target="blank"
|
|
20
|
+
>
|
|
21
|
+
<img
|
|
22
|
+
src="https://github.com/codejq/react-simple-snackbar/actions/workflows/npm-publish.yml/badge.svg"
|
|
23
|
+
alt="CI Status"
|
|
24
|
+
/>
|
|
25
|
+
</a>
|
|
26
|
+
<a
|
|
27
|
+
href="https://coveralls.io/github/codejq/react-simple-snackbar?branch=master"
|
|
28
|
+
title="Coverage Status"
|
|
29
|
+
target="blank"
|
|
30
|
+
>
|
|
31
|
+
<img
|
|
32
|
+
src="https://coveralls.io/repos/github/codejq/react-simple-snackbar/badge.svg?branch=master"
|
|
33
|
+
alt="Coverage Status"
|
|
34
|
+
/>
|
|
35
|
+
</a>
|
|
36
|
+
<a href="#" title="Gzipped size">
|
|
37
|
+
<img
|
|
38
|
+
src="https://img.badgesize.io/codejq/react-simple-snackbar/master/dist/index.js.svg?compression=gzip"
|
|
39
|
+
alt="Gzipped size"
|
|
40
|
+
/>
|
|
41
|
+
</a>
|
|
42
|
+
<a href="https://standardjs.com" title="JavaScript Style Guide" target="blank">
|
|
43
|
+
<img
|
|
44
|
+
src="https://img.shields.io/badge/code_style-standard-brightgreen.svg"
|
|
45
|
+
alt="JavaScript Style Guide"
|
|
46
|
+
/>
|
|
47
|
+
</a>
|
|
48
|
+
<a
|
|
49
|
+
href="https://github.com/codejq/react-simple-snackbar/blob/master/LICENSE.md"
|
|
50
|
+
title="MIT License"
|
|
51
|
+
target="blank"
|
|
52
|
+
>
|
|
53
|
+
<img
|
|
54
|
+
src="https://img.shields.io/npm/l/@testing-library/react-hooks.svg"
|
|
55
|
+
alt="MIT License"
|
|
56
|
+
/>
|
|
57
|
+
</a>
|
|
58
|
+
</p>
|
|
59
|
+
|
|
60
|
+
> **This is the actively maintained fork** of the original `react-simple-snackbar` by [@evandromacedo](https://github.com/evandromacedo). The original repository is no longer maintained.
|
|
61
|
+
|
|
62
|
+
You can check the [live demo](https://codejq.github.io/react-simple-snackbar/).
|
|
63
|
+
|
|
64
|
+
## Getting Started
|
|
65
|
+
|
|
66
|
+
### Requirements
|
|
67
|
+
|
|
68
|
+
Requires **React 16.8 or later**. Compatible with React 16.8 through React 19.
|
|
69
|
+
|
|
70
|
+
### Installation
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
npm install --save @codejq/react-simple-snackbar
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
or
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
yarn add @codejq/react-simple-snackbar
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Basic Usage
|
|
83
|
+
|
|
84
|
+
First, you need to wrap your application into a `SnackbarProvider`:
|
|
85
|
+
|
|
86
|
+
```jsx
|
|
87
|
+
// App.js
|
|
88
|
+
import React from 'react'
|
|
89
|
+
import SnackbarProvider from '@codejq/react-simple-snackbar'
|
|
90
|
+
import SomeChildComponent from './SomeChildComponent'
|
|
91
|
+
|
|
92
|
+
export default function App() {
|
|
93
|
+
return (
|
|
94
|
+
<SnackbarProvider>
|
|
95
|
+
<SomeChildComponent />
|
|
96
|
+
</SnackbarProvider>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Then you can use both options on any descendant component:
|
|
102
|
+
|
|
103
|
+
#### 1. `useSnackbar()` hook on function components
|
|
104
|
+
|
|
105
|
+
<!-- prettier-ignore -->
|
|
106
|
+
```jsx
|
|
107
|
+
// SomeChildComponent.js
|
|
108
|
+
import React from 'react'
|
|
109
|
+
import { useSnackbar } from '@codejq/react-simple-snackbar'
|
|
110
|
+
|
|
111
|
+
export default function SomeChildComponent() {
|
|
112
|
+
const [openSnackbar, closeSnackbar] = useSnackbar()
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<div>
|
|
116
|
+
<button onClick={() => openSnackbar('This is the content of the Snackbar.')}>
|
|
117
|
+
Click me to open the Snackbar!
|
|
118
|
+
</button>
|
|
119
|
+
<button onClick={closeSnackbar}>
|
|
120
|
+
Click me to close the Snackbar programmatically.
|
|
121
|
+
</button>
|
|
122
|
+
</div>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### 2. `withSnackbar()` HoC on class components
|
|
128
|
+
|
|
129
|
+
<!-- prettier-ignore -->
|
|
130
|
+
```jsx
|
|
131
|
+
// SomeChildComponent.js
|
|
132
|
+
import React from 'react'
|
|
133
|
+
import { withSnackbar } from '@codejq/react-simple-snackbar'
|
|
134
|
+
|
|
135
|
+
class SomeChildComponent extends React.Component {
|
|
136
|
+
render() {
|
|
137
|
+
const { openSnackbar, closeSnackbar } = this.props
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<div>
|
|
141
|
+
<button onClick={() => openSnackbar('This is the content of the Snackbar.')}>
|
|
142
|
+
Click me to open the Snackbar!
|
|
143
|
+
</button>
|
|
144
|
+
<button onClick={closeSnackbar}>
|
|
145
|
+
Click me to close the Snackbar programmatically.
|
|
146
|
+
</button>
|
|
147
|
+
</div>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export default withSnackbar(SomeChildComponent)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## API
|
|
156
|
+
|
|
157
|
+
### Methods
|
|
158
|
+
|
|
159
|
+
These methods are returned from `useSnackbar()` hook in array destructuring syntax:
|
|
160
|
+
|
|
161
|
+
```js noLines
|
|
162
|
+
const [openSnackbar, closeSnackbar] = useSnackbar()
|
|
163
|
+
|
|
164
|
+
// You can also give different names as you wish
|
|
165
|
+
const [open, close] = useSnackbar()
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Or added as additional props on components wrapped in `withSnackbar()`:
|
|
169
|
+
|
|
170
|
+
```js noLines
|
|
171
|
+
const { openSnackbar, closeSnackbar } = this.props
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### `openSnackbar(node [, duration [, backgroundColor]])`
|
|
175
|
+
|
|
176
|
+
- **`node`**: the node you want to show into the Snackbar. It can be just `"Some string like showed on Basic Usage"`, or `<p>Some element you would <strong>like</strong> to show</p>`.
|
|
177
|
+
|
|
178
|
+
- **`duration`**: a number in milliseconds to set the duration of the Snackbar. The default value is `8000`.
|
|
179
|
+
|
|
180
|
+
- **`backgroundColor`**: an optional CSS color string to override the Snackbar's background color for this specific call. Equivalent to passing `style: { backgroundColor: '...' }` in the options object, but applied per-call. Takes precedence over the `style.backgroundColor` option.
|
|
181
|
+
|
|
182
|
+
```jsx
|
|
183
|
+
// Basic
|
|
184
|
+
openSnackbar('Hello!')
|
|
185
|
+
|
|
186
|
+
// With custom duration
|
|
187
|
+
openSnackbar('Hello!', 3000)
|
|
188
|
+
|
|
189
|
+
// With custom duration and background color
|
|
190
|
+
openSnackbar('Error occurred', 5000, '#e53935')
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
#### `closeSnackbar()`
|
|
194
|
+
|
|
195
|
+
This method is used if you want to close the Snackbar programmatically. It doesn't receive any params.
|
|
196
|
+
|
|
197
|
+
### Options
|
|
198
|
+
|
|
199
|
+
You can pass an options object to customize your Snackbar. This object can be passed either in `useSnackbar([options])` or as the second argument of `withSnackbar(Component [, options])`.
|
|
200
|
+
|
|
201
|
+
#### Position
|
|
202
|
+
|
|
203
|
+
- **`position`**: a custom position for your Snackbar. The default value is `bottom-center`.
|
|
204
|
+
|
|
205
|
+
| Value | Description |
|
|
206
|
+
| --- | --- |
|
|
207
|
+
| `top-left` | Top of viewport, left-aligned |
|
|
208
|
+
| `top-center` | Top of viewport, centered |
|
|
209
|
+
| `top-right` | Top of viewport, right-aligned |
|
|
210
|
+
| `bottom-left` | Bottom of viewport, left-aligned |
|
|
211
|
+
| `bottom-center` | Bottom of viewport, centered **(default)** |
|
|
212
|
+
| `bottom-right` | Bottom of viewport, right-aligned |
|
|
213
|
+
|
|
214
|
+
#### Styling
|
|
215
|
+
|
|
216
|
+
- **`style`**: a [style object](https://reactjs.org/docs/dom-elements.html#style) with `camelCased` properties and string values. These styles are applied to the Snackbar itself. Use `style.backgroundColor` to set a global background color for all calls.
|
|
217
|
+
|
|
218
|
+
- **`closeStyle`**: same as above, but the styles are applied to the close button. You can use font properties to style the `X` icon.
|
|
219
|
+
|
|
220
|
+
#### Full Example
|
|
221
|
+
|
|
222
|
+
```jsx noLines
|
|
223
|
+
const options = {
|
|
224
|
+
position: 'bottom-right',
|
|
225
|
+
style: {
|
|
226
|
+
backgroundColor: 'midnightblue',
|
|
227
|
+
border: '2px solid lightgreen',
|
|
228
|
+
color: 'lightblue',
|
|
229
|
+
fontFamily: 'Menlo, monospace',
|
|
230
|
+
fontSize: '20px',
|
|
231
|
+
textAlign: 'center',
|
|
232
|
+
},
|
|
233
|
+
closeStyle: {
|
|
234
|
+
color: 'lightcoral',
|
|
235
|
+
fontSize: '16px',
|
|
236
|
+
},
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Usage with hooks
|
|
240
|
+
const [openSnackbar] = useSnackbar(options)
|
|
241
|
+
openSnackbar('Styled message!')
|
|
242
|
+
|
|
243
|
+
// Override background color for a specific call
|
|
244
|
+
openSnackbar('Error!', 5000, '#e53935')
|
|
245
|
+
|
|
246
|
+
// Usage with HoC
|
|
247
|
+
withSnackbar(Component, options)
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Testing
|
|
251
|
+
|
|
252
|
+
> The snackbar itself is [already tested](https://github.com/codejq/react-simple-snackbar/tree/master/src/__tests__) and you don't have to worry about it.
|
|
253
|
+
|
|
254
|
+
To test components that use Snackbar functionalities, there are some approaches as described below. These examples use [Jest](https://jestjs.io/) and [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/).
|
|
255
|
+
|
|
256
|
+
### Testing components that use `useSnackbar()` hook
|
|
257
|
+
|
|
258
|
+
You can mock the implementation of `useSnackbar` to return an array containing `openSnackbar` and `closeSnackbar` as mocked functions:
|
|
259
|
+
|
|
260
|
+
<!-- prettier-ignore -->
|
|
261
|
+
```jsx
|
|
262
|
+
// Component.test.js
|
|
263
|
+
import React from 'react'
|
|
264
|
+
import { render, fireEvent } from '@testing-library/react'
|
|
265
|
+
import * as Snackbar from '@codejq/react-simple-snackbar'
|
|
266
|
+
import Component from './Component'
|
|
267
|
+
|
|
268
|
+
// Mocks the open and close functions
|
|
269
|
+
const openSnackbarMock = jest.fn()
|
|
270
|
+
const closeSnackbarMock = jest.fn()
|
|
271
|
+
jest.spyOn(Snackbar, 'useSnackbar').mockImplementation(() => [openSnackbarMock, closeSnackbarMock])
|
|
272
|
+
|
|
273
|
+
it('can test the openSnackbar and closeSnackbar functions', () => {
|
|
274
|
+
const { getByRole } = render(<Component />)
|
|
275
|
+
|
|
276
|
+
// Simulates click on some buttons that opens and closes the Snackbar
|
|
277
|
+
fireEvent.click(getByRole('button', { name: /open/i }))
|
|
278
|
+
fireEvent.click(getByRole('button', { name: /close/i }))
|
|
279
|
+
|
|
280
|
+
// Some examples of how you can test the mocks
|
|
281
|
+
expect(openSnackbarMock).toHaveBeenCalled()
|
|
282
|
+
expect(openSnackbarMock).toHaveBeenCalledTimes(1)
|
|
283
|
+
expect(openSnackbarMock).toHaveBeenCalledWith('This is the text of the Snackbar.')
|
|
284
|
+
expect(closeSnackbarMock).toHaveBeenCalled()
|
|
285
|
+
expect(closeSnackbarMock).toHaveBeenCalledTimes(1)
|
|
286
|
+
})
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Testing components wrapped in `withSnackbar()` HoC
|
|
290
|
+
|
|
291
|
+
To make it easier to test and not make use of `SnackbarProvider`, you can export your component in isolation as a named export, and as a default export wrapped in `withSnackbar()`:
|
|
292
|
+
|
|
293
|
+
```jsx
|
|
294
|
+
// Component.js
|
|
295
|
+
|
|
296
|
+
// (...)
|
|
297
|
+
// * Here goes all the component's code *
|
|
298
|
+
// (...)
|
|
299
|
+
|
|
300
|
+
// Named export for testing, and default export for using
|
|
301
|
+
export { Component }
|
|
302
|
+
export default withSnackbar(Component)
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
So you can get the component as a named import, then mock the `openSnackbar` and `closeSnackbar` functions as common props if you want:
|
|
306
|
+
|
|
307
|
+
```jsx
|
|
308
|
+
// Component.test.js
|
|
309
|
+
import React from 'react'
|
|
310
|
+
import { render, fireEvent } from '@testing-library/react'
|
|
311
|
+
import { Component } from './Component'
|
|
312
|
+
|
|
313
|
+
it('can test the openSnackbar and closeSnackbar functions', () => {
|
|
314
|
+
const openSnackbarMock = jest.fn()
|
|
315
|
+
const closeSnackbarMock = jest.fn()
|
|
316
|
+
const { getByRole } = render(
|
|
317
|
+
<Component openSnackbar={openSnackbarMock} closeSnackbar={closeSnackbarMock} />
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
// Simulates click on some buttons that opens and closes the Snackbar
|
|
321
|
+
fireEvent.click(getByRole('button', { name: /open/i }))
|
|
322
|
+
fireEvent.click(getByRole('button', { name: /close/i }))
|
|
323
|
+
|
|
324
|
+
// Some examples of how you can test the mocks
|
|
325
|
+
expect(openSnackbarMock).toHaveBeenCalled()
|
|
326
|
+
expect(openSnackbarMock).toHaveBeenCalledTimes(1)
|
|
327
|
+
expect(openSnackbarMock).toHaveBeenCalledWith('This is the text of the Snackbar.')
|
|
328
|
+
expect(closeSnackbarMock).toHaveBeenCalled()
|
|
329
|
+
expect(closeSnackbarMock).toHaveBeenCalledTimes(1)
|
|
330
|
+
})
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
## Contributing
|
|
334
|
+
|
|
335
|
+
See [CONTRIBUTING](https://github.com/codejq/react-simple-snackbar/blob/master/CONTRIBUTING.md) for more information on how to get started.
|
|
336
|
+
|
|
337
|
+
## License
|
|
338
|
+
|
|
339
|
+
React Simple Snackbar is open source software [licensed as MIT](https://github.com/codejq/react-simple-snackbar/blob/master/LICENSE.md).
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import e,{useState as t,useReducer as n,useRef as r,useCallback as a,useMemo as o,createContext as c,useContext as i}from"react";import s from"react-dom";function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,c,i=[],s=!0,p=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){p=!0,a=e}finally{try{if(!s&&null!=n.return&&(c=n.return(),Object(c)!==c))return}finally{if(p)throw a}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}function b(e,t,n){return(t=f(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},d.apply(null,arguments)}function m(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,y(e,t)}var _={exports:{}},k={exports:{}},h={},g="function"==typeof Symbol&&Symbol.for,x=g?Symbol.for("react.element"):60103,S=g?Symbol.for("react.portal"):60106,E=g?Symbol.for("react.fragment"):60107,O=g?Symbol.for("react.strict_mode"):60108,w=g?Symbol.for("react.profiler"):60114,C=g?Symbol.for("react.provider"):60109,j=g?Symbol.for("react.context"):60110,N=g?Symbol.for("react.async_mode"):60111,P=g?Symbol.for("react.concurrent_mode"):60111,T=g?Symbol.for("react.forward_ref"):60112,R=g?Symbol.for("react.suspense"):60113,$=g?Symbol.for("react.suspense_list"):60120,D=g?Symbol.for("react.memo"):60115,A=g?Symbol.for("react.lazy"):60116,I=g?Symbol.for("react.block"):60121,M=g?Symbol.for("react.fundamental"):60117,V=g?Symbol.for("react.responder"):60118,Y=g?Symbol.for("react.scope"):60119;function L(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case x:switch(e=e.type){case N:case P:case E:case w:case O:case R:return e;default:switch(e=e&&e.$$typeof){case j:case T:case A:case D:case C:return e;default:return t}}case S:return t}}}function z(e){return L(e)===P}h.AsyncMode=N,h.ConcurrentMode=P,h.ContextConsumer=j,h.ContextProvider=C,h.Element=x,h.ForwardRef=T,h.Fragment=E,h.Lazy=A,h.Memo=D,h.Portal=S,h.Profiler=w,h.StrictMode=O,h.Suspense=R,h.isAsyncMode=function(e){return z(e)||L(e)===N},h.isConcurrentMode=z,h.isContextConsumer=function(e){return L(e)===j},h.isContextProvider=function(e){return L(e)===C},h.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===x},h.isForwardRef=function(e){return L(e)===T},h.isFragment=function(e){return L(e)===E},h.isLazy=function(e){return L(e)===A},h.isMemo=function(e){return L(e)===D},h.isPortal=function(e){return L(e)===S},h.isProfiler=function(e){return L(e)===w},h.isStrictMode=function(e){return L(e)===O},h.isSuspense=function(e){return L(e)===R},h.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===E||e===P||e===w||e===O||e===R||e===$||"object"==typeof e&&null!==e&&(e.$$typeof===A||e.$$typeof===D||e.$$typeof===C||e.$$typeof===j||e.$$typeof===T||e.$$typeof===M||e.$$typeof===V||e.$$typeof===Y||e.$$typeof===I)},h.typeOf=L;var F={};
|
|
2
|
+
/** @license React v16.13.1
|
|
3
|
+
* react-is.development.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,i=e?Symbol.for("react.context"):60110,s=e?Symbol.for("react.async_mode"):60111,p=e?Symbol.for("react.concurrent_mode"):60111,l=e?Symbol.for("react.forward_ref"):60112,u=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,b=e?Symbol.for("react.memo"):60115,d=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,_=e?Symbol.for("react.scope"):60119;function k(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:var m=e.type;switch(m){case s:case p:case r:case o:case a:case u:return m;default:var y=m&&m.$$typeof;switch(y){case i:case l:case d:case b:case c:return y;default:return f}}case n:return f}}}var h=s,g=p,x=i,S=c,E=t,O=l,w=r,C=d,j=b,N=n,P=o,T=a,R=u,$=!1;function D(e){return k(e)===p}F.AsyncMode=h,F.ConcurrentMode=g,F.ContextConsumer=x,F.ContextProvider=S,F.Element=E,F.ForwardRef=O,F.Fragment=w,F.Lazy=C,F.Memo=j,F.Portal=N,F.Profiler=P,F.StrictMode=T,F.Suspense=R,F.isAsyncMode=function(e){return $||($=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),D(e)||k(e)===s},F.isConcurrentMode=D,F.isContextConsumer=function(e){return k(e)===i},F.isContextProvider=function(e){return k(e)===c},F.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},F.isForwardRef=function(e){return k(e)===l},F.isFragment=function(e){return k(e)===r},F.isLazy=function(e){return k(e)===d},F.isMemo=function(e){return k(e)===b},F.isPortal=function(e){return k(e)===n},F.isProfiler=function(e){return k(e)===o},F.isStrictMode=function(e){return k(e)===a},F.isSuspense=function(e){return k(e)===u},F.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===p||e===o||e===a||e===u||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===b||e.$$typeof===c||e.$$typeof===i||e.$$typeof===l||e.$$typeof===y||e.$$typeof===v||e.$$typeof===_||e.$$typeof===m)},F.typeOf=k}(),"production"===process.env.NODE_ENV?k.exports=h:k.exports=F
|
|
10
|
+
/*
|
|
11
|
+
object-assign
|
|
12
|
+
(c) Sindre Sorhus
|
|
13
|
+
@license MIT
|
|
14
|
+
*/;var H=Object.getOwnPropertySymbols,q=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var G=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(e){a[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},a)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,a=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o<arguments.length;o++){for(var c in n=Object(arguments[o]))q.call(n,c)&&(a[c]=n[c]);if(H){r=H(n);for(var i=0;i<r.length;i++)W.call(n,r[i])&&(a[r[i]]=n[r[i]])}}return a},Q="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",X=function(){};if("production"!==process.env.NODE_ENV){var U=Q,B={},J=Function.call.bind(Object.prototype.hasOwnProperty);X=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function K(e,t,n,r,a){if("production"!==process.env.NODE_ENV)for(var o in e)if(J(e,o)){var c;try{if("function"!=typeof e[o]){var i=Error((r||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.");throw i.name="Invariant Violation",i}c=e[o](t,o,r,n,null,U)}catch(e){c=e}if(!c||c instanceof Error||X((r||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof c+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),c instanceof Error&&!(c.message in B)){B[c.message]=!0;var s=a?a():"";X("Failed "+n+" type: "+c.message+(null!=s?s:""))}}}K.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(B={})};var Z=K,ee=k.exports,te=G,ne=Q,re=Z,ae=Function.call.bind(Object.prototype.hasOwnProperty),oe=function(){};function ce(){return null}"production"!==process.env.NODE_ENV&&(oe=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}});var ie=Q;function se(){}function pe(){}pe.resetWarningCache=se;if("production"!==process.env.NODE_ENV){var le=k.exports;_.exports=function(e,t){var n="function"==typeof Symbol&&Symbol.iterator,r="<<anonymous>>",a={array:s("array"),bool:s("boolean"),func:s("function"),number:s("number"),object:s("object"),string:s("string"),symbol:s("symbol"),any:i(ce),arrayOf:function(e){return i(function(t,n,r,a,o){if("function"!=typeof e)return new c("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var i=t[n];if(!Array.isArray(i))return new c("Invalid "+a+" `"+o+"` of type `"+l(i)+"` supplied to `"+r+"`, expected an array.");for(var s=0;s<i.length;s++){var p=e(i,s,r,a,o+"["+s+"]",ne);if(p instanceof Error)return p}return null})},element:i(function(t,n,r,a,o){var i=t[n];return e(i)?null:new c("Invalid "+a+" `"+o+"` of type `"+l(i)+"` supplied to `"+r+"`, expected a single ReactElement.")}),elementType:i(function(e,t,n,r,a){var o=e[t];return ee.isValidElementType(o)?null:new c("Invalid "+r+" `"+a+"` of type `"+l(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")}),instanceOf:function(e){return i(function(t,n,a,o,i){if(!(t[n]instanceof e)){var s=e.name||r;return new c("Invalid "+o+" `"+i+"` of type `"+((p=t[n]).constructor&&p.constructor.name?p.constructor.name:r)+"` supplied to `"+a+"`, expected instance of `"+s+"`.")}var p;return null})},node:i(function(e,t,n,r,a){return p(e[t])?null:new c("Invalid "+r+" `"+a+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return i(function(t,n,r,a,o){if("function"!=typeof e)return new c("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var i=t[n],s=l(i);if("object"!==s)return new c("Invalid "+a+" `"+o+"` of type `"+s+"` supplied to `"+r+"`, expected an object.");for(var p in i)if(ae(i,p)){var u=e(i,p,r,a,o+"."+p,ne);if(u instanceof Error)return u}return null})},oneOf:function(e){return Array.isArray(e)?i(function(t,n,r,a,i){for(var s=t[n],p=0;p<e.length;p++)if(o(s,e[p]))return null;var l=JSON.stringify(e,function(e,t){return"symbol"===u(t)?String(t):t});return new c("Invalid "+a+" `"+i+"` of value `"+String(s)+"` supplied to `"+r+"`, expected one of "+l+".")}):("production"!==process.env.NODE_ENV&&oe(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),ce)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&oe("Invalid argument supplied to oneOfType, expected an instance of array."),ce;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return oe("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+f(n)+" at index "+t+"."),ce}return i(function(t,n,r,a,o){for(var i=0;i<e.length;i++)if(null==(0,e[i])(t,n,r,a,o,ne))return null;return new c("Invalid "+a+" `"+o+"` supplied to `"+r+"`.")})},shape:function(e){return i(function(t,n,r,a,o){var i=t[n],s=l(i);if("object"!==s)return new c("Invalid "+a+" `"+o+"` of type `"+s+"` supplied to `"+r+"`, expected `object`.");for(var p in e){var u=e[p];if(u){var f=u(i,p,r,a,o+"."+p,ne);if(f)return f}}return null})},exact:function(e){return i(function(t,n,r,a,o){var i=t[n],s=l(i);if("object"!==s)return new c("Invalid "+a+" `"+o+"` of type `"+s+"` supplied to `"+r+"`, expected `object`.");var p=te({},t[n],e);for(var u in p){var f=e[u];if(!f)return new c("Invalid "+a+" `"+o+"` key `"+u+"` supplied to `"+r+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var b=f(i,u,r,a,o+"."+u,ne);if(b)return b}return null})}};function o(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function c(e){this.message=e,this.stack=""}function i(e){if("production"!==process.env.NODE_ENV)var n={},a=0;function o(o,i,s,p,l,u,f){if(p=p||r,u=u||s,f!==ne){if(t){var b=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw b.name="Invariant Violation",b}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var d=p+":"+s;!n[d]&&a<3&&(oe("You are manually calling a React.PropTypes validation function for the `"+u+"` prop on `"+p+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[d]=!0,a++)}}return null==i[s]?o?null===i[s]?new c("The "+l+" `"+u+"` is marked as required in `"+p+"`, but its value is `null`."):new c("The "+l+" `"+u+"` is marked as required in `"+p+"`, but its value is `undefined`."):null:e(i,s,p,l,u)}var i=o.bind(null,!1);return i.isRequired=o.bind(null,!0),i}function s(e){return i(function(t,n,r,a,o,i){var s=t[n];return l(s)!==e?new c("Invalid "+a+" `"+o+"` of type `"+u(s)+"` supplied to `"+r+"`, expected `"+e+"`."):null})}function p(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(p);if(null===t||e(t))return!0;var r=function(e){var t=e&&(n&&e[n]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!r)return!1;var a,o=r.call(t);if(r!==t.entries){for(;!(a=o.next()).done;)if(!p(a.value))return!1}else for(;!(a=o.next()).done;){var c=a.value;if(c&&!p(c[1]))return!1}return!0;default:return!1}}function l(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function u(e){if(null==e)return""+e;var t=l(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function f(e){var t=u(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return c.prototype=Error.prototype,a.checkPropTypes=re,a.resetWarningCache=re.resetWarningCache,a.PropTypes=a,a}(le.isElement,!0)}else _.exports=function(){function e(e,t,n,r,a,o){if(o!==ie){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:pe,resetWarningCache:se};return n.PropTypes=n,n}();var ue=_.exports;function fe(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var be=!1,de="production"!==process.env.NODE_ENV?ue.oneOfType([ue.number,ue.shape({enter:ue.number,exit:ue.number,appear:ue.number}).isRequired]):null,me="production"!==process.env.NODE_ENV?ue.oneOfType([ue.string,ue.shape({enter:ue.string,exit:ue.string,active:ue.string}),ue.shape({enter:ue.string,enterDone:ue.string,enterActive:ue.string,exit:ue.string,exitDone:ue.string,exitActive:ue.string})]):null,ye=e.createContext(null),ve="unmounted",_e="exited",ke="entering",he="entered",ge="exiting",xe=function(t){function n(e,n){var r;r=t.call(this,e,n)||this;var a,o=n&&!n.isMounting?e.enter:e.appear;return r.appearStatus=null,e.in?o?(a=_e,r.appearStatus=ke):a=he:a=e.unmountOnExit||e.mountOnEnter?ve:_e,r.state={status:a},r.nextCallback=null,r}v(n,t),n.getDerivedStateFromProps=function(e,t){return e.in&&t.status===ve?{status:_e}:null};var r=n.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==ke&&n!==he&&(t=ke):n!==ke&&n!==he||(t=ge)}this.updateStatus(!1,t)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!=typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},r.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),t===ke?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&this.state.status===_e&&this.setState({status:ve})},r.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,a=this.props.nodeRef?[r]:[s.findDOMNode(this),r],o=a[0],c=a[1],i=this.getTimeouts(),p=r?i.appear:i.enter;!e&&!n||be?this.safeSetState({status:he},function(){t.props.onEntered(o)}):(this.props.onEnter(o,c),this.safeSetState({status:ke},function(){t.props.onEntering(o,c),t.onTransitionEnd(p,function(){t.safeSetState({status:he},function(){t.props.onEntered(o,c)})})}))},r.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:s.findDOMNode(this);t&&!be?(this.props.onExit(r),this.safeSetState({status:ge},function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:_e},function(){e.props.onExited(r)})})})):this.safeSetState({status:_e},function(){e.props.onExited(r)})},r.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},r.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},r.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:s.findDOMNode(this),r=null==e&&!this.props.addEndListener;if(n&&!r){if(this.props.addEndListener){var a=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],o=a[0],c=a[1];this.props.addEndListener(o,c)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},r.render=function(){var t=this.state.status;if(t===ve)return null;var n=this.props,r=n.children;n.in,n.mountOnEnter,n.unmountOnExit,n.appear,n.enter,n.exit,n.timeout,n.addEndListener,n.onEnter,n.onEntering,n.onEntered,n.onExit,n.onExiting,n.onExited,n.nodeRef;var a=m(n,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return e.createElement(ye.Provider,{value:null},"function"==typeof r?r(t,a):e.cloneElement(e.Children.only(r),a))},n}(e.Component);function Se(){}xe.contextType=ye,xe.propTypes="production"!==process.env.NODE_ENV?{nodeRef:ue.shape({current:"undefined"==typeof Element?ue.any:ue.instanceOf(Element)}),children:ue.oneOfType([ue.func.isRequired,ue.element.isRequired]).isRequired,in:ue.bool,mountOnEnter:ue.bool,unmountOnExit:ue.bool,appear:ue.bool,enter:ue.bool,exit:ue.bool,timeout:function(e){var t=de;e.addEndListener||(t=t.isRequired);for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return t.apply(void 0,[e].concat(r))},addEndListener:ue.func,onEnter:ue.func,onEntering:ue.func,onEntered:ue.func,onExit:ue.func,onExiting:ue.func,onExited:ue.func}:{},xe.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Se,onEntering:Se,onEntered:Se,onExit:Se,onExiting:Se,onExited:Se},xe.UNMOUNTED=ve,xe.EXITED=_e,xe.ENTERING=ke,xe.ENTERED=he,xe.EXITING=ge;var Ee=xe,Oe=function(e,t){return e&&t&&t.split(" ").forEach(function(t){return r=t,void((n=e).classList?n.classList.add(r):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(n,r)||("string"==typeof n.className?n.className=n.className+" "+r:n.setAttribute("class",(n.className&&n.className.baseVal||"")+" "+r)));var n,r})},we=function(e,t){return e&&t&&t.split(" ").forEach(function(t){return r=t,void((n=e).classList?n.classList.remove(r):"string"==typeof n.className?n.className=fe(n.className,r):n.setAttribute("class",fe(n.className&&n.className.baseVal||"",r)));var n,r})},Ce=function(t){function n(){for(var e,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return(e=t.call.apply(t,[this].concat(r))||this).appliedClasses={appear:{},enter:{},exit:{}},e.onEnter=function(t,n){var r=e.resolveArguments(t,n),a=r[0],o=r[1];e.removeClasses(a,"exit"),e.addClass(a,o?"appear":"enter","base"),e.props.onEnter&&e.props.onEnter(t,n)},e.onEntering=function(t,n){var r=e.resolveArguments(t,n),a=r[0],o=r[1]?"appear":"enter";e.addClass(a,o,"active"),e.props.onEntering&&e.props.onEntering(t,n)},e.onEntered=function(t,n){var r=e.resolveArguments(t,n),a=r[0],o=r[1]?"appear":"enter";e.removeClasses(a,o),e.addClass(a,o,"done"),e.props.onEntered&&e.props.onEntered(t,n)},e.onExit=function(t){var n=e.resolveArguments(t)[0];e.removeClasses(n,"appear"),e.removeClasses(n,"enter"),e.addClass(n,"exit","base"),e.props.onExit&&e.props.onExit(t)},e.onExiting=function(t){var n=e.resolveArguments(t)[0];e.addClass(n,"exit","active"),e.props.onExiting&&e.props.onExiting(t)},e.onExited=function(t){var n=e.resolveArguments(t)[0];e.removeClasses(n,"exit"),e.addClass(n,"exit","done"),e.props.onExited&&e.props.onExited(t)},e.resolveArguments=function(t,n){return e.props.nodeRef?[e.props.nodeRef.current,t]:[t,n]},e.getClassNames=function(t){var n=e.props.classNames,r="string"==typeof n,a=r?""+(r&&n?n+"-":"")+t:n[t];return{baseClassName:a,activeClassName:r?a+"-active":n[t+"Active"],doneClassName:r?a+"-done":n[t+"Done"]}},e}v(n,t);var r=n.prototype;return r.addClass=function(e,t,n){var r=this.getClassNames(t)[n+"ClassName"],a=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===n&&a&&(r+=" "+a),"active"===n&&e&&e.scrollTop,r&&(this.appliedClasses[t][n]=r,Oe(e,r))},r.removeClasses=function(e,t){var n=this.appliedClasses[t],r=n.base,a=n.active,o=n.done;this.appliedClasses[t]={},r&&we(e,r),a&&we(e,a),o&&we(e,o)},r.render=function(){var t=this.props;t.classNames;var n=m(t,["classNames"]);return e.createElement(Ee,d({},n,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},n}(e.Component);Ce.defaultProps={classNames:""},Ce.propTypes="production"!==process.env.NODE_ENV?d({},Ee.propTypes,{classNames:me,onEnter:ue.func,onEntering:ue.func,onEntered:ue.func,onExit:ue.func,onExiting:ue.func,onExited:ue.func}):{};var je=Ce;var Ne={"snackbar-wrapper":"Snackbar_snackbar-wrapper__ocbPJ","snackbar-wrapper-top-left":"Snackbar_snackbar-wrapper-top-left__kU4xa","snackbar-wrapper-top-right":"Snackbar_snackbar-wrapper-top-right__2CAmf","snackbar-wrapper-bottom-left":"Snackbar_snackbar-wrapper-bottom-left__-7yn0","snackbar-wrapper-bottom-right":"Snackbar_snackbar-wrapper-bottom-right__8wQeQ","snackbar-wrapper-top-center":"Snackbar_snackbar-wrapper-top-center__1Gbfi","snackbar-wrapper-bottom-center":"Snackbar_snackbar-wrapper-bottom-center__21ghq","snackbar-wrapper-center":"Snackbar_snackbar-wrapper-center__2hNe7",snackbar:"Snackbar_snackbar__GsYZl","snackbar-progress":"Snackbar_snackbar-progress__3GR5W",snackbar__text:"Snackbar_snackbar__text__1Hx2a",snackbar__close:"Snackbar_snackbar__close__NCHgT","snackbar-enter-center":"Snackbar_snackbar-enter-center__282DI","snackbar-enter-active-center":"Snackbar_snackbar-enter-active-center__V9s11","snackbar-exit-active-center":"Snackbar_snackbar-exit-active-center__HKTEJ","snackbar-enter-top-center":"Snackbar_snackbar-enter-top-center__2hv_H","snackbar-enter-active-top-center":"Snackbar_snackbar-enter-active-top-center__sy6SN","snackbar-exit-active-top-center":"Snackbar_snackbar-exit-active-top-center__3MvcF","snackbar-enter-bottom-center":"Snackbar_snackbar-enter-bottom-center__KWFO3","snackbar-enter-active-bottom-center":"Snackbar_snackbar-enter-active-bottom-center__2zcYl","snackbar-exit-active-bottom-center":"Snackbar_snackbar-exit-active-bottom-center__oO6Rn","snackbar-enter-top-left":"Snackbar_snackbar-enter-top-left__5McRQ","snackbar-enter-top-right":"Snackbar_snackbar-enter-top-right__3IZID","snackbar-enter-active-top-left":"Snackbar_snackbar-enter-active-top-left__2EQ5v","snackbar-enter-active-top-right":"Snackbar_snackbar-enter-active-top-right__1Jhh8","snackbar-exit-active-top-left":"Snackbar_snackbar-exit-active-top-left__25M1C","snackbar-exit-active-top-right":"Snackbar_snackbar-exit-active-top-right__1QPvY","snackbar-enter-bottom-left":"Snackbar_snackbar-enter-bottom-left__21M-k","snackbar-enter-bottom-right":"Snackbar_snackbar-enter-bottom-right__20sEa","snackbar-enter-active-bottom-left":"Snackbar_snackbar-enter-active-bottom-left__hXac0","snackbar-enter-active-bottom-right":"Snackbar_snackbar-enter-active-bottom-right__2QyBV","snackbar-exit-active-bottom-left":"Snackbar_snackbar-exit-active-bottom-left__2tT-Y","snackbar-exit-active-bottom-right":"Snackbar_snackbar-exit-active-bottom-right__GOHKw"};function Pe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pe(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===n&&r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}('.Snackbar_snackbar-wrapper__ocbPJ{position:fixed;z-index:9999;pointer-events:none}.Snackbar_snackbar-wrapper-top-left__kU4xa{top:24px;left:24px}.Snackbar_snackbar-wrapper-top-right__2CAmf{top:24px;right:24px}.Snackbar_snackbar-wrapper-bottom-left__-7yn0{bottom:24px;left:24px}.Snackbar_snackbar-wrapper-bottom-right__8wQeQ{bottom:24px;right:24px}.Snackbar_snackbar-wrapper-top-center__1Gbfi{top:24px;left:50%;transform:translateX(-50%)}.Snackbar_snackbar-wrapper-bottom-center__21ghq{bottom:24px;left:50%;transform:translateX(-50%)}.Snackbar_snackbar-wrapper-center__2hNe7{top:50%;left:50%;transform:translate(-50%,-50%)}.Snackbar_snackbar__GsYZl{display:flex;align-items:center;gap:14px;min-width:400px;max-width:580px;padding:16px 18px 20px 22px;background:rgba(15,15,20,.92);backdrop-filter:blur(20px) saturate(180%);-webkit-backdrop-filter:blur(20px) saturate(180%);border:1px solid hsla(0,0%,100%,.1);border-radius:16px;box-shadow:0 32px 80px rgba(0,0,0,.5),0 8px 32px rgba(0,0,0,.3),inset 0 1px 0 hsla(0,0%,100%,.06);color:#f1f5f9;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;font-size:15px;font-weight:450;line-height:1.55;letter-spacing:-.01em;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:relative;overflow:hidden;pointer-events:all}.Snackbar_snackbar__GsYZl:after{content:"";position:absolute;bottom:0;left:0;height:3px;width:100%;background:linear-gradient(90deg,#6366f1,#8b5cf6 50%,#ec4899);border-radius:0 0 16px 16px;animation:Snackbar_snackbar-progress__3GR5W var(--snackbar-duration,6s) linear forwards;transform-origin:left center}@keyframes Snackbar_snackbar-progress__3GR5W{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.Snackbar_snackbar__text__1Hx2a{flex:1;padding:0;margin:0;pointer-events:auto}.Snackbar_snackbar__close__NCHgT{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;margin:0;background:hsla(0,0%,100%,.08);border:none;border-radius:50%;color:hsla(0,0%,100%,.6);cursor:pointer;pointer-events:auto;-webkit-tap-highlight-color:transparent;outline:none;font-size:11px;transition:background .15s ease,color .15s ease,transform .15s ease}.Snackbar_snackbar__close__NCHgT:hover{background:hsla(0,0%,100%,.18);color:#fff;transform:scale(1.1)}.Snackbar_snackbar__close__NCHgT:active{transform:scale(.95)}.Snackbar_snackbar-enter-center__282DI{opacity:0;transform:translate(-50%,-50%) scale(.88)}.Snackbar_snackbar-enter-active-center__V9s11{opacity:1;transform:translate(-50%,-50%) scale(1);transition:opacity .28s ease,transform .3s cubic-bezier(.34,1.56,.64,1)}.Snackbar_snackbar-exit-active-center__HKTEJ{opacity:0;transform:translate(-50%,-50%) scale(.88);transition:opacity .2s ease,transform .22s ease-in}.Snackbar_snackbar-enter-top-center__2hv_H{opacity:0;transform:translateX(-50%) translateY(-28px) scale(.95)}.Snackbar_snackbar-enter-active-top-center__sy6SN{opacity:1;transform:translateX(-50%) translateY(0) scale(1);transition:opacity .25s ease,transform .28s cubic-bezier(.22,1,.36,1)}.Snackbar_snackbar-exit-active-top-center__3MvcF{opacity:0;transform:translateX(-50%) translateY(-18px) scale(.95);transition:opacity .2s ease,transform .22s ease-in}.Snackbar_snackbar-enter-bottom-center__KWFO3{opacity:0;transform:translateX(-50%) translateY(28px) scale(.95)}.Snackbar_snackbar-enter-active-bottom-center__2zcYl{opacity:1;transform:translateX(-50%) translateY(0) scale(1);transition:opacity .25s ease,transform .28s cubic-bezier(.22,1,.36,1)}.Snackbar_snackbar-exit-active-bottom-center__oO6Rn{opacity:0;transform:translateX(-50%) translateY(18px) scale(.95);transition:opacity .2s ease,transform .22s ease-in}.Snackbar_snackbar-enter-top-left__5McRQ,.Snackbar_snackbar-enter-top-right__3IZID{opacity:0;transform:translateY(-28px) scale(.95)}.Snackbar_snackbar-enter-active-top-left__2EQ5v,.Snackbar_snackbar-enter-active-top-right__1Jhh8{opacity:1;transform:translateY(0) scale(1);transition:opacity .25s ease,transform .28s cubic-bezier(.22,1,.36,1)}.Snackbar_snackbar-exit-active-top-left__25M1C,.Snackbar_snackbar-exit-active-top-right__1QPvY{opacity:0;transform:translateY(-18px) scale(.95);transition:opacity .2s ease,transform .22s ease-in}.Snackbar_snackbar-enter-bottom-left__21M-k,.Snackbar_snackbar-enter-bottom-right__20sEa{opacity:0;transform:translateY(28px) scale(.95)}.Snackbar_snackbar-enter-active-bottom-left__hXac0,.Snackbar_snackbar-enter-active-bottom-right__2QyBV{opacity:1;transform:translateY(0) scale(1);transition:opacity .25s ease,transform .28s cubic-bezier(.22,1,.36,1)}.Snackbar_snackbar-exit-active-bottom-left__2tT-Y,.Snackbar_snackbar-exit-active-bottom-right__GOHKw{opacity:0;transform:translateY(18px) scale(.95);transition:opacity .2s ease,transform .22s ease-in}@media (max-width:540px){.Snackbar_snackbar__GsYZl{min-width:calc(100vw - 32px);max-width:calc(100vw - 32px)}.Snackbar_snackbar-wrapper-top-center__1Gbfi,.Snackbar_snackbar-wrapper-top-left__kU4xa,.Snackbar_snackbar-wrapper-top-right__2CAmf{top:16px;left:16px;right:16px;transform:none}.Snackbar_snackbar-wrapper-bottom-center__21ghq,.Snackbar_snackbar-wrapper-bottom-left__-7yn0,.Snackbar_snackbar-wrapper-bottom-right__8wQeQ,.Snackbar_snackbar-wrapper-center__2hNe7{bottom:16px;left:16px;right:16px;transform:none}.Snackbar_snackbar-wrapper-center__2hNe7{top:auto}.Snackbar_snackbar-enter-bottom-center__KWFO3,.Snackbar_snackbar-enter-center__282DI,.Snackbar_snackbar-enter-top-center__2hv_H{transform:translateY(20px) scale(.95)}.Snackbar_snackbar-enter-active-bottom-center__2zcYl,.Snackbar_snackbar-enter-active-center__V9s11,.Snackbar_snackbar-enter-active-top-center__sy6SN{transform:translateY(0) scale(1)}.Snackbar_snackbar-exit-active-bottom-center__oO6Rn,.Snackbar_snackbar-exit-active-center__HKTEJ,.Snackbar_snackbar-exit-active-top-center__3MvcF{transform:translateY(12px) scale(.95)}}');var Re="center",$e=6e3,De=["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right","center"],Ae=c(null),Ie={text:"",duration:$e,position:Re,customStyles:{},closeCustomStyles:{}};function Me(e,t){return"OPEN"===t.type?Te(Te({},e),{},{text:t.text,duration:t.duration,position:t.position,customStyles:t.customStyles,closeCustomStyles:t.closeCustomStyles}):e}function Ve(c){var i=c.children,s=l(t(!1),2),p=s[0],u=s[1],f=l(n(Me,Ie),2),b=f[0],d=f[1],m=r(null),y=r(null),v=r(!1);v.current=p;var _=a(function(){u(!1)},[]),k=a(function(e,t,n,r,a){d({type:"OPEN",text:e,duration:t,position:n,customStyles:r,closeCustomStyles:a}),u(!0)},[]),h=a(function(e,t,n,r,a){!0===v.current?(u(!1),setTimeout(function(){k(e,t,n,r,a)},250)):k(e,t,n,r,a)},[k]),g=o(function(){return{openSnackbar:h,closeSnackbar:_}},[h,_]);return e.createElement(Ae.Provider,{value:g},i,e.createElement(je,{nodeRef:y,in:p,timeout:{enter:300,exit:220},mountOnEnter:!0,unmountOnExit:!0,onEnter:function(){clearTimeout(m.current),m.current=setTimeout(_,b.duration)},className:"".concat(Ne["snackbar-wrapper"]," ").concat(Ne["snackbar-wrapper-".concat(b.position)]),classNames:{enter:"".concat(Ne["snackbar-enter"]," ").concat(Ne["snackbar-enter-".concat(b.position)]),enterActive:"".concat(Ne["snackbar-enter-active"]," ").concat(Ne["snackbar-enter-active-".concat(b.position)]),exitActive:"".concat(Ne["snackbar-exit-active"]," ").concat(Ne["snackbar-exit-active-".concat(b.position)])}},e.createElement("div",{ref:y},e.createElement("div",{className:Ne.snackbar,style:Te({"--snackbar-duration":"".concat(b.duration,"ms")},b.customStyles)},e.createElement("div",{className:Ne.snackbar__text},b.text),e.createElement("button",{onClick:_,className:Ne.snackbar__close,style:b.closeCustomStyles},e.createElement(Ye,null))))))}var Ye=function(){return e.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 12 12"},e.createElement("path",{fill:"currentColor",d:"M11.73 1.58L7.31 6l4.42 4.42-1.06 1.06-4.42-4.42-4.42 4.42-1.06-1.06L5.19 6 .77 1.58 1.83.52l4.42 4.42L10.67.52z",fillRule:"evenodd"}))};function Le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ze(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Le(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Le(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Fe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.position,n=void 0===t?Re:t,r=e.style,o=void 0===r?{}:r,c=e.closeStyle,s=void 0===c?{}:c,p=i(Ae),l=p.openSnackbar,u=p.closeSnackbar,f=De.includes(n)?n:Re,b=a(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=n?ze(ze({},o),{},{backgroundColor:n}):o;l(e,t,f,r,s)},[l,f,o,s]);return[b,u]};function He(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,f(r.key),r)}}function qe(e,t){if(t&&("object"==u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function We(e){return We=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},We(e)}function Ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Xe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Xe=function(){return!!e})()}function Ue(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.position,o=void 0===a?Re:a,c=r.style,i=void 0===c?{}:c,s=r.closeStyle,p=void 0===s?{}:s,l=De.includes(o)?o:Re;return n=function(){function n(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t=function(e,t,n){return t=We(t),qe(e,Xe()?Reflect.construct(t,n||[],We(e).constructor):t.apply(e,n))}(this,n,[e]),t.open=t.open.bind(t),t.close=t.close.bind(t),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t)}(n,e.Component),function(e,t,n){return t&&He(e.prototype,t),n&&He(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(n,[{key:"open",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.context.openSnackbar,a=n?Qe(Qe({},i),{},{backgroundColor:n}):i;r(e,t,l,a,p)}},{key:"close",value:function(){(0,this.context.closeSnackbar)()}},{key:"render",value:function(){return e.createElement(t,d({openSnackbar:this.open,closeSnackbar:this.close},this.props))}}])}(),b(n,"contextType",Ae),n}export{Ve as default,Fe as useSnackbar,Ue as withSnackbar};
|
|
15
|
+
//# sourceMappingURL=index.es.js.map
|