@popmenu/common-ui 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.js CHANGED
@@ -155,12 +155,12 @@ function __rest(s, e) {
155
155
  return t;
156
156
  }
157
157
 
158
- var _path$3f;
158
+ var _path$3g;
159
159
 
160
- 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); }
160
+ function _extends$3x() { _extends$3x = 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$3x.apply(this, arguments); }
161
161
 
162
162
  function SvgMinusCircle(props) {
163
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3v({
163
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$3x({
164
164
  viewBox: "0 0 16 16",
165
165
  strokeLinecap: "round",
166
166
  strokeLinejoin: "round",
@@ -168,17 +168,17 @@ function SvgMinusCircle(props) {
168
168
  width: "1em",
169
169
  height: "1em",
170
170
  fill: "none"
171
- }, props), _path$3f || (_path$3f = /*#__PURE__*/React__namespace.createElement("path", {
171
+ }, props), _path$3g || (_path$3g = /*#__PURE__*/React__namespace.createElement("path", {
172
172
  d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zM5.333 8h5.334"
173
173
  })));
174
174
  }
175
175
 
176
- var _path$37;
176
+ var _path$38;
177
177
 
178
- function _extends$3n() { _extends$3n = 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$3n.apply(this, arguments); }
178
+ function _extends$3p() { _extends$3p = 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$3p.apply(this, arguments); }
179
179
 
180
180
  function SvgPlusCircle(props) {
181
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3n({
181
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$3p({
182
182
  viewBox: "0 0 16 16",
183
183
  strokeLinecap: "round",
184
184
  strokeLinejoin: "round",
@@ -186,17 +186,17 @@ function SvgPlusCircle(props) {
186
186
  width: "1em",
187
187
  height: "1em",
188
188
  fill: "none"
189
- }, props), _path$37 || (_path$37 = /*#__PURE__*/React__namespace.createElement("path", {
189
+ }, props), _path$38 || (_path$38 = /*#__PURE__*/React__namespace.createElement("path", {
190
190
  d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zm0-9.334v5.334M5.333 8h5.334"
191
191
  })));
192
192
  }
193
193
 
194
- var _path$2P;
194
+ var _path$2Q;
195
195
 
196
- function _extends$33() { _extends$33 = 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$33.apply(this, arguments); }
196
+ 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); }
197
197
 
198
198
  function SvgUser(props) {
199
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$33({
199
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$35({
200
200
  viewBox: "0 0 16 16",
201
201
  strokeLinecap: "round",
202
202
  strokeLinejoin: "round",
@@ -204,7 +204,7 @@ function SvgUser(props) {
204
204
  width: "1em",
205
205
  height: "1em",
206
206
  fill: "none"
207
- }, props), _path$2P || (_path$2P = /*#__PURE__*/React__namespace.createElement("path", {
207
+ }, props), _path$2Q || (_path$2Q = /*#__PURE__*/React__namespace.createElement("path", {
208
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"
209
209
  })));
210
210
  }
@@ -436,29 +436,108 @@ var Checkbox = React.forwardRef(function (props, ref) {
436
436
  });
437
437
  Checkbox.displayName = 'Checkbox';
438
438
 
439
- var useTypographyStyles = styles.makeStyles(function () { return ({
440
- root: function (_a) {
441
- var _b;
442
- var weight = _a.weight;
443
- return (__assign((_b = {}, _b["& ." + iconStaticClassName] = {
444
- position: 'relative',
445
- top: '0.125em',
446
- padding: '0 0.125em',
447
- boxSizing: 'content-box',
448
- }, _b), (weight && { fontWeight: (weight === 'semi-bold' && 600) || (weight === 'bold' && 700) || 400 })));
449
- },
450
- caption: {
451
- display: 'inline',
452
- },
453
- overline: {
454
- display: 'inline',
455
- },
456
- }); });
439
+ var weights = {
440
+ regular: 400,
441
+ 'semi-bold': 600,
442
+ bold: 700,
443
+ };
444
+ var getColor = function (theme, props) {
445
+ var color = props.color;
446
+ if (color === undefined) {
447
+ return undefined;
448
+ }
449
+ if (['white', 'black'].includes(color)) {
450
+ return theme.palette.common[color];
451
+ }
452
+ if (color.match(/^grey\.\d{3}/)) {
453
+ var scale = color.split('.')[1];
454
+ return theme.palette.grey[scale] || theme.palette.grey[900];
455
+ }
456
+ if ([
457
+ 'primary.light',
458
+ 'primary.dark',
459
+ 'secondary.light',
460
+ 'secondary',
461
+ 'secondary.dark',
462
+ 'info.light',
463
+ 'info.dark',
464
+ 'success.light',
465
+ 'success.dark',
466
+ 'error.light',
467
+ 'error.dark',
468
+ 'warning.light',
469
+ 'warning.dark',
470
+ ].includes(color)) {
471
+ var _a = color.split('.'), paletteKey = _a[0], variant = _a[1];
472
+ return theme.palette[paletteKey][variant];
473
+ }
474
+ if (['success', 'info', 'error', 'warning', 'primary', 'secondary'].includes(color)) {
475
+ return theme.palette[color].main;
476
+ }
477
+ if (['textPrimary', 'textSecondary'].includes(color)) {
478
+ return theme.palette.text[color.slice(4).toLowerCase()];
479
+ }
480
+ return undefined;
481
+ };
482
+ var useTypographyStyles = styles.makeStyles(function (theme) {
483
+ var _a;
484
+ return ({
485
+ root: (_a = {},
486
+ _a["& ." + iconStaticClassName] = {
487
+ position: 'relative',
488
+ top: '0.125em',
489
+ padding: '0 0.125em',
490
+ boxSizing: 'content-box',
491
+ },
492
+ _a.fontFamily = theme.typography.fontFamily,
493
+ _a.fontWeight = function (_a) {
494
+ var variant = _a.variant, weight = _a.weight;
495
+ return (weight ? weights[weight] : theme.typography[variant || 'body1'].fontWeight);
496
+ },
497
+ _a.fontSize = function (_a) {
498
+ var variant = _a.variant;
499
+ return theme.typography[variant || 'body1'].fontSize;
500
+ },
501
+ _a.lineHeight = function (_a) {
502
+ var variant = _a.variant;
503
+ return theme.typography[variant || 'body1'].lineHeight;
504
+ },
505
+ _a.textTransform = function (_a) {
506
+ var variant = _a.variant;
507
+ return theme.typography[variant || 'body1'].textTransform;
508
+ },
509
+ _a.color = function (props) { return getColor(theme, props); },
510
+ _a),
511
+ caption: {
512
+ display: 'inline',
513
+ },
514
+ overline: {
515
+ display: 'inline',
516
+ },
517
+ });
518
+ });
519
+
520
+ var variantMap = {
521
+ h1: 'h1',
522
+ h2: 'h2',
523
+ h3: 'h3',
524
+ h4: 'h4',
525
+ h5: 'h5',
526
+ h6: 'h6',
527
+ h7: 'h6',
528
+ body1: 'p',
529
+ body2: 'p',
530
+ subtitle1: 'h6',
531
+ subtitle2: 'h6',
532
+ caption: 'span',
533
+ overline: 'span',
534
+ };
457
535
 
458
536
  var Typography = React.forwardRef(function (props, ref) {
459
- props.weight; var restProps = __rest(props, ["weight"]);
537
+ props.weight; var _a = props.variant, variant = _a === void 0 ? 'body1' : _a; props.color; var restProps = __rest(props, ["weight", "variant", "color"]);
460
538
  var classes = useTypographyStyles(props);
461
- return React__default['default'].createElement(core.Typography, __assign({ ref: ref, classes: classes }, restProps));
539
+ var component = variantMap[variant];
540
+ return React__default['default'].createElement(core.Typography, __assign({ component: component, ref: ref, classes: classes }, restProps, { variant: "inherit" }));
462
541
  });
463
542
  Typography.displayName = 'Typography';
464
543