69 Commits

Author SHA1 Message Date
Andrew Overton
ea59fefa1c [TextControls] Translate frame to window coordinates in accessibilityPath
PiperOrigin-RevId: 333289355
2020-09-23 07:40:03 -07:00
Andrew Overton
873c0b78d8 [TextControls] Override accessibilityPath in MDCBaseTextField
PiperOrigin-RevId: 332544566
2020-09-18 16:01:10 -07:00
Jeff Verkoeyen
fbb1f20aa2 Internal change
PiperOrigin-RevId: 332151481
2020-09-16 21:01:21 -07:00
Andrew Overton
0907c19623 [TextControls] Add containerRadius support to filled text field
PiperOrigin-RevId: 331211129
2020-09-11 13:26:29 -07:00
Andrew Overton
3aace45a83 [TextControls] Add containerRadius to filled style object and base text area
PiperOrigin-RevId: 330771085
2020-09-09 12:12:44 -07:00
Andrew Overton
58ae5f8139 [TextControls] Refactor sizing behavior + expose sizing delegate method
PiperOrigin-RevId: 330753801
2020-09-09 10:50:07 -07:00
Andrew Overton
d303da4db4 [TextControls] Add containerRadius to MDCBaseTextField
PiperOrigin-RevId: 330576959
2020-09-08 13:41:24 -07:00
Andrew Overton
9d12dc1f98 [TextControls] Improve TextControls test coverage
PiperOrigin-RevId: 329912259
2020-09-03 07:09:37 -07:00
Andrew Overton
6e52d049a6 [TextControls] Add KVO for assistive labels
This change makes it so that clients will not have to explicitly trigger a layout pass and resize text fields or text areas when they set assistive label text in Auto Layout.
For Manual Layout, they will not have to trigger a layout pass, but they will still have to resize the view.

PiperOrigin-RevId: 324873963
2020-08-04 13:08:08 -07:00
Nobody
36ee03d99d [TextControls] Add MDCBaseTextFieldDelegate
PiperOrigin-RevId: 324075961
2020-07-30 13:55:14 -07:00
Andrew Overton
9b6db6fb44 [TextControls] Add typical use example
PiperOrigin-RevId: 323996387
2020-07-30 07:17:01 -07:00
Andrew Overton
0950ece8f3 [TextControls] Allow setting underline thickness regardless of state
PiperOrigin-RevId: 323002391
2020-07-24 08:43:22 -07:00
Andrew Overton
e360f3c1c4 [TextControls] Expose preferredContainerHeight on MDCBaseTextField
PiperOrigin-RevId: 322999254
2020-07-24 08:23:22 -07:00
Andrew Overton
49b441e849 [TextControls] Prepare to expose preferredContainerHeight on text controls
PiperOrigin-RevId: 322856550
2020-07-23 13:43:55 -07:00
Andrew Overton
93fb883645 [TextControls] Add debug stuff to text controls examples
PiperOrigin-RevId: 322601224
2020-07-22 10:28:08 -07:00
Andrew Overton
66497f7837 [TextControls] Fix jumpiness in text areas
PiperOrigin-RevId: 322590189
2020-07-22 09:30:07 -07:00
Andrew Overton
b18a9191cc [TextControls] Fix secureTextEntry layout pass infinite loop
Closes #10041.

PiperOrigin-RevId: 322408226
2020-07-21 11:51:22 -07:00
Andrew Overton
9480bf4c88 [TextControls] Make text fields without floating labels shorter
PiperOrigin-RevId: 320432378
2020-07-09 11:06:27 -07:00
Andrew Overton
b919fad3a2 [TextControls] Fix line counting mechanism in text areas
PiperOrigin-RevId: 319816916
2020-07-06 11:19:15 -07:00
Andrew Overton
2675070cd5 [TextControls] Make text areas respond to width changes
PiperOrigin-RevId: 319245208
2020-07-01 10:04:24 -07:00
Andrew Overton
cfd9b3ff56 [TextControls] Make text areas shorter when there is no floating label
PiperOrigin-RevId: 319228270
2020-07-01 08:22:48 -07:00
Andrew Overton
b205164477 Delete obsolete markdown files
As I've gone through and replaced all the READMEs I haven't always been good at deleting the markdown files that were stitched together to make the old READMEs. This PR removes all the ones I forgot to remove. All the relevant material in these files is already in the new READMEs, so we're not losing anything by doing this.

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/material-components/material-components-ios/pull/10029 from andrewoverton:delete-unused-docs 65ea55253af300ea7a4c13ea4ce14976097a6253
PiperOrigin-RevId: 318079032
2020-06-24 09:31:01 -07:00
Andrew Overton
9c99bc9006 [TextControls] Add padding customizing properties to MDCBaseTextField and MDCBaseTextArea
This CL adds two new properties, leadingEdgePaddingOverride and trailingEdgePaddingOverride, to MDCBaseTextField and MDCBaseTextArea. When these properties are set, they will be used as padding values by the text field. When they are not set, the text field will use default values. I decided to make these properties NSNumbers, so there is a distinction between setting them to a @0 and leaving them as nil. This is where optionals would come in handy...

