@eduzz/houston
Advanced tools
Comparing version 0.0.17 to 0.0.18
@@ -13,4 +13,5 @@ import * as React from 'react'; | ||
type: 'primary' | 'secondary' | 'text'; | ||
loading?: boolean; | ||
} | ||
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IButtonProps & React.RefAttributes<HTMLButtonElement>>>; | ||
export default _default; |
@@ -6,5 +6,9 @@ "use strict"; | ||
var Button_1 = require("@material-ui/core/Button"); | ||
var CircularProgress_1 = require("@material-ui/core/CircularProgress"); | ||
var styles_1 = require("@material-ui/core/styles"); | ||
var context_1 = require("../ThemeProvider/context"); | ||
var Button = React.forwardRef(function (props, ref) { | ||
var className = props.className, children = props.children, style = props.style, onClick = props.onClick, disabled = props.disabled, startIcon = props.startIcon, type = props.type, href = props.href, endIcon = props.endIcon, fullWidth = props.fullWidth, id = props.id; | ||
var buttonProps = { className: className, style: style, onClick: onClick, disabled: disabled, startIcon: startIcon, href: href, endIcon: endIcon, fullWidth: fullWidth, id: id }; | ||
var theme = context_1.useTheme(); | ||
var className = props.className, children = props.children, style = props.style, onClick = props.onClick, disabled = props.disabled, startIcon = props.startIcon, type = props.type, href = props.href, endIcon = props.endIcon, fullWidth = props.fullWidth, id = props.id, loading = props.loading; | ||
var buttonProps = { className: className, style: style, onClick: onClick, disabled: disabled, startIcon: startIcon, href: href, endIcon: endIcon, fullWidth: fullWidth, id: id, loading: loading }; | ||
var variantMap = { | ||
@@ -15,4 +19,5 @@ primary: 'contained', | ||
var variant = variantMap[type] || 'text'; | ||
return (React.createElement(Button_1.default, tslib_1.__assign({}, buttonProps, { variant: variant, color: 'primary', ref: ref }), children)); | ||
return (React.createElement(styles_1.ThemeProvider, { theme: theme }, | ||
React.createElement(Button_1.default, tslib_1.__assign({}, buttonProps, { startIcon: loading ? React.createElement(CircularProgress_1.default, { size: 20 }) : startIcon, variant: variant, color: 'primary', ref: ref }), children))); | ||
}); | ||
exports.default = React.memo(Button); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var React = require("react"); | ||
var styles_1 = require("@material-ui/core/styles"); | ||
var context_1 = require("./context"); | ||
var custom_1 = require("./custom"); | ||
@@ -23,4 +23,4 @@ function ThemeProvider(props) { | ||
return null; | ||
return React.createElement(styles_1.ThemeProvider, { theme: theme }, children); | ||
return React.createElement(context_1.default, { value: theme }, children); | ||
} | ||
exports.default = ThemeProvider; |
{ | ||
"name": "@eduzz/houston", | ||
"description": "Eduzz Components UI", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"main": "./index.js", | ||
@@ -18,3 +18,4 @@ "types": "./index.d.ts", | ||
"scripts": { | ||
"build": "git clean -f -x && tsc -p .", | ||
"clean": "git clean -f -x", | ||
"build": "yarn clean && tsc -p .", | ||
"prepare": "yarn build", | ||
@@ -32,7 +33,8 @@ "lint": "yarn eslint \"./**/*.ts\" \"./**/*.tsx\"" | ||
"@material-ui/styles": "^4.10.0", | ||
"react": "^16.13.1", | ||
"typescript": "^4.0.3" | ||
"react": "^16.13.1" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.13.1" | ||
"@material-ui/core": ">=4", | ||
"@material-ui/styles": ">=4", | ||
"react": ">=16.8.0" | ||
}, | ||
@@ -50,5 +52,7 @@ "devDependencies": { | ||
"eslint-plugin-react-hooks": "4.1.2", | ||
"eslint-plugin-unused-imports": "^0.1.3", | ||
"husky": "^4.3.0", | ||
"prettier": "^2.1.2" | ||
"prettier": "^2.1.2", | ||
"typescript": "^4.0.3" | ||
} | ||
} |
21025
26
645
6
14
- Removedtypescript@^4.0.3
- Removedtypescript@4.9.5(transitive)