@popmenu/common-ui 0.23.0 → 0.25.1

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.js CHANGED
@@ -7,7 +7,6 @@ var core = require('@material-ui/core');
7
7
  var AppBar = require('@material-ui/core/AppBar');
8
8
  var React = require('react');
9
9
  var MuiIconButton = require('@material-ui/core/IconButton');
10
- var MuiTypography = require('@material-ui/core/Typography');
11
10
  var styles = require('@material-ui/core/styles');
12
11
  var MuiAvatar = require('@material-ui/core/Avatar');
13
12
  var Badge = require('@material-ui/core/Badge');
@@ -77,7 +76,6 @@ var AppBar__default = /*#__PURE__*/_interopDefaultLegacy(AppBar);
77
76
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
78
77
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
79
78
  var MuiIconButton__default = /*#__PURE__*/_interopDefaultLegacy(MuiIconButton);
80
- var MuiTypography__default = /*#__PURE__*/_interopDefaultLegacy(MuiTypography);
81
79
  var MuiAvatar__default = /*#__PURE__*/_interopDefaultLegacy(MuiAvatar);
82
80
  var Badge__default = /*#__PURE__*/_interopDefaultLegacy(Badge);
83
81
  var MuiButton__default = /*#__PURE__*/_interopDefaultLegacy(MuiButton);
@@ -157,164 +155,164 @@ function __rest(s, e) {
157
155
  return t;
158
156
  }
159
157
 
160
- var _path$3e;
158
+ var _path$3M;
161
159
 
162
- function _extends$3u() { _extends$3u = 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$3u.apply(this, arguments); }
160
+ function _extends$41() { _extends$41 = 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$41.apply(this, arguments); }
163
161
 
164
162
  function SvgMinusCircle(props) {
165
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3u({
163
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$41({
166
164
  viewBox: "0 0 16 16",
167
165
  strokeLinecap: "round",
168
166
  strokeLinejoin: "round",
169
167
  stroke: "currentColor",
170
- fill: "none",
171
168
  width: "1em",
172
- height: "1em"
173
- }, props), _path$3e || (_path$3e = /*#__PURE__*/React__namespace.createElement("path", {
174
- d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zM5.333 8h5.334"
169
+ height: "1em",
170
+ fill: "none"
171
+ }, props), _path$3M || (_path$3M = /*#__PURE__*/React__namespace.createElement("path", {
172
+ d: "M8 14.667A6.667 6.667 0 108 1.333a6.667 6.667 0 000 13.334zM5.333 8h5.334"
175
173
  })));
176
174
  }
177
175
 
178
- var _path$36;
176
+ var _path$3E;
179
177
 
180
- function _extends$3m() { _extends$3m = 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$3m.apply(this, arguments); }
178
+ function _extends$3V() { _extends$3V = 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$3V.apply(this, arguments); }
181
179
 
182
180
  function SvgPlusCircle(props) {
183
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3m({
181
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$3V({
184
182
  viewBox: "0 0 16 16",
185
183
  strokeLinecap: "round",
186
184
  strokeLinejoin: "round",
187
185
  stroke: "currentColor",
188
- fill: "none",
189
186
  width: "1em",
190
- height: "1em"
191
- }, props), _path$36 || (_path$36 = /*#__PURE__*/React__namespace.createElement("path", {
192
- d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zm0-9.334v5.334M5.333 8h5.334"
187
+ height: "1em",
188
+ fill: "none"
189
+ }, props), _path$3E || (_path$3E = /*#__PURE__*/React__namespace.createElement("path", {
190
+ d: "M8 14.667A6.667 6.667 0 108 1.333a6.667 6.667 0 000 13.334zm0-9.334v5.334M5.333 8h5.334"
193
191
  })));
194
192
  }
195
193
 
196
- var _path$2O;
194
+ var _path$3k;
197
195
 
198
- function _extends$32() { _extends$32 = 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$32.apply(this, arguments); }
196
+ 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); }
199
197
 
200
198
  function SvgUser(props) {
201
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$32({
199
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$3B({
202
200
  viewBox: "0 0 16 16",
203
201
  strokeLinecap: "round",
204
202
  strokeLinejoin: "round",
205
203
  stroke: "currentColor",
206
- fill: "none",
207
204
  width: "1em",
208
- height: "1em"
209
- }, props), _path$2O || (_path$2O = /*#__PURE__*/React__namespace.createElement("path", {
205
+ height: "1em",
206
+ fill: "none"
207
+ }, props), _path$3k || (_path$3k = /*#__PURE__*/React__namespace.createElement("path", {
210
208
  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"
211
209
  })));
212
210
  }
213
211
 
214
- var _path$1k;
212
+ var _path$1f;
215
213
 
216
- 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); }
214
+ 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); }
217
215
 
