81 Commits

Author SHA1 Message Date
David Collazo
7fd4094424 Change MDCChipField to use UITextField instead of MDCTextField.
PiperOrigin-RevId: 591304366
2023-12-15 11:01:16 -08:00
Wenyu Zhang
b457b13005 Internal change.
PiperOrigin-RevId: 417635153
2021-12-21 09:32:05 -08:00
Jeff Verkoeyen
86a8c97dc7 Remove all pre-iOS 12 logic.
PiperOrigin-RevId: 400788645
2021-10-04 12:41:07 -07:00
Randall Li
502bc5d910 Ran a Swift formatter
PiperOrigin-RevId: 395947664
2021-09-10 09:48:14 -07:00
Jeff Verkoeyen
96cfc7e331 Internal change
PiperOrigin-RevId: 394241967
2021-09-01 08:56:53 -07:00
Alyssa Weiss
85cdcadbec Update MDC chip examples to no longer use mdc_adjsutFontForContentSizeCategory to support Dynamic Type.
PiperOrigin-RevId: 371925667
2021-05-04 09:04:07 -07:00
Jeff Verkoeyen
2a8a6ac1c9 Optimizing imports
PiperOrigin-RevId: 357185734
2021-02-12 07:31:35 -08:00
Wenyu Zhang
c7dfe42227 [Chips] Remove visibleAreaInsets usage in examples with their corresponding snapshot tests.
PiperOrigin-RevId: 320631647
2020-07-10 10:46:59 -07:00
Wenyu Zhang
87422cf14f [Chips] Add centerVisibleArea to MDCChipView and deprecate visibleAreaInsets.
PiperOrigin-RevId: 318399857
2020-06-25 20:08:22 -07:00
Wenyu Zhang
db48cefa9b [Chips] Add visibleAreaInsets API to MDCChipView.
PiperOrigin-RevId: 314146955
2020-06-01 09:51:19 -07:00
Wenyu Zhang
1992bbdd21 [Chips] Adjust hitAreaInsets in the typical example.
PiperOrigin-RevId: 312474752
2020-05-20 07:05:32 -07:00
Bryan Oltman
c3f17b143a Internal change
PiperOrigin-RevId: 309089945
2020-04-29 13:53:57 -07:00
Nobody
e035d70f50 Project import generated by Copybara.
PiperOrigin-RevId: 309039129
2020-04-29 17:00:59 +00:00
Bryan Oltman
6735eea13f [Chips] Add EarlGrey test to expose issue where MDCChipField hides placeholder text after input
and rotation.

PiperOrigin-RevId: 308255597
2020-04-24 08:09:16 -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
Bryan Oltman
d9b5a826c8 [Chips] Adds disabling chip example to the Dragons catalog.
PiperOrigin-RevId: 302095580
2020-03-20 14:08:56 -07:00
featherless
a0dd0a34b3
[Chips] Give the ChipsSizing example's sliders a11y labels and values. (#8942)
Stacked on https://github.com/material-components/material-components-ios/pull/8940

