@eduzz/houston
Advanced tools
Comparing version 0.0.40 to 0.0.41
import * as React from 'react'; | ||
import { AlertProps, Color } from '@material-ui/lab/Alert'; | ||
import { IButtonType } from '../Button'; | ||
declare type AlertPropsExtends = 'id' | 'className' | 'style' | 'children' | 'severity' | 'onClose' | 'icon'; | ||
declare type IActions = { | ||
label: React.ReactNode; | ||
onClick: () => void; | ||
type: IButtonType; | ||
}; | ||
interface IButtonProps extends Pick<AlertProps, AlertPropsExtends> { | ||
type?: Color; | ||
title?: React.ReactNode; | ||
actions: IActions[]; | ||
} | ||
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IButtonProps & React.RefAttributes<HTMLButtonElement>>>; | ||
export default _default; |
@@ -7,10 +7,24 @@ "use strict"; | ||
var Alert_1 = require("@material-ui/lab/Alert"); | ||
var AlertTitle_1 = require("@material-ui/lab/AlertTitle"); | ||
var Button_1 = require("../Button"); | ||
var context_1 = require("../ThemeProvider/context"); | ||
var useStyles = styles_1.makeStyles(function () { | ||
return styles_1.createStyles({ | ||
controlButtons: { | ||
'& button': { | ||
marginRight: 8 | ||
} | ||
} | ||
}); | ||
}); | ||
var Alert = React.forwardRef(function (props, ref) { | ||
var theme = context_1.useTheme(); | ||
var id = props.id, className = props.className, children = props.children, style = props.style, _a = props.type, type = _a === void 0 ? 'success' : _a, icon = props.icon; | ||
var buttonProps = { id: id, className: className, style: style, severity: type, icon: icon }; | ||
var classes = useStyles(); | ||
var id = props.id, className = props.className, children = props.children, style = props.style, _a = props.type, type = _a === void 0 ? 'success' : _a, icon = props.icon, title = props.title, onClose = props.onClose, actions = props.actions; | ||
var buttonProps = { id: id, className: className, style: style, severity: type, icon: icon, onClose: onClose }; | ||
return (React.createElement(styles_1.ThemeProvider, { theme: theme }, | ||
React.createElement(Alert_1.default, tslib_1.__assign({}, buttonProps, { ref: ref }), children))); | ||
React.createElement(Alert_1.default, tslib_1.__assign({}, buttonProps, { ref: ref, action: actions.length ? (React.createElement("div", { className: classes.controlButtons }, actions.map(function (act, index) { return (React.createElement(Button_1.default, { type: act.type, onClick: act.onClick, key: "action-" + index }, act.label)); }))) : null }), | ||
title && React.createElement(AlertTitle_1.default, null, title), | ||
children))); | ||
}); | ||
exports.default = React.memo(Alert); |
import * as React from 'react'; | ||
import { ButtonProps } from '@material-ui/core/Button'; | ||
declare type ButtonPropsExtends = 'id' | 'className' | 'style' | 'onClick' | 'disabled' | 'startIcon' | 'href' | 'endIcon' | 'children' | 'fullWidth'; | ||
export declare type IButtonType = 'primary' | 'secondary' | 'text'; | ||
interface IButtonProps extends Pick<ButtonProps, ButtonPropsExtends> { | ||
@@ -12,3 +13,3 @@ /** | ||
*/ | ||
type?: 'primary' | 'secondary' | 'text'; | ||
type?: IButtonType; | ||
loading?: boolean; | ||
@@ -15,0 +16,0 @@ } |
@@ -98,22 +98,25 @@ "use strict"; | ||
}, | ||
MuiAlertTitle: { | ||
root: { | ||
fontWeight: 600 | ||
} | ||
}, | ||
MuiAlert: { | ||
root: { | ||
borderRadius: 4, | ||
color: '#37474F' | ||
borderRadius: 4 | ||
}, | ||
message: { | ||
fontWeight: 600 | ||
}, | ||
standardSuccess: { | ||
backgroundColor: '#D2EBD3', | ||
color: '#37474F' | ||
backgroundColor: '#D2EBD3' | ||
}, | ||
standardError: { | ||
backgroundColor: '#FDD9D7', | ||
color: '#37474F' | ||
backgroundColor: '#FDD9D7' | ||
}, | ||
standardInfo: { | ||
backgroundColor: '#CDEBFA', | ||
color: '#37474F' | ||
backgroundColor: '#CDEBFA' | ||
}, | ||
standardWarning: { | ||
backgroundColor: '#FFF4D4', | ||
color: '#37474F' | ||
backgroundColor: '#FFF4D4' | ||
} | ||
@@ -120,0 +123,0 @@ } |
{ | ||
"name": "@eduzz/houston", | ||
"description": "Eduzz Components UI", | ||
"version": "0.0.40", | ||
"version": "0.0.41", | ||
"main": "./index.js", | ||
@@ -6,0 +6,0 @@ "types": "./index.d.ts", |
20212
456