547 Commits

Author SHA1 Message Date
Jeff Verkoeyen
fbb1f20aa2 Internal change
PiperOrigin-RevId: 332151481
2020-09-16 21:01:21 -07:00
Bryan Oltman
da4b8f7c7f Fix mdc_elevationDidChangeBlock block parameter types for Xcode 12
PiperOrigin-RevId: 331843566
2020-09-15 13:39:15 -07:00
Yarden Eitan
8d7bc88a11 [Ink] Official deprecation of Ink.
Please use the Ripple component.

PiperOrigin-RevId: 329771765
2020-09-02 13:07:40 -07:00
Bryan Oltman
91a2953b0d Add isPointerInteractionEnabled availability check.
There are still some iOS 13.4 betas floating around that had not yet introduced this API. This
change should prevent those users from crashing when attempting to get/set this value.

PiperOrigin-RevId: 326248791
2020-08-12 09:38:07 -07:00
Andrew Overton
07c46757cc Replace material.io API doc links with links to the relevant header f…
This PR replaces API links containing "/api-docs/" with links to suitable header files in GitHub because the site previously linked to is being taken down and replaced with something that won't handle API docs.

Closes https://github.com/material-components/material-components-ios/pull/10045

COPYBARA_INTEGRATE_REVIEW=https://github.com/material-components/material-components-ios/pull/10045 from andrewoverton:replace-mio-api-docs-with-github-links 0d6e56cc11d0c147366a4f6cde829d8b51567ecc
PiperOrigin-RevId: 323424362
2020-07-27 13:09:23 -07:00
Cody Weaver
2a5996b407 [MDC/Button] Add rippleMaximumRadius API.
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
2020-07-24 09:34:26 -07:00
Cody Weaver
9039d47602 [MDC/Button] Add rippleColor and rippleStyle APIs
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
2020-07-22 09:05:16 -07:00
Bryan Oltman
7b45e787db [Buttons] Remove unused TitleColorAccessibilityMutator.
PiperOrigin-RevId: 322411522
2020-07-21 12:05:57 -07:00
Nobody
3132beea79 Fix lint error UppercaseAttributedString in MDCButton
PiperOrigin-RevId: 322291368
2020-07-20 22:04:31 -07:00
Cody Weaver
330125967a [MDC/Button] Add rippleEdgeInsets API.
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
2020-07-20 12:28:27 -07:00
Wenyu Zhang
222ae37fc9 [Floating Button] Add centerVisibleArea support for the FAB and deprecate visibleAreaMode
API.

PiperOrigin-RevId: 320291504
2020-07-08 16:44:05 -07:00
Wenyu Zhang
2207b7a7d4 [Buttons] Add safeguard to avoid overwriting centerVisibleArea with the same value.
PiperOrigin-RevId: 320256945
2020-07-08 13:46:46 -07:00
Wenyu Zhang
59c44fb3bd [Buttons] Add centerVisibleArea to MDCButton and mark visibleAreaInsets as to be deprecated.
PiperOrigin-RevId: 320085469
2020-07-07 16:36:33 -07:00
Jeff Verkoeyen
89477800f1 [Buttons] Mark more apis as to-be-deprecated.
PiperOrigin-RevId: 318505046
2020-06-26 11:05:16 -07:00
Jake Rockland
df6658771a Expose defaultContentEdgeInsets readonly property on MDCButton in regular header for the class, rather than only in the subclassing header, as clients may need to reset content insets back to their defaults after using a themer, even if they do not subclass MDCButton.
PiperOrigin-RevId: 316165414
2020-06-12 13:26:06 -07:00
Yarden Eitan
6bd4757079 [HitAreaInsets] Add a convenience math method to calculate the correct visibleAreaInsets given a frame and a minimum touch target.
PiperOrigin-RevId: 315655291
2020-06-10 02:29:15 -07:00
Yarden Eitan
dee8934c69 [MDCButton] When visibleAreaInsets are set, don't allow additional setting of the shapeGenerator API directly.
Also add visibleAreaInset API to the FAB typical example now that the conflict between visibleAreaInsets and shapeGenerator is resolved.

PiperOrigin-RevId: 315233817
2020-06-08 02:05:07 -07:00
Yarden Eitan
afb87e9860 [Floating Button] Add visibleAreaInsets support for the FAB.
Like the MDCButton, this is opt-in, and the dictionary for the visibleAreaInsets per mode/shape combination is initially empty.

