106 Commits

Author SHA1 Message Date
Nobody
7c19c196a7 Add imageViewSize property to MDCChipView.
PiperOrigin-RevId: 750667661
2025-04-23 11:40:01 -07:00
Nobody
86241a2598 Make textField padding and text inset an editable variable in chipField
PiperOrigin-RevId: 652493790
2024-07-15 08:42:01 -07:00
David Collazo
7fd4094424 Change MDCChipField to use UITextField instead of MDCTextField.
PiperOrigin-RevId: 591304366
2023-12-15 11:01:16 -08:00
Nobody
9e1c0c0a45 Internal change
PiperOrigin-RevId: 477458164
2022-09-28 08:26:32 -07:00
Randall Li
9100ba8f35 [Color blending] Delete colorBlending API from ColorSchemes. Use MDC Color component instead.
Migrate remaining colorBlending API use from ColorSchemes to the MDC Color component.

PiperOrigin-RevId: 464917740
2022-08-02 16:44:21 -07: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
Alyssa Weiss
6ccb268a37 Move FontScaler APIs in MDCTypography to a separate directory.
PiperOrigin-RevId: 390642325
2021-08-13 10:33:45 -07:00
Andrew Overton
0727135757 [Chips] Explicitly trigger layout pass
PiperOrigin-RevId: 383412610
2021-07-07 08:03:43 -07:00
Alyssa Weiss
9107b8fe42 Remove adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable API from MDCChipView.
PiperOrigin-RevId: 376256843
2021-05-27 15:03:34 -07:00
Nobody
32fdb16b23 This CL makes two changes:
1. Adds a new delegate method `chipFieldShouldEndEditing` to match `chipFieldShouldBeginEditing`
2. Moved the call to the chip field delegate for `chipFieldDidBeginEditing` and `chipFieldDidEndEditing` so they are fired at the correct time.

I noticed that the UITextFieldDelegate method `textFieldShouldBeginEditing` can be called without actually becoming the first responder if the previous first responder doesn't resign it. That meant that the chip field would still claim to have begun editing even if it hadn't.

PiperOrigin-RevId: 367240207
2021-04-07 09:56:09 -07:00
Alyssa Weiss
924c49e43b Remove all iOS 10 availability checks from material_components_ios now that only iOS 10+ is supported.
PiperOrigin-RevId: 366437050
2021-04-02 06:33:16 -07:00
Jeff Verkoeyen
1c14fb5e7b Internal change.
PiperOrigin-RevId: 363294413
2021-03-16 16:23:36 -07:00
Jeff Verkoeyen
4c86b139e4 Optimizing imports
PiperOrigin-RevId: 357185900
2021-02-12 07:35:17 -08:00
Bryan Oltman
da4b8f7c7f Fix mdc_elevationDidChangeBlock block parameter types for Xcode 12
PiperOrigin-RevId: 331843566
2020-09-15 13:39:15 -07:00
Jeff Verkoeyen
eb82984224 Internal change
PiperOrigin-RevId: 331764642
2020-09-15 07:31:56 -07:00
Yarden Eitan
6543af21be [Chips] Have Ripple imitate Ink's behavior in MDCChipView.
PiperOrigin-RevId: 331247922
2020-09-11 16:43:25 -07:00
Wenyu Zhang
70d7a73cb4 [Chips] Add a snapshot test case for MDCChipView with minimumSize set and centerVisible set to YES.
PiperOrigin-RevId: 326545217
2020-08-13 16:14:49 -07:00
Wenyu Zhang
f716061f0f [Chips] Expose visibleAreaInsets as a public readonly API.
PiperOrigin-RevId: 325101887
2020-08-05 14:32:17 -07:00
Wenyu Zhang
899c57e8d5 [MDC-iOS/Chips] Remove visibleAreaInsets from public API.
PiperOrigin-RevId: 325085562
2020-08-05 13:11:52 -07:00
Cody Weaver
8a509d558f [MDC/Chips] Add rippleForState APIs.
This change adds rippleForState APIs for MDCChipView to allow easier migration for the ink component.

PiperOrigin-RevId: 323364613
2020-07-27 08:28:08 -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
ab2801297f [Chips] Add cornerRadius API to support customizing chip's corner radius.
PiperOrigin-RevId: 314752044
2020-06-04 10:14:24 -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
Bryan Oltman
4862d65e13 [Chips] Inform MDCChipField's delegate of height change in layoutSubviews.
This fixes an issue where an MDCChipField height change triggered by text input would not inform the delegate of the height change. Because we're now sending the height changed message in layoutSubviews, we also need to remove the notifyDelegateIfSizeNeedsToBeUpdated method to avoid duplicate calls to chipFieldHeightDidChange:.