Things to come in upcoming CLs:
* Snapshot tests for text areas
* Will rename MDCTextControlVerticalPositioningReference to MDCTextControlVerticalPositioning, for consistency with its horizontal equivalent

PiperOrigin-RevId: 317349272
2020-06-19 11:49:20 -07:00
Andrew Overton
b7f5b0dd2b [TextControls] Separate side padding into leading/trailing padding
This is pre-work for b/158109599.

PiperOrigin-RevId: 316874616
2020-06-17 06:20:05 -07:00
Andrew Overton
c302339943 [TextControls] Change side view positioning for MDCUnderlinedTextField
This change introduces a new private protocol, MDCTextControlTextField, which inherits from MDCTextControl. This protocol adds one property, of a new enum, MDCTextControlTextFieldSideViewVerticalPosition. This type helps MDCBaseTextFieldLayout determine how to vertically position side views. The purpose is to allow MDCUnderlinedTextField to vertically align its side views with the text rect, as opposed to vertically centering them in the container, like the filled and outlined styles do. I'm not sure about the name `MDCTextControlTextFieldSideViewVerticalPosition`, but other ones I considered that were maybe more clear were too ridiculously long.

PiperOrigin-RevId: 316028095
2020-06-11 19:52:03 -07:00
Andrew Overton
6f169c9950 [TextControls] Update Podspec after TextControls changes
PiperOrigin-RevId: 315477850
2020-06-09 07:17:11 -07:00
Andrew Overton
55f0fead00 [TextControls] Add underlined text field
This CL adds an MDCUnderlinedTextField class and some snapshot tests. Upcoming CLs will make slight visual modifications that will be reflected in snapshot diffs.

PiperOrigin-RevId: 314993621
2020-06-05 14:12:50 -07:00
Andrew Overton
9b2e7ecd7a [TextControls] Move private text fields files to TextControlsPrivate
The files moved in this CL were added before TextControlsPrivate existed. TextControlsPrivate is the best place for them.

PiperOrigin-RevId: 314922972
2020-06-05 07:16:26 -07:00
Andrew Overton
1b63eabe19 [TextControls] Add notion of horizontal positioning reference
No visible or public API changes. Internal refactor.

This change adds the notion of a horizontal positioning reference. This will make it so that different styles can have different horizontal padding values.

Prior to this change, there was only one "horizontal padding" value. This change separates it into two values: one for the padding between leftmost and rightmost views and the left and right edges of the TextControl, and one for the padding between subviews of the TextControl. These two values live on a horizontal positioning reference object. Different styles will one day have different horizontal positioning reference objects.

For now only TextControl text fields will use this.
It's a lot of files but trivial changes in most, if not all, of them.

PiperOrigin-RevId: 314748534
2020-06-04 09:58:13 -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
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
Andrew Overton
2a3a0adfae Update TextControls readme metadata path
There shouldn't be an underscore.