PiperOrigin-RevId: 315152916
2020-06-07 05:34:33 -07:00
Yarden Eitan
3d5c27f12b [Buttons] Add a boolean for when observing cornerRadius so that we won't try to add 2 observers or remove a non-existent observer
PiperOrigin-RevId: 314722144
2020-06-04 07:07:33 -07:00
Yarden Eitan
da469c7660 [MDCButton] Put pointerStyleProvider API under a respondsToSelector conditional to ensure no crashes for 13.4 beta users.
PiperOrigin-RevId: 314486597
2020-06-03 01:12:14 -07:00
Yarden Eitan
e8a1c4e7e1 [MDCButton] Add a visibleAreaInsets API.
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
2020-05-28 03:17:34 -07:00
Wenyu Zhang
b19e4e964d [ShadowLayer] Add prepareShadowPath to MDCShadowLayer to allow its subclass preparing shadow path before MDCShadowLayer lays out its sublayers.
PiperOrigin-RevId: 313383830
2020-05-27 07:20:37 -07:00
Wenyu Zhang
dfd5109f15 [FAB] Fix theme being applied to a wrong floating button in the example snapshot.
PiperOrigin-RevId: 312300844
2020-05-19 10:04:54 -07:00
Nobody
70716800b8 Internal change
PiperOrigin-RevId: 312085611
2020-05-18 16:41:12 +00:00
Andrew Overton
7814b0c460 Replace App Bar docs
This PR replaces the AppBar README. The content is mostly the same, I just had to restructure it in order to fit the new template.

Closes https://github.com/material-components/material-components-ios/pull/9981

