@popmenu/common-ui 0.28.1 → 0.31.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/components/Typography/Typography.d.ts +1 -1
- package/build/components/Typography/TypographyProps.d.ts +6 -5
- package/build/components/Typography/TypographyStyles.d.ts +3 -1
- package/build/index.es.js +49 -75
- package/build/index.es.js.map +1 -1
- package/build/index.js +49 -75
- package/build/index.js.map +1 -1
- package/package.json +2 -2
- package/build/components/Typography/variantMap.d.ts +0 -3
package/build/index.js
CHANGED
|
@@ -155,55 +155,55 @@ function __rest(s, e) {
|
|
|
155
155
|
return t;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
var _path$
|
|
158
|
+
var _path$Q;
|
|
159
159
|
|
|
160
|
-
function _extends$
|
|
160
|
+
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); }
|
|
161
161
|
|
|
162
162
|
function SvgMinusCircle(props) {
|
|
163
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
163
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1n({
|
|
164
164
|
viewBox: "0 0 16 16",
|
|
165
165
|
fill: "none",
|
|
166
166
|
strokeLinecap: "round",
|
|
167
167
|
strokeLinejoin: "round",
|
|
168
168
|
width: "1em",
|
|
169
169
|
height: "1em"
|
|
170
|
-
}, props), _path$
|
|
170
|
+
}, props), _path$Q || (_path$Q = /*#__PURE__*/React__namespace.createElement("path", {
|
|
171
171
|
d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zM5.333 8h5.334",
|
|
172
172
|
stroke: "currentColor"
|
|
173
173
|
})));
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
var _path$
|
|
176
|
+
var _path$M;
|
|
177
177
|
|
|
178
|
-
function _extends$
|
|
178
|
+
function _extends$1j() { _extends$1j = 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$1j.apply(this, arguments); }
|
|
179
179
|
|
|
180
180
|
function SvgPlusCircle(props) {
|
|
181
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
181
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1j({
|
|
182
182
|
viewBox: "0 0 16 16",
|
|
183
183
|
fill: "none",
|
|
184
184
|
strokeLinecap: "round",
|
|
185
185
|
strokeLinejoin: "round",
|
|
186
186
|
width: "1em",
|
|
187
187
|
height: "1em"
|
|
188
|
-
}, props), _path$
|
|
188
|
+
}, props), _path$M || (_path$M = /*#__PURE__*/React__namespace.createElement("path", {
|
|
189
189
|
d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zm0-9.334v5.334M5.333 8h5.334",
|
|
190
190
|
stroke: "currentColor"
|
|
191
191
|
})));
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
var _path$
|
|
194
|
+
var _path$D;
|
|
195
195
|
|
|
196
|
-
function _extends$
|
|
196
|
+
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); }
|
|
197
197
|
|
|
198
198
|
function SvgUser(props) {
|
|
199
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
199
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$16({
|
|
200
200
|
viewBox: "0 0 16 16",
|
|
201
201
|
fill: "none",
|
|
202
202
|
strokeLinecap: "round",
|
|
203
203
|
strokeLinejoin: "round",
|
|
204
204
|
width: "1em",
|
|
205
205
|
height: "1em"
|
|
206
|
-
}, props), _path$
|
|
206
|
+
}, props), _path$D || (_path$D = /*#__PURE__*/React__namespace.createElement("path", {
|
|
207
207
|
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",
|
|
208
208
|
stroke: "currentColor"
|
|
209
209
|
})));
|
|
@@ -436,48 +436,35 @@ var Checkbox = React.forwardRef(function (props, ref) {
|
|
|
436
436
|
});
|
|
437
437
|
Checkbox.displayName = 'Checkbox';
|
|
438
438
|
|
|
439
|
+
var defaultTypographyProps = {
|
|
440
|
+
variant: 'body1',
|
|
441
|
+
};
|
|
442
|
+
|
|
439
443
|
var weights = {
|
|
440
444
|
regular: 400,
|
|
445
|
+
medium: 500,
|
|
441
446
|
'semi-bold': 600,
|
|
442
447
|
bold: 700,
|
|
443
448
|
};
|
|
444
|
-
var
|
|
445
|
-
var
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
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];
|
|
449
|
+
var getCustomColor = function (theme, color) {
|
|
450
|
+
var isCommonColor = color && ['white', 'black'].includes(color);
|
|
451
|
+
var isGreyColor = color && color.match(/^grey\.\d{3}/);
|
|
452
|
+
var isSemanticColor = color && color.match(/(primary|secondary|info|success|error|warning).?(light|dark)?/);
|
|
453
|
+
var isTextColor = color && ['textPrimary', 'textSecondary'].includes(color);
|
|
454
|
+
switch (true) {
|
|
455
|
+
case isCommonColor:
|
|
456
|
+
return theme.palette.common[color];
|
|
457
|
+
case Boolean(isGreyColor):
|
|
458
|
+
var scale = color.split('.')[1];
|
|
459
|
+
return theme.palette.grey[scale] || theme.palette.grey[900];
|
|
460
|
+
case Boolean(isSemanticColor):
|
|
461
|
+
var _a = color.split('.'), paletteKey = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
|
|
462
|
+
return theme.palette[paletteKey][variant];
|
|
463
|
+
case isTextColor:
|
|
464
|
+
return theme.palette.text[color.slice(4).toLowerCase()];
|
|
465
|
+
default:
|
|
466
|
+
return undefined;
|
|
473
467
|
}
|
|
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
468
|
};
|
|
482
469
|
var useTypographyStyles = styles.makeStyles(function (theme) {
|
|
483
470
|
var _a;
|
|
@@ -492,21 +479,24 @@ var useTypographyStyles = styles.makeStyles(function (theme) {
|
|
|
492
479
|
_a.fontFamily = theme.typography.fontFamily,
|
|
493
480
|
_a.fontWeight = function (_a) {
|
|
494
481
|
var variant = _a.variant, weight = _a.weight;
|
|
495
|
-
return (weight ? weights[weight] : theme.typography[variant
|
|
482
|
+
return (weight ? weights[weight] : theme.typography[variant].fontWeight);
|
|
496
483
|
},
|
|
497
484
|
_a.fontSize = function (_a) {
|
|
498
485
|
var variant = _a.variant;
|
|
499
|
-
return theme.typography[variant
|
|
486
|
+
return theme.typography[variant].fontSize;
|
|
500
487
|
},
|
|
501
488
|
_a.lineHeight = function (_a) {
|
|
502
489
|
var variant = _a.variant;
|
|
503
|
-
return theme.typography[variant
|
|
490
|
+
return theme.typography[variant].lineHeight;
|
|
504
491
|
},
|
|
505
492
|
_a.textTransform = function (_a) {
|
|
506
493
|
var variant = _a.variant;
|
|
507
|
-
return theme.typography[variant
|
|
494
|
+
return theme.typography[variant].textTransform;
|
|
495
|
+
},
|
|
496
|
+
_a.color = function (_a) {
|
|
497
|
+
var color = _a.color, variant = _a.variant;
|
|
498
|
+
return (color && getCustomColor(theme, color)) || theme.typography[variant].color;
|
|
508
499
|
},
|
|
509
|
-
_a.color = function (props) { return getColor(theme, props); },
|
|
510
500
|
_a),
|
|
511
501
|
caption: {
|
|
512
502
|
display: 'inline',
|
|
@@ -517,30 +507,14 @@ var useTypographyStyles = styles.makeStyles(function (theme) {
|
|
|
517
507
|
});
|
|
518
508
|
});
|
|
519
509
|
|
|
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
|
-
};
|
|
535
|
-
|
|
536
510
|
var Typography = React.forwardRef(function (props, ref) {
|
|
537
|
-
props.weight;
|
|
538
|
-
var
|
|
539
|
-
var
|
|
540
|
-
|
|
541
|
-
return React__default['default'].createElement(core.Typography, __assign({ component: component, ref: ref, classes: classes }, restProps, { variant: "inherit" }));
|
|
511
|
+
props.weight; props.color; var restProps = __rest(props, ["weight", "color"]);
|
|
512
|
+
var classes = useTypographyStyles(__assign({}, props));
|
|
513
|
+
var variantMapping = { subtitle1: 'p' };
|
|
514
|
+
return React__default['default'].createElement(core.Typography, __assign({ ref: ref, classes: classes, variantMapping: variantMapping }, restProps));
|
|
542
515
|
});
|
|
543
|
-
Typography.displayName = 'Typography';
|
|
516
|
+
Typography.displayName = 'Typography';
|
|
517
|
+
Typography.defaultProps = defaultTypographyProps;
|
|
544
518
|
|
|
545
519
|
var getFadeStop = function (_a, typographyVariant) {
|
|
546
520
|
var typography = _a.typography;
|