@@ -18,15 +18,15 @@ const commonButtonStyles = styled.css`
1818 display: inline-flex;
1919 align-items: center;
2020 justify-content: center;
21- height: ${ ( { size = "md" } ) => system . blockSizes [ size ] } ;
22- width: ${ ( { fullWidth, size = "md" , square } ) => fullWidth ? "100%" : square ? system . blockSizes [ size ] : "auto" } ;
23- padding: ${ ( { square } ) => square ? 0 : `0 10px` } ;
21+ height: ${ ( { $ size = "md" } ) => system . blockSizes [ $ size] } ;
22+ width: ${ ( { $ fullWidth, $ size = "md" , $ square } ) => $ fullWidth ? "100%" : $ square ? system . blockSizes [ $ size] : "auto" } ;
23+ padding: ${ ( { $ square } ) => $ square ? 0 : `0 10px` } ;
2424 font-size: 1rem;
2525 user-select: none;
2626 &:active {
27- padding-top: ${ ( { disabled } ) => ! disabled && "2px" } ;
27+ padding-top: ${ ( { $ disabled } ) => ! $ disabled && "2px" } ;
2828 }
29- padding-top: ${ ( { active, disabled } ) => active && ! disabled && "2px" } ;
29+ padding-top: ${ ( { $ active, $ disabled } ) => $ active && ! $ disabled && "2px" } ;
3030 &:after {
3131 content: '';
3232 position: absolute;
@@ -42,9 +42,9 @@ const commonButtonStyles = styled.css`
4242 font-family: inherit;
4343` ;
4444const StyledButton = styled__default [ "default" ] . button `
45- ${ ( { active, disabled, primary, theme, variant } ) => variant === "flat" ? styled . css `
45+ ${ ( { $ active, $ disabled, $ primary, theme, $ variant } ) => $ variant === "flat" ? styled . css `
4646 ${ index . createFlatBoxStyles ( ) }
47- ${ primary ? `
47+ ${ $ primary ? `
4848 border: 2px solid ${ theme . checkmark } ;
4949 outline: 2px solid ${ theme . flatDark } ;
5050 outline-offset: -4px;
@@ -54,74 +54,74 @@ const StyledButton = styled__default["default"].button`
5454 outline-offset: -4px;
5555 ` }
5656 &:focus:after, &:active:after {
57- ${ ! active && ! disabled && index . focusOutline }
57+ ${ ! $ active && ! $ disabled && index . focusOutline }
5858 outline-offset: -4px;
5959 }
60- ` : variant === "menu" || variant === "thin" ? styled . css `
61- ${ index . createBoxStyles ( ) } ;
62- border: 2px solid transparent;
63- &:hover,
64- &:focus {
65- ${ ! disabled && ! active && index . createBorderStyles ( { style : "buttonThin" } ) }
66- }
67- &:active {
68- ${ ! disabled && index . createBorderStyles ( { style : "buttonThinPressed" } ) }
69- }
70- ${ active && index . createBorderStyles ( { style : "buttonThinPressed" } ) }
71- ${ disabled && index . createDisabledTextStyles ( ) }
72- ` : styled . css `
73- ${ index . createBoxStyles ( ) } ;
74- border: none;
75- ${ disabled && index . createDisabledTextStyles ( ) }
76- ${ active ? index . createHatchedBackground ( {
60+ ` : $ variant === "menu" || $ variant === "thin" ? styled . css `
61+ ${ index . createBoxStyles ( ) } ;
62+ border: 2px solid transparent;
63+ &:hover,
64+ &:focus {
65+ ${ ! $ disabled && ! $ active && index . createBorderStyles ( { style : "buttonThin" } ) }
66+ }
67+ &:active {
68+ ${ ! $ disabled && index . createBorderStyles ( { style : "buttonThinPressed" } ) }
69+ }
70+ ${ $ active && index . createBorderStyles ( { style : "buttonThinPressed" } ) }
71+ ${ $ disabled && index . createDisabledTextStyles ( ) }
72+ ` : styled . css `
73+ ${ index . createBoxStyles ( ) } ;
74+ border: none;
75+ ${ $ disabled && index . createDisabledTextStyles ( ) }
76+ ${ $ active ? index . createHatchedBackground ( {
7777 mainColor : theme . material ,
7878 secondaryColor : theme . borderLightest
7979} ) : "" }
8080 &:before {
81- box-sizing: border-box;
82- content: '';
83- position: absolute;
84- ${ primary ? styled . css `
85- left: 2px;
86- top: 2px;
87- width: calc(100% - 4px);
88- height: calc(100% - 4px);
89- outline: 2px solid ${ theme . borderDarkest } ;
90- ` : styled . css `
91- left: 0;
92- top: 0;
93- width: 100%;
94- height: 100%;
95- ` }
81+ box-sizing: border-box;
82+ content: '';
83+ position: absolute;
84+ ${ $ primary ? styled . css `
85+ left: 2px;
86+ top: 2px;
87+ width: calc(100% - 4px);
88+ height: calc(100% - 4px);
89+ outline: 2px solid ${ theme . borderDarkest } ;
90+ ` : styled . css `
91+ left: 0;
92+ top: 0;
93+ width: 100%;
94+ height: 100%;
95+ ` }
9696
97- ${ active ? index . createBorderStyles ( {
98- style : variant === "raised" ? "window" : "button" ,
97+ ${ $ active ? index . createBorderStyles ( {
98+ style : $ variant === "raised" ? "window" : "button" ,
9999 invert : true
100100} ) : index . createBorderStyles ( {
101- style : variant === "raised" ? "window" : "button" ,
101+ style : $ variant === "raised" ? "window" : "button" ,
102102 invert : false
103103} ) }
104- }
105- &:active:before {
106- ${ ! disabled && index . createBorderStyles ( {
107- style : variant === "raised" ? "window" : "button" ,
104+ }
105+ &:active:before {
106+ ${ ! $ disabled && index . createBorderStyles ( {
107+ style : $ variant === "raised" ? "window" : "button" ,
108108 invert : true
109109} ) }
110- }
111- &:focus:after,
112- &:active:after {
113- ${ ! disabled && index . focusOutline }
114- outline-offset: -8px;
115- }
116- &:active:focus:after,
117- &:active:after {
118- top: ${ active ? "0" : "1px" } ;
119- }
120- ` }
110+ }
111+ &:focus:after,
112+ &:active:after {
113+ ${ ! $ disabled && index . focusOutline }
114+ outline-offset: -8px;
115+ }
116+ &:active:focus:after,
117+ &:active:after {
118+ top: ${ $ active ? "0" : "1px" } ;
119+ }
120+ ` }
121121 ${ commonButtonStyles }
122122` ;
123123const Button = React . forwardRef ( ( { onClick, disabled = false , children, type = "button" , fullWidth = false , size = "md" , square = false , active = false , onTouchStart = index$1 . noOp , primary = false , variant = "default" , ...otherProps } , ref ) => {
124- return React__default [ "default" ] . createElement ( StyledButton , { active, disabled, "$disabled" : disabled , fullWidth, onClick : disabled ? void 0 : onClick , onTouchStart, primary, ref, size, square, type, variant, ...otherProps } , children ) ;
124+ return React__default [ "default" ] . createElement ( StyledButton , { "$ active" : active , disabled, "$disabled" : disabled , "$ fullWidth" : fullWidth , onClick : disabled ? void 0 : onClick , onTouchStart, "$ primary" : primary , ref, "$ size" : size , "$ square" : square , type, "$variant" : variant , ...otherProps } , children ) ;
125125} ) ;
126126Button . displayName = "Button" ;
127127
0 commit comments