218
216
  function SvgPause(props) {
219
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$1o({
217
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1p({
220
218
  viewBox: "0 0 16 16",
221
219
  strokeLinecap: "round",
222
220
  strokeLinejoin: "round",
223
221
  stroke: "currentColor",
224
- fill: "none",
225
222
  width: "1em",
226
- height: "1em"
227
- }, props), _path$1k || (_path$1k = /*#__PURE__*/React__namespace.createElement("path", {
228
- d: "M6.667 2.667H4v10.666h2.667V2.666zm5.333 0H9.333v10.666H12V2.666z"
223
+ height: "1em",
224
+ fill: "none"
225
+ }, props), _path$1f || (_path$1f = /*#__PURE__*/React__namespace.createElement("path", {
226
+ d: "M6.667 2.667H4v10.666h2.667V2.667zm5.333 0H9.333v10.666H12V2.667z"
229
227
  })));
230
228
  }
231
229
 
232
- var _path$1i;
230
+ var _path$1d;
233
231
 
234
- 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); }
232
+ 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); }
235
233
 
236
234
  function SvgPlay(props) {
237
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$1m({
235
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1n({
238
236
  viewBox: "0 0 16 16",
239
237
  strokeLinecap: "round",
240
238
  strokeLinejoin: "round",
241
239
  stroke: "currentColor",
242
- fill: "none",
243
240
  width: "1em",
244
- height: "1em"
245
- }, props), _path$1i || (_path$1i = /*#__PURE__*/React__namespace.createElement("path", {
241
+ height: "1em",
242
+ fill: "none"
243
+ }, props), _path$1d || (_path$1d = /*#__PURE__*/React__namespace.createElement("path", {
246
244
  d: "M3.333 2l9.334 6-9.334 6V2z"
247
245
  })));
248
246
  }
249
247
 
250
- var _path$15;
248
+ var _path$10;
251
249
 
252
- 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); }
250
+ 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); }
253
251
 
254
252
  function SvgVolumeDown(props) {
255
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$19({
253
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1a({
256
254
  viewBox: "0 0 16 16",
257
255
  strokeLinecap: "round",
258
256
  strokeLinejoin: "round",
259
257
  stroke: "currentColor",
260
- fill: "none",
261
258
  width: "1em",
262
- height: "1em"
263
- }, props), _path$15 || (_path$15 = /*#__PURE__*/React__namespace.createElement("path", {
264
- d: "M8.999 3.333L5.665 6H3v4h2.666L9 12.667V3.333zm3.026 2.307a3.333 3.333 0 010 4.714"
259
+ height: "1em",
260
+ fill: "none"
261
+ }, props), _path$10 || (_path$10 = /*#__PURE__*/React__namespace.createElement("path", {
262
+ d: "M8.999 3.333L5.665 6H3v4h2.666L9 12.667V3.333zm3.026 2.307a3.333 3.333 0 010 4.713"
265
263
  })));
266
264
  }
267
265
 
268
- var _path$14;
266
+ var _path$$;
269
267
 
270
- 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); }
268
+ 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); }
271
269
 
272
270
  function SvgVolumeMute(props) {
273
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$18({
271
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$19({
274
272
  viewBox: "0 0 16 16",
275
273
  strokeLinecap: "round",
276
274
  strokeLinejoin: "round",
277
275
  stroke: "currentColor",
278
- fill: "none",
279
276
  width: "1em",
280
- height: "1em"
281
- }, props), _path$14 || (_path$14 = /*#__PURE__*/React__namespace.createElement("path", {
277
+ height: "1em",
278
+ fill: "none"
279
+ }, props), _path$$ || (_path$$ = /*#__PURE__*/React__namespace.createElement("path", {
282
280
  d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333z"
283
281
  })));
284
282
  }
285
283
 
286
- var _path$13;
284
+ var _path$_;
287
285
 
288
- 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); }
286
+ 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); }
289
287
 
290
288
  function SvgVolumeOff(props) {
291
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$17({
289
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$18({
292
290
  viewBox: "0 0 16 16",
293
291
  strokeLinecap: "round",
294
292
  strokeLinejoin: "round",
295
293
  stroke: "currentColor",
296
- fill: "none",
297
294
  width: "1em",
298
- height: "1em"
299
- }, props), _path$13 || (_path$13 = /*#__PURE__*/React__namespace.createElement("path", {
295
+ height: "1em",
296
+ fill: "none"
297
+ }, props), _path$_ || (_path$_ = /*#__PURE__*/React__namespace.createElement("path", {
300
298
  d: "M7.333 3.333L4 6H1.333v4H4l3.333 2.667V3.333zm8 2.667l-4 4m0-4l4 4"
301
299
  })));
302
300
  }
303
301
 
304
- var _path$12;
302
+ var _path$Z;
305
303
 
306
- function _extends$16() { _extends$16 = 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$16.apply(this, arguments); }
304
+ 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); }
307
305
 
