@popmenu/audio-player 0.27.0 → 0.28.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/build/index.es.js +132 -53
- package/build/index.es.js.map +1 -1
- package/build/index.js +132 -53
- package/build/index.js.map +1 -1
- package/package.json +2 -2
package/build/index.js
CHANGED
|
@@ -171,12 +171,12 @@ var classnames$1 = {exports: {}};
|
|
|
171
171
|
|
|
172
172
|
var classNames$1 = classnames$1.exports;
|
|
173
173
|
|
|
174
|
-
var _path$
|
|
174
|
+
var _path$1m;
|
|
175
175
|
|
|
176
|
-
function _extends$
|
|
176
|
+
function _extends$1r() { _extends$1r = 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$1r.apply(this, arguments); }
|
|
177
177
|
|
|
178
178
|
function SvgPause(props) {
|
|
179
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
179
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1r({
|
|
180
180
|
viewBox: "0 0 16 16",
|
|
181
181
|
strokeLinecap: "round",
|
|
182
182
|
strokeLinejoin: "round",
|
|
@@ -184,17 +184,17 @@ function SvgPause(props) {
|
|
|
184
184
|
width: "1em",
|
|
185
185
|
height: "1em",
|
|
186
186
|
fill: "none"
|
|
187
|
-
}, props), _path$
|
|
187
|
+
}, props), _path$1m || (_path$1m = /*#__PURE__*/React__namespace.createElement("path", {
|
|
188
188
|
d: "M6.667 2.667H4v10.666h2.667V2.666zm5.333 0H9.333v10.666H12V2.666z"
|
|
189
189
|
})));
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
var _path$
|
|
192
|
+
var _path$1k;
|
|
193
193
|
|
|
194
|
-
function _extends$
|
|
194
|
+
function _extends$1p() { _extends$1p = 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$1p.apply(this, arguments); }
|
|
195
195
|
|
|
196
196
|
function SvgPlay(props) {
|
|
197
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
197
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1p({
|
|
198
198
|
viewBox: "0 0 16 16",
|
|
199
199
|
strokeLinecap: "round",
|
|
200
200
|
strokeLinejoin: "round",
|
|
@@ -202,17 +202,17 @@ function SvgPlay(props) {
|
|
|
202
202
|
width: "1em",
|
|
203
203
|
height: "1em",
|
|
204
204
|
fill: "none"
|
|
205
|
-
}, props), _path$
|
|
205
|
+
}, props), _path$1k || (_path$1k = /*#__PURE__*/React__namespace.createElement("path", {
|
|
206
206
|
d: "M3.333 2l9.334 6-9.334 6V2z"
|
|
207
207
|
})));
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
var _path$
|
|
210
|
+
var _path$17;
|
|
211
211
|
|
|
212
|
-
function _extends$
|
|
212
|
+
function _extends$1c() { _extends$1c = 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$1c.apply(this, arguments); }
|
|
213
213
|
|
|
214
214
|
function SvgVolumeDown(props) {
|
|
215
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
215
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1c({
|
|
216
216
|
viewBox: "0 0 16 16",
|
|
217
217
|
strokeLinecap: "round",
|
|
218
218
|
strokeLinejoin: "round",
|
|
@@ -220,17 +220,17 @@ function SvgVolumeDown(props) {
|
|
|
220
220
|
width: "1em",
|
|
221
221
|
height: "1em",
|
|
222
222
|
fill: "none"
|
|
223
|
-
}, props), _path$
|
|
223
|
+
}, props), _path$17 || (_path$17 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
224
224
|
d: "M8.999 3.333L5.665 6H3v4h2.666L9 12.667V3.333zm3.026 2.307a3.333 3.333 0 010 4.714"
|
|
225
225
|
})));
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
var _path$
|
|
228
|
+
var _path$16;
|
|
229
229
|
|
|
230
|
-
function _extends$
|
|
230
|
+
function _extends$1b() { _extends$1b = 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$1b.apply(this, arguments); }
|
|
231
231
|
|
|
232
232
|
function SvgVolumeMute(props) {
|
|
233
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
233
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1b({
|
|
234
234
|
viewBox: "0 0 16 16",
|
|
235
235
|
strokeLinecap: "round",
|
|
236
236
|
strokeLinejoin: "round",
|
|
@@ -238,17 +238,17 @@ function SvgVolumeMute(props) {
|
|
|
238
238
|
width: "1em",
|
|
239
239
|
height: "1em",
|
|
240
240
|
fill: "none"
|
|
241
|
-
}, props), _path$
|
|
241
|
+
}, props), _path$16 || (_path$16 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
242
242
|
d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333z"
|
|
243
243
|
})));
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
var _path$
|
|
246
|
+
var _path$15;
|
|
247
247
|
|
|
248
|
-
function _extends$
|
|
248
|
+
function _extends$1a() { _extends$1a = 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$1a.apply(this, arguments); }
|
|
249
249
|
|
|
250
250
|
function SvgVolumeOff(props) {
|
|
251
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
251
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1a({
|
|
252
252
|
viewBox: "0 0 16 16",
|
|
253
253
|
strokeLinecap: "round",
|
|
254
254
|
strokeLinejoin: "round",
|
|
@@ -256,17 +256,17 @@ function SvgVolumeOff(props) {
|
|
|
256
256
|
width: "1em",
|
|
257
257
|
height: "1em",
|
|
258
258
|
fill: "none"
|
|
259
|
-
}, props), _path$
|
|
259
|
+
}, props), _path$15 || (_path$15 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
260
260
|
d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333zm8 2.667l-4 4m0-4l4 4"
|
|
261
261
|
})));
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
var _path$
|
|
264
|
+
var _path$14;
|
|
265
265
|
|
|
266
|
-
function _extends$
|
|
266
|
+
function _extends$19() { _extends$19 = 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$19.apply(this, arguments); }
|
|
267
267
|
|
|
268
268
|
function SvgVolumeUp(props) {
|
|
269
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
269
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$19({
|
|
270
270
|
viewBox: "0 0 16 16",
|
|
271
271
|
strokeLinecap: "round",
|
|
272
272
|
strokeLinejoin: "round",
|
|
@@ -274,7 +274,7 @@ function SvgVolumeUp(props) {
|
|
|
274
274
|
width: "1em",
|
|
275
275
|
height: "1em",
|
|
276
276
|
fill: "none"
|
|
277
|
-
}, props), _path$
|
|
277
|
+
}, props), _path$14 || (_path$14 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
278
278
|
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"
|
|
279
279
|
})));
|
|
280
280
|
}
|
|
@@ -317,12 +317,12 @@ function __rest(s, e) {
|
|
|
317
317
|
return t;
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
var _path$
|
|
320
|
+
var _path$2Q;
|
|
321
321
|
|
|
322
|
-
function _extends$
|
|
322
|
+
function _extends$35() { _extends$35 = 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$35.apply(this, arguments); }
|
|
323
323
|
|
|
324
324
|
function SvgUser(props) {
|
|
325
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
325
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$35({
|
|
326
326
|
viewBox: "0 0 16 16",
|
|
327
327
|
strokeLinecap: "round",
|
|
328
328
|
strokeLinejoin: "round",
|
|
@@ -330,7 +330,7 @@ function SvgUser(props) {
|
|
|
330
330
|
width: "1em",
|
|
331
331
|
height: "1em",
|
|
332
332
|
fill: "none"
|
|
333
|
-
}, props), _path$
|
|
333
|
+
}, props), _path$2Q || (_path$2Q = /*#__PURE__*/React__namespace.createElement("path", {
|
|
334
334
|
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"
|
|
335
335
|
})));
|
|
336
336
|
}
|
|
@@ -562,29 +562,108 @@ var Checkbox = React.forwardRef(function (props, ref) {
|
|
|
562
562
|
});
|
|
563
563
|
Checkbox.displayName = 'Checkbox';
|
|
564
564
|
|
|
565
|
-
var
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
}
|
|
582
|
-
|
|
565
|
+
var weights = {
|
|
566
|
+
regular: 400,
|
|
567
|
+
'semi-bold': 600,
|
|
568
|
+
bold: 700,
|
|
569
|
+
};
|
|
570
|
+
var getColor = function (theme, props) {
|
|
571
|
+
var color = props.color;
|
|
572
|
+
if (color === undefined) {
|
|
573
|
+
return undefined;
|
|
574
|
+
}
|
|
575
|
+
if (['white', 'black'].includes(color)) {
|
|
576
|
+
return theme.palette.common[color];
|
|
577
|
+
}
|
|
578
|
+
if (color.match(/^grey\.\d{3}/)) {
|
|
579
|
+
var scale = color.split('.')[1];
|
|
580
|
+
return theme.palette.grey[scale] || theme.palette.grey[900];
|
|
581
|
+
}
|
|
582
|
+
if ([
|
|
583
|
+
'primary.light',
|
|
584
|
+
'primary.dark',
|
|
585
|
+
'secondary.light',
|
|
586
|
+
'secondary',
|
|
587
|
+
'secondary.dark',
|
|
588
|
+
'info.light',
|
|
589
|
+
'info.dark',
|
|
590
|
+
'success.light',
|
|
591
|
+
'success.dark',
|
|
592
|
+
'error.light',
|
|
593
|
+
'error.dark',
|
|
594
|
+
'warning.light',
|
|
595
|
+
'warning.dark',
|
|
596
|
+
].includes(color)) {
|
|
597
|
+
var _a = color.split('.'), paletteKey = _a[0], variant = _a[1];
|
|
598
|
+
return theme.palette[paletteKey][variant];
|
|
599
|
+
}
|
|
600
|
+
if (['success', 'info', 'error', 'warning', 'primary', 'secondary'].includes(color)) {
|
|
601
|
+
return theme.palette[color].main;
|
|
602
|
+
}
|
|
603
|
+
if (['textPrimary', 'textSecondary'].includes(color)) {
|
|
604
|
+
return theme.palette.text[color.slice(4).toLowerCase()];
|
|
605
|
+
}
|
|
606
|
+
return undefined;
|
|
607
|
+
};
|
|
608
|
+
var useTypographyStyles = styles.makeStyles(function (theme) {
|
|
609
|
+
var _a;
|
|
610
|
+
return ({
|
|
611
|
+
root: (_a = {},
|
|
612
|
+
_a["& ." + iconStaticClassName] = {
|
|
613
|
+
position: 'relative',
|
|
614
|
+
top: '0.125em',
|
|
615
|
+
padding: '0 0.125em',
|
|
616
|
+
boxSizing: 'content-box',
|
|
617
|
+
},
|
|
618
|
+
_a.fontFamily = theme.typography.fontFamily,
|
|
619
|
+
_a.fontWeight = function (_a) {
|
|
620
|
+
var variant = _a.variant, weight = _a.weight;
|
|
621
|
+
return (weight ? weights[weight] : theme.typography[variant || 'body1'].fontWeight);
|
|
622
|
+
},
|
|
623
|
+
_a.fontSize = function (_a) {
|
|
624
|
+
var variant = _a.variant;
|
|
625
|
+
return theme.typography[variant || 'body1'].fontSize;
|
|
626
|
+
},
|
|
627
|
+
_a.lineHeight = function (_a) {
|
|
628
|
+
var variant = _a.variant;
|
|
629
|
+
return theme.typography[variant || 'body1'].lineHeight;
|
|
630
|
+
},
|
|
631
|
+
_a.textTransform = function (_a) {
|
|
632
|
+
var variant = _a.variant;
|
|
633
|
+
return theme.typography[variant || 'body1'].textTransform;
|
|
634
|
+
},
|
|
635
|
+
_a.color = function (props) { return getColor(theme, props); },
|
|
636
|
+
_a),
|
|
637
|
+
caption: {
|
|
638
|
+
display: 'inline',
|
|
639
|
+
},
|
|
640
|
+
overline: {
|
|
641
|
+
display: 'inline',
|
|
642
|
+
},
|
|
643
|
+
});
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
var variantMap = {
|
|
647
|
+
h1: 'h1',
|
|
648
|
+
h2: 'h2',
|
|
649
|
+
h3: 'h3',
|
|
650
|
+
h4: 'h4',
|
|
651
|
+
h5: 'h5',
|
|
652
|
+
h6: 'h6',
|
|
653
|
+
h7: 'h6',
|
|
654
|
+
body1: 'p',
|
|
655
|
+
body2: 'p',
|
|
656
|
+
subtitle1: 'h6',
|
|
657
|
+
subtitle2: 'h6',
|
|
658
|
+
caption: 'span',
|
|
659
|
+
overline: 'span',
|
|
660
|
+
};
|
|
583
661
|
|
|
584
662
|
var Typography = React.forwardRef(function (props, ref) {
|
|
585
|
-
props.weight; var restProps = __rest(props, ["weight"]);
|
|
663
|
+
props.weight; var _a = props.variant, variant = _a === void 0 ? 'body1' : _a; props.color; var restProps = __rest(props, ["weight", "variant", "color"]);
|
|
586
664
|
var classes = useTypographyStyles(props);
|
|
587
|
-
|
|
665
|
+
var component = variantMap[variant];
|
|
666
|
+
return React__default['default'].createElement(core.Typography, __assign({ component: component, ref: ref, classes: classes }, restProps, { variant: "inherit" }));
|
|
588
667
|
});
|
|
589
668
|
Typography.displayName = 'Typography';
|
|
590
669
|
|
|
@@ -1059,9 +1138,9 @@ var AudioPlayer = function (props) {
|
|
|
1059
1138
|
return (React__default['default'].createElement(core.Box, { display: "flex", alignItems: "center", gridGap: spacing(1), className: classNames$1([classes.root]) },
|
|
1060
1139
|
React__default['default'].createElement("audio", { ref: audioRef, src: src }),
|
|
1061
1140
|
React__default['default'].createElement(core.Box, null,
|
|
1062
|
-
React__default['default'].createElement(IconButton, { classes: { root: classes.playbackToggle }, "aria-label": state.context.playbackButtonLabel, disabled: state.playback === PLAYBACK_STATES.NONE, onClick: togglePlayback },
|
|
1141
|
+
React__default['default'].createElement(IconButton, __assign$1({}, (classes.playbackToggle && { classes: { root: classes.playbackToggle } }), { "aria-label": state.context.playbackButtonLabel, disabled: state.playback === PLAYBACK_STATES.NONE, onClick: togglePlayback }),
|
|
1063
1142
|
React__default['default'].createElement(Icon, { icon: PlaybackIcon })),
|
|
1064
|
-
React__default['default'].createElement(IconButton, { classes: { root: classes.volumeToggle }, "aria-label": state.context.volumeButtonLabel, ref: volumeRef, onClick: toggleMute, onMouseEnter: toggleVolumeControl, onMouseLeave: toggleVolumeControl, disableRipple: disableRipple },
|
|
1143
|
+
React__default['default'].createElement(IconButton, __assign$1({}, (classes.volumeToggle && { classes: { root: classes.volumeToggle } }), { "aria-label": state.context.volumeButtonLabel, ref: volumeRef, onClick: toggleMute, onMouseEnter: toggleVolumeControl, onMouseLeave: toggleVolumeControl, disableRipple: disableRipple }),
|
|
1065
1144
|
React__default['default'].createElement(Icon, { icon: VolumeIcon }),
|
|
1066
1145
|
React__default['default'].createElement(core.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$1([classes.volumeSlider]) }, function (_a) {
|
|
1067
1146
|
var TransitionProps = _a.TransitionProps;
|
|
@@ -1072,10 +1151,10 @@ var AudioPlayer = function (props) {
|
|
|
1072
1151
|
}))),
|
|
1073
1152
|
React__default['default'].createElement(core.Box, { display: "flex", flexGrow: 1, alignItems: "center", gridGap: spacing(1) },
|
|
1074
1153
|
React__default['default'].createElement(core.Box, { flexBasis: 60, flexShrink: 0 },
|
|
1075
|
-
React__default['default'].createElement(Typography, { classes: { root: classes.playbackText } }, formatTime(((_b = state.context.audioRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0))),
|
|
1076
|
-
React__default['default'].createElement(core.Slider, { classes: { root: classes.playbackSlider }, color: "secondary", value: ((_c = state.context.audioRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) || 0, max: ((_d = state.context.audioRef.current) === null || _d === void 0 ? void 0 : _d.duration) || 1, onChange: setTime, disabled: state.playback === PLAYBACK_STATES.NONE }),
|
|
1154
|
+
React__default['default'].createElement(Typography, __assign$1({}, (classes.playbackText && { classes: { root: classes.playbackText } })), formatTime(((_b = state.context.audioRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0))),
|
|
1155
|
+
React__default['default'].createElement(core.Slider, __assign$1({}, (classes.playbackSlider && { classes: { root: classes.playbackSlider } }), { color: "secondary", value: ((_c = state.context.audioRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) || 0, max: ((_d = state.context.audioRef.current) === null || _d === void 0 ? void 0 : _d.duration) || 1, onChange: setTime, disabled: state.playback === PLAYBACK_STATES.NONE })),
|
|
1077
1156
|
React__default['default'].createElement(core.Box, { flexBasis: 60, flexShrink: 0, textAlign: "end" },
|
|
1078
|
-
React__default['default'].createElement(Typography, { classes: { root: classes.lengthText } }, formatTime(((_f = state.context.audioRef.current) === null || _f === void 0 ? void 0 : _f.duration) || 0))))));
|
|
1157
|
+
React__default['default'].createElement(Typography, __assign$1({}, (classes.lengthText && { classes: { root: classes.lengthText } })), formatTime(((_f = state.context.audioRef.current) === null || _f === void 0 ? void 0 : _f.duration) || 0))))));
|
|
1079
1158
|
};
|
|
1080
1159
|
|
|
1081
1160
|
exports.AudioPlayer = AudioPlayer;
|