@popmenu/audio-player 0.126.0 → 0.126.1
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/build/esm/_virtual/index.js +4 -0
- package/build/esm/_virtual/index.js.map +1 -0
- package/build/{components → esm/components}/AudioPlayer/AudioPlayer.d.ts +3 -3
- package/build/esm/components/AudioPlayer/AudioPlayer.js +67 -0
- package/build/esm/components/AudioPlayer/AudioPlayer.js.map +1 -0
- package/build/{components → esm/components}/AudioPlayer/AudioPlayerProps.d.ts +10 -10
- package/build/{components → esm/components}/AudioPlayer/index.d.ts +2 -2
- package/build/{components → esm/components}/AudioPlayer/util/audioPlayerReducer.d.ts +11 -11
- package/build/esm/components/AudioPlayer/util/audioPlayerReducer.js +113 -0
- package/build/esm/components/AudioPlayer/util/audioPlayerReducer.js.map +1 -0
- package/build/{components → esm/components}/AudioPlayer/util/formatTime.d.ts +1 -1
- package/build/esm/components/AudioPlayer/util/formatTime.js +13 -0
- package/build/esm/components/AudioPlayer/util/formatTime.js.map +1 -0
- package/build/{components → esm/components}/AudioPlayer/util/index.d.ts +5 -5
- package/build/{components → esm/components}/AudioPlayer/util/setupAudioRef.d.ts +8 -8
- package/build/esm/components/AudioPlayer/util/setupAudioRef.js +34 -0
- package/build/esm/components/AudioPlayer/util/setupAudioRef.js.map +1 -0
- package/build/{components → esm/components}/AudioPlayer/util/types.d.ts +77 -77
- package/build/esm/components/AudioPlayer/util/types.js +33 -0
- package/build/esm/components/AudioPlayer/util/types.js.map +1 -0
- package/build/{components → esm/components}/AudioPlayer/util/useVolumeIcon.d.ts +2 -2
- package/build/esm/components/AudioPlayer/util/useVolumeIcon.js +23 -0
- package/build/esm/components/AudioPlayer/util/useVolumeIcon.js.map +1 -0
- package/build/{components → esm/components}/index.d.ts +1 -1
- package/build/{index.d.ts → esm/index.d.ts} +1 -1
- package/build/esm/index.js +2 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/node_modules/classnames/index.js +81 -0
- package/build/esm/node_modules/classnames/index.js.map +1 -0
- package/build/index.js +281 -1235
- package/build/index.js.map +1 -1
- package/package.json +7 -4
- package/build/index.es.js +0 -1258
- package/build/index.es.js.map +0 -1
package/build/index.js
CHANGED
|
@@ -1,121 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var tslib = require('tslib');
|
|
5
4
|
var React = require('react');
|
|
5
|
+
var webIcons = require('@popmenu/web-icons');
|
|
6
6
|
var core = require('@material-ui/core');
|
|
7
|
-
require('@
|
|
8
|
-
require('@material-ui/core/AppBar');
|
|
9
|
-
var MuiAvatar = require('@material-ui/core/Avatar');
|
|
10
|
-
var styles = require('@material-ui/core/styles');
|
|
11
|
-
require('@material-ui/core/Badge');
|
|
12
|
-
require('@material-ui/core/Button');
|
|
13
|
-
require('@material-ui/core/CircularProgress');
|
|
14
|
-
require('@material-ui/core/ButtonGroup');
|
|
15
|
-
require('@material-ui/core/Card');
|
|
16
|
-
require('@material-ui/core/CardActionArea');
|
|
17
|
-
require('@material-ui/core/CardActions');
|
|
18
|
-
require('@material-ui/core/CardContent');
|
|
19
|
-
require('@material-ui/core/CardHeader');
|
|
20
|
-
require('@material-ui/core/CardMedia');
|
|
21
|
-
var MuiCheckbox = require('@material-ui/core/Checkbox');
|
|
22
|
-
var FormControlLabel = require('@material-ui/core/FormControlLabel');
|
|
23
|
-
require('@material-ui/core/Chip');
|
|
24
|
-
require('@material-ui/core/Collapse');
|
|
25
|
-
require('@material-ui/core/Dialog');
|
|
26
|
-
require('@material-ui/core/DialogActions');
|
|
27
|
-
require('@material-ui/core/DialogContent');
|
|
28
|
-
require('@material-ui/core/DialogTitle');
|
|
29
|
-
require('@material-ui/core/Drawer');
|
|
30
|
-
require('@material-ui/core/FormControl');
|
|
31
|
-
require('@material-ui/core/Grid');
|
|
32
|
-
var MuiIconButton = require('@material-ui/core/IconButton');
|
|
33
|
-
require('@material-ui/core/InputAdornment');
|
|
34
|
-
require('@material-ui/core/LinearProgress');
|
|
35
|
-
require('@material-ui/core/List');
|
|
36
|
-
require('@material-ui/core/ListItem');
|
|
37
|
-
require('@material-ui/core/ListItemAvatar');
|
|
38
|
-
require('@material-ui/core/ListItemIcon');
|
|
39
|
-
require('@material-ui/core/ListItemSecondaryAction');
|
|
40
|
-
require('@material-ui/core/ListItemText');
|
|
41
|
-
require('@material-ui/core/Menu');
|
|
42
|
-
require('@material-ui/core/MenuItem');
|
|
43
|
-
require('@material-ui/core/MenuList');
|
|
44
|
-
var MuiRadio = require('@material-ui/core/Radio');
|
|
45
|
-
require('@material-ui/core/TextField');
|
|
46
|
-
var MuiSwitch = require('@material-ui/core/Switch');
|
|
47
|
-
require('@material-ui/core/Tab');
|
|
48
|
-
require('@material-ui/core/Tabs');
|
|
49
|
-
var MuiToggleButton = require('@material-ui/lab/ToggleButton');
|
|
50
|
-
var MuiToggleButtonGroup = require('@material-ui/lab/ToggleButtonGroup');
|
|
51
|
-
var MuiTooltip = require('@material-ui/core/Tooltip');
|
|
52
|
-
|
|
53
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
54
|
-
|
|
55
|
-
function _interopNamespace(e) {
|
|
56
|
-
if (e && e.__esModule) return e;
|
|
57
|
-
var n = Object.create(null);
|
|
58
|
-
if (e) {
|
|
59
|
-
Object.keys(e).forEach(function (k) {
|
|
60
|
-
if (k !== 'default') {
|
|
61
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
62
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
63
|
-
enumerable: true,
|
|
64
|
-
get: function () {
|
|
65
|
-
return e[k];
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
n['default'] = e;
|
|
72
|
-
return Object.freeze(n);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
76
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
77
|
-
var MuiAvatar__default = /*#__PURE__*/_interopDefaultLegacy(MuiAvatar);
|
|
78
|
-
var MuiCheckbox__default = /*#__PURE__*/_interopDefaultLegacy(MuiCheckbox);
|
|
79
|
-
var FormControlLabel__default = /*#__PURE__*/_interopDefaultLegacy(FormControlLabel);
|
|
80
|
-
var MuiIconButton__default = /*#__PURE__*/_interopDefaultLegacy(MuiIconButton);
|
|
81
|
-
var MuiRadio__default = /*#__PURE__*/_interopDefaultLegacy(MuiRadio);
|
|
82
|
-
var MuiSwitch__default = /*#__PURE__*/_interopDefaultLegacy(MuiSwitch);
|
|
83
|
-
var MuiToggleButton__default = /*#__PURE__*/_interopDefaultLegacy(MuiToggleButton);
|
|
84
|
-
var MuiToggleButtonGroup__default = /*#__PURE__*/_interopDefaultLegacy(MuiToggleButtonGroup);
|
|
85
|
-
var MuiTooltip__default = /*#__PURE__*/_interopDefaultLegacy(MuiTooltip);
|
|
86
|
-
|
|
87
|
-
/*! *****************************************************************************
|
|
88
|
-
Copyright (c) Microsoft Corporation.
|
|
89
|
-
|
|
90
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
91
|
-
purpose with or without fee is hereby granted.
|
|
92
|
-
|
|
93
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
94
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
95
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
96
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
97
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
98
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
99
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
100
|
-
***************************************************************************** */
|
|
101
|
-
|
|
102
|
-
var __assign$1 = function() {
|
|
103
|
-
__assign$1 = Object.assign || function __assign(t) {
|
|
104
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
105
|
-
s = arguments[i];
|
|
106
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
107
|
-
}
|
|
108
|
-
return t;
|
|
109
|
-
};
|
|
110
|
-
return __assign$1.apply(this, arguments);
|
|
111
|
-
};
|
|
7
|
+
var commonUi = require('@popmenu/common-ui');
|
|
112
8
|
|
|
113
|
-
var classnames
|
|
9
|
+
var classnames = {exports: {}};
|
|
114
10
|
|
|
115
11
|
/*!
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
12
|
+
Copyright (c) 2018 Jed Watson.
|
|
13
|
+
Licensed under the MIT License (MIT), see
|
|
14
|
+
http://jedwatson.github.io/classnames
|
|
119
15
|
*/
|
|
120
16
|
|
|
121
17
|
(function (module) {
|
|
@@ -125,299 +21,57 @@ var classnames$1 = {exports: {}};
|
|
|
125
21
|
|
|
126
22
|
var hasOwn = {}.hasOwnProperty;
|
|
127
23
|
|
|
128
|
-
function classNames() {
|
|
129
|
-
var classes =
|
|
24
|
+
function classNames () {
|
|
25
|
+
var classes = '';
|
|
130
26
|
|
|
131
27
|
for (var i = 0; i < arguments.length; i++) {
|
|
132
28
|
var arg = arguments[i];
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
var argType = typeof arg;
|
|
136
|
-
|
|
137
|
-
if (argType === 'string' || argType === 'number') {
|
|
138
|
-
classes.push(arg);
|
|
139
|
-
} else if (Array.isArray(arg)) {
|
|
140
|
-
if (arg.length) {
|
|
141
|
-
var inner = classNames.apply(null, arg);
|
|
142
|
-
if (inner) {
|
|
143
|
-
classes.push(inner);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
} else if (argType === 'object') {
|
|
147
|
-
if (arg.toString === Object.prototype.toString) {
|
|
148
|
-
for (var key in arg) {
|
|
149
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
150
|
-
classes.push(key);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
} else {
|
|
154
|
-
classes.push(arg.toString());
|
|
155
|
-
}
|
|
29
|
+
if (arg) {
|
|
30
|
+
classes = appendClass(classes, parseValue(arg));
|
|
156
31
|
}
|
|
157
32
|
}
|
|
158
33
|
|
|
159
|
-
return classes
|
|
34
|
+
return classes;
|
|
160
35
|
}
|
|
161
36
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
window.classNames = classNames;
|
|
167
|
-
}
|
|
168
|
-
}());
|
|
169
|
-
}(classnames$1));
|
|
170
|
-
|
|
171
|
-
var classNames$1 = classnames$1.exports;
|
|
172
|
-
|
|
173
|
-
var _path$Q;
|
|
174
|
-
|
|
175
|
-
function _extends$21() { _extends$21 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$21.apply(this, arguments); }
|
|
176
|
-
|
|
177
|
-
function SvgPause(props) {
|
|
178
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$21({
|
|
179
|
-
viewBox: "0 0 16 16",
|
|
180
|
-
fill: "none",
|
|
181
|
-
strokeLinecap: "round",
|
|
182
|
-
strokeLinejoin: "round",
|
|
183
|
-
width: "1em",
|
|
184
|
-
height: "1em"
|
|
185
|
-
}, props), _path$Q || (_path$Q = /*#__PURE__*/React__namespace.createElement("path", {
|
|
186
|
-
d: "M6.667 2.667H4v10.666h2.667V2.666zm5.333 0H9.333v10.666H12V2.666z",
|
|
187
|
-
stroke: "currentColor"
|
|
188
|
-
})));
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
var _path$P;
|
|
192
|
-
|
|
193
|
-
function _extends$1$() { _extends$1$ = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1$.apply(this, arguments); }
|
|
194
|
-
|
|
195
|
-
function SvgPlay(props) {
|
|
196
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1$({
|
|
197
|
-
viewBox: "0 0 16 16",
|
|
198
|
-
fill: "none",
|
|
199
|
-
strokeLinecap: "round",
|
|
200
|
-
strokeLinejoin: "round",
|
|
201
|
-
width: "1em",
|
|
202
|
-
height: "1em"
|
|
203
|
-
}, props), _path$P || (_path$P = /*#__PURE__*/React__namespace.createElement("path", {
|
|
204
|
-
d: "M3.333 2l9.334 6-9.334 6V2z",
|
|
205
|
-
stroke: "currentColor"
|
|
206
|
-
})));
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
var _path$I;
|
|
210
|
-
|
|
211
|
-
function _extends$1O() { _extends$1O = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1O.apply(this, arguments); }
|
|
212
|
-
|
|
213
|
-
function SvgVolumeDown(props) {
|
|
214
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1O({
|
|
215
|
-
viewBox: "0 0 16 16",
|
|
216
|
-
fill: "none",
|
|
217
|
-
strokeLinecap: "round",
|
|
218
|
-
strokeLinejoin: "round",
|
|
219
|
-
width: "1em",
|
|
220
|
-
height: "1em"
|
|
221
|
-
}, props), _path$I || (_path$I = /*#__PURE__*/React__namespace.createElement("path", {
|
|
222
|
-
d: "M8.999 3.333L5.665 6H3v4h2.666L9 12.667V3.333zm3.026 2.307a3.333 3.333 0 010 4.714",
|
|
223
|
-
stroke: "currentColor"
|
|
224
|
-
})));
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
var _path$H;
|
|
228
|
-
|
|
229
|
-
function _extends$1N() { _extends$1N = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1N.apply(this, arguments); }
|
|
230
|
-
|
|
231
|
-
function SvgVolumeMute(props) {
|
|
232
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1N({
|
|
233
|
-
viewBox: "0 0 16 16",
|
|
234
|
-
fill: "none",
|
|
235
|
-
strokeLinecap: "round",
|
|
236
|
-
strokeLinejoin: "round",
|
|
237
|
-
width: "1em",
|
|
238
|
-
height: "1em"
|
|
239
|
-
}, props), _path$H || (_path$H = /*#__PURE__*/React__namespace.createElement("path", {
|
|
240
|
-
d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333z",
|
|
241
|
-
stroke: "currentColor"
|
|
242
|
-
})));
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
var _path$G;
|
|
246
|
-
|
|
247
|
-
function _extends$1M() { _extends$1M = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1M.apply(this, arguments); }
|
|
248
|
-
|
|
249
|
-
function SvgVolumeOff(props) {
|
|
250
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1M({
|
|
251
|
-
viewBox: "0 0 16 16",
|
|
252
|
-
fill: "none",
|
|
253
|
-
strokeLinecap: "round",
|
|
254
|
-
strokeLinejoin: "round",
|
|
255
|
-
width: "1em",
|
|
256
|
-
height: "1em"
|
|
257
|
-
}, props), _path$G || (_path$G = /*#__PURE__*/React__namespace.createElement("path", {
|
|
258
|
-
d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333zm8 2.667l-4 4m0-4l4 4",
|
|
259
|
-
stroke: "currentColor"
|
|
260
|
-
})));
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
var _path$F;
|
|
264
|
-
|
|
265
|
-
function _extends$1L() { _extends$1L = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1L.apply(this, arguments); }
|
|
266
|
-
|
|
267
|
-
function SvgVolumeUp(props) {
|
|
268
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1L({
|
|
269
|
-
viewBox: "0 0 16 16",
|
|
270
|
-
fill: "none",
|
|
271
|
-
strokeLinecap: "round",
|
|
272
|
-
strokeLinejoin: "round",
|
|
273
|
-
width: "1em",
|
|
274
|
-
height: "1em"
|
|
275
|
-
}, props), _path$F || (_path$F = /*#__PURE__*/React__namespace.createElement("path", {
|
|
276
|
-
d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333zm5.38-.046a6.667 6.667 0 010 9.426M10.36 5.64a3.333 3.333 0 010 4.713",
|
|
277
|
-
stroke: "currentColor"
|
|
278
|
-
})));
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/*! *****************************************************************************
|
|
282
|
-
Copyright (c) Microsoft Corporation.
|
|
283
|
-
|
|
284
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
285
|
-
purpose with or without fee is hereby granted.
|
|
286
|
-
|
|
287
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
288
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
289
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
290
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
291
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
292
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
293
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
294
|
-
***************************************************************************** */
|
|
295
|
-
|
|
296
|
-
var __assign = function() {
|
|
297
|
-
__assign = Object.assign || function __assign(t) {
|
|
298
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
299
|
-
s = arguments[i];
|
|
300
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
301
|
-
}
|
|
302
|
-
return t;
|
|
303
|
-
};
|
|
304
|
-
return __assign.apply(this, arguments);
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
function __rest(s, e) {
|
|
308
|
-
var t = {};
|
|
309
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
310
|
-
t[p] = s[p];
|
|
311
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
312
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
313
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
314
|
-
t[p[i]] = s[p[i]];
|
|
315
|
-
}
|
|
316
|
-
return t;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
var _path$1D;
|
|
320
|
-
|
|
321
|
-
function _extends$3H() { _extends$3H = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3H.apply(this, arguments); }
|
|
322
|
-
|
|
323
|
-
function SvgUser(props) {
|
|
324
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$3H({
|
|
325
|
-
viewBox: "0 0 16 16",
|
|
326
|
-
fill: "none",
|
|
327
|
-
strokeLinecap: "round",
|
|
328
|
-
strokeLinejoin: "round",
|
|
329
|
-
width: "1em",
|
|
330
|
-
height: "1em"
|
|
331
|
-
}, props), _path$1D || (_path$1D = /*#__PURE__*/React__namespace.createElement("path", {
|
|
332
|
-
d: "M13.333 14v-1.333A2.667 2.667 0 0010.667 10H5.333a2.667 2.667 0 00-2.666 2.667V14M8 7.333A2.667 2.667 0 108 2a2.667 2.667 0 000 5.333z",
|
|
333
|
-
stroke: "currentColor"
|
|
334
|
-
})));
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
var useIconStyles = core.makeStyles(function (_a) {
|
|
338
|
-
var spacing = _a.spacing, palette = _a.palette;
|
|
339
|
-
var getFontSize = function (_a) {
|
|
340
|
-
var size = _a.size;
|
|
341
|
-
var sizes = {
|
|
342
|
-
inherit: 'inherit',
|
|
343
|
-
small: spacing(1.5),
|
|
344
|
-
medium: spacing(2),
|
|
345
|
-
large: spacing(2.5),
|
|
346
|
-
'extra-large': spacing(3),
|
|
347
|
-
};
|
|
348
|
-
return size ? sizes[size] : 'inherit';
|
|
349
|
-
};
|
|
350
|
-
var getColor = function (props) {
|
|
351
|
-
var semanticColors = ['primary', 'secondary', 'info', 'success', 'warning', 'error'];
|
|
352
|
-
var value = 'inherit';
|
|
353
|
-
if (props.color) {
|
|
354
|
-
if (semanticColors.includes(props.color.split('.')[0])) {
|
|
355
|
-
var _a = props.color.split('.'), color = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
|
|
356
|
-
// @ts-expect-error - todo.
|
|
357
|
-
value = palette[color][variant];
|
|
358
|
-
}
|
|
359
|
-
else if (props.color.search(/^(rgb|hsla|#)/) !== -1) {
|
|
360
|
-
value = props.color;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
return value;
|
|
364
|
-
};
|
|
365
|
-
return {
|
|
366
|
-
root: {
|
|
367
|
-
color: getColor,
|
|
368
|
-
fontSize: getFontSize,
|
|
369
|
-
strokeWidth: '1.3px',
|
|
370
|
-
},
|
|
371
|
-
};
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
var classnames = {exports: {}};
|
|
375
|
-
|
|
376
|
-
/*!
|
|
377
|
-
Copyright (c) 2018 Jed Watson.
|
|
378
|
-
Licensed under the MIT License (MIT), see
|
|
379
|
-
http://jedwatson.github.io/classnames
|
|
380
|
-
*/
|
|
381
|
-
|
|
382
|
-
(function (module) {
|
|
383
|
-
/* global define */
|
|
384
|
-
|
|
385
|
-
(function () {
|
|
37
|
+
function parseValue (arg) {
|
|
38
|
+
if (typeof arg === 'string' || typeof arg === 'number') {
|
|
39
|
+
return arg;
|
|
40
|
+
}
|
|
386
41
|
|
|
387
|
-
|
|
42
|
+
if (typeof arg !== 'object') {
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
388
45
|
|
|
389
|
-
|
|
390
|
-
|
|
46
|
+
if (Array.isArray(arg)) {
|
|
47
|
+
return classNames.apply(null, arg);
|
|
48
|
+
}
|
|
391
49
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
50
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
51
|
+
return arg.toString();
|
|
52
|
+
}
|
|
395
53
|
|
|
396
|
-
|
|
54
|
+
var classes = '';
|
|
397
55
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
if (arg.length) {
|
|
402
|
-
var inner = classNames.apply(null, arg);
|
|
403
|
-
if (inner) {
|
|
404
|
-
classes.push(inner);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
} else if (argType === 'object') {
|
|
408
|
-
if (arg.toString === Object.prototype.toString) {
|
|
409
|
-
for (var key in arg) {
|
|
410
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
411
|
-
classes.push(key);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
} else {
|
|
415
|
-
classes.push(arg.toString());
|
|
416
|
-
}
|
|
56
|
+
for (var key in arg) {
|
|
57
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
58
|
+
classes = appendClass(classes, key);
|
|
417
59
|
}
|
|
418
60
|
}
|
|
419
61
|
|
|
420
|
-
return classes
|
|
62
|
+
return classes;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function appendClass (value, newClass) {
|
|
66
|
+
if (!newClass) {
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (value) {
|
|
71
|
+
return value + ' ' + newClass;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return value + newClass;
|
|
421
75
|
}
|
|
422
76
|
|
|
423
77
|
if (module.exports) {
|
|
@@ -431,864 +85,256 @@ var classnames = {exports: {}};
|
|
|
431
85
|
|
|
432
86
|
var classNames = classnames.exports;
|
|
433
87
|
|
|
434
|
-
var
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
var imgProps = __assign(__assign({}, avatarProps.imgProps), { onLoad: function (event) {
|
|
465
|
-
var _a, _b;
|
|
466
|
-
setLoaded(LoadingStatus.LOADED);
|
|
467
|
-
(_b = (_a = avatarProps.imgProps) === null || _a === void 0 ? void 0 : _a.onLoad) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
468
|
-
} });
|
|
469
|
-
return { imgProps: imgProps, loaded: loaded };
|
|
470
|
-
};
|
|
471
|
-
|
|
472
|
-
var getAvatarDimensions = function (theme, props) {
|
|
473
|
-
var factors = {
|
|
474
|
-
'extra-small': 3,
|
|
475
|
-
small: 4,
|
|
476
|
-
medium: 5,
|
|
477
|
-
large: 6,
|
|
478
|
-
'extra-large': 12.5,
|
|
479
|
-
};
|
|
480
|
-
var sizeFactor = factors[props.size || 'medium'];
|
|
481
|
-
return theme.spacing(sizeFactor);
|
|
482
|
-
};
|
|
483
|
-
var getAvatarFontSize = function (props) {
|
|
484
|
-
var fontSizes = {
|
|
485
|
-
'extra-small': '0.75rem',
|
|
486
|
-
small: '1rem',
|
|
487
|
-
medium: '1rem',
|
|
488
|
-
large: '1.25rem',
|
|
489
|
-
'extra-large': '3.5rem',
|
|
490
|
-
};
|
|
491
|
-
return fontSizes[props.size];
|
|
492
|
-
};
|
|
493
|
-
var useAvatarStyles = styles.makeStyles(function (theme) { return ({
|
|
494
|
-
root: function (props) { return ({
|
|
495
|
-
width: getAvatarDimensions(theme, props),
|
|
496
|
-
height: getAvatarDimensions(theme, props),
|
|
497
|
-
fontSize: getAvatarFontSize(props),
|
|
498
|
-
backgroundColor: props.loaded === LoadingStatus.LOADED ? 'transparent' : props.background,
|
|
499
|
-
color: theme.palette.getContrastText(props.background),
|
|
500
|
-
objectFit: props.fit,
|
|
501
|
-
}); },
|
|
502
|
-
fallback: function (props) { return ({
|
|
503
|
-
fontSize: getAvatarDimensions(theme, props),
|
|
504
|
-
strokeWidth: 1,
|
|
505
|
-
}); },
|
|
506
|
-
}); });
|
|
507
|
-
|
|
508
|
-
var Avatar = React.forwardRef(function (props, ref) {
|
|
509
|
-
var children = props.children, src = props.src, alt = props.alt, fallback = props.fallback, muiProps = __rest(props, ["children", "src", "alt", "fallback"]);
|
|
510
|
-
var _a = useImgProps(props), imgProps = _a.imgProps, loaded = _a.loaded;
|
|
511
|
-
var classes = useAvatarStyles(__assign(__assign({}, props), { loaded: loaded }));
|
|
512
|
-
var displayAltTextFallback = src && alt;
|
|
513
|
-
var displayNoFallback = fallback === 'none';
|
|
514
|
-
var displayCustomFallback = fallback !== 'none' && typeof fallback !== 'undefined';
|
|
515
|
-
var Fallback;
|
|
516
|
-
if (displayAltTextFallback) {
|
|
517
|
-
Fallback = null;
|
|
518
|
-
}
|
|
519
|
-
else if (displayNoFallback) {
|
|
520
|
-
Fallback = ' ';
|
|
521
|
-
}
|
|
522
|
-
else if (displayCustomFallback) {
|
|
523
|
-
Fallback = fallback;
|
|
524
|
-
}
|
|
525
|
-
else {
|
|
526
|
-
Fallback = React__default['default'].createElement(Icon, { icon: SvgUser, className: classes.fallback });
|
|
527
|
-
}
|
|
528
|
-
return (React__default['default'].createElement(MuiAvatar__default['default'], __assign({ ref: ref, classes: { root: classes.root }, src: src, alt: alt }, muiProps, { imgProps: imgProps }), children || Fallback));
|
|
529
|
-
});
|
|
530
|
-
Avatar.defaultProps = {
|
|
531
|
-
size: 'medium',
|
|
532
|
-
fit: 'cover',
|
|
533
|
-
background: '#E0E0E0',
|
|
534
|
-
};
|
|
535
|
-
Avatar.displayName = 'Avatar';
|
|
536
|
-
|
|
537
|
-
styles.makeStyles(function (theme) { return ({
|
|
538
|
-
circle: {
|
|
539
|
-
backgroundColor: theme.palette.grey[300],
|
|
540
|
-
borderRadius: '50%',
|
|
541
|
-
height: theme.spacing(0.65),
|
|
542
|
-
width: theme.spacing(0.65),
|
|
543
|
-
margin: theme.spacing(1) + "px 0 " + theme.spacing(1) + "px " + theme.spacing(1) + "px",
|
|
544
|
-
},
|
|
545
|
-
container: {
|
|
546
|
-
border: "1px solid " + theme.palette.secondary.light,
|
|
547
|
-
borderRadius: theme.spacing(0.5),
|
|
548
|
-
flexGrow: 1,
|
|
549
|
-
},
|
|
550
|
-
titleBar: {
|
|
551
|
-
display: 'flex',
|
|
552
|
-
flexDirection: 'row',
|
|
553
|
-
borderBottom: "1px solid " + theme.palette.secondary.light,
|
|
554
|
-
width: '100%',
|
|
555
|
-
},
|
|
556
|
-
}); });
|
|
557
|
-
|
|
558
|
-
styles.makeStyles(function () { return ({
|
|
559
|
-
root: {
|
|
560
|
-
minWidth: 'unset',
|
|
561
|
-
},
|
|
562
|
-
label: {
|
|
563
|
-
textTransform: function (_a) {
|
|
564
|
-
var textTransform = _a.textTransform;
|
|
565
|
-
return textTransform;
|
|
566
|
-
},
|
|
567
|
-
},
|
|
568
|
-
}); });
|
|
569
|
-
|
|
570
|
-
var Checkbox = React.forwardRef(function (props, ref) {
|
|
571
|
-
var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest(props, ["label", "disabled", "LabelProps"]);
|
|
572
|
-
var control = React__default['default'].createElement(MuiCheckbox__default['default'], __assign({ disabled: label ? undefined : disabled }, muiProps));
|
|
573
|
-
return label ? (React__default['default'].createElement(FormControlLabel__default['default'], __assign({ disabled: disabled, inputRef: ref, control: control, label: label }, LabelProps))) : (control);
|
|
574
|
-
});
|
|
575
|
-
Checkbox.displayName = 'Checkbox';
|
|
576
|
-
|
|
577
|
-
var getBackground = function (theme) { return function (props) {
|
|
578
|
-
var variant = props.variant, severity = props.severity;
|
|
579
|
-
var background = theme.palette.grey[100];
|
|
580
|
-
var backgrounds = {
|
|
581
|
-
outlined: 'none',
|
|
582
|
-
error: 'error.main',
|
|
583
|
-
warning: 'warning.main',
|
|
584
|
-
info: 'info.light',
|
|
585
|
-
success: 'success.light',
|
|
586
|
-
};
|
|
587
|
-
if (variant === 'outlined') {
|
|
588
|
-
background = backgrounds[variant];
|
|
589
|
-
}
|
|
590
|
-
else if (severity) {
|
|
591
|
-
var _a = backgrounds[severity].split('.'), color = _a[0], colorVariant = _a[1];
|
|
592
|
-
// @ts-expect-error - todo.
|
|
593
|
-
background = theme.palette[color][colorVariant];
|
|
594
|
-
}
|
|
595
|
-
return background;
|
|
596
|
-
}; };
|
|
597
|
-
var getColor = function (theme) { return function (props) {
|
|
598
|
-
var variant = props.variant, severity = props.severity;
|
|
599
|
-
var textColor;
|
|
600
|
-
if (variant === 'outlined' && severity) {
|
|
601
|
-
var textColors = {
|
|
602
|
-
error: theme.palette.error.main,
|
|
603
|
-
info: theme.palette.info.main,
|
|
604
|
-
warning: theme.palette.warning.dark,
|
|
605
|
-
success: theme.palette.success.dark,
|
|
606
|
-
};
|
|
607
|
-
textColor = textColors[severity];
|
|
608
|
-
}
|
|
609
|
-
else if (variant === 'outlined' && !severity) {
|
|
610
|
-
textColor = theme.palette.grey[700];
|
|
611
|
-
}
|
|
612
|
-
else if ((variant === 'default' || variant === undefined) && severity) {
|
|
613
|
-
var textColors = {
|
|
614
|
-
error: theme.palette.common.white,
|
|
615
|
-
info: theme.palette.secondary.main,
|
|
616
|
-
warning: theme.palette.secondary.main,
|
|
617
|
-
success: theme.palette.secondary.main,
|
|
618
|
-
};
|
|
619
|
-
textColor = textColors[severity];
|
|
620
|
-
}
|
|
621
|
-
return textColor;
|
|
622
|
-
}; };
|
|
623
|
-
var getBorder = function (theme) { return function (props) {
|
|
624
|
-
var variant = props.variant, severity = props.severity;
|
|
625
|
-
var borderColor;
|
|
626
|
-
if (variant === 'outlined' && severity) {
|
|
627
|
-
var borderColors = {
|
|
628
|
-
error: theme.palette.error.main,
|
|
629
|
-
info: theme.palette.info.main,
|
|
630
|
-
warning: theme.palette.warning.dark,
|
|
631
|
-
success: theme.palette.success.dark,
|
|
632
|
-
};
|
|
633
|
-
borderColor = borderColors[severity];
|
|
634
|
-
}
|
|
635
|
-
return borderColor;
|
|
636
|
-
}; };
|
|
637
|
-
// using `any` here is a bit of cheating but it doesn't matter since this doesn't depend on
|
|
638
|
-
// any component-specific props
|
|
639
|
-
styles.makeStyles(function (theme) { return ({
|
|
640
|
-
root: {
|
|
641
|
-
background: getBackground(theme),
|
|
642
|
-
color: getColor(theme),
|
|
643
|
-
borderColor: getBorder(theme),
|
|
644
|
-
borderRadius: theme.spacing(0.5),
|
|
645
|
-
},
|
|
646
|
-
icon: {
|
|
647
|
-
color: 'inherit',
|
|
648
|
-
height: theme.spacing(2),
|
|
649
|
-
width: theme.spacing(2),
|
|
650
|
-
},
|
|
651
|
-
deleteIcon: {
|
|
652
|
-
color: theme.palette.grey[500],
|
|
653
|
-
},
|
|
654
|
-
}); });
|
|
655
|
-
|
|
656
|
-
var defaultTypographyProps = {
|
|
657
|
-
variant: 'body1',
|
|
658
|
-
};
|
|
659
|
-
|
|
660
|
-
var weights = {
|
|
661
|
-
regular: 400,
|
|
662
|
-
medium: 500,
|
|
663
|
-
'semi-bold': 600,
|
|
664
|
-
bold: 700,
|
|
665
|
-
};
|
|
666
|
-
var getCustomColor = function (theme, color) {
|
|
667
|
-
var isCommonColor = color && ['white', 'black'].includes(color);
|
|
668
|
-
var isGreyColor = color && color.match(/^grey\.\d{3}/);
|
|
669
|
-
var isSemanticColor = color && color.match(/(primary|secondary|info|success|error|warning).?(light|dark)?/);
|
|
670
|
-
var isTextColor = color && ['textPrimary', 'textSecondary'].includes(color);
|
|
671
|
-
switch (true) {
|
|
672
|
-
case isCommonColor:
|
|
673
|
-
// @ts-expect-error - todo.
|
|
674
|
-
return theme.palette.common[color];
|
|
675
|
-
case Boolean(isGreyColor):
|
|
676
|
-
var scale = color.split('.')[1];
|
|
677
|
-
// @ts-expect-error - todo.
|
|
678
|
-
return theme.palette.grey[scale] || theme.palette.grey[900];
|
|
679
|
-
case Boolean(isSemanticColor):
|
|
680
|
-
var _a = color.split('.'), paletteKey = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
|
|
681
|
-
// @ts-expect-error - todo.
|
|
682
|
-
return theme.palette[paletteKey][variant];
|
|
683
|
-
case isTextColor:
|
|
684
|
-
// @ts-expect-error - todo.
|
|
685
|
-
return theme.palette.text[color.slice(4).toLowerCase()];
|
|
686
|
-
default:
|
|
687
|
-
return undefined;
|
|
688
|
-
}
|
|
689
|
-
};
|
|
690
|
-
var useTypographyStyles = styles.makeStyles(function (theme) {
|
|
691
|
-
var _a;
|
|
692
|
-
return ({
|
|
693
|
-
root: (_a = {},
|
|
694
|
-
_a["& ." + iconStaticClassName] = {
|
|
695
|
-
position: 'relative',
|
|
696
|
-
top: '0.125em',
|
|
697
|
-
padding: '0 0.125em',
|
|
698
|
-
boxSizing: 'content-box',
|
|
699
|
-
},
|
|
700
|
-
_a.fontFamily = theme.typography.fontFamily,
|
|
701
|
-
_a.fontWeight = function (_a) {
|
|
702
|
-
var variant = _a.variant, weight = _a.weight;
|
|
703
|
-
return (weight ? weights[weight] : theme.typography[variant].fontWeight);
|
|
704
|
-
},
|
|
705
|
-
_a.fontSize = function (_a) {
|
|
706
|
-
var variant = _a.variant;
|
|
707
|
-
return theme.typography[variant].fontSize;
|
|
708
|
-
},
|
|
709
|
-
_a.lineHeight = function (_a) {
|
|
710
|
-
var variant = _a.variant;
|
|
711
|
-
return theme.typography[variant].lineHeight;
|
|
712
|
-
},
|
|
713
|
-
_a.textTransform = function (_a) {
|
|
714
|
-
var variant = _a.variant;
|
|
715
|
-
return theme.typography[variant].textTransform;
|
|
716
|
-
},
|
|
717
|
-
_a.color = function (_a) {
|
|
718
|
-
var color = _a.color, variant = _a.variant;
|
|
719
|
-
return (color && getCustomColor(theme, color)) || theme.typography[variant].color;
|
|
720
|
-
},
|
|
721
|
-
_a),
|
|
722
|
-
caption: {
|
|
723
|
-
display: 'inline',
|
|
724
|
-
},
|
|
725
|
-
overline: {
|
|
726
|
-
display: 'inline',
|
|
727
|
-
},
|
|
728
|
-
});
|
|
729
|
-
});
|
|
730
|
-
|
|
731
|
-
var Typography = function (props) {
|
|
732
|
-
props.weight; props.color; var TypographyRef = props.TypographyRef, restProps = __rest(props, ["weight", "color", "TypographyRef"]);
|
|
733
|
-
var classes = useTypographyStyles(__assign({}, props));
|
|
734
|
-
var variantMapping = { subtitle1: 'p' };
|
|
735
|
-
return React__default['default'].createElement(core.Typography, __assign({ classes: classes, variantMapping: variantMapping, ref: TypographyRef }, restProps));
|
|
736
|
-
};
|
|
737
|
-
Typography.displayName = 'Typography';
|
|
738
|
-
Typography.defaultProps = defaultTypographyProps;
|
|
739
|
-
|
|
740
|
-
var getFadeStop = function (_a, typographyVariant) {
|
|
741
|
-
var typography = _a.typography;
|
|
742
|
-
// @ts-expect-error - todo.
|
|
743
|
-
return !isNaN(Number(typography[typographyVariant].lineHeight))
|
|
744
|
-
? // @ts-expect-error - todo.
|
|
745
|
-
typography[typographyVariant].lineHeight + "rem"
|
|
746
|
-
: // @ts-expect-error - todo.
|
|
747
|
-
typography[typographyVariant].lineHeight;
|
|
748
|
-
};
|
|
749
|
-
core.makeStyles(function (theme) { return ({
|
|
750
|
-
overlay: {
|
|
751
|
-
position: 'absolute',
|
|
752
|
-
top: 0,
|
|
753
|
-
left: 0,
|
|
754
|
-
height: '100%',
|
|
755
|
-
width: '100%',
|
|
756
|
-
background: function (props) { return "linear-gradient(to top, white, #FFF0 " + getFadeStop(theme, props.typographyVariant) + ")"; },
|
|
757
|
-
},
|
|
758
|
-
}); });
|
|
759
|
-
|
|
760
|
-
var SemanticColors;
|
|
761
|
-
(function (SemanticColors) {
|
|
762
|
-
SemanticColors["PRIMARY_MAIN"] = "primary.main";
|
|
763
|
-
SemanticColors["PRIMARY_DARK"] = "primary.dark";
|
|
764
|
-
SemanticColors["PRIMARY_LIGHT"] = "primary.light";
|
|
765
|
-
SemanticColors["SECONDARY_MAIN"] = "secondary.main";
|
|
766
|
-
SemanticColors["SECONDARY_DARK"] = "secondary.dark";
|
|
767
|
-
SemanticColors["SECONDARY_LIGHT"] = "secondary.light";
|
|
768
|
-
})(SemanticColors || (SemanticColors = {}));
|
|
769
|
-
core.makeStyles(function (theme) { return ({
|
|
770
|
-
dividerRoot: {
|
|
771
|
-
gap: theme.spacing(2),
|
|
772
|
-
},
|
|
773
|
-
textRoot: {
|
|
774
|
-
color: function (props) {
|
|
775
|
-
var textColor = props.textColor;
|
|
776
|
-
if (Object.values(SemanticColors).includes(textColor)) {
|
|
777
|
-
var _a = textColor.split('.'), semanticColor = _a[0], shade = _a[1];
|
|
778
|
-
// @ts-expect-error - todo.
|
|
779
|
-
return theme.palette[semanticColor][shade];
|
|
780
|
-
}
|
|
781
|
-
else if (textColor) {
|
|
782
|
-
return textColor;
|
|
783
|
-
}
|
|
784
|
-
else {
|
|
785
|
-
return 'black';
|
|
786
|
-
}
|
|
787
|
-
},
|
|
788
|
-
textTransform: function (props) { return props.textTransform; },
|
|
789
|
-
},
|
|
790
|
-
dividerLine: {
|
|
791
|
-
backgroundColor: function (props) {
|
|
792
|
-
var dividerColor = props.dividerColor;
|
|
793
|
-
if (Object.values(SemanticColors).includes(dividerColor)) {
|
|
794
|
-
var _a = dividerColor.split('.'), semanticColor = _a[0], shade = _a[1];
|
|
795
|
-
// @ts-expect-error - todo.
|
|
796
|
-
return theme.palette[semanticColor][shade];
|
|
797
|
-
}
|
|
798
|
-
else if (dividerColor) {
|
|
799
|
-
return dividerColor;
|
|
800
|
-
}
|
|
801
|
-
else {
|
|
802
|
-
return theme.palette.grey[500];
|
|
803
|
-
}
|
|
804
|
-
},
|
|
805
|
-
},
|
|
806
|
-
}); });
|
|
88
|
+
var AUDIO_PLAYER_EVENT_TYPES;
|
|
89
|
+
(function (AUDIO_PLAYER_EVENT_TYPES) {
|
|
90
|
+
AUDIO_PLAYER_EVENT_TYPES["TOGGLE_PLAYBACK"] = "TOGGLE_PLAYBACK";
|
|
91
|
+
AUDIO_PLAYER_EVENT_TYPES["TOGGLE_VOLUME_CONTROL"] = "TOGGLE_VOLUME_CONTROL";
|
|
92
|
+
AUDIO_PLAYER_EVENT_TYPES["TOGGLE_MUTE"] = "TOGGLE_MUTE";
|
|
93
|
+
AUDIO_PLAYER_EVENT_TYPES["VOLUME_CHANGE"] = "VOLUME_CHANGE";
|
|
94
|
+
AUDIO_PLAYER_EVENT_TYPES["TIME_CHANGE"] = "TIME_CHANGE";
|
|
95
|
+
AUDIO_PLAYER_EVENT_TYPES["DURATION_CHANGE"] = "DURATION_CHANGE";
|
|
96
|
+
AUDIO_PLAYER_EVENT_TYPES["SET_TIME"] = "SET_TIME";
|
|
97
|
+
AUDIO_PLAYER_EVENT_TYPES["CAN_PLAY"] = "CAN_PLAY";
|
|
98
|
+
AUDIO_PLAYER_EVENT_TYPES["RESET"] = "RESET";
|
|
99
|
+
})(AUDIO_PLAYER_EVENT_TYPES || (AUDIO_PLAYER_EVENT_TYPES = {}));
|
|
100
|
+
var PLAYBACK_STATES;
|
|
101
|
+
(function (PLAYBACK_STATES) {
|
|
102
|
+
PLAYBACK_STATES["NONE"] = "NONE";
|
|
103
|
+
PLAYBACK_STATES["PAUSED"] = "PAUSED";
|
|
104
|
+
PLAYBACK_STATES["PLAYING"] = "PLAYING";
|
|
105
|
+
})(PLAYBACK_STATES || (PLAYBACK_STATES = {}));
|
|
106
|
+
var CONTROL_LABELS;
|
|
107
|
+
(function (CONTROL_LABELS) {
|
|
108
|
+
CONTROL_LABELS["PAUSE"] = "PAUSE";
|
|
109
|
+
CONTROL_LABELS["PLAY"] = "PLAY";
|
|
110
|
+
CONTROL_LABELS["MUTE"] = "MUTE";
|
|
111
|
+
CONTROL_LABELS["UNMUTE"] = "UNMUTE";
|
|
112
|
+
})(CONTROL_LABELS || (CONTROL_LABELS = {}));
|
|
113
|
+
var VOLUME_CONTROL_STATES;
|
|
114
|
+
(function (VOLUME_CONTROL_STATES) {
|
|
115
|
+
VOLUME_CONTROL_STATES["SHOW"] = "SHOW";
|
|
116
|
+
VOLUME_CONTROL_STATES["HIDE"] = "HIDE";
|
|
117
|
+
})(VOLUME_CONTROL_STATES || (VOLUME_CONTROL_STATES = {}));
|
|
807
118
|
|
|
808
|
-
var
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
119
|
+
var initialAudioPlayerState = {
|
|
120
|
+
playback: PLAYBACK_STATES.NONE,
|
|
121
|
+
volumeControls: VOLUME_CONTROL_STATES.HIDE,
|
|
122
|
+
context: {
|
|
123
|
+
volume: 100,
|
|
124
|
+
playbackButtonLabel: CONTROL_LABELS.PLAY,
|
|
125
|
+
volumeButtonLabel: CONTROL_LABELS.MUTE,
|
|
126
|
+
},
|
|
814
127
|
};
|
|
815
|
-
|
|
816
|
-
var
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
Link.defaultProps = {
|
|
832
|
-
variant: 'body1',
|
|
833
|
-
};
|
|
834
|
-
Link.displayName = 'Link';
|
|
835
|
-
|
|
836
|
-
var useStyles$4 = core.makeStyles(function (_a) {
|
|
837
|
-
var spacing = _a.spacing;
|
|
838
|
-
return ({
|
|
839
|
-
root: {
|
|
840
|
-
'&:last-child': {
|
|
841
|
-
marginBottom: 0,
|
|
842
|
-
},
|
|
843
|
-
marginBottom: spacing(4),
|
|
844
|
-
padding: spacing(4),
|
|
845
|
-
},
|
|
846
|
-
});
|
|
847
|
-
});
|
|
848
|
-
var Paper = React.forwardRef(function (props, ref) {
|
|
849
|
-
var legacyStyles = props.legacyStyles, restProps = __rest(props, ["legacyStyles"]);
|
|
850
|
-
var classes = useStyles$4(props);
|
|
851
|
-
return React__default['default'].createElement(core.Paper, __assign({}, ref, { classes: __assign({}, (legacyStyles && classes)) }, restProps));
|
|
852
|
-
});
|
|
853
|
-
Paper.displayName = 'Paper';
|
|
854
|
-
Paper.defaultProps = {
|
|
855
|
-
legacyStyles: false,
|
|
128
|
+
var getPlayback = function (_a) {
|
|
129
|
+
var audio = _a.current;
|
|
130
|
+
var playback = PLAYBACK_STATES.NONE;
|
|
131
|
+
if (audio) {
|
|
132
|
+
var paused = audio.paused, readyState = audio.readyState;
|
|
133
|
+
if (readyState === 0) {
|
|
134
|
+
playback = PLAYBACK_STATES.NONE;
|
|
135
|
+
}
|
|
136
|
+
else if (paused) {
|
|
137
|
+
playback = PLAYBACK_STATES.PAUSED;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
playback = PLAYBACK_STATES.PLAYING;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return playback;
|
|
856
144
|
};
|
|
857
|
-
|
|
858
|
-
var
|
|
859
|
-
var
|
|
860
|
-
var
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
ToggleButton.displayName = 'ToggleButton';
|
|
938
|
-
|
|
939
|
-
var useToggleButtonGroupStyles = styles.makeStyles(function (theme) { return ({
|
|
940
|
-
root: {
|
|
941
|
-
'&&': {
|
|
942
|
-
backgroundColor: theme.palette.grey[300],
|
|
943
|
-
},
|
|
944
|
-
},
|
|
945
|
-
}); });
|
|
946
|
-
|
|
947
|
-
var ToggleButtonGroup = React.forwardRef(function (props, ref) {
|
|
948
|
-
var children = props.children, _a = props.color, color = _a === void 0 ? 'primary' : _a, muiProps = __rest(props, ["children", "color"]);
|
|
949
|
-
var classes = useToggleButtonGroupStyles(props);
|
|
950
|
-
var childrenWithProps = React__default['default'].Children.map(children, function (child) {
|
|
951
|
-
if (!React__default['default'].isValidElement(child)) {
|
|
952
|
-
return null;
|
|
953
|
-
}
|
|
954
|
-
return React__default['default'].cloneElement(child, { color: color });
|
|
955
|
-
});
|
|
956
|
-
return (React__default['default'].createElement(MuiToggleButtonGroup__default['default'], __assign({ ref: ref, classes: { root: classes.root } }, muiProps), childrenWithProps));
|
|
957
|
-
});
|
|
958
|
-
ToggleButtonGroup.displayName = 'ToggleButtonGroup';
|
|
959
|
-
|
|
960
|
-
var useTooltipStyles = styles.makeStyles(function (_a) {
|
|
961
|
-
var typography = _a.typography;
|
|
962
|
-
return ({
|
|
963
|
-
tooltip: {
|
|
964
|
-
fontSize: typography.pxToRem(16),
|
|
965
|
-
},
|
|
966
|
-
});
|
|
967
|
-
});
|
|
968
|
-
|
|
969
|
-
var Tooltip = React.forwardRef(function (props, ref) {
|
|
970
|
-
var classes = useTooltipStyles(props);
|
|
971
|
-
return React__default['default'].createElement(MuiTooltip__default['default'], __assign({ ref: ref, classes: classes }, props));
|
|
972
|
-
});
|
|
973
|
-
Tooltip.displayName = 'Tooltip';
|
|
974
|
-
|
|
975
|
-
core.makeStyles(function () { return ({
|
|
976
|
-
root: {
|
|
977
|
-
height: 56,
|
|
978
|
-
},
|
|
979
|
-
}); });
|
|
980
|
-
core.makeStyles(function (theme) { return ({
|
|
981
|
-
root: {
|
|
982
|
-
height: '100%',
|
|
983
|
-
width: 'min-content',
|
|
984
|
-
borderRadius: theme.spacing(1),
|
|
985
|
-
},
|
|
986
|
-
input: {
|
|
987
|
-
'&::-webkit-clear-button, &::-webkit-outer-spin-button, &::-webkit-inner-spin-button': {
|
|
988
|
-
display: 'none',
|
|
989
|
-
},
|
|
990
|
-
'-moz-appearance': 'textfield',
|
|
991
|
-
minWidth: 40,
|
|
992
|
-
padding: 0,
|
|
993
|
-
textAlign: 'center',
|
|
994
|
-
},
|
|
995
|
-
adornedStart: {
|
|
996
|
-
padding: 0,
|
|
997
|
-
},
|
|
998
|
-
adornedEnd: {
|
|
999
|
-
padding: 0,
|
|
1000
|
-
},
|
|
1001
|
-
}); });
|
|
1002
|
-
|
|
1003
|
-
core.makeStyles(function () { return ({
|
|
1004
|
-
root: {
|
|
1005
|
-
display: 'flex',
|
|
1006
|
-
flexDirection: 'column',
|
|
1007
|
-
alignItems: 'center',
|
|
1008
|
-
gridGap: 16,
|
|
1009
|
-
},
|
|
1010
|
-
}); });
|
|
1011
|
-
|
|
1012
|
-
var FollowerAuthenticationDialogContext = React.createContext(null);
|
|
1013
|
-
FollowerAuthenticationDialogContext.Provider;
|
|
1014
|
-
|
|
1015
|
-
core.makeStyles(function () { return ({
|
|
1016
|
-
form: {
|
|
1017
|
-
display: 'flex',
|
|
1018
|
-
flexDirection: 'column',
|
|
1019
|
-
alignItems: 'center',
|
|
1020
|
-
width: '100%',
|
|
1021
|
-
gridGap: 16,
|
|
1022
|
-
},
|
|
1023
|
-
}); });
|
|
1024
|
-
|
|
1025
|
-
core.makeStyles(function () { return ({
|
|
1026
|
-
main: {
|
|
1027
|
-
width: '100%',
|
|
1028
|
-
display: 'flex',
|
|
1029
|
-
flexDirection: 'column',
|
|
1030
|
-
gridGap: 16,
|
|
1031
|
-
},
|
|
1032
|
-
}); });
|
|
1033
|
-
|
|
1034
|
-
core.makeStyles(function () { return ({
|
|
1035
|
-
root: {
|
|
1036
|
-
position: 'absolute',
|
|
1037
|
-
top: 0,
|
|
1038
|
-
right: 0,
|
|
1039
|
-
},
|
|
1040
|
-
}); });
|
|
1041
|
-
|
|
1042
|
-
var AUDIO_PLAYER_EVENT_TYPES;
|
|
1043
|
-
(function (AUDIO_PLAYER_EVENT_TYPES) {
|
|
1044
|
-
AUDIO_PLAYER_EVENT_TYPES["TOGGLE_PLAYBACK"] = "TOGGLE_PLAYBACK";
|
|
1045
|
-
AUDIO_PLAYER_EVENT_TYPES["TOGGLE_VOLUME_CONTROL"] = "TOGGLE_VOLUME_CONTROL";
|
|
1046
|
-
AUDIO_PLAYER_EVENT_TYPES["TOGGLE_MUTE"] = "TOGGLE_MUTE";
|
|
1047
|
-
AUDIO_PLAYER_EVENT_TYPES["VOLUME_CHANGE"] = "VOLUME_CHANGE";
|
|
1048
|
-
AUDIO_PLAYER_EVENT_TYPES["TIME_CHANGE"] = "TIME_CHANGE";
|
|
1049
|
-
AUDIO_PLAYER_EVENT_TYPES["DURATION_CHANGE"] = "DURATION_CHANGE";
|
|
1050
|
-
AUDIO_PLAYER_EVENT_TYPES["SET_TIME"] = "SET_TIME";
|
|
1051
|
-
AUDIO_PLAYER_EVENT_TYPES["CAN_PLAY"] = "CAN_PLAY";
|
|
1052
|
-
AUDIO_PLAYER_EVENT_TYPES["RESET"] = "RESET";
|
|
1053
|
-
})(AUDIO_PLAYER_EVENT_TYPES || (AUDIO_PLAYER_EVENT_TYPES = {}));
|
|
1054
|
-
var PLAYBACK_STATES;
|
|
1055
|
-
(function (PLAYBACK_STATES) {
|
|
1056
|
-
PLAYBACK_STATES["NONE"] = "NONE";
|
|
1057
|
-
PLAYBACK_STATES["PAUSED"] = "PAUSED";
|
|
1058
|
-
PLAYBACK_STATES["PLAYING"] = "PLAYING";
|
|
1059
|
-
})(PLAYBACK_STATES || (PLAYBACK_STATES = {}));
|
|
1060
|
-
var CONTROL_LABELS;
|
|
1061
|
-
(function (CONTROL_LABELS) {
|
|
1062
|
-
CONTROL_LABELS["PAUSE"] = "PAUSE";
|
|
1063
|
-
CONTROL_LABELS["PLAY"] = "PLAY";
|
|
1064
|
-
CONTROL_LABELS["MUTE"] = "MUTE";
|
|
1065
|
-
CONTROL_LABELS["UNMUTE"] = "UNMUTE";
|
|
1066
|
-
})(CONTROL_LABELS || (CONTROL_LABELS = {}));
|
|
1067
|
-
var VOLUME_CONTROL_STATES;
|
|
1068
|
-
(function (VOLUME_CONTROL_STATES) {
|
|
1069
|
-
VOLUME_CONTROL_STATES["SHOW"] = "SHOW";
|
|
1070
|
-
VOLUME_CONTROL_STATES["HIDE"] = "HIDE";
|
|
1071
|
-
})(VOLUME_CONTROL_STATES || (VOLUME_CONTROL_STATES = {}));
|
|
1072
|
-
|
|
1073
|
-
var initialAudioPlayerState = {
|
|
1074
|
-
playback: PLAYBACK_STATES.NONE,
|
|
1075
|
-
volumeControls: VOLUME_CONTROL_STATES.HIDE,
|
|
1076
|
-
context: {
|
|
1077
|
-
volume: 100,
|
|
1078
|
-
playbackButtonLabel: CONTROL_LABELS.PLAY,
|
|
1079
|
-
volumeButtonLabel: CONTROL_LABELS.MUTE,
|
|
1080
|
-
},
|
|
1081
|
-
};
|
|
1082
|
-
var getPlayback = function (_a) {
|
|
1083
|
-
var audio = _a.current;
|
|
1084
|
-
var playback = PLAYBACK_STATES.NONE;
|
|
1085
|
-
if (audio) {
|
|
1086
|
-
var paused = audio.paused, readyState = audio.readyState;
|
|
1087
|
-
if (readyState === 0) {
|
|
1088
|
-
playback = PLAYBACK_STATES.NONE;
|
|
1089
|
-
}
|
|
1090
|
-
else if (paused) {
|
|
1091
|
-
playback = PLAYBACK_STATES.PAUSED;
|
|
1092
|
-
}
|
|
1093
|
-
else {
|
|
1094
|
-
playback = PLAYBACK_STATES.PLAYING;
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
return playback;
|
|
1098
|
-
};
|
|
1099
|
-
var audioPlayerReducer = function (state, event) {
|
|
1100
|
-
var _a, _b, _c;
|
|
1101
|
-
var audioRef = state.context.audioRef;
|
|
1102
|
-
var nextState = __assign$1({}, state);
|
|
1103
|
-
switch (state.playback) {
|
|
1104
|
-
case PLAYBACK_STATES.NONE:
|
|
1105
|
-
if (event.type === AUDIO_PLAYER_EVENT_TYPES.CAN_PLAY) {
|
|
1106
|
-
nextState.playback = getPlayback(audioRef);
|
|
1107
|
-
return nextState;
|
|
1108
|
-
}
|
|
1109
|
-
// Required for iOS users. iOS prevents media from being loaded before user interaction.
|
|
1110
|
-
if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_PLAYBACK) {
|
|
1111
|
-
(_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
|
1112
|
-
}
|
|
1113
|
-
break;
|
|
1114
|
-
case PLAYBACK_STATES.PAUSED:
|
|
1115
|
-
if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_PLAYBACK) {
|
|
1116
|
-
(_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.play();
|
|
1117
|
-
nextState.playback = getPlayback(audioRef);
|
|
1118
|
-
nextState.context.playbackButtonLabel = CONTROL_LABELS.PAUSE;
|
|
1119
|
-
return nextState;
|
|
1120
|
-
}
|
|
1121
|
-
break;
|
|
1122
|
-
case PLAYBACK_STATES.PLAYING:
|
|
1123
|
-
if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_PLAYBACK) {
|
|
1124
|
-
(_c = audioRef.current) === null || _c === void 0 ? void 0 : _c.pause();
|
|
1125
|
-
nextState.playback = getPlayback(audioRef);
|
|
1126
|
-
nextState.context.playbackButtonLabel = CONTROL_LABELS.PLAY;
|
|
1127
|
-
return nextState;
|
|
1128
|
-
}
|
|
1129
|
-
if (event.type === AUDIO_PLAYER_EVENT_TYPES.TIME_CHANGE) {
|
|
1130
|
-
return nextState;
|
|
1131
|
-
}
|
|
1132
|
-
break;
|
|
1133
|
-
}
|
|
1134
|
-
switch (state.volumeControls) {
|
|
1135
|
-
case VOLUME_CONTROL_STATES.SHOW:
|
|
1136
|
-
if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_VOLUME_CONTROL) {
|
|
1137
|
-
nextState.volumeControls = VOLUME_CONTROL_STATES.HIDE;
|
|
1138
|
-
return nextState;
|
|
1139
|
-
}
|
|
1140
|
-
if (event.type === AUDIO_PLAYER_EVENT_TYPES.VOLUME_CHANGE) {
|
|
1141
|
-
if (nextState.context.volume !== event.context.volume) {
|
|
1142
|
-
nextState.context.volume = event.context.volume;
|
|
1143
|
-
if (audioRef.current) {
|
|
1144
|
-
audioRef.current.volume = event.context.volume;
|
|
1145
|
-
}
|
|
1146
|
-
return nextState;
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
break;
|
|
1150
|
-
case VOLUME_CONTROL_STATES.HIDE:
|
|
1151
|
-
if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_VOLUME_CONTROL) {
|
|
1152
|
-
nextState.volumeControls = VOLUME_CONTROL_STATES.SHOW;
|
|
1153
|
-
return nextState;
|
|
1154
|
-
}
|
|
1155
|
-
break;
|
|
1156
|
-
}
|
|
1157
|
-
switch (event.type) {
|
|
1158
|
-
case AUDIO_PLAYER_EVENT_TYPES.TOGGLE_MUTE:
|
|
1159
|
-
if (audioRef.current) {
|
|
1160
|
-
audioRef.current.muted = !audioRef.current.muted;
|
|
1161
|
-
return nextState;
|
|
1162
|
-
}
|
|
1163
|
-
break;
|
|
1164
|
-
case AUDIO_PLAYER_EVENT_TYPES.SET_TIME:
|
|
1165
|
-
if (audioRef.current) {
|
|
1166
|
-
audioRef.current.currentTime = event.context.time;
|
|
1167
|
-
return nextState;
|
|
1168
|
-
}
|
|
1169
|
-
break;
|
|
1170
|
-
case AUDIO_PLAYER_EVENT_TYPES.RESET:
|
|
1171
|
-
if (audioRef.current) {
|
|
1172
|
-
audioRef.current.currentTime = 0;
|
|
1173
|
-
nextState.playback = getPlayback(audioRef);
|
|
1174
|
-
return nextState;
|
|
1175
|
-
}
|
|
1176
|
-
break;
|
|
1177
|
-
}
|
|
1178
|
-
return state;
|
|
145
|
+
var audioPlayerReducer = function (state, event) {
|
|
146
|
+
var _a, _b, _c;
|
|
147
|
+
var audioRef = state.context.audioRef;
|
|
148
|
+
var nextState = tslib.__assign({}, state);
|
|
149
|
+
switch (state.playback) {
|
|
150
|
+
case PLAYBACK_STATES.NONE:
|
|
151
|
+
if (event.type === AUDIO_PLAYER_EVENT_TYPES.CAN_PLAY) {
|
|
152
|
+
nextState.playback = getPlayback(audioRef);
|
|
153
|
+
return nextState;
|
|
154
|
+
}
|
|
155
|
+
// Required for iOS users. iOS prevents media from being loaded before user interaction.
|
|
156
|
+
if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_PLAYBACK) {
|
|
157
|
+
(_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
|
158
|
+
}
|
|
159
|
+
break;
|
|
160
|
+
case PLAYBACK_STATES.PAUSED:
|
|
161
|
+
if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_PLAYBACK) {
|
|
162
|
+
(_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.play();
|
|
163
|
+
nextState.playback = getPlayback(audioRef);
|
|
164
|
+
nextState.context.playbackButtonLabel = CONTROL_LABELS.PAUSE;
|
|
165
|
+
return nextState;
|
|
166
|
+
}
|
|
167
|
+
break;
|
|
168
|
+
case PLAYBACK_STATES.PLAYING:
|
|
169
|
+
if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_PLAYBACK) {
|
|
170
|
+
(_c = audioRef.current) === null || _c === void 0 ? void 0 : _c.pause();
|
|
171
|
+
nextState.playback = getPlayback(audioRef);
|
|
172
|
+
nextState.context.playbackButtonLabel = CONTROL_LABELS.PLAY;
|
|
173
|
+
return nextState;
|
|
174
|
+
}
|
|
175
|
+
if (event.type === AUDIO_PLAYER_EVENT_TYPES.TIME_CHANGE) {
|
|
176
|
+
return nextState;
|
|
177
|
+
}
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
switch (state.volumeControls) {
|
|
181
|
+
case VOLUME_CONTROL_STATES.SHOW:
|
|
182
|
+
if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_VOLUME_CONTROL) {
|
|
183
|
+
nextState.volumeControls = VOLUME_CONTROL_STATES.HIDE;
|
|
184
|
+
return nextState;
|
|
185
|
+
}
|
|
186
|
+
if (event.type === AUDIO_PLAYER_EVENT_TYPES.VOLUME_CHANGE) {
|
|
187
|
+
if (nextState.context.volume !== event.context.volume) {
|
|
188
|
+
nextState.context.volume = event.context.volume;
|
|
189
|
+
if (audioRef.current) {
|
|
190
|
+
audioRef.current.volume = event.context.volume;
|
|
191
|
+
}
|
|
192
|
+
return nextState;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
break;
|
|
196
|
+
case VOLUME_CONTROL_STATES.HIDE:
|
|
197
|
+
if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_VOLUME_CONTROL) {
|
|
198
|
+
nextState.volumeControls = VOLUME_CONTROL_STATES.SHOW;
|
|
199
|
+
return nextState;
|
|
200
|
+
}
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
switch (event.type) {
|
|
204
|
+
case AUDIO_PLAYER_EVENT_TYPES.TOGGLE_MUTE:
|
|
205
|
+
if (audioRef.current) {
|
|
206
|
+
audioRef.current.muted = !audioRef.current.muted;
|
|
207
|
+
return nextState;
|
|
208
|
+
}
|
|
209
|
+
break;
|
|
210
|
+
case AUDIO_PLAYER_EVENT_TYPES.SET_TIME:
|
|
211
|
+
if (audioRef.current) {
|
|
212
|
+
audioRef.current.currentTime = event.context.time;
|
|
213
|
+
return nextState;
|
|
214
|
+
}
|
|
215
|
+
break;
|
|
216
|
+
case AUDIO_PLAYER_EVENT_TYPES.RESET:
|
|
217
|
+
if (audioRef.current) {
|
|
218
|
+
audioRef.current.currentTime = 0;
|
|
219
|
+
nextState.playback = getPlayback(audioRef);
|
|
220
|
+
return nextState;
|
|
221
|
+
}
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
return state;
|
|
1179
225
|
};
|
|
1180
226
|
|
|
1181
|
-
var useVolumeIcon = function (state) {
|
|
1182
|
-
var volumeIcon =
|
|
1183
|
-
if (state.context.volume >= 0.5) {
|
|
1184
|
-
volumeIcon =
|
|
1185
|
-
}
|
|
1186
|
-
else if (state.context.volume < 0.5 && state.context.volume > 0) {
|
|
1187
|
-
volumeIcon =
|
|
1188
|
-
}
|
|
1189
|
-
else if (state.context.volume === 0) {
|
|
1190
|
-
volumeIcon =
|
|
1191
|
-
}
|
|
1192
|
-
if (state.context.audioRef.current) {
|
|
1193
|
-
if (state.context.audioRef.current.muted) {
|
|
1194
|
-
volumeIcon =
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
return volumeIcon;
|
|
227
|
+
var useVolumeIcon = function (state) {
|
|
228
|
+
var volumeIcon = webIcons.VolumeUp;
|
|
229
|
+
if (state.context.volume >= 0.5) {
|
|
230
|
+
volumeIcon = webIcons.VolumeUp;
|
|
231
|
+
}
|
|
232
|
+
else if (state.context.volume < 0.5 && state.context.volume > 0) {
|
|
233
|
+
volumeIcon = webIcons.VolumeDown;
|
|
234
|
+
}
|
|
235
|
+
else if (state.context.volume === 0) {
|
|
236
|
+
volumeIcon = webIcons.VolumeMute;
|
|
237
|
+
}
|
|
238
|
+
if (state.context.audioRef.current) {
|
|
239
|
+
if (state.context.audioRef.current.muted) {
|
|
240
|
+
volumeIcon = webIcons.VolumeOff;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return volumeIcon;
|
|
1198
244
|
};
|
|
1199
245
|
|
|
1200
|
-
var appendZero = function (num) { return (num < 10 ? "0" + num : num); };
|
|
1201
|
-
var formatTime = function (time, remaning) {
|
|
1202
|
-
if (remaning === void 0) { remaning = false; }
|
|
1203
|
-
var dateTime = new Date(0, 0, 0, 0, 0, time, 0);
|
|
1204
|
-
var dateTimeH = appendZero(dateTime.getHours());
|
|
1205
|
-
var dateTimeM = appendZero(dateTime.getMinutes());
|
|
1206
|
-
var dateTimeS = appendZero(dateTime.getSeconds());
|
|
1207
|
-
var minus = remaning ? '-' : '';
|
|
1208
|
-
return dateTimeH > 0 ? "" + minus + dateTimeH + ":" + dateTimeM + ":" + dateTimeS : "" + minus + dateTimeM + ":" + dateTimeS;
|
|
246
|
+
var appendZero = function (num) { return (num < 10 ? "0" + num : num); };
|
|
247
|
+
var formatTime = function (time, remaning) {
|
|
248
|
+
if (remaning === void 0) { remaning = false; }
|
|
249
|
+
var dateTime = new Date(0, 0, 0, 0, 0, time, 0);
|
|
250
|
+
var dateTimeH = appendZero(dateTime.getHours());
|
|
251
|
+
var dateTimeM = appendZero(dateTime.getMinutes());
|
|
252
|
+
var dateTimeS = appendZero(dateTime.getSeconds());
|
|
253
|
+
var minus = remaning ? '-' : '';
|
|
254
|
+
return dateTimeH > 0 ? "" + minus + dateTimeH + ":" + dateTimeM + ":" + dateTimeS : "" + minus + dateTimeM + ":" + dateTimeS;
|
|
1209
255
|
};
|
|
1210
256
|
|
|
1211
|
-
var setupAudioRef = function (config) { return function () {
|
|
1212
|
-
var _a, _b, _c, _d;
|
|
1213
|
-
var audioRef = config.audioRef, send = config.send;
|
|
1214
|
-
var handleDurationChange = function (event) {
|
|
1215
|
-
var duration = event.target.duration;
|
|
1216
|
-
send({ type: AUDIO_PLAYER_EVENT_TYPES.DURATION_CHANGE, context: { duration: duration } });
|
|
1217
|
-
};
|
|
1218
|
-
var handleTimeUpdate = function (event) {
|
|
1219
|
-
var currentTime = event.target.currentTime;
|
|
1220
|
-
send({ type: AUDIO_PLAYER_EVENT_TYPES.TIME_CHANGE, context: { currentTime: currentTime } });
|
|
1221
|
-
};
|
|
1222
|
-
var handleCanPlay = function () {
|
|
1223
|
-
send({ type: AUDIO_PLAYER_EVENT_TYPES.CAN_PLAY });
|
|
1224
|
-
};
|
|
1225
|
-
var handleEnded = function () {
|
|
1226
|
-
send({ type: AUDIO_PLAYER_EVENT_TYPES.RESET });
|
|
1227
|
-
};
|
|
1228
|
-
(_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('durationchange', handleDurationChange);
|
|
1229
|
-
(_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('timeupdate', handleTimeUpdate);
|
|
1230
|
-
(_c = audioRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('canplay', handleCanPlay);
|
|
1231
|
-
(_d = audioRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleEnded);
|
|
1232
|
-
return function () {
|
|
1233
|
-
var _a, _b, _c, _d;
|
|
1234
|
-
(_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('durationchange', handleDurationChange);
|
|
1235
|
-
(_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('timeupdate', handleTimeUpdate);
|
|
1236
|
-
(_c = audioRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('canplay', handleCanPlay);
|
|
1237
|
-
(_d = audioRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('ended', handleEnded);
|
|
1238
|
-
};
|
|
257
|
+
var setupAudioRef = function (config) { return function () {
|
|
258
|
+
var _a, _b, _c, _d;
|
|
259
|
+
var audioRef = config.audioRef, send = config.send;
|
|
260
|
+
var handleDurationChange = function (event) {
|
|
261
|
+
var duration = event.target.duration;
|
|
262
|
+
send({ type: AUDIO_PLAYER_EVENT_TYPES.DURATION_CHANGE, context: { duration: duration } });
|
|
263
|
+
};
|
|
264
|
+
var handleTimeUpdate = function (event) {
|
|
265
|
+
var currentTime = event.target.currentTime;
|
|
266
|
+
send({ type: AUDIO_PLAYER_EVENT_TYPES.TIME_CHANGE, context: { currentTime: currentTime } });
|
|
267
|
+
};
|
|
268
|
+
var handleCanPlay = function () {
|
|
269
|
+
send({ type: AUDIO_PLAYER_EVENT_TYPES.CAN_PLAY });
|
|
270
|
+
};
|
|
271
|
+
var handleEnded = function () {
|
|
272
|
+
send({ type: AUDIO_PLAYER_EVENT_TYPES.RESET });
|
|
273
|
+
};
|
|
274
|
+
(_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('durationchange', handleDurationChange);
|
|
275
|
+
(_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('timeupdate', handleTimeUpdate);
|
|
276
|
+
(_c = audioRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('canplay', handleCanPlay);
|
|
277
|
+
(_d = audioRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleEnded);
|
|
278
|
+
return function () {
|
|
279
|
+
var _a, _b, _c, _d;
|
|
280
|
+
(_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('durationchange', handleDurationChange);
|
|
281
|
+
(_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('timeupdate', handleTimeUpdate);
|
|
282
|
+
(_c = audioRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('canplay', handleCanPlay);
|
|
283
|
+
(_d = audioRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('ended', handleEnded);
|
|
284
|
+
};
|
|
1239
285
|
}; };
|
|
1240
286
|
|
|
1241
|
-
var getPlaybackIcon = function (status) {
|
|
1242
|
-
var icon;
|
|
1243
|
-
switch (status) {
|
|
1244
|
-
case PLAYBACK_STATES.PAUSED:
|
|
1245
|
-
icon =
|
|
1246
|
-
break;
|
|
1247
|
-
case PLAYBACK_STATES.PLAYING:
|
|
1248
|
-
icon =
|
|
1249
|
-
break;
|
|
1250
|
-
case PLAYBACK_STATES.NONE:
|
|
1251
|
-
icon =
|
|
1252
|
-
break;
|
|
1253
|
-
}
|
|
1254
|
-
return icon;
|
|
1255
|
-
};
|
|
1256
|
-
var AudioPlayer = function (props) {
|
|
1257
|
-
var _a, _b, _c, _d, _f, _g;
|
|
1258
|
-
var src = props.src, _h = props.classes, classes = _h === void 0 ? {} : _h;
|
|
1259
|
-
var volumeRef = React.useRef(null);
|
|
1260
|
-
var audioRef = React.useRef(null);
|
|
1261
|
-
var spacing = core.useTheme().spacing;
|
|
1262
|
-
var _j = React.useState(false), disableRipple = _j[0], setDisableRipple = _j[1];
|
|
1263
|
-
var _k = React.useReducer(audioPlayerReducer, __assign
|
|
1264
|
-
React.useEffect(setupAudioRef({ audioRef: audioRef, send: send }), [audioRef]);
|
|
1265
|
-
var PlaybackIcon = getPlaybackIcon(state.playback);
|
|
1266
|
-
var VolumeIcon = React.useMemo(function () { return useVolumeIcon(state); }, [state.context.volume, (_a = state.context.audioRef.current) === null || _a === void 0 ? void 0 : _a.muted]);
|
|
1267
|
-
var togglePlayback = function () { return send({ type: AUDIO_PLAYER_EVENT_TYPES.TOGGLE_PLAYBACK }); };
|
|
1268
|
-
var toggleVolumeControl = function () { return send({ type: AUDIO_PLAYER_EVENT_TYPES.TOGGLE_VOLUME_CONTROL }); };
|
|
1269
|
-
var toggleMute = function () { return send({ type: AUDIO_PLAYER_EVENT_TYPES.TOGGLE_MUTE }); };
|
|
1270
|
-
var setTime = function (_e, time) { return send({ type: AUDIO_PLAYER_EVENT_TYPES.SET_TIME, context: { time: time } }); };
|
|
1271
|
-
var setVolume = function (_e, volume) { return send({ type: AUDIO_PLAYER_EVENT_TYPES.VOLUME_CHANGE, context: { volume: volume } }); };
|
|
1272
|
-
return (
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
var TransitionProps = _a.TransitionProps;
|
|
1281
|
-
return (
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
}))),
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
287
|
+
var getPlaybackIcon = function (status) {
|
|
288
|
+
var icon;
|
|
289
|
+
switch (status) {
|
|
290
|
+
case PLAYBACK_STATES.PAUSED:
|
|
291
|
+
icon = webIcons.Play;
|
|
292
|
+
break;
|
|
293
|
+
case PLAYBACK_STATES.PLAYING:
|
|
294
|
+
icon = webIcons.Pause;
|
|
295
|
+
break;
|
|
296
|
+
case PLAYBACK_STATES.NONE:
|
|
297
|
+
icon = webIcons.Play;
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
return icon;
|
|
301
|
+
};
|
|
302
|
+
var AudioPlayer = function (props) {
|
|
303
|
+
var _a, _b, _c, _d, _f, _g;
|
|
304
|
+
var src = props.src, _h = props.classes, classes = _h === void 0 ? {} : _h;
|
|
305
|
+
var volumeRef = React.useRef(null);
|
|
306
|
+
var audioRef = React.useRef(null);
|
|
307
|
+
var spacing = core.useTheme().spacing;
|
|
308
|
+
var _j = React.useState(false), disableRipple = _j[0], setDisableRipple = _j[1];
|
|
309
|
+
var _k = React.useReducer(audioPlayerReducer, tslib.__assign(tslib.__assign({}, initialAudioPlayerState), { context: tslib.__assign(tslib.__assign({}, initialAudioPlayerState.context), { audioRef: audioRef }) })), state = _k[0], send = _k[1];
|
|
310
|
+
React.useEffect(setupAudioRef({ audioRef: audioRef, send: send }), [audioRef]);
|
|
311
|
+
var PlaybackIcon = getPlaybackIcon(state.playback);
|
|
312
|
+
var VolumeIcon = React.useMemo(function () { return useVolumeIcon(state); }, [state.context.volume, (_a = state.context.audioRef.current) === null || _a === void 0 ? void 0 : _a.muted]);
|
|
313
|
+
var togglePlayback = function () { return send({ type: AUDIO_PLAYER_EVENT_TYPES.TOGGLE_PLAYBACK }); };
|
|
314
|
+
var toggleVolumeControl = function () { return send({ type: AUDIO_PLAYER_EVENT_TYPES.TOGGLE_VOLUME_CONTROL }); };
|
|
315
|
+
var toggleMute = function () { return send({ type: AUDIO_PLAYER_EVENT_TYPES.TOGGLE_MUTE }); };
|
|
316
|
+
var setTime = function (_e, time) { return send({ type: AUDIO_PLAYER_EVENT_TYPES.SET_TIME, context: { time: time } }); };
|
|
317
|
+
var setVolume = function (_e, volume) { return send({ type: AUDIO_PLAYER_EVENT_TYPES.VOLUME_CHANGE, context: { volume: volume } }); };
|
|
318
|
+
return (React.createElement(commonUi.Box, { display: "flex", alignItems: "center", gridGap: spacing(1), className: classNames([classes.root]) },
|
|
319
|
+
React.createElement("audio", { ref: audioRef, src: src }),
|
|
320
|
+
React.createElement(commonUi.Box, null,
|
|
321
|
+
React.createElement(commonUi.IconButton, tslib.__assign({}, (classes.playbackToggle && { classes: { root: classes.playbackToggle } }), { "aria-label": state.context.playbackButtonLabel, disabled: ((_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.networkState) === 2, onClick: togglePlayback }),
|
|
322
|
+
React.createElement(commonUi.Icon, { icon: PlaybackIcon })),
|
|
323
|
+
React.createElement(commonUi.IconButton, tslib.__assign({}, (classes.volumeToggle && { classes: { root: classes.volumeToggle } }), { "aria-label": state.context.volumeButtonLabel, ref: volumeRef, onClick: toggleMute, onMouseEnter: toggleVolumeControl, onMouseLeave: toggleVolumeControl, disableRipple: disableRipple }),
|
|
324
|
+
React.createElement(commonUi.Icon, { icon: VolumeIcon }),
|
|
325
|
+
React.createElement(commonUi.Popper, { onClick: function (e) { return e.stopPropagation(); }, onMouseEnter: function () { return setDisableRipple(true); }, onMouseLeave: function () { return setDisableRipple(false); }, open: state.volumeControls === VOLUME_CONTROL_STATES.SHOW, anchorEl: function () { return volumeRef.current; }, transition: true, placement: "top", className: classNames([classes.volumeSlider]) }, function (_a) {
|
|
326
|
+
var TransitionProps = _a.TransitionProps;
|
|
327
|
+
return (React.createElement(core.Grow, tslib.__assign({}, TransitionProps),
|
|
328
|
+
React.createElement(commonUi.Paper, { elevation: 1 },
|
|
329
|
+
React.createElement(commonUi.Box, { py: 1, height: 80 },
|
|
330
|
+
React.createElement(core.Slider, { color: "secondary", orientation: "vertical", value: state.context.volume, onChange: setVolume, max: 1, step: 0.01 })))));
|
|
331
|
+
}))),
|
|
332
|
+
React.createElement(commonUi.Box, { display: "flex", flexGrow: 1, alignItems: "center", gridGap: spacing(1) },
|
|
333
|
+
React.createElement(commonUi.Box, { flexBasis: 60, flexShrink: 0 },
|
|
334
|
+
React.createElement(commonUi.Typography, tslib.__assign({}, (classes.playbackText && { classes: { root: classes.playbackText } })), formatTime(((_c = state.context.audioRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) || 0))),
|
|
335
|
+
React.createElement(core.Slider, tslib.__assign({}, (classes.playbackSlider && { classes: { root: classes.playbackSlider } }), { color: "secondary", value: ((_d = state.context.audioRef.current) === null || _d === void 0 ? void 0 : _d.currentTime) || 0, max: ((_f = state.context.audioRef.current) === null || _f === void 0 ? void 0 : _f.duration) || 1, onChange: setTime, disabled: state.playback === PLAYBACK_STATES.NONE })),
|
|
336
|
+
React.createElement(commonUi.Box, { flexBasis: 60, flexShrink: 0, textAlign: "end" },
|
|
337
|
+
React.createElement(commonUi.Typography, tslib.__assign({}, (classes.lengthText && { classes: { root: classes.lengthText } })), formatTime(((_g = state.context.audioRef.current) === null || _g === void 0 ? void 0 : _g.duration) || 0))))));
|
|
1292
338
|
};
|
|
1293
339
|
|
|
1294
340
|
exports.AudioPlayer = AudioPlayer;
|