This commit adds the ripple maximum radius API to match the inkMaxRippleRadius API that are soon to be deprecated. This also moves those APIs to a "ToBeDeprecated" category. In this commit I set an ivar instead of having pass through properties because in a follow up I think it would be a good optimization to have the ripple be lazy until a user interacts with the button. This will lower initialization time and make the setters potentially faster. Since we don't have pass through properties I defaulted it to 0 to match the legacy API from `MDCStatefulRippleView` to match here.
PiperOrigin-RevId: 323011293
This commit adds the ripple color and ripple style APIs to match the inkColor and inkStyle APIs that are soon to be deprecated. This also moves those APIs to a "ToBeDeprecated" category. In this commit I set an ivar instead of having pass through properties because in a follow up I think it would be a good optimization to have the ripple be lazy until a user interacts with the button. This will lower initialization time and make the setters potentially faster. Since we don't have pass through properties I mirrored the default rippleColor from `MDCStatefulRippleView` to match here.
PiperOrigin-RevId: 322585578
Currently we make the ripple the entire size of the button. This limits clients being able to customize if the ripple is inset or outset on a particular side of the button. Since MDCFloatingButton sets its contentEdgeInsets this API is needed to allow for the two values to be independent.
https://developer.apple.com/documentation/uikit/uibutton/1624036-contentedgeinsets
PiperOrigin-RevId: 322199718
Like the MDCButton, this is opt-in, and the dictionary for the visibleAreaInsets per mode/shape combination is initially empty.
PiperOrigin-RevId: 315152916
This API allows clients to inset the visible content and allow it to be smaller than the frame.
In turn, clients can have a touch target that is bigger than the visible content.
PiperOrigin-RevId: 313556504
Note: MDCButton does not enable pointer interactivity by default.
This also adds an example to demonstrate MDCButtons with the default UIPointerInteraction enabled. The example exposes an issue with MDCFloatButton's collapse/expand animations (b/153666859), which will be addressed in a future CL.
PiperOrigin-RevId: 305872547
We recommend using `initWithDefaults` and we should follow the recommendation. This change removes all usage of `init` within MDC components in order to let us remove that initializer from the public surface.
PiperOrigin-RevId: 302958447
Introduces a new API to disable the `titleFont:forState:` APIs. This is the
first step toward removing those APIs.
State-based fonts make it impossible to support UIContentSizeCategoryAdjusting
behavior on the button's `titleLabel`. Providing support for automatic font
resizing for Dynamic Type means removing state-based font APIs.
Part of #8595
As part of our work of adding traitCollectionDidChangeBlocks to components, we add self as a parameter to the block, buttons is the only component that seems to be missing it.
This is essentially a breaking change based on our breaking changes conventions.
Updates the BUILD file to use more Starlark macros. This makes it easier to
perform releases. Also fixes a test import so `includes` amendments aren't
required.
Part of #8150
This change adds dynamic color support to MDCButton. Before this MDCButton wouldn't update its shadowColor in the proper methods causing it to not support Dark Mode properly. This change updates it to call updateShadowColor in layoutSubviews additionally there is a test added for iOS 13+.
This changes adds support for `inkMaxRippleRadius` when `enableRippleBehavior` is set to `YES`. This was previously not added because Ripple didn't support `maximumRadius` when it was integrated in `Buttons` in #7087. Since `maximumRadius` was added in #7357 this should now be set in Buttons. The getter was removed from Buttons since this is currently setting two properties and then returning one. When we remove ink this could potentially cause a problem if we didn't update the getter. By setting an ivar this should help protect us against our future selfs when ink is removed.
The `titleFontForState:` API did not correctly reflect the rendered font
when no explicit fonts were set via the MDCButton APIs. As a result,
calling `updateTitleFont` internally could result in a different font
being returned than what was displayed.
Moving the "fall back" and Dynamic Type behavior into the
`titleFontForState:` method allows more consistent behavior (reduces the
risk of deviations) and corrects the APIs to reflect what is rendered.
This change should result in no visible changes to clients (the rendered
fonts should remain the same), but will result in non-`nil` results
being returned from `titleFontForState:` to correctly reflect the
rendered font for a given state.
Part of #7492
This change reverts the changes in #7466
This change deviates from the rest of our components therefore we are reverting it to bring buttons into alignment with our other components.
## Motivation
The possible code paths for the legacy dynamic type when there are no scaling curves associated with a font are as follows
#### Case 1
```swift
button.mdc_adjustsFontForContentSizeCategory = true
button.adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable = true
// This should update the font use the legacy *magic* font
```
#### Case 2
```swift
button.adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable = true
button.mdc_adjustsFontForContentSizeCategory = true
// This should update the font use the legacy *magic* font
```
#### Case 3
```swift
button.adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable = false
button.mdc_adjustsFontForContentSizeCategory = true
// This should *not* update the font use the legacy *magic* font
```
#### Case 4
```swift
button.mdc_adjustsFontForContentSizeCategory = true
button.adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable = false
// This should *not* update the font use the legacy *magic* font
```
Currently we only cover cases 1-3, but it's reasonable for a client to get into _Case 4_, this requires a setter for `adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable` to _undo_ **magic** behavior if the **magic** behavior has been applied.
## Detailed changes
This change adds a setter to `adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable` to update the fonts accordingly and _undo_ any changes done to the component.
Related to #7464
## Motivation
As a team we have decided that `mdc_legacyFontScaling` isn't the correct name for what the flag actually does. We have decided to change the name to `adjustFontForContentSizeCategoryWhenScaledFontIsUnavailable` is a more accurate name.
## Detailed changes
- Deprecate the older API `mdc_legacyFontScaling` so we can delete it in the upcoming release.
- Add API for `adjustFontForContentSizeCategoryWhenScaledFontIsUnavailable`
- Update the getter and setter for `mdc_legacyFontScaling` to mirror `adjustFontForContentSizeCategoryWhenScaledFontIsUnavailable`
Fixing programmatic interface of buttons to correctly set the Ripple highlighted and select state.
### Description
Buttons do not change the ripple state correctly when their selected or highlighted states are updated programmatically. To fix this issue, we're updating the RippleViews's highlighted and selected states to match the button's highlighted and selected states.
Steps to reproduce the highlighted state issued:
1. set: button.isHighlighted = true
Expected: button is highlighted (background is light blue)
Outcome: button is not highlighted (background is white)
Steps to reproduce the selected state issued:
1. set: button.isSelected = true
Expected: button is selected (background is light blue)
Outcome: button is not selected (background is white)
Before:

