@popmenu/table 0.30.0 → 0.33.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
@@ -178,19 +178,19 @@ function __rest(s, e) {
178
178
  return t;
179
179
  }
180
180
 
181
- var _path$24;
181
+ var _path$F;
182
182
 
183
- function _extends$3i() { _extends$3i = 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$3i.apply(this, arguments); }
183
+ function _extends$1c() { _extends$1c = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1c.apply(this, arguments); }
184
184
 
185
185
  function SvgUser(props) {
186
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3i({
186
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1c({
187
187
  viewBox: "0 0 16 16",
188
188
  fill: "none",
189
189
  strokeLinecap: "round",
190
190
  strokeLinejoin: "round",
191
191
  width: "1em",
192
192
  height: "1em"
193
- }, props), _path$24 || (_path$24 = /*#__PURE__*/React__namespace.createElement("path", {
193
+ }, props), _path$F || (_path$F = /*#__PURE__*/React__namespace.createElement("path", {
194
194
  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",
195
195
  stroke: "currentColor"
196
196
  })));
@@ -423,48 +423,35 @@ var Checkbox = React.forwardRef(function (props, ref) {
423
423
  });
424
424
  Checkbox.displayName = 'Checkbox';
425
425
 
426
+ var defaultTypographyProps = {
427
+ variant: 'body1',
428
+ };
429
+
426
430
  var weights = {
427
431
  regular: 400,
432
+ medium: 500,
428
433
  'semi-bold': 600,
429
434
  bold: 700,
430
435
  };
431
- var getColor = function (theme, props) {
432
- var color = props.color;
433
- if (color === undefined) {
434
- return undefined;
435
- }
436
- if (['white', 'black'].includes(color)) {
437
- return theme.palette.common[color];
438
- }
439
- if (color.match(/^grey\.\d{3}/)) {
440
- var scale = color.split('.')[1];
441
- return theme.palette.grey[scale] || theme.palette.grey[900];
442
- }
443
- if ([
444
- 'primary.light',
445
- 'primary.dark',
446
- 'secondary.light',
447
- 'secondary',
448
- 'secondary.dark',
449
- 'info.light',
450
- 'info.dark',
451
- 'success.light',
452
- 'success.dark',
453
- 'error.light',
454
- 'error.dark',
455
- 'warning.light',
456
- 'warning.dark',
457
- ].includes(color)) {
458
- var _a = color.split('.'), paletteKey = _a[0], variant = _a[1];
459
- return theme.palette[paletteKey][variant];
436
+ var getCustomColor = function (theme, color) {
437
+ var isCommonColor = color && ['white', 'black'].includes(color);
438
+ var isGreyColor = color && color.match(/^grey\.\d{3}/);
439
+ var isSemanticColor = color && color.match(/(primary|secondary|info|success|error|warning).?(light|dark)?/);
440
+ var isTextColor = color && ['textPrimary', 'textSecondary'].includes(color);
441
+ switch (true) {
442
+ case isCommonColor:
443
+ return theme.palette.common[color];
444
+ case Boolean(isGreyColor):
445
+ var scale = color.split('.')[1];
446
+ return theme.palette.grey[scale] || theme.palette.grey[900];
447
+ case Boolean(isSemanticColor):
448
+ var _a = color.split('.'), paletteKey = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
449
+ return theme.palette[paletteKey][variant];
450
+ case isTextColor:
451
+ return theme.palette.text[color.slice(4).toLowerCase()];
452
+ default:
453
+ return undefined;
460
454
  }
461
- if (['success', 'info', 'error', 'warning', 'primary', 'secondary'].includes(color)) {
462
- return theme.palette[color].main;
463
- }
464
- if (['textPrimary', 'textSecondary'].includes(color)) {
465
- return theme.palette.text[color.slice(4).toLowerCase()];
466
- }
467
- return undefined;
468
455
  };
469
456
  var useTypographyStyles = styles.makeStyles(function (theme) {
470
457
  var _a;
@@ -479,21 +466,24 @@ var useTypographyStyles = styles.makeStyles(function (theme) {
479
466
  _a.fontFamily = theme.typography.fontFamily,
480
467
  _a.fontWeight = function (_a) {
481
468
  var variant = _a.variant, weight = _a.weight;
482
- return (weight ? weights[weight] : theme.typography[variant || 'body1'].fontWeight);
469
+ return (weight ? weights[weight] : theme.typography[variant].fontWeight);
483
470
  },
484
471
  _a.fontSize = function (_a) {
485
472
  var variant = _a.variant;
486
- return theme.typography[variant || 'body1'].fontSize;
473
+ return theme.typography[variant].fontSize;
487
474
  },
488
475
  _a.lineHeight = function (_a) {
489
476
  var variant = _a.variant;
490
- return theme.typography[variant || 'body1'].lineHeight;
477
+ return theme.typography[variant].lineHeight;
491
478
  },
492
479
  _a.textTransform = function (_a) {
493
480
  var variant = _a.variant;
494
- return theme.typography[variant || 'body1'].textTransform;
481
+ return theme.typography[variant].textTransform;
482
+ },
483
+ _a.color = function (_a) {
484
+ var color = _a.color, variant = _a.variant;
485
+ return (color && getCustomColor(theme, color)) || theme.typography[variant].color;
495
486
  },
496
- _a.color = function (props) { return getColor(theme, props); },
497
487
  _a),
498
488
  caption: {
499
489
  display: 'inline',
@@ -504,30 +494,14 @@ var useTypographyStyles = styles.makeStyles(function (theme) {
504
494
  });
505
495
  });
506
496
 
507
- var variantMap = {
508
- h1: 'h1',
509
- h2: 'h2',
510
- h3: 'h3',
511
- h4: 'h4',
512
- h5: 'h5',
513
- h6: 'h6',
514
- h7: 'h6',
515
- body1: 'p',
516
- body2: 'p',
517
- subtitle1: 'h6',
518
- subtitle2: 'h6',
519
- caption: 'span',
520
- overline: 'span',
521
- };
522
-
523
497
  var Typography = React.forwardRef(function (props, ref) {
524
- props.weight; var _a = props.variant, variant = _a === void 0 ? 'body1' : _a; props.color; var restProps = __rest(props, ["weight", "variant", "color"]);
525
- var validatedVariant = Object.keys(variantMap).includes(variant) ? variant : 'body1';
526
- var classes = useTypographyStyles(__assign(__assign({}, props), { variant: validatedVariant }));
527
- var component = variantMap[validatedVariant];
528
- return React__default['default'].createElement(core.Typography, __assign({ component: component, ref: ref, classes: classes }, restProps, { variant: "inherit" }));
498
+ props.weight; props.color; var restProps = __rest(props, ["weight", "color"]);
499
+ var classes = useTypographyStyles(__assign({}, props));
500
+ var variantMapping = { subtitle1: 'p' };
501
+ return React__default['default'].createElement(core.Typography, __assign({ ref: ref, classes: classes, variantMapping: variantMapping }, restProps));
529
502
  });
530
- Typography.displayName = 'Typography';
503
+ Typography.displayName = 'Typography';
504
+ Typography.defaultProps = defaultTypographyProps;
531
505
 
532
506
  var getFadeStop = function (_a, typographyVariant) {
533
507
  var typography = _a.typography;
@@ -795,73 +769,73 @@ var TableHeader = function (props) {
795
769
  return React__default['default'].createElement("thead", __assign$1({}, restProps), children);
796
770
  };
797
771
 
798
- var _path$39;
772
+ var _path$1j;
799
773
 
800
- function _extends$50() { _extends$50 = 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$50.apply(this, arguments); }
774
+ function _extends$2a() { _extends$2a = 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$2a.apply(this, arguments); }
801
775
 
802
776
  function SvgChevronDown(props) {
803
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$50({
777
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$2a({
804
778
  viewBox: "0 0 16 16",
805
779
  fill: "none",
806
780
  strokeLinecap: "round",
807
781
  strokeLinejoin: "round",
808
782
  width: "1em",
809
783
  height: "1em"
810
- }, props), _path$39 || (_path$39 = /*#__PURE__*/React__namespace.createElement("path", {
784
+ }, props), _path$1j || (_path$1j = /*#__PURE__*/React__namespace.createElement("path", {
811
785
  d: "M4 6l4 4 4-4",
812
786
  stroke: "currentColor"
813
787
  })));
814
788
  }
815
789
 
816
- var _path$38;
790
+ var _path$1i;
817
791
 
818
- function _extends$4$() { _extends$4$ = 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$4$.apply(this, arguments); }
792
+ function _extends$29() { _extends$29 = 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$29.apply(this, arguments); }
819
793
 
820
794
  function SvgChevronUp(props) {
821
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$4$({
795
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$29({
822
796
  viewBox: "0 0 16 16",
823
797
  fill: "none",
824
798
  strokeLinecap: "round",
825
799
  strokeLinejoin: "round",
826
800
  width: "1em",
827
801
  height: "1em"
828
- }, props), _path$38 || (_path$38 = /*#__PURE__*/React__namespace.createElement("path", {
802
+ }, props), _path$1i || (_path$1i = /*#__PURE__*/React__namespace.createElement("path", {
829
803
  d: "M12 10L8 6l-4 4",
830
804
  stroke: "currentColor"
831
805
  })));
832
806
  }
833
807
 
834
- var _path$2o;
808
+ var _path$R;
835
809
 
836
- function _extends$3I() { _extends$3I = 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$3I.apply(this, arguments); }
810
+ function _extends$1s() { _extends$1s = 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$1s.apply(this, arguments); }
837
811
 
838
812
  function SvgMore(props) {
839
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3I({
813
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1s({
840
814
  viewBox: "0 0 16 16",
841
815
  fill: "none",
842
816
  strokeLinecap: "round",
843
817
  strokeLinejoin: "round",
844
818
  width: "1em",
845
819
  height: "1em"
846
- }, props), _path$2o || (_path$2o = /*#__PURE__*/React__namespace.createElement("path", {
820
+ }, props), _path$R || (_path$R = /*#__PURE__*/React__namespace.createElement("path", {
847
821
  d: "M8 8.667a.667.667 0 100-1.334.667.667 0 000 1.334zM8 4a.667.667 0 100-1.334A.667.667 0 008 4zm0 9.333A.667.667 0 108 12a.667.667 0 000 1.333z",
848
822
  stroke: "currentColor"
849
823
  })));
850
824
  }
851
825
 
852
- var _path$2f;
826
+ var _path$N;
853
827
 
854
- function _extends$3y() { _extends$3y = 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$3y.apply(this, arguments); }
828
+ 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); }
855
829
 
856
830
  function SvgSearch(props) {
857
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3y({
831
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1n({
858
832
  viewBox: "0 0 16 16",
859
833
  fill: "none",
860
834
  strokeLinecap: "round",
861
835
  strokeLinejoin: "round",
862
836
  width: "1em",
863
837
  height: "1em"
864
- }, props), _path$2f || (_path$2f = /*#__PURE__*/React__namespace.createElement("path", {
838
+ }, props), _path$N || (_path$N = /*#__PURE__*/React__namespace.createElement("path", {
865
839
  d: "M7.333 12.667A5.333 5.333 0 107.333 2a5.333 5.333 0 000 10.667zM14 14l-2.9-2.9",
866
840
  stroke: "currentColor"
867
841
  })));