@react-md/button
Advanced tools
Comparing version 2.0.0-alpha.0 to 2.0.0-alpha.1
@@ -23,3 +23,3 @@ "use strict"; | ||
"rmd-button-contained-resting-elevation": 2, | ||
"rmd-button-contained-pressed-elevation": 8, | ||
"rmd-button-contained-pressed-elevation": 4, | ||
"rmd-button-theme-values": { | ||
@@ -26,0 +26,0 @@ "text-border-radius": "0.5rem", |
@@ -22,10 +22,13 @@ var __assign = (this && this.__assign) || function () { | ||
import React, { forwardRef, } from "react"; | ||
import { FixColorPollution, useInteractionStates, } from "@react-md/states"; | ||
import { useInteractionStates, } from "@react-md/states"; | ||
import buttonThemeClassNames from "./buttonThemeClassNames"; | ||
var Button = function (providedProps) { | ||
var _a = providedProps, theme = _a.theme, themeType = _a.themeType, buttonType = _a.buttonType, children = _a.children, forwardedRef = _a.forwardedRef, disableRipple = _a.disableRipple, disableProgrammaticRipple = _a.disableProgrammaticRipple, rippleTimeout = _a.rippleTimeout, rippleClassNames = _a.rippleClassNames, rippleClassName = _a.rippleClassName, rippleContainerClassName = _a.rippleContainerClassName, props = __rest(_a, ["theme", "themeType", "buttonType", "children", "forwardedRef", "disableRipple", "disableProgrammaticRipple", "rippleTimeout", "rippleClassNames", "rippleClassName", "rippleContainerClassName"]); | ||
var _a = providedProps, theme = _a.theme, themeType = _a.themeType, buttonType = _a.buttonType, children = _a.children, forwardedRef = _a.forwardedRef, disableRipple = _a.disableRipple, disableProgrammaticRipple = _a.disableProgrammaticRipple, rippleTimeout = _a.rippleTimeout, rippleClassNames = _a.rippleClassNames, rippleClassName = _a.rippleClassName, rippleContainerClassName = _a.rippleContainerClassName, propEnablePressedAndRipple = _a.enablePressedAndRipple, props = __rest(_a, ["theme", "themeType", "buttonType", "children", "forwardedRef", "disableRipple", "disableProgrammaticRipple", "rippleTimeout", "rippleClassNames", "rippleClassName", "rippleContainerClassName", "enablePressedAndRipple"]); | ||
var enablePressedAndRipple = typeof propEnablePressedAndRipple === "boolean" | ||
? propEnablePressedAndRipple | ||
: themeType === "contained"; | ||
var _b = useInteractionStates({ | ||
id: props.id, | ||
handlers: props, | ||
className: buttonThemeClassNames(providedProps), | ||
disabled: props.disabled, | ||
disableRipple: disableRipple, | ||
@@ -37,5 +40,6 @@ disableProgrammaticRipple: disableProgrammaticRipple, | ||
rippleContainerClassName: rippleContainerClassName, | ||
enablePressedAndRipple: enablePressedAndRipple, | ||
}), ripples = _b.ripples, className = _b.className, handlers = _b.handlers; | ||
return (React.createElement("button", __assign({}, props, handlers, { ref: forwardedRef, className: className }), | ||
React.createElement(FixColorPollution, null, children), | ||
children, | ||
ripples)); | ||
@@ -42,0 +46,0 @@ }; |
import cn from "classnames"; | ||
import { bem } from "@react-md/theme"; | ||
var block = bem("rmd-button"); | ||
/** | ||
@@ -18,14 +20,14 @@ * Creates a button theme based on the button theming props. This is really just used so that | ||
var clear = theme === "clear"; | ||
return cn("rmd-button", (_a = { | ||
"rmd-button--text": text, | ||
"rmd-button--icon": icon, | ||
"rmd-button--disabled": disabled, | ||
"rmd-button--contained": !disabled && contained, | ||
"rmd-button--outline": outline | ||
return cn(block((_a = { | ||
text: text, | ||
icon: icon, | ||
disabled: disabled, | ||
contained: !disabled && contained, | ||
outline: outline | ||
}, | ||
_a["rmd-button--" + theme] = !disabled && !clear && contained, | ||
_a["rmd-button--text-" + theme] = !disabled && !clear && !contained, | ||
_a["rmd-button--outline-" + theme] = !disabled && !clear && outline, | ||
_a), className); | ||
_a[theme] = !disabled && !clear && contained, | ||
_a["text-" + theme] = !disabled && !clear && !contained, | ||
_a["outline-" + theme] = !disabled && !clear && outline, | ||
_a)), className); | ||
} | ||
//# sourceMappingURL=buttonThemeClassNames.js.map |
@@ -37,7 +37,10 @@ "use strict"; | ||
var Button = function (providedProps) { | ||
var _a = providedProps, theme = _a.theme, themeType = _a.themeType, buttonType = _a.buttonType, children = _a.children, forwardedRef = _a.forwardedRef, disableRipple = _a.disableRipple, disableProgrammaticRipple = _a.disableProgrammaticRipple, rippleTimeout = _a.rippleTimeout, rippleClassNames = _a.rippleClassNames, rippleClassName = _a.rippleClassName, rippleContainerClassName = _a.rippleContainerClassName, props = __rest(_a, ["theme", "themeType", "buttonType", "children", "forwardedRef", "disableRipple", "disableProgrammaticRipple", "rippleTimeout", "rippleClassNames", "rippleClassName", "rippleContainerClassName"]); | ||
var _a = providedProps, theme = _a.theme, themeType = _a.themeType, buttonType = _a.buttonType, children = _a.children, forwardedRef = _a.forwardedRef, disableRipple = _a.disableRipple, disableProgrammaticRipple = _a.disableProgrammaticRipple, rippleTimeout = _a.rippleTimeout, rippleClassNames = _a.rippleClassNames, rippleClassName = _a.rippleClassName, rippleContainerClassName = _a.rippleContainerClassName, propEnablePressedAndRipple = _a.enablePressedAndRipple, props = __rest(_a, ["theme", "themeType", "buttonType", "children", "forwardedRef", "disableRipple", "disableProgrammaticRipple", "rippleTimeout", "rippleClassNames", "rippleClassName", "rippleContainerClassName", "enablePressedAndRipple"]); | ||
var enablePressedAndRipple = typeof propEnablePressedAndRipple === "boolean" | ||
? propEnablePressedAndRipple | ||
: themeType === "contained"; | ||
var _b = states_1.useInteractionStates({ | ||
id: props.id, | ||
handlers: props, | ||
className: buttonThemeClassNames_1.default(providedProps), | ||
disabled: props.disabled, | ||
disableRipple: disableRipple, | ||
@@ -49,5 +52,6 @@ disableProgrammaticRipple: disableProgrammaticRipple, | ||
rippleContainerClassName: rippleContainerClassName, | ||
enablePressedAndRipple: enablePressedAndRipple, | ||
}), ripples = _b.ripples, className = _b.className, handlers = _b.handlers; | ||
return (react_1.default.createElement("button", __assign({}, props, handlers, { ref: forwardedRef, className: className }), | ||
react_1.default.createElement(states_1.FixColorPollution, null, children), | ||
children, | ||
ripples)); | ||
@@ -54,0 +58,0 @@ }; |
@@ -7,2 +7,4 @@ "use strict"; | ||
var classnames_1 = __importDefault(require("classnames")); | ||
var theme_1 = require("@react-md/theme"); | ||
var block = theme_1.bem("rmd-button"); | ||
/** | ||
@@ -24,15 +26,15 @@ * Creates a button theme based on the button theming props. This is really just used so that | ||
var clear = theme === "clear"; | ||
return classnames_1.default("rmd-button", (_a = { | ||
"rmd-button--text": text, | ||
"rmd-button--icon": icon, | ||
"rmd-button--disabled": disabled, | ||
"rmd-button--contained": !disabled && contained, | ||
"rmd-button--outline": outline | ||
return classnames_1.default(block((_a = { | ||
text: text, | ||
icon: icon, | ||
disabled: disabled, | ||
contained: !disabled && contained, | ||
outline: outline | ||
}, | ||
_a["rmd-button--" + theme] = !disabled && !clear && contained, | ||
_a["rmd-button--text-" + theme] = !disabled && !clear && !contained, | ||
_a["rmd-button--outline-" + theme] = !disabled && !clear && outline, | ||
_a), className); | ||
_a[theme] = !disabled && !clear && contained, | ||
_a["text-" + theme] = !disabled && !clear && !contained, | ||
_a["outline-" + theme] = !disabled && !clear && outline, | ||
_a)), className); | ||
} | ||
exports.default = buttonThemeClassNames; | ||
//# sourceMappingURL=buttonThemeClassNames.js.map |
{ | ||
"name": "@react-md/button", | ||
"version": "2.0.0-alpha.0", | ||
"version": "2.0.0-alpha.1", | ||
"description": "This package is used to create buttons with the material design spec. There is built-in support to be able to render accessible clickable divs that look like buttons, or even apply button styles to any element.", | ||
@@ -34,8 +34,8 @@ "scripts": { | ||
"dependencies": { | ||
"@react-md/elevation": "^2.0.0-alpha.0", | ||
"@react-md/icon": "^2.0.0-alpha.0", | ||
"@react-md/states": "^2.0.0-alpha.0", | ||
"@react-md/theme": "^2.0.0-alpha.0", | ||
"@react-md/typography": "^2.0.0-alpha.0", | ||
"@react-md/utils": "^2.0.0-alpha.0", | ||
"@react-md/elevation": "^2.0.0-alpha.1", | ||
"@react-md/icon": "^2.0.0-alpha.1", | ||
"@react-md/states": "^2.0.0-alpha.1", | ||
"@react-md/theme": "^2.0.0-alpha.1", | ||
"@react-md/typography": "^2.0.0-alpha.1", | ||
"@react-md/utils": "^2.0.0-alpha.1", | ||
"classnames": "^2.2.6" | ||
@@ -52,3 +52,3 @@ }, | ||
}, | ||
"gitHead": "cc5de21740e62c1fd5da8f832f562c48eb028717" | ||
"gitHead": "9197bcdf38df3cff304499431696dc8e950b4b17" | ||
} |
import cn from "classnames"; | ||
import { bem } from "@react-md/theme"; | ||
import { ButtonThemeProps } from "./types.d"; | ||
const block = bem("rmd-button"); | ||
/** | ||
@@ -28,15 +31,14 @@ * Creates a button theme based on the button theming props. This is really just used so that | ||
return cn( | ||
"rmd-button", | ||
{ | ||
"rmd-button--text": text, | ||
"rmd-button--icon": icon, | ||
"rmd-button--disabled": disabled, | ||
"rmd-button--contained": !disabled && contained, | ||
"rmd-button--outline": outline, | ||
[`rmd-button--${theme}`]: !disabled && !clear && contained, | ||
[`rmd-button--text-${theme}`]: !disabled && !clear && !contained, | ||
[`rmd-button--outline-${theme}`]: !disabled && !clear && outline, | ||
}, | ||
block({ | ||
text, | ||
icon, | ||
disabled, | ||
contained: !disabled && contained, | ||
outline, | ||
[theme]: !disabled && !clear && contained, | ||
[`text-${theme}`]: !disabled && !clear && !contained, | ||
[`outline-${theme}`]: !disabled && !clear && outline, | ||
}), | ||
className | ||
); | ||
} |
@@ -21,3 +21,3 @@ /** this is an auto-generated file from @react-md/dev-utils */ | ||
"rmd-button-contained-resting-elevation": 2, | ||
"rmd-button-contained-pressed-elevation": 8, | ||
"rmd-button-contained-pressed-elevation": 4, | ||
"rmd-button-theme-values": { | ||
@@ -24,0 +24,0 @@ "text-border-radius": "0.5rem", |
@@ -10,3 +10,3 @@ import React, { ReactNode, HTMLAttributes } from "react"; | ||
*/ | ||
export interface ButtonProps extends ButtonThemeProps, Omit<HTMLAttributes<HTMLButtonElement>, "id">, Omit<InteractionStatesOptions<HTMLButtonElement>, "disableSpacebarClick"> { | ||
export interface ButtonProps extends ButtonThemeProps, HTMLAttributes<HTMLButtonElement>, Omit<InteractionStatesOptions<HTMLButtonElement>, "disableSpacebarClick"> { | ||
/** | ||
@@ -13,0 +13,0 @@ * The button's type attribute. This is set to "button" by default so that forms are not |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
2
100812
42
981
1
+ Added@babel/runtime@7.26.9(transitive)
+ Added@types/react@19.0.9(transitive)
- Removed@babel/runtime@7.26.7(transitive)
- Removed@types/react@19.0.8(transitive)