@popmenu/common-ui 0.17.0 → 0.18.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.
@@ -1,5 +1,4 @@
1
1
  export { audioPlayerReducer, initialAudioPlayerState } from './audioPlayerReducer';
2
- export { usePlaybackIcon } from './usePlaybackIcon';
3
2
  export { useVolumeIcon } from './useVolumeIcon';
4
3
  export { formatTime } from './formatTime';
5
4
  export { setupAudioRef } from './setupAudioRef';
@@ -4,5 +4,5 @@ interface Config {
4
4
  audioRef: RefObject<HTMLAudioElement>;
5
5
  send: (event: AudioPlayerEvent) => void;
6
6
  }
7
- export declare const setupAudioRef: (config: Config) => () => () => void;
7
+ export declare const setupAudioRef: (config: Config) => () => (() => void);
8
8
  export {};
@@ -7,7 +7,8 @@ export declare enum AUDIO_PLAYER_EVENT_TYPES {
7
7
  TIME_CHANGE = "TIME_CHANGE",
8
8
  DURATION_CHANGE = "DURATION_CHANGE",
9
9
  SET_TIME = "SET_TIME",
10
- CAN_PLAY = "CAN_PLAY"
10
+ CAN_PLAY = "CAN_PLAY",
11
+ RESET = "RESET"
11
12
  }
