UNPKG

@naturacosmeticos/natds-react

Version:
45 lines 3.43 kB
"use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var react_1 = __importDefault(require("react")); var react_jss_1 = require("react-jss"); var Icon_1 = require("../Icon"); var Ripple_1 = require("../Ripple"); var Button_styles_1 = __importDefault(require("./Button.styles")); var Button = react_1.default.forwardRef(function (_a, ref) { var children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b, brand = _a.brand, _c = _a.mode, mode = _c === void 0 ? 'light' : _c, color = _a.color, _d = _a.textTransform, textTransform = _d === void 0 ? 'uppercase' : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.fullWidth, fullWidth = _f === void 0 ? false : _f, _g = _a.iconPosition, iconPosition = _g === void 0 ? 'right' : _g, onClick = _a.onClick, _h = _a.size, size = _h === void 0 ? 'semiX' : _h, testID = _a.testID, _j = _a.type, type = _j === void 0 ? 'button' : _j, _k = _a.variant, variant = _k === void 0 ? 'contained' : _k, ariaLabel = _a.ariaLabel, accessibility = _a.accessibility, rest = __rest(_a, ["children", "className", "brand", "mode", "color", "textTransform", "disabled", "fullWidth", "iconPosition", "onClick", "size", "testID", "type", "variant", "ariaLabel", "accessibility"]); var _l = (0, Button_styles_1.default)(__assign({ disabled: disabled, color: color, brand: brand, mode: mode, fullWidth: fullWidth, iconPosition: iconPosition, size: size, variant: variant, textTransform: textTransform }, rest)), button = _l.button, label = _l.label, labelContainer = _l.labelContainer; var theme = (0, react_jss_1.useTheme)(); var iconColor = theme.button[variant].color.enable.label; return (react_1.default.createElement(Ripple_1.Ripple, { brand: brand, disabled: disabled, fullWidth: fullWidth }, react_1.default.createElement("button", __assign({ className: "".concat(button, " ").concat(className, " Button-gaya"), "data-testid": testID, disabled: disabled, onClick: onClick, type: type, ref: ref, "aria-label": ariaLabel }, accessibility, rest), react_1.default.createElement("div", { className: labelContainer }, react_1.default.createElement("span", { className: label }, children), rest.showIcon && react_1.default.createElement(Icon_1.Icon, { name: rest.iconName, color: iconColor }))))); }); exports.default = Button; //# sourceMappingURL=Button.js.map