308
306
  function SvgVolumeUp(props) {
309
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$16({
307
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$17({
310
308
  viewBox: "0 0 16 16",
311
309
  strokeLinecap: "round",
312
310
  strokeLinejoin: "round",
313
311
  stroke: "currentColor",
314
- fill: "none",
315
312
  width: "1em",
316
- height: "1em"
317
- }, props), _path$12 || (_path$12 = /*#__PURE__*/React__namespace.createElement("path", {
313
+ height: "1em",
314
+ fill: "none"
315
+ }, props), _path$Z || (_path$Z = /*#__PURE__*/React__namespace.createElement("path", {
318
316
  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"
319
317
  })));
320
318
  }
@@ -441,29 +439,29 @@ IconButton.defaultProps = {
441
439
  color: 'secondary',
442
440
  };
443
441
 
444
- var useTypographyStyles = styles.makeStyles(function () {
445
- var _a;
446
- return ({
447
- root: (_a = {},
448
- _a["& ." + iconStaticClassName] = {
449
- position: 'relative',
450
- top: '0.125em',
451
- padding: '0 0.125em',
452
- boxSizing: 'content-box',
453
- },
454
- _a),
455
- caption: {
456
- display: 'inline',
457
- },
458
- overline: {
459
- display: 'inline',
460
- },
461
- });
462
- });
442
+ var useTypographyStyles = styles.makeStyles(function () { return ({
443
+ root: function (_a) {
444
+ var _b;
445
+ var weight = _a.weight;
446
+ return (__assign((_b = {}, _b["& ." + iconStaticClassName] = {
447
+ position: 'relative',
448
+ top: '0.125em',
449
+ padding: '0 0.125em',
450
+ boxSizing: 'content-box',
451
+ }, _b), (weight && { fontWeight: (weight === 'semi-bold' && 600) || (weight === 'bold' && 700) || 400 })));
452
+ },
453
+ caption: {
454
+ display: 'inline',
455
+ },
456
+ overline: {
457
+ display: 'inline',
458
+ },
459
+ }); });
463
460
 
464
461
  var Typography = React.forwardRef(function (props, ref) {
462
+ props.weight; var restProps = __rest(props, ["weight"]);
465
463
  var classes = useTypographyStyles(props);
466
- return React__default['default'].createElement(MuiTypography__default['default'], __assign({ ref: ref, classes: classes }, props));
464
+ return React__default['default'].createElement(core.Typography, __assign({ ref: ref, classes: classes }, restProps));
467
465
  });
468
466
  Typography.displayName = 'Typography';
469
467
 
@@ -1034,6 +1032,11 @@ var Switch = React.forwardRef(function (props, ref) {
1034
1032
  });
1035
1033
  Switch.displayName = 'Switch';
1036
1034
 
1035
+ var TabPanel = function (props) {
1036
+ var children = props.children, show = props.show;
1037
+ return show ? React__default['default'].createElement(core.Box, null, children) : null;
1038
+ };
1039
+
1037
1040
  var useToggleButtonStyles = styles.makeStyles(function (theme) { return ({
1038
1041
  root: {
1039
1042
  color: theme.palette.text.primary,
@@ -1149,6 +1152,37 @@ var useCollapsibleText = function () {
1149
1152
  };
1150
1153
  };
1151
1154
 
1155
+ var useTabs = function (options) {
1156
+ var initialTab = options.initialTab;
1157
+ var genTabId = function (id) { return ("tab-" + id).toLowerCase().replace(/ /g, '-'); };
1158
+ var genPanelId = function (id) { return ("tab-panel-" + id).toLowerCase().replace(/ /g, '-'); };
1159
+ var _a = React.useState(genTabId(initialTab)), activeTab = _a[0], setActiveTab = _a[1];
1160
+ var handleChange = function (_, nextTab) { return setActiveTab(nextTab); };
1161
+ var TabsProps = { onChange: handleChange, value: activeTab };
1162
+ var useTab = function (baseId) {
1163
+ var tabId = genTabId(baseId);
1164
+ var tabPanelId = genPanelId(baseId);
1165
+ var tabProps = {
1166
+ id: tabId,
1167
+ label: baseId,
1168
+ value: tabId,
1169
+ 'aria-controls': tabPanelId,
1170
+ };
1171
+ var panelProps = {
1172
+ id: tabPanelId,
1173
+ role: 'tabpanel',
1174
+ show: activeTab === tabId,
1175
+ 'aria-labelledby': tabId,
1176
+ };
1177
+ return [tabProps, panelProps];
1178
+ };
1179
+ return {
1180
+ TabsProps: TabsProps,
1181
+ useTab: useTab,
1182
+ setActiveTab: function (tabId) { return setActiveTab(tabId); },
1183
+ };
1184
+ };
1185
+
1152
1186
  Object.defineProperty(exports, 'Alert', {
1153
1187
  enumerable: true,
1154
1188
  get: function () {
@@ -1566,9 +1600,11 @@ exports.PaperContent = PaperContent;
1566
1600
  exports.Radio = Radio;
1567
1601
  exports.SplitInput = SplitInput;
1568
1602
  exports.Switch = Switch;
1603
+ exports.TabPanel = TabPanel;
1569
1604
  exports.ToggleButton = ToggleButton;
1570
1605
  exports.ToggleButtonGroup = ToggleButtonGroup;
1571
1606
  exports.Tooltip = Tooltip;
1572
1607
  exports.Typography = Typography;
1573
1608
  exports.useCollapsibleText = useCollapsibleText;
1609
+ exports.useTabs = useTabs;
1574
1610
  //# sourceMappingURL=index.js.map