181 Commits

Author SHA1 Message Date
rami-a
4766299a56
[ButtonBar] Fix incorrect casts in ButtonBar (#5358)
This change updates a couple of improper casts in ButtonBar that had the potential to cause a crash.
Closes #4934
2018-10-08 14:22:15 -04:00
featherless
471936b842
[ButtonBar] Add a buttonBarDidInvalidateIntrinsicContentSize API to the delegate. (#4932)
This will allow the owner of a button bar to react to changes in the button bar's intrinsic size.

We need to add this delegate because I'm not aware of an equivalent UIKit mechanism that works with views that aren't using auto layout (the MDCNavigationBar uses manual layout).

In a follow-up change, MDCNavigationBar will implement this delegate and update the layout of its left/right button bars as a result.

Part of https://github.com/material-components/material-components-ios/issues/1717
2018-08-31 14:10:56 -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
Jeff Verkoeyen
9854044c96 Revert "[automated] Standardize our open source license stanza to what Xcode generates. (#4982)"
This reverts commit b45bc2fdd4dfe12fc76751a45c9cf7b0d6c1261f.
2018-08-31 12:01:24 -04:00
featherless
b45bc2fdd4
[automated] Standardize our open source license stanza to what Xcode generates. (#4982)
Removes the need to copy-paste stanzas from other files anymore as we'll rely on https://github.com/material-components/material-components-ios/pull/4478 to generate the correct stanza for us instead.

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

### Find

```
/\*
 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\.
 \*/
```

### Replace

```
// 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 11:49:00 -04:00
Yarden Eitan
3480c50c67
updated to newest CbC standard (#4956)
Move to the new CbC standard released in CatalogByConvention v2.5.0. See PR: material-foundation/cocoapods-catalog-by-convention#27 for more info on the change.
2018-08-29 20:45:13 -04:00
featherless
5d0e7ccfa8
[ButtonBar] Add uppercasesButtonTitles API for modifying title casing behavior. (#4935)
This change enables us to expose a similar API in MDCNavigationBar that will enable configuration of title casing behaviors for navigation bar button bars.

Step 1/2 for https://github.com/material-components/material-components-ios/issues/2968
2018-08-29 09:41:03 -04:00
featherless
aa2b2189d2
[ButtonBar] Annotate MDCButtonBarDelegate's only API as deprecated. (#4931)
This API is only used internally and is a layer of indirection that is not necessary.

The API has no internal usage or reasonable mechanism for use publicly, so we are marking it deprecated immediately.

Closes https://github.com/material-components/material-components-ios/issues/2943
2018-08-28 17:29:44 -04:00
featherless
bc6dfc007f
[ButtonBar] Add support for pure Swift class button invocations. (#4878)
Repro case:

Add the following code to a view controller with an App Bar:

```swift
class SomeObject {
  @objc func someEvent() {

  }
}

let object = SomeObject()

self.navigationItem.rightBarButtonItem =
  UIBarButtonItem(title: "Right", style: .done, target: object, action: #selector(SomeObject.someEvent))
```

Tap the button.

Expected behavior: the someEvent method is invoked.
Actual behavior: crash due to unrecognized selector `methodSignatureForSelector:`.

After this change the behavior works as expected, with the caveat being that we are not able to pass the button instance along as a third argument to pure Swift classes. The implication of this is that pure Swift classes will not be able to present popovers from the provided item instance. Supporting this case will require turning the pure Swift class into an Objective-C compatible class.

Closes https://github.com/material-components/material-components-ios/issues/2981
2018-08-24 10:51:40 -04:00
featherless
f6db581e01
[ButtonBar] Remove unnecessary ColorThemer dependency on NavigationBar. (#4885)
Closes https://github.com/material-components/material-components-ios/issues/3967
2018-08-24 10:50:59 -04:00
featherless
e89ece3bb8
[ButtonBar|NavigationBar] Remove custom iPad heights. (#4874)
Historically we had given navigation bars different heights on iPads. We no longer intent to make this distinction.

This change also fixes a bug related to this difference in behavior on iPads. The repro case for this bug is:

- Launch MDCDragons on an iPad Pro running 10.3.1.
- Open the App Bar typical use example.
- Scroll the content down somewhat.

Expected behavior: the navigation bar does not change its height or shift.
Actual behavior: the navigation bar shifts slightly as the scroll view is scrolled.

After this change, the navigation bar's height will always default to the same fixed height on all devices. This reflects the fact that Flexible Header's default minimumHeight and maximumHeight values are constant across all devices.

Closes https://github.com/material-components/material-components-ios/issues/4840
2018-08-23 09:48:10 -04:00
Ian Gordon
58761c75f6 Remove methods duplicated in categories 2018-08-16 14:49:39 -04:00
Robert Moore
175942d9e0
[Catalog] Fix Swift example imports (#4780)
Many of our Swift examples are either missing imports or are importing all of
MaterialComponents. Both of these will cause failures during internal builds.
2018-08-14 13:26:37 -04:00
featherless
e14b90e829
[schemes/Color] Formally mark all to-be-deprecated APIs as "ToBeDeprecated". (#4738)
This change further formalizes our pattern of annotating APIs that will be or are deprecated using class categories. Moving an API into such a category has the benefit of being picked up by the API diff toolchain and elevated into our release notes as a result.
2018-08-09 16:39:56 -04:00
featherless
7f5f920493
[ButtonBar] Remove NSCoding support. (#4553)
Closes https://github.com/material-components/material-components-ios/issues/3947
2018-07-16 08:04:41 -04:00
Randall Li
95751ee02b Update disabled button alpha to match spec (#4430) 2018-06-22 15:30:04 -04:00
featherless
c1b513ba9e
[ButtonBar] Add tintColor observation support. (#4380)
This allows button bar buttons to observe the following additional UIBarButtonItem properties:

 - accessibilityHint
 - accessibilityIdentifier
 - accessibilityLabel
 - accessibilityValue
- tag
- tintColor

Closes https://github.com/material-components/material-components-ios/issues/3692.
2018-06-07 16:23:34 -04:00
featherless
fc2671fe94
[ButtonBar] Add unit tests for KVO behavior. (#4379)
These tests verify that the following properties are observed:

- Title
- Image
- Enabled

This change is part of resolving https://github.com/material-components/material-components-ios/issues/3692
2018-06-07 11:23:09 -04:00
featherless
e1e6d249a4
[Docs] Add badges to all components. (#4278)
As part of our readme generator, components can now opt in to displaying badges in their readme.

The badges are generated from https://shields.io/ and are focused on an individual component. We're currently generating the following badges:

- Open bug count.
2018-05-25 11:12:48 -04:00
John Detloff
0c0ce4248e
Initialize default color and typography schemes in examples (#4200)
Ensure a default colorScheme and typographyScheme is initialized for examples.
2018-05-21 12:44:43 -04:00
Jeff Verkoeyen
f059a37d50 Avoid picking up class properties in the API table for READMEs. 2018-05-04 09:16:24 -04:00
featherless
a078a9722d
Standardize the casing for all components to match spec. (#3693) 2018-05-03 15:02:36 -04:00
featherless
da21941afa
Regenerate component docs with automatic API links. (#3673)
Example output:

<img width="468" alt="screen shot 2018-05-02 at 10 33 23 pm" src="https://user-images.githubusercontent.com/45670/39557914-d9512f38-4e58-11e8-824d-60f03bcd1b76.png">
2018-05-02 22:33:55 -04:00
featherless
037bf7d0f0
Flatten all +Extensions CocoaPods targets into standalone targets. (#3572)
This discourages depending on all of a component's extensions and aligns our targets more closely with how we expect them to be imported and depended upon.

This is a breaking change.

Pivotal story: https://www.pivotaltracker.com/story/show/157118721
2018-05-02 10:20:01 -04:00
featherless
3e2cca9e98
[ButtonBar] Remove from the website. (#3638)
This component is an implementation detail of NavigationBar and should probably be private.
2018-05-01 23:03:19 -04:00
featherless
d0866fc6f0
Mark all of the AppBar implementation component examples as dragons. (#3596)
ButtonBar, FlexibleHeader, HeaderStackView, and NavigationBar are all implementation details of AppBar. While these components can be used on their own, in practice we expect most typical usage to rely on AppBar. FlexibleHeader is a bit blurry in that there is often value in relying on it solely, but because it is not a true concept in the spec and its behavioral demos largely overlap with AppBar's, it is now a dragons demo.

Pivotal story: https://www.pivotaltracker.com/story/show/156982162
2018-05-01 16:46:13 -04:00
featherless
74d0320132
[ButtonBar] Split the documentation into separate articles and run the readme generator. (#3614) 2018-05-01 16:06:47 -04:00
featherless
f8f8092a6e [ButtonBar] Fix typo in docs. (#3580)
Fixed misspelling of 'warning' in the headerdoc.
2018-04-30 09:37:37 -04:00
Adrian Secord
7a7293883f
Remove space after triple-backtick Markdown syntax. (#3577) 2018-04-29 09:00:53 -04:00
featherless
d3c5316db0 Generate all themer documentation. (#3562)
* Generate all themer documentation.

* Fix Snackbar vars.

* Fix textfields vars.

* Fix link.

* Fix bottom app bar vars.

* Fix more vars.

* Add home page links.

* Fix typos.

* Fix more links.

* Add ink.

* Tabs.

* Cleanup.
2018-04-27 16:59:03 -04:00
featherless
4186de3733
Adding .vars files for each component. (#3557) 2018-04-27 12:20:05 -04:00
featherless
0cc7e9860f
Standardizing API docs. (#3481)
This standardizes the themer API docs for every component.

Pivotal story: https://www.pivotaltracker.com/story/show/157066083
2018-04-26 22:25:57 -04:00
featherless
8395836c98
Remove all UIAppearance references from documentation. (#3480)
We do not intend to actively support UIAppearance any further. This change removes any references to supporting UIAppearance from our public documentation.

Pivotal story: https://www.pivotaltracker.com/story/show/157048342
2018-04-26 12:55:35 -04:00
Yarden Eitan
7f7bc36202
[Catalog] Expose colorScheme + typographyScheme properties for all examples to use app wide theming (#3478)
Made colorScheme and typographyScheme properties in the class interfaces for all our examples.
Moved theming away from example inits and into viewDidLoad
Small update for slider example to allow it to grab the theming properly.
Related Pivotal: https://www.pivotaltracker.com/story/show/156616695
2018-04-25 15:15:17 -04:00
featherless
a448657a23
[ButtonBar] Add umbrella headers for all extension targets. (#3462)
Also updated all imports to make use of the umbrella headers.

Pivotal story: https://www.pivotaltracker.com/story/show/157045283
2018-04-24 17:21:12 -04:00
featherless
23110ef116
[Catalog] Make all swift copycat demos be dragons. (#3443)
Also removed "(Swift)" from any examples that remained as non-dragons. The catalog does not need to advertise which language a given demo is in.

Pivotal story: https://www.pivotaltracker.com/story/show/156939611

## Screenshots

Before:
![simulator screen shot - iphone se - 2018-04-23 at 14 04 14](https://user-images.githubusercontent.com/45670/39144588-36095450-46ff-11e8-868d-bdb7e8ee5438.png)

After:
![simulator screen shot - iphone se - 2018-04-23 at 13 53 39](https://user-images.githubusercontent.com/45670/39144567-2ad7bf9a-46ff-11e8-9fd5-ef0739d427b3.png)
2018-04-24 15:52:13 -04:00
Ali Rabbani
3c112ae350 [ButtonBar] Make left/right insets for image and text buttons consistent (#3397)
Internal testing of this PR is done in cl/193415210. This is a behavior change for text button insets in MDCButtonBar.

NOTE: This doesn't *change* insets for text buttons that are the only button in the bar on iPad, since it still adds a 12pt inset on both sides for it. on iPhone, the additional inset for edge buttons is 4pt, which results in a 16pt inset on the edge side(s).

Before screenshots:
[Text buttons on both sides](https://user-images.githubusercontent.com/2232489/38957009-57ca20fa-4327-11e8-9f62-a92a61c7f20f.png)
[Text button on one side](https://user-images.githubusercontent.com/2232489/38957010-57d6b784-4327-11e8-8971-2c565833052d.png)

After screenshots:
[Text buttons on both sides](https://user-images.githubusercontent.com/2232489/38957016-5c719ee4-4327-11e8-886c-a7b6bdece4b5.png)
[Text button on one side](https://user-images.githubusercontent.com/2232489/38957017-5c7ebd36-4327-11e8-868b-5fde087eb382.png)

closes #3342
2018-04-23 14:40:25 -04:00
featherless
5a372de8fc
[ButtonBar] Add a stateful buttons title color API. (#3414)
This API allows a client to customize the title color for buttons for a given control state.

Related to https://www.pivotaltracker.com/story/show/156934328

Screenshot shows a button with a custom normal and highlighted state. The button on the left is highlighted.

![simulator screen shot - iphone se - 2018-04-19 at 19 51 59](https://user-images.githubusercontent.com/45670/39024065-786db638-440c-11e8-97e8-f6bf3e6c2af7.png)
2018-04-20 10:17:16 -04:00
featherless
a400ff0b30
[ButtonBar] Fix layout behavior when using custom button title font. (#3410)
Button frames need to be updated after the font changes because their frames are not dynamically updated in any layoutSubviews pass.

It may be sensible to update layoutSubviews to do the frame calculations in a follow-up change, but this has the potential to be a behaviorally-breaking change so I've filed a follow-up story: https://www.pivotaltracker.com/story/show/156930078
2018-04-20 10:08:03 -04:00
featherless
289223a5bb
[ButtonBar] Add a Typography Themer. (#3395)
Pivotal story: https://www.pivotaltracker.com/n/projects/2150420/stories/156769836

![simulator screen shot - iphone se - 2018-04-18 at 12 07 32](https://user-images.githubusercontent.com/45670/38957691-396cc5ca-4329-11e8-8a18-5d76cd50b736.png)
2018-04-19 19:55:44 -04:00
featherless
e11d24a110
[ButtonBar] Expose APIs for setting custom button fonts. (#3389)
This introduces a new API to MDCButtonBar that allows the title font to be customized for a given state. This is part of the work required to allow MDCNavigationBar to support custom button title fonts.

Pivotal story: https://www.pivotaltracker.com/story/show/156769836

Example of customization:

![simulator screen shot - iphone se - 2018-04-18 at 12 07 32](https://user-images.githubusercontent.com/45670/38945147-b7971dea-4303-11e8-86ca-31eaf45f416f.png)
2018-04-18 16:47:23 -04:00
Ali Rabbani
65091d5e36 [NavigationBar][ButtonBar] Restore the changed default inkColor
The issue was caused by #3250, where we override MDCFlatButton's appearance.inkColor with MDCButton's default inkColor.

5fe8cf2752/components/Buttons/src/MDCFlatButton.m (L32)
2018-04-16 15:36:21 -04:00
Ali Rabbani
8af9e9fc81 [ButtonBar] Allow customizing the inkColor of the buttons (#3250)
Make inkColor for buttons in MDCButtonBar customizable. Also expose an API on MDCNavigationBar to allow using the custom inkColor in AppBar.

closes #1660
2018-04-13 09:05:22 -04:00
Ali Rabbani
992d581481 [NavigationBar] Allow flexible height/insets in MDCNavigationBar (#3305)
This is a roll-forward for #2974, with fixes for the internal issues. We now have an API, and only change the behavior when the API is used. That API should be mainlined when all clients adopt the new behavior.

[titleLabel with titleView with useFlexibleTopBottomInsets=YES](https://user-images.githubusercontent.com/2232489/38525318-c7890406-3c1f-11e8-81f3-b72afee2dd71.png)
[titleLabel with titleView with useFlexibleTopBottomInsets=YES](https://user-images.githubusercontent.com/2232489/38525320-c7a32570-3c1f-11e8-9e46-e232307a5a0a.png)


[titleLabel with titleView with useFlexibleTopBottomInsets=NO (current behavior)](https://user-images.githubusercontent.com/2232489/38525261-9bf7b2f6-3c1f-11e8-9942-048c139e6163.png)
[titleLabel with titleView with useFlexibleTopBottomInsets=NO (current behavior)](https://user-images.githubusercontent.com/2232489/38525286-b150692c-3c1f-11e8-94b3-167d75393870.png)

[titleView with useFlexibleTopBottomInsets=NO (current behavior)](https://user-images.githubusercontent.com/2232489/38525208-72545e4a-3c1f-11e8-8e5e-eb9b3457c8b3.png)
[titleView with useFlexibleTopBottomInsets=YES](https://user-images.githubusercontent.com/2232489/38525209-725f4012-3c1f-11e8-838d-f6872a760931.png)

Internal testing done in cl/192612758.

closes #2793
closes #253
2018-04-13 09:02:59 -04:00
Ali Rabbani
9947b8fa2b [ButtonBar] Fix insets for the trailing button bar (#3324)
Fix button insets used in MDCNavigationBar's trailing button bar. 

Internal testing of this PR is done in cl/192473549.

closes #2851
closes #3315
2018-04-12 14:53:57 -04:00
Jeff Verkoeyen
18b937aa31 Merge branch 'hotfix-53.0.0' into develop 2018-04-06 16:38:32 -04:00
Robert Moore
a5c0c8603e
Revert "[AppBar] Make MDCNavigationBar and MDCButtonBar size dynamically (#2974)" (#3276)
Internal clients have broken layouts when using custom titleViews after this
change. Reverting as a hotfix until a migration path can be developed.

This reverts commit 7172657a7b1cd04839eadc10e9d66e895a71bee7.
2018-04-06 15:19:58 -04:00
featherless
9d9e8cd3ba
[ButtonBar] Update documentation for the themer. (#3265)
Remove references to UIAppearance and clarify the class' intent.
2018-04-06 09:47:42 -04:00
featherless
5c09f5e625
[ButtonBar] Implement new semantic color scheme themer APIs. (#3252)
Also updated the examples accordingly.

Pivotal story: https://www.pivotaltracker.com/story/show/156169509

![simulator screen shot - iphone 8 plus - 2018-04-05 at 12 57 34](https://user-images.githubusercontent.com/45670/38380177-f9ba1c46-38d0-11e8-9a6a-ef6f91a23d7e.png)
2018-04-06 09:03:15 -04:00
Ali Rabbani
7172657a7b [AppBar] Make MDCNavigationBar and MDCButtonBar size dynamically (#2974)
* Allow setting a custom height on MDCNavigationBar and MDCButtonBar. Currently, these two components don't respect the height that is used for MDCAppBar, and position the buttons incorrectly when a height other than 56.0f is used.

* Make MDCNavigationBar and MDCButtonBar size dynamically instead of exposing an API.

* Fix whitespace

* Maintain previous functionality by checking size.height > 0 in sizeThatFits: for both MDCNavigationBar and MDCButtonBar.
2018-03-21 13:10:25 -04:00