After:

### Issue
b/128908676
Issue: https://github.com/material-components/material-components-ios/issues/7342
## Motivation
In working on #7390 it was discovered that the _outline_ theme for `MDCButton` was not theming the icon. This change now sets the correct values in the theming extension.
## Detailed changes
*imageTintColor* This wasn't being set and now is being set to the correct value
*inkColor* This is now being set to the correct value, previously this was the wrong value
Formatting changes also
## Alternatives
I elected not to change the Themer object because that will soon be deprecated and we need to move off of it. This copies what was in the themer where applicable and updates the needed changes.
Closes#7400
## Motivation
As outlined in #5919 many of our `forState:` APIs don't match what `UIButton` is doing. This addresses that problem for our `titleFont` API. This updates the fallback behavior. Additionally this will help facilitate #7388.
## Test
In other test similar to this one we update a `UIButton` with a `UIColor` to make sure the colors match for a given state in given conditions, since `UIButton` doesn't have any `forState` APIs that set a font we can't test this as easily. Also this follows the same pattern outlined in the other PRs to address this issue.
This PR graduates ContainerScheme to ready.
This includes updating the podspecs, podfile, all the import statements related to ContainerScheme, updating .kokoro rewrite rules, and finally the readme to not have ContainerScheme regarded to as being in beta.
Ran locally kokoro with -b bazel successfully.
Resolves#6732