diff --git a/CHANGELOG.md b/CHANGELOG.md index d2e893f452d..1917da33f4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,56 @@ +# 103.0.0 + +This major release includes a refactoring of the TextControls libraries, a theming extension for TextFields' underline controller, +a bugfix change to Chips imagePadding handling, and the annotation of an AppBar API as to be deprecated. + +## API changes + +### TextControls+BaseTextFields + +**New extension.** + +### TextControls+Enums + +**New extension.** + +### TextControls+FilledTextFields + +**New extension.** + +### TextControls+FilledTextFieldsTheming + +**New extension.** + +### TextControls+OutlinedTextFields + +**New extension.** + +### TextControls+OutlinedTextFieldsTheming + +**New extension.** + +## Component changes + +### AppBar + +* [Annotate MDCAppBarNavigationControllerDelegate's appBarNavigationController:willAddAppBar:asChildOfViewController: as to be deprecated. (#9395)](https://github.com/material-components/material-components-ios/commit/8f80efe08d3af4643ef402f10d369f15f4eeef51) (featherless) + +### Chips + +* [Additional `imagePadding` tests. (#9441)](https://github.com/material-components/material-components-ios/commit/8377722bdb22163068e0775aea5cc39a89a35f6f) (Robert Moore) +* [Fix `contentPadding` API. (#9440)](https://github.com/material-components/material-components-ios/commit/d1d494b0ef0fe716f9b1422830077b5552e48996) (Robert Moore) +* [Fix `imagePadding` behavior. (#9442)](https://github.com/material-components/material-components-ios/commit/944ed3a1852e77dcf8a961e022fd18dd3645b6dc) (Robert Moore) + +### TextFields + +* [Add theming extension for underline controller (#9437)](https://github.com/material-components/material-components-ios/commit/3b3d288ea42ddcc53b61127283770f145b9def38) (Cody Weaver) + +## Multi-component changes + +* [Restructure Cocoapods and Blaze targets (#9430)](https://github.com/material-components/material-components-ios/commit/083cf8c12f8efe1d9351ddb56f513a5fed5cd289) (Andrew Overton) + +--- + # 102.0.0 This major hotfix release reverts a change introduced in 101.1.0 that caused Snackbar not to appear in some situations. diff --git a/MaterialComponents.podspec b/MaterialComponents.podspec index 1c76d6669f1..052577b3149 100644 --- a/MaterialComponents.podspec +++ b/MaterialComponents.podspec @@ -2,7 +2,7 @@ load 'scripts/generated/icons.rb' Pod::Spec.new do |mdc| mdc.name = "MaterialComponents" - mdc.version = "102.0.0" + mdc.version = "103.0.0" mdc.authors = "The Material Components authors." mdc.summary = "A collection of stand-alone production-ready UI libraries focused on design details." mdc.homepage = "https://github.com/material-components/material-components-ios" @@ -1536,47 +1536,117 @@ Pod::Spec.new do |mdc| end end - mdc.subspec "TextControls" do |component| + # TextControls+Enums + + mdc.subspec "TextControls+Enums" do |component| component.ios.deployment_target = '9.0' - component.public_header_files = "components/#{component.base_name}/src/*.h" - component.source_files = [ - "components/#{component.base_name}/src/*.{h,m}", - "components/#{component.base_name}/src/private/*.{h,m}" + component.public_header_files = "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.h" + component.source_files = "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.{h,m}" + end + + # TextControls+BaseTextFields + + mdc.subspec "TextControls+BaseTextFields" do |component| + component.ios.deployment_target = '9.0' + component.public_header_files = "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.h" + component.source_files = [ "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.{h,m}", + "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/private/*.{h,m}" ] - component.dependency "MaterialComponents/AnimationTiming" - component.dependency "MaterialComponents/private/Math" + component.dependency "MaterialComponents/private/TextControlsPrivate+Shared" + component.dependency "MaterialComponents/private/TextControlsPrivate+BaseStyle" component.dependency "MDFInternationalization" component.test_spec 'UnitTests' do |unit_tests| unit_tests.source_files = [ - "components/#{component.base_name}/tests/unit/*.{h,m,swift}", - "components/#{component.base_name}/tests/unit/supplemental/*.{h,m,swift}" + "components/#{component.base_name.split('+')[0]}/tests/unit/#{component.base_name.split('+')[1]}/*.{h,m,swift}" ] - unit_tests.resources = "components/#{component.base_name.split('+')[0]}/tests/unit/#{component.base_name.split('+')[1]}/resources/*" + unit_tests.dependency "MaterialComponents/schemes/Container" end end - mdc.subspec "TextControls+Theming" do |extension| - extension.ios.deployment_target = '9.0' - extension.public_header_files = "components/#{extension.base_name.split('+')[0]}/src/#{extension.base_name.split('+')[1]}/*.h" - extension.source_files = [ - "components/#{extension.base_name.split('+')[0]}/src/#{extension.base_name.split('+')[1]}/*.{h,m}", - "components/#{extension.base_name.split('+')[0]}/src/#{extension.base_name.split('+')[1]}/private/*.{h,m}" + # TextControls+FilledTextFields + + mdc.subspec "TextControls+FilledTextFields" do |component| + component.ios.deployment_target = '9.0' + component.public_header_files = "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.h" + component.source_files = [ + "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.{h,m}", + "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/private/*.{h,m}" ] - extension.dependency "MaterialComponents/#{extension.base_name.split('+')[0]}" - extension.dependency "MaterialComponents/schemes/Color" - extension.dependency "MaterialComponents/schemes/Container" - extension.dependency "MaterialComponents/schemes/Typography" - extension.test_spec 'UnitTests' do |unit_tests| + component.dependency "MaterialComponents/TextControls+BaseTextFields" + component.dependency "MaterialComponents/private/TextControlsPrivate+FilledStyle" + + component.test_spec 'UnitTests' do |unit_tests| unit_tests.source_files = [ - "components/#{extension.base_name.split('+')[0]}/tests/unit/#{extension.base_name.split('+')[1]}/*.{h,m,swift}" + "components/#{component.base_name.split('+')[0]}/tests/unit/#{component.base_name.split('+')[1]}/*.{h,m,swift}" + ] + unit_tests.dependency "MaterialComponents/schemes/Container" + end + end + + # TextControls+FilledTextFieldsTheming + + mdc.subspec "TextControls+FilledTextFieldsTheming" do |component| + component.ios.deployment_target = '9.0' + component.public_header_files = "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.h" + component.source_files = [ + "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.{h,m}", + "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/private/*.{h,m}" + ] + + component.dependency "MaterialComponents/TextControls+FilledTextFields" + component.dependency "MaterialComponents/schemes/Container" + + component.test_spec 'UnitTests' do |unit_tests| + unit_tests.source_files = [ + "components/#{component.base_name.split('+')[0]}/tests/unit/#{component.base_name.split('+')[1]}/*.{h,m,swift}" + ] + end + end + + # TextControls+OutlinedTextFields + + mdc.subspec "TextControls+OutlinedTextFields" do |component| + component.ios.deployment_target = '9.0' + component.public_header_files = "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.h" + component.source_files = [ + "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.{h,m}", + "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/private/*.{h,m}" + ] + + component.dependency "MaterialComponents/TextControls+BaseTextFields" + component.dependency "MaterialComponents/private/TextControlsPrivate+OutlinedStyle" + + component.test_spec 'UnitTests' do |unit_tests| + unit_tests.source_files = [ + "components/#{component.base_name.split('+')[0]}/tests/unit/#{component.base_name.split('+')[1]}/*.{h,m,swift}" ] unit_tests.dependency "MaterialComponents/schemes/Container" end end + # TextControls+OutlinedTextFieldsTheming + + mdc.subspec "TextControls+OutlinedTextFieldsTheming" do |component| + component.ios.deployment_target = '9.0' + component.public_header_files = "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.h" + component.source_files = [ + "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.{h,m}", + "components/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/private/*.{h,m}" + ] + + component.dependency "MaterialComponents/TextControls+OutlinedTextFields" + component.dependency "MaterialComponents/schemes/Container" + + component.test_spec 'UnitTests' do |unit_tests| + unit_tests.source_files = [ + "components/#{component.base_name.split('+')[0]}/tests/unit/#{component.base_name.split('+')[1]}/*.{h,m,swift}" + ] + end + end + mdc.subspec "TextFields+ColorThemer" do |extension| extension.ios.deployment_target = '9.0' extension.public_header_files = [ @@ -1803,7 +1873,6 @@ Pod::Spec.new do |mdc| component.ios.deployment_target = '9.0' component.public_header_files = "components/private/#{component.base_name}/src/*.h" component.source_files = "components/private/#{component.base_name}/src/*.{h,m}" - component.test_spec 'UnitTests' do |unit_tests| unit_tests.source_files = [ "components/private/#{component.base_name}/tests/unit/*.{h,m,swift}", @@ -1830,6 +1899,47 @@ Pod::Spec.new do |mdc| end end + private_spec.subspec "TextControlsPrivate+Shared" do |component| + component.ios.deployment_target = '9.0' + component.public_header_files = "components/private/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.h" + component.source_files = [ "components/private/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.{h,m}" + ] + component.dependency "MaterialComponents/TextControls+Enums" + component.dependency "MaterialComponents/AnimationTiming" + component.dependency "MaterialComponents/private/Math" + end + + private_spec.subspec "TextControlsPrivate+BaseStyle" do |component| + component.ios.deployment_target = '9.0' + component.public_header_files = "components/private/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.h" + component.source_files = [ "components/private/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.{h,m}" + ] + component.dependency "MaterialComponents/private/TextControlsPrivate+Shared" + component.dependency "MaterialComponents/AnimationTiming" + component.dependency "MaterialComponents/private/Math" + end + + private_spec.subspec "TextControlsPrivate+FilledStyle" do |component| + component.ios.deployment_target = '9.0' + component.public_header_files = "components/private/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.h" + component.source_files = [ "components/private/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.{h,m}" + ] + + component.dependency "MaterialComponents/private/TextControlsPrivate+Shared" + component.dependency "MaterialComponents/AnimationTiming" + component.dependency "MaterialComponents/private/Math" + end + + private_spec.subspec "TextControlsPrivate+OutlinedStyle" do |component| + component.ios.deployment_target = '9.0' + component.public_header_files = "components/private/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.h" + component.source_files = [ "components/private/#{component.base_name.split('+')[0]}/src/#{component.base_name.split('+')[1]}/*.{h,m}" + ] + component.dependency "MaterialComponents/private/TextControlsPrivate+Shared" + component.dependency "MaterialComponents/AnimationTiming" + component.dependency "MaterialComponents/private/Math" + end + private_spec.subspec "ThumbTrack" do |component| component.ios.deployment_target = '9.0' component.public_header_files = "components/private/#{component.base_name}/src/*.h" diff --git a/MaterialComponentsBeta.podspec b/MaterialComponentsBeta.podspec index 59c7a71ebde..60d5b4540e2 100644 --- a/MaterialComponentsBeta.podspec +++ b/MaterialComponentsBeta.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |mdc| mdc.name = "MaterialComponentsBeta" - mdc.version = "102.0.0" + mdc.version = "103.0.0" mdc.authors = "The Material Components authors." mdc.summary = "A collection of stand-alone alpha UI libraries that are not yet guaranteed to be ready for general production use. Use with caution." mdc.homepage = "https://github.com/material-components/material-components-ios" diff --git a/MaterialComponentsEarlGreyTests.podspec b/MaterialComponentsEarlGreyTests.podspec index cf63a8584f9..f4390f643a6 100644 --- a/MaterialComponentsEarlGreyTests.podspec +++ b/MaterialComponentsEarlGreyTests.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "MaterialComponentsEarlGreyTests" - s.version = "102.0.0" + s.version = "103.0.0" s.authors = "The Material Components authors." s.summary = "This spec is an aggregate of all the Material Components EarlGrey tests." s.description = "This spec is made for use in the MDC Catalog." diff --git a/MaterialComponentsExamples.podspec b/MaterialComponentsExamples.podspec index 5c8bda6443e..907d680eec3 100644 --- a/MaterialComponentsExamples.podspec +++ b/MaterialComponentsExamples.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "MaterialComponentsExamples" - s.version = "102.0.0" + s.version = "103.0.0" s.authors = "The Material Components authors." s.summary = "This spec is an aggregate of all the Material Components examples." s.description = "This spec is made for use in the MDC Catalog. Used in conjunction with CatalogByConvention we create our Material Catalog." diff --git a/MaterialComponentsSnapshotTests.podspec b/MaterialComponentsSnapshotTests.podspec index 400205f1d56..55bfc6fd4c8 100644 --- a/MaterialComponentsSnapshotTests.podspec +++ b/MaterialComponentsSnapshotTests.podspec @@ -53,7 +53,7 @@ end Pod::Spec.new do |s| s.name = "MaterialComponentsSnapshotTests" - s.version = "102.0.0" + s.version = "103.0.0" s.authors = "The Material Components authors." s.summary = "This spec is an aggregate of all the Material Components snapshot tests." s.homepage = "https://github.com/material-components/material-components-ios" diff --git a/VERSION b/VERSION index d4641b132dc..9dd4f066910 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -102.0.0 +103.0.0 diff --git a/catalog/MDCCatalog/Info.plist b/catalog/MDCCatalog/Info.plist index eb64eb61f55..41d69d99055 100644 --- a/catalog/MDCCatalog/Info.plist +++ b/catalog/MDCCatalog/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 102.0.0 + 103.0.0 CFBundleSignature ???? CFBundleVersion - 102.0.0 + 103.0.0 LSRequiresIPhoneOS UIAppFonts diff --git a/catalog/MDCDragons/Info.plist b/catalog/MDCDragons/Info.plist index 9d43ccd2df0..5caf6eace10 100644 --- a/catalog/MDCDragons/Info.plist +++ b/catalog/MDCDragons/Info.plist @@ -15,9 +15,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 102.0.0 + 103.0.0 CFBundleVersion - 102.0.0 + 103.0.0 LSRequiresIPhoneOS UILaunchStoryboardName diff --git a/catalog/MaterialCatalog/MaterialCatalog.podspec b/catalog/MaterialCatalog/MaterialCatalog.podspec index ba291bbaa46..72f5a7eec63 100644 --- a/catalog/MaterialCatalog/MaterialCatalog.podspec +++ b/catalog/MaterialCatalog/MaterialCatalog.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "MaterialCatalog" - s.version = "102.0.0" + s.version = "103.0.0" s.summary = "Helper Objective-C classes for the MDC catalog." s.description = "This spec is made for use in the MDC Catalog." s.homepage = "https://github.com/material-components/material-components-ios" diff --git a/catalog/Podfile b/catalog/Podfile index f4aff73257a..d4b3865f589 100644 --- a/catalog/Podfile +++ b/catalog/Podfile @@ -70,9 +70,12 @@ target "MDCCatalog" do 'Tabs/UnitTests', 'Tabs+Theming/UnitTests', 'TextFields/UnitTests', - 'TextControls/UnitTests', - 'TextControls+Theming/UnitTests', 'TextFields+Theming/UnitTests', + 'TextControls+BaseTextFields/UnitTests', + 'TextControls+FilledTextFields/UnitTests', + 'TextControls+FilledTextFieldsTheming/UnitTests', + 'TextControls+OutlinedTextFields/UnitTests', + 'TextControls+OutlinedTextFieldsTheming/UnitTests', 'Themes/UnitTests', 'Typography/UnitTests', ] diff --git a/components/AppBar/src/MDCAppBarNavigationController.h b/components/AppBar/src/MDCAppBarNavigationController.h index afe8c7c118e..8acda6698b6 100644 --- a/components/AppBar/src/MDCAppBarNavigationController.h +++ b/components/AppBar/src/MDCAppBarNavigationController.h @@ -19,10 +19,42 @@ @class MDCAppBarNavigationController; @class MDCFlexibleHeaderViewController; +/** + Defines delegate methods that will be deprecated. + */ +@protocol MDCAppBarNavigationControllerToBeDeprecatedDelegate +@optional + +/** + Informs the receiver that the given App Bar will be added as a child of the given view controller. + + This event is primarily intended to allow any configuration or theming of the App Bar to occur + before it becomes part of the view controller hierarchy. + + By the time this event has fired, the navigation controller will already have attempted to infer + the tracking scroll view from the provided view controller. + + @note This method will only be invoked if a new App Bar instance is about to be added to the view + controller. If a flexible header is already present in the view controller, this method will not + be invoked. + + @warning This method will soon be deprecated. Please use + -appBarNavigationController:willAddAppBarViewController:asChildOfViewController: instead. Learn + more at + https://github.com/material-components/material-components-ios/blob/develop/components/AppBar/docs/migration-guide-appbar-appbarviewcontroller.md + */ +- (void)appBarNavigationController:(nonnull MDCAppBarNavigationController *)navigationController + willAddAppBar:(nonnull MDCAppBar *)appBar + asChildOfViewController:(nonnull UIViewController *)viewController; + +@end + /** Defines the events that an MDCAppBarNavigationController may send to a delegate. */ -@protocol MDCAppBarNavigationControllerDelegate +@protocol + MDCAppBarNavigationControllerDelegate @optional /** @@ -73,30 +105,6 @@ trackingScrollViewForViewController:(nonnull UIViewController *)viewController suggestedTrackingScrollView:(nullable UIScrollView *)scrollView; -#pragma mark - Will be deprecated - -/** - Informs the receiver that the given App Bar will be added as a child of the given view controller. - - This event is primarily intended to allow any configuration or theming of the App Bar to occur - before it becomes part of the view controller hierarchy. - - By the time this event has fired, the navigation controller will already have attempted to infer - the tracking scroll view from the provided view controller. - - @note This method will only be invoked if a new App Bar instance is about to be added to the view - controller. If a flexible header is already present in the view controller, this method will not - be invoked. - - @warning This method will soon be deprecated. Please use - -appBarNavigationController:willAddAppBarViewController:asChildOfViewController: instead. Learn - more at - https://github.com/material-components/material-components-ios/blob/develop/components/AppBar/docs/migration-guide-appbar-appbarviewcontroller.md - */ -- (void)appBarNavigationController:(nonnull MDCAppBarNavigationController *)navigationController - willAddAppBar:(nonnull MDCAppBar *)appBar - asChildOfViewController:(nonnull UIViewController *)viewController; - @end /** diff --git a/components/Chips/src/MDCChipView.m b/components/Chips/src/MDCChipView.m index 6f3ca033625..18d77bd3bcb 100644 --- a/components/Chips/src/MDCChipView.m +++ b/components/Chips/src/MDCChipView.m @@ -76,8 +76,9 @@ static CGRect CGRectVerticallyCentered(CGRect rect, } static inline CGRect MDCChipBuildFrame( - UIEdgeInsets insets, CGSize size, CGFloat xOffset, CGFloat chipHeight, CGFloat pixelScale) { - CGRect frame = CGRectMake(xOffset + insets.left, insets.top, size.width, size.height); + UIEdgeInsets insets, CGSize size, CGPoint originPoint, CGFloat chipHeight, CGFloat pixelScale) { + CGRect frame = + CGRectMake(originPoint.x + insets.left, originPoint.y + insets.top, size.width, size.height); return CGRectVerticallyCentered(frame, insets, chipHeight, pixelScale); } @@ -708,11 +709,13 @@ - (CGRect)selectedImageViewFrame { } - (CGRect)frameForImageView:(UIImageView *)imageView visible:(BOOL)visible { - CGRect frame = CGRectMake(CGRectGetMinX(self.contentRect), CGRectGetMidY(self.contentRect), 0, 0); + CGRect contentRect = self.contentRect; + CGRect frame = CGRectMake(CGRectGetMinX(contentRect), CGRectGetMidY(contentRect), 0, 0); if (visible) { - CGSize selectedSize = [self sizeForImageView:imageView maxSize:self.contentRect.size]; - frame = MDCChipBuildFrame(_imagePadding, selectedSize, CGRectGetMinX(self.contentRect), - CGRectGetHeight(self.frame), self.pixelScale); + CGSize selectedSize = [self sizeForImageView:imageView maxSize:contentRect.size]; + frame = MDCChipBuildFrame(_imagePadding, selectedSize, + CGPointMake(CGRectGetMinX(contentRect), CGRectGetMinY(contentRect)), + CGRectGetHeight(contentRect), self.pixelScale); } return frame; } @@ -724,12 +727,14 @@ - (CGSize)sizeForImageView:(UIImageView *)imageView maxSize:(CGSize)maxSize { - (CGRect)accessoryViewFrame { CGSize size = CGSizeZero; + CGRect contentRect = self.contentRect; if (self.showAccessoryView) { - size = [self sizeForAccessoryViewWithMaxSize:self.contentRect.size]; + size = [self sizeForAccessoryViewWithMaxSize:contentRect.size]; } CGFloat xOffset = CGRectGetMaxX(self.contentRect) - size.width - UIEdgeInsetsHorizontal(_accessoryPadding); - return MDCChipBuildFrame(_accessoryPadding, size, xOffset, CGRectGetHeight(self.frame), + CGPoint frameOrigin = CGPointMake(xOffset, CGRectGetMinY(contentRect)); + return MDCChipBuildFrame(_accessoryPadding, size, frameOrigin, CGRectGetHeight(contentRect), self.pixelScale); } @@ -739,22 +744,37 @@ - (CGSize)sizeForAccessoryViewWithMaxSize:(CGSize)maxSize { } - (CGRect)titleLabelFrame { - CGRect imageFrame = CGRectUnion(_imageView.frame, _selectedImageView.frame); - CGFloat maximumTitleWidth = CGRectGetWidth(self.contentRect) - CGRectGetWidth(imageFrame) - - UIEdgeInsetsHorizontal(_titlePadding) + - UIEdgeInsetsHorizontal(_imagePadding); + // Default to the unselected image, but account for the selected image if it's shown. + CGRect imageFrame = _imageView.frame; + if (self.showSelectedImageView) { + // Both images are present, take the union of their frames. + if (self.showImageView) { + imageFrame = CGRectUnion(_imageView.frame, _selectedImageView.frame); + } else { + imageFrame = _selectedImageView.frame; + } + } + CGRect contentRect = self.contentRect; + CGFloat maximumTitleWidth = CGRectGetWidth(contentRect) - CGRectGetWidth(imageFrame) - + UIEdgeInsetsHorizontal(_titlePadding); + if (self.showImageView || self.showSelectedImageView) { + maximumTitleWidth -= UIEdgeInsetsHorizontal(_imagePadding); + } if (self.showAccessoryView) { maximumTitleWidth -= CGRectGetWidth(_accessoryView.frame) + UIEdgeInsetsHorizontal(_accessoryPadding); } - CGFloat maximumTitleHeight = - CGRectGetHeight(self.contentRect) - UIEdgeInsetsVertical(_titlePadding); + CGFloat maximumTitleHeight = CGRectGetHeight(contentRect) - UIEdgeInsetsVertical(_titlePadding); CGSize maximumSize = CGSizeMake(maximumTitleWidth, maximumTitleHeight); CGSize titleSize = [_titleLabel sizeThatFits:maximumSize]; titleSize.width = MAX(0, maximumTitleWidth); - CGFloat imageRightEdge = CGRectGetMaxX(imageFrame) + _imagePadding.right; - return MDCChipBuildFrame(_titlePadding, titleSize, imageRightEdge, CGRectGetHeight(self.frame), + CGFloat imageRightEdge = CGRectGetMinX(contentRect); + if (self.showImageView || self.showSelectedImageView) { + imageRightEdge = CGRectGetMaxX(imageFrame) + _imagePadding.right; + } + CGPoint frameOrigin = CGPointMake(imageRightEdge, CGRectGetMinY(contentRect)); + return MDCChipBuildFrame(_titlePadding, titleSize, frameOrigin, CGRectGetHeight(contentRect), self.pixelScale); } diff --git a/components/Chips/tests/snapshot/MDCChipViewLayoutSnapshotTests.m b/components/Chips/tests/snapshot/MDCChipViewLayoutSnapshotTests.m index 369b6b0a1a9..2031f176af1 100644 --- a/components/Chips/tests/snapshot/MDCChipViewLayoutSnapshotTests.m +++ b/components/Chips/tests/snapshot/MDCChipViewLayoutSnapshotTests.m @@ -195,6 +195,16 @@ - (void)testChipContentPaddingShiftUp { #pragma mark - ImagePadding +- (void)testChipImagePaddingWithoutImagesLTR { + // When + self.chipView.imageView.image = nil; + self.chipView.selectedImageView.image = nil; + self.chipView.imagePadding = UIEdgeInsetsMake(10, 20, 30, 40); + + // Then + [self generateSnapshotAndVerifyForView:self.chipView]; +} + - (void)testUnselectedChipImagePaddingAllPositiveValuesLTR { // When self.chipView.imagePadding = UIEdgeInsetsMake(10, 20, 30, 40); @@ -259,6 +269,33 @@ - (void)testSelectedChipImagePaddingAllPositiveValuesForLargeSelectedImageLTR { [self generateSnapshotAndVerifyForView:self.chipView]; } +- (void)testUnselectedChipImagePaddingAllPositiveValuesForSmallSelectedImageLTR { + // Given + self.chipView.selectedImageView.image = + [UIImage mdc_testImageOfSize:CGSizeMake(8, 8) + withStyle:MDCSnapshotTestImageStyleDiagonalLines]; + + // When + self.chipView.imagePadding = UIEdgeInsetsMake(10, 20, 30, 40); + + // Then + [self generateSnapshotAndVerifyForView:self.chipView]; +} + +- (void)testSelectedChipImagePaddingAllPositiveValuesForSmallSelectedImageLTR { + // Given + self.chipView.selectedImageView.image = + [UIImage mdc_testImageOfSize:CGSizeMake(8, 8) + withStyle:MDCSnapshotTestImageStyleDiagonalLines]; + self.chipView.selected = YES; + + // When + self.chipView.imagePadding = UIEdgeInsetsMake(10, 20, 30, 40); + + // Then + [self generateSnapshotAndVerifyForView:self.chipView]; +} + - (void)testUnselectedChipImagePaddingAllPositiveValuesRTL { // Given [self changeToRTL:self.chipView]; diff --git a/components/LibraryInfo/src/MDCLibraryInfo.m b/components/LibraryInfo/src/MDCLibraryInfo.m index 32fdf1afe26..967b1386d6f 100644 --- a/components/LibraryInfo/src/MDCLibraryInfo.m +++ b/components/LibraryInfo/src/MDCLibraryInfo.m @@ -19,7 +19,7 @@ // This string is updated automatically as a part of the release process and should not be edited // manually. Do not rename this constant or change the formatting without updating the release // scripts. -static NSString const *MDCLibraryInfoVersionString = @"102.0.0"; +static NSString const *MDCLibraryInfoVersionString = @"103.0.0"; @implementation MDCLibraryInfo diff --git a/components/LibraryInfo/tests/unit/LibraryInfoTests.m b/components/LibraryInfo/tests/unit/LibraryInfoTests.m index dead23267c2..bdace19a31e 100644 --- a/components/LibraryInfo/tests/unit/LibraryInfoTests.m +++ b/components/LibraryInfo/tests/unit/LibraryInfoTests.m @@ -26,7 +26,7 @@ - (void)testVersionFormat { // Given // This regex pattern does the following: - // Accept: "102.0.0", etc. + // Accept: "103.0.0", etc. // Reject: "0.0.0", "1.2", "1", "-1.2.3", "Hi, I'm a version 1.2.3", "1.2.3 is my version", etc. // // Note the major version must be >= 1 since "0.0.0" is used as the version when something goes diff --git a/components/TextControls/BUILD b/components/TextControls/BUILD index 157f44e73e4..dfca752d158 100644 --- a/components/TextControls/BUILD +++ b/components/TextControls/BUILD @@ -1,4 +1,4 @@ -# Copyright 2017-present The Material Components for iOS Authors. All Rights Reserved. +# Copyright 2019-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. @@ -27,36 +27,67 @@ load( licenses(["notice"]) -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - includes = ["src/private"], - visibility = [":test_targets"], -) - package_group( - name = "test_targets", + name = "TextControlsPackageGroup", packages = [ "//components/TextControls/...", ], ) -mdc_public_objc_library( - name = "TextControls", - sdk_frameworks = [ - "QuartzCore", +mdc_extension_objc_library( + name = "Enums", + visibility = [ + ":TextControlsPackageGroup", + "//components/private/TextControlsPrivate:TextControlsPrivatePackageGroup", ], +) + +mdc_extension_objc_library( + name = "BaseTextFields", deps = [ - "//components/AnimationTiming", - "//components/private/Math", + "//components/private/TextControlsPrivate:BaseStyle", + "//components/private/TextControlsPrivate:Shared", "@material_internationalization_ios//:MDFInternationalization", ], ) +mdc_objc_library( + name = "BaseTextFieldsPrivate", + hdrs = native.glob(["src/BaseTextFields/private/*.h"]), + includes = ["src/BaseTextFields/private"], + visibility = [ + ":TextControlsPackageGroup", + ], +) + +mdc_extension_objc_library( + name = "FilledTextFields", + deps = [ + ":BaseTextFields", + "//components/private/TextControlsPrivate:FilledStyle", + ], +) + +mdc_extension_objc_library( + name = "FilledTextFieldsTheming", + deps = [ + ":FilledTextFields", + "//components/schemes/Container", + ], +) + +mdc_extension_objc_library( + name = "OutlinedTextFields", + deps = [ + ":BaseTextFields", + "//components/private/TextControlsPrivate:OutlinedStyle", + ], +) + mdc_extension_objc_library( - name = "Theming", + name = "OutlinedTextFieldsTheming", deps = [ - ":TextControls", + ":OutlinedTextFields", "//components/schemes/Container", ], ) @@ -64,8 +95,11 @@ mdc_extension_objc_library( mdc_examples_objc_library( name = "ObjcExamples", deps = [ - ":TextControls", - ":Theming", + ":BaseTextFields", + ":FilledTextFields", + ":FilledTextFieldsTheming", + ":OutlinedTextFields", + ":OutlinedTextFieldsTheming", "//components/Buttons", "//components/Buttons:Theming", "//components/schemes/Container", @@ -75,20 +109,26 @@ mdc_examples_objc_library( mdc_examples_swift_library( name = "SwiftExamples", deps = [ - ":TextControls", - ":Theming", + ":BaseTextFields", + ":FilledTextFields", + ":FilledTextFieldsTheming", + ":OutlinedTextFields", + ":OutlinedTextFieldsTheming", ], ) mdc_unit_test_objc_library( name = "unit_test_sources", extra_srcs = glob([ - "tests/unit/Theming/*.m", + "tests/unit/*/*.m", ]), deps = [ - ":TextControls", - ":Theming", - ":private", + ":BaseTextFields", + ":BaseTextFieldsPrivate", + ":FilledTextFields", + ":FilledTextFieldsTheming", + ":OutlinedTextFields", + ":OutlinedTextFieldsTheming", ], ) @@ -98,9 +138,15 @@ mdc_snapshot_objc_library( "CoreGraphics", ], deps = [ - ":TextControls", - ":Theming", - ":private", + ":BaseTextFields", + ":Enums", + ":FilledTextFields", + ":FilledTextFieldsTheming", + ":OutlinedTextFields", + ":OutlinedTextFieldsTheming", + "//components/private/TextControlsPrivate:FilledStyle", + "//components/private/TextControlsPrivate:OutlinedStyle", + "//components/private/TextControlsPrivate:Shared", ], ) diff --git a/components/TextControls/README.md b/components/TextControls/README.md index 4138bc3097a..31f6c2490e5 100644 --- a/components/TextControls/README.md +++ b/components/TextControls/README.md @@ -93,15 +93,14 @@ The largest difference between MDCTextControl text fields and UITextFields from ### Theming -You can theme a text field to match the Material Design style by using a theming extension. The content below assumes you have read the article on [Theming](../../docs/theming.md). +You can theme a text field to match the Material Design style by importing a theming extension. The content below assumes you have read the article on [Theming](../../docs/theming.md). -First, import the theming extension for TextControls and create a text field. +First, import the text field theming extension and create a text field. #### Swift ```swift -import MaterialComponents.MaterialTextControls -import MaterialComponents.MaterialTextControls_Theming +import MaterialComponents.MaterialTextControls_OutlinedTextFieldsTheming let textField = MDCOutlinedTextField() ``` @@ -109,14 +108,13 @@ let textField = MDCOutlinedTextField() #### Objective-C ```objc -#import -#import +#import MDCFilledTextField *filledTextField = [[MDCFilledTextField alloc] init]; ``` -Then pass a container scheme to one of the theming methods on a theming extension. +Then pass a container scheme to one of the theming methods on the theming extension. #### Swift @@ -125,7 +123,6 @@ filledTextField.applyTheme(withScheme: containerScheme) ``` #### Objective-C - ```objc [self.filledTextField applyThemeWithScheme:self.containerScheme]; ``` diff --git a/components/TextControls/docs/theming.md b/components/TextControls/docs/theming.md index 6cc7356878e..56702e1f5d5 100644 --- a/components/TextControls/docs/theming.md +++ b/components/TextControls/docs/theming.md @@ -1,14 +1,13 @@ ### Theming -You can theme a text field to match the Material Design style by using a theming extension. The content below assumes you have read the article on [Theming](../../../docs/theming.md). +You can theme a text field to match the Material Design style by importing a theming extension. The content below assumes you have read the article on [Theming](../../../docs/theming.md). -First, import the theming extension for TextControls and create a text field. +First, import the text field theming extension and create a text field. #### Swift ```swift -import MaterialComponents.MaterialTextControls -import MaterialComponents.MaterialTextControls_Theming +import MaterialComponents.MaterialTextControls_OutlinedTextFieldsTheming let textField = MDCOutlinedTextField() ``` @@ -16,14 +15,13 @@ let textField = MDCOutlinedTextField() #### Objective-C ```objc -#import -#import +#import MDCFilledTextField *filledTextField = [[MDCFilledTextField alloc] init]; ``` -Then pass a container scheme to one of the theming methods on a theming extension. +Then pass a container scheme to one of the theming methods on the theming extension. #### Swift @@ -32,7 +30,6 @@ filledTextField.applyTheme(withScheme: containerScheme) ``` #### Objective-C - ```objc [self.filledTextField applyThemeWithScheme:self.containerScheme]; ``` diff --git a/components/TextControls/examples/MDCTextControlTextFieldsStoryboardExample.swift b/components/TextControls/examples/MDCTextControlTextFieldsStoryboardExample.swift index 165c0f3b1c1..e701de306a8 100644 --- a/components/TextControls/examples/MDCTextControlTextFieldsStoryboardExample.swift +++ b/components/TextControls/examples/MDCTextControlTextFieldsStoryboardExample.swift @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -import MaterialComponents.MaterialTextControls -import MaterialComponents.MaterialTextControls_Theming +import MaterialComponents.MaterialTextControls_FilledTextFieldsTheming +import MaterialComponents.MaterialTextControls_OutlinedTextFieldsTheming import UIKit diff --git a/components/TextControls/examples/supplemental/MDCTextControlConfiguratorExample.m b/components/TextControls/examples/supplemental/MDCTextControlConfiguratorExample.m index edf6392893c..9a27550c69d 100644 --- a/components/TextControls/examples/supplemental/MDCTextControlConfiguratorExample.m +++ b/components/TextControls/examples/supplemental/MDCTextControlConfiguratorExample.m @@ -16,8 +16,9 @@ #import "MaterialButtons.h" #import "MaterialContainerScheme.h" -#import "MaterialTextControls+Theming.h" -#import "MaterialTextControls.h" +#import "MaterialTextControls+FilledTextFieldsTheming.h" +#import "MaterialTextControls+OutlinedTextFieldsTheming.h" +#import "MaterialTextControlsPrivate+Shared.h" #import "MDCTextControlConfiguratorExample.h" #import "MDCTraitEnvironmentChangeDelegate.h" diff --git a/components/TextControls/src/MDCBaseTextField.h b/components/TextControls/src/BaseTextFields/MDCBaseTextField.h similarity index 98% rename from components/TextControls/src/MDCBaseTextField.h rename to components/TextControls/src/BaseTextFields/MDCBaseTextField.h index bab9d7eed74..c4f1e2892c1 100644 --- a/components/TextControls/src/MDCBaseTextField.h +++ b/components/TextControls/src/BaseTextFields/MDCBaseTextField.h @@ -14,8 +14,7 @@ #import -#import "MDCTextControlLabelBehavior.h" -#import "MDCTextControlState.h" +#import "MaterialTextControls+Enums.h" /** A UITextField subclass that will potentially provide the foundation for Material TextFields in the diff --git a/components/TextControls/src/MDCBaseTextField.m b/components/TextControls/src/BaseTextFields/MDCBaseTextField.m similarity index 98% rename from components/TextControls/src/MDCBaseTextField.m rename to components/TextControls/src/BaseTextFields/MDCBaseTextField.m index 3d631ce894c..0b037cbf31b 100644 --- a/components/TextControls/src/MDCBaseTextField.m +++ b/components/TextControls/src/BaseTextFields/MDCBaseTextField.m @@ -18,15 +18,10 @@ #import -#import "MDCTextControlState.h" #import "MaterialMath.h" +#import "MaterialTextControlsPrivate+BaseStyle.h" +#import "MaterialTextControlsPrivate+Shared.h" #import "private/MDCBaseTextFieldLayout.h" -#import "private/MDCTextControlAssistiveLabelView.h" -#import "private/MDCTextControlColorViewModel.h" -#import "private/MDCTextControlLabelAnimation.h" -#import "private/MDCTextControlLabelState.h" -#import "private/MDCTextControlStyleBase.h" -#import "private/MDCTextControlVerticalPositioningReferenceBase.h" @interface MDCBaseTextField () diff --git a/components/TextControls/src/private/MDCBaseTextField+MDCTextControl.h b/components/TextControls/src/BaseTextFields/MaterialTextControls+BaseTextFields.h similarity index 69% rename from components/TextControls/src/private/MDCBaseTextField+MDCTextControl.h rename to components/TextControls/src/BaseTextFields/MaterialTextControls+BaseTextFields.h index 00d69c0727d..a73c4fc3e58 100644 --- a/components/TextControls/src/private/MDCBaseTextField+MDCTextControl.h +++ b/components/TextControls/src/BaseTextFields/MaterialTextControls+BaseTextFields.h @@ -12,13 +12,4 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import #import "MDCBaseTextField.h" -#import "MDCTextControl.h" - -/** - This category is imported from MDCBaseTextField subclasses and categories, as well as categories of - MDCBaseTextField subclasses, to make MDCTextControl conformance visible. - */ -@interface MDCBaseTextField (Private) -@end diff --git a/components/TextControls/src/private/MDCBaseTextFieldLayout.h b/components/TextControls/src/BaseTextFields/private/MDCBaseTextFieldLayout.h similarity index 95% rename from components/TextControls/src/private/MDCBaseTextFieldLayout.h rename to components/TextControls/src/BaseTextFields/private/MDCBaseTextFieldLayout.h index 0fb7ee3da8c..eba82927dc8 100644 --- a/components/TextControls/src/private/MDCBaseTextFieldLayout.h +++ b/components/TextControls/src/BaseTextFields/private/MDCBaseTextFieldLayout.h @@ -15,9 +15,7 @@ #import #import -#import "MDCTextControlAssistiveLabelDrawPriority.h" -#import "MDCTextControlAssistiveLabelViewLayout.h" -#import "MDCTextControlVerticalPositioningReference.h" +#import "MaterialTextControlsPrivate+Shared.h" @interface MDCBaseTextFieldLayout : NSObject diff --git a/components/TextControls/src/private/MDCBaseTextFieldLayout.m b/components/TextControls/src/BaseTextFields/private/MDCBaseTextFieldLayout.m similarity index 100% rename from components/TextControls/src/private/MDCBaseTextFieldLayout.m rename to components/TextControls/src/BaseTextFields/private/MDCBaseTextFieldLayout.m diff --git a/components/TextControls/src/MDCTextControlLabelBehavior.h b/components/TextControls/src/Enums/MDCTextControlLabelBehavior.h similarity index 100% rename from components/TextControls/src/MDCTextControlLabelBehavior.h rename to components/TextControls/src/Enums/MDCTextControlLabelBehavior.h diff --git a/components/TextControls/src/MDCTextControlState.h b/components/TextControls/src/Enums/MDCTextControlState.h similarity index 100% rename from components/TextControls/src/MDCTextControlState.h rename to components/TextControls/src/Enums/MDCTextControlState.h diff --git a/components/TextControls/src/MaterialTextControls.h b/components/TextControls/src/Enums/MaterialTextControls+Enums.h similarity index 88% rename from components/TextControls/src/MaterialTextControls.h rename to components/TextControls/src/Enums/MaterialTextControls+Enums.h index be6b864d4cc..41c51b288a1 100644 --- a/components/TextControls/src/MaterialTextControls.h +++ b/components/TextControls/src/Enums/MaterialTextControls+Enums.h @@ -12,8 +12,5 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MDCBaseTextField.h" -#import "MDCFilledTextField.h" -#import "MDCOutlinedTextField.h" #import "MDCTextControlLabelBehavior.h" #import "MDCTextControlState.h" diff --git a/components/TextControls/src/MDCFilledTextField.h b/components/TextControls/src/FilledTextFields/MDCFilledTextField.h similarity index 97% rename from components/TextControls/src/MDCFilledTextField.h rename to components/TextControls/src/FilledTextFields/MDCFilledTextField.h index 7e66990a00f..6ee6240b589 100644 --- a/components/TextControls/src/MDCFilledTextField.h +++ b/components/TextControls/src/FilledTextFields/MDCFilledTextField.h @@ -14,7 +14,7 @@ #import -#import "MDCBaseTextField.h" +#import "MaterialTextControls+BaseTextFields.h" /** An implementation of a Material filled text field. diff --git a/components/TextControls/src/MDCFilledTextField.m b/components/TextControls/src/FilledTextFields/MDCFilledTextField.m similarity index 93% rename from components/TextControls/src/MDCFilledTextField.m rename to components/TextControls/src/FilledTextFields/MDCFilledTextField.m index 07b5dc87646..1d768f6545c 100644 --- a/components/TextControls/src/MDCFilledTextField.m +++ b/components/TextControls/src/FilledTextFields/MDCFilledTextField.m @@ -16,9 +16,11 @@ #import -#import "private/MDCBaseTextField+MDCTextControl.h" -#import "private/MDCTextControl.h" -#import "private/MDCTextControlStyleFilled.h" +#import "MaterialTextControlsPrivate+FilledStyle.h" +#import "MaterialTextControlsPrivate+Shared.h" + +@interface MDCFilledTextField (Private) +@end @interface MDCFilledTextField () @end diff --git a/components/TextControls/src/FilledTextFields/MaterialTextControls+FilledTextFields.h b/components/TextControls/src/FilledTextFields/MaterialTextControls+FilledTextFields.h new file mode 100644 index 00000000000..86348e4ec39 --- /dev/null +++ b/components/TextControls/src/FilledTextFields/MaterialTextControls+FilledTextFields.h @@ -0,0 +1,15 @@ +// Copyright 2020-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. + +#import "MDCFilledTextField.h" diff --git a/components/TextControls/src/Theming/MDCFilledTextField+MaterialTheming.h b/components/TextControls/src/FilledTextFieldsTheming/MDCFilledTextField+MaterialTheming.h similarity index 96% rename from components/TextControls/src/Theming/MDCFilledTextField+MaterialTheming.h rename to components/TextControls/src/FilledTextFieldsTheming/MDCFilledTextField+MaterialTheming.h index 29e893c3edc..9f7296caf5b 100644 --- a/components/TextControls/src/Theming/MDCFilledTextField+MaterialTheming.h +++ b/components/TextControls/src/FilledTextFieldsTheming/MDCFilledTextField+MaterialTheming.h @@ -14,8 +14,8 @@ #import -#import "MDCFilledTextField.h" #import "MaterialContainerScheme.h" +#import "MaterialTextControls+FilledTextFields.h" /** This category is used to style MDCFilledTextField instances with an MDCContainerScheme. diff --git a/components/TextControls/src/Theming/MDCFilledTextField+MaterialTheming.m b/components/TextControls/src/FilledTextFieldsTheming/MDCFilledTextField+MaterialTheming.m similarity index 100% rename from components/TextControls/src/Theming/MDCFilledTextField+MaterialTheming.m rename to components/TextControls/src/FilledTextFieldsTheming/MDCFilledTextField+MaterialTheming.m diff --git a/components/TextControls/src/FilledTextFieldsTheming/MaterialTextControls+FilledTextFieldsTheming.h b/components/TextControls/src/FilledTextFieldsTheming/MaterialTextControls+FilledTextFieldsTheming.h new file mode 100644 index 00000000000..e026413461c --- /dev/null +++ b/components/TextControls/src/FilledTextFieldsTheming/MaterialTextControls+FilledTextFieldsTheming.h @@ -0,0 +1,15 @@ +// Copyright 2020-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. + +#import "MDCFilledTextField+MaterialTheming.h" diff --git a/components/TextControls/src/MDCOutlinedTextField.h b/components/TextControls/src/OutlinedTextFields/MDCOutlinedTextField.h similarity index 96% rename from components/TextControls/src/MDCOutlinedTextField.h rename to components/TextControls/src/OutlinedTextFields/MDCOutlinedTextField.h index 06f1986da6c..0208c21bbd8 100644 --- a/components/TextControls/src/MDCOutlinedTextField.h +++ b/components/TextControls/src/OutlinedTextFields/MDCOutlinedTextField.h @@ -14,7 +14,7 @@ #import -#import "MDCBaseTextField.h" +#import "MaterialTextControls+BaseTextFields.h" /** An implementation of a Material outlined text field. diff --git a/components/TextControls/src/MDCOutlinedTextField.m b/components/TextControls/src/OutlinedTextFields/MDCOutlinedTextField.m similarity index 93% rename from components/TextControls/src/MDCOutlinedTextField.m rename to components/TextControls/src/OutlinedTextFields/MDCOutlinedTextField.m index 9cd099f8061..87dd7838159 100644 --- a/components/TextControls/src/MDCOutlinedTextField.m +++ b/components/TextControls/src/OutlinedTextFields/MDCOutlinedTextField.m @@ -16,9 +16,10 @@ #import -#import "private/MDCBaseTextField+MDCTextControl.h" -#import "private/MDCTextControl.h" -#import "private/MDCTextControlStyleOutlined.h" +#import "MaterialTextControlsPrivate+OutlinedStyle.h" + +@interface MDCOutlinedTextField (Private) +@end @interface MDCOutlinedTextField () @end diff --git a/components/TextControls/src/OutlinedTextFields/MaterialTextControls+OutlinedTextFields.h b/components/TextControls/src/OutlinedTextFields/MaterialTextControls+OutlinedTextFields.h new file mode 100644 index 00000000000..4262b671954 --- /dev/null +++ b/components/TextControls/src/OutlinedTextFields/MaterialTextControls+OutlinedTextFields.h @@ -0,0 +1,15 @@ +// Copyright 2020-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. + +#import "MDCOutlinedTextField.h" diff --git a/components/TextControls/src/Theming/MDCOutlinedTextField+MaterialTheming.h b/components/TextControls/src/OutlinedTextFieldsTheming/MDCOutlinedTextField+MaterialTheming.h similarity index 96% rename from components/TextControls/src/Theming/MDCOutlinedTextField+MaterialTheming.h rename to components/TextControls/src/OutlinedTextFieldsTheming/MDCOutlinedTextField+MaterialTheming.h index e1cc6d3e8d5..73de86a8af0 100644 --- a/components/TextControls/src/Theming/MDCOutlinedTextField+MaterialTheming.h +++ b/components/TextControls/src/OutlinedTextFieldsTheming/MDCOutlinedTextField+MaterialTheming.h @@ -14,8 +14,8 @@ #import -#import "MDCOutlinedTextField.h" #import "MaterialContainerScheme.h" +#import "MaterialTextControls+OutlinedTextFields.h" /** This category is used to style MDCOutlinedTextField instances with an MDCContainerScheme. diff --git a/components/TextControls/src/Theming/MDCOutlinedTextField+MaterialTheming.m b/components/TextControls/src/OutlinedTextFieldsTheming/MDCOutlinedTextField+MaterialTheming.m similarity index 100% rename from components/TextControls/src/Theming/MDCOutlinedTextField+MaterialTheming.m rename to components/TextControls/src/OutlinedTextFieldsTheming/MDCOutlinedTextField+MaterialTheming.m diff --git a/components/TextControls/src/Theming/MaterialTextControls+Theming.h b/components/TextControls/src/OutlinedTextFieldsTheming/MaterialTextControls+OutlinedTextFieldsTheming.h similarity index 93% rename from components/TextControls/src/Theming/MaterialTextControls+Theming.h rename to components/TextControls/src/OutlinedTextFieldsTheming/MaterialTextControls+OutlinedTextFieldsTheming.h index f76d6fa3910..c9adebf0520 100644 --- a/components/TextControls/src/Theming/MaterialTextControls+Theming.h +++ b/components/TextControls/src/OutlinedTextFieldsTheming/MaterialTextControls+OutlinedTextFieldsTheming.h @@ -12,5 +12,4 @@ // See the License for the specific language governing permissions and // limitations under the License. -#import "MDCFilledTextField+MaterialTheming.h" #import "MDCOutlinedTextField+MaterialTheming.h" diff --git a/components/TextControls/tests/snapshot/MDCBaseTextFieldSnapshotTests.m b/components/TextControls/tests/snapshot/MDCBaseTextFieldSnapshotTests.m index e800bad8325..95eb8229419 100644 --- a/components/TextControls/tests/snapshot/MDCBaseTextFieldSnapshotTests.m +++ b/components/TextControls/tests/snapshot/MDCBaseTextFieldSnapshotTests.m @@ -16,8 +16,8 @@ #import -#import "../../src/private/MDCTextControl.h" -#import "MaterialTextControls.h" +#import "MaterialTextControls+FilledTextFieldsTheming.h" +#import "MaterialTextControls+OutlinedTextFieldsTheming.h" #import "supplemental/MDCBaseTextFieldTestsSnapshotTestHelpers.h" #import "supplemental/MDCTextControlSnapshotTestHelpers.h" diff --git a/components/TextControls/tests/snapshot/MDCFilledTextFieldSnapshotTests.m b/components/TextControls/tests/snapshot/MDCFilledTextFieldSnapshotTests.m index c4f7646bcf8..c93b3b5c6cf 100644 --- a/components/TextControls/tests/snapshot/MDCFilledTextFieldSnapshotTests.m +++ b/components/TextControls/tests/snapshot/MDCFilledTextFieldSnapshotTests.m @@ -16,8 +16,8 @@ #import -#import "../../src/private/MDCTextControl.h" -#import "MaterialTextControls.h" +#import "MaterialTextControls+FilledTextFieldsTheming.h" +#import "MaterialTextControls+OutlinedTextFieldsTheming.h" #import "supplemental/MDCBaseTextFieldTestsSnapshotTestHelpers.h" #import "supplemental/MDCTextControlSnapshotTestHelpers.h" diff --git a/components/TextControls/tests/snapshot/MDCOutlinedTextFieldSnapshotTests.m b/components/TextControls/tests/snapshot/MDCOutlinedTextFieldSnapshotTests.m index efd26aa0075..8bfe7d8be4e 100644 --- a/components/TextControls/tests/snapshot/MDCOutlinedTextFieldSnapshotTests.m +++ b/components/TextControls/tests/snapshot/MDCOutlinedTextFieldSnapshotTests.m @@ -16,8 +16,8 @@ #import -#import "../../src/private/MDCTextControl.h" -#import "MaterialTextControls.h" +#import "MaterialTextControls+FilledTextFieldsTheming.h" +#import "MaterialTextControls+OutlinedTextFieldsTheming.h" #import "supplemental/MDCBaseTextFieldTestsSnapshotTestHelpers.h" #import "supplemental/MDCTextControlSnapshotTestHelpers.h" diff --git a/components/TextControls/tests/snapshot/supplemental/MDCBaseTextFieldTestsSnapshotTestHelpers.h b/components/TextControls/tests/snapshot/supplemental/MDCBaseTextFieldTestsSnapshotTestHelpers.h index dd2de50db03..682ffed520c 100644 --- a/components/TextControls/tests/snapshot/supplemental/MDCBaseTextFieldTestsSnapshotTestHelpers.h +++ b/components/TextControls/tests/snapshot/supplemental/MDCBaseTextFieldTestsSnapshotTestHelpers.h @@ -16,7 +16,8 @@ #import -#import "MaterialTextControls.h" +#import "MaterialTextControls+FilledTextFieldsTheming.h" +#import "MaterialTextControls+OutlinedTextFieldsTheming.h" @interface MDCBaseTextFieldTestsSnapshotTestHelpers : NSObject diff --git a/components/TextControls/tests/snapshot/supplemental/MDCBaseTextFieldTestsSnapshotTestHelpers.m b/components/TextControls/tests/snapshot/supplemental/MDCBaseTextFieldTestsSnapshotTestHelpers.m index 2008442c0c6..f884689b74a 100644 --- a/components/TextControls/tests/snapshot/supplemental/MDCBaseTextFieldTestsSnapshotTestHelpers.m +++ b/components/TextControls/tests/snapshot/supplemental/MDCBaseTextFieldTestsSnapshotTestHelpers.m @@ -18,6 +18,8 @@ #import "MDCBaseTextFieldTestsSnapshotTestHelpers.h" #import "MDCTextControlSnapshotTestHelpers.h" +#import "MaterialTextControls+FilledTextFieldsTheming.h" +#import "MaterialTextControls+OutlinedTextFieldsTheming.h" @interface MDCBaseTextField (AnimationDuration) @property(nonatomic, assign) NSTimeInterval animationDuration; diff --git a/components/TextControls/tests/snapshot/supplemental/MDCTextControlSnapshotTestHelpers.h b/components/TextControls/tests/snapshot/supplemental/MDCTextControlSnapshotTestHelpers.h index 3616124d25e..69aa72ad992 100644 --- a/components/TextControls/tests/snapshot/supplemental/MDCTextControlSnapshotTestHelpers.h +++ b/components/TextControls/tests/snapshot/supplemental/MDCTextControlSnapshotTestHelpers.h @@ -16,7 +16,7 @@ #import -#import "../../../src/private/MDCTextControl.h" +#import "MaterialTextControlsPrivate+Shared.h" @interface MDCTextControlSnapshotTestHelpers : NSObject diff --git a/components/TextControls/tests/snapshot/supplemental/MDCTextControlSnapshotTestHelpers.m b/components/TextControls/tests/snapshot/supplemental/MDCTextControlSnapshotTestHelpers.m index 145940fc55a..79f72e8aeca 100644 --- a/components/TextControls/tests/snapshot/supplemental/MDCTextControlSnapshotTestHelpers.m +++ b/components/TextControls/tests/snapshot/supplemental/MDCTextControlSnapshotTestHelpers.m @@ -16,8 +16,6 @@ #import -#import "MaterialTextControls.h" - #import "MDCTextControlSnapshotTestHelpers.h" #import "MDCBaseTextFieldTestsSnapshotTestHelpers.h" diff --git a/components/TextControls/tests/unit/MDCBaseTextFieldLayoutTests.m b/components/TextControls/tests/unit/BaseTextFields/MDCBaseTextFieldLayoutTests.m similarity index 95% rename from components/TextControls/tests/unit/MDCBaseTextFieldLayoutTests.m rename to components/TextControls/tests/unit/BaseTextFields/MDCBaseTextFieldLayoutTests.m index ba6d7c9ea07..cb3b9f3e078 100644 --- a/components/TextControls/tests/unit/MDCBaseTextFieldLayoutTests.m +++ b/components/TextControls/tests/unit/BaseTextFields/MDCBaseTextFieldLayoutTests.m @@ -14,11 +14,8 @@ #import -#import "MaterialTextControls.h" - -#import "../../src/private/MDCBaseTextFieldLayout.h" -#import "../../src/private/MDCTextControlAssistiveLabelView.h" -#import "../../src/private/MDCTextControlVerticalPositioningReferenceBase.h" +#import "../../../src/BaseTextFields/private/MDCBaseTextFieldLayout.h" +#import "MaterialTextControlsPrivate+BaseStyle.h" @interface MDCBaseTextFieldLayout (Testing) - (CGFloat)textHeightWithFont:(UIFont *)font; diff --git a/components/TextControls/tests/unit/MDCBaseTextFieldTests.m b/components/TextControls/tests/unit/BaseTextFields/MDCBaseTextFieldTests.m similarity index 99% rename from components/TextControls/tests/unit/MDCBaseTextFieldTests.m rename to components/TextControls/tests/unit/BaseTextFields/MDCBaseTextFieldTests.m index b9341cc4fbc..62ef74656d7 100644 --- a/components/TextControls/tests/unit/MDCBaseTextFieldTests.m +++ b/components/TextControls/tests/unit/BaseTextFields/MDCBaseTextFieldTests.m @@ -14,9 +14,8 @@ #import -#import "MaterialTextControls.h" - -#import "../../src/private/MDCTextControlLabelState.h" +#import "MaterialTextControls+BaseTextFields.h" +#import "MaterialTextControlsPrivate+BaseStyle.h" @interface MDCBaseTextField (Private) @property(nonatomic, assign) UIUserInterfaceLayoutDirection layoutDirection; diff --git a/components/TextControls/tests/unit/MDCFilledTextFieldTests.m b/components/TextControls/tests/unit/FilledTextFields/MDCFilledTextFieldTests.m similarity index 98% rename from components/TextControls/tests/unit/MDCFilledTextFieldTests.m rename to components/TextControls/tests/unit/FilledTextFields/MDCFilledTextFieldTests.m index 6a0f89e61a1..39575124979 100644 --- a/components/TextControls/tests/unit/MDCFilledTextFieldTests.m +++ b/components/TextControls/tests/unit/FilledTextFields/MDCFilledTextFieldTests.m @@ -14,7 +14,7 @@ #import -#import "MaterialTextControls.h" +#import "MaterialTextControls+FilledTextFields.h" @interface MDCFilledTextFieldTests : XCTestCase @end diff --git a/components/TextControls/tests/unit/Theming/MDCFilledTextFieldThemingTests.m b/components/TextControls/tests/unit/FilledTextFieldsTheming/MDCFilledTextFieldThemingTests.m similarity index 99% rename from components/TextControls/tests/unit/Theming/MDCFilledTextFieldThemingTests.m rename to components/TextControls/tests/unit/FilledTextFieldsTheming/MDCFilledTextFieldThemingTests.m index afe5e6ceded..e7e7dafa36d 100644 --- a/components/TextControls/tests/unit/Theming/MDCFilledTextFieldThemingTests.m +++ b/components/TextControls/tests/unit/FilledTextFieldsTheming/MDCFilledTextFieldThemingTests.m @@ -15,8 +15,7 @@ #import #import "MaterialContainerScheme.h" -#import "MaterialTextControls+Theming.h" -#import "MaterialTextControls.h" +#import "MaterialTextControls+FilledTextFieldsTheming.h" static const CGFloat kDisabledOpacity = (CGFloat)0.60; diff --git a/components/TextControls/tests/unit/MDCOutlinedTextFieldTests.m b/components/TextControls/tests/unit/OutlinedTextFields/MDCOutlinedTextFieldTests.m similarity index 97% rename from components/TextControls/tests/unit/MDCOutlinedTextFieldTests.m rename to components/TextControls/tests/unit/OutlinedTextFields/MDCOutlinedTextFieldTests.m index 0b210ded5bc..1680274024e 100644 --- a/components/TextControls/tests/unit/MDCOutlinedTextFieldTests.m +++ b/components/TextControls/tests/unit/OutlinedTextFields/MDCOutlinedTextFieldTests.m @@ -14,7 +14,7 @@ #import -#import "MaterialTextControls.h" +#import "MaterialTextControls+OutlinedTextFields.h" @interface MDCOutlinedTextFieldTests : XCTestCase @end diff --git a/components/TextControls/tests/unit/Theming/MDCOutlinedTextFieldThemingTests.m b/components/TextControls/tests/unit/OutlinedTextFieldsTheming/MDCOutlinedTextFieldThemingTests.m similarity index 99% rename from components/TextControls/tests/unit/Theming/MDCOutlinedTextFieldThemingTests.m rename to components/TextControls/tests/unit/OutlinedTextFieldsTheming/MDCOutlinedTextFieldThemingTests.m index 68e4139635e..4cfc743b354 100644 --- a/components/TextControls/tests/unit/Theming/MDCOutlinedTextFieldThemingTests.m +++ b/components/TextControls/tests/unit/OutlinedTextFieldsTheming/MDCOutlinedTextFieldThemingTests.m @@ -15,8 +15,7 @@ #import #import "MaterialContainerScheme.h" -#import "MaterialTextControls+Theming.h" -#import "MaterialTextControls.h" +#import "MaterialTextControls+OutlinedTextFieldsTheming.h" static const CGFloat kDisabledOpacity = (CGFloat)0.60; diff --git a/components/TextFields/examples/TextFieldControllerStylesExample.m b/components/TextFields/examples/TextFieldControllerStylesExample.m index 8f1754e9d2b..e2d737ca6bd 100644 --- a/components/TextFields/examples/TextFieldControllerStylesExample.m +++ b/components/TextFields/examples/TextFieldControllerStylesExample.m @@ -14,6 +14,7 @@ #import +#import "MaterialTextFields+Theming.h" #import "MaterialTextFields.h" #import "supplemental/TextFieldControllerStylesExampleSupplemental.h" @@ -35,7 +36,10 @@ @implementation TextFieldControllerStylesExample - (void)viewDidLoad { [super viewDidLoad]; - self.view.backgroundColor = [UIColor colorWithWhite:(CGFloat)0.97 alpha:1]; + if (self.containerScheme == nil) { + self.containerScheme = [[MDCContainerScheme alloc] init]; + } + self.view.backgroundColor = self.containerScheme.colorScheme.backgroundColor; self.title = @"Material Text Fields"; [self setupExampleViews]; @@ -156,6 +160,7 @@ - (void)setupTextFields { self.textFieldControllerUnderline.characterCountMax = characterCountMax; [self.textFieldControllerUnderline mdc_setAdjustsFontForContentSizeCategory:YES]; + [self.textFieldControllerUnderline applyThemeWithScheme:self.containerScheme]; [NSLayoutConstraint constraintWithItem:textFieldUnderline attribute:NSLayoutAttributeTop diff --git a/components/TextFields/examples/supplemental/TextFieldControllerStylesExampleSupplemental.h b/components/TextFields/examples/supplemental/TextFieldControllerStylesExampleSupplemental.h index 567d57267b9..0b8dcc67ecd 100644 --- a/components/TextFields/examples/supplemental/TextFieldControllerStylesExampleSupplemental.h +++ b/components/TextFields/examples/supplemental/TextFieldControllerStylesExampleSupplemental.h @@ -14,10 +14,14 @@ #import +#import "MaterialContainerScheme.h" + @interface TextFieldControllerStylesExample : UIViewController @property(nonatomic, strong) UIScrollView *scrollView; +@property(nonatomic, strong) id containerScheme; + @end @interface TextFieldControllerStylesExample (Supplemental) diff --git a/components/TextFields/src/Theming/MDCTextInputControllerUnderline+MaterialTheming.h b/components/TextFields/src/Theming/MDCTextInputControllerUnderline+MaterialTheming.h new file mode 100644 index 00000000000..7d25f6cae1e --- /dev/null +++ b/components/TextFields/src/Theming/MDCTextInputControllerUnderline+MaterialTheming.h @@ -0,0 +1,33 @@ +// Copyright 2020-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. + +#import "MaterialContainerScheme.h" +#import "MaterialTextFields.h" + +/** + This category is used to style MDCTextInputControllerUnderline instances to a specific Material + style which can be found within the [Material + Guidelines](https://material.io/design/components/text-fields.html). + */ +@interface MDCTextInputControllerUnderline (MaterialTheming) + +/** + Applies the Material theme to this instance. + + @param scheme A container scheme instance containing any desired customizations to the theming + system. + */ +- (void)applyThemeWithScheme:(nonnull id)scheme; + +@end diff --git a/components/TextFields/src/Theming/MDCTextInputControllerUnderline+MaterialTheming.m b/components/TextFields/src/Theming/MDCTextInputControllerUnderline+MaterialTheming.m new file mode 100644 index 00000000000..698eba612cb --- /dev/null +++ b/components/TextFields/src/Theming/MDCTextInputControllerUnderline+MaterialTheming.m @@ -0,0 +1,70 @@ +// Copyright 2020-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. + +#import "MDCTextInputControllerUnderline+MaterialTheming.h" + +@implementation MDCTextInputControllerUnderline (MaterialTheming) + +- (void)applyThemeWithScheme:(id)scheme { + // Color + [self applyColorThemeWithColorScheme:scheme.colorScheme]; + + // Typography + [self applyTypographyThemeWithScheme:scheme.typographyScheme]; +} + +- (void)applyColorThemeWithColorScheme:(id)colorScheme { + UIColor *onSurface87Opacity = [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.87]; + UIColor *onSurface60Opacity = [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.60]; + UIColor *primary87Opacity = [colorScheme.primaryColor colorWithAlphaComponent:(CGFloat)0.87]; + + self.activeColor = colorScheme.primaryColor; + self.errorColor = colorScheme.errorColor; + self.normalColor = onSurface87Opacity; + self.inlinePlaceholderColor = onSurface60Opacity; + self.trailingUnderlineLabelTextColor = onSurface60Opacity; + self.leadingUnderlineLabelTextColor = onSurface60Opacity; + + if ([self conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { + id textInputControllerFloatingPlaceholder = + (id)self; + + if ([textInputControllerFloatingPlaceholder + respondsToSelector:@selector(setFloatingPlaceholderNormalColor:)]) { + textInputControllerFloatingPlaceholder.floatingPlaceholderNormalColor = onSurface60Opacity; + textInputControllerFloatingPlaceholder.floatingPlaceholderActiveColor = primary87Opacity; + } + } +} + +- (void)applyTypographyThemeWithScheme:(id)typographyScheme { + self.inlinePlaceholderFont = typographyScheme.subtitle1; + self.leadingUnderlineLabelFont = typographyScheme.caption; + self.trailingUnderlineLabelFont = typographyScheme.caption; + + if ([self conformsToProtocol:@protocol(MDCTextInputControllerFloatingPlaceholder)]) { + id floatingPlaceholderController = + (id)self; + + // if caption.pointSize <= 0 there is no meaningful ratio so we fallback to default. + if (typographyScheme.caption.pointSize <= 0) { + floatingPlaceholderController.floatingPlaceholderScale = nil; + } else { + double ratio = typographyScheme.caption.pointSize / typographyScheme.subtitle1.pointSize; + floatingPlaceholderController.floatingPlaceholderScale = [NSNumber numberWithDouble:ratio]; + } + } +} + +@end diff --git a/components/TextFields/src/Theming/MaterialTextFields+Theming.h b/components/TextFields/src/Theming/MaterialTextFields+Theming.h index 50672f03496..2996184607d 100644 --- a/components/TextFields/src/Theming/MaterialTextFields+Theming.h +++ b/components/TextFields/src/Theming/MaterialTextFields+Theming.h @@ -14,3 +14,4 @@ #import "MDCTextInputControllerFilled+MaterialTheming.h" #import "MDCTextInputControllerOutlined+MaterialTheming.h" +#import "MDCTextInputControllerUnderline+MaterialTheming.h" diff --git a/components/TextFields/tests/unit/Theming/MDCTextFieldControllerUnderline_MaterialThemingTests.swift b/components/TextFields/tests/unit/Theming/MDCTextFieldControllerUnderline_MaterialThemingTests.swift new file mode 100644 index 00000000000..92c2ca7500b --- /dev/null +++ b/components/TextFields/tests/unit/Theming/MDCTextFieldControllerUnderline_MaterialThemingTests.swift @@ -0,0 +1,65 @@ +// Copyright 2020-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. + +import MaterialComponents.MaterialTextFields +import MaterialComponents.MaterialColorScheme +import MaterialComponents.MaterialContainerScheme +import MaterialComponents.MaterialTypographyScheme +import MaterialComponents.MaterialTextFields_Theming +import XCTest + +class MDCTextFieldControllerUnderline_MaterialThemingTests: XCTestCase { + func testWithDefaultContainerSchemeStylesAppropriately() { + // Given + let textFieldFilled = MDCTextField() + let textFieldControllerUnderline = MDCTextInputControllerUnderline(textInput: textFieldFilled) + let scheme = MDCContainerScheme() + let onSurface60Opacity = scheme.colorScheme.onSurfaceColor.withAlphaComponent(0.6) + let typographyScheme = scheme.typographyScheme + let floatingPlaceholderController: MDCTextInputControllerFloatingPlaceholder = + textFieldControllerUnderline + + // When + textFieldControllerUnderline.applyTheme(withScheme: scheme) + + // Then + // Color + XCTAssertEqual(textFieldControllerUnderline.activeColor, scheme.colorScheme.primaryColor) + XCTAssertEqual(textFieldControllerUnderline.errorColor, scheme.colorScheme.errorColor) + XCTAssertEqual( + textFieldControllerUnderline.normalColor, + scheme.colorScheme.onSurfaceColor.withAlphaComponent(0.87) + ) + XCTAssertEqual(textFieldControllerUnderline.inlinePlaceholderColor, onSurface60Opacity) + XCTAssertEqual(textFieldControllerUnderline.trailingUnderlineLabelTextColor, onSurface60Opacity) + XCTAssertEqual(textFieldControllerUnderline.leadingUnderlineLabelTextColor, onSurface60Opacity) + XCTAssertEqual(floatingPlaceholderController.floatingPlaceholderNormalColor, onSurface60Opacity) + XCTAssertEqual(floatingPlaceholderController.floatingPlaceholderActiveColor, + scheme.colorScheme.primaryColor.withAlphaComponent(0.87) + ) + // Typography + XCTAssertEqual(textFieldControllerUnderline.inlinePlaceholderFont, typographyScheme.subtitle1) + XCTAssertEqual(textFieldControllerUnderline.leadingUnderlineLabelFont, typographyScheme.caption) + XCTAssertEqual( + textFieldControllerUnderline.trailingUnderlineLabelFont, + typographyScheme.caption + ) + if typographyScheme.caption.pointSize <= 0 { + XCTAssertNil(floatingPlaceholderController.floatingPlaceholderScale) + } else { + let ratio = Double(typographyScheme.caption.pointSize / typographyScheme.subtitle1.pointSize) + XCTAssertEqual(floatingPlaceholderController.floatingPlaceholderScale, NSNumber(value: ratio)) + } + } +} diff --git a/components/private/TextControlsPrivate/BUILD b/components/private/TextControlsPrivate/BUILD new file mode 100644 index 00000000000..5d016651e0e --- /dev/null +++ b/components/private/TextControlsPrivate/BUILD @@ -0,0 +1,88 @@ +# Copyright 2020-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. + +load( + "//:material_components_ios.bzl", + "mdc_extension_objc_library", +) + +licenses(["notice"]) # Apache 2.0 + +package_group( + name = "TextControlsPrivatePackageGroup", + packages = [ + "//components/private/TextControlsPrivate/...", + ], +) + +mdc_extension_objc_library( + name = "Shared", + sdk_frameworks = [ + "QuartzCore", + ], + visibility = [ + "//components/TextControls:TextControlsPackageGroup", + ], + deps = [ + "//components/AnimationTiming", + "//components/TextControls:Enums", + "//components/private/Math", + "@material_internationalization_ios//:MDFInternationalization", + ], +) + +mdc_extension_objc_library( + name = "BaseStyle", + sdk_frameworks = [ + "QuartzCore", + ], + visibility = [ + "//components/TextControls:TextControlsPackageGroup", + ], + deps = [ + ":Shared", + "//components/AnimationTiming", + "//components/private/Math", + ], +) + +mdc_extension_objc_library( + name = "FilledStyle", + sdk_frameworks = [ + "QuartzCore", + ], + visibility = [ + "//components/TextControls:TextControlsPackageGroup", + ], + deps = [ + ":Shared", + "//components/AnimationTiming", + "//components/private/Math", + ], +) + +mdc_extension_objc_library( + name = "OutlinedStyle", + sdk_frameworks = [ + "QuartzCore", + ], + visibility = [ + "//components/TextControls:TextControlsPackageGroup", + ], + deps = [ + ":Shared", + "//components/AnimationTiming", + "//components/private/Math", + ], +) diff --git a/components/TextControls/src/private/MDCTextControlStyleBase.h b/components/private/TextControlsPrivate/src/BaseStyle/MDCTextControlStyleBase.h similarity index 100% rename from components/TextControls/src/private/MDCTextControlStyleBase.h rename to components/private/TextControlsPrivate/src/BaseStyle/MDCTextControlStyleBase.h diff --git a/components/TextControls/src/private/MDCTextControlStyleBase.m b/components/private/TextControlsPrivate/src/BaseStyle/MDCTextControlStyleBase.m similarity index 100% rename from components/TextControls/src/private/MDCTextControlStyleBase.m rename to components/private/TextControlsPrivate/src/BaseStyle/MDCTextControlStyleBase.m diff --git a/components/TextControls/src/private/MDCTextControlVerticalPositioningReferenceBase.h b/components/private/TextControlsPrivate/src/BaseStyle/MDCTextControlVerticalPositioningReferenceBase.h similarity index 100% rename from components/TextControls/src/private/MDCTextControlVerticalPositioningReferenceBase.h rename to components/private/TextControlsPrivate/src/BaseStyle/MDCTextControlVerticalPositioningReferenceBase.h diff --git a/components/TextControls/src/private/MDCTextControlVerticalPositioningReferenceBase.m b/components/private/TextControlsPrivate/src/BaseStyle/MDCTextControlVerticalPositioningReferenceBase.m similarity index 100% rename from components/TextControls/src/private/MDCTextControlVerticalPositioningReferenceBase.m rename to components/private/TextControlsPrivate/src/BaseStyle/MDCTextControlVerticalPositioningReferenceBase.m diff --git a/components/private/TextControlsPrivate/src/BaseStyle/MaterialTextControlsPrivate+BaseStyle.h b/components/private/TextControlsPrivate/src/BaseStyle/MaterialTextControlsPrivate+BaseStyle.h new file mode 100644 index 00000000000..d1d1458f006 --- /dev/null +++ b/components/private/TextControlsPrivate/src/BaseStyle/MaterialTextControlsPrivate+BaseStyle.h @@ -0,0 +1,16 @@ +// Copyright 2020-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. + +#import "MDCTextControlStyleBase.h" +#import "MDCTextControlVerticalPositioningReferenceBase.h" diff --git a/components/TextControls/src/private/MDCTextControlStyleFilled.h b/components/private/TextControlsPrivate/src/FilledStyle/MDCTextControlStyleFilled.h similarity index 96% rename from components/TextControls/src/private/MDCTextControlStyleFilled.h rename to components/private/TextControlsPrivate/src/FilledStyle/MDCTextControlStyleFilled.h index 99b97a3f647..48d0435c70c 100644 --- a/components/TextControls/src/private/MDCTextControlStyleFilled.h +++ b/components/private/TextControlsPrivate/src/FilledStyle/MDCTextControlStyleFilled.h @@ -15,8 +15,6 @@ #import #import "MDCTextControl.h" -#import "MDCTextControlLabelBehavior.h" -#import "MDCTextControlStyleBase.h" // TODO: When the MDCBaseTextField subclass that makes use of this style (and the path drawing logic // inside it) lands there should be snapshot tests for it. diff --git a/components/TextControls/src/private/MDCTextControlStyleFilled.m b/components/private/TextControlsPrivate/src/FilledStyle/MDCTextControlStyleFilled.m similarity index 100% rename from components/TextControls/src/private/MDCTextControlStyleFilled.m rename to components/private/TextControlsPrivate/src/FilledStyle/MDCTextControlStyleFilled.m diff --git a/components/TextControls/src/private/MDCTextControlVerticalPositioningReferenceFilled.h b/components/private/TextControlsPrivate/src/FilledStyle/MDCTextControlVerticalPositioningReferenceFilled.h similarity index 100% rename from components/TextControls/src/private/MDCTextControlVerticalPositioningReferenceFilled.h rename to components/private/TextControlsPrivate/src/FilledStyle/MDCTextControlVerticalPositioningReferenceFilled.h diff --git a/components/TextControls/src/private/MDCTextControlVerticalPositioningReferenceFilled.m b/components/private/TextControlsPrivate/src/FilledStyle/MDCTextControlVerticalPositioningReferenceFilled.m similarity index 100% rename from components/TextControls/src/private/MDCTextControlVerticalPositioningReferenceFilled.m rename to components/private/TextControlsPrivate/src/FilledStyle/MDCTextControlVerticalPositioningReferenceFilled.m diff --git a/components/private/TextControlsPrivate/src/FilledStyle/MaterialTextControlsPrivate+FilledStyle.h b/components/private/TextControlsPrivate/src/FilledStyle/MaterialTextControlsPrivate+FilledStyle.h new file mode 100644 index 00000000000..c287a9a182f --- /dev/null +++ b/components/private/TextControlsPrivate/src/FilledStyle/MaterialTextControlsPrivate+FilledStyle.h @@ -0,0 +1,16 @@ +// Copyright 2020-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. + +#import "MDCTextControlStyleFilled.h" +#import "MDCTextControlVerticalPositioningReferenceFilled.h" diff --git a/components/TextControls/src/private/MDCTextControlStyleOutlined.h b/components/private/TextControlsPrivate/src/OutlinedStyle/MDCTextControlStyleOutlined.h similarity index 100% rename from components/TextControls/src/private/MDCTextControlStyleOutlined.h rename to components/private/TextControlsPrivate/src/OutlinedStyle/MDCTextControlStyleOutlined.h diff --git a/components/TextControls/src/private/MDCTextControlStyleOutlined.m b/components/private/TextControlsPrivate/src/OutlinedStyle/MDCTextControlStyleOutlined.m similarity index 100% rename from components/TextControls/src/private/MDCTextControlStyleOutlined.m rename to components/private/TextControlsPrivate/src/OutlinedStyle/MDCTextControlStyleOutlined.m diff --git a/components/TextControls/src/private/MDCTextControlVerticalPositioningReferenceOutlined.h b/components/private/TextControlsPrivate/src/OutlinedStyle/MDCTextControlVerticalPositioningReferenceOutlined.h similarity index 100% rename from components/TextControls/src/private/MDCTextControlVerticalPositioningReferenceOutlined.h rename to components/private/TextControlsPrivate/src/OutlinedStyle/MDCTextControlVerticalPositioningReferenceOutlined.h diff --git a/components/TextControls/src/private/MDCTextControlVerticalPositioningReferenceOutlined.m b/components/private/TextControlsPrivate/src/OutlinedStyle/MDCTextControlVerticalPositioningReferenceOutlined.m similarity index 100% rename from components/TextControls/src/private/MDCTextControlVerticalPositioningReferenceOutlined.m rename to components/private/TextControlsPrivate/src/OutlinedStyle/MDCTextControlVerticalPositioningReferenceOutlined.m diff --git a/components/private/TextControlsPrivate/src/OutlinedStyle/MaterialTextControlsPrivate+OutlinedStyle.h b/components/private/TextControlsPrivate/src/OutlinedStyle/MaterialTextControlsPrivate+OutlinedStyle.h new file mode 100644 index 00000000000..fa3544f7eb0 --- /dev/null +++ b/components/private/TextControlsPrivate/src/OutlinedStyle/MaterialTextControlsPrivate+OutlinedStyle.h @@ -0,0 +1,16 @@ +// Copyright 2020-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. + +#import "MDCTextControlStyleOutlined.h" +#import "MDCTextControlVerticalPositioningReferenceOutlined.h" diff --git a/components/TextControls/src/private/MDCTextControl.h b/components/private/TextControlsPrivate/src/Shared/MDCTextControl.h similarity index 100% rename from components/TextControls/src/private/MDCTextControl.h rename to components/private/TextControlsPrivate/src/Shared/MDCTextControl.h diff --git a/components/TextControls/src/private/MDCTextControlAssistiveLabelDrawPriority.h b/components/private/TextControlsPrivate/src/Shared/MDCTextControlAssistiveLabelDrawPriority.h similarity index 100% rename from components/TextControls/src/private/MDCTextControlAssistiveLabelDrawPriority.h rename to components/private/TextControlsPrivate/src/Shared/MDCTextControlAssistiveLabelDrawPriority.h diff --git a/components/TextControls/src/private/MDCTextControlAssistiveLabelView.h b/components/private/TextControlsPrivate/src/Shared/MDCTextControlAssistiveLabelView.h similarity index 100% rename from components/TextControls/src/private/MDCTextControlAssistiveLabelView.h rename to components/private/TextControlsPrivate/src/Shared/MDCTextControlAssistiveLabelView.h diff --git a/components/TextControls/src/private/MDCTextControlAssistiveLabelView.m b/components/private/TextControlsPrivate/src/Shared/MDCTextControlAssistiveLabelView.m similarity index 100% rename from components/TextControls/src/private/MDCTextControlAssistiveLabelView.m rename to components/private/TextControlsPrivate/src/Shared/MDCTextControlAssistiveLabelView.m diff --git a/components/TextControls/src/private/MDCTextControlAssistiveLabelViewLayout.h b/components/private/TextControlsPrivate/src/Shared/MDCTextControlAssistiveLabelViewLayout.h similarity index 100% rename from components/TextControls/src/private/MDCTextControlAssistiveLabelViewLayout.h rename to components/private/TextControlsPrivate/src/Shared/MDCTextControlAssistiveLabelViewLayout.h diff --git a/components/TextControls/src/private/MDCTextControlAssistiveLabelViewLayout.m b/components/private/TextControlsPrivate/src/Shared/MDCTextControlAssistiveLabelViewLayout.m similarity index 100% rename from components/TextControls/src/private/MDCTextControlAssistiveLabelViewLayout.m rename to components/private/TextControlsPrivate/src/Shared/MDCTextControlAssistiveLabelViewLayout.m diff --git a/components/TextControls/src/private/MDCTextControlColorViewModel.h b/components/private/TextControlsPrivate/src/Shared/MDCTextControlColorViewModel.h similarity index 100% rename from components/TextControls/src/private/MDCTextControlColorViewModel.h rename to components/private/TextControlsPrivate/src/Shared/MDCTextControlColorViewModel.h diff --git a/components/TextControls/src/private/MDCTextControlColorViewModel.m b/components/private/TextControlsPrivate/src/Shared/MDCTextControlColorViewModel.m similarity index 100% rename from components/TextControls/src/private/MDCTextControlColorViewModel.m rename to components/private/TextControlsPrivate/src/Shared/MDCTextControlColorViewModel.m diff --git a/components/TextControls/src/private/MDCTextControlLabelAnimation.h b/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelAnimation.h similarity index 100% rename from components/TextControls/src/private/MDCTextControlLabelAnimation.h rename to components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelAnimation.h diff --git a/components/TextControls/src/private/MDCTextControlLabelAnimation.m b/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelAnimation.m similarity index 100% rename from components/TextControls/src/private/MDCTextControlLabelAnimation.m rename to components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelAnimation.m diff --git a/components/TextControls/src/private/MDCTextControlLabelState.h b/components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelState.h similarity index 100% rename from components/TextControls/src/private/MDCTextControlLabelState.h rename to components/private/TextControlsPrivate/src/Shared/MDCTextControlLabelState.h diff --git a/components/TextControls/src/private/MDCTextControlVerticalPositioningReference.h b/components/private/TextControlsPrivate/src/Shared/MDCTextControlVerticalPositioningReference.h similarity index 100% rename from components/TextControls/src/private/MDCTextControlVerticalPositioningReference.h rename to components/private/TextControlsPrivate/src/Shared/MDCTextControlVerticalPositioningReference.h diff --git a/components/private/TextControlsPrivate/src/Shared/MaterialTextControlsPrivate+Shared.h b/components/private/TextControlsPrivate/src/Shared/MaterialTextControlsPrivate+Shared.h new file mode 100644 index 00000000000..a678f266349 --- /dev/null +++ b/components/private/TextControlsPrivate/src/Shared/MaterialTextControlsPrivate+Shared.h @@ -0,0 +1,20 @@ +// Copyright 2020-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. + +#import "MDCTextControl.h" +#import "MDCTextControlAssistiveLabelView.h" +#import "MDCTextControlAssistiveLabelViewLayout.h" +#import "MDCTextControlColorViewModel.h" +#import "MDCTextControlLabelAnimation.h" +#import "MDCTextControlVerticalPositioningReference.h" diff --git a/components/TextControls/src/private/UIBezierPath+MDCTextControlStyle.h b/components/private/TextControlsPrivate/src/Shared/UIBezierPath+MDCTextControlStyle.h similarity index 100% rename from components/TextControls/src/private/UIBezierPath+MDCTextControlStyle.h rename to components/private/TextControlsPrivate/src/Shared/UIBezierPath+MDCTextControlStyle.h diff --git a/components/TextControls/src/private/UIBezierPath+MDCTextControlStyle.m b/components/private/TextControlsPrivate/src/Shared/UIBezierPath+MDCTextControlStyle.m similarity index 100% rename from components/TextControls/src/private/UIBezierPath+MDCTextControlStyle.m rename to components/private/TextControlsPrivate/src/Shared/UIBezierPath+MDCTextControlStyle.m diff --git a/demos/supplemental/RemoteImageServiceForMDCDemos.podspec b/demos/supplemental/RemoteImageServiceForMDCDemos.podspec index 1ddda040574..cb199d7d75d 100644 --- a/demos/supplemental/RemoteImageServiceForMDCDemos.podspec +++ b/demos/supplemental/RemoteImageServiceForMDCDemos.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "RemoteImageServiceForMDCDemos" - s.version = "102.0.0" + s.version = "103.0.0" s.summary = "A helper image class for the MDC demos." s.description = "This spec is made for use in the MDC demos. It gets images via url." s.homepage = "https://github.com/material-components/material-components-ios" diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllNegativeValuesLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllNegativeValuesLTR_11_2@2x.png index 166f9e272d1..ee53a440158 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllNegativeValuesLTR_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllNegativeValuesLTR_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7896af5dae1c0492e03b20e5e6f6e09d8ff817e18bcf0d644db0431a010a8f73 -size 5997 +oid sha256:640d0ad7e49ae7678a2e761d687170efe0ba1b13074dfd7a12ea76c616c0a22e +size 5862 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllNegativeValuesRTL_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllNegativeValuesRTL_11_2@2x.png index 1cc426c7e4a..3a5303c0238 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllNegativeValuesRTL_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllNegativeValuesRTL_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:136e36a494f4595a75901aa666386b3d623991613a2de5d77960d1ee5dd98a70 -size 5871 +oid sha256:49cdc9ad21b382ed3d1f488dc26808822c1a97c37725e64e2873eafef7ea3566 +size 5922 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllPositiveValuesLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllPositiveValuesLTR_11_2@2x.png index e0bf90345bf..537cc8710db 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllPositiveValuesLTR_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllPositiveValuesLTR_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f99ab685678acaf0eda999a86c486050ebca6d4b3e3852a5d6d498b52ed4f3e -size 8795 +oid sha256:770264fac4dd654a89e3e3197f97ead8e15ba9de7687c35ec89ad9779b02692e +size 8726 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllPositiveValuesRTL_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllPositiveValuesRTL_11_2@2x.png index 97cd39c4c6c..71a6f255f47 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllPositiveValuesRTL_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingAllPositiveValuesRTL_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f71bf46c1ef41a83ef2944b3f5a887bbc37b829cd10f266164e1376ba9d11956 -size 8926 +oid sha256:b23ab4a7d4634d31417ea74b16800e19da6d74bd4613fdf72823ede2442587d0 +size 8838 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingShiftDown_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingShiftDown_11_2@2x.png index 6188f66cd30..4fbcc3cc2c0 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingShiftDown_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingShiftDown_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:07fae752bdb3974f04476b74fe9edb4fa4d7f51e04192683156f59b8876361c7 -size 6087 +oid sha256:0dfbb32a6d4ba28714170748c127857689982969a3fea79ee7a402b3a393bafa +size 6176 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingShiftUp_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingShiftUp_11_2@2x.png index 16997dd1c7e..adef5ab9a1b 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingShiftUp_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipContentPaddingShiftUp_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:029e5f8b0c87251d84a12db039b0105faa4bd4e4dc29e78d020a0c043c8b09ab -size 6064 +oid sha256:af19f093196d3361a70052b05c68efe688fcd4aa99372fc85e5215c4279bf06c +size 6183 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipImagePaddingWithoutImagesLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipImagePaddingWithoutImagesLTR_11_2@2x.png new file mode 100644 index 00000000000..300bad0cd08 --- /dev/null +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testChipImagePaddingWithoutImagesLTR_11_2@2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e01be4724fd2e9df9548872dabaed87318739cebf6ac100c4b2b99961f863c78 +size 5223 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testSelectedChipImagePaddingAllPositiveValuesForLargeSelectedImageLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testSelectedChipImagePaddingAllPositiveValuesForLargeSelectedImageLTR_11_2@2x.png index d89d7ca1934..8959b2ea1fc 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testSelectedChipImagePaddingAllPositiveValuesForLargeSelectedImageLTR_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testSelectedChipImagePaddingAllPositiveValuesForLargeSelectedImageLTR_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dcb8e22109690963a5675a63f2738d2cadf78ae08334b7ab7fc76e3d66a3baeb -size 10308 +oid sha256:7a1f514e412a9e259b3d38baa06e4d98e3d07560d70dc1d97501973c8d5897ac +size 10406 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testSelectedChipImagePaddingAllPositiveValuesForOnlySelectedImageLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testSelectedChipImagePaddingAllPositiveValuesForOnlySelectedImageLTR_11_2@2x.png index 3a5c8b8c1f2..0cf9fc6f916 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testSelectedChipImagePaddingAllPositiveValuesForOnlySelectedImageLTR_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testSelectedChipImagePaddingAllPositiveValuesForOnlySelectedImageLTR_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1382dbf50e015f11ee01adfb2d6f67eb660b97c2ec319b5d470d5bff7b1605be -size 8608 +oid sha256:63b9e04a21fc747b2f74e6153a2648e32d9f4d6073495da1e20694c47aedea75 +size 8715 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testSelectedChipImagePaddingAllPositiveValuesForSmallSelectedImageLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testSelectedChipImagePaddingAllPositiveValuesForSmallSelectedImageLTR_11_2@2x.png new file mode 100644 index 00000000000..24cf0ba9abe --- /dev/null +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testSelectedChipImagePaddingAllPositiveValuesForSmallSelectedImageLTR_11_2@2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2139a473e8a6c21a6fe3327d9e26d567142d066437cf36db062007679297b908 +size 8891 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllNegativeValuesLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllNegativeValuesLTR_11_2@2x.png index 9a699894fdf..7a524de9880 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllNegativeValuesLTR_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllNegativeValuesLTR_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dbf66c18249f1d8de80d9cfddcb5dd9b015236db2cd49550a011f9f24750f678 -size 4507 +oid sha256:ff2c0f9c24922f8aeb0444dc01b15b75bafd21fdd9a236b98e67a3b69ab55a6a +size 5698 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllNegativeValuesRTL_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllNegativeValuesRTL_11_2@2x.png index 1b736283a06..a4e1e75a620 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllNegativeValuesRTL_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllNegativeValuesRTL_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3f2bcef5bade497a0b0d06f2567075aa95cfaa6dcf586c7160c7a20877684314 -size 4741 +oid sha256:fe2c47762155435c5337741d5c893b57072d138a4ab3af7c71a983318afd6a13 +size 5792 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesForLargeSelectedImageLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesForLargeSelectedImageLTR_11_2@2x.png index 402e48e7b75..a0148a71fad 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesForLargeSelectedImageLTR_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesForLargeSelectedImageLTR_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91fa84afcba24db32489ba231e2831242cd97f59fff81bd1196a20b0638b9d64 -size 9330 +oid sha256:97a7ff43c2245d550eac5321d976ee579deb0d23161d58f7a208e7902d9ddc9b +size 9260 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesForOnlySelectedImageLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesForOnlySelectedImageLTR_11_2@2x.png index 6f0bb855d1b..300bad0cd08 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesForOnlySelectedImageLTR_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesForOnlySelectedImageLTR_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b4b496a7c4d42a4f1536003af79be3161cc0fa27d4663079c73c5075d961aae5 -size 5317 +oid sha256:e01be4724fd2e9df9548872dabaed87318739cebf6ac100c4b2b99961f863c78 +size 5223 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesForSmallSelectedImageLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesForSmallSelectedImageLTR_11_2@2x.png new file mode 100644 index 00000000000..a0148a71fad --- /dev/null +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesForSmallSelectedImageLTR_11_2@2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97a7ff43c2245d550eac5321d976ee579deb0d23161d58f7a208e7902d9ddc9b +size 9260 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesLTR_11_2@2x.png index 402e48e7b75..a0148a71fad 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesLTR_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesLTR_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91fa84afcba24db32489ba231e2831242cd97f59fff81bd1196a20b0638b9d64 -size 9330 +oid sha256:97a7ff43c2245d550eac5321d976ee579deb0d23161d58f7a208e7902d9ddc9b +size 9260 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesRTL_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesRTL_11_2@2x.png index 6bbe44d3440..f8d72d31d3e 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesRTL_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingAllPositiveValuesRTL_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8934d24a090b3e2318f2cca5ea7373e7e072dc6bfdd814120ede1590f2a1428d -size 9288 +oid sha256:698e2b144df85dfe4a9c0d79bfbb4271b46341689a8a96ddc23b9886f7eb0917 +size 9100 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingShiftToTrailingEdgeLTR_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingShiftToTrailingEdgeLTR_11_2@2x.png index b73ace732e9..4b6a257143d 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingShiftToTrailingEdgeLTR_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingShiftToTrailingEdgeLTR_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2099c086772f4406383947e52d90123bbd626221b508e76d3467f068c58a2c48 -size 5537 +oid sha256:f13f80c70c2ced03df3305aa579de3370473d7d8895e666041a8fa40f9de1fea +size 5907 diff --git a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingShiftToTrailingEdgeRTL_11_2@2x.png b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingShiftToTrailingEdgeRTL_11_2@2x.png index 4e776e851a3..576092c8e32 100644 --- a/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingShiftToTrailingEdgeRTL_11_2@2x.png +++ b/snapshot_test_goldens/goldens_64/MDCChipViewLayoutSnapshotTests/testUnselectedChipImagePaddingShiftToTrailingEdgeRTL_11_2@2x.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7b8e1849239345866d2defb6e60059b66fe8a4857eef4546d9add6b36b23a63f -size 5123 +oid sha256:55a638b1a2e7a3621a2d4d1083ee57296d78b55b7064a6b693a831dc267746c7 +size 5853