12
13
  interface SetVolumeEvent {
13
14
  type: AUDIO_PLAYER_EVENT_TYPES.VOLUME_CHANGE;
@@ -43,10 +44,12 @@ interface SetTimeEvent {
43
44
  interface CanPlayEvent {
44
45
  type: AUDIO_PLAYER_EVENT_TYPES.CAN_PLAY;
45
46
  }
46
- export declare type AudioPlayerEvent = TogglePlaybackEvent | ToggleVolumeControlEvent | SetVolumeEvent | TimeChangeEvent | DurationChangeEvent | ToggleMuteEvent | SetTimeEvent | CanPlayEvent;
47
+ interface ResetEvent {
48
+ type: AUDIO_PLAYER_EVENT_TYPES.RESET;
49
+ }
50
+ export declare type AudioPlayerEvent = TogglePlaybackEvent | ToggleVolumeControlEvent | SetVolumeEvent | TimeChangeEvent | DurationChangeEvent | ToggleMuteEvent | SetTimeEvent | CanPlayEvent | ResetEvent;
47
51
  export declare enum PLAYBACK_STATES {
48
52
  NONE = "NONE",
49
- PLAYABLE = "PLAYABLE",
50
53
  PAUSED = "PAUSED",
51
54
  PLAYING = "PLAYING"
52
55
  }
@@ -13,6 +13,8 @@ export interface TableProps {
13
13
  label: string;
14
14
  action: (cell: Cell) => void;
15
15
  }>;
16
+ /** Styles the table to not shrink below the height of a full page. */
17
+ enableMinHeight?: boolean;
16
18
  /** Styles the table to take up its containers full width. */
17
19
  fullWidth?: boolean;
18
20
  /** Enables sortability for columns. */
package/build/index.es.js CHANGED
@@ -3,7 +3,7 @@ import { makeStyles, Box as Box$1, Paper as Paper$1, Popper, Grow, Slider, useTh
3
3
  export { Accordion, AccordionActions, AccordionDetails, AccordionSummary, 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, Fragment, useMemo } from 'react';
6
+ import React__default, { createElement, forwardRef, useRef, useState, useReducer, useEffect, useMemo, Fragment } from 'react';
7
7
  import MuiIconButton from '@material-ui/core/IconButton';
8
8
  import MuiTypography from '@material-ui/core/Typography';
9
9
  import { makeStyles as makeStyles$1, useTheme } from '@material-ui/core/styles';
@@ -104,6 +104,168 @@ function __spreadArray(to, from, pack) {
104
104
  return to.concat(ar || from);
105
105
  }
106
106
 
107
+ var _path$3K;
108
+
109
+ function _extends$3$() { _extends$3$ = 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$3$.apply(this, arguments); }
110
+
111
+ function SvgMore(props) {
112
+ return /*#__PURE__*/React.createElement("svg", _extends$3$({
113
+ viewBox: "0 0 16 16",
114
+ strokeLinecap: "round",
115
+ strokeLinejoin: "round",
116
+ stroke: "currentColor",
117
+ width: "1em",
118
+ height: "1em",
119
+ fill: "none"
120
+ }, props), _path$3K || (_path$3K = /*#__PURE__*/React.createElement("path", {
121
+ d: "M8 8.667a.667.667 0 100-1.334.667.667 0 000 1.334zM8 4a.667.667 0 100-1.333A.667.667 0 008 4zm0 9.333A.667.667 0 108 12a.667.667 0 000 1.333z"
122
+ })));
123
+ }
124
+
125
+ var _path$2X;
126
+
127
+ function _extends$3b() { _extends$3b = 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$3b.apply(this, arguments); }
128
+
129
+ function SvgChevronDown(props) {
130
+ return /*#__PURE__*/React.createElement("svg", _extends$3b({
131
+ viewBox: "0 0 16 16",
132
+ strokeLinecap: "round",
133
+ strokeLinejoin: "round",
134
+ stroke: "currentColor",
135
+ width: "1em",
136
+ height: "1em",
137
+ fill: "none"
138
+ }, props), _path$2X || (_path$2X = /*#__PURE__*/React.createElement("path", {
139
+ d: "M4 6l4 4 4-4"
140
+ })));
141
+ }
142
+
143
+ var _path$2W;
144
+
145
+ function _extends$3a() { _extends$3a = 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$3a.apply(this, arguments); }
146
+
147
+ function SvgChevronUp(props) {
148
+ return /*#__PURE__*/React.createElement("svg", _extends$3a({
149
+ viewBox: "0 0 16 16",
150
+ strokeLinecap: "round",
151
+ strokeLinejoin: "round",
152
+ stroke: "currentColor",
153
+ width: "1em",
154
+ height: "1em",
155
+ fill: "none"
156
+ }, props), _path$2W || (_path$2W = /*#__PURE__*/React.createElement("path", {
157
+ d: "M12 10L8 6l-4 4"
158
+ })));
159
+ }
160
+
161
+ var _path$1f;
162
+
163
+ 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); }
164
+
165
+ function SvgPause(props) {
166
+ return /*#__PURE__*/React.createElement("svg", _extends$1p({
167
+ viewBox: "0 0 16 16",
168
+ strokeLinecap: "round",
169
+ strokeLinejoin: "round",
170
+ stroke: "currentColor",
171
+ width: "1em",
172
+ height: "1em",
173
+ fill: "none"
174
+ }, props), _path$1f || (_path$1f = /*#__PURE__*/React.createElement("path", {
175
+ d: "M6.667 2.667H4v10.666h2.667V2.667zm5.333 0H9.333v10.666H12V2.667z"
176
+ })));
177
+ }
178
+
179
+ var _path$1d;
180
+
181
+ 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); }
182
+
183
+ function SvgPlay(props) {
184
+ return /*#__PURE__*/React.createElement("svg", _extends$1n({
185
+ viewBox: "0 0 16 16",
186
+ strokeLinecap: "round",
187
+ strokeLinejoin: "round",
188
+ stroke: "currentColor",
189
+ width: "1em",
190
+ height: "1em",
191
+ fill: "none"
192
+ }, props), _path$1d || (_path$1d = /*#__PURE__*/React.createElement("path", {
193
+ d: "M3.333 2l9.334 6-9.334 6V2z"
194
+ })));
195
+ }
196
+
197
+ var _path$10;
198
+
199
+ 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); }
200
+
201
+ function SvgVolumeDown(props) {
202
+ return /*#__PURE__*/React.createElement("svg", _extends$1a({
203
+ viewBox: "0 0 16 16",
204
+ strokeLinecap: "round",
205
+ strokeLinejoin: "round",
206
+ stroke: "currentColor",
207
+ width: "1em",
208
+ height: "1em",
209
+ fill: "none"
210
+ }, props), _path$10 || (_path$10 = /*#__PURE__*/React.createElement("path", {
211
+ d: "M8.999 3.333L5.665 6H3v4h2.666L9 12.667V3.333zm3.026 2.307a3.333 3.333 0 010 4.713"
212
+ })));
213
+ }
214
+
215
+ var _path$$;
216
+
217
+ 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); }
218
+
219
+ function SvgVolumeMute(props) {
220
+ return /*#__PURE__*/React.createElement("svg", _extends$19({
221
+ viewBox: "0 0 16 16",
222
+ strokeLinecap: "round",
223
+ strokeLinejoin: "round",
224
+ stroke: "currentColor",
225
+ width: "1em",
226
+ height: "1em",
227
+ fill: "none"
228
+ }, props), _path$$ || (_path$$ = /*#__PURE__*/React.createElement("path", {
229
+ d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333z"
230
+ })));
231
+ }
232
+
233
+ var _path$_;
234
+
235
+ 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); }
236
+
237
+ function SvgVolumeOff(props) {
238
+ return /*#__PURE__*/React.createElement("svg", _extends$18({
239
+ viewBox: "0 0 16 16",
240
+ strokeLinecap: "round",
241
+ strokeLinejoin: "round",
242
+ stroke: "currentColor",
243
+ width: "1em",
244
+ height: "1em",
245
+ fill: "none"
246
+ }, props), _path$_ || (_path$_ = /*#__PURE__*/React.createElement("path", {
247
+ d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333zm8 2.667l-4 4m0-4l4 4"
248
+ })));
249
+ }
250
+
251
+ var _path$Z;
252
+
253
+ 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); }
254
+
255
+ function SvgVolumeUp(props) {
256
+ return /*#__PURE__*/React.createElement("svg", _extends$17({
257
+ viewBox: "0 0 16 16",
258
+ strokeLinecap: "round",
259
+ strokeLinejoin: "round",
260
+ stroke: "currentColor",
261
+ width: "1em",
262
+ height: "1em",
263
+ fill: "none"
264
+ }, props), _path$Z || (_path$Z = /*#__PURE__*/React.createElement("path", {
265
+ 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"
266
+ })));
267
+ }
268
+
107
269
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
108
270
 
