@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.es.js
CHANGED
|
@@ -132,12 +132,12 @@ var classnames$1 = {exports: {}};
|
|
|
132
132
|
|
|
133
133
|
var classNames$1 = classnames$1.exports;
|
|
134
134
|
|
|
135
|
-
var _path$
|
|
135
|
+
var _path$1m;
|
|
136
136
|
|
|
137
|
-
function _extends$
|
|
137
|
+
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); }
|
|
138
138
|
|
|
139
139
|
function SvgPause(props) {
|
|
140
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
140
|
+
return /*#__PURE__*/React.createElement("svg", _extends$1r({
|
|
141
141
|
viewBox: "0 0 16 16",
|
|
142
142
|
strokeLinecap: "round",
|
|
143
143
|
strokeLinejoin: "round",
|
|
@@ -145,17 +145,17 @@ function SvgPause(props) {
|
|
|
145
145
|
width: "1em",
|
|
146
146
|
height: "1em",
|
|
147
147
|
fill: "none"
|
|
148
|
-
}, props), _path$
|
|
148
|
+
}, props), _path$1m || (_path$1m = /*#__PURE__*/React.createElement("path", {
|
|
149
149
|
d: "M6.667 2.667H4v10.666h2.667V2.666zm5.333 0H9.333v10.666H12V2.666z"
|
|
150
150
|
})));
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
var _path$
|
|
153
|
+
var _path$1k;
|
|
154
154
|
|
|
155
|
-
function _extends$
|
|
155
|
+
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); }
|
|
156
156
|
|
|
157
157
|
function SvgPlay(props) {
|
|
158
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
158
|
+
return /*#__PURE__*/React.createElement("svg", _extends$1p({
|
|
159
159
|
viewBox: "0 0 16 16",
|
|
160
160
|
strokeLinecap: "round",
|
|
161
161
|
strokeLinejoin: "round",
|
|
@@ -163,17 +163,17 @@ function SvgPlay(props) {
|
|
|
163
163
|
width: "1em",
|
|
164
164
|
height: "1em",
|
|
165
165
|
fill: "none"
|
|
166
|
-
}, props), _path$
|
|
166
|
+
}, props), _path$1k || (_path$1k = /*#__PURE__*/React.createElement("path", {
|
|
167
167
|
d: "M3.333 2l9.334 6-9.334 6V2z"
|
|
168
168
|
})));
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
var _path$
|
|
171
|
+
var _path$17;
|
|
172
172
|
|
|
173
|
-
function _extends$
|
|
173
|
+
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); }
|
|
174
174
|
|
|
175
175
|
function SvgVolumeDown(props) {
|
|
176
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
176
|
+
return /*#__PURE__*/React.createElement("svg", _extends$1c({
|
|
177
177
|
viewBox: "0 0 16 16",
|
|
178
178
|
strokeLinecap: "round",
|
|
179
179
|
strokeLinejoin: "round",
|
|
@@ -181,17 +181,17 @@ function SvgVolumeDown(props) {
|
|
|
181
181
|
width: "1em",
|
|
182
182
|
height: "1em",
|
|
183
183
|
fill: "none"
|
|
184
|
-
}, props), _path$
|
|
184
|
+
}, props), _path$17 || (_path$17 = /*#__PURE__*/React.createElement("path", {
|
|
185
185
|
d: "M8.999 3.333L5.665 6H3v4h2.666L9 12.667V3.333zm3.026 2.307a3.333 3.333 0 010 4.714"
|
|
186
186
|
})));
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
var _path$
|
|
189
|
+
var _path$16;
|
|
190
190
|
|
|
191
|
-
function _extends$
|
|
191
|
+
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); }
|
|
192
192
|
|
|
193
193
|
function SvgVolumeMute(props) {
|
|
194
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
194
|
+
return /*#__PURE__*/React.createElement("svg", _extends$1b({
|
|
195
195
|
viewBox: "0 0 16 16",
|
|
196
196
|
strokeLinecap: "round",
|
|
197
197
|
strokeLinejoin: "round",
|
|
@@ -199,17 +199,17 @@ function SvgVolumeMute(props) {
|
|
|
199
199
|
width: "1em",
|
|
200
200
|
height: "1em",
|
|
201
201
|
fill: "none"
|
|
202
|
-
}, props), _path$
|
|
202
|
+
}, props), _path$16 || (_path$16 = /*#__PURE__*/React.createElement("path", {
|
|
203
203
|
d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333z"
|
|
204
204
|
})));
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
var _path$
|
|
207
|
+
var _path$15;
|
|
208
208
|
|
|
209
|
-
function _extends$
|
|
209
|
+
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); }
|
|
210
210
|
|
|
211
211
|
function SvgVolumeOff(props) {
|
|
212
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
212
|
+
return /*#__PURE__*/React.createElement("svg", _extends$1a({
|
|
213
213
|
viewBox: "0 0 16 16",
|
|
214
214
|
strokeLinecap: "round",
|
|
215
215
|
strokeLinejoin: "round",
|
|
@@ -217,17 +217,17 @@ function SvgVolumeOff(props) {
|
|
|
217
217
|
width: "1em",
|
|
218
218
|
height: "1em",
|
|
219
219
|
fill: "none"
|
|
220
|
-
}, props), _path$
|
|
220
|
+
}, props), _path$15 || (_path$15 = /*#__PURE__*/React.createElement("path", {
|
|
221
221
|
d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333zm8 2.667l-4 4m0-4l4 4"
|
|
222
222
|
})));
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
var _path$
|
|
225
|
+
var _path$14;
|
|
226
226
|
|
|
227
|
-
function _extends$
|
|
227
|
+
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); }
|
|
228
228
|
|
|
229
229
|
function SvgVolumeUp(props) {
|
|
230
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
230
|
+
return /*#__PURE__*/React.createElement("svg", _extends$19({
|
|
231
231
|
viewBox: "0 0 16 16",
|
|
232
232
|
strokeLinecap: "round",
|
|
233
233
|
strokeLinejoin: "round",
|
|
@@ -235,7 +235,7 @@ function SvgVolumeUp(props) {
|
|
|
235
235
|
width: "1em",
|
|
236
236
|
height: "1em",
|
|
237
237
|
fill: "none"
|
|
238
|
-
}, props), _path$
|
|
238
|
+
}, props), _path$14 || (_path$14 = /*#__PURE__*/React.createElement("path", {
|
|
239
239
|
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"
|
|
240
240
|
})));
|
|
241
241
|
}
|
|
@@ -278,12 +278,12 @@ function __rest(s, e) {
|
|
|
278
278
|
return t;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
var _path$
|
|
281
|
+
var _path$2Q;
|
|
282
282
|
|
|
283
|
-
function _extends$
|
|
283
|
+
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); }
|
|
284
284
|
|
|
285
285
|
function SvgUser(props) {
|
|
286
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
286
|
+
return /*#__PURE__*/React.createElement("svg", _extends$35({
|
|
287
287
|
viewBox: "0 0 16 16",
|
|
288
288
|
strokeLinecap: "round",
|
|
289
289
|
strokeLinejoin: "round",
|
|
@@ -291,7 +291,7 @@ function SvgUser(props) {
|
|
|
291
291
|
width: "1em",
|
|
292
292
|
height: "1em",
|
|
293
293
|
fill: "none"
|
|
294
|
-
}, props), _path$
|
|
294
|
+
}, props), _path$2Q || (_path$2Q = /*#__PURE__*/React.createElement("path", {
|
|
295
295
|
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"
|
|
296
296
|
})));
|
|
297
297
|
}
|
|
@@ -523,29 +523,108 @@ var Checkbox = forwardRef(function (props, ref) {
|
|
|
523
523
|
});
|
|
524
524
|
Checkbox.displayName = 'Checkbox';
|
|
525
525
|
|
|
526
|
-
var
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
543
|
-
|
|
526
|
+
var weights = {
|
|
527
|
+
regular: 400,
|
|
528
|
+
'semi-bold': 600,
|
|
529
|
+
bold: 700,
|
|
530
|
+
};
|
|
531
|
+
var getColor = function (theme, props) {
|
|
532
|
+
var color = props.color;
|
|
533
|
+
if (color === undefined) {
|
|
534
|
+
return undefined;
|
|
535
|
+
}
|
|
536
|
+
if (['white', 'black'].includes(color)) {
|
|
537
|
+
return theme.palette.common[color];
|
|
538
|
+
}
|
|
539
|
+
if (color.match(/^grey\.\d{3}/)) {
|
|
540
|
+
var scale = color.split('.')[1];
|
|
541
|
+
return theme.palette.grey[scale] || theme.palette.grey[900];
|
|
542
|
+
}
|
|
543
|
+
if ([
|
|
544
|
+
'primary.light',
|
|
545
|
+
'primary.dark',
|
|
546
|
+
'secondary.light',
|
|
547
|
+
'secondary',
|
|
548
|
+
'secondary.dark',
|
|
549
|
+
'info.light',
|
|
550
|
+
'info.dark',
|
|
551
|
+
'success.light',
|
|
552
|
+
'success.dark',
|
|
553
|
+
'error.light',
|
|
554
|
+
'error.dark',
|
|
555
|
+
'warning.light',
|
|
556
|
+
'warning.dark',
|
|
557
|
+
].includes(color)) {
|
|
558
|
+
var _a = color.split('.'), paletteKey = _a[0], variant = _a[1];
|
|
559
|
+
return theme.palette[paletteKey][variant];
|
|
560
|
+
}
|
|
561
|
+
if (['success', 'info', 'error', 'warning', 'primary', 'secondary'].includes(color)) {
|
|
562
|
+
return theme.palette[color].main;
|
|
563
|
+
}
|
|
564
|
+
if (['textPrimary', 'textSecondary'].includes(color)) {
|
|
565
|
+
return theme.palette.text[color.slice(4).toLowerCase()];
|
|
566
|
+
}
|
|
567
|
+
return undefined;
|
|
568
|
+
};
|
|
569
|
+
var useTypographyStyles = makeStyles$1(function (theme) {
|
|
570
|
+
var _a;
|
|
571
|
+
return ({
|
|
572
|
+
root: (_a = {},
|
|
573
|
+
_a["& ." + iconStaticClassName] = {
|
|
574
|
+
position: 'relative',
|
|
575
|
+
top: '0.125em',
|
|
576
|
+
padding: '0 0.125em',
|
|
577
|
+
boxSizing: 'content-box',
|
|
578
|
+
},
|
|
579
|
+
_a.fontFamily = theme.typography.fontFamily,
|
|
580
|
+
_a.fontWeight = function (_a) {
|
|
581
|
+
var variant = _a.variant, weight = _a.weight;
|
|
582
|
+
return (weight ? weights[weight] : theme.typography[variant || 'body1'].fontWeight);
|
|
583
|
+
},
|
|
584
|
+
_a.fontSize = function (_a) {
|
|
585
|
+
var variant = _a.variant;
|
|
586
|
+
return theme.typography[variant || 'body1'].fontSize;
|
|
587
|
+
},
|
|
588
|
+
_a.lineHeight = function (_a) {
|
|
589
|
+
var variant = _a.variant;
|
|
590
|
+
return theme.typography[variant || 'body1'].lineHeight;
|
|
591
|
+
},
|
|
592
|
+
_a.textTransform = function (_a) {
|
|
593
|
+
var variant = _a.variant;
|
|
594
|
+
return theme.typography[variant || 'body1'].textTransform;
|
|
595
|
+
},
|
|
596
|
+
_a.color = function (props) { return getColor(theme, props); },
|
|
597
|
+
_a),
|
|
598
|
+
caption: {
|
|
599
|
+
display: 'inline',
|
|
600
|
+
},
|
|
601
|
+
overline: {
|
|
602
|
+
display: 'inline',
|
|
603
|
+
},
|
|
604
|
+
});
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
var variantMap = {
|
|
608
|
+
h1: 'h1',
|
|
609
|
+
h2: 'h2',
|
|
610
|
+
h3: 'h3',
|
|
611
|
+
h4: 'h4',
|
|
612
|
+
h5: 'h5',
|
|
613
|
+
h6: 'h6',
|
|
614
|
+
h7: 'h6',
|
|
615
|
+
body1: 'p',
|
|
616
|
+
body2: 'p',
|
|
617
|
+
subtitle1: 'h6',
|
|
618
|
+
subtitle2: 'h6',
|
|
619
|
+
caption: 'span',
|
|
620
|
+
overline: 'span',
|
|
621
|
+
};
|
|
544
622
|
|
|
545
623
|
var Typography = forwardRef(function (props, ref) {
|
|
546
|
-
props.weight; var restProps = __rest(props, ["weight"]);
|
|
624
|
+
props.weight; var _a = props.variant, variant = _a === void 0 ? 'body1' : _a; props.color; var restProps = __rest(props, ["weight", "variant", "color"]);
|
|
547
625
|
var classes = useTypographyStyles(props);
|
|
548
|
-
|
|
626
|
+
var component = variantMap[variant];
|
|
627
|
+
return React__default.createElement(Typography$1, __assign({ component: component, ref: ref, classes: classes }, restProps, { variant: "inherit" }));
|
|
549
628
|
});
|
|
550
629
|
Typography.displayName = 'Typography';
|
|
551
630
|
|
|
@@ -1020,9 +1099,9 @@ var AudioPlayer = function (props) {
|
|
|
1020
1099
|
return (React__default.createElement(Box, { display: "flex", alignItems: "center", gridGap: spacing(1), className: classNames$1([classes.root]) },
|
|
1021
1100
|
React__default.createElement("audio", { ref: audioRef, src: src }),
|
|
1022
1101
|
React__default.createElement(Box, null,
|
|
1023
|
-
React__default.createElement(IconButton, { classes: { root: classes.playbackToggle }, "aria-label": state.context.playbackButtonLabel, disabled: state.playback === PLAYBACK_STATES.NONE, onClick: togglePlayback },
|
|
1102
|
+
React__default.createElement(IconButton, __assign$1({}, (classes.playbackToggle && { classes: { root: classes.playbackToggle } }), { "aria-label": state.context.playbackButtonLabel, disabled: state.playback === PLAYBACK_STATES.NONE, onClick: togglePlayback }),
|
|
1024
1103
|
React__default.createElement(Icon, { icon: PlaybackIcon })),
|
|
1025
|
-
React__default.createElement(IconButton, { classes: { root: classes.volumeToggle }, "aria-label": state.context.volumeButtonLabel, ref: volumeRef, onClick: toggleMute, onMouseEnter: toggleVolumeControl, onMouseLeave: toggleVolumeControl, disableRipple: disableRipple },
|
|
1104
|
+
React__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 }),
|
|
1026
1105
|
React__default.createElement(Icon, { icon: VolumeIcon }),
|
|
1027
1106
|
React__default.createElement(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) {
|
|
1028
1107
|
var TransitionProps = _a.TransitionProps;
|
|
@@ -1033,10 +1112,10 @@ var AudioPlayer = function (props) {
|
|
|
1033
1112
|
}))),
|
|
1034
1113
|
React__default.createElement(Box, { display: "flex", flexGrow: 1, alignItems: "center", gridGap: spacing(1) },
|
|
1035
1114
|
React__default.createElement(Box, { flexBasis: 60, flexShrink: 0 },
|
|
1036
|
-
React__default.createElement(Typography, { classes: { root: classes.playbackText } }, formatTime(((_b = state.context.audioRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0))),
|
|
1037
|
-
React__default.createElement(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 }),
|
|
1115
|
+
React__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))),
|
|
1116
|
+
React__default.createElement(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 })),
|
|
1038
1117
|
React__default.createElement(Box, { flexBasis: 60, flexShrink: 0, textAlign: "end" },
|
|
1039
|
-
React__default.createElement(Typography, { classes: { root: classes.lengthText } }, formatTime(((_f = state.context.audioRef.current) === null || _f === void 0 ? void 0 : _f.duration) || 0))))));
|
|
1118
|
+
React__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))))));
|
|
1040
1119
|
};
|
|
1041
1120
|
|
|
1042
1121
|
export { AudioPlayer };
|