@popmenu/audio-player 0.27.0 → 0.30.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 +160 -81
- package/build/index.es.js.map +1 -1
- package/build/index.js +160 -81
- package/build/index.js.map +1 -1
- package/package.json +2 -2
package/build/index.js
CHANGED
|
@@ -171,111 +171,111 @@ var classnames$1 = {exports: {}};
|
|
|
171
171
|
|
|
172
172
|
var classNames$1 = classnames$1.exports;
|
|
173
173
|
|
|
174
|
-
var _path$
|
|
174
|
+
var _path$13;
|
|
175
175
|
|
|
176
|
-
function _extends$
|
|
176
|
+
function _extends$1E() { _extends$1E = 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$1E.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$1E({
|
|
180
180
|
viewBox: "0 0 16 16",
|
|
181
|
+
fill: "none",
|
|
181
182
|
strokeLinecap: "round",
|
|
182
183
|
strokeLinejoin: "round",
|
|
183
|
-
stroke: "currentColor",
|
|
184
184
|
width: "1em",
|
|
185
|
-
height: "1em"
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
height: "1em"
|
|
186
|
+
}, props), _path$13 || (_path$13 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
187
|
+
d: "M6.667 2.667H4v10.666h2.667V2.666zm5.333 0H9.333v10.666H12V2.666z",
|
|
188
|
+
stroke: "currentColor"
|
|
189
189
|
})));
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
var _path$
|
|
192
|
+
var _path$11;
|
|
193
193
|
|
|
194
|
-
function _extends$
|
|
194
|
+
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); }
|
|
195
195
|
|
|
196
196
|
function SvgPlay(props) {
|
|
197
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
197
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1C({
|
|
198
198
|
viewBox: "0 0 16 16",
|
|
199
|
+
fill: "none",
|
|
199
200
|
strokeLinecap: "round",
|
|
200
201
|
strokeLinejoin: "round",
|
|
201
|
-
stroke: "currentColor",
|
|
202
202
|
width: "1em",
|
|
203
|
-
height: "1em"
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
height: "1em"
|
|
204
|
+
}, props), _path$11 || (_path$11 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
205
|
+
d: "M3.333 2l9.334 6-9.334 6V2z",
|
|
206
|
+
stroke: "currentColor"
|
|
207
207
|
})));
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
var _path$
|
|
210
|
+
var _path$V;
|
|
211
211
|
|
|
212
|
-
function _extends$
|
|
212
|
+
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); }
|
|
213
213
|
|
|
214
214
|
function SvgVolumeDown(props) {
|
|
215
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
215
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1p({
|
|
216
216
|
viewBox: "0 0 16 16",
|
|
217
|
+
fill: "none",
|
|
217
218
|
strokeLinecap: "round",
|
|
218
219
|
strokeLinejoin: "round",
|
|
219
|
-
stroke: "currentColor",
|
|
220
220
|
width: "1em",
|
|
221
|
-
height: "1em"
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
221
|
+
height: "1em"
|
|
222
|
+
}, props), _path$V || (_path$V = /*#__PURE__*/React__namespace.createElement("path", {
|
|
223
|
+
d: "M8.999 3.333L5.665 6H3v4h2.666L9 12.667V3.333zm3.026 2.307a3.333 3.333 0 010 4.714",
|
|
224
|
+
stroke: "currentColor"
|
|
225
225
|
})));
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
var _path$
|
|
228
|
+
var _path$U;
|
|
229
229
|
|
|
230
|
-
function _extends$
|
|
230
|
+
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); }
|
|
231
231
|
|
|
232
232
|
function SvgVolumeMute(props) {
|
|
233
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
233
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1o({
|
|
234
234
|
viewBox: "0 0 16 16",
|
|
235
|
+
fill: "none",
|
|
235
236
|
strokeLinecap: "round",
|
|
236
237
|
strokeLinejoin: "round",
|
|
237
|
-
stroke: "currentColor",
|
|
238
238
|
width: "1em",
|
|
239
|
-
height: "1em"
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
239
|
+
height: "1em"
|
|
240
|
+
}, props), _path$U || (_path$U = /*#__PURE__*/React__namespace.createElement("path", {
|
|
241
|
+
d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333z",
|
|
242
|
+
stroke: "currentColor"
|
|
243
243
|
})));
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
var _path$
|
|
246
|
+
var _path$T;
|
|
247
247
|
|
|
248
|
-
function _extends$
|
|
248
|
+
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); }
|
|
249
249
|
|
|
250
250
|
function SvgVolumeOff(props) {
|
|
251
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
251
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1n({
|
|
252
252
|
viewBox: "0 0 16 16",
|
|
253
|
+
fill: "none",
|
|
253
254
|
strokeLinecap: "round",
|
|
254
255
|
strokeLinejoin: "round",
|
|
255
|
-
stroke: "currentColor",
|
|
256
256
|
width: "1em",
|
|
257
|
-
height: "1em"
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
257
|
+
height: "1em"
|
|
258
|
+
}, props), _path$T || (_path$T = /*#__PURE__*/React__namespace.createElement("path", {
|
|
259
|
+
d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333zm8 2.667l-4 4m0-4l4 4",
|
|
260
|
+
stroke: "currentColor"
|
|
261
261
|
})));
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
var _path$
|
|
264
|
+
var _path$S;
|
|
265
265
|
|
|
266
|
-
function _extends$
|
|
266
|
+
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); }
|
|
267
267
|
|
|
268
268
|
function SvgVolumeUp(props) {
|
|
269
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
269
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1m({
|
|
270
270
|
viewBox: "0 0 16 16",
|
|
271
|
+
fill: "none",
|
|
271
272
|
strokeLinecap: "round",
|
|
272
273
|
strokeLinejoin: "round",
|
|
273
|
-
stroke: "currentColor",
|
|
274
274
|
width: "1em",
|
|
275
|
-
height: "1em"
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
275
|
+
height: "1em"
|
|
276
|
+
}, props), _path$S || (_path$S = /*#__PURE__*/React__namespace.createElement("path", {
|
|
277
|
+
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",
|
|
278
|
+
stroke: "currentColor"
|
|
279
279
|
})));
|
|
280
280
|
}
|
|
281
281
|
|
|
@@ -317,21 +317,21 @@ function __rest(s, e) {
|
|
|
317
317
|
return t;
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
var _path$
|
|
320
|
+
var _path$23;
|
|
321
321
|
|
|
322
|
-
function _extends$
|
|
322
|
+
function _extends$3g() { _extends$3g = 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$3g.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$3g({
|
|
326
326
|
viewBox: "0 0 16 16",
|
|
327
|
+
fill: "none",
|
|
327
328
|
strokeLinecap: "round",
|
|
328
329
|
strokeLinejoin: "round",
|
|
329
|
-
stroke: "currentColor",
|
|
330
330
|
width: "1em",
|
|
331
|
-
height: "1em"
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
331
|
+
height: "1em"
|
|
332
|
+
}, props), _path$23 || (_path$23 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
333
|
+
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",
|
|
334
|
+
stroke: "currentColor"
|
|
335
335
|
})));
|
|
336
336
|
}
|
|
337
337
|
|
|
@@ -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));
|
|
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;
|