109
271
  var classnames = {exports: {}};
@@ -1517,11 +1679,11 @@ var AUDIO_PLAYER_EVENT_TYPES;
1517
1679
  AUDIO_PLAYER_EVENT_TYPES["DURATION_CHANGE"] = "DURATION_CHANGE";
1518
1680
  AUDIO_PLAYER_EVENT_TYPES["SET_TIME"] = "SET_TIME";
1519
1681
  AUDIO_PLAYER_EVENT_TYPES["CAN_PLAY"] = "CAN_PLAY";
1682
+ AUDIO_PLAYER_EVENT_TYPES["RESET"] = "RESET";
1520
1683
  })(AUDIO_PLAYER_EVENT_TYPES || (AUDIO_PLAYER_EVENT_TYPES = {}));
1521
1684
  var PLAYBACK_STATES;
1522
1685
  (function (PLAYBACK_STATES) {
1523
1686
  PLAYBACK_STATES["NONE"] = "NONE";
1524
- PLAYBACK_STATES["PLAYABLE"] = "PLAYABLE";
1525
1687
  PLAYBACK_STATES["PAUSED"] = "PAUSED";
1526
1688
  PLAYBACK_STATES["PLAYING"] = "PLAYING";
1527
1689
  })(PLAYBACK_STATES || (PLAYBACK_STATES = {}));
@@ -1547,22 +1709,38 @@ var initialAudioPlayerState = {
1547
1709
  volumeButtonLabel: CONTROL_LABELS.MUTE,
1548
1710
  },
1549
1711
  };
