Files
Brandy Carney 94159291b2 feat(components): improve button states and add new css properties (#19440)
Before users had to know the exact opacity that the MD/iOS spec called for in order to change the hover or focused background color. This allows them to change the background without having to know the opacity. 

- changes apply to Action Sheet (Buttons), Back Button, Button, FAB Button, Item, Menu Button, Segment Button, Tab Button
- greatly reduces the requirement by users to set the background hover, focused states for dark modes and custom themes, also eliminates the need to know what the hover opacity is for each based on the spec
- updates the MD dark theme per their spec
- adds a component guide for internal use changing Ionic components

references #18279 fixes #20213 fixes #19965

BREAKING CHANGE:

*Activated Class*

The `activated` class that is automatically added to buttons on press has been renamed to `ion-activated`. This will be more consistent with our `ion-focused` class we add and also will reduce conflicts with user's CSS.

*CSS Variables*

The `--background-hover`, `--background-focused` and `--background-activated` CSS variables on components that render native buttons will now have an opacity automatically set. If you are setting any of these like the following:

```
--background-hover: rgba(44, 44, 44, 0.08);
```

You will likely not see a hover state anymore. It should be updated to only set the desired color:

```
--background-hover: rgba(44, 44, 44);
```

If the opacity desired is something other than what the spec asks for, use:

```
--background-hover: rgba(44, 44, 44);
--background-hover-opacity: 1;
```
2020-01-23 16:57:47 -05:00

40 lines
813 B
SCSS

@import "../../themes/ionic.globals.md";
@import "./menu-button";
// MD Menu Button
// --------------------------------------------------
:host {
--background-focused: currentColor;
--background-focused-opacity: .12;
--background-hover: currentColor;
--background-hover-opacity: .04;
--border-radius: 50%;
--color: initial;
--padding-start: 8px;
--padding-end: 8px;
width: 48px;
height: 48px;
font-size: 24px;
}
// Menu Button Color: Focused
// --------------------------------------------------
:host(.ion-color.ion-focused)::after {
background: #{current-color(base)};
}
// Menu Button Color: Hover
// --------------------------------------------------
@media (any-hover: hover) {
:host(.ion-color:hover) .button-native::after {
background: #{current-color(base)};
}
}