PiperOrigin-RevId: 307814300
2020-04-22 07:44:48 -07:00
Bryan Oltman
ee625232f8 [Chips] Add unit tests for MDCChipField delegate interaction.
These tests expose an issue where MDCChipField does not notify its delegate of a height change triggered by text input.

PiperOrigin-RevId: 307422898
2020-04-20 10:13:01 -07:00
Cody Weaver
cfb97206ea [MDC/Chips] Update intrinsicContentSize when text, font, or image change.
Currently since we expose the `titleLabel` and `imageView` of the `MDCChipView` when properties that can result in changes in size occur clients need to call `invalidateIntrinsicContentSize` in order to get the chip to update it's layout. This should be handled on our end instead of requiring clients to force the chip to layout when these properties change we can do it for them in the component. This issue occurs when the client has set the `autoresizingMask` to `.flexibleWidth, .flexibHeight` and constrained the position of the chip as seen in the tests.

I added unit test here instead of snapshot test because `BOOL success = [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];` in the snapshot test forces the chip to relay itself out causing the test to look like they are passing when they really aren't.

An alternative approach here would be to subclass UIImageView and UILabel and when the respective properties are set we can `invalidateIntrinsicContentSize` on the chip but I felt this case was better suited for KVO so we don't have to maintain these subclasses.

