@popmenu/common-ui
Advanced tools
Comparing version 0.27.0 to 0.28.0
@@ -74,3 +74,3 @@ export { default as Alert, AlertProps } from './Alert'; | ||
export { default as Tooltip, TooltipProps } from './Tooltip'; | ||
export { default as Typography, TypographyProps } from './Typography'; | ||
export { default as Typography, TypographyProps, ThemeColors } from './Typography'; | ||
export { NumberField, NumberFieldProps } from './NumberField'; |
export { Typography as default } from './Typography'; | ||
export { TypographyProps } from './TypographyProps'; | ||
export { TypographyProps, ThemeColors } from './TypographyProps'; |
import React from 'react'; | ||
import { TypographyProps } from './TypographyProps'; | ||
export declare const Typography: React.ForwardRefExoticComponent<Pick<TypographyProps, "className" | "style" | "classes" | "innerRef" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "noWrap" | "gutterBottom" | "paragraph" | "weight" | "align" | "display" | "variant" | "variantMapping"> & React.RefAttributes<HTMLParagraphElement | HTMLHeadingElement | HTMLSpanElement>>; | ||
export declare const Typography: React.ForwardRefExoticComponent<Pick<TypographyProps, "className" | "style" | "classes" | "innerRef" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "variant" | "noWrap" | "gutterBottom" | "paragraph" | "align" | "display" | "variantMapping" | "weight"> & React.RefAttributes<HTMLParagraphElement | HTMLHeadingElement | HTMLSpanElement>>; |
import { TypographyProps as MuiTypographyProps } from '@material-ui/core'; | ||
export interface TypographyProps extends MuiTypographyProps { | ||
export declare type BaseTypographyVariants = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'body1' | 'body2' | 'subtitle1' | 'subtitle2' | 'caption' | 'overline'; | ||
export declare type CustomTypographyVariants = 'h7'; | ||
export declare type ThemeColors = 'primary.light' | 'primary' | 'primary.dark' | 'secondary.light' | 'secondary' | 'secondary.dark' | 'info.light' | 'info' | 'info.dark' | 'success.light' | 'success' | 'success.dark' | 'error.light' | 'error' | 'error.dark' | 'warning.light' | 'warning' | 'warning.dark' | 'white' | 'black' | 'grey.100' | 'grey.200' | 'grey.300' | 'grey.400' | 'grey.500' | 'grey.600' | 'grey.700' | 'grey.800' | 'grey.900' | 'textPrimary' | 'textSecondary'; | ||
export interface TypographyProps extends Omit<MuiTypographyProps, 'variant' | 'color'> { | ||
variant?: BaseTypographyVariants | CustomTypographyVariants; | ||
color?: ThemeColors; | ||
weight?: 'regular' | 'semi-bold' | 'bold'; | ||
} |
@@ -92,8 +92,8 @@ export { default as Alert } from '@material-ui/lab/Alert'; | ||
var _path$3f; | ||
var _path$3g; | ||
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); } | ||
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); } | ||
function SvgMinusCircle(props) { | ||
return /*#__PURE__*/React.createElement("svg", _extends$3v({ | ||
return /*#__PURE__*/React.createElement("svg", _extends$3x({ | ||
viewBox: "0 0 16 16", | ||
@@ -106,3 +106,3 @@ strokeLinecap: "round", | ||
fill: "none" | ||
}, props), _path$3f || (_path$3f = /*#__PURE__*/React.createElement("path", { | ||
}, props), _path$3g || (_path$3g = /*#__PURE__*/React.createElement("path", { | ||
d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zM5.333 8h5.334" | ||
@@ -112,8 +112,8 @@ }))); | ||
var _path$37; | ||
var _path$38; | ||
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); } | ||
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); } | ||
function SvgPlusCircle(props) { | ||
return /*#__PURE__*/React.createElement("svg", _extends$3n({ | ||
return /*#__PURE__*/React.createElement("svg", _extends$3p({ | ||
viewBox: "0 0 16 16", | ||
@@ -126,3 +126,3 @@ strokeLinecap: "round", | ||
fill: "none" | ||
}, props), _path$37 || (_path$37 = /*#__PURE__*/React.createElement("path", { | ||
}, props), _path$38 || (_path$38 = /*#__PURE__*/React.createElement("path", { | ||
d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zm0-9.334v5.334M5.333 8h5.334" | ||
@@ -132,8 +132,8 @@ }))); | ||
var _path$2P; | ||
var _path$2Q; | ||
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); } | ||
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); } | ||
function SvgUser(props) { | ||
return /*#__PURE__*/React.createElement("svg", _extends$33({ | ||
return /*#__PURE__*/React.createElement("svg", _extends$35({ | ||
viewBox: "0 0 16 16", | ||
@@ -146,3 +146,3 @@ strokeLinecap: "round", | ||
fill: "none" | ||
}, props), _path$2P || (_path$2P = /*#__PURE__*/React.createElement("path", { | ||
}, props), _path$2Q || (_path$2Q = /*#__PURE__*/React.createElement("path", { | ||
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" | ||
@@ -379,25 +379,104 @@ }))); | ||
var useTypographyStyles = makeStyles$1(function () { return ({ | ||
root: function (_a) { | ||
var _b; | ||
var weight = _a.weight; | ||
return (__assign((_b = {}, _b["& ." + iconStaticClassName] = { | ||
position: 'relative', | ||
top: '0.125em', | ||
padding: '0 0.125em', | ||
boxSizing: 'content-box', | ||
}, _b), (weight && { fontWeight: (weight === 'semi-bold' && 600) || (weight === 'bold' && 700) || 400 }))); | ||
}, | ||
caption: { | ||
display: 'inline', | ||
}, | ||
overline: { | ||
display: 'inline', | ||
}, | ||
}); }); | ||
var weights = { | ||
regular: 400, | ||
'semi-bold': 600, | ||
bold: 700, | ||
}; | ||
var getColor = function (theme, props) { | ||
var color = props.color; | ||
if (color === undefined) { | ||
return undefined; | ||
} | ||
if (['white', 'black'].includes(color)) { | ||
return theme.palette.common[color]; | ||
} | ||
if (color.match(/^grey\.\d{3}/)) { | ||
var scale = color.split('.')[1]; | ||
return theme.palette.grey[scale] || theme.palette.grey[900]; | ||
} | ||
if ([ | ||
'primary.light', | ||
'primary.dark', | ||
'secondary.light', | ||
'secondary', | ||
'secondary.dark', | ||
'info.light', | ||
'info.dark', | ||
'success.light', | ||
'success.dark', | ||
'error.light', | ||
'error.dark', | ||
'warning.light', | ||
'warning.dark', | ||
].includes(color)) { | ||
var _a = color.split('.'), paletteKey = _a[0], variant = _a[1]; | ||
return theme.palette[paletteKey][variant]; | ||
} | ||
if (['success', 'info', 'error', 'warning', 'primary', 'secondary'].includes(color)) { | ||
return theme.palette[color].main; | ||
} | ||
if (['textPrimary', 'textSecondary'].includes(color)) { | ||
return theme.palette.text[color.slice(4).toLowerCase()]; | ||
} | ||
return undefined; | ||
}; | ||
var useTypographyStyles = makeStyles$1(function (theme) { | ||
var _a; | ||
return ({ | ||
root: (_a = {}, | ||
_a["& ." + iconStaticClassName] = { | ||
position: 'relative', | ||
top: '0.125em', | ||
padding: '0 0.125em', | ||
boxSizing: 'content-box', | ||
}, | ||
_a.fontFamily = theme.typography.fontFamily, | ||
_a.fontWeight = function (_a) { | ||
var variant = _a.variant, weight = _a.weight; | ||
return (weight ? weights[weight] : theme.typography[variant || 'body1'].fontWeight); | ||
}, | ||
_a.fontSize = function (_a) { | ||
var variant = _a.variant; | ||
return theme.typography[variant || 'body1'].fontSize; | ||
}, | ||
_a.lineHeight = function (_a) { | ||
var variant = _a.variant; | ||
return theme.typography[variant || 'body1'].lineHeight; | ||
}, | ||
_a.textTransform = function (_a) { | ||
var variant = _a.variant; | ||
return theme.typography[variant || 'body1'].textTransform; | ||
}, | ||
_a.color = function (props) { return getColor(theme, props); }, | ||
_a), | ||
caption: { | ||
display: 'inline', | ||
}, | ||
overline: { | ||
display: 'inline', | ||
}, | ||
}); | ||
}); | ||
var variantMap = { | ||
h1: 'h1', | ||
h2: 'h2', | ||
h3: 'h3', | ||
h4: 'h4', | ||
h5: 'h5', | ||
h6: 'h6', | ||
h7: 'h6', | ||
body1: 'p', | ||
body2: 'p', | ||
subtitle1: 'h6', | ||
subtitle2: 'h6', | ||
caption: 'span', | ||
overline: 'span', | ||
}; | ||
var Typography = forwardRef(function (props, ref) { | ||
props.weight; var restProps = __rest(props, ["weight"]); | ||
props.weight; var _a = props.variant, variant = _a === void 0 ? 'body1' : _a; props.color; var restProps = __rest(props, ["weight", "variant", "color"]); | ||
var classes = useTypographyStyles(props); | ||
return React__default.createElement(Typography$1, __assign({ ref: ref, classes: classes }, restProps)); | ||
var component = variantMap[variant]; | ||
return React__default.createElement(Typography$1, __assign({ component: component, ref: ref, classes: classes }, restProps, { variant: "inherit" })); | ||
}); | ||
@@ -404,0 +483,0 @@ Typography.displayName = 'Typography'; |
@@ -158,8 +158,8 @@ 'use strict'; | ||
var _path$3f; | ||
var _path$3g; | ||
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); } | ||
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); } | ||
function SvgMinusCircle(props) { | ||
return /*#__PURE__*/React__namespace.createElement("svg", _extends$3v({ | ||
return /*#__PURE__*/React__namespace.createElement("svg", _extends$3x({ | ||
viewBox: "0 0 16 16", | ||
@@ -172,3 +172,3 @@ strokeLinecap: "round", | ||
fill: "none" | ||
}, props), _path$3f || (_path$3f = /*#__PURE__*/React__namespace.createElement("path", { | ||
}, props), _path$3g || (_path$3g = /*#__PURE__*/React__namespace.createElement("path", { | ||
d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zM5.333 8h5.334" | ||
@@ -178,8 +178,8 @@ }))); | ||
var _path$37; | ||
var _path$38; | ||
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); } | ||
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); } | ||
function SvgPlusCircle(props) { | ||
return /*#__PURE__*/React__namespace.createElement("svg", _extends$3n({ | ||
return /*#__PURE__*/React__namespace.createElement("svg", _extends$3p({ | ||
viewBox: "0 0 16 16", | ||
@@ -192,3 +192,3 @@ strokeLinecap: "round", | ||
fill: "none" | ||
}, props), _path$37 || (_path$37 = /*#__PURE__*/React__namespace.createElement("path", { | ||
}, props), _path$38 || (_path$38 = /*#__PURE__*/React__namespace.createElement("path", { | ||
d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zm0-9.334v5.334M5.333 8h5.334" | ||
@@ -198,8 +198,8 @@ }))); | ||
var _path$2P; | ||
var _path$2Q; | ||
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); } | ||
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); } | ||
function SvgUser(props) { | ||
return /*#__PURE__*/React__namespace.createElement("svg", _extends$33({ | ||
return /*#__PURE__*/React__namespace.createElement("svg", _extends$35({ | ||
viewBox: "0 0 16 16", | ||
@@ -212,3 +212,3 @@ strokeLinecap: "round", | ||
fill: "none" | ||
}, props), _path$2P || (_path$2P = /*#__PURE__*/React__namespace.createElement("path", { | ||
}, props), _path$2Q || (_path$2Q = /*#__PURE__*/React__namespace.createElement("path", { | ||
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" | ||
@@ -445,25 +445,104 @@ }))); | ||
var useTypographyStyles = styles.makeStyles(function () { return ({ | ||
root: function (_a) { | ||
var _b; | ||
var weight = _a.weight; | ||
return (__assign((_b = {}, _b["& ." + iconStaticClassName] = { | ||
position: 'relative', | ||
top: '0.125em', | ||
padding: '0 0.125em', | ||
boxSizing: 'content-box', | ||
}, _b), (weight && { fontWeight: (weight === 'semi-bold' && 600) || (weight === 'bold' && 700) || 400 }))); | ||
}, | ||
caption: { | ||
display: 'inline', | ||
}, | ||
overline: { | ||
display: 'inline', | ||
}, | ||
}); }); | ||
var weights = { | ||
regular: 400, | ||
'semi-bold': 600, | ||
bold: 700, | ||
}; | ||
var getColor = function (theme, props) { | ||
var color = props.color; | ||
if (color === undefined) { | ||
return undefined; | ||
} | ||
if (['white', 'black'].includes(color)) { | ||
return theme.palette.common[color]; | ||
} | ||
if (color.match(/^grey\.\d{3}/)) { | ||
var scale = color.split('.')[1]; | ||
return theme.palette.grey[scale] || theme.palette.grey[900]; | ||
} | ||
if ([ | ||
'primary.light', | ||
'primary.dark', | ||
'secondary.light', | ||
'secondary', | ||
'secondary.dark', | ||
'info.light', | ||
'info.dark', | ||
'success.light', | ||
'success.dark', | ||
'error.light', | ||
'error.dark', | ||
'warning.light', | ||
'warning.dark', | ||
].includes(color)) { | ||
var _a = color.split('.'), paletteKey = _a[0], variant = _a[1]; | ||
return theme.palette[paletteKey][variant]; | ||
} | ||
if (['success', 'info', 'error', 'warning', 'primary', 'secondary'].includes(color)) { | ||
return theme.palette[color].main; | ||
} | ||
if (['textPrimary', 'textSecondary'].includes(color)) { | ||
return theme.palette.text[color.slice(4).toLowerCase()]; | ||
} | ||
return undefined; | ||
}; | ||
var useTypographyStyles = styles.makeStyles(function (theme) { | ||
var _a; | ||
return ({ | ||
root: (_a = {}, | ||
_a["& ." + iconStaticClassName] = { | ||
position: 'relative', | ||
top: '0.125em', | ||
padding: '0 0.125em', | ||
boxSizing: 'content-box', | ||
}, | ||
_a.fontFamily = theme.typography.fontFamily, | ||
_a.fontWeight = function (_a) { | ||
var variant = _a.variant, weight = _a.weight; | ||
return (weight ? weights[weight] : theme.typography[variant || 'body1'].fontWeight); | ||
}, | ||
_a.fontSize = function (_a) { | ||
var variant = _a.variant; | ||
return theme.typography[variant || 'body1'].fontSize; | ||
}, | ||
_a.lineHeight = function (_a) { | ||
var variant = _a.variant; | ||
return theme.typography[variant || 'body1'].lineHeight; | ||
}, | ||
_a.textTransform = function (_a) { | ||
var variant = _a.variant; | ||
return theme.typography[variant || 'body1'].textTransform; | ||
}, | ||
_a.color = function (props) { return getColor(theme, props); }, | ||
_a), | ||
caption: { | ||
display: 'inline', | ||
}, | ||
overline: { | ||
display: 'inline', | ||
}, | ||
}); | ||
}); | ||
var variantMap = { | ||
h1: 'h1', | ||
h2: 'h2', | ||
h3: 'h3', | ||
h4: 'h4', | ||
h5: 'h5', | ||
h6: 'h6', | ||
h7: 'h6', | ||
body1: 'p', | ||
body2: 'p', | ||
subtitle1: 'h6', | ||
subtitle2: 'h6', | ||
caption: 'span', | ||
overline: 'span', | ||
}; | ||
var Typography = React.forwardRef(function (props, ref) { | ||
props.weight; var restProps = __rest(props, ["weight"]); | ||
props.weight; var _a = props.variant, variant = _a === void 0 ? 'body1' : _a; props.color; var restProps = __rest(props, ["weight", "variant", "color"]); | ||
var classes = useTypographyStyles(props); | ||
return React__default['default'].createElement(core.Typography, __assign({ ref: ref, classes: classes }, restProps)); | ||
var component = variantMap[variant]; | ||
return React__default['default'].createElement(core.Typography, __assign({ component: component, ref: ref, classes: classes }, restProps, { variant: "inherit" })); | ||
}); | ||
@@ -470,0 +549,0 @@ Typography.displayName = 'Typography'; |
{ | ||
"name": "@popmenu/common-ui", | ||
"version": "0.27.0", | ||
"version": "0.28.0", | ||
"license": "MIT", | ||
@@ -33,3 +33,3 @@ "author": "Popmenu Design System Team", | ||
"sideEffects": false, | ||
"gitHead": "9c8e2dc9096eeaa8be6eee8112bc5330d2c7ffcc" | ||
"gitHead": "e94e8b2bf58e7c2767c320311051c6f50aaa8c5f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
835455
157
2789