Part of https://github.com/material-components/material-components-ios/issues/8868
2019-11-15 15:28:42 -05:00
featherless
e9e913b4dd
[Chips] Fix layout of ChipsSizingExampleViewController. (#8940)
Part of https://github.com/material-components/material-components-ios/issues/8868

| Before | After |
|:--|:--|
| ![Simulator Screen Shot - iPhone Xʀ - 2019-11-15 at 12 20 17](https://user-images.githubusercontent.com/45670/68962319-4c095d80-07a2-11ea-861c-04244f213da1.png) | ![Simulator Screen Shot - iPhone Xʀ - 2019-11-15 at 12 19 39](https://user-images.githubusercontent.com/45670/68962302-40b63200-07a2-11ea-918e-b62c151a176d.png) |
2019-11-15 14:19:33 -05:00
featherless
539f39215d
[Chips] Add an "animated" button to the filter example. (#8615)
This allows us to delete the "Animated" subclass and the remainder of the supplemental code.

Final polish as part of https://github.com/material-components/material-components-ios/issues/8459

![Simulator Screen Shot - iPhone XS Max - 2019-10-21 at 09 37 34](https://user-images.githubusercontent.com/45670/67210792-ae5f8000-f3e7-11e9-975b-c5b9a1da2186.png)
2019-10-21 13:23:55 -04:00
featherless
d59cab0d9f
[Chips] Fold more supplemental code into the examples. (#8605)
This is further polish as part of https://github.com/material-components/material-components-ios/issues/8459
2019-10-17 16:52:18 -04:00
featherless
588024d04f [Chips] Fold supplemental code into the examples. (#8587)
Also aligned the examples to consistently make use of properties instead of ivars.

ivar -> property replacement done using the following regexp:

- Find: `_(\w+)`
- Replace: `self.$1`

Cleaned up the following examples:

- ChipsActionExampleViewController
- ChipsChoiceExampleViewController
- ChipsCustomizedExampleViewController
- ChipsInputExampleViewController
- ChipsSizingExampleViewController
- ChipsShapingExampleViewController

Polish as part of https://github.com/material-components/material-components-ios/issues/8459
2019-10-15 22:02:52 -04:00
featherless
cf1a9010f1 [Chips] Move ChipModel into ChipsTypicalUseViewController. (#8579)
It is not reused by any other example. Folding it into the example removes one layer of file indirection required to understand this example.

Polish as part of https://github.com/material-components/material-components-ios/issues/8459
2019-10-14 11:30:55 -04:00
featherless
ecba8c89d6
[Chips] Move all example assets to a supplemental file. (#8577)
This reduces method duplication complexity across all of the examples. It also removes a layer of indirection between the examples and the assets.

Polish for https://github.com/material-components/material-components-ios/issues/8459
2019-10-14 09:26:04 -04:00
featherless
4f7e1e00c3
[Chips] Remove all lazy initialization of models from examples. (#8576)
The lazy initialization adds unnecessary complexity to the examples.

Polish for https://github.com/material-components/material-components-ios/issues/8459
2019-10-11 17:51:44 -04:00
featherless
acdbc6f1d6 [Chips] Remove sizing chips from all remaining examples. (#8575)
In doing so, adds Dynamic Type support to ChipsCustomizedExampleViewController (a dragons example).

This is polish of https://github.com/material-components/material-components-ios/issues/8459
2019-10-11 16:40:20 -04:00
featherless
eac0034d93
[Chips] Add Dynamic Type support to ChipsInputExampleViewController. (#8569)
Part of https://github.com/material-components/material-components-ios/issues/8459

Testing strategy:

1. Open the ChipsInputExampleViewController example in MDCCatalog.
2. Type some chips.
3. Change the system Dynamic Type size to a large and then small size and back again. After each change, verify that the chip field changed in reaction.

![Simulator Screen Shot - iPhone 11 Pro Max - 2019-10-11 at 08 55 22](https://user-images.githubusercontent.com/45670/66652939-df300000-ec04-11e9-9083-b97427b14bd5.png)
2019-10-11 09:27:43 -04:00
featherless
dbfaa92f9b
[Chips] Add Dynamic Type support to the remaining chip collection examples. (#8567)
This is part of https://github.com/material-components/material-components-ios/issues/8459
2019-10-11 08:53:14 -04:00
featherless
332123d241 [Chips] Remove unnecessary explicit layout code. (#8564)
Initializing with the container bounds & using autoresizing width + height when possible is preferred to explicit layout.

Cleanup as part of https://github.com/material-components/material-components-ios/issues/8459
2019-10-10 16:58:20 -04:00
featherless
20102a792c
[Chips] Add Dynamic Type support to ChipsActionExampleViewController. (#8565)
Prior to this change, the ChipsActionExampleViewController did not support Dynamic Type in any way.

After this change, ChipsActionExampleViewController will dynamically respond to changes in Dynamic Type.

Support for Dynamic Type auto-adjustment was added by opting in to self-sizing cell behavior via setting a non-zero estimatedItemSize on the layout.

Part of https://github.com/material-components/material-components-ios/issues/8459

![Simulator Screen Shot - iPhone 11 Pro Max - 2019-10-10 at 14 06 31](https://user-images.githubusercontent.com/45670/66594444-2f588500-eb67-11e9-93fd-b18ef38205da.png)
2019-10-10 15:19:59 -04:00
Yarden Eitan
119fcf9ffd
[Chips] Adding Ripple support for Chips (#7270)
In this PR I am adding initial support for Ripple in Chips as an opt-in behavior.
The ripple will be placed in the .m file and not exposed in the header file, similarly to the existing Ink.
Clients who wish to modify the Ripple's color for state can use the existing inkColorForState API, similarly to how Ripple was integrated in Buttons.

There are currently some issues in fully integrating the Selected state that Stateful Ripple provides into Chips. There have been bugs filed that block this effort at its current state: #7265 #7266 #7267 

As part of the effort for: #7268
2019-04-30 11:45:23 -04:00
Wenyu Zhang
cb4ffbc580
[Chips] Move Chips Theming to Ready. (#7179)
closes https://github.com/material-components/material-components-ios/issues/7164
2019-04-19 12:00:55 -04:00
Yarden Eitan
5bed3961e6
[ContainerScheme] Graduate ContainerScheme to ready. (#7170)
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
2019-04-18 09:25:02 -04:00
Andrew Overton
c56d5d76d3
Add @objc annotations to get examples to show up in Dragons (#7168)
This is a follow up PR for #7166 adds @objc annotations to Swift catalogMetadata() methods, because the Swift 4 compiler no longer attempts to infer what methods should be visible to Objective-C. As a result of this change in the compiler, no Swift examples were showing up in Dragons after #7166. See this article: https://useyourloaf.com/blog/objc-warnings-upgrading-to-swift-4/ for additional context.
2019-04-17 21:35:43 -04:00
Andrew Overton
b38372192f
Update to Swift 4.2 (#7166)
This PR updates the Swift version to 4.2.

Partially resolves #6874.
2019-04-17 16:59:02 -04:00
Yarden Eitan
10abd4524d
[Shapes] Move shapes from components/private to components/ - Part 3 (last part) (#6734)
This is the third and last part of the migration of moving the Shape libraries away from the private/ folder. Continuation to PR: #6664 and #6495

Tracking bug, progress and more details can be found here: #6494

This resolves #6494

Because Shapes and ShapeLibrary have been used in production and are an integral part of the shape scheme and theming. Moreover, with to stop the confusion of clients that the library should not be imported as it is under private, we want to migrate the Shape libs to be under components/ instead of components/private.

The migration will be a 7 step migration to not break clients internally.
**We have completed steps 1 to 6, This PR concludes step 7 and the entire migration**

1. move the folders to the new directory.
2. Make the old component's BUILD and Podspec targets depend on the new component (and nothing else).
3. Delete all implementation files from the old component.
4. Replace the contents of the old component's headers with import statements to the new component's header. If the new component has headers that match the old component's, then the new component's headers will need to be named uniquely for a period of time to allow clients to migrate over.
5. Once all clients have migrated from the old component, delete the old component. This is a breaking change.
6. If you had to create temporary header names in the new component, then in a separate release add the new headers that you want the new component to use. Move the content of the old headers into the new headers and replace the old headers with an import of the new headers. Migrate clients to the desired headers.
7. Once all clients have moved off of the old headers, delete the old headers.
2019-02-28 16:54:58 -05:00
Cody Weaver
50307bb330
[Container] Fix colorScheme and typographyScheme to be nonnull. (#6699)
## Introduction
Before we move container scheme to ready we need to have both the `colorScheme` and `typographyScheme` nonnull. By making colorScheme and typographyScheme of MDCContainerScheming nonnull, clients will reduce the amount of conditional checks required in their apps and reduce a category of potential errors (accidentally passing nil to a nonnull parameter).

## The problem
Both `colorScheme` and `typographyScheme` were nullable in the container scheme making it harder for clients to use the container scheme throughout their app on non Material UIElements, i.e. UIView.backgroundColor

## The fix
Make both of these properties nonnull.

## Additional work
- [x]  I had to update the swift examples to not be optional and I additionally removed the nil checks from the ObjC examples.
2019-02-27 15:47:26 -05:00
Andrew Overton
0626ccff89
[Chips] Update chips examples to use container schemes (#6477)
This PR adds a container scheme property to the chips examples that didn't have them.
It also uses the theming extension to theme chips that weren't already being themed with it.

Closes #6439.
2019-01-30 11:36:45 -05:00
Yarden Eitan
de5d200599
[Shapes] Move shapes from components/private to components/ (#6495)
This is the first part of the migration of moving the Shape libraries away from the private/ folder.

Tracking bug, progress and more details can be found here: #6494 

"Because Shapes and ShapeLibrary have been used in production and are an integral part of the shape scheme and theming. Moreover, with to stop the confusion of clients that the library should not be imported as it is under private, we want to migrate the Shape libs to be under components/ instead of components/private.

The migration will be a 7 step migration to not break clients internally.

1. move the folders to the new directory.
2. Make the old component's BUILD and Podspec targets depend on the new component (and nothing else).
3. Delete all implementation files from the old component.
4. Replace the contents of the old component's headers with import statements to the new component's header. If the new component has headers that match the old component's, then the new component's headers will need to be named uniquely for a period of time to allow clients to migrate over.
5. Once all clients have migrated from the old component, delete the old component. This is a breaking change.
6. If you had to create temporary header names in the new component, then in a separate release add the new headers that you want the new component to use. Move the content of the old headers into the new headers and replace the old headers with an import of the new headers. Migrate clients to the desired headers.
7. Once all clients have moved off of the old headers, delete the old headers.

Passes bazel build and pod build locally.
2019-01-28 17:51:27 -05:00
Robert Moore
800188a649
{clang-format} Format the components. (#6347)
This is a follow-up to https://github.com/material-components/material-components-ios/pull/6027

```
find components \( -name "*.h" -or -name "*.m" \) | xargs clang-format -i
```
2019-01-23 11:08:43 -05:00
Cody Weaver
12b841aff6
[Chips] Add example to BUILD file (#6273)
Closes #6218
2019-01-11 15:03:14 -05:00
Yarden Eitan
2803125b2c
ran clang-format (#6027) 2019-01-11 13:23:51 -05:00
rami-a
c604f9fd35
[Chips] Update chips examples to use theming extension (#6096)
### Context
As the team pivots to using theming within extensions we continue this work with Chips.

### The problem
We currently do not utilize the theming extension for chips examples

### The fix
* This change updates all the chips examples to use the new chips theming extension.
* Additionally, this updates the shape example to use the new chips theming extension.

### Bug
Closes #6083
2018-12-21 13:13:45 -05:00
Robert Moore
372d6b24f9
No longer using -init for Color Scheme. (#5734)
{MDC iOS} No longer using `-init` for Color Scheme.

Based on the discussions in go/mdc-ios-theming, we should not use the `-init` default initializer. Instead, we should use an explicit set of defaults.

Search regex: '\[\[MDCSemanticColorScheme alloc\] init\]'
2018-11-12 12:54:47 -05:00
Robert Moore
03f3351ad5
Global replace of single-precision floats with CGFloat casts. (#5718)
Replacing all non-integral, single-precision floating point literals with double-precision values explicitly cast to CGFloat.  For example, `0.1f` should become `(CGFloat)0.1`.

Regex used:
```
([0-9]*\.)([0-9]*?)([1-9]+)([0-9]*?)[fF]
```

PiperOrigin-RevId: 220683126
2018-11-12 10:50:01 -05:00
Robert Moore
74a27253e8
Global replace of integral single-precision literals with integer literals. (#5709)
Global replace of integral single-precision literals with integer literals.

Regular expression used:
```perl
/[^\w]([0-9]+)\.[0]*[fF]/$1/
```
2018-11-08 14:02:04 -05:00
rami-a
ae6d459a34
[Chips] Respect safe area for Chips examples (#5377)
Several examples under Chips were not respecting the safe area and therefore obscruing content on iPhone X in landscape. This change fixes that for:
* ChipsActionExampleViewController
* ChipsChoiceExampleViewController
* ChipsFilterExampleViewController

Closes #3705 
Closes #3706 
Closes #3707 


Before:
![simulator screen shot - iphone x - 2018-10-09 at 15 52 46](https://user-images.githubusercontent.com/2364772/46696484-378e8500-cbe0-11e8-9eb0-fedb5f3a0da9.png)

After:
![simulator screen shot - iphone x - 2018-10-09 at 15 55 43](https://user-images.githubusercontent.com/2364772/46696489-3bbaa280-cbe0-11e8-8cfe-e79118205c67.png)
2018-10-10 10:02:17 -04:00
Cody Weaver
f233981e2f
[Chips] Add client the ability to delete chips in a chip field (#5135)
This adds the ability for clients to delete chips within a chip field. 

Within the unit test I couldn't simulate touchUpInside so I felt this was the best option. A client cannot get this behavior unless if they set the flag `showChipsDeleteButton`.

Closes #4787
2018-09-15 23:04:34 -04:00
Cody Weaver
d57e6b724f
[Chips] Update example (#5118)
Previously the example didn't respect the safe area or use a typography scheme. This addresses both issues and cleans up some code. You previously couldn't see the chip field because it was hidden behind the app bar.

Closes #3708 

| Before | After |
| ------ | ------ |
|![simulator screen shot - iphone x - 2018-09-13 at 16 28 51](https://user-images.githubusercontent.com/7131294/45513977-259cfc00-b772-11e8-89c7-bcfb65825723.png)|![simulator screen shot - iphone x - 2018-09-13 at 16 27 17](https://user-images.githubusercontent.com/7131294/45513995-30579100-b772-11e8-877d-80c191b781e9.png)|
|![simulator screen shot - iphone x - 2018-09-13 at 16 28 57](https://user-images.githubusercontent.com/7131294/45514052-53824080-b772-11e8-969a-be99d248651e.png)|![simulator screen shot - iphone x - 2018-09-13 at 16 27 48](https://user-images.githubusercontent.com/7131294/45514058-5a10b800-b772-11e8-80fc-5abc602190d5.png)|
2018-09-14 07:25:27 -04:00
Yarden Eitan
31e4007ec0
[Chips] Integration of the chip themer into the examples (#5113)
This is a follow up PR for #5111  and #5112 and relies on both.

This integrates the created shape themer for chips into the examples that currently use color/typography themers.

This closes #5048
2018-09-13 18:40:43 -04:00
featherless
2181084272
[automated] Standardize our open source license stanza to what Xcode generates. (#4985)
Removes the need to copy-paste stanzas from other files anymore as we'll rely on #4478 to generate the correct stanza for us instead.

This was an automated change generated by running a find-and-replace regular expression:

```
/\*
 Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.

 Licensed under the Apache License, Version 2\.0 \(the "License"\);
 you may not use this file except in compliance with the License\.
 You may obtain a copy of the License at

 http://www\.apache\.org/licenses/LICENSE-2\.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
 See the License for the specific language governing permissions and
 limitations under the License\.
 \*/
```

```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.

Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at

http://www\.apache\.org/licenses/LICENSE-2\.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```

```
/\*
 Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
 Licensed under the Apache License, Version 2\.0 \(the "License"\);
 you may not use this file except in compliance with the License\.
 You may obtain a copy of the License at
 http://www\.apache\.org/licenses/LICENSE-2\.0
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
 See the License for the specific language governing permissions and
 limitations under the License\.
 \*/
```

```
// Copyright $1-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
```
2018-08-31 12:13:07 -04:00