PiperOrigin-RevId: 302049886
2020-03-20 10:12:42 -07:00
Bryan Oltman
992d235d9b
[Chips] Do not include contentEdgeInsets for MDCChipField placeholder if no placeholder is present (#9847)
Adds a snapshot test to demonstrate #9846
2020-03-05 15:19:34 -05:00
Bryan Oltman
0d00e58cd0
[Chips] Add MDCChipField snapshot test for placeholder truncation (#9842)
Adds a snapshot test exposing placeholder truncation issue in MDCChipField. This will be fixed in a followup PR.
2020-03-05 13:19:14 -05:00
Bryan Oltman
e1aee8556d
[Chips] Resize MDCChipField's textField frame instead of using left insets to align with chips (#9837)
Updates calculation of text field frame in MDCChipField.

Previously, the text field's frame was always the full width of its parent MDCChipField, with the left inset being provided by textInsets:withSizeThatFitsWidthHint:. This change updates the left inset to be constant, and updates the text field frame's width to fit the available space to the side of the chips if the text field's text is short enough.

This is a partial roll-forward of https://github.com/material-components/material-components-ios/pull/9828. The primary change is that the default minimum text field width has been updated to match the minimum HIG-recommended touch target size.

Pre-work for #9006
2020-03-05 10:49:12 -05:00
Bryan Oltman
a42a84cca9
[Chips] Add MDCChipField snapshot tests verifying text field placement (#9831)
* [Chips] Add MDCChipField snapshot tests verifying text field placement

* clang

* Add calls to sizeToFit to capture overall chip field size

* Cast doubles to CGFloats
2020-03-04 14:56:59 -05:00
Bryan Oltman
f8d520b4f1
[Chips] Revert "Resize MDCChipField's textField frame instead of using left insets to align with chips" (#9828)
Reverts 04567ba1653cb61927117160c3e8fd37e186d4b9 and 8b7c2b696c1f1ea212817f38b75d47825f3deb39

This change is getting rolled back because, when adding chips programatically, the MDCChipField grows taller than it should. After rollback, I'll add snapshot and/or unit tests to capture the current behavior and attempt to fix the issue then. 

Reopens #9006
2020-03-04 10:03:59 -05:00
Bryan Oltman
04567ba165
[Chips] Resize MDCChipField's textField frame instead of using left insets to align with chips (#9827)
* [Chips] Resize MDCChipField's textField frame instead of using left insets to align with chips

* Update tests to reflect text field frame editing (instead of placeholder frame editing)

* clang
2020-03-03 16:21:36 -05:00
Yarden Eitan
9b21ec994b
[Chips] MDCChipCollectionViewCell to correctly support increased touch target (#9816)
Currently, the Chips component uses the `hitAreaInsets` API to allow an increase of the touch target of the view. However, when using MDCChipCollectionViewCell, setting the `hitAreaInsets` does not work, because there is no pointInside method to increase the tap target for the cell itself, which is responsible for the touches. This PR adds the same logic to the chip cell, borrowing the value of the hitAreaInsets from the chip view.

Tested in catalog with iOS 13 and iPhone Max Pro simulator and added unit tests.

Closes #9276
2020-02-28 13:53:25 -05:00
Bryan Oltman
45952d95a7
[Chips] Add snapshot tests for MDCChipCollectionViewFlowLayout (#9796)
* [Chips] Add snapshot tests for MDCChipCollectionViewFlowLayout

* cleanup
2020-02-25 16:23:37 -05:00
Randall Li
33fbdfc3be
[Material][Availability] Migrates Chips to MDCAvailability. (#9713)
[Material][Availability] Migrates Chips to MDCAvailability.
2020-02-14 15:02:13 -05:00
Robert Moore
8377722bdb [Chips] Additional imagePadding tests. (#9441)
Adds extra tests for `imagePadding` focused on when no image is visible or
when only `selectedImage` is visible.

Preparation to roll-forward #9267
Part of #9250
2020-01-21 16:21:26 -05:00
Robert Moore
aadb9a6bd0
[Chips] Add snapshot tests for selectedImage layout. (#9425)
Adds more snapshot tests to capture the behavior of Chips when a
`selectedImageView.image` is set. An upcoming change will correct the layout
of subviews when `imagePadding` is used, and these tests capture errors that
take place when a `selectedImageView.image` is set.

Preparation for #9250

This is a roll-forward of #9266
2020-01-13 16:09:06 -05:00
Robert Moore
9694cb2fb6
[Chips] Tests to evaluate padding APIs. (#9423)
Adds several new snapshot tests intended to evaluate the following APIs:
*  `- contentPadding`
*  `- titlePadding`
*  `- imagePadding`
*  `- accessoryPadding`

Confirms bugs found as part of #7940

This is a roll-forward of #9252
2020-01-13 15:09:38 -05:00
Randall Li
b4b033c7c7 Revert "[Chips] Tests to evaluate padding APIs. (#9252)"
This reverts commit 2bd1b89c88d505fadbe45f7a0c21534802e8c2d0.
2019-12-18 00:30:44 -05:00
Randall Li
6cd3bdb40a Revert "[Chips] Add snapshot tests for selectedImage layout. (#9266)"
This reverts commit c9cc0f1a6bf7dc9e92b758e7783e48606ee9b1b7.
2019-12-18 00:30:19 -05:00
Randall Li
7d5b9a4e61 Revert "[Chips] Fix imagePadding behavior. (#9267)"
This reverts commit 7a5cc0f17a114a3dfa1301048d6410ce89d0a317.
2019-12-18 00:30:08 -05:00
Robert Moore
7a5cc0f17a
[Chips] Fix imagePadding behavior. (#9267)
Corrects the behavior of `imagePadding` in two significant ways:

*   Previously, the union of the frames of `selectedImageView` and `imageView`
    were used to determine the position of the `titleLabel`. However, since
    `selectedImageView` is documented as not having an effect on
    `MDCChipView` unless it is set and the Chip is selected, it should not have
    any effect on the frame calculations when unselected or unset.
*   `imagePadding` is now only applied if either `selectedImageView` or
    `imageView` in the Chip. Previously, `imagePadding` would have been
    applied even without an image present.

Closes #9250
2019-12-13 10:02:22 -05:00
Robert Moore
c9cc0f1a6b
[Chips] Add snapshot tests for selectedImage layout. (#9266)
Adds more snapshot tests to capture the behavior of Chips when a
`selectedImageView.image` is set. An upcoming change will correct the layout
of subviews when `imagePadding` is used, and these tests capture errors that
take place when a `selectedImageView.image` is set.

Preparation for #9250
2019-12-12 23:36:23 -05:00
Robert Moore
2bd1b89c88
[Chips] Tests to evaluate padding APIs. (#9252)
Adds several new snapshot tests intended to evaluate the following APIs:
*  `- contentPadding`
*  `- titlePadding`
*  `- imagePadding`
*  `- accessoryPadding`

Confirms bugs found as part of #7940
2019-12-12 09:20:05 -05:00
Robert Moore
df352364df
[Chips] Fix calculation of accessory frame. (#9167)
The accessory view's frame was incorrectly calculated by ignoring its `.left`
padding value. This would result in the padding being added twice when the
Chip was sized and laid-out.

Preparation for #7940
2019-12-09 08:16:53 -05:00
Bryan Oltman
9c3a3fbdd2
[Chips] Add chipFieldShouldBeginEditing method to MDCChipFieldDelegate (#9157)
Adds `chipFieldShouldBeginEditing` to `MDCChipFieldDelegate` to control whether a `MDCChipField` can begin editing.

Fixes #7106
2019-12-06 14:34:53 -05:00
Robert Moore
c369d445e5
[Chips] Add RTL snapshot tests. (#9131)
Adds simple snapshot tests for Right-To-Left (RTL) layout.

Closes #4518
2019-12-06 08:05:22 -05:00
Bryan Oltman
f848eaf5ee
[Chips] Delete Themers (#9028)
* [Chips] Delete Themers

* clang

* Delete MDCChipViewTypographyThemer, update BUILD file

* Use correct MDCChipViewColorThemer applySemanticColorScheme implementation for applyThemeWithColorScheme

* Delete Chip imports from Shape BUILD file

* Delete Chips themers from podspec

* Preserve example behavior

* Fix Shape scheme BUILD file
2019-12-05 14:12:21 -05:00