PiperOrigin-RevId: 309097690
2020-04-29 14:32:52 -07:00
Nobody
e035d70f50 Project import generated by Copybara.
PiperOrigin-RevId: 309039129
2020-04-29 17:00:59 +00:00
Wenyu Zhang
a3381717f7
Fix the bazel BUILD files and snapshot that were restored unintentionally.(#9983) 2020-04-29 11:00:00 -04:00
Bryan Oltman
f7f154d483 [Buttons] Move button alpha tests into their own file.
PiperOrigin-RevId: 308681214
2020-04-27 13:03:44 -07:00
Jeff Verkoeyen
25471afea0 Rename "flaky" to "skip_snapshots".
PiperOrigin-RevId: 308259307
2020-04-24 08:34:12 -07:00
Jeff Verkoeyen
92254ea119 Rename all icons to an ic_<#name#> convention.
PiperOrigin-RevId: 308232277
2020-04-24 04:33:51 -07:00
Randall Li
0100cfe414 [MDC-iOS/BottomSheet] Fix dismissOnDraggingDownSheet behavior
The bottom sheet incorrectly allowed the sheet to be drag dismissed when `dismissOnDraggingDownSheet` was set to NO.

This change permits the gesture to dismiss to begin but prevents it from actually closing the sheet.

https://github.com/material-components/material-components-ios/issues/9723

Closes https://github.com/material-components/material-components-ios/pull/9885

PiperOrigin-RevId: 307802500
2020-04-22 06:21:26 -07:00
Dave MacLachlan
ebac2a8eb7 As of iOS 9/macOS 10.11 (circa 2015) removing objective C objects from the NSNotificationCenter in - (void)dealloc. is no longer required (the classic example is: [[NSNotificationCenter defaultCenter] removeObserver:self] but there are several variations).
In many cases this is the only thing being done in - (void)dealloc, so we can remove the whole thing.

PiperOrigin-RevId: 307663440
2020-04-21 13:00:30 -07:00
Jeff Verkoeyen
44ec4e204c Internal change
PiperOrigin-RevId: 307562279
2020-04-21 01:44:02 -07:00
Jeff Verkoeyen
7bd2a4e317 Internal change
PiperOrigin-RevId: 307390564
2020-04-20 07:01:37 -07:00
Andrew Overton
512d6a0049 Replace TextControls documentation
This PR primarily replaces the TextControls README with a different README. It also makes the TextControls README the source of the default TextField docs on material.io.

Preview the changes at: https://github.com/andrewoverton/material-components-ios/tree/material-io-text-field/components/TextControls

Closes https://github.com/material-components/material-components-ios/pull/9970

PiperOrigin-RevId: 306473798
2020-04-14 11:05:09 -07:00
Nobody
e49657fb14 Fix compilation with -std=c11
The keyword "typeof" is not recognised by the compiler when
using -std=c11 (it is considered a gnu extension). However,
the keyword "__typeof__" is always recognised in both mode (
-std=gnu11 and -std=c11). Thus it is safe to convert to use
"__typeof__" even if building with -std=gnu11.

See https://clang.llvm.org/docs/UsersManual.html#differences-between-various-standard-modes

PiperOrigin-RevId: 306453103
2020-04-14 09:27:23 -07:00
Jeff Verkoeyen
8abbb099a9 Delete all bazel support.
We no longer support bazel.

This PR deletes everything related to bazel support from our repo.

Closes https://github.com/material-components/material-components-ios/pull/9968

PiperOrigin-RevId: 306227127
2020-04-13 07:13:47 -07:00
Bryan Oltman
bff4209df2 [Buttons] Update MDCButton to use the proposed pointer effect in pointerStyleProvider.
Previously, MDCButton's pointerStyleProvider was ignoring both the proposed effect and proposed shape. To better align with UIButton, we now use the proposed effect and use the button's boundingPath to provide a pointer shape.

PiperOrigin-RevId: 305900307
2020-04-13 09:25:38 -04:00
Bryan Oltman
4f75f7c33f [Buttons] Disable pointer interactions for MDCFloatingButton during animation.
PiperOrigin-RevId: 305879022
2020-04-13 09:23:13 -04:00
Bryan Oltman
5a2b2caae0 [Button] Add custom UIButtonPointerStyleProvider to MDCButton for better iPadOS pointer interaction.
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
2020-04-13 09:20:43 -04:00
Andrew Overton
f5841c6d2f I got this build error when building on the latest Xcode:
```
"MDCFloatingButtonModeAnimator.m:150:9: Block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior"
```
This change adds the explicit self. If I got this other people might.

PiperOrigin-RevId: 305777188
2020-04-09 15:55:08 -07:00
Andrew Overton
f9a72c3df8 [Buttons] Fix a lot of formatting issues with material.io and some broken links
TL;DR -  This PR consists of fixes for broken links, broken image links, and broken Swift/Objective-C code snippets on material.io, and also adds some small copy edits.

Sometimes our documentation renders okay on GitHub, but breaks in the conversion of markdown to HTML/CSS that takes place during material.io deploys. As of yesterday, I'm able to build material.io locally, which allows me _validate_ the documentation changes I will keep making for the material.io work. It also allows me to catch broken links elsewhere, in totally unrelated files. For example, there were broken links in some Shapes documentation that were already blocking the deployment of our docs unbeknownst to us.

Closes https://github.com/material-components/material-components-ios/pull/9963

COPYBARA_INTEGRATE_REVIEW=https://github.com/material-components/material-components-ios/pull/9963 from andrewoverton:fix-formatting-issues cd54e90863274a49068e016547b1bf0b1af3afcb
PiperOrigin-RevId: 305770167
2020-04-09 15:16:14 -07:00
Jeff Verkoeyen
6ac7e6c3d8 [Buttons] Add support to MDCFloatingButton for animating mode changes.
The new API allows the floating button to animate changes between normal and expanded states.

PiperOrigin-RevId: 305703859
2020-04-09 09:57:44 -07:00
Jeff Verkoeyen
bc113b658c [Buttons] Add a snapshot test for floating buttons in normal mode with a label.
This snapshot test demonstrates the incorrect behavior of the title label being visible while the button is in normal mode.

PiperOrigin-RevId: 305668064
2020-04-09 05:49:02 -07:00
Jeff Verkoeyen
57ec631be2 [Buttons] Standardize all test names on <Symbol><TestCategory>Tests.
PiperOrigin-RevId: 305667188
2020-04-09 05:39:30 -07:00
Andrew Overton
8c27dcf2e5 Fix broken link in Buttons docs
PiperOrigin-RevId: 305561023
2020-04-08 15:00:07 -07:00
Jeff Verkoeyen
4454d0be94 [Buttons] Use static storage for all local consts.
Two examples were using non-static storage for effectively static consts, causing the symbols to be available available across compilation units and resulting in linker errors when the symbols happen to collide across compilation units.

PiperOrigin-RevId: 305337107
2020-04-07 14:11:53 -07:00
Jeff Verkoeyen
3a157e1f43 [Buttons] Standardize all examples on the same <Component><Example>Example pattern.
PiperOrigin-RevId: 305332675
2020-04-07 13:53:57 -07:00
Andrew Overton
40a62dc328 Update images again because they weren't using secondary theming before
The FABs anatomy assets changed, this time to use secondary theming. This PR updates them in the iOS docs.

Closes https://github.com/material-components/material-components-ios/pull/9960

COPYBARA_INTEGRATE_REVIEW=https://github.com/material-components/material-components-ios/pull/9960 from andrewoverton:update-fab-anatomy-images-again a54d18f76bb0e4175f513808bc0ae3e2cf0abc35
PiperOrigin-RevId: 305064142
2020-04-06 10:42:55 -07:00
Andrew Overton
7fa3ffc105 [Buttons] Add new fab anatomy pngs
This PR adds some new FAB anatomy PNGs.

Closes https://github.com/material-components/material-components-ios/pull/9959

COPYBARA_INTEGRATE_REVIEW=https://github.com/material-components/material-components-ios/pull/9959 from andrewoverton:update-fab-anatomy-pngs 5964c875e65d84ddbc63f7ac0401dd609a2bde4d
PiperOrigin-RevId: 305013702
2020-04-06 06:21:04 -07:00