1712
+ var getPlayback = function (_a) {
1713
+ var audio = _a.current;
1714
+ var playback = PLAYBACK_STATES.NONE;
1715
+ if (audio) {
1716
+ var paused = audio.paused, readyState = audio.readyState;
1717
+ if (readyState === 0) {
1718
+ playback = PLAYBACK_STATES.NONE;
1719
+ }
1720
+ else if (paused) {
1721
+ playback = PLAYBACK_STATES.PAUSED;
1722
+ }
1723
+ else {
1724
+ playback = PLAYBACK_STATES.PLAYING;
1725
+ }
1726
+ }
1727
+ return playback;
1728
+ };
1550
1729
  var audioPlayerReducer = function (state, event) {
1551
1730
  var _a, _b;
1552
- console.log(event.type);
1553
1731
  var audioRef = state.context.audioRef;
1554
1732
  var nextState = __assign({}, state);
1555
1733
  switch (state.playback) {
1556
1734
  case PLAYBACK_STATES.NONE:
1557
1735
  if (event.type === AUDIO_PLAYER_EVENT_TYPES.CAN_PLAY) {
1558
- nextState.playback = PLAYBACK_STATES.PAUSED;
1736
+ nextState.playback = getPlayback(audioRef);
1559
1737
  return nextState;
1560
1738
  }
1561
1739
  break;
1562
1740
  case PLAYBACK_STATES.PAUSED:
1563
1741
  if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_PLAYBACK) {
1564
1742
  (_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.play();
1565
- nextState.playback = PLAYBACK_STATES.PLAYING;
1743
+ nextState.playback = getPlayback(audioRef);
1566
1744
  nextState.context.playbackButtonLabel = CONTROL_LABELS.PAUSE;
1567
1745
  return nextState;
1568
1746
  }
@@ -1570,12 +1748,11 @@ var audioPlayerReducer = function (state, event) {
1570
1748
  case PLAYBACK_STATES.PLAYING:
1571
1749
  if (event.type === AUDIO_PLAYER_EVENT_TYPES.TOGGLE_PLAYBACK) {
1572
1750
  (_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.pause();
1573
- nextState.playback = PLAYBACK_STATES.PAUSED;
1751
+ nextState.playback = getPlayback(audioRef);
1574
1752
  nextState.context.playbackButtonLabel = CONTROL_LABELS.PLAY;
1575
1753
  return nextState;
1576
1754
  }
1577
1755
  if (event.type === AUDIO_PLAYER_EVENT_TYPES.TIME_CHANGE) {
1578
- // time change is managed by audioRef automatically, return state to force re-render so ui stays synced
1579
1756
  return nextState;
1580
1757
  }
1581
1758
  break;
@@ -1616,183 +1793,17 @@ var audioPlayerReducer = function (state, event) {
1616
1793
  return nextState;
1617
1794
  }
1618
1795
  break;
1796
+ case AUDIO_PLAYER_EVENT_TYPES.RESET:
1797
+ if (audioRef.current) {
1798
+ audioRef.current.currentTime = 0;
1799
+ nextState.playback = getPlayback(audioRef);
1800
+ return nextState;
1801
+ }
1802
+ break;
1619
1803
  }
1620
1804
  return state;
1621
1805
  };
1622
1806
 
1623
- var _path$3K;
1624
-
1625
- function _extends$3$() { _extends$3$ = 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$3$.apply(this, arguments); }
1626
-
1627
- function SvgMore(props) {
1628
- return /*#__PURE__*/React.createElement("svg", _extends$3$({
1629
- viewBox: "0 0 16 16",
1630
- strokeLinecap: "round",
1631
- strokeLinejoin: "round",
1632
- stroke: "currentColor",
1633
- width: "1em",
1634
- height: "1em",
1635
- fill: "none"
1636
- }, props), _path$3K || (_path$3K = /*#__PURE__*/React.createElement("path", {
1637
- d: "M8 8.667a.667.667 0 100-1.334.667.667 0 000 1.334zM8 4a.667.667 0 100-1.333A.667.667 0 008 4zm0 9.333A.667.667 0 108 12a.667.667 0 000 1.333z"
1638
- })));
1639
- }
1640
-
1641
- var _path$2X;
1642
-
1643
- function _extends$3b() { _extends$3b = 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$3b.apply(this, arguments); }
1644
-
1645
- function SvgChevronDown(props) {
1646
- return /*#__PURE__*/React.createElement("svg", _extends$3b({
1647
- viewBox: "0 0 16 16",
1648
- strokeLinecap: "round",
1649
- strokeLinejoin: "round",
1650
- stroke: "currentColor",
1651
- width: "1em",
1652
- height: "1em",
1653
- fill: "none"
1654
- }, props), _path$2X || (_path$2X = /*#__PURE__*/React.createElement("path", {
1655
- d: "M4 6l4 4 4-4"
1656
- })));
1657
- }
1658
-
1659
- var _path$2W;
1660
-
1661
- function _extends$3a() { _extends$3a = 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$3a.apply(this, arguments); }
1662
-
1663
- function SvgChevronUp(props) {
1664
- return /*#__PURE__*/React.createElement("svg", _extends$3a({
1665
- viewBox: "0 0 16 16",
1666
- strokeLinecap: "round",
1667
- strokeLinejoin: "round",
1668
- stroke: "currentColor",
1669
- width: "1em",
1670
- height: "1em",
1671
- fill: "none"
1672
- }, props), _path$2W || (_path$2W = /*#__PURE__*/React.createElement("path", {
1673
- d: "M12 10L8 6l-4 4"
1674
- })));
1675
- }
1676
-
1677
- var _path$1f;
1678
-
1679
- 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); }
1680
-
1681
- function SvgPause(props) {
1682
- return /*#__PURE__*/React.createElement("svg", _extends$1p({
1683
- viewBox: "0 0 16 16",
1684
- strokeLinecap: "round",
1685
- strokeLinejoin: "round",
1686
- stroke: "currentColor",
1687
- width: "1em",
1688
- height: "1em",
1689
- fill: "none"
1690
- }, props), _path$1f || (_path$1f = /*#__PURE__*/React.createElement("path", {
1691
- d: "M6.667 2.667H4v10.666h2.667V2.667zm5.333 0H9.333v10.666H12V2.667z"
1692
- })));
1693
- }
1694
-
1695
- var _path$1d;
1696
-
1697
- 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); }
1698
-
1699
- function SvgPlay(props) {
1700
- return /*#__PURE__*/React.createElement("svg", _extends$1n({
1701
- viewBox: "0 0 16 16",
1702
- strokeLinecap: "round",
1703
- strokeLinejoin: "round",
1704
- stroke: "currentColor",
1705
- width: "1em",
1706
- height: "1em",
1707
- fill: "none"
1708
- }, props), _path$1d || (_path$1d = /*#__PURE__*/React.createElement("path", {
1709
- d: "M3.333 2l9.334 6-9.334 6V2z"
1710
- })));
1711
- }
1712
-
1713
- var _path$10;
1714
-
1715
- 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); }
1716
-
1717
- function SvgVolumeDown(props) {
1718
- return /*#__PURE__*/React.createElement("svg", _extends$1a({
1719
- viewBox: "0 0 16 16",
1720
- strokeLinecap: "round",
1721
- strokeLinejoin: "round",
1722
- stroke: "currentColor",
1723
- width: "1em",
1724
- height: "1em",
1725
- fill: "none"
1726
- }, props), _path$10 || (_path$10 = /*#__PURE__*/React.createElement("path", {
1727
- d: "M8.999 3.333L5.665 6H3v4h2.666L9 12.667V3.333zm3.026 2.307a3.333 3.333 0 010 4.713"
1728
- })));
1729
- }
1730
-
1731
- var _path$$;
1732
-
1733
- 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); }
1734
-
1735
- function SvgVolumeMute(props) {
1736
- return /*#__PURE__*/React.createElement("svg", _extends$19({
1737
- viewBox: "0 0 16 16",
1738
- strokeLinecap: "round",
1739
- strokeLinejoin: "round",
1740
- stroke: "currentColor",
1741
- width: "1em",
1742
- height: "1em",
1743
- fill: "none"
1744
- }, props), _path$$ || (_path$$ = /*#__PURE__*/React.createElement("path", {
1745
- d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333z"
1746
- })));
1747
- }
1748
-
1749
- var _path$_;
1750
-
1751
- 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); }
1752
-
1753
- function SvgVolumeOff(props) {
1754
- return /*#__PURE__*/React.createElement("svg", _extends$18({
1755
- viewBox: "0 0 16 16",
1756
- strokeLinecap: "round",
1757
- strokeLinejoin: "round",
1758
- stroke: "currentColor",
1759
- width: "1em",
1760
- height: "1em",
1761
- fill: "none"
1762
- }, props), _path$_ || (_path$_ = /*#__PURE__*/React.createElement("path", {
1763
- d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333zm8 2.667l-4 4m0-4l4 4"
1764
- })));
1765
- }
1766
-
1767
- var _path$Z;
1768
-
1769
- 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); }
1770
-
1771
- function SvgVolumeUp(props) {
1772
- return /*#__PURE__*/React.createElement("svg", _extends$17({
1773
- viewBox: "0 0 16 16",
1774
- strokeLinecap: "round",
1775
- strokeLinejoin: "round",
1776
- stroke: "currentColor",
1777
- width: "1em",
1778
- height: "1em",
1779
- fill: "none"
1780
- }, props), _path$Z || (_path$Z = /*#__PURE__*/React.createElement("path", {
1781
- 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"
1782
- })));
1783
- }
1784
-
1785
- var usePlaybackIcon = function (state) {
1786
- var _a;
1787
- var options = (_a = {},
1788
- _a[PLAYBACK_STATES.PAUSED] = SvgPlay,
1789
- _a[PLAYBACK_STATES.PLAYING] = SvgPause,
1790
- _a[PLAYBACK_STATES.NONE] = SvgPlay,
1791
- _a[PLAYBACK_STATES.PLAYABLE] = SvgPlay,
1792
- _a);
1793
- return options[state.playback];
1794
- };
1795
-
1796
1807
  var useVolumeIcon = function (state) {
1797
1808
  var volumeIcon = SvgVolumeUp;
1798
1809
  if (state.context.volume >= 0.5) {
@@ -1824,7 +1835,7 @@ var formatTime = function (time, remaning) {
1824
1835
  };
1825
1836
 
1826
1837
  var setupAudioRef = function (config) { return function () {
1827
- var _a, _b, _c;
1838
+ var _a, _b, _c, _d;
1828
1839
  var audioRef = config.audioRef, send = config.send;
1829
1840
  var handleDurationChange = function (event) {
1830
1841
  var duration = event.target.duration;
@@ -1837,27 +1848,32 @@ var setupAudioRef = function (config) { return function () {
1837
1848
  var handleCanPlay = function () {
1838
1849
  send({ type: AUDIO_PLAYER_EVENT_TYPES.CAN_PLAY });
1839
1850
  };
1851
+ var handleEnded = function () {
1852
+ send({ type: AUDIO_PLAYER_EVENT_TYPES.RESET });
1853
+ };
1840
1854
  (_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('durationchange', handleDurationChange);
1841
1855
  (_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('timeupdate', handleTimeUpdate);
1842
1856
  (_c = audioRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('canplay', handleCanPlay);
1857
+ (_d = audioRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleEnded);
1843
1858
  return function () {
1844
- var _a, _b, _c;
1859
+ var _a, _b, _c, _d;
1845
1860
  (_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('durationchange', handleDurationChange);
1846
1861
  (_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('timeupdate', handleTimeUpdate);
1847
1862
  (_c = audioRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('canplay', handleCanPlay);
1863
+ (_d = audioRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('ended', handleEnded);
1848
1864
  };
1849
1865
  }; };
1850
1866
 
1851
1867
  var AudioPlayer = function (props) {
1852
- var _a, _b, _c, _d;
1868
+ var _a, _b, _c, _d, _f;
1853
1869
  var src = props.src;
1854
1870
  var volumeRef = useRef(null);
1855
1871
  var audioRef = useRef(null);
1856
- var _f = useState(false), disableRipple = _f[0], setDisableRipple = _f[1];
1857
- var _g = useReducer(audioPlayerReducer, __assign(__assign({}, initialAudioPlayerState), { context: __assign(__assign({}, initialAudioPlayerState.context), { audioRef: audioRef }) })), state = _g[0], send = _g[1];
1872
+ var _g = useState(false), disableRipple = _g[0], setDisableRipple = _g[1];
1873
+ var _h = useReducer(audioPlayerReducer, __assign(__assign({}, initialAudioPlayerState), { context: __assign(__assign({}, initialAudioPlayerState.context), { audioRef: audioRef }) })), state = _h[0], send = _h[1];
1858
1874
  useEffect(setupAudioRef({ audioRef: audioRef, send: send }), [audioRef]);
1859
- var PlaybackIcon = usePlaybackIcon(state);
1860
- var VolumeIcon = useVolumeIcon(state);
1875
+ var PlaybackIcon = state.playback !== PLAYBACK_STATES.PAUSED ? SvgPause : SvgPlay;
1876
+ var VolumeIcon = useMemo(function () { return useVolumeIcon(state); }, [state.context.volume, (_a = state.context.audioRef.current) === null || _a === void 0 ? void 0 : _a.muted]);
1861
1877
  var togglePlayback = function () { return send({ type: AUDIO_PLAYER_EVENT_TYPES.TOGGLE_PLAYBACK }); };
1862
1878
  var toggleVolumeControl = function () { return send({ type: AUDIO_PLAYER_EVENT_TYPES.TOGGLE_VOLUME_CONTROL }); };
1863
1879
  var toggleMute = function () { return send({ type: AUDIO_PLAYER_EVENT_TYPES.TOGGLE_MUTE }); };
@@ -1878,11 +1894,11 @@ var AudioPlayer = function (props) {
1878
1894
  React__default.createElement(Slider, { color: "secondary", orientation: "vertical", value: state.context.volume, onChange: setVolume, max: 1, step: 0.01 })))));
1879
1895
  }))),
1880
1896
  React__default.createElement(Box, { display: "flex", flexGrow: 1, alignItems: "center", gap: 1 },
1881
- React__default.createElement(Box, { flexBasis: 60 },
1882
- React__default.createElement(Typography, null, formatTime(((_a = state.context.audioRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) || 0))),
1883
- React__default.createElement(Slider, { color: "secondary", value: ((_b = state.context.audioRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0, max: ((_c = state.context.audioRef.current) === null || _c === void 0 ? void 0 : _c.duration) || 1, onChange: setTime, disabled: state.playback === PLAYBACK_STATES.NONE }),
1884
- React__default.createElement(Box, { flexBasis: 60, textAlign: "end" },
1885
- React__default.createElement(Typography, null, formatTime(((_d = state.context.audioRef.current) === null || _d === void 0 ? void 0 : _d.duration) || 0))))));
1897
+ React__default.createElement(Box, { flexBasis: 60, flexShrink: 0 },
1898
+ React__default.createElement(Typography, null, formatTime(((_b = state.context.audioRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0))),
1899
+ React__default.createElement(Slider, { 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 }),
1900
+ React__default.createElement(Box, { flexBasis: 60, flexShrink: 0, textAlign: "end" },
1901
+ React__default.createElement(Typography, null, formatTime(((_f = state.context.audioRef.current) === null || _f === void 0 ? void 0 : _f.duration) || 0))))));
1886
1902
  };
1887
1903
 
1888
1904
  var LoadingStatus;
@@ -6964,14 +6980,16 @@ var useTableStyles = makeStyles(function (_a) {
6964
6980
  },
6965
6981
  tableWrap: function () { return ({
6966
6982
  maxWidth: '100%',
6967
- overflowX: 'scroll',
6983
+ overflowX: 'auto',
6968
6984
  overflowY: 'hidden',
6969
6985
  }); },
6970
6986
  });
6971
6987
  });
6972
6988
 
6973
6989
  var TableActionsCell = function (props) {
6974
- var _a = props.actions, primary = _a.primary, secondary = _a.secondary, restActions = __rest(_a, ["primary", "secondary"]);
6990
+ var _a = props.actions, primary = _a.primary, secondary = _a.secondary, intermediate = __rest(_a, ["primary", "secondary"]);
6991
+ var tertiary = intermediate.tertiary, restActions = __rest(intermediate, ["tertiary"]);
6992
+ var overflow = Object.keys(props.actions).length > 3;
6975
6993
  var _b = React__default.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
6976
6994
  var openMenu = function (event) {
6977
6995
  setAnchorEl(event.currentTarget);
@@ -6988,10 +7006,14 @@ var TableActionsCell = function (props) {
6988
7006
  React__default.createElement(Icon, { icon: primary.icon }))),
6989
7007
  secondary && secondary.icon && (React__default.createElement(IconButton, { size: "small", onClick: function () { return secondary.action(props.cell); } },
6990
7008
  React__default.createElement(Icon, { icon: secondary.icon }))),
6991
- restActions && (React__default.createElement(React__default.Fragment, null,
7009
+ !overflow && tertiary && tertiary.icon && (React__default.createElement(IconButton, { size: "small", onClick: function () { return tertiary.action(props.cell); } },
7010
+ React__default.createElement(Icon, { icon: tertiary.icon }))),
7011
+ overflow && restActions && (React__default.createElement(React__default.Fragment, null,
6992
7012
  React__default.createElement(IconButton, { size: "small", onClick: openMenu },
6993
7013
  React__default.createElement(Icon, { icon: SvgMore })),
6994
- React__default.createElement(Menu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: closeMenu }, Object.values(restActions).map(function (_a, i) {
7014
+ React__default.createElement(Menu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: closeMenu }, Object.values(__assign({ tertiary: tertiary }, restActions))
7015
+ .filter(function (value) { return value; })
7016
+ .map(function (_a, i) {
6995
7017
  var label = _a.label, action = _a.action;
6996
7018
  return (React__default.createElement(MenuItem, { key: i, onClick: function () { return handleItemClick(action); } }, label));
6997
7019
  }))))));
@@ -7016,7 +7038,7 @@ var makeColumns = function (config) {
7016
7038
  /* eslint-disable react/jsx-key */
7017
7039
  var Table = function (props) {
7018
7040
  var actionColumnId = 'table-actions-column';
7019
- var rawColumns = props.columns, data = props.data, actions = props.actions, sortable = props.sortable, emptyMessage = props.emptyMessage, EmptyImage = props.EmptyImage, isLoading = props.loading;
7041
+ var rawColumns = props.columns, data = props.data, actions = props.actions, sortable = props.sortable, emptyMessage = props.emptyMessage, EmptyImage = props.EmptyImage, isLoading = props.loading, enableMinHeight = props.enableMinHeight;
7020
7042
  var classes = useTableStyles(props);
7021
7043
  var columns = useMemo(function () { return makeColumns({ columns: rawColumns, actions: actions, actionColumnId: actionColumnId }); }, [rawColumns, actions]);
7022
7044
  // @ts-expect-error @types/react-table issue
@@ -7028,8 +7050,8 @@ var Table = function (props) {
7028
7050
  var handlePagination = function (_e, pageNumber) {
7029
7051
  gotoPage(pageNumber - 1);
7030
7052
  };
7031
- return (React__default.createElement(Box, { className: classes.root, minHeight: 706 },
7032
- React__default.createElement(Box, { className: classes.tableWrap },
7053
+ return (React__default.createElement(Box, { className: classes.root, minHeight: (isLoading || isEmpty) && enableMinHeight ? 618 : 'unset' },
7054
+ React__default.createElement(Box, { className: classes.tableWrap, minHeight: page.length > 0 && !isLoading && enableMinHeight ? 618 : 'unset' },
7033
7055
  React__default.createElement("table", __assign({ className: classes.table }, getTableProps()),
7034
7056
  React__default.createElement(TableHeader, null, headerGroups.map(function (headerGroup) { return (React__default.createElement(TableHeaderRow, __assign({}, headerGroup.getHeaderGroupProps()), headerGroup.headers.map(function (column) { return (React__default.createElement(TableHeaderCell
7035
7057
  // @ts-expect-error @types/react-table issue
@@ -7048,6 +7070,7 @@ var Table = function (props) {
7048
7070
  };
7049
7071
  Table.defaultProps = {
7050
7072
  emptyMessage: 'No results.',
7073
+ enableMinHeight: true,
7051
7074
  };
7052
7075
 
7053
7076
  var useToggleButtonStyles = makeStyles$1(function (theme) { return ({