PiperOrigin-RevId: 306503819
2020-04-14 13:33:57 -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
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
Andrew Overton
965cde39c8 This change finishes adding TextControls examples to the internal Catalog.
PiperOrigin-RevId: 305470131
2020-04-08 07:11:50 -07:00
Cody Weaver
fdf87c5995 [MDC/ColorScheme] Remove usage of init within MDC.
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
2020-03-25 13:36:51 -07:00
Andrew Overton
f01ede70ed
Update MDCBaseTextField docs (#9861)
After MDCBaseTextField was done being brought over and ready to use the docs were never updated to indicate that. They still warn against using it. This PR updates them.

This change was prompted by https://github.com/material-components/material-components-ios/issues/9860.

Related to #6945.
2020-03-09 10:20:03 -04:00
Andrew Overton
3e5edeccec
[TextControls] Add text area example (#9772)
This PR adds a text area example. I may refine some layout stuff before I start migrating people to use it. Gradient/top and bottom padding specifically.

Here's a gif:
![text_area_example](https://user-images.githubusercontent.com/8020010/74979556-d7773800-53fc-11ea-8508-cf5458bfe3d9.gif)

Closes #9407.
2020-02-21 11:17:37 -05:00
Andrew Overton
beca30be4a
[TextControls] add filled text areas (#9770)
This PR adds the TextControl filled text areas, as well as their theming extensions, and a bunch of unit tests. Snapshot tests to follow.

Related to #9407.
2020-02-20 16:10:53 -05:00
Andrew Overton
79d0ba0231
Add outlined text areas (#9771)
This PR adds the TextControl outlined text areas, as well as their theming extensions, and a bunch of unit tests. Snapshot tests to follow.

Related to #9407.
2020-02-20 15:37:30 -05:00
Andrew Overton
2c1669718c
Add first pass of unit tests for MDCBaseTextArea (#9754)
This PR adds some initial unit tests to MDCBaseTextArea.

Related to #9407.
2020-02-20 11:05:46 -05:00
Andrew Overton
a37edbf81a
MDCTextControlLabelState renamed to MDCTextControlLabelPosition and other changes (#9753)
This follow up PR for #9731 includes the following:
* MDCTextControlLabelState has been renamed to MDCTextControlLabelPosition
* Identical methods in MDCTextField and MDCBaseArea have been consolidated as C functions in shared locations.
* A few methods have been renamed.
* A few pragma marks have been renamed.

Related to #9407.
2020-02-18 16:24:45 -05:00
Andrew Overton
2f6b40a588
[TextControls] Add the rest of MDCBaseTextArea (#9731)
This PR adds the bulk of MDCBaseTextArea. If you are familiar with MDCBaseTextField this will all look very familiar.

Here's a gif:
![base-text-area](https://user-images.githubusercontent.com/8020010/74545957-c8354d80-4f17-11ea-9a5b-9237934f6119.gif)
That black line is not part of the text area haha. 

The other styles (and tests) to follow.

Related to #9407.
2020-02-18 12:48:35 -05:00
Andrew Overton
e6ef298bdf
[TextControls] Changes from text-area-feature-branch with additional podspec and BUILD file changes (#9711)
Because CI wasn't working earlier this week I merged the initial text area PRs (https://github.com/material-components/material-components-ios/pull/9682 and https://github.com/material-components/material-components-ios/pull/9684) into a [feature branch](https://github.com/material-components/material-components-ios/tree/text-area-feature-branch) in the main repo. This PR contains those changes, as well as a commit to update the BUILD file and podspec (3da2803), a commit that makes it compile (6a06594), and a commit to run clang (078cd70). The changes in these last three commits have not been reviewed, unlike the ones from the PRs into the feature branch.

Related to #9407.
2020-02-13 13:33:59 -05:00
Andrew Overton
54b9d1b72e Add Swift-friendlier names to TextControl text fields
Automatic Swift header generation worked for the most part. However, stateful setters with the words "LabelColor" in them seemed to not translate correctly. For example...

This method:

-setTrailingAssistiveLabelColor:forState:

Would end up looking like this:

func setTrailingAssistiveLabel(_ trailingAssistiveLabelColor: UIColor, for state: MDCTextControlState)

Which makes it look like it's setting a label, not a label color.

Now those methods look like this:

func setTrailingAssistiveLabelColor(_ trailingAssistiveLabelColor: UIColor, for state: MDCTextControlState)

So when you call it it looks like this:

textField.setTrailingAssistiveLabelColor(.blue, for: .normal)

PiperOrigin-RevId: 293805941
2020-02-07 07:00:24 -08:00
Andrew Overton
1d7746f552 Reevaluate RTL logic because of internal snapshot testing infrastructure
Some internal snapshot tests force RTL by setting the semantic content attribute. The "is RTL" logic in MDCBaseTextFields up to this point only looked at effective layout direction. This change makes it so that it checks if either RTL or LTR semantic content attributes are being forced before consulting effective layout direction.

PiperOrigin-RevId: 293201200
2020-02-04 12:19:14 -08:00
Andrew Overton
905dac8d81 Invalidate intrinsic content size in MDCBaseTextField
This change makes it so that the MDCBaseTextField invalidates its intrinsic content size when either the view's width or the view's layout's calculatedHeight has changed since the intrinsic content size was last calculated.

PiperOrigin-RevId: 293141339
2020-02-04 07:27:17 -08:00
Andrew Overton
2103f285ee This change adds a new property to the private protocol MDCTextControl. This property, labelFrame, is used by the outlined style object during style application. The outlined style object needs to know the label frame because the outline breaks before it hits the label and resumes after it. Accessing label.frame has proven unreliable during this scenario because of animations in progress.
PiperOrigin-RevId: 292384279
2020-01-30 11:11:01 -08:00