@popmenu/common-ui 0.26.0 → 0.27.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.
@@ -4,7 +4,6 @@ export { default as AccordionActions, AccordionActionsProps } from './AccordionA
4
4
  export { default as AccordionDetails, AccordionDetailsProps } from './AccordionDetails';
5
5
  export { default as AccordionSummary, AccordionSummaryProps } from './AccordionSummary';
6
6
  export { default as AppBar, AppBarProps } from './AppBar';
7
- export { default as AudioPlayer, AudioPlayerProps } from './AudioPlayer';
8
7
  export { default as Avatar, AvatarProps } from './Avatar';
9
8
  export { default as Badge, BadgeProps } from './Badge';
10
9
  export { default as Box, BoxProps } from './Box';
package/build/index.es.js CHANGED
@@ -1,13 +1,12 @@
1
1
  export { default as Alert } from '@material-ui/lab/Alert';
2
- import { makeStyles, Typography as Typography$1, Paper as Paper$1, useTheme, Box, Popper, Grow, Slider, Link as Link$1, TextField as TextField$1 } from '@material-ui/core';
2
+ import { makeStyles, Typography as Typography$1, useTheme as useTheme$1, Box, Link as Link$1, Paper as Paper$1, TextField as TextField$1 } from '@material-ui/core';
3
3
  export { Accordion, AccordionActions, AccordionDetails, AccordionSummary, Box, Breadcrumbs, ButtonBase, ClickAwayListener, Fab, GridList, Hidden, Modal, Popover, Popper, Step, StepButton, StepConnector, StepContent, StepIcon, StepLabel, Stepper, ThemeProvider, Toolbar, alpha, createTheme, darken, decomposeColor, getLuminance, hexToRgb, lighten, makeStyles, recomposeColor, rgbToHex } from '@material-ui/core';
4
4
  export { default as AppBar } from '@material-ui/core/AppBar';
5
5
  import * as React from 'react';
6
- import React__default, { createElement, forwardRef, useRef, useState, useReducer, useEffect, useMemo } from 'react';
7
- import MuiIconButton from '@material-ui/core/IconButton';
8
- import { makeStyles as makeStyles$1, useTheme as useTheme$1 } from '@material-ui/core/styles';
9
- export { ServerStyleSheets } from '@material-ui/core/styles';
6
+ import React__default, { createElement, forwardRef, useState, useRef, useEffect } from 'react';
10
7
  import MuiAvatar from '@material-ui/core/Avatar';
8
+ import { makeStyles as makeStyles$1, useTheme } from '@material-ui/core/styles';
9
+ export { ServerStyleSheets } from '@material-ui/core/styles';
11
10
  export { default as Badge } from '@material-ui/core/Badge';
12
11
  import MuiButton from '@material-ui/core/Button';
13
12
  import CircularProgress from '@material-ui/core/CircularProgress';
@@ -31,6 +30,7 @@ export { default as DialogTitle } from '@material-ui/core/DialogTitle';
31
30
  export { default as Drawer } from '@material-ui/core/Drawer';
32
31
  export { default as FormControl } from '@material-ui/core/FormControl';
33
32
  export { default as Grid } from '@material-ui/core/Grid';
33
+ import MuiIconButton from '@material-ui/core/IconButton';
34
34
  export { default as InputAdornment } from '@material-ui/core/InputAdornment';
35
35
  export { default as LinearProgress } from '@material-ui/core/LinearProgress';
36
36
  export { default as List } from '@material-ui/core/List';
@@ -143,113 +143,41 @@ function SvgUser(props) {
143
143
  })));
144
144
  }
145
145
 
146
- var _path$1l;
147
-
148
- 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); }
149
-
150
- function SvgPause(props) {
151
- return /*#__PURE__*/React.createElement("svg", _extends$1p({
152
- viewBox: "0 0 16 16",
153
- strokeLinecap: "round",
154
- strokeLinejoin: "round",
155
- stroke: "currentColor",
156
- width: "1em",
157
- height: "1em",
158
- fill: "none"
159
- }, props), _path$1l || (_path$1l = /*#__PURE__*/React.createElement("path", {
160
- d: "M6.667 2.667H4v10.666h2.667V2.666zm5.333 0H9.333v10.666H12V2.666z"
161
- })));
162
- }
163
-
164
- var _path$1j;
165
-
166
- 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); }
167
-
168
- function SvgPlay(props) {
169
- return /*#__PURE__*/React.createElement("svg", _extends$1n({
170
- viewBox: "0 0 16 16",
171
- strokeLinecap: "round",
172
- strokeLinejoin: "round",
173
- stroke: "currentColor",
174
- width: "1em",
175
- height: "1em",
176
- fill: "none"
177
- }, props), _path$1j || (_path$1j = /*#__PURE__*/React.createElement("path", {
178
- d: "M3.333 2l9.334 6-9.334 6V2z"
179
- })));
180
- }
181
-
182
- var _path$16;
183
-
184
- 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); }
185
-
186
- function SvgVolumeDown(props) {
187
- return /*#__PURE__*/React.createElement("svg", _extends$1a({
188
- viewBox: "0 0 16 16",
189
- strokeLinecap: "round",
190
- strokeLinejoin: "round",
191
- stroke: "currentColor",
192
- width: "1em",
193
- height: "1em",
194
- fill: "none"
195
- }, props), _path$16 || (_path$16 = /*#__PURE__*/React.createElement("path", {
196
- d: "M8.999 3.333L5.665 6H3v4h2.666L9 12.667V3.333zm3.026 2.307a3.333 3.333 0 010 4.714"
197
- })));
198
- }
199
-
200
- var _path$15;
201
-
202
- 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); }
203
-
204
- function SvgVolumeMute(props) {
205
- return /*#__PURE__*/React.createElement("svg", _extends$19({
206
- viewBox: "0 0 16 16",
207
- strokeLinecap: "round",
208
- strokeLinejoin: "round",
209
- stroke: "currentColor",
210
- width: "1em",
211
- height: "1em",
212
- fill: "none"
213
- }, props), _path$15 || (_path$15 = /*#__PURE__*/React.createElement("path", {
214
- d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333z"
215
- })));
216
- }
217
-
218
- var _path$14;
219
-
220
- function _extends$18() { _extends$18 = 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$18.apply(this, arguments); }
221
-
222
- function SvgVolumeOff(props) {
223
- return /*#__PURE__*/React.createElement("svg", _extends$18({
224
- viewBox: "0 0 16 16",
225
- strokeLinecap: "round",
226
- strokeLinejoin: "round",
227
- stroke: "currentColor",
228
- width: "1em",
229
- height: "1em",
230
- fill: "none"
231
- }, props), _path$14 || (_path$14 = /*#__PURE__*/React.createElement("path", {
232
- d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333zm8 2.667l-4 4m0-4l4 4"
233
- })));
234
- }
235
-
236
- var _path$13;
237
-
238
- function _extends$17() { _extends$17 = 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$17.apply(this, arguments); }
239
-
240
- function SvgVolumeUp(props) {
241
- return /*#__PURE__*/React.createElement("svg", _extends$17({
242
- viewBox: "0 0 16 16",
243
- strokeLinecap: "round",
244
- strokeLinejoin: "round",
245
- stroke: "currentColor",
246
- width: "1em",
247
- height: "1em",
248
- fill: "none"
249
- }, props), _path$13 || (_path$13 = /*#__PURE__*/React.createElement("path", {
250
- 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"
251
- })));
252
- }
146
+ var useIconStyles = makeStyles(function (_a) {
147
+ var spacing = _a.spacing, palette = _a.palette;
148
+ var getFontSize = function (_a) {
149
+ var size = _a.size;
150
+ var sizes = {
151
+ inherit: 'inherit',
152
+ small: spacing(1.5),
153
+ medium: spacing(2),
154
+ large: spacing(2.5),
155
+ 'extra-large': spacing(3),
156
+ };
157
+ return size ? sizes[size] : 'inherit';
158
+ };
159
+ var getColor = function (props) {
160
+ var semanticColors = ['primary', 'secondary', 'info', 'success', 'warning', 'error'];
161
+ var value = 'inherit';
162
+ if (props.color) {
163
+ if (semanticColors.includes(props.color.split('.')[0])) {
164
+ var _a = props.color.split('.'), color = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
165
+ value = palette[color][variant];
166
+ }
167
+ else if (props.color.search(/^(rgb|hsla|#)/) !== -1) {
168
+ value = props.color;
169
+ }
170
+ }
171
+ return value;
172
+ };
173
+ return {
174
+ root: {
175
+ color: getColor,
176
+ fontSize: getFontSize,
177
+ strokeWidth: '1.3px',
178
+ },
179
+ };
180
+ });
253
181
 
254
182
  var classnames = {exports: {}};
255
183
 
@@ -311,42 +239,6 @@ var classnames = {exports: {}};
311
239
 
312
240
  var classNames = classnames.exports;
313
241
 
314
- var useIconStyles = makeStyles(function (_a) {
315
- var spacing = _a.spacing, palette = _a.palette;
316
- var getFontSize = function (_a) {
317
- var size = _a.size;
318
- var sizes = {
319
- inherit: 'inherit',
320
- small: spacing(1.5),
321
- medium: spacing(2),
322
- large: spacing(2.5),
323
- 'extra-large': spacing(3),
324
- };
325
- return size ? sizes[size] : 'inherit';
326
- };
327
- var getColor = function (props) {
328
- var semanticColors = ['primary', 'secondary', 'info', 'success', 'warning', 'error'];
329
- var value = 'inherit';
330
- if (props.color) {
331
- if (semanticColors.includes(props.color.split('.')[0])) {
332
- var _a = props.color.split('.'), color = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
333
- value = palette[color][variant];
334
- }
335
- else if (props.color.search(/^(rgb|hsla|#)/) !== -1) {
336
- value = props.color;
337
- }
338
- }
339
- return value;
340
- };
341
- return {
342
- root: {
343
- color: getColor,
344
- fontSize: getFontSize,
345
- strokeWidth: '1.3px',
346
- },
347
- };
348
- });
349
-
350
242
  var iconStaticClassName = 'pop-icon';
351
243
  var Icon = function (props) {
352
244
  var icon = props.icon, className = props.className, restProps = __rest(props, ["icon", "className"]);
@@ -365,295 +257,6 @@ Icon.defaultProps = {
365
257
  };
366
258
  Icon.displayName = 'Icon';
367
259
 
368
- var IconButton = forwardRef(function (props, ref) {
369
- return React__default.createElement(MuiIconButton, __assign({ ref: ref }, props));
370
- });
371
- IconButton.displayName = 'IconButton';
372
- IconButton.defaultProps = {
373
- color: 'secondary',
374
- };
375
-
376
- var useTypographyStyles = makeStyles$1(function () { return ({
377
- root: function (_a) {
378
- var _b;
379
- var weight = _a.weight;
380
- return (__assign((_b = {}, _b["& ." + iconStaticClassName] = {
381
- position: 'relative',
382
- top: '0.125em',
383
- padding: '0 0.125em',
384
- boxSizing: 'content-box',
385
- }, _b), (weight && { fontWeight: (weight === 'semi-bold' && 600) || (weight === 'bold' && 700) || 400 })));
386
- },
387
- caption: {
388
- display: 'inline',
389
- },
390
- overline: {
391
- display: 'inline',
392
- },
393
- }); });
394
-
395
- var Typography = forwardRef(function (props, ref) {
396
- props.weight; var restProps = __rest(props, ["weight"]);
397
- var classes = useTypographyStyles(props);
398
- return React__default.createElement(Typography$1, __assign({ ref: ref, classes: classes }, restProps));
399
- });
400
- Typography.displayName = 'Typography';
401
-
402
- var useStyles$1 = makeStyles(function (_a) {
403
- var spacing = _a.spacing;
404
- return ({
405
- root: {
406
- '&:last-child': {
407
- marginBottom: 0,
408
- },
409
- marginBottom: spacing(4),
410
- padding: spacing(4),
411
- },
412
- });
413
- });
414
- var Paper = forwardRef(function (props, ref) {
415
- var legacyStyles = props.legacyStyles, restProps = __rest(props, ["legacyStyles"]);
416
- var classes = useStyles$1(props);
417
- return React__default.createElement(Paper$1, __assign({}, ref, { classes: __assign({}, (legacyStyles && classes)) }, restProps));
418
- });
419
- Paper.displayName = 'Paper';
420
- Paper.defaultProps = {
421
- legacyStyles: false,
422
- };
423
-
424
- var AUDIO_PLAYER_EVENT_TYPES;
425
- (function (AUDIO_PLAYER_EVENT_TYPES) {
426
- AUDIO_PLAYER_EVENT_TYPES["TOGGLE_PLAYBACK"] = "TOGGLE_PLAYBACK";
427
- AUDIO_PLAYER_EVENT_TYPES["TOGGLE_VOLUME_CONTROL"] = "TOGGLE_VOLUME_CONTROL";
428
- AUDIO_PLAYER_EVENT_TYPES["TOGGLE_MUTE"] = "TOGGLE_MUTE";
429
- AUDIO_PLAYER_EVENT_TYPES["VOLUME_CHANGE"] = "VOLUME_CHANGE";
430
- AUDIO_PLAYER_EVENT_TYPES["TIME_CHANGE"] = "TIME_CHANGE";
431
- AUDIO_PLAYER_EVENT_TYPES["DURATION_CHANGE"] = "DURATION_CHANGE";
432
- AUDIO_PLAYER_EVENT_TYPES["SET_TIME"] = "SET_TIME";
433
- AUDIO_PLAYER_EVENT_TYPES["CAN_PLAY"] = "CAN_PLAY";
434
- AUDIO_PLAYER_EVENT_TYPES["RESET"] = "RESET";
435
- })(AUDIO_PLAYER_EVENT_TYPES || (AUDIO_PLAYER_EVENT_TYPES = {}));
436
- var PLAYBACK_STATES;
437
- (function (PLAYBACK_STATES) {
438
- PLAYBACK_STATES["NONE"] = "NONE";
439
- PLAYBACK_STATES["PAUSED"] = "PAUSED";
440
- PLAYBACK_STATES["PLAYING"] = "PLAYING";
441
- })(PLAYBACK_STATES || (PLAYBACK_STATES = {}));
442
- var CONTROL_LABELS;
443
- (function (CONTROL_LABELS) {
444
- CONTROL_LABELS["PAUSE"] = "PAUSE";
445
- CONTROL_LABELS["PLAY"] = "PLAY";
446
- CONTROL_LABELS["MUTE"] = "MUTE";
447
- CONTROL_LABELS["UNMUTE"] = "UNMUTE";
448
- })(CONTROL_LABELS || (CONTROL_LABELS = {}));
449
- var VOLUME_CONTROL_STATES;
450
- (function (VOLUME_CONTROL_STATES) {
451
- VOLUME_CONTROL_STATES["SHOW"] = "SHOW";
452
- VOLUME_CONTROL_STATES["HIDE"] = "HIDE";
453
- })(VOLUME_CONTROL_STATES || (VOLUME_CONTROL_STATES = {}));
454
-
455
- var initialAudioPlayerState = {
456
- playback: PLAYBACK_STATES.NONE,
457
- volumeControls: VOLUME_CONTROL_STATES.HIDE,
458
- context: {
459
- volume: 100,
460
- playbackButtonLabel: CONTROL_LABELS.PLAY,
461
- volumeButtonLabel: CONTROL_LABELS.MUTE,
462
- },
463
- };
464
- var getPlayback = function (_a) {
465
- var audio = _a.current;
466
- var playback = PLAYBACK_STATES.NONE;
467
- if (audio) {
468
- var paused = audio.paused, readyState = audio.readyState;
469
- if (readyState === 0) {
470
- playback = PLAYBACK_STATES.NONE;
471
- }
472
- else if (paused) {
473
- playback = PLAYBACK_STATES.PAUSED;
474
- }
475
- else {
476
- playback = PLAYBACK_STATES.PLAYING;
477
- }
478
- }
479
- return playback;
480
- };
481
- var audioPlayerReducer = function (state, event) {
482
- var _a, _b;
483
- var audioRef = state.context.audioRef;
484
- var nextState = __assign({}, state);
485
- switch (state.playback) {
486
- case PLAYBACK_STATES.NONE:
487
- if (event.type === AUDIO_PLAYER_EVENT_TYPES.CAN_PLAY) {
488
- nextState.playback = getPlayback(audioRef);
489
- return nextState;
490
- }
491
- break;
492
- case PLAYBACK_STATES.PAUSED:
493
- if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_PLAYBACK) {
494
- (_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.play();
495
- nextState.playback = getPlayback(audioRef);
496
- nextState.context.playbackButtonLabel = CONTROL_LABELS.PAUSE;
497
- return nextState;
498
- }
499
- break;
500
- case PLAYBACK_STATES.PLAYING:
501
- if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_PLAYBACK) {
502
- (_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.pause();
503
- nextState.playback = getPlayback(audioRef);
504
- nextState.context.playbackButtonLabel = CONTROL_LABELS.PLAY;
505
- return nextState;
506
- }
507
- if (event.type === AUDIO_PLAYER_EVENT_TYPES.TIME_CHANGE) {
508
- return nextState;
509
- }
510
- break;
511
- }
512
- switch (state.volumeControls) {
513
- case VOLUME_CONTROL_STATES.SHOW:
514
- if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_VOLUME_CONTROL) {
515
- nextState.volumeControls = VOLUME_CONTROL_STATES.HIDE;
516
- return nextState;
517
- }
518
- if (event.type === AUDIO_PLAYER_EVENT_TYPES.VOLUME_CHANGE) {
519
- if (nextState.context.volume !== event.context.volume) {
520
- nextState.context.volume = event.context.volume;
521
- if (audioRef.current) {
522
- audioRef.current.volume = event.context.volume;
523
- }
524
- return nextState;
525
- }
526
- }
527
- break;
528
- case VOLUME_CONTROL_STATES.HIDE:
529
- if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_VOLUME_CONTROL) {
530
- nextState.volumeControls = VOLUME_CONTROL_STATES.SHOW;
531
- return nextState;
532
- }
533
- break;
534
- }
535
- switch (event.type) {
536
- case AUDIO_PLAYER_EVENT_TYPES.TOGGLE_MUTE:
537
- if (audioRef.current) {
538
- audioRef.current.muted = !audioRef.current.muted;
539
- return nextState;
540
- }
541
- break;
542
- case AUDIO_PLAYER_EVENT_TYPES.SET_TIME:
543
- if (audioRef.current) {
544
- audioRef.current.currentTime = event.context.time;
545
- return nextState;
546
- }
547
- break;
548
- case AUDIO_PLAYER_EVENT_TYPES.RESET:
549
- if (audioRef.current) {
550
- audioRef.current.currentTime = 0;
551
- nextState.playback = getPlayback(audioRef);
552
- return nextState;
553
- }
554
- break;
555
- }
556
- return state;
557
- };
558
-
559
- var useVolumeIcon = function (state) {
560
- var volumeIcon = SvgVolumeUp;
561
- if (state.context.volume >= 0.5) {
562
- volumeIcon = SvgVolumeUp;
563
- }
564
- else if (state.context.volume < 0.5 && state.context.volume > 0) {
565
- volumeIcon = SvgVolumeDown;
566
- }
567
- else if (state.context.volume === 0) {
568
- volumeIcon = SvgVolumeMute;
569
- }
570
- if (state.context.audioRef.current) {
571
- if (state.context.audioRef.current.muted) {
572
- volumeIcon = SvgVolumeOff;
573
- }
574
- }
575
- return volumeIcon;
576
- };
577
-
578
- var appendZero = function (num) { return (num < 10 ? "0" + num : num); };
579
- var formatTime = function (time, remaning) {
580
- if (remaning === void 0) { remaning = false; }
581
- var dateTime = new Date(0, 0, 0, 0, 0, time, 0);
582
- var dateTimeH = appendZero(dateTime.getHours());
583
- var dateTimeM = appendZero(dateTime.getMinutes());
584
- var dateTimeS = appendZero(dateTime.getSeconds());
585
- var minus = remaning ? '-' : '';
586
- return dateTimeH > 0 ? "" + minus + dateTimeH + ":" + dateTimeM + ":" + dateTimeS : "" + minus + dateTimeM + ":" + dateTimeS;
587
- };
588
-
589
- var setupAudioRef = function (config) { return function () {
590
- var _a, _b, _c, _d;
591
- var audioRef = config.audioRef, send = config.send;
592
- var handleDurationChange = function (event) {
593
- var duration = event.target.duration;
594
- send({ type: AUDIO_PLAYER_EVENT_TYPES.DURATION_CHANGE, context: { duration: duration } });
595
- };
596
- var handleTimeUpdate = function (event) {
597
- var currentTime = event.target.currentTime;
598
- send({ type: AUDIO_PLAYER_EVENT_TYPES.TIME_CHANGE, context: { currentTime: currentTime } });
599
- };
600
- var handleCanPlay = function () {
601
- send({ type: AUDIO_PLAYER_EVENT_TYPES.CAN_PLAY });
602
- };
603
- var handleEnded = function () {
604
- send({ type: AUDIO_PLAYER_EVENT_TYPES.RESET });
605
- };
606
- (_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('durationchange', handleDurationChange);
607
- (_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('timeupdate', handleTimeUpdate);
608
- (_c = audioRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('canplay', handleCanPlay);
609
- (_d = audioRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleEnded);
610
- return function () {
611
- var _a, _b, _c, _d;
612
- (_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('durationchange', handleDurationChange);
613
- (_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('timeupdate', handleTimeUpdate);
614
- (_c = audioRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('canplay', handleCanPlay);
615
- (_d = audioRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('ended', handleEnded);
616
- };
617
- }; };
618
-
619
- var AudioPlayer = function (props) {
620
- var _a, _b, _c, _d, _f;
621
- var src = props.src, _g = props.classes, classes = _g === void 0 ? {} : _g;
622
- var volumeRef = useRef(null);
623
- var audioRef = useRef(null);
624
- var spacing = useTheme().spacing;
625
- var _h = useState(false), disableRipple = _h[0], setDisableRipple = _h[1];
626
- var _j = useReducer(audioPlayerReducer, __assign(__assign({}, initialAudioPlayerState), { context: __assign(__assign({}, initialAudioPlayerState.context), { audioRef: audioRef }) })), state = _j[0], send = _j[1];
627
- useEffect(setupAudioRef({ audioRef: audioRef, send: send }), [audioRef]);
628
- var PlaybackIcon = state.playback !== PLAYBACK_STATES.PAUSED ? SvgPause : SvgPlay;
629
- var VolumeIcon = useMemo(function () { return useVolumeIcon(state); }, [state.context.volume, (_a = state.context.audioRef.current) === null || _a === void 0 ? void 0 : _a.muted]);
630
- var togglePlayback = function () { return send({ type: AUDIO_PLAYER_EVENT_TYPES.TOGGLE_PLAYBACK }); };
631
- var toggleVolumeControl = function () { return send({ type: AUDIO_PLAYER_EVENT_TYPES.TOGGLE_VOLUME_CONTROL }); };
632
- var toggleMute = function () { return send({ type: AUDIO_PLAYER_EVENT_TYPES.TOGGLE_MUTE }); };
633
- var setTime = function (_e, time) { return send({ type: AUDIO_PLAYER_EVENT_TYPES.SET_TIME, context: { time: time } }); };
634
- var setVolume = function (_e, volume) { return send({ type: AUDIO_PLAYER_EVENT_TYPES.VOLUME_CHANGE, context: { volume: volume } }); };
635
- return (React__default.createElement(Box, { display: "flex", alignItems: "center", gridGap: spacing(1), className: classNames([classes.root]) },
636
- React__default.createElement("audio", { ref: audioRef, src: src }),
637
- React__default.createElement(Box, null,
638
- React__default.createElement(IconButton, { classes: { root: classes.playbackToggle }, "aria-label": state.context.playbackButtonLabel, disabled: state.playback === PLAYBACK_STATES.NONE, onClick: togglePlayback },
639
- React__default.createElement(Icon, { icon: PlaybackIcon })),
640
- React__default.createElement(IconButton, { classes: { root: classes.volumeToggle }, "aria-label": state.context.volumeButtonLabel, ref: volumeRef, onClick: toggleMute, onMouseEnter: toggleVolumeControl, onMouseLeave: toggleVolumeControl, disableRipple: disableRipple },
641
- React__default.createElement(Icon, { icon: VolumeIcon }),
642
- 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([classes.volumeSlider]) }, function (_a) {
643
- var TransitionProps = _a.TransitionProps;
644
- return (React__default.createElement(Grow, __assign({}, TransitionProps),
645
- React__default.createElement(Paper, { elevation: 1 },
646
- React__default.createElement(Box, { py: 1, height: 80 },
647
- React__default.createElement(Slider, { color: "secondary", orientation: "vertical", value: state.context.volume, onChange: setVolume, max: 1, step: 0.01 })))));
648
- }))),
649
- React__default.createElement(Box, { display: "flex", flexGrow: 1, alignItems: "center", gridGap: spacing(1) },
650
- React__default.createElement(Box, { flexBasis: 60, flexShrink: 0 },
651
- React__default.createElement(Typography, { classes: { root: classes.playbackText } }, formatTime(((_b = state.context.audioRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0))),
652
- 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 }),
653
- React__default.createElement(Box, { flexBasis: 60, flexShrink: 0, textAlign: "end" },
654
- React__default.createElement(Typography, { classes: { root: classes.lengthText } }, formatTime(((_f = state.context.audioRef.current) === null || _f === void 0 ? void 0 : _f.duration) || 0))))));
655
- };
656
-
657
260
  var LoadingStatus;
658
261
  (function (LoadingStatus) {
659
262
  LoadingStatus["ERROR"] = "ERROR";
@@ -751,7 +354,7 @@ var Button = forwardRef(function (props, ref) {
751
354
  props.textTransform; var loading = props.loading, classesOverride = props.classes, className = props.className, muiProps = __rest(props, ["textTransform", "loading", "classes", "className"]);
752
355
  props.classes; var styleProps = __rest(props, ["classes"]);
753
356
  var classes = useButtonStyles(styleProps);
754
- var typography = useTheme$1().typography;
357
+ var typography = useTheme().typography;
755
358
  var loadingIndicator = {
756
359
  startIcon: React__default.createElement(CircularProgress, { color: "inherit", size: typography.button.fontSize }),
757
360
  disabled: true,
@@ -767,6 +370,32 @@ var Checkbox = forwardRef(function (props, ref) {
767
370
  });
768
371
  Checkbox.displayName = 'Checkbox';
769
372
 
373
+ var useTypographyStyles = makeStyles$1(function () { return ({
374
+ root: function (_a) {
375
+ var _b;
376
+ var weight = _a.weight;
377
+ return (__assign((_b = {}, _b["& ." + iconStaticClassName] = {
378
+ position: 'relative',
379
+ top: '0.125em',
380
+ padding: '0 0.125em',
381
+ boxSizing: 'content-box',
382
+ }, _b), (weight && { fontWeight: (weight === 'semi-bold' && 600) || (weight === 'bold' && 700) || 400 })));
383
+ },
384
+ caption: {
385
+ display: 'inline',
386
+ },
387
+ overline: {
388
+ display: 'inline',
389
+ },
390
+ }); });
391
+
392
+ var Typography = forwardRef(function (props, ref) {
393
+ props.weight; var restProps = __rest(props, ["weight"]);
394
+ var classes = useTypographyStyles(props);
395
+ return React__default.createElement(Typography$1, __assign({ ref: ref, classes: classes }, restProps));
396
+ });
397
+ Typography.displayName = 'Typography';
398
+
770
399
  var getFadeStop = function (_a, typographyVariant) {
771
400
  var typography = _a.typography;
772
401
  return !isNaN(Number(typography[typographyVariant].lineHeight))
@@ -789,7 +418,7 @@ var CollapsibleText = function (props) {
789
418
  var collapseState = useState(false);
790
419
  var typographyRef = useRef(null);
791
420
  var classes = useCollapsibleTextStyles(__assign(__assign({}, props), { previewLines: previewLines, typographyVariant: typographyVariant }));
792
- var theme = useTheme();
421
+ var theme = useTheme$1();
793
422
  var _c = props.collapseState ? props.collapseState : collapseState, collapsible = _c[0], setCollapsible = _c[1];
794
423
  var typographyEntryLineHeightRem = parseFloat(theme.typography[typographyVariant].lineHeight);
795
424
  var collapsedSizeRem = previewLines * typographyEntryLineHeightRem;
@@ -825,7 +454,7 @@ var SemanticColors;
825
454
  SemanticColors["SECONDARY_DARK"] = "secondary.dark";
826
455
  SemanticColors["SECONDARY_LIGHT"] = "secondary.light";
827
456
  })(SemanticColors || (SemanticColors = {}));
828
- var useStyles = makeStyles(function (theme) { return ({
457
+ var useStyles$1 = makeStyles(function (theme) { return ({
829
458
  dividerRoot: {
830
459
  gap: theme.spacing(2),
831
460
  },
@@ -863,7 +492,7 @@ var useStyles = makeStyles(function (theme) { return ({
863
492
  }); });
864
493
  var Divider = function (props) {
865
494
  var className = props.className, text = props.text, textTransform = props.textTransform, TypographyProps = props.TypographyProps;
866
- var classes = useStyles(props);
495
+ var classes = useStyles$1(props);
867
496
  var casingOffset = textTransform === 'lowercase' ? '.25rem' : 'unset';
868
497
  return (React__default.createElement(Box, { className: classNames([classes.dividerRoot, className]), display: "flex", alignItems: "center" },
869
498
  React__default.createElement(Box, { className: classes.dividerLine, display: "flex", flexGrow: 1, height: "1px", marginTop: casingOffset }),
@@ -876,6 +505,14 @@ Divider.defaultProps = {
876
505
  textTransform: 'lowercase',
877
506
  };
878
507
 
508
+ var IconButton = forwardRef(function (props, ref) {
509
+ return React__default.createElement(MuiIconButton, __assign({ ref: ref }, props));
510
+ });
511
+ IconButton.displayName = 'IconButton';
512
+ IconButton.defaultProps = {
513
+ color: 'secondary',
514
+ };
515
+
879
516
  var useLinkStyles = makeStyles$1(function (theme) { return ({
880
517
  root: function (props) {
881
518
  var _a;
@@ -895,6 +532,28 @@ Link.defaultProps = {
895
532
  };
896
533
  Link.displayName = 'Link';
897
534
 
535
+ var useStyles = makeStyles(function (_a) {
536
+ var spacing = _a.spacing;
537
+ return ({
538
+ root: {
539
+ '&:last-child': {
540
+ marginBottom: 0,
541
+ },
542
+ marginBottom: spacing(4),
543
+ padding: spacing(4),
544
+ },
545
+ });
546
+ });
547
+ var Paper = forwardRef(function (props, ref) {
548
+ var legacyStyles = props.legacyStyles, restProps = __rest(props, ["legacyStyles"]);
549
+ var classes = useStyles(props);
550
+ return React__default.createElement(Paper$1, __assign({}, ref, { classes: __assign({}, (legacyStyles && classes)) }, restProps));
551
+ });
552
+ Paper.displayName = 'Paper';
553
+ Paper.defaultProps = {
554
+ legacyStyles: false,
555
+ };
556
+
898
557
  var PaperContent = function (props) {
899
558
  var children = props.children;
900
559
  return React__default.createElement(Box, { padding: 4 }, children);
@@ -1117,5 +776,5 @@ var useTabs = function (options) {
1117
776
  };
1118
777
  };
1119
778
 
1120
- export { AudioPlayer, Avatar, Button, Checkbox, CollapsibleText, Divider, Icon, IconButton, Link, NumberField, Paper, PaperContent, Radio, SplitInput, Switch, TabPanel, ToggleButton, ToggleButtonGroup, Tooltip, Typography, useCollapsibleText, useTabs };
779
+ export { Avatar, Button, Checkbox, CollapsibleText, Divider, Icon, IconButton, Link, NumberField, Paper, PaperContent, Radio, SplitInput, Switch, TabPanel, ToggleButton, ToggleButtonGroup, Tooltip, Typography, useCollapsibleText, useTabs };
1121
780
  //# sourceMappingURL=index.es.js.map