diff --git a/.bazelrc b/.bazelrc deleted file mode 100644 index 7126d808ae0..00000000000 --- a/.bazelrc +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2020-present The Material Foundation 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. - -# Common flags for all builds -build --verbose_failures # Print the full command line for commands that failed. -build --test_output=errors # Prints log file output to the console on failure. - -# Platform-specific flags -build --apple_platform_type=ios # Build for iOS by default. - -# Swift-specific features: https://github.com/bazelbuild/rules_swift/blob/master/swift/internal/features.bzl -build --features=swift.enable_batch_mode # Intended to speed up non-incremental non-WMO builds. -build --features=swift.use_global_module_cache # Use the same global Clang module as ObjC targets. diff --git a/.bazelversion b/.bazelversion deleted file mode 100644 index a881cf79f29..00000000000 --- a/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -0.20.0 \ No newline at end of file diff --git a/.kokoro b/.kokoro index a25015bf9e4..318febba7ef 100755 --- a/.kokoro +++ b/.kokoro @@ -42,74 +42,6 @@ source "${scripts_dir}/package_managers.sh" # This currently points to version 0.21.3, the last version that supports Xcode 9 SOURCEKITTEN_FORMULA="https://raw.githubusercontent.com/Homebrew/homebrew-core/c5a8a094f9e1dd8e41ed24785acef07ef7092d0d/Formula/sourcekitten.rb" -fix_bazel_imports() { - echo "Rewriting imports for bazel..." - - private_components() { - find "components/private" -type d | cut -d'/' -f3 | sort | uniq - } - - rewrite_tests() { - find "${stashed_dir}"components/private/*/tests -type f -name '*.swift' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"components/private/*/tests -type f -name '*.m' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"components/*/tests -type f -name '*.swift' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"components/*/tests -type f -name '*.m' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"components/schemes/*/tests -type f -name '*.m' -exec perl -pi -e "$1" {} + || true - } - rewrite_examples() { - find "${stashed_dir}"components/private/*/examples -type f -name '*.swift' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"components/private/*/examples -type f -name '*.h' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"components/private/*/examples -type f -name '*.m' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"components/*/examples -type f -name '*.swift' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"components/*/examples -type f -name '*.h' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"components/*/examples -type f -name '*.m' -exec perl -pi -e "$1" {} + || true - } - rewrite_source() { - find "${stashed_dir}"components/private/*/src -type f -name '*.h' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"components/private/*/src -type f -name '*.m' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"components/*/src -type f -name '*.h' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"components/*/src -type f -name '*.m' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"components/schemes/*/src -type f -name '*.h' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"components/schemes/*/src -type f -name '*.m' -exec perl -pi -e "$1" {} + || true - } - rewrite_catalogs() { - find "${stashed_dir}"catalog/MDC* -type f -name '*.swift' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"catalog/MDC* -type f -name '*.m' -exec perl -pi -e "$1" {} + || true - find "${stashed_dir}"catalog/MDC* -type f -name '*.h' -exec perl -pi -e "$1" {} + || true - } - - stashed_dir="" - rewrite_examples "s/import /import\/\*Material beta framework import\*\/ \"\1\"/" - rewrite_catalogs "s/import /import\/\*Material prefix framework import\*\/ \"CatalogByConvention.h\"/" - rewrite_examples "s/import /import\/\*Material prefix framework import\*\/ \"Material\1.h\"/" - rewrite_source "s/import /import\/\*Material beta framework import\*\/ \"\1\"/" - rewrite_source "s/import /import \"Motion\1.h\"/" - rewrite_source "s/import /import \"MDFTextAccessibility.h\"/" - rewrite_source "s/import /import\/\*Material prefix framework import\*\/ \"Material\1.h\"/" - rewrite_source "s/import /import\/\*MDC prefix framework import\*\/ \"MDC\1.h\"/" - rewrite_tests "s/import /import\/\*Material beta prefix framework import\*\/ \"Material\1Beta.h\"/" - rewrite_tests "s/import /import\/\*Material prefix framework import\*\/ \"Material\1.h\"/" - rewrite_tests "s/import /import \"MDFTesting.h\"/" - stashed_dir="$(pwd)/" - reset_imports() { - echo "Undoing import rewrites for bazel..." - - # Undoes our source changes from above. - rewrite_tests "s/import\/\*Material beta prefix framework import\*\/ \"Material(.+).h\"/import /" - rewrite_catalogs "s/import\/\*Material prefix framework import\*\/ \"CatalogByConvention\.h\"/import /" - rewrite_examples "s/import\/\*Material beta framework import\*\/ \"(.+)\"/import /" - rewrite_examples "s/import\/\*Material prefix framework import\*\/ \"Material(.+)\.h\"/import /" - rewrite_source "s/import\/\*Material beta framework import\*\/ \"(.+)\"/import /" - rewrite_source "s/import \"Motion(.+)\.h\"/import /" - rewrite_source "s/import \"MDFTextAccessibility\.h\"/import /" - rewrite_source "s/import\/\*Material prefix framework import\*\/ \"Material(.+)\.h\"/import /" - rewrite_source "s/import\/\*MDC prefix framework import\*\/ \"MDC(.+)\.h\"/import /" - rewrite_tests "s/import\/\*Material prefix framework import\*\/ \"Material(.+)\.h\"/import /" - rewrite_tests "s/import \"MDFTesting\.h\"/import /" - } - trap reset_imports EXIT -} - move_derived_data_to_tmp() { targetDir="${HOME}/Library/Developer/Xcode/DerivedData" if [[ -d "$targetDir" ]]; then @@ -118,215 +50,6 @@ move_derived_data_to_tmp() { fi } -# Uploads all of the bazel test artifacts to Kokoro's artifacts storage. -upload_bazel_test_artifacts() { - logs_dir="$KOKORO_ARTIFACTS_DIR/bazel_test_logs" - mkdir -p "$logs_dir" - - # Copies each file from stdin to $KOKORO_ARTIFACTS_DIR and preserves the directory structure - copy_to_artifacts() { - cat - | while read file; do - directory="$logs_dir/$(dirname $file)" - mkdir -p "$directory" - cp "$file" "$logs_dir/$file" - done - } - - brew_install rename - - # rename all test.log to sponge_log.log and then copy them to the kokoro - # artifacts directory. - find -L . -name "test.log" -type f -exec rename 's/test.log/sponge_log.log/' {} \; - find -L . -name "sponge_log.log" -type f | copy_to_artifacts - - # rename all test.xml to sponge_log.xml and then copy them to kokoro - # artifacts directory. - find -L . -name "test.xml" -type f -exec rename 's/test.xml/sponge_log.xml/' {} \; - find -L . -name "sponge_log.xml" -type f | copy_to_artifacts -} - -# Upgrades kokoro's current bazel version to at least 0.20.0 -upgrade_kokoro_bazel_if_needed() { - bazel version - - if [ -f "$KOKORO_GFILE_DIR/use_bazel.sh" ]; then - bash "$KOKORO_GFILE_DIR/use_bazel.sh" 0.20.0 - else - use_bazel.sh 0.20.0 - fi - bazel version -} - -run_bazel_affected() { - echo "Checking affected targets..." - if [ -z "$COMMAND" ]; then - COMMAND="test" - fi - if [ -z "$TARGET" ]; then - if [ "$COMMAND" == "test" ]; then - # Only return test targets. - bazel_kind="test" - else - # Return all affected targets. - bazel_kind="rule" - fi - - if [ -n "$KOKORO_BUILD_NUMBER" ]; then - pushd github/repo >> /dev/null - fi - - # `target_branch` is either the Pull Request destination branch (where it will be merged) or if - # none can be determined, defaults to `develop`. - if [ -n "$KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH" ]; then - target_branch="$KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH" - else - target_branch=develop - fi - - # `base_sha` is the merge base of `target_branch` and the current HEAD. - base_sha=$(git merge-base "$target_branch" HEAD) - - # We must upgrade bazel prior to running bazel query because we rely on features in bazel - # 0.20. - if [ -n "$KOKORO_BUILD_NUMBER" ]; then - upgrade_kokoro_bazel_if_needed - fi - - # Output the affected targets to the logs. This also gives the affected_targets script the - # opportunity to fail. - scripts/affected_targets "$bazel_kind" "$base_sha...HEAD" - - # `TARGET` is then all bazel targets affected by changes in the commit range between `base_sha` - # and `HEAD`. By default, that becomes all changes between the `develop` branch and the latest - # commit. - TARGET="$(scripts/affected_targets $bazel_kind $base_sha...HEAD)" - - if [ -n "$KOKORO_BUILD_NUMBER" ]; then - popd >> /dev/null - fi - fi - - if [ -z "$TARGET" ]; then - echo "Nothing to build." - exit 0 - fi - - comment_identifier="affected-targets" - - if [ -z "$TARGET" ]; then - echo "Nothing to build." - - if [ -n "$GITHUB_API_TOKEN" ]; then - delete_comment "$comment_identifier" - fi - - exit 0 - else - if [ -n "$GITHUB_API_TOKEN" ]; then - comment_tmp_path=$(mktemp -d) - comment_tmp_file="$comment_tmp_path/comment.tmp" - echo "bazel detected changes to the following targets:" > "$comment_tmp_file" - echo >> "$comment_tmp_file" - echo '```' >> "$comment_tmp_file" - echo "$TARGET" >> "$comment_tmp_file" - echo '```' >> "$comment_tmp_file" - - post_comment "$comment_identifier" "$comment_tmp_file" - fi - fi - - run_bazel -} - -run_bazel() { - echo "Running bazel builds..." - - if [ -n "$KOKORO_BUILD_NUMBER" ]; then - move_derived_data_to_tmp - fi - - if [ -n "$KOKORO_BUILD_NUMBER" ]; then - upgrade_kokoro_bazel_if_needed - fi - - if [ -n "$VERBOSE_OUTPUT" ]; then - verbosity_args="-s" - fi - - if [ -z "$COMMAND" ]; then - COMMAND="test" - fi - if [ -z "$TARGET" ]; then - TARGET="//..." - fi - - if [ -n "$KOKORO_BUILD_NUMBER" ]; then - select_xcode "$XCODE_VERSION" - - # Move into our cloned repo - cd github/repo - fi - - # Run against whichever Xcode is currently selected. - selected_xcode_developer_path=$(xcode-select -p) - selected_xcode_contents_path=$(dirname "$selected_xcode_developer_path") - - xcode_version=$(cat "$selected_xcode_contents_path/version.plist" \ - | grep "CFBundleShortVersionString" -A1 \ - | grep string \ - | cut -d'>' -f2 \ - | cut -d'<' -f1) - - if [ "$COMMAND" == "build" ]; then - echo "🏗️ $COMMAND with Xcode $xcode_version..." - elif [ "$COMMAND" == "test" ]; then - echo "🛠️ $COMMAND with Xcode $xcode_version..." - - if [ -n "$VERBOSE_OUTPUT" ]; then - extra_args="--test_output=all" - else - extra_args="--test_output=errors" - fi - fi - - fix_bazel_imports - if [ -n "$KOKORO_ARTIFACTS_DIR" ]; then - # Especially in the event of failure, we want our test artifacts to be uploaded. - trap upload_bazel_test_artifacts EXIT - fi - - snapshot_dir="${repo_dir}/snapshot_test_goldens/goldens" - tmp_img_dir="$(mktemp -d)" - - # Install git lfs if we're performing tests on kokoro - if [ -n "$KOKORO_BUILD_NUMBER" ] || [ -n "$AUTOBOT_BUILD_NUMBER" ]; then - if [ "$COMMAND" == "test" ]; then - brew_install git-lfs - git lfs install - git lfs pull - - # Reset the simulators to prepare for hosted snapshot tests - sim_cleaner_tmp=$(mktemp -d) - git clone https://github.com/material-foundation/ios-simulator-utils.git "$sim_cleaner_tmp" - source "${sim_cleaner_tmp}/scripts/cleanup_simulators.sh" - perform_pre_test_cleanup "iPhone" - fi - fi - - # Configure CI mode - if [ -n "$KOKORO_BUILD_NUMBER" ]; then - ci_mode="kokoro" - elif [ -n "$AUTOBOT_BUILD_NUMBER" ]; then - ci_mode="autobot" - fi - - bazel $COMMAND $TARGET --xcode_version $xcode_version --ios_minimum_os=9.0 \ - --ios_multi_cpus=i386,x86_64 $extra_args $verbosity_args \ - --test_env="FB_REFERENCE_IMAGE_DIR=$snapshot_dir" \ - --test_env="IMAGE_DIFF_DIR=$tmp_img_dir" \ - --define ci_mode=$ci_mode -} - run_cocoapods() { echo "Running cocoapods builds..." @@ -611,8 +334,6 @@ if [ -n "$VERBOSE_OUTPUT" ]; then fi case "$DEPENDENCY_SYSTEM" in - "bazel") run_bazel ;; - "bazel-affected") run_bazel_affected ;; "cocoapods") run_cocoapods ;; "cocoapods-podspec") run_cocoapods ;; "website") generate_website ;; diff --git a/BUILD b/BUILD deleted file mode 100644 index dc1643e509c..00000000000 --- a/BUILD +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2017-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. - -licenses(["notice"]) # Apache 2.0 - -exports_files(["LICENSE"]) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46f7ca0000e..469a47f984b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,74 @@ +# 109.0.0 + +This major release deletes bazel support, improves documentation for Cards and TextControls, and +adds the large content view support for MDCItemBar. + +## Breaking changes + +Bazel is no longer supported. + +## Component changes + +### ActionSheet + +* [Remove duplicate primary demo bit.](https://github.com/material-components/material-components-ios/commit/b56963f4edb029e4642409a317a74637ab9f5e8b) (Jeff Verkoeyen) + +### Banner + +* [Make the primary demo presentable.](https://github.com/material-components/material-components-ios/commit/fb7a6f4f266117319b36ae57c89d3acf07412bb5) (Jeff Verkoeyen) + +### BottomAppBar + +* [Add MDCRipple support to MDCBottomAppBarView](https://github.com/material-components/material-components-ios/commit/cd30e764c252865d1d7c8fa973cb7996ac2421d2) (Cody Weaver) + +### BottomSheet + +* [Present in full screen in vertical compact size classes when the content height is taller than the sheet view's bounds.](https://github.com/material-components/material-components-ios/commit/b5c894e7e31b280a5ee2bc345cf0d7d6dbad4aa7) (Andrew Overton) + +### Buttons + +* [Fix compilation with -std=c11](https://github.com/material-components/material-components-ios/commit/e49657fb1435f04ad58bee8502cc4c32801fa26b) (Sylvain Defresne) + +### Cards + +* [Replace Cards documentation](https://github.com/material-components/material-components-ios/commit/54723a16a4a9c44e8866ddfe9977d85cbb8524c1) (Andrew Overton) + +### Chips + +* [Add unit tests for MDCChipField delegate interaction.](https://github.com/material-components/material-components-ios/commit/ee625232f81bacd82bb6347492ea4f3fc3ed9388) (Bryan Oltman) +* [Invalidate MDCChipField intrinsic content size in layoutSubviews.](https://github.com/material-components/material-components-ios/commit/3171e89ed6698bb6df0c23e62173eb716ca367b9) (Bryan Oltman) +* [When deleting text in MDCChipField, only select the last chip if the text field is empty.](https://github.com/material-components/material-components-ios/commit/6a6c33b4cc6a3b24c752a31b4cb0b894331f500b) (Bryan Oltman) + +### List + +* [Use standard "List Items" name for all Lists examples.](https://github.com/material-components/material-components-ios/commit/5957dd223a089155428806af5a13bb8cd13d039f) (Jeff Verkoeyen) + +### Snackbar + +* [Add a property to allow customization the accessibility post notification level.](https://github.com/material-components/material-components-ios/commit/23a372798c4844dae04c18fa3b9fee67292c328d) (Yarden Eitan) +* [Ensure snackbar buttons meet minimum touch target requirements](https://github.com/material-components/material-components-ios/commit/853f461ab6b6d5b5b3429243df974e0931c47508) (Andrew Overton) + +### Tabs + +* [Add ScrollableCentered option to TabBarView example](https://github.com/material-components/material-components-ios/commit/1666348de940fc67bf2579bec7cc71574c80088b) (Andrew Overton) +* [Add example to expose a bug where tab selection indicator and selected text highlighting can get out of sync.](https://github.com/material-components/material-components-ios/commit/99345ad5084f92db2ca46c15513b1a1d62a35509) (Bryan Oltman) +* [Adds large content viewer support to MDCItemBar.](https://github.com/material-components/material-components-ios/commit/28c20ee11cd9bedff0f52687bf62cca900cb22cd) (Nobody) +* [Adds large content viewer support to MDCItemBar.](https://github.com/material-components/material-components-ios/commit/b387c367d8addb0f88572991f4b763960ad7abaa) (Eric Lee) +* [Ensure the cell representing MDCTabBar's selected item is selected before display.](https://github.com/material-components/material-components-ios/commit/c715e6bcf78953ee2aa4b21d21ef7cf2dd299284) (Bryan Oltman) +* [Stop ripple in MDCTabBar from showing up on scroll](https://github.com/material-components/material-components-ios/commit/f1a125544b8b111fc90686ca9c9798dad6c6506c) (Cody Weaver) + +### TextControls + +* [Update TextControls readme metadata path](https://github.com/material-components/material-components-ios/commit/2a3a0adfaeb2837a1220ab23491c2702c2ae6787) (Andrew Overton) +* [Replace TextControls documentation](https://github.com/material-components/material-components-ios/commit/512d6a00495b782b0979677178ce5caee188643b) (Andrew Overton) + +## Multi-component changes + +* [Delete all bazel support.](https://github.com/material-components/material-components-ios/commit/8abbb099a920ee04e2cd6d50731930cd9fea9cdc) (Jeff Verkoeyen) +* [Remove stale code coverage badge.](https://github.com/material-components/material-components-ios/commit/c577ec898cea2a5313a7c215f8a38be5d92e4417) (Jeff Verkoeyen) + +--- + # 108.1.0 This minor release improves our support of the new iPadOS cursor APIs, deprecates a themer, and diff --git a/MaterialComponents.podspec b/MaterialComponents.podspec index 98e65f9cd6e..2328a3a9095 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 = "108.1.0" + mdc.version = "109.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" diff --git a/MaterialComponentsBeta.podspec b/MaterialComponentsBeta.podspec index 8f61ae61719..7e6ba90c5bd 100644 --- a/MaterialComponentsBeta.podspec +++ b/MaterialComponentsBeta.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |mdc| mdc.name = "MaterialComponentsBeta" - mdc.version = "108.1.0" + mdc.version = "109.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 d9e8e73a9bc..f0a7c2429b7 100644 --- a/MaterialComponentsEarlGreyTests.podspec +++ b/MaterialComponentsEarlGreyTests.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "MaterialComponentsEarlGreyTests" - s.version = "108.1.0" + s.version = "109.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 d4cb0639613..5ccee3e5de5 100644 --- a/MaterialComponentsExamples.podspec +++ b/MaterialComponentsExamples.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "MaterialComponentsExamples" - s.version = "108.1.0" + s.version = "109.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 450e54f8584..2043406ad84 100644 --- a/MaterialComponentsSnapshotTests.podspec +++ b/MaterialComponentsSnapshotTests.podspec @@ -53,7 +53,7 @@ end Pod::Spec.new do |s| s.name = "MaterialComponentsSnapshotTests" - s.version = "108.1.0" + s.version = "109.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 a40dc2f20e6..9005a415ab4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -108.1.0 +109.0.0 diff --git a/WORKSPACE b/WORKSPACE deleted file mode 100644 index 6233cb2d0c2..00000000000 --- a/WORKSPACE +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright 2017-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("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") - -git_repository( - name = "build_bazel_rules_apple", - remote = "https://github.com/bazelbuild/rules_apple.git", - tag = "0.9.0", -) - -load( - "@build_bazel_rules_apple//apple:repositories.bzl", - "apple_rules_dependencies", -) - -apple_rules_dependencies() - -git_repository( - name = "build_bazel_rules_swift", - remote = "https://github.com/bazelbuild/rules_swift.git", - tag = "0.4.0", -) - -load( - "@build_bazel_rules_swift//swift:repositories.bzl", - "swift_rules_dependencies", -) - -swift_rules_dependencies() - -git_repository( - name = "bazel_skylib", - remote = "https://github.com/bazelbuild/bazel-skylib.git", - tag = "0.6.0", -) - -git_repository( - name = "bazel_ios_warnings", - remote = "https://github.com/material-foundation/bazel_ios_warnings.git", - tag = "v3.0.0", -) - -http_file( - name = "xctestrunner", - executable = 1, - urls = ["https://github.com/google/xctestrunner/releases/download/0.2.10/ios_test_runner.par"], -) - -git_repository( - name = "material_internationalization_ios", - remote = "https://github.com/material-foundation/material-internationalization-ios.git", - tag = "v2.0.1", -) - -git_repository( - name = "material_testing_ios", - remote = "https://github.com/material-foundation/material-testing-ios.git", - tag = "v1.0.1", -) - -git_repository( - name = "material_text_accessibility_ios", - remote = "https://github.com/material-foundation/material-text-accessibility-ios.git", - tag = "v2.0.0", -) - -git_repository( - name = "motion_interchange_objc", - remote = "https://github.com/material-motion/motion-interchange-objc.git", - tag = "v2.0.0", -) - -git_repository( - name = "motion_animator_objc", - remote = "https://github.com/material-motion/motion-animator-objc.git", - tag = "v3.0.0", -) - -git_repository( - name = "ios_snapshot_test_case", - remote = "https://github.com/material-foundation/ios-snapshot-test-case", - commit = "cd9db9129956037297ef023857e3d82c424b6880", -) - -git_repository( - name = "catalog_by_convention", - remote = "https://github.com/material-foundation/cocoapods-catalog-by-convention.git", - tag = "v2.5.1", -) diff --git a/catalog/BUILD b/catalog/BUILD deleted file mode 100644 index 962857b8c02..00000000000 --- a/catalog/BUILD +++ /dev/null @@ -1,147 +0,0 @@ -# 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. -# 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_objc_library", "mdc_swift_library") -load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") - -licenses(["notice"]) # Apache 2.0 - -IOS_MINIMUM_OS = "9.0" - -ios_application( - name = "MDCCatalog", - app_icons = glob(["MDCCatalog/Assets.xcassets/AppIcon.appiconset/**"]), - bundle_id = "com.google.mdc-catalog", - families = [ - "iphone", - "ipad", - ], - infoplists = ["MDCCatalog/Info.plist"], - launch_storyboard = "MDCCatalog/Base.lproj/LaunchScreen.storyboard", - minimum_os_version = IOS_MINIMUM_OS, - deps = [ - ":MDCCatalogLib", - ":MDCCatalogObjcLib", - ], -) - -ios_application( - name = "MDCDragons", - app_icons = glob(["MDCCatalog/Assets.xcassets/AppIconInverse.appiconset/**"]), - bundle_id = "com.google.MDCDragons", - families = [ - "iphone", - "ipad", - ], - infoplists = ["MDCDragons/Info.plist"], - launch_storyboard = "MDCCatalog/Base.lproj/LaunchScreen.storyboard", - minimum_os_version = IOS_MINIMUM_OS, - deps = [ - ":MDCDragonsLib", - ], -) - -mdc_objc_library( - name = "MDCCatalogObjcLib", - srcs = native.glob(["MDCCatalog/*.h"]), - visibility = ["//visibility:private"], -) - -mdc_swift_library( - name = "MDCCatalogLib", - srcs = native.glob(["MDCCatalog/*.swift"]), - copts = [ - "-swift-version", - "4.2", - ], - resources = ["MDCDragons/HeaderView.xib"], - deps = [ - ":MaterialCatalog", - "//components/AppBar", - "//components/AppBar:ColorThemer", - "//components/AppBar:TypographyThemer", - "//components/BottomSheet", - "//components/Buttons", - "//components/Buttons:ButtonThemer", - "//components/Buttons:Theming", - "//components/Collections", - "//components/Dialogs", - "//components/FlexibleHeader", - "//components/FlexibleHeader:ColorThemer", - "//components/Ink", - "//components/LibraryInfo", - "//components/OverlayWindow", - "//components/Palettes", - "//components/ShadowElevations", - "//components/ShadowLayer", - "//components/Themes", - "//components/Typography", - "//components/private/Icons", - "//components/private/Icons/icons/ic_arrow_back", - "//components/private/Icons/icons/ic_check", - "//components/private/Icons/icons/ic_color_lens", - "//components/private/Icons/icons/ic_help_outline", - "//components/private/Icons/icons/ic_more_horiz", - "//components/private/Icons/icons/ic_settings", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - "@catalog_by_convention//:CatalogByConvention", - "@material_internationalization_ios//:MDFInternationalization", - "@material_text_accessibility_ios//:MDFTextAccessibility", - ], -) - -mdc_objc_library( - name = "MaterialCatalog", - srcs = native.glob(["MaterialCatalog/*.m"]), - hdrs = native.glob(["MaterialCatalog/*.h"]), - module_name = "MaterialCatalog", - deps = [ - "//components/Themes", - ], -) - -mdc_swift_library( - name = "MDCDragonsLib", - srcs = native.glob(["MDCDragons/*.swift"]), - copts = [ - "-swift-version", - "4.2", - ], - data = glob(["MDCCatalog/Assets.xcassets/*.imageset/**"]), - resources = ["MDCDragons/HeaderView.xib"], - deps = [ - "//components/AppBar", - "//components/FlexibleHeader", - "//components/LibraryInfo", - "//components/ShadowElevations", - "//components/ShadowLayer", - "//components/Themes", - "//components/Typography", - "//components/private/Icons/icons/ic_arrow_back", - "//components/private/Icons/icons/ic_chevron_right", - "//components/private/KeyboardWatcher", - "@catalog_by_convention//:CatalogByConvention", - ], -) - -mdc_objc_library( - name = "MDCActionExtension", - srcs = native.glob(["MDCActionExtension/*.m"]), - hdrs = native.glob(["MDCActionExtension/*.h"]), - deps = ["@catalog_by_convention//:CatalogByConvention"], -) diff --git a/catalog/MDCCatalog/Info.plist b/catalog/MDCCatalog/Info.plist index a10bbd3da06..fb9a29157ed 100644 --- a/catalog/MDCCatalog/Info.plist +++ b/catalog/MDCCatalog/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 108.1.0 + 109.0.0 CFBundleSignature ???? CFBundleVersion - 108.1.0 + 109.0.0 LSRequiresIPhoneOS UIAppFonts diff --git a/catalog/MDCDragons/Info.plist b/catalog/MDCDragons/Info.plist index 7c6b7b9baa9..0ae8b77ecc1 100644 --- a/catalog/MDCDragons/Info.plist +++ b/catalog/MDCDragons/Info.plist @@ -15,9 +15,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 108.1.0 + 109.0.0 CFBundleVersion - 108.1.0 + 109.0.0 LSRequiresIPhoneOS UILaunchStoryboardName diff --git a/catalog/MaterialCatalog/MaterialCatalog.podspec b/catalog/MaterialCatalog/MaterialCatalog.podspec index cf2e668e078..ee9b8dff9ab 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 = "108.1.0" + s.version = "109.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/components/ActionSheet/BUILD b/components/ActionSheet/BUILD deleted file mode 100644 index c9d3cfce801..00000000000 --- a/components/ActionSheet/BUILD +++ /dev/null @@ -1,167 +0,0 @@ -# Copyright 2018-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", - "mdc_unit_test_swift_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ActionSheet", - sdk_frameworks = ["UIKit"], - deps = [ - "//components/BottomSheet", - "//components/Elevation", - "//components/Ink", - "//components/Ripple", - "//components/ShadowElevations", - "//components/Typography", - "//components/private/Math", - ], -) - -mdc_extension_objc_library( - name = "Theming", - deps = [ - ":ActionSheet", - "//components/Elevation", - "//components/ShadowElevations", - "//components/private/Color", - "//components/schemes/Container", - ], -) - -mdc_extension_objc_library( - name = "ActionSheetThemer", - deps = [ - ":ActionSheet", - ":ColorThemer", - ":TypographyThemer", - ], -) - -mdc_extension_objc_library( - name = "TypographyThemer", - deps = [ - ":ActionSheet", - "//components/schemes/Typography", - ], -) - -mdc_extension_objc_library( - name = "ColorThemer", - deps = [ - ":ActionSheet", - "//components/schemes/Color", - ], -) - -mdc_objc_library( - name = "privateHeaders", - testonly = 1, - hdrs = native.glob(["src/private/*.h"]), - deps = [":ActionSheet"], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":ActionSheet", - ":Theming", - "//components/Buttons", - "//components/Buttons:Theming", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":ActionSheet", - ":Theming", - "//components/AppBar", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_unit_test_swift_library( - name = "unit_test_swift_sources", - extra_srcs = glob(["tests/unit/ColorThemer/*.swift"]), - deps = [ - ":ActionSheet", - ":ColorThemer", - ":privateHeaders", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - hdrs = glob(["tests/unit/*.h"]), - extra_srcs = glob([ - "tests/unit/ActionSheetThemer/*.m", - "tests/unit/Theming/*.m", - ]), - sdk_frameworks = [ - "CoreImage", - ], - deps = [ - ":ActionSheet", - ":ActionSheetThemer", - ":ColorThemer", - ":Theming", - ":TypographyThemer", - ":privateHeaders", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - # TODO (https://github.com/material-components/material-components-ios/issues/8249): Re-enable autobot environment. - use_autobot_environment_runner = False, - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":ActionSheet", - ":privateHeaders", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/ActionSheet/examples/ActionSheetComparisonExample.m b/components/ActionSheet/examples/ActionSheetComparisonExample.m index dabb5a9bf5a..f9c9093df42 100644 --- a/components/ActionSheet/examples/ActionSheetComparisonExample.m +++ b/components/ActionSheet/examples/ActionSheetComparisonExample.m @@ -140,7 +140,7 @@ @implementation ActionSheetComparisonExampleViewController (CatalogByConvention) + (NSDictionary *)catalogMetadata { return @{ @"breadcrumbs" : @[ @"Action Sheet", @"Material : UIKit Comparison" ], - @"primaryDemo" : @YES, + @"primaryDemo" : @NO, @"presentable" : @NO }; } diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet/ipadair2_13_3_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/ipadair2_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..4ea43aec32c Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/ipadair2_13_3_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..239686141a8 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone11_13_3_x86_64_en_us_dark_mode.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone11_13_3_x86_64_en_us_dark_mode.png new file mode 100644 index 00000000000..26ba4f5d081 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone11_13_3_x86_64_en_us_dark_mode.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone11promax_13_3_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone11promax_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..b883f5f2774 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone11promax_13_3_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone5s_10_3_1_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone5s_10_3_1_x86_64_en_us.png new file mode 100644 index 00000000000..f1822f3f636 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone5s_10_3_1_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone6splus_11_4_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone6splus_11_4_x86_64_en_us.png new file mode 100644 index 00000000000..8b259e30f9a Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone6splus_11_4_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone6splus_12_4_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone6splus_12_4_x86_64_en_us.png new file mode 100644 index 00000000000..d3eddab9c34 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphone6splus_12_4_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..a6cc5bbc25f Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us_M.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us_M.png new file mode 100644 index 00000000000..a6cc5bbc25f Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us_M.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us_XL.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us_XL.png new file mode 100644 index 00000000000..a6cc5bbc25f Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us_XL.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us_XS.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us_XS.png new file mode 100644 index 00000000000..a6cc5bbc25f Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us_XS.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us_XXXL.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us_XXXL.png new file mode 100644 index 00000000000..a6cc5bbc25f Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet/iphonese_13_3_x86_64_en_us_XXXL.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/ipadair2_13_3_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/ipadair2_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..c6b7509aad6 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/ipadair2_13_3_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..64d4440bdc3 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone11_13_3_x86_64_en_us_dark_mode.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone11_13_3_x86_64_en_us_dark_mode.png new file mode 100644 index 00000000000..8481438b907 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone11_13_3_x86_64_en_us_dark_mode.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone11promax_13_3_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone11promax_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..2b34fd6ec23 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone11promax_13_3_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone5s_10_3_1_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone5s_10_3_1_x86_64_en_us.png new file mode 100644 index 00000000000..c928b8fedce Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone5s_10_3_1_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone6splus_11_4_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone6splus_11_4_x86_64_en_us.png new file mode 100644 index 00000000000..367445e5952 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone6splus_11_4_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone6splus_12_4_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone6splus_12_4_x86_64_en_us.png new file mode 100644 index 00000000000..e017b42e1e6 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphone6splus_12_4_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..9f6fb4a36b6 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us_M.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us_M.png new file mode 100644 index 00000000000..f4d90e1c92f Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us_M.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us_XL.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us_XL.png new file mode 100644 index 00000000000..e75a3adb510 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us_XL.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us_XS.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us_XS.png new file mode 100644 index 00000000000..5b0429a017b Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us_XS.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us_XXXL.png b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us_XXXL.png new file mode 100644 index 00000000000..9ba5ad1a976 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Action_Sheet__Swift_/iphonese_13_3_x86_64_en_us_XXXL.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/ipadair2_13_3_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/ipadair2_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..6e94ba479e3 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/ipadair2_13_3_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..3636dc3a8ec Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone11_13_3_x86_64_en_us_dark_mode.png b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone11_13_3_x86_64_en_us_dark_mode.png new file mode 100644 index 00000000000..b1d71293b81 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone11_13_3_x86_64_en_us_dark_mode.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone11promax_13_3_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone11promax_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..9662fd07099 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone11promax_13_3_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone5s_10_3_1_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone5s_10_3_1_x86_64_en_us.png new file mode 100644 index 00000000000..e8ca52dc8f0 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone5s_10_3_1_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone6splus_11_4_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone6splus_11_4_x86_64_en_us.png new file mode 100644 index 00000000000..9686fc35042 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone6splus_11_4_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone6splus_12_4_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone6splus_12_4_x86_64_en_us.png new file mode 100644 index 00000000000..cd126c21659 Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphone6splus_12_4_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us.png b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..c27fbabf0fa Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us_M.png b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us_M.png new file mode 100644 index 00000000000..c27fbabf0fa Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us_M.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us_XL.png b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us_XL.png new file mode 100644 index 00000000000..c27fbabf0fa Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us_XL.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us_XS.png b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us_XS.png new file mode 100644 index 00000000000..c27fbabf0fa Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us_XS.png differ diff --git a/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us_XXXL.png b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us_XXXL.png new file mode 100644 index 00000000000..c27fbabf0fa Binary files /dev/null and b/components/ActionSheet/examples/scuba_goldens/Material___UIKit_Comparison/iphonese_13_3_x86_64_en_us_XXXL.png differ diff --git a/components/ActivityIndicator/BUILD b/components/ActivityIndicator/BUILD deleted file mode 100644 index 0836224b164..00000000000 --- a/components/ActivityIndicator/BUILD +++ /dev/null @@ -1,111 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", - "mdc_unit_test_swift_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ActivityIndicator", - bundles = [":Bundle"], - sdk_frameworks = [ - "QuartzCore", - "UIKit", - ], - deps = [ - "//components/Palettes", - "//components/private/Application", - "@material_internationalization_ios//:MDFInternationalization", - "@motion_animator_objc//:MotionAnimator", - "@motion_interchange_objc//:MotionInterchange", - ], -) - -filegroup( - name = "BundleFiles", - srcs = glob([ - "src/MaterialActivityIndicator.bundle/**", - ]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) - -mdc_unit_test_swift_library( - name = "unit_test_swift_sources", - deps = [ - ":ActivityIndicator", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":ActivityIndicator", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":ActivityIndicator", - "//components/Buttons", - "//components/Buttons:ButtonThemer", - "//components/Collections", - "//components/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":ActivityIndicator", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":ActivityIndicator", - "//components/Availability", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/AnimationTiming/BUILD b/components/AnimationTiming/BUILD deleted file mode 100644 index 252d52c425f..00000000000 --- a/components/AnimationTiming/BUILD +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "AnimationTiming", - sdk_frameworks = [ - "UIKit", - "QuartzCore", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - hdrs = glob(["tests/unit/*.h"]), - deps = [":AnimationTiming"], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":AnimationTiming", - "//components/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":AnimationTiming", - "//components/Typography", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/AppBar/BUILD b/components/AppBar/BUILD deleted file mode 100644 index 03babf38885..00000000000 --- a/components/AppBar/BUILD +++ /dev/null @@ -1,173 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", - "mdc_unit_test_swift_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "AppBar", - bundles = [":Bundle"], - sdk_frameworks = [ - "CoreGraphics", - "UIKit", - ], - deps = [ - "//components/FlexibleHeader", - "//components/HeaderStackView", - "//components/NavigationBar", - "//components/ShadowElevations", - "//components/ShadowLayer", - "//components/Typography", - "//components/private/Application", - "//components/private/Icons/icons/ic_arrow_back", - "//components/private/UIMetrics", - "@material_internationalization_ios//:MDFInternationalization", - "@material_text_accessibility_ios//:MDFTextAccessibility", - ], -) - -filegroup( - name = "BundleFiles", - srcs = glob([ - "src/MaterialAppBar.bundle/**", - ]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) - -mdc_extension_objc_library( - name = "ColorThemer", - deps = [ - ":AppBar", - "//components/FlexibleHeader:ColorThemer", - "//components/NavigationBar:ColorThemer", - "//components/Themes", - ], -) - -mdc_extension_objc_library( - name = "Theming", - deps = [ - ":AppBar", - "//components/schemes/Container", - ], -) - -mdc_extension_objc_library( - name = "TypographyThemer", - deps = [ - ":AppBar", - "//components/NavigationBar:TypographyThemer", - ], -) - -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - includes = ["src/private"], - visibility = ["//visibility:private"], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":AppBar", - ":ColorThemer", - ":Theming", - ":TypographyThemer", - "//components/Buttons", - "//components/Buttons:ButtonThemer", - "//components/Buttons:Theming", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":AppBar", - ":Theming", - "//components/Buttons", - "//components/Buttons:Theming", - "//components/FlexibleHeader:CanAlwaysExpandToMaximumHeight", - "//components/Tabs", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - extra_srcs = glob([ - "tests/unit/Theming/*.m", - ]), - deps = [ - ":AppBar", - ":Theming", - ], -) - -mdc_unit_test_swift_library( - name = "unit_test_swift_sources", - deps = [ - ":AppBar", - ":ColorThemer", - ":TypographyThemer", - ":private", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - extra_srcs = native.glob(["tests/snapshot/Theming/*.m"]), - deps = [ - ":AppBar", - ":Theming", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/Availability/BUILD b/components/Availability/BUILD deleted file mode 100644 index 67b9d24528c..00000000000 --- a/components/Availability/BUILD +++ /dev/null @@ -1,28 +0,0 @@ -# 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. - -# Description: -# Material Availability - -load( - "//:material_components_ios.bzl", - "mdc_public_objc_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Availability", -) - diff --git a/components/Banner/BUILD b/components/Banner/BUILD deleted file mode 100644 index dd4bd657f8d..00000000000 --- a/components/Banner/BUILD +++ /dev/null @@ -1,113 +0,0 @@ -# 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. -# 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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Banner", - deps = [ - "//components/Buttons", - "//components/Elevation", - "//components/Typography", - ], -) - -mdc_extension_objc_library( - name = "Theming", - deps = [ - ":Banner", - "//components/Buttons", - "//components/Buttons:Theming", - "//components/Elevation", - "//components/schemes/Container", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":Banner", - ":Theming", - "//components/AppBar", - "//components/AppBar:Theming", - "//components/Buttons", - "//components/Buttons:Theming", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":Banner", - ":Theming", - "//components/Buttons", - "//components/Buttons:Theming", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":Banner", - ":Theming", - "//components/Buttons", - "//components/schemes/Typography", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [":snapshot_test_lib"], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - extra_srcs = glob([ - "tests/unit/Theming/*.m", - ]), - deps = [ - ":Banner", - ":Theming", - "//components/Availability", - "//components/Buttons", - "//components/Typography", - "//components/private/Color", - "//components/private/Math", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/Banner/examples/BannerTypicalUseExampleViewController.m b/components/Banner/examples/BannerTypicalUseExampleViewController.m index 78f5efa8a09..6b0586decee 100644 --- a/components/Banner/examples/BannerTypicalUseExampleViewController.m +++ b/components/Banner/examples/BannerTypicalUseExampleViewController.m @@ -153,7 +153,7 @@ + (NSDictionary *)catalogMetadata { return @{ @"breadcrumbs" : @[ @"Banner", @"Banner" ], @"primaryDemo" : @YES, - @"presentable" : @NO, + @"presentable" : @YES, }; } diff --git a/components/BottomAppBar/BUILD b/components/BottomAppBar/BUILD deleted file mode 100644 index 190526eeadd..00000000000 --- a/components/BottomAppBar/BUILD +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "BottomAppBar", - sdk_frameworks = [ - "CoreGraphics", - "QuartzCore", - "UIKit", - ], - deps = [ - "//components/Buttons", - "//components/NavigationBar", - "//components/NavigationBar:ColorThemer", - "//components/private/Math", - "@material_internationalization_ios//:MDFInternationalization", - ], -) - -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - includes = ["src/private"], - visibility = ["//visibility:private"], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":BottomAppBar", - "//components/AppBar", - "//components/AppBar:ColorThemer", - "//components/AppBar:TypographyThemer", - "//components/Buttons", - "//components/Buttons:Theming", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":BottomAppBar", - "//components/AppBar", - "//components/Buttons", - "//components/Buttons:Theming", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":BottomAppBar", - ":private", - "//components/NavigationBar", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":BottomAppBar", - "//components/Availability", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [":snapshot_test_lib"], -) diff --git a/components/BottomAppBar/src/MDCBottomAppBarView.h b/components/BottomAppBar/src/MDCBottomAppBarView.h index 378e58e98d0..d36504f2209 100644 --- a/components/BottomAppBar/src/MDCBottomAppBarView.h +++ b/components/BottomAppBar/src/MDCBottomAppBarView.h @@ -104,6 +104,25 @@ typedef NS_ENUM(NSInteger, MDCBottomAppBarFloatingButtonPosition) { */ @property(nullable, nonatomic, strong) UIColor *shadowColor UI_APPEARANCE_SELECTOR; +/** + The color of ink that ripples across the buttons. + + @note This API only has a visual effect if @c enableRippleBehavior is set to @c YES. + */ +@property(nonnull, nonatomic, copy) UIColor *rippleColor; + +/** + By setting this property to @c YES, the Ripple component will be used instead of Ink + to display visual feedback to the user. + + @note This property will eventually be enabled by default, deprecated, and then deleted as part + of our migration to Ripple. Learn more at + https://github.com/material-components/material-components-ios/tree/develop/components/Ink#migration-guide-ink-to-ripple + + Defaults to NO. + */ +@property(nonatomic, assign) BOOL enableRippleBehavior; + /** Sets the visibility of the floating action button. diff --git a/components/BottomAppBar/src/MDCBottomAppBarView.m b/components/BottomAppBar/src/MDCBottomAppBarView.m index 5a681c5e99c..77fa4808d63 100644 --- a/components/BottomAppBar/src/MDCBottomAppBarView.m +++ b/components/BottomAppBar/src/MDCBottomAppBarView.m @@ -441,6 +441,19 @@ - (void)setShadowColor:(UIColor *)shadowColor { _bottomBarLayer.shadowColor = shadowColor.CGColor; } +- (void)setRippleColor:(UIColor *)rippleColor { + _rippleColor = [rippleColor copy]; + self.navBar.rippleColor = _rippleColor; +} + +- (BOOL)enableRippleBehavior { + return self.navBar.enableRippleBehavior; +} + +- (void)setEnableRippleBehavior:(BOOL)enableRippleBehavior { + self.navBar.enableRippleBehavior = enableRippleBehavior; +} + #pragma mark TraitCollection - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { diff --git a/components/BottomAppBar/tests/unit/MDCBottomAppBarRippleTests.m b/components/BottomAppBar/tests/unit/MDCBottomAppBarRippleTests.m new file mode 100644 index 00000000000..e5707ac877d --- /dev/null +++ b/components/BottomAppBar/tests/unit/MDCBottomAppBarRippleTests.m @@ -0,0 +1,68 @@ +// 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 "MaterialBottomAppBar.h" + +#import + +#import "MaterialNavigationBar.h" + +@interface MDCBottomAppBarView (MDCRippleTesting) + +@property(nonatomic, strong) MDCNavigationBar *navBar; + +@end + +@interface MDCBottomAppBarRippleTests : XCTestCase + +@property(nonatomic, nullable, strong) MDCBottomAppBarView *bottomAppBar; + +@end + +@implementation MDCBottomAppBarRippleTests + +- (void)setUp { + [super setUp]; + + self.bottomAppBar = [[MDCBottomAppBarView alloc] init]; +} + +- (void)tearDown { + self.bottomAppBar = nil; + + [super tearDown]; +} + +- (void)testEnableRippleBehaviorDefaultsToNo { + // Then + XCTAssertFalse(self.bottomAppBar.enableRippleBehavior); +} + +- (void)testSetEnableRippleBehaviorSetsNavBarProperty { + // When + self.bottomAppBar.enableRippleBehavior = YES; + + // Then + XCTAssertTrue(self.bottomAppBar.navBar.enableRippleBehavior); +} + +- (void)testSetRippleColorUpdatesNavigationBarProperty { + // When + self.bottomAppBar.rippleColor = UIColor.orangeColor; + + // Then + XCTAssertEqualObjects(self.bottomAppBar.navBar.rippleColor, UIColor.orangeColor); +} + +@end diff --git a/components/BottomNavigation/BUILD b/components/BottomNavigation/BUILD deleted file mode 100644 index 8251ecd2866..00000000000 --- a/components/BottomNavigation/BUILD +++ /dev/null @@ -1,225 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_suite", -) -load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test") - -licenses(["notice"]) # Apache 2.0 - -mdc_objc_library( - name = "BottomNavigation", - srcs = - native.glob( - [ - "src/*.m", - "src/private/*.h", - "src/private/*.m", - ], - exclude = [ - "src/MDCBottomNavigationBarController.m", - "src/MDCBottomNavigationBarController.h", - "src/MaterialBottomNavigationBeta.h", - ], - ), - hdrs = - native.glob( - ["src/*.h"], - exclude = [ - "src/MDCBottomNavigationBarController.h", - "src/MaterialBottomNavigationBeta.h", - ], - ), - bundles = [":Bundle"], - enable_modules = 1, - includes = ["src"], - sdk_frameworks = [ - "CoreGraphics", - "UIKit", - ], - visibility = ["//visibility:public"], - deps = [ - "//components/Availability", - "//components/Elevation", - "//components/Ink", - "//components/Palettes", - "//components/Ripple", - "//components/ShadowElevations", - "//components/ShadowLayer", - "//components/Typography", - "//components/private/Math", - "@material_internationalization_ios//:MDFInternationalization", - ], -) - -# Should only be used by test targets or :BottomNavigationBeta until -# that can be rolled-up into the main target. -mdc_objc_library( - name = "privateHeaders", - hdrs = native.glob(["src/private/*.h"]), - visibility = ["//visibility:private"], -) - -mdc_objc_library( - name = "BottomNavigationBeta", - srcs = ["src/MDCBottomNavigationBarController.m"], - hdrs = [ - "src/MDCBottomNavigationBarController.h", - "src/MaterialBottomNavigationBeta.h", - ], - enable_modules = 1, - includes = ["src"], - sdk_frameworks = ["CoreGraphics"], - visibility = ["//:__subpackages__"], - deps = [ - ":BottomNavigation", - ":privateHeaders", - ], -) - -mdc_extension_objc_library( - name = "Theming", - deps = [ - ":BottomNavigation", - "//components/ShadowElevations", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -filegroup( - name = "BundleFiles", - srcs = glob([ - "src/MaterialBottomNavigation.bundle/**", - ]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - includes = ["examples/supplemental"], - deps = [ - ":BottomNavigation", - ":Theming", - "//components/Availability", - "//components/Palettes", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":BottomNavigation", - ":BottomNavigationBeta", - ":ObjcExamples", - ":Theming", - "//components/AppBar", - "//components/Buttons", - "//components/Palettes", - "//components/schemes/Container", - ], -) - -mdc_objc_library( - name = "unit_test_sources", - testonly = 1, - srcs = native.glob( - [ - "tests/unit/*.m", - "tests/unit/*.h", - "tests/unit/Theming/*.m", - ], - exclude = [ - "tests/unit/MDCBottomNavigationBarControllerTests.m", - "tests/unit/MDCBottomNavigationBarControllerDelegateTests.m", - ], - ), - sdk_frameworks = [ - "CoreGraphics", - "XCTest", - ], - visibility = ["//visibility:private"], - deps = [ - ":BottomNavigation", - ":Theming", - ":privateHeaders", - "//components/Availability", - "//components/Typography", - ], -) - -mdc_objc_library( - name = "unit_test_beta_sources", - testonly = 1, - srcs = [ - "tests/unit/MDCBottomNavigationBarControllerTests.m", - "tests/unit/MDCBottomNavigationBarControllerDelegateTests.m", - ], - sdk_frameworks = [ - "CoreGraphics", - "XCTest", - ], - visibility = ["//visibility:private"], - deps = [ - ":BottomNavigationBeta", - ], -) - -ios_unit_test( - name = "unit_tests_beta", - flaky = 1, - minimum_os_version = "9.0", - test_host = "//components/private/Snapshot/TestHost", - deps = [":unit_test_beta_sources"], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":BottomNavigation", - ":BottomNavigationBeta", - ":Theming", - ":privateHeaders", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [":snapshot_test_lib"], -) diff --git a/components/BottomSheet/BUILD b/components/BottomSheet/BUILD deleted file mode 100644 index e96486445aa..00000000000 --- a/components/BottomSheet/BUILD +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", - "mdc_unit_test_swift_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "BottomSheet", - sdk_frameworks = [ - "QuartzCore", - "WebKit", - ], - deps = [ - "//components/Elevation", - "//components/ShadowElevations", - "//components/ShadowLayer", - "//components/ShapeLibrary", - "//components/Shapes", - "//components/private/KeyboardWatcher", - "//components/private/Math", - ], -) - -mdc_objc_library( - name = "privateHeaders", - hdrs = glob(["src/private/*.h"]), - visibility = ["//visibility:private"], - deps = [":BottomSheet"], -) - -mdc_extension_objc_library( - name = "ShapeThemer", - deps = [ - ":BottomSheet", - "//components/schemes/Shape", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":BottomSheet", - ":ShapeThemer", - "//components/AppBar", - "//components/AppBar:ColorThemer", - "//components/AppBar:TypographyThemer", - "//components/Buttons", - "//components/ShapeLibrary", - "//components/Shapes", - "//components/private/Application", - "//components/schemes/Color", - "//components/schemes/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":BottomSheet", - "//components/Buttons", - "//components/Buttons:ButtonThemer", - "//components/Buttons:Theming", - "//components/schemes/Container", - "//components/TextFields", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":BottomSheet", - ":privateHeaders", - ], -) - -mdc_unit_test_swift_library( - name = "unit_test_swift_sources", - deps = [ - ":BottomSheet", - ":ShapeThemer", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":BottomSheet", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [":snapshot_test_lib"], -) diff --git a/components/BottomSheet/src/private/MDCSheetContainerView.m b/components/BottomSheet/src/private/MDCSheetContainerView.m index 30b0c00a14f..db6ef17009f 100644 --- a/components/BottomSheet/src/private/MDCSheetContainerView.m +++ b/components/BottomSheet/src/private/MDCSheetContainerView.m @@ -244,7 +244,7 @@ - (void)updateSheetFrame { [self.animator removeAllBehaviors]; CGRect sheetRect = self.bounds; - sheetRect.origin.y = CGRectGetMaxY(self.bounds) - [self truncatedPreferredSheetHeight]; + sheetRect.origin.y = CGRectGetMaxY(self.bounds) - [self effectiveSheetHeight]; sheetRect.size.height += kSheetBounceBuffer; self.sheet.frame = sheetRect; @@ -254,7 +254,7 @@ - (void)updateSheetFrame { if (!self.sheet.scrollView) { // If the content doesn't scroll then we have to set its frame to the size we are making // visible. This ensures content using autolayout lays out correctly. - contentFrame.size.height = [self truncatedPreferredSheetHeight]; + contentFrame.size.height = [self effectiveSheetHeight]; } self.contentView.frame = contentFrame; } @@ -271,10 +271,24 @@ - (void)updateSheetState { } } -// Returns |preferredSheetHeight|, truncated as necessary, so that it never exceeds the height of -// the view. -- (CGFloat)truncatedPreferredSheetHeight { - return MIN(self.preferredSheetHeight, [self maximumSheetHeight]); +// Returns |preferredSheetHeight|, modified as necessary. It will return the full screen height if +// the content height is taller than the sheet height and the vertical size class is `.compact`. +// Otherwise, it will return `preferredSheetHeight`, assuming it's shorter than the sheet height. +- (CGFloat)effectiveSheetHeight { + CGFloat maxSheetHeight = [self maximumSheetHeight]; + BOOL contentIsTallerThanMaxSheetHeight = [self scrollViewContentHeight] > maxSheetHeight; + BOOL isVerticallyCompact = + self.traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact; + if (contentIsTallerThanMaxSheetHeight && isVerticallyCompact) { + return maxSheetHeight; + } else { + return MIN(self.preferredSheetHeight, maxSheetHeight); + } +} + +- (CGFloat)scrollViewContentHeight { + return self.sheet.scrollView.contentInset.top + self.sheet.scrollView.contentSize.height + + self.sheet.scrollView.contentInset.bottom; } // Returns the maximum allowable height that the sheet can be dragged to. @@ -283,13 +297,10 @@ - (CGFloat)maximumSheetHeight { if (@available(iOS 11.0, *)) { boundsHeight -= self.safeAreaInsets.top; } - CGFloat scrollViewContentHeight = self.sheet.scrollView.contentInset.top + - self.sheet.scrollView.contentSize.height + - self.sheet.scrollView.contentInset.bottom; - // If we have a scrollview, the sheet should never get taller than its content height. - if (scrollViewContentHeight > 0) { - return MIN(boundsHeight, scrollViewContentHeight); + CGFloat contentHeight = [self scrollViewContentHeight]; + if (contentHeight > 0) { + return MIN(boundsHeight, contentHeight); } else { return MIN(boundsHeight, self.preferredSheetHeight); } @@ -318,7 +329,7 @@ - (CGPoint)targetPoint { CGPoint targetPoint; switch (self.sheetState) { case MDCSheetStatePreferred: - targetPoint = CGPointMake(midX, bottomY - [self truncatedPreferredSheetHeight]); + targetPoint = CGPointMake(midX, bottomY - [self effectiveSheetHeight]); break; case MDCSheetStateExtended: targetPoint = CGPointMake(midX, bottomY - [self maximumSheetHeight]); diff --git a/components/ButtonBar/BUILD b/components/ButtonBar/BUILD deleted file mode 100644 index fd4b09fcd29..00000000000 --- a/components/ButtonBar/BUILD +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", - "mdc_unit_test_swift_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ButtonBar", - sdk_frameworks = [ - "QuartzCore", - "UIKit", - ], - deps = [ - "//components/Buttons", - "//components/private/Application", - "@material_internationalization_ios//:MDFInternationalization", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":ButtonBar", - "//components/Palettes", - "//components/private/Icons/icons/ic_check_circle", - "//components/private/Icons/icons/ic_info", - "//components/schemes/Container", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":ButtonBar", - "//components/schemes/Container", - ], -) - -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - visibility = ["//visibility:private"], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":ButtonBar", - ":private", - ], -) - -mdc_unit_test_swift_library( - name = "unit_test_swift_sources", - deps = [ - ":ButtonBar", - "//components/Typography", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - # TODO (https://github.com/material-components/material-components-ios/issues/8249): Re-enable autobot environment. - use_autobot_environment_runner = False, - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":ButtonBar", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [":snapshot_test_lib"], -) diff --git a/components/Buttons/BUILD b/components/Buttons/BUILD deleted file mode 100644 index 3764304c055..00000000000 --- a/components/Buttons/BUILD +++ /dev/null @@ -1,203 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", - "mdc_unit_test_swift_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Buttons", - sdk_frameworks = [ - "CoreGraphics", - "QuartzCore", - ], - deps = [ - "//components/Elevation", - "//components/Ink", - "//components/Ripple", - "//components/ShadowElevations", - "//components/ShadowLayer", - "//components/ShapeLibrary", - "//components/Shapes", - "//components/Typography", - "//components/private/Math", - "@material_text_accessibility_ios//:MDFTextAccessibility", - ], -) - -mdc_extension_objc_library( - name = "Theming", - deps = [ - ":Buttons", - ":ColorThemer", - ":ShapeThemer", - "//components/ShadowElevations", - "//components/schemes/Container", - ], -) - -mdc_extension_objc_library( - name = "ColorThemer", - deps = [ - ":Buttons", - "//components/schemes/Color", - ], -) - -mdc_extension_objc_library( - name = "TitleColorAccessibilityMutator", - deps = [ - ":Buttons", - "@material_text_accessibility_ios//:MDFTextAccessibility", - ], -) - -mdc_extension_objc_library( - name = "ShapeThemer", - deps = [ - ":Buttons", - "//components/schemes/Shape", - ], -) - -mdc_extension_objc_library( - name = "TypographyThemer", - deps = [ - ":Buttons", - "//components/schemes/Typography", - ], -) - -mdc_extension_objc_library( - name = "ButtonThemer", - deps = [ - ":Buttons", - ":ColorThemer", - ":ShapeThemer", - ":TypographyThemer", - ], -) - -mdc_objc_library( - name = "private", - testonly = 1, - hdrs = native.glob(["src/private/*.h"]), - visibility = [":test_targets"], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":Buttons", - ":Theming", - "//components/ShapeLibrary", - "//components/Shapes", - "//components/Typography", - "//components/private/Math", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Shape", - "//components/schemes/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":Buttons", - ":Theming", - "//components/Typography", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Shape", - "//components/schemes/Typography", - ], -) - -package_group( - name = "test_targets", - packages = [ - "//components/Buttons/...", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - extra_srcs = glob([ - "tests/unit/supplemental/*.m", - "tests/unit/supplemental/*.h", - ]), - xibs = native.glob(["tests/unit/resources/*.xib"]), - deps = [ - ":ButtonThemer", - ":Buttons", - ":ColorThemer", - ":ShapeThemer", - ":TitleColorAccessibilityMutator", - ":TypographyThemer", - ":private", - "//components/Palettes", - "//components/Typography", - ], -) - -mdc_unit_test_swift_library( - name = "unit_test_swift_sources", - extra_srcs = native.glob([ - "tests/unit/Theming/*.swift", - ]), - deps = [ - ":Buttons", - ":ColorThemer", - ":Theming", - ":TypographyThemer", - ":private", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":Buttons", - ":Theming", - "//components/Availability", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [":snapshot_test_lib"], -) diff --git a/components/Buttons/docs/fabs.md b/components/Buttons/docs/fabs.md index 4a18ecf78eb..217869818d9 100644 --- a/components/Buttons/docs/fabs.md +++ b/components/Buttons/docs/fabs.md @@ -20,7 +20,7 @@ There are three types of FABS: -# Using FABs +## Using FABs A FAB performs the primary, or most common, action on a screen. It appears in front of all screen content, typically as a circular shape with an icon in its center. diff --git a/components/Buttons/examples/ButtonsStoryboardExample.swift b/components/Buttons/examples/ButtonsStoryboardExample.swift index 496e09f0603..90c5bb1a27f 100644 --- a/components/Buttons/examples/ButtonsStoryboardExample.swift +++ b/components/Buttons/examples/ButtonsStoryboardExample.swift @@ -216,6 +216,10 @@ extension ButtonsStoryboardExample { "breadcrumbs": ["Buttons", "Buttons (Storyboard)"], "primaryDemo": false, "presentable": false, + // Disabling tests of this example because it currently crashes with + // "'[ setValue:forUndefinedKey:]: this class is not key + // value coding-compliant for the key storyboardContained.'" + "flaky": true, "storyboardName": "ButtonsStoryboardAndProgrammatic", ] } diff --git a/components/Buttons/examples/FloatingButtonTypicalUseSwiftExample.swift b/components/Buttons/examples/FloatingButtonTypicalUseSwiftExample.swift index 6f4b05694fd..a95385a2703 100644 --- a/components/Buttons/examples/FloatingButtonTypicalUseSwiftExample.swift +++ b/components/Buttons/examples/FloatingButtonTypicalUseSwiftExample.swift @@ -31,7 +31,8 @@ class FloatingButtonTypicalUseSwiftExample: UIViewController { view.backgroundColor = UIColor(white: 0.9, alpha: 1) - let plusImage = #imageLiteral(resourceName: "Plus") + let plusImage = UIImage(named: "Plus", in: Bundle(for: type(of: self)), + compatibleWith: traitCollection) let plusImage36 = UIImage(named: "plus_white_36", in: Bundle(for: type(of: self)), compatibleWith: traitCollection) diff --git a/components/Buttons/examples/resources/ButtonsExamples.xcassets/Plus.imageset/Contents.json b/components/Buttons/examples/resources/ButtonsExamples.xcassets/Plus.imageset/Contents.json new file mode 100644 index 00000000000..6915f5b2b77 --- /dev/null +++ b/components/Buttons/examples/resources/ButtonsExamples.xcassets/Plus.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_add_white_1x_ios_24dp.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_add_white_2x_ios_24dp.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ic_add_white_3x_ios_24dp.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/components/Buttons/examples/resources/ButtonsExamples.xcassets/Plus.imageset/ic_add_white_1x_ios_24dp.png b/components/Buttons/examples/resources/ButtonsExamples.xcassets/Plus.imageset/ic_add_white_1x_ios_24dp.png new file mode 100644 index 00000000000..3856041d702 Binary files /dev/null and b/components/Buttons/examples/resources/ButtonsExamples.xcassets/Plus.imageset/ic_add_white_1x_ios_24dp.png differ diff --git a/components/Buttons/examples/resources/ButtonsExamples.xcassets/Plus.imageset/ic_add_white_2x_ios_24dp.png b/components/Buttons/examples/resources/ButtonsExamples.xcassets/Plus.imageset/ic_add_white_2x_ios_24dp.png new file mode 100644 index 00000000000..67bb598e52a Binary files /dev/null and b/components/Buttons/examples/resources/ButtonsExamples.xcassets/Plus.imageset/ic_add_white_2x_ios_24dp.png differ diff --git a/components/Buttons/examples/resources/ButtonsExamples.xcassets/Plus.imageset/ic_add_white_3x_ios_24dp.png b/components/Buttons/examples/resources/ButtonsExamples.xcassets/Plus.imageset/ic_add_white_3x_ios_24dp.png new file mode 100644 index 00000000000..0fdced8fce7 Binary files /dev/null and b/components/Buttons/examples/resources/ButtonsExamples.xcassets/Plus.imageset/ic_add_white_3x_ios_24dp.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons/ipadair2_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons/ipadair2_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..5cf0f7393a3 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons/ipadair2_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..ae9cb2daca4 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons/iphone11_13_3_x86_64_en_us_dark_mode.png b/components/Buttons/examples/scuba_goldens/Buttons/iphone11_13_3_x86_64_en_us_dark_mode.png new file mode 100644 index 00000000000..dc60f39e786 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons/iphone11_13_3_x86_64_en_us_dark_mode.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons/iphone11promax_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons/iphone11promax_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..baf46250bac Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons/iphone11promax_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons/iphone5s_10_3_1_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons/iphone5s_10_3_1_x86_64_en_us.png new file mode 100644 index 00000000000..c4ada4729b7 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons/iphone5s_10_3_1_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons/iphone6splus_11_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons/iphone6splus_11_4_x86_64_en_us.png new file mode 100644 index 00000000000..03f3528c7a1 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons/iphone6splus_11_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons/iphone6splus_12_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons/iphone6splus_12_4_x86_64_en_us.png new file mode 100644 index 00000000000..9b310a589ad Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons/iphone6splus_12_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..83448198603 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us_M.png b/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us_M.png new file mode 100644 index 00000000000..83448198603 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us_M.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us_XL.png b/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us_XL.png new file mode 100644 index 00000000000..83448198603 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us_XL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us_XS.png b/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us_XS.png new file mode 100644 index 00000000000..83448198603 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us_XS.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us_XXXL.png b/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us_XXXL.png new file mode 100644 index 00000000000..83448198603 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons/iphonese_13_3_x86_64_en_us_XXXL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/ipadair2_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/ipadair2_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..034a5f556cf Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/ipadair2_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..7d1db9e7ff0 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone11_13_3_x86_64_en_us_dark_mode.png b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone11_13_3_x86_64_en_us_dark_mode.png new file mode 100644 index 00000000000..1ad11e48239 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone11_13_3_x86_64_en_us_dark_mode.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone11promax_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone11promax_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..b1af4675ff9 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone11promax_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone5s_10_3_1_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone5s_10_3_1_x86_64_en_us.png new file mode 100644 index 00000000000..ccb179b5de0 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone5s_10_3_1_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone6splus_11_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone6splus_11_4_x86_64_en_us.png new file mode 100644 index 00000000000..a671a67689d Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone6splus_11_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone6splus_12_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone6splus_12_4_x86_64_en_us.png new file mode 100644 index 00000000000..5a08c65cbf8 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphone6splus_12_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..fa6e0689dfa Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us_M.png b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us_M.png new file mode 100644 index 00000000000..fa6e0689dfa Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us_M.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us_XL.png b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us_XL.png new file mode 100644 index 00000000000..fa6e0689dfa Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us_XL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us_XS.png b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us_XS.png new file mode 100644 index 00000000000..fa6e0689dfa Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us_XS.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us_XXXL.png b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us_XXXL.png new file mode 100644 index 00000000000..fa6e0689dfa Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Content_Edge_Insets_/iphonese_13_3_x86_64_en_us_XXXL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/ipadair2_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/ipadair2_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..8a4d8d29806 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/ipadair2_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..f8f02386e36 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone11_13_3_x86_64_en_us_dark_mode.png b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone11_13_3_x86_64_en_us_dark_mode.png new file mode 100644 index 00000000000..2e7606da59f Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone11_13_3_x86_64_en_us_dark_mode.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone11promax_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone11promax_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..330f71218be Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone11promax_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone5s_10_3_1_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone5s_10_3_1_x86_64_en_us.png new file mode 100644 index 00000000000..10a1a0adf7b Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone5s_10_3_1_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone6splus_11_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone6splus_11_4_x86_64_en_us.png new file mode 100644 index 00000000000..cef0a37d8ed Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone6splus_11_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone6splus_12_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone6splus_12_4_x86_64_en_us.png new file mode 100644 index 00000000000..9cf72ae805d Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphone6splus_12_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..303be48cb8f Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us_M.png b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us_M.png new file mode 100644 index 00000000000..129815169d5 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us_M.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us_XL.png b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us_XL.png new file mode 100644 index 00000000000..abaf1f07c4b Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us_XL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us_XS.png b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us_XS.png new file mode 100644 index 00000000000..9a5818df23a Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us_XS.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us_XXXL.png b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us_XXXL.png new file mode 100644 index 00000000000..8de0d3005a1 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Custom_Font_/iphonese_13_3_x86_64_en_us_XXXL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/ipadair2_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/ipadair2_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..1e426e74343 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/ipadair2_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..ed0da19ca00 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone11_13_3_x86_64_en_us_dark_mode.png b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone11_13_3_x86_64_en_us_dark_mode.png new file mode 100644 index 00000000000..a054d5de020 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone11_13_3_x86_64_en_us_dark_mode.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone11promax_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone11promax_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..ded3ddbb629 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone11promax_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone5s_10_3_1_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone5s_10_3_1_x86_64_en_us.png new file mode 100644 index 00000000000..80df651058c Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone5s_10_3_1_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone6splus_11_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone6splus_11_4_x86_64_en_us.png new file mode 100644 index 00000000000..e9a161e898b Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone6splus_11_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone6splus_12_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone6splus_12_4_x86_64_en_us.png new file mode 100644 index 00000000000..f8be554faca Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphone6splus_12_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..67df677339f Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us_M.png b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us_M.png new file mode 100644 index 00000000000..eedfb3ec952 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us_M.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us_XL.png b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us_XL.png new file mode 100644 index 00000000000..037d4f5263e Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us_XL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us_XS.png b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us_XS.png new file mode 100644 index 00000000000..3853583112a Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us_XS.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us_XXXL.png b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us_XXXL.png new file mode 100644 index 00000000000..3ccbd6832b1 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__DynamicType_/iphonese_13_3_x86_64_en_us_XXXL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Swift_/ipadair2_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/ipadair2_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..b975557e497 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/ipadair2_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Swift_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..4cccb270073 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone11_13_3_x86_64_en_us_dark_mode.png b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone11_13_3_x86_64_en_us_dark_mode.png new file mode 100644 index 00000000000..0e6a7ec6135 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone11_13_3_x86_64_en_us_dark_mode.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone11promax_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone11promax_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..4d638800831 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone11promax_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone5s_10_3_1_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone5s_10_3_1_x86_64_en_us.png new file mode 100644 index 00000000000..27c33e215ea Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone5s_10_3_1_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone6splus_11_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone6splus_11_4_x86_64_en_us.png new file mode 100644 index 00000000000..dc59f3660ee Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone6splus_11_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone6splus_12_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone6splus_12_4_x86_64_en_us.png new file mode 100644 index 00000000000..7e2719a58a3 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphone6splus_12_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..29e35d722b1 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us_M.png b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us_M.png new file mode 100644 index 00000000000..29e35d722b1 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us_M.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us_XL.png b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us_XL.png new file mode 100644 index 00000000000..29e35d722b1 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us_XL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us_XS.png b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us_XS.png new file mode 100644 index 00000000000..29e35d722b1 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us_XS.png differ diff --git a/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us_XXXL.png b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us_XXXL.png new file mode 100644 index 00000000000..29e35d722b1 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Buttons__Swift_/iphonese_13_3_x86_64_en_us_XXXL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button/ipadair2_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/ipadair2_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..48ef311d5ad Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/ipadair2_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..8bc8a6d07be Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone11_13_3_x86_64_en_us_dark_mode.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone11_13_3_x86_64_en_us_dark_mode.png new file mode 100644 index 00000000000..a5cf82bd8f7 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone11_13_3_x86_64_en_us_dark_mode.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone11promax_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone11promax_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..c33e8357e6c Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone11promax_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone5s_10_3_1_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone5s_10_3_1_x86_64_en_us.png new file mode 100644 index 00000000000..2f965e82828 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone5s_10_3_1_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone6splus_11_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone6splus_11_4_x86_64_en_us.png new file mode 100644 index 00000000000..d1a6b6323f4 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone6splus_11_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone6splus_12_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone6splus_12_4_x86_64_en_us.png new file mode 100644 index 00000000000..eca4cd24af3 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphone6splus_12_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..529e5b7fdc8 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us_M.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us_M.png new file mode 100644 index 00000000000..529e5b7fdc8 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us_M.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us_XL.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us_XL.png new file mode 100644 index 00000000000..529e5b7fdc8 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us_XL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us_XS.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us_XS.png new file mode 100644 index 00000000000..529e5b7fdc8 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us_XS.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us_XXXL.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us_XXXL.png new file mode 100644 index 00000000000..529e5b7fdc8 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button/iphonese_13_3_x86_64_en_us_XXXL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/ipadair2_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/ipadair2_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..9ad01c280ca Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/ipadair2_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..30097600f9e Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone11_13_3_x86_64_en_us_dark_mode.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone11_13_3_x86_64_en_us_dark_mode.png new file mode 100644 index 00000000000..5b9106b2783 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone11_13_3_x86_64_en_us_dark_mode.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone11promax_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone11promax_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..a90c28608a7 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone11promax_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone5s_10_3_1_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone5s_10_3_1_x86_64_en_us.png new file mode 100644 index 00000000000..dfb4d32ed45 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone5s_10_3_1_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone6splus_11_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone6splus_11_4_x86_64_en_us.png new file mode 100644 index 00000000000..32cba2eaced Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone6splus_11_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone6splus_12_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone6splus_12_4_x86_64_en_us.png new file mode 100644 index 00000000000..eab16975a73 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphone6splus_12_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..a6a1e212ba3 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us_M.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us_M.png new file mode 100644 index 00000000000..a6a1e212ba3 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us_M.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us_XL.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us_XL.png new file mode 100644 index 00000000000..a6a1e212ba3 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us_XL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us_XS.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us_XS.png new file mode 100644 index 00000000000..a6a1e212ba3 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us_XS.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us_XXXL.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us_XXXL.png new file mode 100644 index 00000000000..a6a1e212ba3 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button_Mode_Animation/iphonese_13_3_x86_64_en_us_XXXL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/ipadair2_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/ipadair2_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..1e845cb3194 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/ipadair2_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..9e599364f71 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone11_13_3_x86_64_en_us_dark_mode.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone11_13_3_x86_64_en_us_dark_mode.png new file mode 100644 index 00000000000..1f10b1c3545 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone11_13_3_x86_64_en_us_dark_mode.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone11promax_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone11promax_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..85e66da2e51 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone11promax_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone5s_10_3_1_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone5s_10_3_1_x86_64_en_us.png new file mode 100644 index 00000000000..ec412b36e50 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone5s_10_3_1_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone6splus_11_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone6splus_11_4_x86_64_en_us.png new file mode 100644 index 00000000000..6741181d241 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone6splus_11_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone6splus_12_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone6splus_12_4_x86_64_en_us.png new file mode 100644 index 00000000000..d6e0189d0bf Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphone6splus_12_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..2ebdb1a2779 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us_M.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us_M.png new file mode 100644 index 00000000000..2ebdb1a2779 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us_M.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us_XL.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us_XL.png new file mode 100644 index 00000000000..2ebdb1a2779 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us_XL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us_XS.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us_XS.png new file mode 100644 index 00000000000..2ebdb1a2779 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us_XS.png differ diff --git a/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us_XXXL.png b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us_XXXL.png new file mode 100644 index 00000000000..2ebdb1a2779 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Floating_Action_Button__Swift_/iphonese_13_3_x86_64_en_us_XXXL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Pointer_Interactions/ipadair2_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/ipadair2_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..651add3896a Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/ipadair2_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Pointer_Interactions/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..18a58659fb2 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone11_13_3_x86_64_en_us_dark_mode.png b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone11_13_3_x86_64_en_us_dark_mode.png new file mode 100644 index 00000000000..9117bdf1d3f Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone11_13_3_x86_64_en_us_dark_mode.png differ diff --git a/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone11promax_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone11promax_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..aa0e2ea9710 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone11promax_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone5s_10_3_1_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone5s_10_3_1_x86_64_en_us.png new file mode 100644 index 00000000000..dd55cf864dc Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone5s_10_3_1_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone6splus_11_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone6splus_11_4_x86_64_en_us.png new file mode 100644 index 00000000000..73b7efca0be Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone6splus_11_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone6splus_12_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone6splus_12_4_x86_64_en_us.png new file mode 100644 index 00000000000..147bd4b995b Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphone6splus_12_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..b24fa0eb233 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us_M.png b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us_M.png new file mode 100644 index 00000000000..b24fa0eb233 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us_M.png differ diff --git a/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us_XL.png b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us_XL.png new file mode 100644 index 00000000000..b24fa0eb233 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us_XL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us_XS.png b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us_XS.png new file mode 100644 index 00000000000..b24fa0eb233 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us_XS.png differ diff --git a/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us_XXXL.png b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us_XXXL.png new file mode 100644 index 00000000000..b24fa0eb233 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Pointer_Interactions/iphonese_13_3_x86_64_en_us_XXXL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Shaped_Buttons/ipadair2_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/ipadair2_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..14fc72bd0aa Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/ipadair2_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Shaped_Buttons/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..6c089ff321c Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/ipadpro12.9-3rdgen_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone11_13_3_x86_64_en_us_dark_mode.png b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone11_13_3_x86_64_en_us_dark_mode.png new file mode 100644 index 00000000000..c98e7191d70 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone11_13_3_x86_64_en_us_dark_mode.png differ diff --git a/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone11promax_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone11promax_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..895c9293a6e Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone11promax_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone5s_10_3_1_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone5s_10_3_1_x86_64_en_us.png new file mode 100644 index 00000000000..369e64e2cb1 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone5s_10_3_1_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone6splus_11_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone6splus_11_4_x86_64_en_us.png new file mode 100644 index 00000000000..06c5744e057 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone6splus_11_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone6splus_12_4_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone6splus_12_4_x86_64_en_us.png new file mode 100644 index 00000000000..c63d2389b94 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphone6splus_12_4_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us.png b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us.png new file mode 100644 index 00000000000..cf5cd420880 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us.png differ diff --git a/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us_M.png b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us_M.png new file mode 100644 index 00000000000..cf5cd420880 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us_M.png differ diff --git a/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us_XL.png b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us_XL.png new file mode 100644 index 00000000000..cf5cd420880 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us_XL.png differ diff --git a/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us_XS.png b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us_XS.png new file mode 100644 index 00000000000..cf5cd420880 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us_XS.png differ diff --git a/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us_XXXL.png b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us_XXXL.png new file mode 100644 index 00000000000..cf5cd420880 Binary files /dev/null and b/components/Buttons/examples/scuba_goldens/Shaped_Buttons/iphonese_13_3_x86_64_en_us_XXXL.png differ diff --git a/components/Buttons/src/MDCButton.m b/components/Buttons/src/MDCButton.m index 6e343688e84..d606c846fe0 100644 --- a/components/Buttons/src/MDCButton.m +++ b/components/Buttons/src/MDCButton.m @@ -228,10 +228,10 @@ - (void)commonMDCButtonInit { #ifdef __IPHONE_13_4 if (@available(iOS 13.4, *)) { - __weak typeof(self) weakSelf = self; + __weak __typeof__(self) weakSelf = self; UIButtonPointerStyleProvider buttonPointerStyleProvider = ^UIPointerStyle *( UIButton *buttonToStyle, UIPointerEffect *proposedEffect, UIPointerShape *proposedShape) { - typeof(weakSelf) strongSelf = weakSelf; + __typeof__(weakSelf) strongSelf = weakSelf; if (!strongSelf) { return [UIPointerStyle styleWithEffect:proposedEffect shape:proposedShape]; } diff --git a/components/Cards/BUILD b/components/Cards/BUILD deleted file mode 100644 index d5bf57844fa..00000000000 --- a/components/Cards/BUILD +++ /dev/null @@ -1,144 +0,0 @@ -# Copyright 2018-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", - "mdc_unit_test_swift_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Cards", - sdk_frameworks = [ - "CoreGraphics", - ], - visibility = ["//visibility:public"], - deps = [ - "//components/Elevation", - "//components/Ink", - "//components/Ripple", - "//components/ShadowLayer", - "//components/ShapeLibrary", - "//components/Shapes", - "//components/private/Icons/icons/ic_check_circle", - "//components/private/Math", - ], -) - -mdc_extension_objc_library( - name = "Theming", - deps = [ - ":Cards", - "//components/schemes/Container", - ], -) - -mdc_extension_objc_library( - name = "CardThemer", - deps = [ - ":Cards", - ":ColorThemer", - ":ShapeThemer", - ], -) - -mdc_extension_objc_library( - name = "ColorThemer", - deps = [ - ":Cards", - "//components/schemes/Color", - ], -) - -mdc_extension_objc_library( - name = "ShapeThemer", - deps = [ - ":Cards", - "//components/schemes/Shape", - ], -) - -mdc_unit_test_swift_library( - name = "unit_test_swift_sources", - extra_srcs = glob([ - "tests/unit/Theming/*.swift", - ]), - deps = [ - ":Cards", - ":ColorThemer", - ":ShapeThemer", - ":Theming", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":Cards", - "//components/private/Icons/icons/ic_info", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":Cards", - ":Theming", - "//components/Availability", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [":snapshot_test_lib"], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":Cards", - ":Theming", - "//components/Ink", - "//components/schemes/Container", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":Cards", - ":Theming", - "//components/Buttons:ButtonThemer", - "//components/Buttons:Theming", - "//components/schemes/Container", - ], -) diff --git a/components/Cards/README.md b/components/Cards/README.md index d5fa3b20bd9..6832b433291 100644 --- a/components/Cards/README.md +++ b/components/Cards/README.md @@ -8,52 +8,18 @@ path: /catalog/cards/ api_doc_root: true --> - - # Cards [![Open bugs badge](https://img.shields.io/badge/dynamic/json.svg?label=open%20bugs&url=https%3A%2F%2Fapi.github.com%2Fsearch%2Fissues%3Fq%3Dis%253Aopen%2Blabel%253Atype%253ABug%2Blabel%253A%255BCards%255D&query=%24.total_count)](https://github.com/material-components/material-components-ios/issues?q=is%3Aopen+is%3Aissue+label%3Atype%3ABug+label%3A%5BCards%5D) -Cards contain content and actions about a single subject. They can be used standalone, or as part -of a list. Cards are meant to be interactive, and aren't meant to be be used solely for style -purposes. - -
- Cards -
- -## Design & API documentation - - - -## Table of contents - -- [Overview](#overview) - - [Cards Classes](#cards-classes) -- [Installation](#installation) - - [Installation with CocoaPods](#installation-with-cocoapods) - - [Importing](#importing) -- [Usage](#usage) - - [Typical use: as a view](#typical-use-as-a-view) - - [Typical use: in a collection view](#typical-use-in-a-collection-view) -- [Extensions](#extensions) - - [Theming](#theming) -- [Accessibility](#accessibility) - - [Card Accessibility](#card-accessibility) +[Cards](https://material.io/components/cards/) contain content and actions about +a single subject. -- - - +![Basic card](docs/assets/card-hero.png) -## Overview +## Using cards -Cards provides two different versions, `MDCCard` inheriting from `UIControl` and `MDCCardCollectionCell` inheriting from `UICollectionViewCell`. +Cards are implemented by `MDCCard`, which inherits from `UIControl`, and `MDCCardCollectionCell`, which inherits from `UICollectionViewCell`. A card's state determines its visual styling. @@ -92,28 +58,22 @@ An `MDCCardCollectionCell` can be added, used, and reused as a `UICollectionView `MDCCardCollectionCell` uses the `selected` property that is built-in in `UICollectionViewCell` and has its own `MDCCardCellState` to keep track of the current state it is in. -## Installation +### Install `MDCCard` or `MDCCardCollectionCell` - - -### Installation with CocoaPods - -Add the following to your `Podfile`: +In order to use `MDCCard` or `MDCCardCollectionCell`, first add Cards to your `Podfile`: ```bash -pod 'MaterialComponents/Cards' +pod MaterialComponents/Cards ``` -Then, run the following command: +Then, run the installer. ```bash pod install ``` -### Importing - -To import the component: +After that, import the Cards target. #### Swift @@ -122,48 +82,154 @@ import MaterialComponents.MaterialCards ``` #### Objective-C - ```objc #import "MaterialCards.h" ``` +From there, either initialize an `MDCCard` like you would any UIView or use `MDCCardCollectionCell` as a superclass for a custom `UICollectionViewCell`. -## Usage +### Making cards accessible - +To help ensure your cards are accessible to as many users as possible, please be sure to review the following +recommendations: -### Typical use: as a view +#### Accessibility for Cards in a Collection -`MDCCard` can be used like a regular UIView. +Since assistive technologies visit all cards in a collection in a sequential order, it is often +easier to distinguish between elements that belong to different cards by aggregating all the +card's information so the card is read as a single sentence. +This can be done by setting an appropriate +[`accessibilityLabel`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement/1619577-accessibilitylabel) +for the card. Additionally, set the card's +[`isAccessibilityElement`](https://developer.apple.com/documentation/objectivec/nsobject/1615141-isaccessibilityelement) +to true. Cards are a container element and setting isAccessibiltyElement for a container +turns off individually selecting its subelements. #### Swift - ```swift -let card = MDCCard() +card.isAccessibilityElement = true +card.accessibilityLabel = "Location \(userLocation.name) is popular with users " + + "who enjoy \(userLocation.popularActivityMatchingUserProfile(userProfile))" +``` -// Create, position, and add content views: -let imageView = UIImageView() -card.addSubview(imageView) +#### Objective-C +```objc +card.isAccessibilityElement = YES; +card.accessibilityLabel = [NSString + stringWithFormat:@"Location %@ is popular with users who enjoy %@", + userLocation.name, + userLocation.popularActivityMatchingUserProfile(userProfile)]; +``` + + +#### Accessibility for Single Cards + +Nested elements in MDCCards are available to assistive technologies without additional +customization, however additional setup may be needed to accommodate special scenarios, +such as: + +#### Accessibility for Single Cards: Images +Images that have additional context beyond text that is already presented on the card. +For example, news article images can benefit from an +[`accessibilityLabel`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement/1619577-accessibilitylabel) +describing their content. + + +#### Swift +```swift +articleImageView.isAccessibilityElement = true +articleImageView.accessibilityLabel = "Event or scene description" ``` #### Objective-C +```objc +articleImageView.isAccessibilityElement = YES; +articleImageView.accessibilityLabel = @"Event or scene description"; +``` + + +#### Accessibility for Single Cards: Star Rating +Star or rating images should have an +[`accessibilityLabel`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement/1619577-accessibilitylabel) +describing its purpuse and an +[`accessibilityValue`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement/1619583-accessibilityvalue) +describing the rating value. + + +#### Swift +```swift +ratingView.isAccessibilityElement = true +ratingView.accessibilityLabel = "Average customer rating, out of " + + "\(MDCProductRating.maximumValue) stars" +ratingView.accessibilityValue = (String)product.averageRating +``` +#### Objective-C ```objc -MDCCard *card = [[MDCCard alloc] init]; +ratingView.isAccessibilityElement = YES; +ratingView.accessibilityLabel = [NSString stringWithFormat:@"Average customer" + + " rating, out of %d stars", MDCProductRating.maximumValue]; +ratingView.accessibilityValue = @(product.averageRating).stringValue; +``` + -// Create, position, and add content views: -UIImageView *imageView = [[UIImageView alloc] init]; -[card addSubview:imageView]; +#### Accessibility for Single Cards: Reordering elements +Primary content or actions that appear lower on the screen will be read last by assistive +technologies, sometimes after longer or non-primary content. To change the order, or group +elements together, you can make the card an accessibility container by adopting the +[`UIAccessibilityContainer`](https://developer.apple.com/documentation/uikit/accessibility/uiaccessibilitycontainer) +protocol. Grouping and order is controlled by creating as many +[`UIAccessibilityElement`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement) +elements as needed, and returning them in the desired order. + +## Card + +![Card with sample image and buttons](docs/assets/custom-card.png) + +Cards can be used to build custom UIs, like the one shown above, from [CardWithImageViewAndButtonsExample](examples/CardWithImageViewAndButtonsExample.swift). + +MDCCard and MDCCardCollectionCell inherit from UIControl and UICollectionViewCell, respectively. + +* MDCCard + * [API documentation](https://material.io/develop/ios/components/cards/api-docs/Classes/MDCCard.html) + * [GitHub source](https://github.com/material-components/material-components-ios/blob/develop/components/Cards/src/MDCCard.h) + +* MDCCardCollectionCell + * [API documentation](https://material.io/develop/ios/components/cards/api-docs/Classes/MDCCardCollectionCell.html) + * [GitHub source](https://github.com/material-components/material-components-ios/blob/develop/components/Cards/src/MDCCardCollectionCell.h) + +### Card examples using MDCCard + +`MDCCard` can be used like a regular `UIView`. This is an example of a regular card: + +![single basic card](docs/assets/single-basic-card.png) + + +#### Swift + +```swift +let card = MDCCard(frame: CGRect(x: 30, y: 100, width: 150, height: 150)) +card.applyTheme(withScheme: containerScheme) +view.addSubview(card) ``` + +#### Objective-C + +```objc +MDCCard *card = [[MDCCard alloc] initWithFrame:CGRectMake(30, 100, 150, 150)]; +[card applyThemeWithScheme:containerScheme]; +[view addSubview:card]; +``` + - +### Card examples using MDCCardCollectionCell -### Typical use: in a collection view +`MDCCardCollectionCell` can be used like a regular `UICollectionViewCell`. This is an example of `MDCCardCollectionCell`s in a collection: -Use `MDCCardCollectionCell` as a base class for your custom collection view cell +![card collection cells](docs/assets/card-collection-cells.png) #### Swift @@ -178,11 +244,7 @@ func collectionView(_ collectionView: UICollectionView, // If you wanted to have the card show the selected state when tapped // then you need to turn isSelectable to true, otherwise the default is false. cell.isSelectable = true - - cell.selectedImageTintColor = .blue cell.cornerRadius = 8 - cell.setShadowElevation(6, for: .selected) - cell.setShadowColor(UIColor.black, for: .highlighted) return cell } ``` @@ -201,148 +263,109 @@ func collectionView(_ collectionView: UICollectionView, // If you wanted to have the card show the selected state when tapped // then you need to turn selectable to true, otherwise the default is false. [cell setSelectable:YES]; - - [cell setSelectedImageTintColor:[UIColor blueColor]]; [cell setCornerRadius:8]; - [cell setShadowElevation:6 forState:MDCCardCellStateSelected]; - [cell setShadowColor:[UIColor blackColor] forState:MDCCardCellStateHighlighted]; + return cell; } ``` +### Anatomy and key properties -## Extensions +A card has a container and an optional thumbnail, header text, secondary text, +media, supporting text, buttons and icons. - +![card anatomy diagram](docs/assets/card-anatomy.png) -### Theming +1. Container +2. Thumbnail +3. Header text +4. Secondary text +5. Media +6. Supporting text +7. Buttons +8. Icons +9. Checked icon (not shown) - `MDCCard` supports Material Theming using a Container Scheme. -There are two variants for Material Theming of a MDCCard and MDCCardCollectionCell, which are the default theme -and the outlined theme. +_**Note:** All the optional elements of a card's content are implemented through the use of other views/components._ - +#### Container attributes for MDCCard -#### Swift +  | Attribute | Related method(s) | Default value +-------------------- | ------------------------- | ------------------------------------------------------------------- | ------------- +**Color** | `backgroundColor` | `-setBackgroundColor:`
`backgroundColor:` | Surface color +**Foreground color** | N/A | N/A | N/A +**Stroke color** | `layer.borderColor` | `-setBorderColor:forState:`
`-borderColorForState:` | On surface color at 37% opacity +**Stroke width** | `layer.borderWidth` | `-setBorderWidth:forState:`
`-borderWidthForState:` | 1 +**Shape** | `shapeGenerator` | `-setShapeGenerator:`
`-shapeGenerator` | `MDCRectangleShapeGenerator` +**Elevation** | N/A | `-setShadowElevation:forState:`
`-shadowElevationForState:` | 1 +**Ripple color** | `rippleView.rippleColor` | N/A | `nil` -```swift -// Import the Cards Theming Extensions module -import MaterialComponents.MaterialCards_MaterialTheming - ... - // Create or use your app's Container Scheme -let containerScheme = MDCContainerScheme() - // Theme the card with either default theme -card.applyTheme(withScheme: containerScheme) - // Or outlined theme -card.applyOutlinedTheme(withScheme: containerScheme) -``` - -#### Objective-C - -```objc -// Import the Cards Theming Extensions header -#import - ... - // Create or use your app's Container Scheme -MDCContainerScheme *containerScheme = [[MDCContainerScheme alloc] init]; - // Theme the card with either default theme -[self.card applyThemeWithScheme:containerScheme]; - // Or outlined theme -[self.card applyOutlinedThemeWithScheme:containerScheme]; -``` - - +#### Container attributes for MDCCardCollectionCell +  | Attribute | Related method(s) | Default value +-------------------- | ------------------------- | ------------------------------------------------------------------- | ------------- +**Color** | `backgroundColor` | `-setBackgroundColor:`
`backgroundColor:` | Surface color +**Foreground color** | N/A | N/A | N/A +**Stroke color** | `layer.borderColor` | `-setBorderColor:forState:`
`-borderColorForState:` | On surface color at 37% opacity +**Stroke width** | `layer.borderWidth` | `-setBorderWidth:forState:`
`-borderWidthForState:` | 1 +**Shape** | `shapeGenerator` | `-setShapeGenerator:`
`-shapeGenerator` | `MDCRectangleShapeGenerator` +**Elevation** | N/A | `-setShadowElevation:forState:`
`-shadowElevationForState:` | 1 +**Ripple color** | `rippleView.rippleColor` | N/A | `nil` -## Accessibility +### Theming cards - +Cards supports Material Theming using a Container Scheme. MDCCard and MDCCardCollectionCell have both default and outlined theming methods. [Learn more about theming extensions](../../docs/theming.md). Below is a screenshot of an MDCCard with the Material Design Shrine theme: -### Card Accessibility +![Shrine card](docs/assets/shrine-card.png) -To help ensure your cards are accessible to as many users as possible, please be sure to review the following -recommendations: +### Cards theming example -#### Accessibility for Cards in a Collection +To make use of Cards theming install the Cards theming extensions with Cocoapods. First, add the following line to your `Podfile`. -Since assistive technologies visit all cards in a collection in a sequential order, it is often -easier to distinguish between elements that belong to different cards by aggregating all the -card's information so the card is read as a single sentence. -This can be done by setting an appropriate -[`accessibilityLabel`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement/1619577-accessibilitylabel) -for the card. Additionally, set the card's -[`isAccessibilityElement`](https://developer.apple.com/documentation/objectivec/nsobject/1615141-isaccessibilityelement) -to true. Cards are a container element and setting isAccessibiltyElement for a container -turns off individually selecting its subelements. - -##### Swift -```swift - card.isAccessibilityElement = true - card.accessibilityLabel = "Location \(userLocation.name) is popular with users " + - "who enjoy \(userLocation.popularActivityMatchingUserProfile(userProfile))" -``` - -##### Objective-C -```objc - card.isAccessibilityElement = YES; - card.accessibilityLabel = [NSString - stringWithFormat:@"Location %@ is popular with users who enjoy %@", - userLocation.name, - userLocation.popularActivityMatchingUserProfile(userProfile)]; +```bash +pod MaterialComponents/Cards+Theming ``` -#### Accessibility for Single Cards - -Nested elements in MDCCards are available to assistive technologies without additional -customization, however additional setup may be needed to accommodate special scenarios, -such as: - -#### Accessibility for Single Cards: Images -Images that have additional context beyond text that is already presented on the card. -For example, news article images can benefit from an -[`accessibilityLabel`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement/1619577-accessibilitylabel) -describing their content. + -##### Swift -```swift - articleImageView.isAccessibilityElement = true - articleImageView.accessibilityLabel = "Event or scene description" -``` +Then Run the installer. -##### Objective-C -```objc - articleImageView.isAccessibilityElement = YES; - articleImageView.accessibilityLabel = @"Event or scene description"; +```bash +pod install ``` -#### Accessibility for Single Cards: Star Rating -Star or rating images should have an -[`accessibilityLabel`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement/1619577-accessibilitylabel) -describing its purpuse and an -[`accessibilityValue`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement/1619583-accessibilityvalue) -describing the rating value. +Next, import the Cards theming target, and call the correct theming method. -##### Swift + +#### Swift ```swift - ratingView.isAccessibilityElement = true - ratingView.accessibilityLabel = "Average customer rating, out of " + - "\(MDCProductRating.maximumValue) stars" - ratingView.accessibilityValue = (String)product.averageRating +import MaterialComponents.MaterialCards +import MaterialComponents.MaterialCards_Theming + +... + // Create a card +let card = MDCCard() + // Create or use your app's Container Scheme +let containerScheme = MDCContainerScheme() + // Theme the card with either default theme +card.applyTheme(withScheme: containerScheme) + // Or outlined theme +card.applyOutlinedTheme(withScheme: containerScheme) ``` -##### Objective-C +#### Objective-C ```objc - ratingView.isAccessibilityElement = YES; - ratingView.accessibilityLabel = [NSString stringWithFormat:@"Average customer" + - " rating, out of %d stars", MDCProductRating.maximumValue]; - ratingView.accessibilityValue = @(product.averageRating).stringValue; -``` +#import "MaterialCards.h" +#import "MaterialCards+Theming.h" -#### Accessibility for Single Cards: Reordering elements -Primary content or actions that appear lower on the screen will be read last by assistive -technologies, sometimes after longer or non-primary content. To change the order, or group -elements together, you can make the card an accessibility container by adopting the -[`UIAccessibilityContainer`](https://developer.apple.com/documentation/uikit/accessibility/uiaccessibilitycontainer) -protocol. Grouping and order is controlled by creating as many -[`UIAccessibilityElement`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement) -elements as needed, and returning them in the desired order. +... + // Create a card +MDCCard *card = [[MDCCard alloc] init]; + // Create or use your app's Container Scheme +MDCContainerScheme *containerScheme = [[MDCContainerScheme alloc] init]; + // Theme the card with either default theme +[self.card applyThemeWithScheme:containerScheme]; + // Or outlined theme +[self.card applyOutlinedThemeWithScheme:containerScheme]; +``` + diff --git a/components/Cards/docs/accessibility.md b/components/Cards/docs/accessibility.md deleted file mode 100644 index 6f96acc0486..00000000000 --- a/components/Cards/docs/accessibility.md +++ /dev/null @@ -1,88 +0,0 @@ -### Card Accessibility - -To help ensure your cards are accessible to as many users as possible, please be sure to review the following -recommendations: - -#### Accessibility for Cards in a Collection - -Since assistive technologies visit all cards in a collection in a sequential order, it is often -easier to distinguish between elements that belong to different cards by aggregating all the -card's information so the card is read as a single sentence. -This can be done by setting an appropriate -[`accessibilityLabel`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement/1619577-accessibilitylabel) -for the card. Additionally, set the card's -[`isAccessibilityElement`](https://developer.apple.com/documentation/objectivec/nsobject/1615141-isaccessibilityelement) -to true. Cards are a container element and setting isAccessibiltyElement for a container -turns off individually selecting its subelements. - -#### Swift -```swift - card.isAccessibilityElement = true - card.accessibilityLabel = "Location \(userLocation.name) is popular with users " + - "who enjoy \(userLocation.popularActivityMatchingUserProfile(userProfile))" -``` - -#### Objective-C -```objc - card.isAccessibilityElement = YES; - card.accessibilityLabel = [NSString - stringWithFormat:@"Location %@ is popular with users who enjoy %@", - userLocation.name, - userLocation.popularActivityMatchingUserProfile(userProfile)]; -``` - -#### Accessibility for Single Cards - -Nested elements in MDCCards are available to assistive technologies without additional -customization, however additional setup may be needed to accommodate special scenarios, -such as: - -#### Accessibility for Single Cards: Images -Images that have additional context beyond text that is already presented on the card. -For example, news article images can benefit from an -[`accessibilityLabel`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement/1619577-accessibilitylabel) -describing their content. - -Swift -```swift - articleImageView.isAccessibilityElement = true - articleImageView.accessibilityLabel = "Event or scene description" -``` - -Objective-C -```objc - articleImageView.isAccessibilityElement = YES; - articleImageView.accessibilityLabel = @"Event or scene description"; -``` - -#### Accessibility for Single Cards: Star Rating -Star or rating images should have an -[`accessibilityLabel`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement/1619577-accessibilitylabel) -describing its purpuse and an -[`accessibilityValue`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement/1619583-accessibilityvalue) -describing the rating value. - -Swift -```swift - ratingView.isAccessibilityElement = true - ratingView.accessibilityLabel = "Average customer rating, out of " + - "\(MDCProductRating.maximumValue) stars" - ratingView.accessibilityValue = (String)product.averageRating -``` - -Objective-C -```objc - ratingView.isAccessibilityElement = YES; - ratingView.accessibilityLabel = [NSString stringWithFormat:@"Average customer" + - " rating, out of %d stars", MDCProductRating.maximumValue]; - ratingView.accessibilityValue = @(product.averageRating).stringValue; -``` - -#### Accessibility for Single Cards: Reordering elements -Primary content or actions that appear lower on the screen will be read last by assistive -technologies, sometimes after longer or non-primary content. To change the order, or group -elements together, you can make the card an accessibility container by adopting the -[`UIAccessibilityContainer`](https://developer.apple.com/documentation/uikit/accessibility/uiaccessibilitycontainer) -protocol. Grouping and order is controlled by creating as many -[`UIAccessibilityElement`](https://developer.apple.com/documentation/uikit/uiaccessibilityelement) -elements as needed, and returning them in the desired order. diff --git a/components/Cards/docs/assets/card-anatomy.png b/components/Cards/docs/assets/card-anatomy.png new file mode 100644 index 00000000000..4c7b0d3d6cc Binary files /dev/null and b/components/Cards/docs/assets/card-anatomy.png differ diff --git a/components/Cards/docs/assets/card-collection-cells.png b/components/Cards/docs/assets/card-collection-cells.png new file mode 100644 index 00000000000..f4544716323 Binary files /dev/null and b/components/Cards/docs/assets/card-collection-cells.png differ diff --git a/components/Cards/docs/assets/card-hero.png b/components/Cards/docs/assets/card-hero.png new file mode 100644 index 00000000000..f63c0f29399 Binary files /dev/null and b/components/Cards/docs/assets/card-hero.png differ diff --git a/components/Cards/docs/assets/cards.png b/components/Cards/docs/assets/cards.png deleted file mode 100644 index 2e97c2063d5..00000000000 Binary files a/components/Cards/docs/assets/cards.png and /dev/null differ diff --git a/components/Cards/docs/assets/custom-card.png b/components/Cards/docs/assets/custom-card.png new file mode 100644 index 00000000000..6b61c437c76 Binary files /dev/null and b/components/Cards/docs/assets/custom-card.png differ diff --git a/components/Cards/docs/assets/shrine-card.png b/components/Cards/docs/assets/shrine-card.png new file mode 100644 index 00000000000..14cf50a5994 Binary files /dev/null and b/components/Cards/docs/assets/shrine-card.png differ diff --git a/components/Cards/docs/assets/single-basic-card.png b/components/Cards/docs/assets/single-basic-card.png new file mode 100644 index 00000000000..db89462bdd5 Binary files /dev/null and b/components/Cards/docs/assets/single-basic-card.png differ diff --git a/components/Cards/docs/theming.md b/components/Cards/docs/theming.md deleted file mode 100644 index aad53bfc1cb..00000000000 --- a/components/Cards/docs/theming.md +++ /dev/null @@ -1,37 +0,0 @@ -### Theming - - `MDCCard` supports Material Theming using a Container Scheme. -There are two variants for Material Theming of a MDCCard and MDCCardCollectionCell, which are the default theme -and the outlined theme. - - - - #### Swift - -```swift -// Import the Cards Theming Extensions module -import MaterialComponents.MaterialCards_MaterialTheming - ... - // Create or use your app's Container Scheme -let containerScheme = MDCContainerScheme() - // Theme the card with either default theme -card.applyTheme(withScheme: containerScheme) - // Or outlined theme -card.applyOutlinedTheme(withScheme: containerScheme) -``` - - #### Objective-C - -```objc -// Import the Cards Theming Extensions header -#import - ... - // Create or use your app's Container Scheme -MDCContainerScheme *containerScheme = [[MDCContainerScheme alloc] init]; - // Theme the card with either default theme -[self.card applyThemeWithScheme:containerScheme]; - // Or outlined theme -[self.card applyOutlinedThemeWithScheme:containerScheme]; -``` - - diff --git a/components/Cards/docs/typical-use-collections.md b/components/Cards/docs/typical-use-collections.md deleted file mode 100644 index 9064ef06c56..00000000000 --- a/components/Cards/docs/typical-use-collections.md +++ /dev/null @@ -1,48 +0,0 @@ -### Typical use: in a collection view - -Use `MDCCardCollectionCell` as a base class for your custom collection view cell - - -#### Swift - -```swift -collectionView.register(MDCCardCollectionCell.self, forCellWithReuseIdentifier: "Cell") - -func collectionView(_ collectionView: UICollectionView, - cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", - for: indexPath) as! MDCCardCollectionCell - // If you wanted to have the card show the selected state when tapped - // then you need to turn isSelectable to true, otherwise the default is false. - cell.isSelectable = true - - cell.selectedImageTintColor = .blue - cell.cornerRadius = 8 - cell.setShadowElevation(6, for: .selected) - cell.setShadowColor(UIColor.black, for: .highlighted) - return cell -} -``` - -#### Objective-C - -```objc -[self.collectionView registerClass:[MDCCardCollectionCell class] - forCellWithReuseIdentifier:@"Cell"]; - -- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView - cellForItemAtIndexPath:(NSIndexPath *)indexPath { - MDCCardCollectionCell *cell = - [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" - forIndexPath:indexPath]; - // If you wanted to have the card show the selected state when tapped - // then you need to turn selectable to true, otherwise the default is false. - [cell setSelectable:YES]; - - [cell setSelectedImageTintColor:[UIColor blueColor]]; - [cell setCornerRadius:8]; - [cell setShadowElevation:6 forState:MDCCardCellStateSelected]; - [cell setShadowColor:[UIColor blackColor] forState:MDCCardCellStateHighlighted]; -} -``` - diff --git a/components/Cards/docs/typical-use-view.md b/components/Cards/docs/typical-use-view.md deleted file mode 100644 index 7afa8768b48..00000000000 --- a/components/Cards/docs/typical-use-view.md +++ /dev/null @@ -1,25 +0,0 @@ -### Typical use: as a view - -`MDCCard` can be used like a regular UIView. - - -#### Swift - -```swift -let card = MDCCard() - -// Create, position, and add content views: -let imageView = UIImageView() -card.addSubview(imageView) -``` - -#### Objective-C - -```objc -MDCCard *card = [[MDCCard alloc] init]; - -// Create, position, and add content views: -UIImageView *imageView = [[UIImageView alloc] init]; -[card addSubview:imageView]; -``` - diff --git a/components/Cards/examples/CardWithImageViewAndButtonsExample.swift b/components/Cards/examples/CardWithImageViewAndButtonsExample.swift new file mode 100644 index 00000000000..2be7e3ccb02 --- /dev/null +++ b/components/Cards/examples/CardWithImageViewAndButtonsExample.swift @@ -0,0 +1,108 @@ +// 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 UIKit +import MaterialComponents.MaterialButtons_ButtonThemer +import MaterialComponents.MaterialContainerScheme +import MaterialComponents.MaterialCards_Theming +import MaterialComponents.MaterialButtons_Theming + +class CustomCard: MDCCard { + + static let cardWidth: CGFloat = 300; + let imageView: UIImageView = UIImageView() + let cardButton1: MDCButton = MDCButton() + let cardButton2: MDCButton = MDCButton() + + override func layoutSubviews() { + super.layoutSubviews() + if imageView.superview == nil { addSubview(imageView) } + if cardButton1.superview == nil { addSubview(cardButton1) } + if cardButton2.superview == nil { addSubview(cardButton2) } + cardButton1.sizeToFit() + cardButton2.sizeToFit() + imageView.frame = CGRect(x: 0, + y: 0, + width: CustomCard.cardWidth, + height: 200) + cardButton1.frame = CGRect(x: 8, + y: imageView.frame.maxY + 8, + width: cardButton1.frame.width, + height: cardButton1.frame.height) + cardButton2.frame = CGRect(x: 8, + y: cardButton1.frame.maxY + 8, + width: cardButton2.frame.width, + height: cardButton2.frame.height) + } + + override var intrinsicContentSize: CGSize { + return CGSize(width: CustomCard.cardWidth, height: cardButton2.frame.maxY + 8) + } +} + +class CardWithImageViewAndButtonsExample: UIViewController { + let card: CustomCard = CustomCard() + + @objc var containerScheme: MDCContainerScheming + + override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { + containerScheme = MDCContainerScheme() + super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = containerScheme.colorScheme.backgroundColor + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + setUpCard() + } + + func setUpCard() { + let bundle = Bundle(for: CardWithImageViewAndButtonsExample.self) + card.imageView.image = UIImage(named: "sample-image", in: bundle, compatibleWith: nil) + card.cardButton1.setTitle("Action 1", for: .normal) + card.cardButton2.setTitle("Action 2", for: .normal) + card.cardButton1.applyTextTheme(withScheme: containerScheme) + card.cardButton2.applyTextTheme(withScheme: containerScheme) + card.cornerRadius = 8 + card.applyTheme(withScheme: containerScheme) + card.setNeedsLayout() + card.layoutIfNeeded() + card.frame = CGRect(x: card.frame.minX, + y: card.frame.minY, + width: card.intrinsicContentSize.width, + height: card.intrinsicContentSize.height) + if card.superview == nil { view.addSubview(card) } + card.center = view.center + } +} + +extension CardWithImageViewAndButtonsExample { + + @objc class func catalogMetadata() -> [String: Any] { + return [ + "breadcrumbs": ["Cards", "Card README example"], + "description": "Cards contain content and actions about a single subject.", + "primaryDemo": true, + "presentable": true, + ] + } +} diff --git a/components/Chips/BUILD b/components/Chips/BUILD deleted file mode 100644 index 7252d0971e3..00000000000 --- a/components/Chips/BUILD +++ /dev/null @@ -1,144 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", - "mdc_unit_test_swift_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Chips", - sdk_frameworks = [ - "CoreGraphics", - "UIKit", - ], - deps = [ - "//components/Elevation", - "//components/Ink", - "//components/Ripple", - "//components/ShadowElevations", - "//components/ShadowLayer", - "//components/ShapeLibrary", - "//components/Shapes", - "//components/TextFields", - "//components/Typography", - "//components/private/Math", - "@material_internationalization_ios//:MDFInternationalization", - ], -) - -mdc_extension_objc_library( - name = "Theming", - deps = [ - ":Chips", - "//components/Typography", - "//components/schemes/Container", - ], -) - -mdc_objc_library( - name = "privateHeaders", - testonly = 1, - hdrs = glob(["src/*.h"]), - visibility = ["//visibility:private"], - deps = [":Chips"], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":Chips", - ":Theming", - "//components/ShapeLibrary", - "//components/Shapes", - "//components/Slider", - "//components/Slider:ColorThemer", - "//components/TextFields", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Shape", - "//components/schemes/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":Chips", - ":Theming", - "//components/TextFields", - "//components/schemes/Container", - ], -) - -mdc_unit_test_swift_library( - name = "unit_test_swift_sources", - extra_srcs = glob([ - "tests/unit/Theming/*.swift", - ]), - deps = [ - ":Chips", - ":Theming", - "//components/schemes/Color", - "//components/schemes/Shape", - "//components/schemes/Typography", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":Chips", - ":privateHeaders", - "//components/ShapeLibrary", - "//components/TextFields:private", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - asset_catalogs = [ - "tests/snapshot/resources/ChipsSnapshotTests.xcassets/ic_cancel.imageset", - "tests/snapshot/resources/ChipsSnapshotTests.xcassets/ic_mask.imageset", - ], - deps = [ - ":Chips", - ":Theming", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [":snapshot_test_lib"], -) diff --git a/components/Chips/src/MDCChipField.m b/components/Chips/src/MDCChipField.m index b47c711dffd..6867c043d20 100644 --- a/components/Chips/src/MDCChipField.m +++ b/components/Chips/src/MDCChipField.m @@ -63,10 +63,10 @@ - (CGRect)textRectForBounds:(CGRect)bounds { #pragma mark UIKeyInput - (void)deleteBackward { - [super deleteBackward]; if (self.text.length == 0) { [self.deletionDelegate textFieldShouldRespondToDeleteBackward:self]; } + [super deleteBackward]; } #if MDC_CHIPFIELD_PRIVATE_API_BUG_FIX && \ @@ -202,6 +202,7 @@ - (void)layoutSubviews { self.textField.frame = textFieldFrame; [self updateTextFieldPlaceholderText]; + [self invalidateIntrinsicContentSize]; } - (void)updateTextFieldPlaceholderText { @@ -256,7 +257,6 @@ - (void)setChips:(NSArray *)chips { [self addChipSubview:chip]; } [self notifyDelegateIfSizeNeedsToBeUpdated]; - [self invalidateIntrinsicContentSize]; [self setNeedsLayout]; } @@ -286,7 +286,6 @@ - (void)addChip:(MDCChipView *)chip { [self.textField setNeedsLayout]; [self notifyDelegateIfSizeNeedsToBeUpdated]; - [self invalidateIntrinsicContentSize]; [self setNeedsLayout]; } @@ -298,7 +297,6 @@ - (void)removeChip:(MDCChipView *)chip { } [self notifyDelegateIfSizeNeedsToBeUpdated]; [self.textField setNeedsLayout]; - [self invalidateIntrinsicContentSize]; [self setNeedsLayout]; } @@ -343,7 +341,6 @@ - (void)setContentEdgeInsets:(UIEdgeInsets)contentEdgeInsets { if (!UIEdgeInsetsEqualToEdgeInsets(_contentEdgeInsets, contentEdgeInsets)) { _contentEdgeInsets = contentEdgeInsets; [self setNeedsLayout]; - [self invalidateIntrinsicContentSize]; } } @@ -351,7 +348,6 @@ - (void)setMinTextFieldWidth:(CGFloat)minTextFieldWidth { if (_minTextFieldWidth != minTextFieldWidth) { _minTextFieldWidth = minTextFieldWidth; [self setNeedsLayout]; - [self invalidateIntrinsicContentSize]; } } @@ -625,12 +621,10 @@ - (void)textFieldDidChange { if (isTextTooWide && isTextFieldOnSameLineAsChips) { // The text is on the same line as the chips and doesn't fit // Trigger layout to move the text field down to the next line - [self invalidateIntrinsicContentSize]; [self setNeedsLayout]; } else if (!isTextTooWide && !isTextFieldOnSameLineAsChips) { // The text is on the line below the chips but can fit on the same line // Trigger layout to move the text field up to the previous line - [self invalidateIntrinsicContentSize]; [self setNeedsLayout]; } } diff --git a/components/Chips/tests/unit/MDCChipFieldDelegateTests.m b/components/Chips/tests/unit/MDCChipFieldDelegateTests.m new file mode 100644 index 00000000000..dac4276ad57 --- /dev/null +++ b/components/Chips/tests/unit/MDCChipFieldDelegateTests.m @@ -0,0 +1,117 @@ +// 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 + +#import "MDCChipField.h" +#import "MDCChipFieldDelegate.h" + +/** + A class to record messages from MDCChipField. + */ +@interface MDCChipFieldDelegateFake : NSObject +/** The chip field (if any) passed as an argument to chipFieldHeightDidChange: */ +@property(nonatomic) MDCChipField *heightChangedChipField; +@end + +@implementation MDCChipFieldDelegateFake + +- (void)chipFieldHeightDidChange:(MDCChipField *)chipField { + self.heightChangedChipField = chipField; +} + +@end + +/** + Tests to ensure communication between @c MDCChipField and its delegate happens as expected. + */ +@interface MDCChipFieldDelegateTests : XCTestCase +/** The MDCChipField being tested. */ +@property(nonatomic) MDCChipField *chipField; +/** The MDCChipField delegate used to record calls from chipField. */ +@property(nonatomic) MDCChipFieldDelegateFake *delegate; +@end + +@implementation MDCChipFieldDelegateTests + +- (void)setUp { + [super setUp]; + + self.chipField = [[MDCChipField alloc] init]; + self.chipField.textField.placeholder = @"Placeholder"; + [self.chipField sizeToFit]; + self.delegate = [[MDCChipFieldDelegateFake alloc] init]; + self.chipField.delegate = self.delegate; +} + +/** + Ensures the @c MDCChipField's delegate is notified of a height change triggered by text input. + */ +- (void)testHeightChangedCalledOnTextAddition { + // Given + [self.chipField addChip:[self chipViewWithTitle:@"Chip"]]; + // Adding a chip calls chipFieldHeightDidChange, so we need to reset heightChangedChipField to nil + self.delegate.heightChangedChipField = nil; + [self.chipField layoutIfNeeded]; + + // When + self.chipField.textField.text = @"This is a very very long chip field string"; + + // Then + // TODO(b/154325932): this exposes b/154325932, update this once the bug is resolved. + XCTAssertNil(self.delegate.heightChangedChipField); +} + +/** + Ensures the @c MDCChipField's delegate is notified of a height change triggered by chip addition. + */ +- (void)testHeightChangedCalledOnChipAddition { + // When + [self.chipField addChip:[self chipViewWithTitle:@"Chip"]]; + + // Then + XCTAssertNotNil(self.delegate.heightChangedChipField); + XCTAssertEqualObjects(self.delegate.heightChangedChipField, self.chipField); +} + +/** + Ensures the @c MDCChipField's delegate is notified of a height change triggered by chip removal. + */ +- (void)testHeightChangedCalledOnChipRemoval { + // Given + // Because the chip field does not change height when its only chip is removed, we need to test + // the removal of a second chip. + [self.chipField addChip:[self chipViewWithTitle:@"title 1"]]; + [self.chipField addChip:[self chipViewWithTitle:@"title 2"]]; + // Adding a chip calls chipFieldHeightDidChange, so we need to reset heightChangedChipField to nil + self.delegate.heightChangedChipField = nil; + + // When + [self.chipField removeChip:self.chipField.chips.firstObject]; + + // Then + XCTAssertNotNil(self.delegate.heightChangedChipField); + XCTAssertEqualObjects(self.delegate.heightChangedChipField, self.chipField); +} + +#pragma mark - Helpers + +- (MDCChipView *)chipViewWithTitle:(NSString *)title { + MDCChipView *chipView = [[MDCChipView alloc] init]; + chipView.titleLabel.text = title; + [chipView sizeToFit]; + return chipView; +} + +@end diff --git a/components/CollectionCells/BUILD b/components/CollectionCells/BUILD deleted file mode 100644 index f2b1cc68ac9..00000000000 --- a/components/CollectionCells/BUILD +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "CollectionCells", - bundles = [":Bundle"], - deps = [ - "//components/CollectionLayoutAttributes", - "//components/Ink", - "//components/Palettes", - "//components/Typography", - "//components/private/Icons", - "//components/private/Icons/icons/ic_check", - "//components/private/Icons/icons/ic_check_circle", - "//components/private/Icons/icons/ic_chevron_right", - "//components/private/Icons/icons/ic_info", - "//components/private/Icons/icons/ic_radio_button_unchecked", - "//components/private/Icons/icons/ic_reorder", - "//components/private/Math", - "@material_internationalization_ios//:MDFInternationalization", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":CollectionCells", - "//components/Collections", - "//components/Typography", - ], -) - -filegroup( - name = "BundleFiles", - srcs = glob([ - "src/MaterialCollectionCells.bundle/**", - ]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":CollectionCells", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/CollectionLayoutAttributes/BUILD b/components/CollectionLayoutAttributes/BUILD deleted file mode 100644 index 3dd85f0f2c4..00000000000 --- a/components/CollectionLayoutAttributes/BUILD +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2017-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_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "CollectionLayoutAttributes", - sdk_frameworks = [ - "CoreGraphics", - "UIKit", - ], -) - -package_group( - name = "test_targets", - packages = [ - "//components/CollectionLayoutAttributes/...", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":CollectionLayoutAttributes", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/Collections/BUILD b/components/Collections/BUILD deleted file mode 100644 index eb0c82c98fa..00000000000 --- a/components/Collections/BUILD +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Collections", - bundles = [":Bundle"], - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - "//components/Availability", - "//components/CollectionCells", - "//components/CollectionLayoutAttributes", - "//components/Ink", - "//components/Palettes", - "//components/ShadowLayer", - "//components/Typography", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":Collections", - "//components/Palettes", - "//components/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":Collections", - ], -) - -filegroup( - name = "BundleFiles", - srcs = glob([ - "src/MaterialCollections.bundle/**", - ]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) - -mdc_objc_library( - name = "private", - testonly = 1, - hdrs = native.glob(["src/private/*.h"]), - includes = ["src/private"], - visibility = ["//visibility:private"], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":Collections", - ":private", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/Dialogs/BUILD b/components/Dialogs/BUILD deleted file mode 100644 index d4f33024b27..00000000000 --- a/components/Dialogs/BUILD +++ /dev/null @@ -1,188 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", - "mdc_unit_test_swift_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Dialogs", - bundles = [":Bundle"], - sdk_frameworks = [ - "QuartzCore", - "UIKit", - ], - deps = [ - "//components/Buttons", - "//components/Buttons:ColorThemer", - "//components/Buttons:TypographyThemer", - "//components/Elevation", - "//components/ShadowElevations", - "//components/ShadowLayer", - "//components/Typography", - "//components/private/KeyboardWatcher", - "//components/private/Math", - "@material_internationalization_ios//:MDFInternationalization", - "@motion_animator_objc//:MotionAnimator", - ], -) - -filegroup( - name = "BundleFiles", - srcs = glob([ - "src/MaterialDialogs.bundle/**", - ]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) - -mdc_extension_objc_library( - name = "Theming", - deps = [ - ":ColorThemer", - ":Dialogs", - ":TypographyThemer", - "//components/Buttons:Theming", - "//components/ShadowElevations", - "//components/schemes/Container", - ], -) - -mdc_extension_objc_library( - name = "DialogThemer", - deps = [ - ":ColorThemer", - ":Dialogs", - ":TypographyThemer", - "//components/Buttons:ButtonThemer", - "//components/Buttons:ColorThemer", - "//components/Themes", - ], -) - -mdc_extension_objc_library( - name = "ColorThemer", - deps = [ - ":Dialogs", - "//components/Buttons:ColorThemer", - "//components/Themes", - ], -) - -mdc_extension_objc_library( - name = "TypographyThemer", - deps = [ - ":Dialogs", - "//components/Buttons:TypographyThemer", - "//components/schemes/Typography", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":Dialogs", - ":Theming", - "//components/Buttons:ButtonThemer", - "//components/Collections", - "//components/schemes/Color", - "//components/schemes/Container", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":DialogThemer", - ":Dialogs", - ":Theming", - "//components/Collections", - "//components/List", - "//components/schemes/Color", - "//components/schemes/Container", - ], -) - -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - includes = ["src/private"], - visibility = ["//visibility:private"], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":ColorThemer", - ":DialogThemer", - ":Dialogs", - ":TypographyThemer", - ":private", - ], -) - -mdc_unit_test_swift_library( - name = "unit_test_swift_sources", - extra_srcs = glob([ - "tests/unit/Theming/*.swift", - ]), - deps = [ - ":DialogThemer", - ":Theming", - "//components/Buttons:Theming", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":Dialogs", - ":Theming", - ":private", - "//components/Availability", - "//components/private/Color", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [":snapshot_test_lib"], -) diff --git a/components/Elevation/BUILD b/components/Elevation/BUILD deleted file mode 100644 index 8f9e42eaf78..00000000000 --- a/components/Elevation/BUILD +++ /dev/null @@ -1,58 +0,0 @@ -# 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. -# 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_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Elevation", - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - "//components/Availability", - "//components/private/Color", - "//components/private/Math", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - testonly = 1, - sdk_frameworks = [ - "UIKit", - "CoreGraphics", - ], - visibility = ["//visibility:private"], - deps = [ - ":Elevation", - "//components/Availability", - "//components/private/Color", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/FeatureHighlight/BUILD b/components/FeatureHighlight/BUILD deleted file mode 100644 index 068bfed5663..00000000000 --- a/components/FeatureHighlight/BUILD +++ /dev/null @@ -1,144 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "FeatureHighlight", - bundles = [":Bundle"], - sdk_frameworks = [ - "CoreGraphics", - "UIKit", - ], - deps = [ - "//components/Availability", - "//components/Typography", - "//components/private/Math", - "@material_text_accessibility_ios//:MDFTextAccessibility", - ], -) - -filegroup( - name = "BundleFiles", - srcs = glob([ - "src/MaterialFeatureHighlight.bundle/**", - ]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) - -mdc_extension_objc_library( - name = "ColorThemer", - deps = [ - ":FeatureHighlight", - "//components/Themes", - ], -) - -mdc_extension_objc_library( - name = "FeatureHighlightAccessibilityMutator", - deps = [ - ":FeatureHighlight", - "@material_text_accessibility_ios//:MDFTextAccessibility", - ], -) - -mdc_objc_library( - name = "private", - testonly = 1, - hdrs = native.glob(["src/private/*.h"]), - includes = ["src/private"], - visibility = ["//visibility:private"], - deps = [ - "//components/Availability", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":ColorThemer", - ":FeatureHighlight", - ":FeatureHighlightAccessibilityMutator", - "//components/Buttons", - "//components/Buttons:ButtonThemer", - "//components/Buttons:Theming", - "//components/Collections", - "//components/Palettes", - "//components/Typography", - "//components/private/Math", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":ColorThemer", - ":FeatureHighlight", - "//components/Buttons", - "//components/Buttons:ButtonThemer", - "//components/schemes/Color", - "//components/schemes/Typography", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":ColorThemer", - ":FeatureHighlight", - ":FeatureHighlightAccessibilityMutator", - ":private", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":FeatureHighlight", - ":private", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [":snapshot_test_lib"], -) diff --git a/components/FlexibleHeader/BUILD b/components/FlexibleHeader/BUILD deleted file mode 100644 index 9d21071c9ce..00000000000 --- a/components/FlexibleHeader/BUILD +++ /dev/null @@ -1,146 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_swift_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", - "mdc_unit_test_swift_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "FlexibleHeader", - sdk_frameworks = [ - "QuartzCore", - "UIKit", - ], - deps = [ - "//components/Availability", - "//components/Elevation", - "//components/ShadowElevations", - "//components/private/Application", - "//components/private/Math", - "//components/private/UIMetrics", - "@material_text_accessibility_ios//:MDFTextAccessibility", - ], -) - -mdc_extension_objc_library( - name = "ColorThemer", - deps = [ - ":FlexibleHeader", - "//components/schemes/Color", - ], -) - -mdc_objc_library( - name = "private", - testonly = 1, - hdrs = native.glob(["src/private/*.h"]), - includes = ["src/private"], - visibility = [":test_targets"], -) - -package_group( - name = "test_targets", - packages = [ - "//components/FlexibleHeader/...", - ], -) - -mdc_extension_objc_library( - name = "CanAlwaysExpandToMaximumHeight", - deps = [ - ":FlexibleHeader", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":CanAlwaysExpandToMaximumHeight", - ":ColorThemer", - ":FlexibleHeader", - "//components/Buttons", - "//components/PageControl", - "//components/Palettes", - ], -) - -mdc_unit_test_swift_library( - name = "unit_test_swift_sources", - deps = [ - ":CanAlwaysExpandToMaximumHeight", - ":ColorThemer", - ":FlexibleHeader", - "//components/ShadowLayer", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - extra_srcs = glob([ - "tests/unit/supplemental/*.m", - "tests/unit/supplemental/*.h", - ]), - deps = [ - ":CanAlwaysExpandToMaximumHeight", - ":ColorThemer", - ":FlexibleHeader", - ":private", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - # TODO (https://github.com/material-components/material-components-ios/issues/8249): Re-enable autobot environment. - use_autobot_environment_runner = False, - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":FlexibleHeader", - "//components/ShadowLayer", - ], -) - -mdc_snapshot_swift_library( - name = "snapshot_test_lib_swift", - deps = [ - ":FlexibleHeader", - "//components/ShadowLayer", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ":snapshot_test_lib_swift", - ], -) diff --git a/components/HeaderStackView/BUILD b/components/HeaderStackView/BUILD deleted file mode 100644 index 7c9ab703572..00000000000 --- a/components/HeaderStackView/BUILD +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2017-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", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "HeaderStackView", - sdk_frameworks = [ - "CoreGraphics", - ], -) - -mdc_extension_objc_library( - name = "ColorThemer", - deps = [ - ":HeaderStackView", - "//components/Themes", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":ColorThemer", - ":HeaderStackView", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - # TODO(https://github.com/material-foundation/ios-snapshot-test-case/pull/2 ): Remove once - # upstream linking is fixed. - sdk_frameworks = ["QuartzCore"], - deps = [ - ":HeaderStackView", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/Ink/BUILD b/components/Ink/BUILD deleted file mode 100644 index 573b87e170a..00000000000 --- a/components/Ink/BUILD +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Ink", - sdk_frameworks = [ - "CoreGraphics", - "QuartzCore", - ], - deps = [ - "//components/Availability", - "//components/private/Math", - ], -) - -mdc_objc_library( - name = "private", - testonly = 1, - hdrs = native.glob(["src/private/*.h"]), - visibility = ["//visibility:private"], - deps = [":Ink"], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":Ink", - "//components/Palettes", - "//components/Typography", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":Ink", - ":private", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":Ink", - "//components/private/Color", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/LibraryInfo/BUILD b/components/LibraryInfo/BUILD deleted file mode 100644 index ca451c16038..00000000000 --- a/components/LibraryInfo/BUILD +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2017-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_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "LibraryInfo", - sdk_frameworks = [ - "Foundation", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [":LibraryInfo"], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/LibraryInfo/src/MDCLibraryInfo.m b/components/LibraryInfo/src/MDCLibraryInfo.m index 23d79081ac0..afc29eea527 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 = @"108.1.0"; +static NSString const *MDCLibraryInfoVersionString = @"109.0.0"; @implementation MDCLibraryInfo diff --git a/components/LibraryInfo/tests/unit/LibraryInfoTests.m b/components/LibraryInfo/tests/unit/LibraryInfoTests.m index 4f1a7ae9d45..65a0cc8c1c3 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: "108.1.0", etc. + // Accept: "109.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/List/BUILD b/components/List/BUILD deleted file mode 100644 index e0755e4f638..00000000000 --- a/components/List/BUILD +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright 2018-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", - "mdc_unit_test_swift_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "List", - sdk_frameworks = [ - "CoreGraphics", - "UIKit", - ], - deps = [ - "//components/Elevation", - "//components/Ink", - "//components/Ripple", - "//components/ShadowElevations", - "//components/ShadowLayer", - "//components/Typography", - "@material_internationalization_ios//:MDFInternationalization", - ], -) - -mdc_extension_objc_library( - name = "Theming", - deps = [ - ":List", - "//components/Typography", - "//components/schemes/Color", - "//components/schemes/Container", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":List", - "//components/Typography", - "//components/schemes/Typography", - ], -) - -mdc_unit_test_swift_library( - name = "unit_test_swift_sources", - extra_srcs = glob([ - "tests/unit/Theming/*.swift", - ]), - deps = [ - ":List", - ":Theming", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":List", - ":Theming", - "//components/private/Icons/icons/ic_info", - "//components/schemes/Container", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":List", - "//components/schemes/Container", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":List", - "//components/schemes/Typography", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/List/examples/CollectionListCellExampleTypicalUse.m b/components/List/examples/CollectionListCellExampleTypicalUse.m index 5555c1fc4e3..0bfa4d88c19 100644 --- a/components/List/examples/CollectionListCellExampleTypicalUse.m +++ b/components/List/examples/CollectionListCellExampleTypicalUse.m @@ -166,7 +166,7 @@ - (void)viewWillTransitionToSize:(CGSize)size + (NSDictionary *)catalogMetadata { return @{ - @"breadcrumbs" : @[ @"Lists", @"List Cell Example" ], + @"breadcrumbs" : @[ @"List Items", @"List Cell Example" ], @"description" : @"Material Collection Lists are continuous, vertical indexes of text " @"or images.", @"primaryDemo" : @NO, diff --git a/components/NavigationBar/BUILD b/components/NavigationBar/BUILD deleted file mode 100644 index f5b241ed5c2..00000000000 --- a/components/NavigationBar/BUILD +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", - "mdc_unit_test_swift_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "NavigationBar", - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - "//components/ButtonBar", - "//components/Elevation", - "//components/Typography", - "//components/private/Math", - "@material_internationalization_ios//:MDFInternationalization", - "@material_text_accessibility_ios//:MDFTextAccessibility", - ], -) - -mdc_extension_objc_library( - name = "ColorThemer", - deps = [ - ":NavigationBar", - "//components/schemes/Color", - ], -) - -mdc_extension_objc_library( - name = "TypographyThemer", - deps = [ - ":NavigationBar", - "//components/schemes/Typography", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":ColorThemer", - ":NavigationBar", - ":TypographyThemer", - "//components/Palettes", - "//components/TextFields", - "//components/private/Icons/icons/ic_arrow_back", - "//components/private/Icons/icons/ic_check_circle", - "//components/private/Icons/icons/ic_info", - "//components/private/Icons/icons/ic_reorder", - "//components/schemes/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":ColorThemer", - ":NavigationBar", - "//components/Palettes", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":ColorThemer", - ":NavigationBar", - ":TypographyThemer", - "@material_text_accessibility_ios//:MDFTextAccessibility", - ], -) - -mdc_unit_test_swift_library( - name = "unit_test_swift_sources", - deps = [ - ":ColorThemer", - ":NavigationBar", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - # TODO (https://github.com/material-components/material-components-ios/issues/8249): Re-enable autobot environment. - use_autobot_environment_runner = False, - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":NavigationBar", - "//components/private/Icons/icons/ic_arrow_back", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [":snapshot_test_lib"], -) diff --git a/components/NavigationDrawer/BUILD b/components/NavigationDrawer/BUILD deleted file mode 100644 index 90e82ff1acb..00000000000 --- a/components/NavigationDrawer/BUILD +++ /dev/null @@ -1,95 +0,0 @@ -# Copyright 2018-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_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "NavigationDrawer", - deps = [ - "//components/Elevation", - "//components/Palettes", - "//components/ShadowLayer", - "//components/private/Math", - "//components/private/UIMetrics", - ], -) - -mdc_extension_objc_library( - name = "ColorThemer", - deps = [ - ":NavigationDrawer", - "//components/schemes/Color", - ], -) - -mdc_objc_library( - name = "private", - testonly = 1, - hdrs = native.glob(["src/private/*.h"]), - visibility = ["//visibility:private"], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":ColorThemer", - ":NavigationDrawer", - "//components/BottomAppBar", - "//components/schemes/Color", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":ColorThemer", - ":NavigationDrawer", - ":private", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":NavigationDrawer", - ":private", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/OverlayWindow/BUILD b/components/OverlayWindow/BUILD deleted file mode 100644 index 42d4684903f..00000000000 --- a/components/OverlayWindow/BUILD +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright 2017-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_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "OverlayWindow", - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - "//components/private/Application", - "//components/Availability", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":OverlayWindow", - "//components/Availability", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/PageControl/BUILD b/components/PageControl/BUILD deleted file mode 100644 index 6e1ebdc7360..00000000000 --- a/components/PageControl/BUILD +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "PageControl", - bundles = [":Bundle"], - sdk_frameworks = [ - "QuartzCore", - "CoreGraphics", - ], - deps = [ - "@material_internationalization_ios//:MDFInternationalization", - ], -) - -filegroup( - name = "BundleFiles", - srcs = glob([ - "src/MaterialPageControl.bundle/**", - ]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) - -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - visibility = ["//visibility:private"], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":PageControl", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":PageControl", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":PageControl", - "//components/Palettes", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":PageControl", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/Palettes/BUILD b/components/Palettes/BUILD deleted file mode 100644 index 30067de0a80..00000000000 --- a/components/Palettes/BUILD +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2017-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_examples_swift_library", - "mdc_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Palettes", -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":Palettes", - "@material_text_accessibility_ios//:MDFTextAccessibility", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [":Palettes"], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/ProgressView/BUILD b/components/ProgressView/BUILD deleted file mode 100644 index 28edd1053dd..00000000000 --- a/components/ProgressView/BUILD +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ProgressView", - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - "//components/Palettes", - "//components/private/Math", - "@material_internationalization_ios//:MDFInternationalization", - "@motion_animator_objc//:MotionAnimator", - "@motion_interchange_objc//:MotionInterchange", - ], -) - -mdc_extension_objc_library( - name = "Theming", - deps = [ - ":ProgressView", - "//components/schemes/Container", - ], -) - -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - visibility = ["//visibility:private"], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - extra_srcs = native.glob([ - "tests/unit/Theming/*.m", - ]), - deps = [ - ":ProgressView", - ":Theming", - ":private", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":ProgressView", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":ProgressView", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/Ripple/BUILD b/components/Ripple/BUILD deleted file mode 100644 index 5e2023e13f3..00000000000 --- a/components/Ripple/BUILD +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Ripple", - sdk_frameworks = [ - "CoreGraphics", - "QuartzCore", - ], - deps = [ - "//components/AnimationTiming", - "//components/private/Math", - ], -) - -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - visibility = ["//visibility:private"], - deps = [":Ripple"], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - visibility = ["//visibility:private"], - deps = [ - ":Ripple", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - visibility = ["//visibility:private"], - deps = [ - ":Ripple", - "//components/Buttons:ButtonThemer", - "//components/Buttons:Theming", - "//components/Cards:CardThemer", - "//components/Cards:Theming", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":Ripple", - ":private", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":Ripple", - "//components/private/Color", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [":snapshot_test_lib"], -) diff --git a/components/ShadowElevations/BUILD b/components/ShadowElevations/BUILD deleted file mode 100644 index 2cbba1323a8..00000000000 --- a/components/ShadowElevations/BUILD +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ShadowElevations", - sdk_frameworks = [ - "QuartzCore", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":ShadowElevations", - "//components/ShadowLayer", - "//components/Slider", - "//components/private/Math", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [":ShadowElevations"], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":ShadowElevations", - "//components/Cards", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/ShadowLayer/BUILD b/components/ShadowLayer/BUILD deleted file mode 100644 index 9fd2aec6a1b..00000000000 --- a/components/ShadowLayer/BUILD +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ShadowLayer", - sdk_frameworks = [ - "CoreGraphics", - "QuartzCore", - ], - deps = [ - "//components/ShadowElevations", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":ShadowLayer", - "//components/AnimationTiming", - "//components/Buttons", - "//components/Buttons:ButtonThemer", - "//components/ShadowElevations", - "//components/Slider", - "//components/private/Math", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":ShadowLayer", - "//components/ShadowElevations", - "//components/ShapeLibrary", - "//components/Shapes", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [":ShadowLayer"], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":ShadowLayer", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/ShapeLibrary/BUILD b/components/ShapeLibrary/BUILD deleted file mode 100644 index 456a68cd993..00000000000 --- a/components/ShapeLibrary/BUILD +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright 2017-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_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ShapeLibrary", - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - "//components/Shapes", - "//components/private/Math", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":ShapeLibrary", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":ShapeLibrary", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/Shapes/BUILD b/components/Shapes/BUILD deleted file mode 100644 index a0923352d6b..00000000000 --- a/components/Shapes/BUILD +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright 2017-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_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Shapes", - sdk_frameworks = [ - "CoreGraphics", - "QuartzCore", - ], - deps = [ - "//components/ShadowLayer", - "//components/private/Color", - "//components/private/Math", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":Shapes", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":Shapes", - "//components/ShapeLibrary", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/Slider/BUILD b/components/Slider/BUILD deleted file mode 100644 index 0496d0936dd..00000000000 --- a/components/Slider/BUILD +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Slider", - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - "//components/Elevation", - "//components/Palettes", - "//components/private/Math", - "//components/private/ThumbTrack", - ], -) - -mdc_extension_objc_library( - name = "ColorThemer", - deps = [ - ":Slider", - "//components/schemes/Color", - ], -) - -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - visibility = ["//visibility:private"], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":ColorThemer", - ":Slider", - "//components/Collections", - "//components/Palettes", - "//components/private/Math", - "//components/schemes/Color", - "//components/schemes/Typography", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":ColorThemer", - ":Slider", - ":private", - "//components/private/ThumbTrack", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":Slider", - ":private", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/Snackbar/BUILD b/components/Snackbar/BUILD deleted file mode 100644 index 8ce47fd24b9..00000000000 --- a/components/Snackbar/BUILD +++ /dev/null @@ -1,158 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", - "mdc_unit_test_swift_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Snackbar", - bundles = [":Bundle"], - sdk_frameworks = [ - "CoreGraphics", - "QuartzCore", - ], - deps = [ - "//components/AnimationTiming", - "//components/Availability", - "//components/Buttons", - "//components/Elevation", - "//components/OverlayWindow", - "//components/ShadowElevations", - "//components/ShadowLayer", - "//components/Typography", - "//components/private/Application", - "//components/private/KeyboardWatcher", - "//components/private/Math", - "//components/private/Overlay", - "@material_internationalization_ios//:MDFInternationalization", - ], -) - -filegroup( - name = "BundleFiles", - srcs = glob([ - "src/MaterialSnackbar.bundle/**", - ]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) - -mdc_extension_objc_library( - name = "FontThemer", - deps = [ - ":Snackbar", - "//components/Themes", - ], -) - -mdc_extension_objc_library( - name = "TypographyThemer", - deps = [ - ":Snackbar", - "//components/schemes/Typography", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":Snackbar", - ":TypographyThemer", - "//components/Buttons", - "//components/Collections", - "//components/Palettes", - "//components/Typography", - "//components/private/Overlay", - "//components/schemes/Color", - "//components/schemes/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":Snackbar", - "//components/Buttons", - "//components/Buttons:Theming", - "//components/schemes/Container", - ], -) - -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - visibility = ["//visibility:private"], -) - -mdc_unit_test_swift_library( - name = "unit_test_swift_sources", - deps = [ - ":Snackbar", - ":TypographyThemer", - ":private", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - extra_srcs = glob([ - "tests/unit/supplemental/*.m", - "tests/unit/supplemental/*.h", - ]), - deps = [ - ":FontThemer", - ":Snackbar", - ":private", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":Snackbar", - ":private", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/Snackbar/src/MDCSnackbarManager.h b/components/Snackbar/src/MDCSnackbarManager.h index ac2c8012be0..9da90facef0 100644 --- a/components/Snackbar/src/MDCSnackbarManager.h +++ b/components/Snackbar/src/MDCSnackbarManager.h @@ -198,6 +198,13 @@ */ @property(nonatomic, assign) BOOL shouldApplyStyleChangesToVisibleSnackbars; +/** + This accessibility notification posted when a Snackbar changes the focus of VoiceOver. + + Default is set to UIAccessibilityLayoutChangedNotification. + */ +@property(nonatomic, assign) UIAccessibilityNotifications focusAccessibilityNotification; + /** Returns the button title color for a particular control state. diff --git a/components/Snackbar/src/MDCSnackbarManager.m b/components/Snackbar/src/MDCSnackbarManager.m index e052115774a..80b781cee7e 100644 --- a/components/Snackbar/src/MDCSnackbarManager.m +++ b/components/Snackbar/src/MDCSnackbarManager.m @@ -247,7 +247,7 @@ - (void)displaySnackbarViewForMessage:(MDCSnackbarMessage *)message { completion:^{ if (snackbarView.accessibilityViewIsModal || message.focusOnShow || ![self isSnackbarTransient:snackbarView]) { - UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, + UIAccessibilityPostNotification(self.manager.focusAccessibilityNotification, snackbarView); } else { snackbarView.accessibilityElementsHidden = YES; @@ -573,6 +573,7 @@ - (instancetype)init { _messageElevation = MDCShadowElevationSnackbar; _adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable = YES; _mdc_overrideBaseElevation = -1; + _focusAccessibilityNotification = UIAccessibilityLayoutChangedNotification; } return self; } diff --git a/components/Snackbar/src/MDCSnackbarMessageView.m b/components/Snackbar/src/MDCSnackbarMessageView.m index 657b5b6b13a..a136f33e412 100644 --- a/components/Snackbar/src/MDCSnackbarMessageView.m +++ b/components/Snackbar/src/MDCSnackbarMessageView.m @@ -85,11 +85,6 @@ static BOOL UIViewHasFocusedAccessibilityElement(UIView *view) { static const CGFloat kLegacyButtonPadding = 5; static const CGFloat kButtonPadding = 8; -/** - Minimum padding for the vertical padding of the buttons to the Snackbar - */ -static const CGFloat kMinVerticalButtonPadding = 6; - /** The width of the Snackbar. */ @@ -706,7 +701,6 @@ - (NSArray *)containerViewConstraints { @"kTopMargin" : @(self.safeContentMargin.top), @"kTitleButtonPadding" : @(kTitleButtonPadding), @"kContentSafeBottomInset" : @(kBorderWidth + self.contentSafeBottomInset), - @"kMinVerticalButtonPadding" : @(kMinVerticalButtonPadding), }; NSDictionary *views = @{ @"container" : self.containerView, @@ -803,7 +797,7 @@ - (NSArray *)containerViewConstraints { metrics:metrics views:views]]; - formatString = @"V:|-(>=kMinVerticalButtonPadding)-[buttons]-(>=kMinVerticalButtonPadding)-|"; + formatString = @"V:|[buttons]|"; [constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:formatString options:NSLayoutFormatAlignAllCenterY @@ -911,11 +905,13 @@ - (NSArray *)horizontalButtonLayoutConstraints { }; __block UIView *previousButton = nil; - [self.buttons enumerateObjectsUsingBlock:^(UIView *button, NSUInteger idx, __unused BOOL *stop) { + [self.buttons enumerateObjectsUsingBlock:^(UIView *buttonContainer, NSUInteger idx, + __unused BOOL *stop) { // Convenience dictionary of views. NSMutableDictionary *views = [NSMutableDictionary dictionary]; - views[@"buttonContainer"] = button; - views[@"button"] = [button viewWithTag:kButtonTagStart + idx]; + views[@"buttonContainer"] = buttonContainer; + MDCButton *currentButton = [buttonContainer viewWithTag:kButtonTagStart + idx]; + views[@"button"] = currentButton; if (previousButton) { views[@"previousButton"] = previousButton; } @@ -927,11 +923,16 @@ - (NSArray *)horizontalButtonLayoutConstraints { metrics:metrics views:views]]; - // Pin the button to the height of its container. - [constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[button]|" - options:0 - metrics:metrics - views:views]]; + // Ensure that the button is vertically centered in its container view + NSLayoutConstraint *verticallyCenterConstraint = + [NSLayoutConstraint constraintWithItem:currentButton + attribute:NSLayoutAttributeCenterY + relatedBy:NSLayoutRelationEqual + toItem:buttonContainer + attribute:NSLayoutAttributeCenterY + multiplier:1.0 + constant:0]; + [constraints addObject:verticallyCenterConstraint]; // Pin the button to the width of its container. [constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[button]|" diff --git a/components/Snackbar/src/private/MDCSnackbarOverlayView.m b/components/Snackbar/src/private/MDCSnackbarOverlayView.m index 681b30bb5d7..891bfa6e997 100644 --- a/components/Snackbar/src/private/MDCSnackbarOverlayView.m +++ b/components/Snackbar/src/private/MDCSnackbarOverlayView.m @@ -489,6 +489,20 @@ - (BOOL)anchoredToScreenBottom { return [self dynamicBottomMargin] == 0; } +- (void)configureActionButtonHitAreaInsets:(MDCSnackbarMessageView *)snackbarView { + for (MDCButton *button in snackbarView.actionButtons) { + UIView *buttonSuperview = button.superview; + if (buttonSuperview) { + CGFloat superViewHeight = CGRectGetHeight(buttonSuperview.frame); + if (superViewHeight > 0) { + CGFloat spaceAboveButton = CGRectGetMinY(button.frame); + CGFloat spaceBelowButton = superViewHeight - CGRectGetMaxY(button.frame); + button.hitAreaInsets = UIEdgeInsetsMake(-spaceAboveButton, 0, 0, -spaceBelowButton); + } + } + } +} + #pragma mark - Safe Area Insets - (void)safeAreaInsetsDidChange { @@ -619,6 +633,8 @@ - (void)slideInMessageView:(MDCSnackbarMessageView *)snackbarView // Make sure that the Snackbar has been properly sized to calculate the translation value. [self triggerSnackbarLayoutChange]; + [self configureActionButtonHitAreaInsets:snackbarView]; + [self slideMessageView:snackbarView onscreen:YES fromContentOpacity:0 diff --git a/components/Snackbar/tests/unit/SnackbarManagerTests.m b/components/Snackbar/tests/unit/SnackbarManagerTests.m index 6e77c253ba7..bbf2ff4da4b 100644 --- a/components/Snackbar/tests/unit/SnackbarManagerTests.m +++ b/components/Snackbar/tests/unit/SnackbarManagerTests.m @@ -257,4 +257,10 @@ - (void)testDefaultValueForOverrideBaseElevationIsNegative { XCTAssertLessThan(MDCSnackbarManager.defaultManager.mdc_overrideBaseElevation, 0); } +- (void)testDefaultValueForFocusedSnackbarsAccessibilityNotification { + // Then + XCTAssertEqual(MDCSnackbarManager.defaultManager.focusAccessibilityNotification, + UIAccessibilityLayoutChangedNotification); +} + @end diff --git a/components/Tabs/BUILD b/components/Tabs/BUILD deleted file mode 100644 index 9bc25dea99d..00000000000 --- a/components/Tabs/BUILD +++ /dev/null @@ -1,192 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Tabs", - bundles = [":Bundle"], - deps = [ - "//components/AnimationTiming", - "//components/Elevation", - "//components/Ink", - "//components/Palettes", - "//components/Ripple", - "//components/ShadowElevations", - "//components/ShadowLayer", - "//components/Typography", - "@material_internationalization_ios//:MDFInternationalization", - ], -) - -filegroup( - name = "BundleFiles", - srcs = glob([ - "src/MaterialTabs.bundle/**", - ]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) - -mdc_extension_objc_library( - name = "TypographyThemer", - deps = [ - ":Tabs", - "//components/schemes/Typography", - ], -) - -mdc_extension_objc_library( - name = "Theming", - deps = [ - ":Tabs", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_extension_objc_library( - name = "TabBarView", - deps = [ - "//components/AnimationTiming", - "//components/Ripple", - "//components/private/Math", - "@material_internationalization_ios//:MDFInternationalization", - ], -) - -filegroup( - name = "TabsExamplesAssets", - srcs = glob(["examples/resources/TabBarDemoAssets.xcassets/**"]), -) - -mdc_examples_objc_library( - name = "ObjcExamples", - data = [":TabsExamplesAssets"], - deps = [ - ":TabBarView", - ":Tabs", - ":Theming", - ":TypographyThemer", - "//components/ActionSheet", - "//components/ActionSheet:Theming", - "//components/AppBar", - "//components/AppBar:ColorThemer", - "//components/AppBar:TypographyThemer", - "//components/Buttons", - "//components/Buttons:ButtonThemer", - "//components/Collections", - "//components/Palettes", - "//components/Slider", - "//components/private/Icons/icons/ic_settings", - "//components/private/Math", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":TabBarView", - ":Tabs", - ":Theming", - "//components/AppBar", - "//components/AppBar:ColorThemer", - "//components/AppBar:TypographyThemer", - "//components/Buttons", - "//components/Buttons:ButtonThemer", - "//components/Palettes", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - ], -) - -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - visibility = ["//visibility:private"], -) - -mdc_objc_library( - name = "privateTabBarView", - hdrs = native.glob(["src/TabBarView/private/*.h"]), - visibility = ["//visibility:private"], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - extra_srcs = glob([ - "tests/unit/Theming/*.m", - "tests/unit/TabBarView/*.m", - ]), - deps = [ - ":TabBarView", - ":Tabs", - ":Theming", - ":TypographyThemer", - ":private", - ":privateTabBarView", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Typography", - "@material_internationalization_ios//:MDFInternationalization", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - extra_srcs = native.glob(["tests/snapshot/*/*.m"]), - deps = [ - ":TabBarView", - ":Tabs", - ":Theming", - ":privateTabBarView", - "//components/Availability", - "//components/AppBar", - "//components/HeaderStackView", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [":snapshot_test_lib"], -) diff --git a/components/Tabs/examples/MDCTabBarViewTypicalExampleViewController.m b/components/Tabs/examples/MDCTabBarViewTypicalExampleViewController.m index d460e6e558e..89b4c536ece 100644 --- a/components/Tabs/examples/MDCTabBarViewTypicalExampleViewController.m +++ b/components/Tabs/examples/MDCTabBarViewTypicalExampleViewController.m @@ -353,11 +353,19 @@ - (void)didTapAlignmentButton { handler:^(MDCActionSheetAction *_Nonnull action) { self.tabBar.preferredLayoutStyle = MDCTabBarViewLayoutStyleScrollable; }]; + MDCActionSheetAction *scrollableCenteredAction = [MDCActionSheetAction + actionWithTitle:@"Scrollable Centered" + image:((currentStyle == MDCTabBarViewLayoutStyleScrollableCentered) ? checkIcon + : nil) + handler:^(MDCActionSheetAction *_Nonnull action) { + self.tabBar.preferredLayoutStyle = MDCTabBarViewLayoutStyleScrollableCentered; + }]; [actionSheet addAction:fixedJustifiedAction]; [actionSheet addAction:fixedClusteredLeadingAction]; [actionSheet addAction:fixedClusteredTrailingAction]; [actionSheet addAction:fixedClusteredCenteredAction]; [actionSheet addAction:scrollableAction]; + [actionSheet addAction:scrollableCenteredAction]; [actionSheet applyThemeWithScheme:self.containerScheme]; actionSheet.alwaysAlignTitleLeadingEdges = YES; [self presentViewController:actionSheet animated:YES completion:nil]; diff --git a/components/Tabs/examples/TabBarTextOnlyExample.m b/components/Tabs/examples/TabBarTextOnlyExample.m index 72215a0aa87..8d09319dfae 100644 --- a/components/Tabs/examples/TabBarTextOnlyExample.m +++ b/components/Tabs/examples/TabBarTextOnlyExample.m @@ -29,7 +29,9 @@ - (id)initWithCollectionViewLayout:(UICollectionViewLayout *)layout { self = [super initWithCollectionViewLayout:layout]; if (self) { _containerScheme = [[MDCContainerScheme alloc] init]; - [self setupExampleViews:@[ @"Change Alignment", @"Toggle Case", @"Clear Selection" ]]; + [self setupExampleViews:@[ + @"Change Alignment", @"Toggle Case", @"Clear Selection", @"Select First", @"Select Last" + ]]; } return self; } @@ -128,6 +130,14 @@ - (void)collectionView:(UICollectionView *)collectionView [self clearSelection:collectionView]; break; + case 3: + [self.tabBar setSelectedItem:self.tabBar.items.firstObject animated:YES]; + break; + + case 4: + [self.tabBar setSelectedItem:self.tabBar.items.lastObject animated:YES]; + break; + default: // Unsupported break; diff --git a/components/Tabs/src/private/MDCItemBar.m b/components/Tabs/src/private/MDCItemBar.m index d1c4763b8f2..dc521d2f4ee 100644 --- a/components/Tabs/src/private/MDCItemBar.m +++ b/components/Tabs/src/private/MDCItemBar.m @@ -436,6 +436,9 @@ - (void)collectionView:(UICollectionView *)collectionView UITabBarItem *item = [self itemAtIndexPath:indexPath]; if (item) { [self.tabBar.displayDelegate tabBar:self.tabBar willDisplayItem:item]; + if ([cell isKindOfClass:[MDCItemBarCell class]]) { + cell.selected = (item == self.selectedItem); + } } } diff --git a/components/Tabs/src/private/MDCItemBarCell.h b/components/Tabs/src/private/MDCItemBarCell.h index 938285f35a5..fc55a8da1b7 100644 --- a/components/Tabs/src/private/MDCItemBarCell.h +++ b/components/Tabs/src/private/MDCItemBarCell.h @@ -14,6 +14,8 @@ #import +#import "MaterialRipple.h" + @class MDCItemBarStyle; /** View displaying an individual item in an item bar. */ @@ -36,6 +38,9 @@ /** Frame within the cell for its primary content. */ @property(nonatomic, readonly) CGRect contentFrame; +/** The @c MDCRippleTouchController responsible for user feedback in the cell. */ +@property(nonatomic, strong, nonnull) MDCRippleTouchController *rippleTouchController; + /** Updates the cell to use the given style properties. */ - (void)applyStyle:(nonnull MDCItemBarStyle *)itemStyle; diff --git a/components/Tabs/src/private/MDCItemBarCell.m b/components/Tabs/src/private/MDCItemBarCell.m index ce29de81a22..177030bbda6 100644 --- a/components/Tabs/src/private/MDCItemBarCell.m +++ b/components/Tabs/src/private/MDCItemBarCell.m @@ -23,7 +23,6 @@ #import "MaterialAnimationTiming.h" #import "MaterialInk.h" #import "MaterialMath.h" -#import "MaterialRipple.h" #import "MaterialTypography.h" /// Size of image in points. @@ -58,7 +57,6 @@ @interface MDCItemBarCell () @property(nonatomic, strong) UIImageView *imageView; @property(nonatomic, strong) MDCItemBarBadge *badge; @property(nonatomic, strong) MDCInkTouchController *inkTouchController; -@property(nonatomic, strong) MDCRippleTouchController *rippleTouchController; @property(nonatomic, strong) MDCItemBarStyle *style; @@ -593,6 +591,7 @@ - (void)updateInk { } - (void)updateRipple { + self.rippleTouchController.shouldProcessRippleWithScrollViewGestures = NO; MDCRippleView *rippleView = self.rippleTouchController.rippleView; rippleView.rippleColor = _style.rippleColor; rippleView.rippleStyle = _style.rippleStyle; diff --git a/components/Tabs/tests/unit/MDCItemBarCellTests.m b/components/Tabs/tests/unit/MDCItemBarCellTests.m index c5a5ee28879..c0b845172bd 100644 --- a/components/Tabs/tests/unit/MDCItemBarCellTests.m +++ b/components/Tabs/tests/unit/MDCItemBarCellTests.m @@ -101,4 +101,13 @@ - (void)testBadgeLabelTextTruncation { XCTAssertEqualWithAccuracy(CGRectGetWidth(frameWithFiveDigitBadgeValue), CGRectGetWidth(frameWithFourDigitBadgeValue), 0.001); } + +- (void)testRippleTouchControllerShouldProcessRippleWithScrollViewDefaultsToNo { + // Given + MDCItemBarCell *cell = [[MDCItemBarCell alloc] initWithFrame:CGRectZero]; + + // Then + XCTAssertFalse(cell.rippleTouchController.shouldProcessRippleWithScrollViewGestures); +} + @end diff --git a/components/TextControls/BUILD b/components/TextControls/BUILD deleted file mode 100644 index 0d863d1b8b3..00000000000 --- a/components/TextControls/BUILD +++ /dev/null @@ -1,225 +0,0 @@ -# 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. -# 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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) - -package_group( - name = "TextControlsPackageGroup", - packages = [ - "//components/TextControls/...", - ], -) - -mdc_extension_objc_library( - name = "Enums", - visibility = [ - ":TextControlsPackageGroup", - "//components/private/TextControlsPrivate:TextControlsPrivatePackageGroup", - ], -) - -mdc_extension_objc_library( - name = "BaseTextAreas", - deps = [ - ":BaseTextAreasPrivate", - "//components/private/TextControlsPrivate:BaseStyle", - "//components/private/TextControlsPrivate:Shared", - ], -) - -mdc_extension_objc_library( - name = "BaseTextFields", - deps = [ - "//components/private/TextControlsPrivate:BaseStyle", - "//components/private/TextControlsPrivate:Shared", - "@material_internationalization_ios//:MDFInternationalization", - ], -) - -mdc_objc_library( - name = "BaseTextAreasPrivate", - hdrs = native.glob(["src/BaseTextAreas/private/*.h"]), - includes = ["src/BaseTextAreas/private"], - visibility = [ - ":TextControlsPackageGroup", - ], -) - -mdc_objc_library( - name = "BaseTextFieldsPrivate", - hdrs = native.glob(["src/BaseTextFields/private/*.h"]), - includes = ["src/BaseTextFields/private"], - visibility = [ - ":TextControlsPackageGroup", - ], -) - -mdc_extension_objc_library( - name = "FilledTextAreas", - deps = [ - ":BaseTextAreas", - "//components/private/TextControlsPrivate:FilledStyle", - ], -) - -mdc_extension_objc_library( - name = "FilledTextAreasTheming", - deps = [ - ":FilledTextAreas", - "//components/schemes/Container", - ], -) - -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 = "OutlinedTextAreas", - deps = [ - ":BaseTextAreas", - "//components/private/TextControlsPrivate:OutlinedStyle", - ], -) - -mdc_extension_objc_library( - name = "OutlinedTextAreasTheming", - deps = [ - ":OutlinedTextAreas", - "//components/schemes/Container", - ], -) - -mdc_extension_objc_library( - name = "OutlinedTextFields", - deps = [ - ":BaseTextFields", - "//components/private/TextControlsPrivate:OutlinedStyle", - ], -) - -mdc_extension_objc_library( - name = "OutlinedTextFieldsTheming", - deps = [ - ":OutlinedTextFields", - "//components/schemes/Container", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":BaseTextFields", - ":FilledTextAreas", - ":FilledTextAreasTheming", - ":FilledTextFields", - ":FilledTextFieldsTheming", - ":OutlinedTextAreas", - ":OutlinedTextAreasTheming", - ":OutlinedTextFields", - ":OutlinedTextFieldsTheming", - "//components/Buttons", - "//components/Buttons:Theming", - "//components/schemes/Container", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":BaseTextFields", - ":FilledTextFields", - ":FilledTextFieldsTheming", - ":OutlinedTextFields", - ":OutlinedTextFieldsTheming", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - extra_srcs = glob([ - "tests/unit/*/*.m", - ]), - deps = [ - ":BaseTextAreas", - ":BaseTextAreasPrivate", - ":BaseTextFields", - ":BaseTextFieldsPrivate", - ":FilledTextAreas", - ":FilledTextAreasTheming", - ":FilledTextFields", - ":FilledTextFieldsTheming", - ":OutlinedTextAreas", - ":OutlinedTextAreasTheming", - ":OutlinedTextFields", - ":OutlinedTextFieldsTheming", - "//components/Availability", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - ":BaseTextFields", - ":Enums", - ":FilledTextFields", - ":FilledTextFieldsTheming", - ":OutlinedTextFields", - ":OutlinedTextFieldsTheming", - "//components/private/TextControlsPrivate:FilledStyle", - "//components/private/TextControlsPrivate:OutlinedStyle", - "//components/private/TextControlsPrivate:Shared", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - timeout = "long", - deps = ["snapshot_test_lib"], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/TextControls/README.md b/components/TextControls/README.md index 3ef139e80ab..ce89e041b2e 100644 --- a/components/TextControls/README.md +++ b/components/TextControls/README.md @@ -1,56 +1,40 @@ - + -# TextControls +# Text fields -[![Open bugs badge](https://img.shields.io/badge/dynamic/json.svg?label=open%20bugs&url=https%3A%2F%2Fapi.github.com%2Fsearch%2Fissues%3Fq%3Dis%253Aopen%2Blabel%253Atype%253ABug%2Blabel%253A%255BTextControls%255D&query=%24.total_count)](https://github.com/material-components/material-components-ios/issues?q=is%3Aopen+is%3Aissue+label%3Atype%3ABug+label%3A%5BTextControls%5D) +[Text fields](https://material.io/components/text-fields) allow users to enter text into a UI. They typically appear in forms and dialogs. -TextControls are controls used for text input that make use of classes like UITextField and UITextView. +Text fields come in two styles: -
- TextFields -
+1. [Filled text fields](#filled-text-fields) +2. [Outlined text fields](#outlined-text-fields) -## Design & API documentation +!["Text field examples of both filled and outlined types, and each type showing +both inactive and focused states. The filled text fields show a gray background +and a darker gray activation indicator that is purple when focused. The outlined +text fields show a clear background and an outline that is purple when +focused"](docs/assets/text-field-generic.png) +## Using text fields -## Table of contents +Material iOS text fields consist of both single-line and multi-line offerings in both filled and outlined styles. The single-line text fields, MDCFilledTextField and MDCOutlinedTextField, are subclasses of UITextField, and can generally be used in the same ways as UITextField. The multi-line text fields, also known as text areas, include MDCFilledTextArea and MDCOutlinedTextArea. These classes are subclasses of UIControl that contain UITextViews. -- [Overview](#overview) -- [Installation](#installation) - - [Installation with CocoaPods](#installation-with-cocoapods) - - [Importing](#importing) -- [Usage](#usage) - - [Text fields](#text-fields) -- [Theming](#theming) - - [Theming](#theming) -- [Examples](#examples) - - [Creating a text field](#creating-a-text-field) +Because these classes make use of things like floating labels and assistive labels, their layout considerations are different than those of UITextField and UITextView. Where UITextField and UITextView can be whatever height a developer wants them to be, these classes have heights that they need to be in order to look correct. The process for ensuring that instances of these classes are sized correctly depends on whether one is in an Auto Layout or Manual Layout environment. In an Auto Layout environment, the text field or text area's preferred height will be reflected in `-intrinsicContentSize`, and the user will probably not have to do anything other than set a width constraint on the view to ensure that the preferred height is achieved. In a Manual Layout environment, standard methods like `-sizeThatFits:` or `-sizeToFit` must be used to inform the frames of the text field. These methods assume that the view already has a preferred width, and that any relevant APIs related to preferred number of lines have been set. -- - - - -## Overview - -At this time, the only text control we offer is the text field. There are three text field classes: - -
    - - -
  • MDCBaseTextField: An unstyled text field that the previous two inherit from
  • -
- -## Installation - - - -### Installation with CocoaPods - -Add any of the following to your `Podfile`, depending on which TextControl target you're interested in: +To make use of filled or outlined text fields or text areas, add any of the following targets to your Podfile: ```bash +pod 'MaterialComponents/TextControls+FilledTextAreas' pod 'MaterialComponents/TextControls+FilledTextFields' -pod 'MaterialComponents/TextControls+FilledTextFieldsTheming' +pod 'MaterialComponents/TextControls+OutlinedTextAreas' pod 'MaterialComponents/TextControls+OutlinedTextFields' -pod 'MaterialComponents/TextControls+OutlinedTextFieldsTheming' ``` @@ -60,102 +44,191 @@ Then, run the following command: pod install ``` -### Importing - -To use TextControls in your code, import the appropriate MaterialTextControls umbrella header (Objective-C) or MaterialComponents module (Swift). +From there, import the relevant target. #### Swift ```swift +import MaterialComponents.MaterialTextControls_FilledTextAreas import MaterialComponents.MaterialTextControls_FilledTextFields -import MaterialComponents.MaterialTextControls_FilledTextFieldsTheming +import MaterialComponents.MaterialTextControls_OutlinedTextAreas import MaterialComponents.MaterialTextControls_OutlinedTextFields -import MaterialComponents.MaterialTextControls_OutlinedTextFieldsTheming ``` #### Objective-C ```objc +#import "MaterialTextControls+FilledTextAreas.h" #import "MaterialTextControls+FilledTextFields.h" -#import "MaterialTextControls+FilledTextFieldsTheming.h" +#import "MaterialTextControls+OutlinedTextAreas.h" #import "MaterialTextControls+OutlinedTextFields.h" -#import "MaterialTextControls+OutlinedTextFieldsTheming.h" ``` +## Making text fields accessible +As mentioned above, MDCFilledTextField and MDCOutlinedTextField inherit from UITextField, and MDCFilledTextArea and MDCOutlinedTextArea contain UITextViews. Both UITextField and UITextView are accessible by default, and generally work out of the box with VoiceOver. The same is true for the text field and text area classes we provide. However, because they also make use of floating labels and assistive labels below the input text, their VoiceOver behavior is slightly different. If `accessibilityLabel` is _not_ explictly set on a text field or text area, the `accessibilityLabel` that VoiceOver reads is a concatenation of the floating label text, the entered text, and the assistive label text. If `accessibilityLabel` _is_ set, the screen reader will read whatever it is set to. If you would like fine-grained control over what VoiceOver reads for these classes it is probably best to set the `accessibilityLabel` yourself. -## Usage - - - -### Text fields - -The largest difference between MDCTextControl text fields and UITextFields from a usability standpoint relates to the sizing behavior of MDCTextControl text fields. Where UITextField can be whatever height a user wants it to be, MDCTextControl text fields have heights that they need to be in order to look correct. The process for ensuring that MDCTextControl text fields have their preferred heights depends on whether one is in an Auto Layout or Manual Layout environment. In an Auto Layout environment, the text field's preferred height will be reflected in `intrinsicContentSize`, and the user will not have to do anything other than set a width constraint on the text field to ensure that the preferred height is achieved. In a Manual Layout environment, standard methods like `sizeThatFits:` or `sizeToFit` must be used to inform the frames of the text field. These methods assume that the text field already has the preferred width. - +## Filled text fields -## Theming +[Filled text fields](https://material.io/components/text-fields/#filled-text-field) +have more visual emphasis than outlined text fields, making them stand out when +surrounded by other content and components. - +### Single-line filled text fields -### Theming +![Filled text field](docs/assets/filled-text-field.png) -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 text field theming extension and create a text field. +To set up a single-line filled text field using [MDCFilledTextField](https://github.com/material-components/material-components-ios/blob/develop/components/TextControls/src/FilledTextFields/MDCFilledTextField.h), do the following: #### Swift -```swift -import MaterialComponents.MaterialTextControls_OutlinedTextFieldsTheming -let textField = MDCOutlinedTextField() +```swift +let estimatedFrame = ... +let textField = MDCFilledTextField(frame: estimatedFrame) +textField.label.text = "Phone number" +textField.placeholder = "555-555-5555" +textField.leadingAssistiveLabel.text = "This is helper text" +textField.sizeToFit() +view.addSubview(textField) ``` #### Objective-C ```objc -#import - -MDCFilledTextField *filledTextField = [[MDCFilledTextField alloc] init]; +CGRect estimatedFrame = ... +MDCFilledTextField *textField = [[MDCFilledTextField alloc] initWithFrame:estimatedFrame]; +textField.label.text = @"Phone number"; +textField.placeholder = @"555-555-5555"; +textField.leadingAssistiveLabel.text = @"This is helper text"; +[textField sizeToFit]; +[view addSubview:textField]; ``` -Then pass a container scheme to one of the theming methods on the theming extension. +### Multi-line filled text fields + +![Filled text area](docs/assets/filled-text-area.png) + +To set up a multi-line filled text field (text area) using [MDCFilledTextArea](https://github.com/material-components/material-components-ios/blob/develop/components/TextControls/src/FilledTextAreas/MDCFilledTextArea.h), do the following: #### Swift + ```swift -filledTextField.applyTheme(withScheme: containerScheme) +let estimatedFrame = ... +let textArea = MDCFilledTextArea(frame: estimatedFrame) +textArea.label.text = "Label" +textArea.textView.text = "This is a filled text area with enough text to span two lines." +textArea.leadingAssistiveLabel.text = "This is helper text" +textArea.sizeToFit() +view.addSubview(textArea) ``` #### Objective-C + ```objc -[self.filledTextField applyThemeWithScheme:self.containerScheme]; +CGRect estimatedFrame = ... +MDCFilledTextArea *textArea = [[MDCFilledTextArea alloc] initWithFrame:estimatedFrame]; +textArea.label.text = @"Label"; +textArea.leadingAssistiveLabel.text = @"This is helper text"; +textArea.textView.text = @"This is a filled text area with enough text to span two lines."; +[textArea sizeToFit]; +[view addSubview:textArea]; ``` +### Anatomy and key properties + +A filled text field has a filled container, input text, a label, an activation indicator, optional helper/error text and optional leading/trailing icons. This applies to both text fields and text areas. + +![filled text field anatomy](docs/assets/filled-text-field-anatomy.png) + +1. Container +2. Leading icon +3. Label +4. Input text +5. Trailing icon +6. Activation indicator +7. Helper/error/counter text +8. Prefix/suffix/placeholder (not supported on iOS) + +#### Container attributes + +  | Attribute | Related method(s) | Default value +---------------------- | ------------------------ | --------------------------------------------------------------------------------------- | ------------- +**Color** | N/A | `-setFilledBackgroundColor:forState:`
`-filledBackgroundColorForState:` | On surface color at 12% opacity + +#### Leading icon attributes + +  | Attribute | Related method(s) | Default value +----------------------- | --------------------------------- | --------------------------------------------------------------------- | ------------- +**Icon** | `leadingView` | `-setLeadingView`
`-leadingView` | `nil` + +#### Label attributes + +  | Attribute | Related method(s) | Default value +------------------------------ | ------------------------ | ------------------------------------------------------- | ------------- +**Text** | `label.text` | N/A | `nil` +**Color** | `label.textColor` | `-setFloatingColor:forState:`
`-floatingLabelColorForState:`
`-setNormalLabelColor:forState:`
`-normalLabelColorForState:` | On surface color at 60% opacity when not editing and primary color when editing + +#### Input text attributes + +  | Attribute | Related method(s) | Default value +-------------------- | --------------------------- | ------------------------------------------------------------ | ------------- +**Input text** | `text` | `-setText:`
`-text` | `nil` +**Typography** | `font` | `-setFont:`
`-font` | Subtitle 1 +**Input text color** | `textColor` | `-setTextColor:`
`-textColor`
`-setTextColor:forState`
`-textColorForState:`
| On surface color at 87% opacity +**Cursor color** | `tintColor` | `-setTintColor:`
`-tintColor:` | Primary color + +#### Trailing icon attributes + +  | Attribute | Related method(s) | Default value +----------------------- | --------------------------------- | --------------------------------------------------------------------- | ------------- +**Icon** | `trailingView` | `-setTrailingView`
`-trailingView` | `nil` + +#### Activation indicator attributes + +  | Attribute | Related method(s) | Default value +----------------- | --------------------------- | ---------------------------------------------------------------------------- | ------------- +**Color** | N/A | `-setUnderlineColor:forState:`
`-underlineColorForState:` | On surface at 42% opacity when not editing and Primary when editing +#### Helper/error/counter text attributes +  | Attribute | Related method(s) | Default value +--------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ------------- +**Helper/Error text** | `leadingAssistiveLabel.text`
`trailingAssistiveLabel.text` | N/A | `nil` +**Helper/Error text color** | `leadingAssistiveLabel.textColor`
`trailingAssistiveLabel.textColor` | N/A | On Surface at 60% opacity +**Helper text typography** | `leadingAssistiveLabel.font`
`trailingAssistiveLabel.font` | N/A | Caption +#### Prefix/suffix attributes +Not supported. +## Outlined text fields -## Examples +[Outlined text fields](https://material.io/components/text-fields/#outlined-text-field) +have less visual emphasis than filled text fields. When they appear in places +like forms, where many text fields are placed together, their reduced emphasis +helps simplify the layout. - +### Single-line outlined text fields -### Creating a text field +![Outlined text field](docs/assets/outlined-text-field.png) + +To set up a single-line outlined text field using [MDCOutlinedTextField](https://github.com/material-components/material-components-ios/blob/develop/components/TextControls/src/OutlinedTextFields/MDCOutlinedTextField.h), do the following: #### Swift ```swift let estimatedFrame = ... -let textField = MDCFilledTextField(frame: estimatedFrame) -textField.label.text = "This is the floating label" +let textField = MDCOutlinedTextField(frame: estimatedFrame) +textField.label.text = "Phone number" +textField.placeholder = "555-555-5555" textField.leadingAssistiveLabel.text = "This is helper text" textField.sizeToFit() view.addSubview(textField) @@ -166,11 +239,180 @@ view.addSubview(textField) ```objc CGRect estimatedFrame = ... MDCOutlinedTextField *textField = [[MDCOutlinedTextField alloc] initWithFrame:estimatedFrame]; -textField.label.text = "This is the floating label"; -textField.leadingAssistiveLabel.text = "This is helper text"; +textField.label.text = @"Phone number"; +textField.placeholder = @"555-555-5555"; +textField.leadingAssistiveLabel.text = @"This is helper text"; [textField sizeToFit]; [view addSubview:textField]; ``` + + +### Multi-line Outlined text fields + +![Outlined text area](docs/assets/outlined-text-area.png) + +To set up a multi-line outlined text field (text area) using [MDCOutlinedTextArea](https://github.com/material-components/material-components-ios/blob/develop/components/TextControls/src/OutlinedTextAreas/MDCOutlinedTextArea.h), do the following: + + +#### Swift + +```swift +let estimatedFrame = ... +let textArea = MDCOutlinedTextArea(frame: estimatedFrame) +textArea.label.text = "Label" +textArea.leadingAssistiveLabel.text = "This is helper text" +textArea.textView.text = "This is an outlined text area with enough text to span two lines." +textArea.sizeToFit() +view.addSubview(textArea) +``` + +#### Objective-C + +```objc +CGRect estimatedFrame = ... +MDCOutlinedTextArea *textArea = [[MDCOutlinedTextArea alloc] initWithFrame:estimatedFrame]; +textArea.label.text = @"Label"; +textArea.leadingAssistiveLabel.text = @"This is helper text"; +textArea.textView.text = @"This is an outlined text area with enough text to span two lines."; +[textArea sizeToFit]; +[view addSubview:textArea]; +``` + + +### Anatomy and key properties + +An outlined text field has a stroked container, input text, a label, optional +helper/error text and optional leading/trailing icons. + +![outlined text field anatomy](docs/assets/outlined-text-field-anatomy.png) + +1. Container +2. Leading icon +3. Label +4. Input text +5. Trailing icon +6. Helper/error/counter text +7. Prefix/suffix/placeholder (not supported on iOS) + +The following examples shows a filled text field with a label. + +#### Container attributes + +  | Attribute | Related method(s) | Default value +---------------------- | ------------------------ | --------------------------------------------------------------------------------------- | ------------- +**Stroke color** | N/A | `-setOutlineColor:forState:`
`-outlineColorForState:` | On surface at 38% opacity when not editing and primary when editing + +#### Leading icon attributes + +  | Attribute | Related method(s) | Default value +----------------------- | --------------------------------- | --------------------------------------------------------------------- | ------------- +**Icon** | `leadingView` | `-setLeadingView`
`-leadingView` | `nil` + +#### Label attributes + +  | Attribute | Related method(s) | Default value +------------------------------ | ------------------------ | ------------------------------------------------------- | ------------- +**Text** | `label.text` | N/A | `nil` +**Color** | `label.textColor` | `-setFloatingColor:forState:`
`-floatingLabelColorForState:`
`-setNormalLabelColor:forState:`
`-normalLabelColorForState:` | On surface color at 60% opacity when not editing and primary color when editing + +#### Input text attributes + +  | Attribute | Related method(s) | Default value +-------------------- | --------------------------- | ------------------------------------------------------------ | ------------- +**Input text** | `text` | `-setText:`
`-text` | `nil` +**Typography** | `font` | `-setFont:`
`-font` | Subtitle 1 +**Input text color** | `textColor` | `-setTextColor:`
`-textColor`
`-setTextColor:forState`
`-textColorForState:`
| On surface color at 87% opacity +**Cursor color** | `tintColor` | `-setTintColor:`
`-tintColor:` | Primary color + +#### Trailing icon attributes + +  | Attribute | Related method(s) | Default value +----------------------- | --------------------------------- | --------------------------------------------------------------------- | ------------- +**Icon** | `trailingView` | `-setTrailingView`
`-trailingView` | `nil` + +#### Activation indicator attributes + +  | Attribute | Related method(s) | Default value +----------------- | --------------------------- | ---------------------------------------------------------------------------- | ------------- +**Color** | N/A | `-setUnderlineColor:forState:`
`-underlineColorForState:` | On surface at 42% opacity when not editing and Primary when editing + +#### Helper/error/counter text attributes + +  | Attribute | Related method(s) | Default value +--------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ------------- +**Helper/Error text** | `leadingAssistiveLabel.text`
`trailingAssistiveLabel.text` | N/A | `nil` +**Helper/Error text color** | `leadingAssistiveLabel.textColor`
`trailingAssistiveLabel.textColor` | N/A | On Surface at 60% opacity +**Helper text typography** | `leadingAssistiveLabel.font`
`trailingAssistiveLabel.font` | N/A | Caption + +#### Prefix/suffix attributes + +Not supported. + +### Theming text fields and text areas + +Text fields and text areas support Material Theming using a Container Scheme. The filled and outlined text fields and text areas each have default theming methods and theming methods intended to convey an error state. [Learn more about theming extensions](../../docs/theming.md). Below are some screenshots of filled and outlined text fields using the Shrine theme: + +![Shrine filled text field](docs/assets/shrine-filled-text-field.png) + +![Shrine outlined text field](docs/assets/shrine-outlined-text-field.png) + +### Cards theming example + +In order to achieve something like the examples shown above, import your desired theming target. + +```bash +pod 'MaterialComponents/TextControls+FilledTextAreasTheming' +pod 'MaterialComponents/TextControls+FilledTextFieldsTheming' +pod 'MaterialComponents/TextControls+OutlinedTextAreasTheming' +pod 'MaterialComponents/TextControls+OutlinedTextFieldsTheming' +``` + + +Then Run the installer. + +```bash +pod install +``` + +Next, import the appropriate theming target. + + +#### Swift + +```swift +import MaterialComponents.MaterialTextControls_FilledTextAreasTheming +import MaterialComponents.MaterialTextControls_FilledTextFieldsTheming +import MaterialComponents.MaterialTextControls_OutlinedTextAreasTheming +import MaterialComponents.MaterialTextControls_OutlinedTextFieldsTheming +``` + +#### Objective-C + +```objc +#import "MaterialTextControls+FilledTextAreasTheming.h" +#import "MaterialTextControls+FilledTextFieldsTheming.h" +#import "MaterialTextControls+OutlinedTextAreasTheming.h" +#import "MaterialTextControls+OutlinedTextFieldsTheming.h" +``` +From there, call either the default or the error theming method. + + +#### Objective-C + +```objc +MDCContainerScheme *containerScheme = ... // Set up a container scheme; +[textField applyThemeWithScheme:self.containerScheme]; // Default theming method +[textField applyErrorThemeWithScheme:self.containerScheme]; // Error theming method +``` + +#### Swift + +```swift +let containerScheme = ... // Set up a container scheme +textField.applyTheme(withScheme: self.containerScheme) // Default theming method +textField.applyErrorTheme(withScheme: self.containerScheme) // Error theming method +``` + diff --git a/components/TextControls/docs/assets/banner.png b/components/TextControls/docs/assets/banner.png deleted file mode 100644 index decf83d1f9a..00000000000 Binary files a/components/TextControls/docs/assets/banner.png and /dev/null differ diff --git a/components/TextControls/docs/assets/filled-text-area.png b/components/TextControls/docs/assets/filled-text-area.png new file mode 100644 index 00000000000..f2e537040b0 Binary files /dev/null and b/components/TextControls/docs/assets/filled-text-area.png differ diff --git a/components/TextControls/docs/assets/filled-text-field-anatomy.png b/components/TextControls/docs/assets/filled-text-field-anatomy.png new file mode 100644 index 00000000000..09d29714d56 Binary files /dev/null and b/components/TextControls/docs/assets/filled-text-field-anatomy.png differ diff --git a/components/TextControls/docs/assets/filled-text-field.png b/components/TextControls/docs/assets/filled-text-field.png new file mode 100644 index 00000000000..1d10ea5f27e Binary files /dev/null and b/components/TextControls/docs/assets/filled-text-field.png differ diff --git a/components/TextControls/docs/assets/outlined-text-area.png b/components/TextControls/docs/assets/outlined-text-area.png new file mode 100644 index 00000000000..ac9b6acdc1c Binary files /dev/null and b/components/TextControls/docs/assets/outlined-text-area.png differ diff --git a/components/TextControls/docs/assets/outlined-text-field-anatomy.png b/components/TextControls/docs/assets/outlined-text-field-anatomy.png new file mode 100644 index 00000000000..2cd20ee2ffa Binary files /dev/null and b/components/TextControls/docs/assets/outlined-text-field-anatomy.png differ diff --git a/components/TextControls/docs/assets/outlined-text-field.png b/components/TextControls/docs/assets/outlined-text-field.png new file mode 100644 index 00000000000..6acae0aad73 Binary files /dev/null and b/components/TextControls/docs/assets/outlined-text-field.png differ diff --git a/components/TextControls/docs/assets/shrine-filled-text-field.png b/components/TextControls/docs/assets/shrine-filled-text-field.png new file mode 100644 index 00000000000..381d969b632 Binary files /dev/null and b/components/TextControls/docs/assets/shrine-filled-text-field.png differ diff --git a/components/TextControls/docs/assets/shrine-outlined-text-field.png b/components/TextControls/docs/assets/shrine-outlined-text-field.png new file mode 100644 index 00000000000..33840c4a7cb Binary files /dev/null and b/components/TextControls/docs/assets/shrine-outlined-text-field.png differ diff --git a/components/TextControls/docs/assets/text-field-generic.png b/components/TextControls/docs/assets/text-field-generic.png new file mode 100644 index 00000000000..04c5250ee7e Binary files /dev/null and b/components/TextControls/docs/assets/text-field-generic.png differ diff --git a/components/TextFields/BUILD b/components/TextFields/BUILD deleted file mode 100644 index 9a14c799407..00000000000 --- a/components/TextFields/BUILD +++ /dev/null @@ -1,165 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_extension_objc_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", - "mdc_unit_test_swift_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - includes = ["src/private"], - visibility = [":test_targets"], -) - -package_group( - name = "test_targets", - packages = [ - "//components/Chips/...", - "//components/TextFields/...", - ], -) - -mdc_public_objc_library( - name = "TextFields", - sdk_frameworks = [ - "QuartzCore", - ], - deps = [ - "//components/AnimationTiming", - "//components/Buttons", - "//components/Elevation", - "//components/Palettes", - "//components/Typography", - "//components/private/Math", - ], -) - -mdc_extension_objc_library( - name = "Theming", - deps = [ - ":ColorThemer", - ":TextFields", - ":TypographyThemer", - "//components/schemes/Container", - ], -) - -mdc_extension_objc_library( - name = "ColorThemer", - deps = [ - ":TextFields", - "//components/Themes", - ], -) - -mdc_extension_objc_library( - name = "TypographyThemer", - deps = [ - ":TextFields", - "//components/schemes/Typography", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":ColorThemer", - ":TextFields", - ":Theming", - "//components/Buttons", - "//components/schemes/Container", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":ColorThemer", - ":TextFields", - ":Theming", - "//components/AppBar", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":ColorThemer", - ":TextFields", - ":TypographyThemer", - ":private", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - asset_catalogs = [ - "tests/snapshot/resources/TextFieldsSnapshotTests.xcassets/ic_done.imageset", - "tests/snapshot/resources/TextFieldsSnapshotTests.xcassets/ic_search.imageset", - ], - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - ":TextFields", - ":Theming", - "//components/Buttons", - "//components/Ripple", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - # Tests have sometimes taken more than 5 minutes to launch the simulator - # and execute - timeout = "long", - deps = ["snapshot_test_lib"], -) - -mdc_unit_test_swift_library( - name = "unit_test_swift_sources", - extra_srcs = glob([ - "tests/unit/Theming/*.swift", - ]), - deps = [ - ":ColorThemer", - ":TextFields", - ":Theming", - "//components/Palettes", - "//components/private/Math", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - # TODO (https://github.com/material-components/material-components-ios/issues/8249): Re-enable autobot environment. - use_autobot_environment_runner = False, - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources", - ], -) diff --git a/components/TextFields/README.md b/components/TextFields/README.md index 6b2ce8b34bb..52e35a8fb4f 100644 --- a/components/TextFields/README.md +++ b/components/TextFields/README.md @@ -1,13 +1,3 @@ - - # Text fields diff --git a/components/Themes/BUILD b/components/Themes/BUILD deleted file mode 100644 index ef0f8435622..00000000000 --- a/components/Themes/BUILD +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2017-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_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Themes", - deps = [ - "//components/schemes/Color", - "//components/schemes/Typography", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - ":Themes", - "//components/Palettes", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/Typography/BUILD b/components/Typography/BUILD deleted file mode 100644 index 2887028eb6f..00000000000 --- a/components/Typography/BUILD +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright 2017-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_examples_objc_library", - "mdc_examples_swift_library", - "mdc_objc_library", - "mdc_public_objc_library", - "mdc_snapshot_objc_library", - "mdc_snapshot_test", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Typography", - sdk_frameworks = [ - "QuartzCore", - ], - deps = [ - "//components/private/Application", - "//components/private/Math", - "@material_internationalization_ios//:MDFInternationalization", - ], -) - -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - visibility = ["//visibility:private"], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":Typography", - "//components/schemes/Typography", - ], -) - -mdc_examples_swift_library( - name = "SwiftExamples", - deps = [ - ":Typography", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":Typography", - ":private", - "//components/private/Application", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) - -mdc_snapshot_objc_library( - name = "snapshot_test_lib", - deps = [ - ":Typography", - ], -) - -mdc_snapshot_test( - name = "snapshot_tests", - deps = [ - ":snapshot_test_lib", - ], -) diff --git a/components/private/Application/BUILD b/components/private/Application/BUILD deleted file mode 100644 index 74ccaed191b..00000000000 --- a/components/private/Application/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2017-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_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Application", -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [":unit_test_sources"], -) diff --git a/components/private/Beta/BUILD b/components/private/Beta/BUILD deleted file mode 100644 index ac25908b82f..00000000000 --- a/components/private/Beta/BUILD +++ /dev/null @@ -1,26 +0,0 @@ -# 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. -# 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_public_objc_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Beta", -) diff --git a/components/private/Color/BUILD b/components/private/Color/BUILD deleted file mode 100644 index 6a143a59fe5..00000000000 --- a/components/private/Color/BUILD +++ /dev/null @@ -1,42 +0,0 @@ -# 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. -# 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_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Color", - deps = [ - "//components/Availability", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":Color", - "//components/private/Math", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [":unit_test_sources"], -) diff --git a/components/private/Dragons/BUILD b/components/private/Dragons/BUILD deleted file mode 100644 index 6dd569a801c..00000000000 --- a/components/private/Dragons/BUILD +++ /dev/null @@ -1,27 +0,0 @@ -# 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. -# 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_examples_swift_library") - -licenses(["notice"]) # Apache 2.0 - -mdc_examples_swift_library( - name = "Dragons", - resources = ["examples/resources/ZShadow.xib"], - deps = [ - "//components/ShadowLayer", - ], -) diff --git a/components/private/Icons/BUILD b/components/private/Icons/BUILD deleted file mode 100644 index d386f13cc33..00000000000 --- a/components/private/Icons/BUILD +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2017-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_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Icons", -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":Icons", - "//components/private/Icons/icons/ic_arrow_back", - "//components/private/Icons/icons/ic_check", - "//components/private/Icons/icons/ic_check_circle", - "//components/private/Icons/icons/ic_chevron_right", - "//components/private/Icons/icons/ic_color_lens", - "//components/private/Icons/icons/ic_help_outline", - "//components/private/Icons/icons/ic_info", - "//components/private/Icons/icons/ic_more_horiz", - "//components/private/Icons/icons/ic_radio_button_unchecked", - "//components/private/Icons/icons/ic_reorder", - "//components/private/Icons/icons/ic_settings", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/private/Icons/icons/ic_arrow_back/BUILD b/components/private/Icons/icons/ic_arrow_back/BUILD deleted file mode 100644 index 5ceb441e1a5..00000000000 --- a/components/private/Icons/icons/ic_arrow_back/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2017-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_public_objc_library") - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ic_arrow_back", - bundles = [":Bundle"], - sdk_frameworks = ["UIKit"], - deps = ["//components/private/Icons"], -) - -filegroup( - name = "BundleFiles", - srcs = glob(["src/MaterialIcons_ic_arrow_back.bundle/**"]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) diff --git a/components/private/Icons/icons/ic_check/BUILD b/components/private/Icons/icons/ic_check/BUILD deleted file mode 100644 index 946516fe710..00000000000 --- a/components/private/Icons/icons/ic_check/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2017-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_public_objc_library") - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ic_check", - bundles = [":Bundle"], - sdk_frameworks = ["UIKit"], - deps = ["//components/private/Icons"], -) - -filegroup( - name = "BundleFiles", - srcs = glob(["src/MaterialIcons_ic_check.bundle/**"]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) diff --git a/components/private/Icons/icons/ic_check_circle/BUILD b/components/private/Icons/icons/ic_check_circle/BUILD deleted file mode 100644 index 7ce90bfbeca..00000000000 --- a/components/private/Icons/icons/ic_check_circle/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2017-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_public_objc_library") - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ic_check_circle", - bundles = [":Bundle"], - sdk_frameworks = ["UIKit"], - deps = ["//components/private/Icons"], -) - -filegroup( - name = "BundleFiles", - srcs = glob(["src/MaterialIcons_ic_check_circle.bundle/**"]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) diff --git a/components/private/Icons/icons/ic_chevron_right/BUILD b/components/private/Icons/icons/ic_chevron_right/BUILD deleted file mode 100644 index 50f106bd589..00000000000 --- a/components/private/Icons/icons/ic_chevron_right/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2017-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_public_objc_library") - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ic_chevron_right", - bundles = [":Bundle"], - sdk_frameworks = ["UIKit"], - deps = ["//components/private/Icons"], -) - -filegroup( - name = "BundleFiles", - srcs = glob(["src/MaterialIcons_ic_chevron_right.bundle/**"]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) diff --git a/components/private/Icons/icons/ic_color_lens/BUILD b/components/private/Icons/icons/ic_color_lens/BUILD deleted file mode 100644 index 104eebbb1b5..00000000000 --- a/components/private/Icons/icons/ic_color_lens/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2018-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_public_objc_library") - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ic_color_lens", - bundles = [":Bundle"], - sdk_frameworks = ["UIKit"], - deps = ["//components/private/Icons"], -) - -filegroup( - name = "BundleFiles", - srcs = glob(["src/MaterialIcons_ic_color_lens.bundle/**"]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) diff --git a/components/private/Icons/icons/ic_help_outline/BUILD b/components/private/Icons/icons/ic_help_outline/BUILD deleted file mode 100644 index d8ff8df5ef8..00000000000 --- a/components/private/Icons/icons/ic_help_outline/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2018-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_public_objc_library") - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ic_help_outline", - bundles = [":Bundle"], - sdk_frameworks = ["UIKit"], - deps = ["//components/private/Icons"], -) - -filegroup( - name = "BundleFiles", - srcs = glob(["src/MaterialIcons_ic_help_outline.bundle/**"]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) diff --git a/components/private/Icons/icons/ic_info/BUILD b/components/private/Icons/icons/ic_info/BUILD deleted file mode 100644 index 02450eae663..00000000000 --- a/components/private/Icons/icons/ic_info/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2017-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_public_objc_library") - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ic_info", - bundles = [":Bundle"], - sdk_frameworks = ["UIKit"], - deps = ["//components/private/Icons"], -) - -filegroup( - name = "BundleFiles", - srcs = glob(["src/MaterialIcons_ic_info.bundle/**"]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) diff --git a/components/private/Icons/icons/ic_more_horiz/BUILD b/components/private/Icons/icons/ic_more_horiz/BUILD deleted file mode 100644 index 69e08c7f748..00000000000 --- a/components/private/Icons/icons/ic_more_horiz/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2018-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_public_objc_library") - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ic_more_horiz", - bundles = [":Bundle"], - sdk_frameworks = ["UIKit"], - deps = ["//components/private/Icons"], -) - -filegroup( - name = "BundleFiles", - srcs = glob(["src/MaterialIcons_ic_more_horiz.bundle/**"]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) diff --git a/components/private/Icons/icons/ic_radio_button_unchecked/BUILD b/components/private/Icons/icons/ic_radio_button_unchecked/BUILD deleted file mode 100644 index e2273e7d31e..00000000000 --- a/components/private/Icons/icons/ic_radio_button_unchecked/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2017-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_public_objc_library") - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ic_radio_button_unchecked", - bundles = [":Bundle"], - sdk_frameworks = ["UIKit"], - deps = ["//components/private/Icons"], -) - -filegroup( - name = "BundleFiles", - srcs = glob(["src/MaterialIcons_ic_radio_button_unchecked.bundle/**"]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) diff --git a/components/private/Icons/icons/ic_reorder/BUILD b/components/private/Icons/icons/ic_reorder/BUILD deleted file mode 100644 index ffa5796a089..00000000000 --- a/components/private/Icons/icons/ic_reorder/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2017-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_public_objc_library") - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ic_reorder", - bundles = [":Bundle"], - sdk_frameworks = ["UIKit"], - deps = ["//components/private/Icons"], -) - -filegroup( - name = "BundleFiles", - srcs = glob(["src/MaterialIcons_ic_reorder.bundle/**"]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) diff --git a/components/private/Icons/icons/ic_settings/BUILD b/components/private/Icons/icons/ic_settings/BUILD deleted file mode 100644 index 1adad829cb4..00000000000 --- a/components/private/Icons/icons/ic_settings/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2018-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_public_objc_library") - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ic_settings", - bundles = [":Bundle"], - sdk_frameworks = ["UIKit"], - deps = ["//components/private/Icons"], -) - -filegroup( - name = "BundleFiles", - srcs = glob(["src/MaterialIcons_ic_settings.bundle/**"]), -) - -objc_bundle( - name = "Bundle", - bundle_imports = [":BundleFiles"], -) diff --git a/components/private/KeyboardWatcher/BUILD b/components/private/KeyboardWatcher/BUILD deleted file mode 100644 index 35671057398..00000000000 --- a/components/private/KeyboardWatcher/BUILD +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2017-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_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "KeyboardWatcher", - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - "//components/private/Application", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":KeyboardWatcher", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - size = "small", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/private/Math/BUILD b/components/private/Math/BUILD deleted file mode 100644 index 38fdbe7f53f..00000000000 --- a/components/private/Math/BUILD +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2017-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_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Math", -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - ":Math", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/private/Overlay/BUILD b/components/private/Overlay/BUILD deleted file mode 100644 index 3de478c1dbb..00000000000 --- a/components/private/Overlay/BUILD +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2017-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_objc_library", - "mdc_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Overlay", - sdk_frameworks = [ - "QuartzCore", - "CoreGraphics", - ], -) - -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - visibility = ["//visibility:private"], -) - -mdc_objc_library( - name = "unit_test_sources", - deps = [ - ":Overlay", - ":private", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/private/Snapshot/BUILD b/components/private/Snapshot/BUILD deleted file mode 100644 index 14c61900968..00000000000 --- a/components/private/Snapshot/BUILD +++ /dev/null @@ -1,66 +0,0 @@ -# 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. -# 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", - "mdc_objc_library", - "mdc_swift_library", - "mdc_public_objc_library", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_objc_library( - name = "SnapshotSourceDummies", - srcs = native.glob([ - "src/SourceDummies/*.h", - "src/SourceDummies/*.m", - ]), -) - -mdc_swift_library( - name = "SnapshotSwiftLib", - srcs = glob(["src/*.swift"]), - copts = [ - "-swift-version", - "4.2", - ], -) - -mdc_extension_objc_library( - name = "SnapshotUtilities", - testonly = 1, - visibility = ["//visibility:public"], -) - -mdc_extension_objc_library( - name = "SnapshotTestCase", - testonly = 1, - visibility = ["//visibility:private"], - deps = [ - "@ios_snapshot_test_case//:SnapshotTestCase", - ], -) - -mdc_public_objc_library( - name = "Snapshot", - testonly = 1, - deps = [ - ":SnapshotSourceDummies", - ":SnapshotSwiftLib", - ":SnapshotTestCase", - ":SnapshotUtilities", - ], -) diff --git a/components/private/Snapshot/TestHost/BUILD b/components/private/Snapshot/TestHost/BUILD deleted file mode 100644 index dae7163d74b..00000000000 --- a/components/private/Snapshot/TestHost/BUILD +++ /dev/null @@ -1,39 +0,0 @@ -# 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. -# 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("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") -load("//:material_components_ios.bzl", "mdc_objc_library") - -licenses(["notice"]) # Apache 2.0 - -mdc_objc_library( - name = "test_host_lib", - srcs = native.glob([ - "src/*.m", - ]), - hdrs = native.glob([ - "src/*.h", - ]), - enable_modules = 1, -) - -ios_application( - name = "TestHost", - testonly = 1, - bundle_id = "io.material.ios.snapshot", - families = ["iphone"], - infoplists = ["TestHost-Info.plist"], - minimum_os_version = "10.0.0", - visibility = ["//components:__subpackages__"], - deps = [":test_host_lib"], -) diff --git a/components/private/TextControlsPrivate/BUILD b/components/private/TextControlsPrivate/BUILD deleted file mode 100644 index 075b47ecf9d..00000000000 --- a/components/private/TextControlsPrivate/BUILD +++ /dev/null @@ -1,90 +0,0 @@ -# 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/Availability", - "//components/private/Math", - ], -) - -mdc_extension_objc_library( - name = "OutlinedStyle", - sdk_frameworks = [ - "QuartzCore", - ], - visibility = [ - "//components/TextControls:TextControlsPackageGroup", - ], - deps = [ - ":Shared", - "//components/AnimationTiming", - "//components/Availability", - "//components/private/Math", - ], -) diff --git a/components/private/ThumbTrack/BUILD b/components/private/ThumbTrack/BUILD deleted file mode 100644 index baf24384e20..00000000000 --- a/components/private/ThumbTrack/BUILD +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright 2017-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_objc_library", - "mdc_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ThumbTrack", - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - "//components/Availability", - "//components/Ink", - "//components/Ripple", - "//components/ShadowElevations", - "//components/ShadowLayer", - "//components/Typography", - "//components/private/Math", - "@material_internationalization_ios//:MDFInternationalization", - ], -) - -mdc_objc_library( - name = "private_headers", - testonly = 1, - hdrs = native.glob(["src/private/*.h"]), - visibility = ["//visibility:private"], - deps = [":ThumbTrack"], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":ThumbTrack", - ":private_headers", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/private/UIMetrics/BUILD b/components/private/UIMetrics/BUILD deleted file mode 100644 index 373ca21fc63..00000000000 --- a/components/private/UIMetrics/BUILD +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2017-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_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "UIMetrics", - deps = [ - "//components/private/Application", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [":UIMetrics"], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [":unit_test_sources"], -) diff --git a/components/schemes/Color/BUILD b/components/schemes/Color/BUILD deleted file mode 100644 index 76eee920208..00000000000 --- a/components/schemes/Color/BUILD +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 2018-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_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Color", - deps = [ - "//components/Availability", - "//components/private/Color", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - ":Color", - "//components/Palettes", - "//components/private/Math", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/schemes/Container/BUILD b/components/schemes/Container/BUILD deleted file mode 100644 index 7b4060c9457..00000000000 --- a/components/schemes/Container/BUILD +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2018-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_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Container", - deps = [ - "//components/schemes/Color", - "//components/schemes/Shape", - "//components/schemes/Typography", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - deps = [ - ":Container", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/schemes/Shape/BUILD b/components/schemes/Shape/BUILD deleted file mode 100644 index 699c337b656..00000000000 --- a/components/schemes/Shape/BUILD +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright 2018-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_examples_objc_library", - "mdc_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Shape", - deps = [ - "//components/ShapeLibrary", - ], -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - "//components/AppBar", - "//components/AppBar:ColorThemer", - "//components/AppBar:TypographyThemer", - "//components/BottomSheet", - "//components/BottomSheet:ShapeThemer", - "//components/Buttons", - "//components/Buttons:ButtonThemer", - "//components/Buttons:ShapeThemer", - "//components/Buttons:Theming", - "//components/Cards", - "//components/Cards:ShapeThemer", - "//components/Cards:Theming", - "//components/Chips", - "//components/Chips:Theming", - "//components/ShapeLibrary", - "//components/schemes/Color", - "//components/schemes/Container", - "//components/schemes/Shape", - "//components/schemes/Typography", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - ":Shape", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) diff --git a/components/schemes/Typography/BUILD b/components/schemes/Typography/BUILD deleted file mode 100644 index cb85a73ff47..00000000000 --- a/components/schemes/Typography/BUILD +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright 2018-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_examples_objc_library", - "mdc_extension_objc_library", - "mdc_public_objc_library", - "mdc_unit_test_objc_library", - "mdc_unit_test_suite", -) - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "Typography", - deps = [ - ":BasicFontScheme", - ":Scheming", - "//components/Typography", - ], -) - -mdc_extension_objc_library( - name = "Scheming", -) - -mdc_extension_objc_library( - name = "BasicFontScheme", -) - -mdc_examples_objc_library( - name = "ObjcExamples", - deps = [ - ":Typography", - "//components/Typography", - "//components/schemes/Color", - ], -) - -mdc_unit_test_objc_library( - name = "unit_test_sources", - sdk_frameworks = [ - "CoreGraphics", - ], - deps = [ - ":Typography", - ], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - "//components/Typography", - ], -) diff --git a/components/testing/runners/BUILD b/components/testing/runners/BUILD deleted file mode 100644 index c87e13b29b2..00000000000 --- a/components/testing/runners/BUILD +++ /dev/null @@ -1,51 +0,0 @@ -load("@build_bazel_rules_apple//apple/testing/default_runner:ios_test_runner.bzl", "ios_test_runner") - -ios_test_runner( - name = "IPHONE_5_IN_8_1", - device_type = "iPhone 5", - os_version = "8.1", - visibility = ["//visibility:public"], -) - -ios_test_runner( - name = "IPAD_PRO_12_9_IN_9_3", - device_type = "iPad Pro (12.9-inch)", - os_version = "9.3", - visibility = ["//visibility:public"], -) - -ios_test_runner( - name = "IPHONE_7_IN_11_2", - device_type = "iPhone 7", - os_version = "11.2", - visibility = ["//visibility:public"], -) - -ios_test_runner( - name = "IPHONE_7_PLUS_IN_10_3", - device_type = "iPhone 7 Plus", - os_version = "10.3", - visibility = ["//visibility:public"], -) - -ios_test_runner( - name = "IPHONE_X_IN_11_0", - device_type = select({ - ":xcode_9_0": "iPhone2017-C", - "//conditions:default": "iPhone X", - }), - os_version = "11.0", - visibility = ["//visibility:public"], -) - -ios_test_runner( - name = "IPHONE_8_IN_13_0", - device_type = "iPhone 8", - os_version = "13.0", - visibility = ["//visibility:public"], -) - -native.config_setting( - name = "xcode_9_0", - values = {"xcode_version": "9.0"}, -) diff --git a/contributing/bazel_kokoro.md b/contributing/bazel_kokoro.md deleted file mode 100644 index 8b64f8785e6..00000000000 --- a/contributing/bazel_kokoro.md +++ /dev/null @@ -1,191 +0,0 @@ -# Bazel and Kokoro support for MDC iOS - -[Bazel](https://bazel.build/) is Google's open source build infrastructure. Kokoro is Google's -continuous integration infrastructure, presently visible -[only to Googlers](http://kokoro.corp.google.com/job/MaterialComponents_iOS/job/macos_external/). - -Kokoro, like Travis CI, will run continuous integration on the latest commits to develop as -well as presubmit checks on pull requests. The entry-point for the kokoro continuous integration -script is the `.kokoro` script in the root of the repo. - -## Running kokoro presubmits locally - -First, ensure that you have [installed bazel 0.20](https://docs.bazel.build/versions/master/install-os-x.html#install-with-installer-mac-os-x) using [the binary installer from the Release page](https://github.com/bazelbuild/bazel/releases/tag/0.20.0) (not Homebrew) -and at least one version of Xcode. - -Run the following command from the root of your MDC-iOS repo to run the presubmits: - -``` -./.kokoro -``` - -The presubmit script will build and run unit tests against every version of Xcode installed on your -local machine. The results of the unit tests will be reported to the console. - -## Module import statements - -When bazel generates modules for use in Swift, module names follow the convention of -`path_to_component_component`. For example, ActivityIndicator would need to be imported like so in a -swift file: - -```swift -import components_ActivityIndicator_ActivityIndicator -``` - -However, because we primarily support CocoaPods for public use, we write our import statements like -so in the committed code: - -```swift -import MaterialComponents.MaterialActivityIndicator -``` - -The `.kokoro` script has a pre/post phase where it will translate between the CocoaPods-supported -import statements and the bazel-supported import statements. - -> Note that the kokoro script can only translate import statements that specify the component name. -> Import statements like the following will need to be updated to use the more specific -> `MaterialComponents.Material` pattern: -> -> import MaterialComponents - -## BUILD files - -In order for a component to be included in the kokoro presubmits it must have a `BUILD` file. This -file must be located in the root of the component's folder: - -``` -components/ - ActivityIndicator/ - BUILD -``` - -### Minimal BUILD template - -For a component written in Objective-C with only Objective-C tests and no resources or dependencies. - -``` -load("//:material_components_ios.bzl", - "mdc_public_objc_library", - "mdc_objc_library", - "mdc_unit_test_suite") - -licenses(["notice"]) # Apache 2.0 - -mdc_public_objc_library( - name = "ComponentName", - sdk_frameworks = [ - "QuartzCore", - "UIKit", - ], -) - -mdc_objc_library( - name = "unit_test_sources", - testonly = 1, - srcs = glob(["tests/unit/*.m"]), - hdrs = glob(["tests/unit/*.h"]), - sdk_frameworks = [ - "UIKit", - "XCTest", - ], - deps = [":ComponentName"], - visibility = ["//visibility:private"], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ], -) -``` - -### Adding dependencies - -Dependencies are added as paths relative to the root of the MDC iOS repo: - -``` -mdc_public_objc_library( - name = "ComponentName", - deps = ["//components/Palettes"], -) - -``` - -### Adding a Bundle - -If your component depends on non-source resources, you can add a bundle target to your component -with the following additions: - -``` -load("//tools/build_defs/apple:resources.bzl", "apple_bundle_import") - -mdc_public_objc_library( - name = "ComponentName", - data = [":Bundle"], -) - -apple_bundle_import( - name = "Bundle", - bundle_imports = glob([ - "src/ComponentName.bundle/**", - ]), -) -``` - -### Exposing private APIs to unit tests - -You can export private APIs such that they are only visible to unit test targets using `filegroup` -rules: - -``` -mdc_objc_library( - name = "private", - hdrs = native.glob(["src/private/*.h"]), - deps = [":Ink"], - includes = ["src/private"], - visibility = [":test_targets"], -) - -package_group( - name = "test_targets", - packages = [ - "//components/ComponentName/...", - ], -) - -mdc_objc_library( - name = "unit_test_sources", - testonly = 1, - srcs = glob(["tests/unit/*.m"]), - hdrs = glob(["tests/unit/*.h"]), - sdk_frameworks = [ - "UIKit", - "XCTest", - ], - deps = [ - ":ComponentName", - ":private" - ], - visibility = ["//visibility:private"], -) -``` - -### Adding Swift unit tests - -``` -mdc_swift_library( - name = "unit_test_swift_sources", - srcs = glob(["tests/unit/*.swift"]), - deps = [":ComponentName"], - visibility = ["//visibility:private"], -) - -mdc_unit_test_suite( - name = "unit_tests", - deps = [ - ":unit_test_sources", - ":unit_test_swift_sources" - ], -) -``` diff --git a/contributing/checklist.md b/contributing/checklist.md index 8c950ebb445..6b8129d0413 100644 --- a/contributing/checklist.md +++ b/contributing/checklist.md @@ -167,15 +167,6 @@ Unit tests in MDC are run by the developer, the continuous integration service, 1. Ensure unit tests run with no errors. 1. Enter YES or NO -### Kokoro Support - - -MDC-iOS uses Google's continuous integration service Kokoro for automated tests on each PR. Kokoro builds MDC with Google's open source build system, [Bazel](https://bazel.build/). For more information, see the [Kokoro & Bazel document](bazel_kokoro.md). - -1. Add a Bazel `BUILD` file to the root directory of the component. -1. Add `BUILD` files for any components that are dependencies of the component. (If necessary.) -1. Test locally with the .kokoro script in the repo's root directory. If necessary, propose adjustments to the script to support custom features of your target (like a private dependency.) -1. Enter YES or NO ### Translations (If necessary) diff --git a/demos/supplemental/RemoteImageServiceForMDCDemos.podspec b/demos/supplemental/RemoteImageServiceForMDCDemos.podspec index 90e125394a4..f875dd21bac 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 = "108.1.0" + s.version = "109.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/material_components_ios.bzl b/material_components_ios.bzl deleted file mode 100644 index 9f1c8c271b6..00000000000 --- a/material_components_ios.bzl +++ /dev/null @@ -1,386 +0,0 @@ -"""Bazel macros for building MDC component libraries.""" - -load("@bazel_ios_warnings//:strict_warnings_objc_library.bzl", "strict_warnings_objc_library") -load("@build_bazel_rules_apple//apple/testing/default_runner:ios_test_runner.bzl", "ios_test_runner") -load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test", "ios_unit_test_suite") -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -IOS_MINIMUM_OS = "9.0" -SNAPSHOT_IOS_MINIMUM_OS = "10.0" -SWIFT_VERSION = "4.2" - -DEFAULT_IOS_RUNNER_TARGETS = [ - "//components/testing/runners:IPAD_PRO_12_9_IN_9_3", - "//components/testing/runners:IPHONE_7_PLUS_IN_10_3", -] - -KOKORO_ENVIRONMENT_IOS_RUNNER_TARGET = "//components/testing/runners:IPHONE_X_IN_11_0" -AUTOBOT_ENVIRONMENT_IOS_RUNNER_TARGET = "//components/testing/runners:IPHONE_8_IN_13_0" - -SNAPSHOT_IOS_RUNNER_TARGET = "//components/testing/runners:IPHONE_7_IN_11_2" - -def mdc_objc_library( - name, - copts = [], - **kwargs): - """Declare an Objective-C library with strict_warnings_objc_library.""" - strict_warnings_objc_library( - name = name, - copts = copts, - **kwargs) - -def mdc_swift_library(name, **kwargs): - """Declare a Swift library that supports CocoaPods-style imports.""" - _mdc_cocoapods_compatible_swift_library( - name = name, - **kwargs) - -def mdc_public_objc_library( - name, - deps = [], - extra_srcs = [], - sdk_frameworks = [], - visibility = ["//visibility:public"], - **kwargs): - """Declare a public MDC component as a Objective-C library according to MDC's conventions. - - The conventions for an MDC component are: - - The public implementation lives inside of src. - - The private implementation lives inside of src/private. - - The default visibility of "//visibility:public" can be overridden, for - example, "//some/package:__subpackages__". - - Args: - name: The name of the library. - deps: The dependencies of the library. - extra_srcs: Extra sources to add to the standard ones. - sdk_frameworks: The SDK frameworks needed, e.g. "CoreGraphics". - visibility: The visibility of the package. - **kwargs: Any arguments accepted by _mdc_objc_library(). - """ - mdc_objc_library( - name = name, - deps = deps, - sdk_frameworks = sdk_frameworks, - visibility = visibility, - srcs = native.glob(["src/*.m", "src/private/*.h", "src/private/*.m"]) + extra_srcs, - hdrs = native.glob(["src/*.h"]), - includes = ["src"], - enable_modules = 1, - **kwargs) - -def mdc_extension_objc_library( - name, - deps = [], - sdk_frameworks = [], - visibility = ["//visibility:public"], - **kwargs): - """Declare a public MDC component extension as an Objective-C library according to MDC's - conventions. - - The conventions for an MDC component extension are: - - The public implementation lives in `src/$name/`. - - The private implementation lives in `src/$name/private`. - - The default visibility can be overridden. - - Args: - name: The name of the extension. It must match the folder it resides in. - deps: The dependencies of the extension. - sdk_frameworks: Extra SDK frameworks (e.g., CoreGraphics) required by the extension. - visibility: The visibility of the extension. - **kwarrgs: Any arguments accepted by _mdc_objc_library(). - """ - mdc_objc_library( - name = name, - deps = deps, - sdk_frameworks = sdk_frameworks, - visibility = visibility, - srcs = native.glob([ - "src/" + name + "/*.m", - "src/" + name + "/private/*.m", - "src/" + name + "/private/*.h", - ]), - hdrs = native.glob(["src/" + name + "/*.h"]), - includes = ["src/" + name], - enable_modules = 1, - **kwargs) - -def mdc_examples_objc_library( - name, - deps = [], - sdk_frameworks = [], - visibility = ["//visibility:public"], - **kwargs): - """Declare an MDC component examples target as an Objective-C library according to MDC's - conventions. - - The conventions for MDC component examples are: - - The source lives in `examples/` and `examples/supplemental/`. - - The default visibility can be overridden. - - Args: - name: The name of the examples target. - deps: The examples dependencies. - sdk_frameworks: Extra SDK frameworks (e.g., CoreGraphics) required by the examples. - visibility: The visibility of the examples. - **kwarrgs: Any arguments accepted by _mdc_objc_library(). - """ - mdc_objc_library( - name = name, - deps = deps, - sdk_frameworks = sdk_frameworks, - visibility = visibility, - srcs = native.glob([ - "examples/*.m", - "examples/*.h", - "examples/supplemental/*.m", - "examples/supplemental/*.h", - ]), - enable_modules = 1, - **kwargs) - -def mdc_examples_swift_library( - name, - deps = [], - visibility = ["//visibility:public"], - **kwargs): - """Declare an MDC component examples target as a Swift library according to MDC's - conventions. - - The conventions for MDC component examples are: - - The source lives in `examples/` and `examples/supplemental/`. - - The default visibility can be overridden. - - Args: - name: The name of the examples target. - deps: The examples dependencies. - visibility: The visibility of the examples. - **kwarrgs: Any arguments accepted by _mdc_objc_library(). - """ - _mdc_cocoapods_compatible_swift_library( - name = name, - deps = deps, - visibility = visibility, - copts = [ - "-swift-version", - "4.2", - ], - srcs = native.glob([ - "examples/*.swift", - "examples/supplemental/*.swift", - ]), - **kwargs) - -def mdc_unit_test_objc_library( - name, - extra_srcs = [], - deps = [], - sdk_frameworks = [], - visibility = ["//visibility:private"], - testonly = 1, - **kwargs): - """Declare an mdc_objc_library for unit test sources.""" - mdc_objc_library( - name = name, - srcs = native.glob([ - "tests/unit/*.m", - "tests/unit/*.h", - ]) + extra_srcs, - deps = deps, - sdk_frameworks = ["XCTest"] + sdk_frameworks, - visibility = visibility, - testonly = testonly, - **kwargs) - -def mdc_unit_test_swift_library( - name, - extra_srcs = [], - deps = [], - visibility = ["//visibility:private"], - testonly = 1, - **kwargs): - """Declare a swift_library for unit test sources.""" - _mdc_cocoapods_compatible_swift_library( - name = name, - srcs = native.glob(["tests/unit/*.swift"]) + extra_srcs, - deps = deps, - visibility = visibility, - testonly = testonly, - copts = [ - "-swift-version", - SWIFT_VERSION, - ], - **kwargs) - -def mdc_snapshot_objc_library( - name, - extra_srcs = [], - deps = [], - sdk_frameworks = [], - visibility = ["//visibility:private"], - testonly = 1, - **kwargs): - """Declare an mdc_objc_library for snapshot test source.""" - mdc_objc_library( - name = name, - srcs = native.glob([ - "tests/snapshot/*.m", - "tests/snapshot/*.h", - "tests/snapshot/supplemental/*.m", - "tests/snapshot/supplemental/*.h", - ]) + extra_srcs, - deps = ["//components/private/Snapshot"] + deps, - sdk_frameworks = ["XCTest", "CoreGraphics"] + sdk_frameworks, - visibility = visibility, - testonly = testonly, - **kwargs) - -def mdc_snapshot_swift_library( - name, - extra_srcs = [], - deps = [], - visibility = ["//visibility:private"], - testonly = 1, - **kwargs): - """Declare a swift_library for snapshot test source.""" - _mdc_cocoapods_compatible_swift_library( - name = name, - srcs = native.glob(["tests/snapshot/*.swift"]) + extra_srcs, - deps = ["//components/private/Snapshot"] + deps, - visibility = visibility, - testonly = testonly, - copts = [ - "-swift-version", - SWIFT_VERSION, - ], - **kwargs) - -def mdc_snapshot_test( - name, - deps = [], - minimum_os_version = SNAPSHOT_IOS_MINIMUM_OS, - visibility = ["//visibility:private"], - size = "medium", - tags = ["exclusive"], - **kwargs): - """Declare an MDC ios_unit_test for snapshot tests.""" - ios_unit_test( - name = name, - deps = deps, - minimum_os_version = minimum_os_version, - runner = SNAPSHOT_IOS_RUNNER_TARGET, - tags = tags, - test_host = "//components/private/Snapshot/TestHost", - visibility = visibility, - # TODO(https://github.com/material-components/material-components-ios/issues/6335) - flaky = 1, - size = size, - **kwargs) - -def mdc_ci_config_setting(): - """Config setting for mdc continuous integration, e.g. --define ci_mode=kokoro""" - native.config_setting( - name = "kokoro", - values = {"define": "ci_mode=kokoro"}, - ) - native.config_setting( - name = "autobot", - values = {"define": "ci_mode=autobot"}, - ) - -def mdc_unit_test_suite( - name, - deps = [], - minimum_os_version = IOS_MINIMUM_OS, - visibility = ["//visibility:private"], - size = "medium", - use_autobot_environment_runner = True, - **kwargs): - """Declare a MDC unit_test_suite and a unit_test_environment using the ios_runners matrix. - - Args: - name: The name of the target. - deps: The dependencies of the target. - minimum_os_version: The minimum iOS version supported by the target. - visibility: The visibility of the package. - size: The size of the test. - use_autobot_environment_runner: Indicates whether autobot (a testing machine) environment runner should be used. - **kwargs: Any arguments accepted by ios_unit_test(). - """ - mdc_ci_config_setting() - runners = list(DEFAULT_IOS_RUNNER_TARGETS) - if use_autobot_environment_runner: - ios_unit_test( - name = name + '_environment', - deps = deps, - minimum_os_version = minimum_os_version, - runner = select({ - ":kokoro": KOKORO_ENVIRONMENT_IOS_RUNNER_TARGET, - ":autobot": AUTOBOT_ENVIRONMENT_IOS_RUNNER_TARGET, - "//conditions:default": KOKORO_ENVIRONMENT_IOS_RUNNER_TARGET, - }), - visibility = visibility, - size = size, - **kwargs) - else: - runners.append(KOKORO_ENVIRONMENT_IOS_RUNNER_TARGET) - ios_unit_test_suite( - name = name, - deps = deps, - minimum_os_version = minimum_os_version, - runners = runners, - visibility = visibility, - size = size, - **kwargs - ) - -# The bazel target for the tool we use to rewrite import statements. -BAZEL_IMPORT_REWRITER = "//scripts/bazel_import_rewriter" - -def _mdc_cocoapods_compatible_swift_library( - name, - srcs, - **kwargs): - """Internal Swift library rule for CocoaPods compatibility. - - Rewrites the provided source files to use Bazel-style imports. - - This rule is a drop-in replacement for swift_library. - - Args: - name: The name of the target. - srcs: The source Swift files for this library. - **kwarrgs: Any arguments to be passed to swift_library. - """ - cocoapods_compatible_srcs_target_name = name + "_cocoapods_compatible_srcs" - - # First, map all of the srcs to their outs. - bazel_import_srcs = [] - for src in srcs: - bazel_import_srcs.append(src.replace(".swift", ".bazel_imports.swift")) - - # Then, create an intermediary rule that transforms all of the srcs files. - # Note that we provide the srcs and outs as a concatenated list of args. - # E.g. if srcs is ['src1.swift', 'src2.swift'], - # then outs is ['src1.bazel_imports.swift', 'src2.bazel_imports.swift'] - # and the command invocation is: - # - # $cmd src1.swift src2.swift src1.bazel_imports.swift src2.bazel_imports.swift - # - native.genrule( - name = cocoapods_compatible_srcs_target_name, - srcs = srcs, - outs = bazel_import_srcs, - cmd = "$(location %s) $(SRCS) $(OUTS)" % BAZEL_IMPORT_REWRITER, - tools = [BAZEL_IMPORT_REWRITER], - ) - - # And finally, define our swift_library with the `srcs` swapped for our generated srcs. - swift_library( - name = name, - srcs = [":" + cocoapods_compatible_srcs_target_name], - **kwargs) diff --git a/scripts/affected_targets b/scripts/affected_targets deleted file mode 100755 index b1df1cf97e2..00000000000 --- a/scripts/affected_targets +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash -# -# Copyright 2018-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. -# -# Finds all targets of a given kind affected by changes in a given commit range. - -SCRIPT_NAME=$(basename "$0") - -# bazel_kind should be a bazel `kind` type. E.g. test or rule. -# https://docs.bazel.build/versions/master/query.html#kind -bazel_kind="$1" - -# range should be a valid git diff/log range. E.g. origin/develop...HEAD -range="$2" - -if [ -z "$bazel_kind" ]; then - echo "Please provide a blaze rule kind to query for." - exit 1 -fi - -if [ -z "$range" ]; then - echo "Please provide a diff range." - exit 1 -fi - -if [ $(git branch --list "$TARGET_BRANCH") ]; then - base_sha=$(git merge-base "$TARGET_BRANCH" HEAD) -else - base_sha="HEAD^" -fi - -# Generates a list of files that were modified within $range. -modified_files() { - git diff --name-only "$range" \ - | grep -vE '^[0-9a-f]{40} ' \ - | sort \ - | uniq -} - -# Reads a list of files and generates a list of files that will affect the entire -# build system. -files_that_affect_everything() { - grep -e "\.bzl$" \ - -e "WORKSPACE" \ - -e "\.bazelversion" \ - -e "\.kokoro" \ - -e "\.gitattributes" \ - -e "${SCRIPT_NAME/\./\\.}" \ - "$@" -} - -if modified_files | files_that_affect_everything -q; then - echo "//..." - exit 0 -fi - -# Reads a list of file paths and generates a list of bazel targets that would be affected by changes -# to these files. -affected_targets() { - while read file_path; do - if [ "$(basename $file_path)" == "BUILD" ]; then - # All targets are affected - query="//$(dirname $file_path)/..." - else - query="$file_path" - fi - - # allrdeps is part of Sky Query, which can only be accessed when universe_scope and order_output - # are provided. See the following docs for more details: - # https://docs.bazel.build/versions/master/query.html#sky-query - bazel query \ - --universe_scope=//... \ - --order_output=no \ - "kind($bazel_kind, allrdeps('$query'))" \ - 2>/dev/null - done | sort | uniq -} - -# Generate the transitive list of affected targets. -modified_files | affected_targets diff --git a/scripts/bazel_import_rewriter/BUILD b/scripts/bazel_import_rewriter/BUILD deleted file mode 100644 index 78ae01a42fa..00000000000 --- a/scripts/bazel_import_rewriter/BUILD +++ /dev/null @@ -1,19 +0,0 @@ -# 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. -# 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. - -sh_binary( - name = "bazel_import_rewriter", - srcs = ["bazel_import_rewriter.sh"], - visibility = ["//:__subpackages__"], -) diff --git a/scripts/bazel_import_rewriter/bazel_import_rewriter.sh b/scripts/bazel_import_rewriter/bazel_import_rewriter.sh deleted file mode 100755 index 9920a84897f..00000000000 --- a/scripts/bazel_import_rewriter/bazel_import_rewriter.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# -# 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. -# 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. - -# Returns a list of private component directories. -private_components() { - echo "Application" - echo "Beta" - echo "Color" - echo "Dragons" - echo "Icons" - echo "KeyboardWatcher" - echo "Math" - echo "Overlay" - echo "Snapshot" - echo "ThumbTrack" - echo "UIMetrics" -} - -NUMBER_OF_FILES=$(($# / 2)) -for i in $(seq 1 $NUMBER_OF_FILES); do - src_index=$i - dst_index=$(($i + $NUMBER_OF_FILES)) - src_path=${!src_index} - dst_path=${!dst_index} - - # Copy the file over, making adjustments along the way. - cat "$src_path" > "$dst_path" - - # - # Note: Swift imports need to be rewritten using the bazel module naming convention. - # In essence, each target maps to its bazel target path with / and : symbols replaced by _ - # symbols. - # E.g. //components/AppBar:AppBar becomes components_AppBar_AppBar - # - - # First, rewrite all imports with an unambiguous suffix: - perl -pi -e "s/import MaterialComponents.MaterialIcons_(.+)/import components_private_Icons_icons_\1_\1/" "$dst_path" - perl -pi -e "s/import MaterialComponents.Material(.+)_Private/import components_\1_Private/" "$dst_path" - perl -pi -e "s/import MaterialComponents.Material(.+)_(.+)/import components_\1_\2/" "$dst_path" - perl -pi -e "s/import MaterialComponentsBeta.Material(.+)Beta/import components_\1_\1Beta \/\/ BetaSplit/" "$dst_path" - perl -pi -e "s/import MaterialComponents.Material(.+)Scheme/import components_schemes_\1_\1/" "$dst_path" - perl -pi -e "s/import CatalogByConvention/import catalog_by_convention_CatalogByConvention/" "$dst_path" - perl -pi -e "s/import MDFInternationalization/import material_internationalization_ios_MDFInternationalization/" "$dst_path" - perl -pi -e "s/import MDFTextAccessibility/import material_text_accessibility_ios_MDFTextAccessibility/" "$dst_path" - - # Then, because our private component headers can't be distinguished from a generic import, we - # explicitly rewrite them first. - private_components | while read private_component; do - if [ -z "$private_component" ]; then - continue - fi - perl -pi -e "s/import MaterialComponents.Material$private_component\b/import components_private_${private_component}_${private_component}/" "$dst_path" - done - - # Finally, rewrite all generic imports. - perl -pi -e "s/import MaterialComponentsBeta.Material(.+)_(.+)/import components_\1_\2 \/\/ Beta/" "$dst_path" - perl -pi -e "s/import MaterialComponentsBeta.Material(.+)/import components_\1_\1 \/\/ Beta/" "$dst_path" - perl -pi -e "s/import MaterialComponents.Material(.+)/import components_\1_\1/" "$dst_path" -done diff --git a/scripts/files_missing_bazel_target b/scripts/files_missing_bazel_target deleted file mode 100755 index 4f4be6a5280..00000000000 --- a/scripts/files_missing_bazel_target +++ /dev/null @@ -1,152 +0,0 @@ -#!/bin/bash -# -# Copyright 2018-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. -# -# Finds all newly-added files that are missing BUILD targets - -# Unique identifier for GitHub comments posted by this script. -COMMENT_IDENTIFIER='bazel-rule-coverage' - -## Import Github Comment library script -if [ -n "$KOKORO_BUILD_NUMBER" ]; then - # Import source methods for managing GitHub comments - scripts_dir='github/repo/scripts/lib' -else - scripts_dir="$(dirname $0)/lib" -fi - -source "${scripts_dir}/github_comments.sh" - -# Required for posting and deleting comments -source "${scripts_dir}/select_xcode.sh" - -if [ -n "$XCODE_VERSION" ]; then - select_xcode "$XCODE_VERSION" -fi - -# Generates a list of files that were modified since the target branch -modified_files() { - # Move to our cloned repository - if [ -n "$KOKORO_BUILD_NUMBER" ]; then - pushd github/repo >> /dev/null - fi - - # `target_branch` is either the Pull Request destination branch (where it will be merged) or if - # none can be determined, defaults to `develop`. - if [ -n "$KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH" ]; then - target_branch="origin/${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}" - else - target_branch=develop - fi - - # `base_sha` is the merge base of `target_branch` and the current HEAD. - base_sha=$(git merge-base "${target_branch}" HEAD) - - # `TARGET` is then all bazel targets affected by changes in the commit range between `base_sha` - # and `HEAD`. By default, that becomes all changes between the `develop` branch and the latest - # commit. - range="${base_sha}...HEAD" - - git diff --name-status "${range}" \ - | grep -v -E '^D' \ - | grep -E '(\.swift|\.h|\.m)$' \ - | while read LINE; do \ - echo "$LINE" | sed -nE 's/.*[[:blank:]]+([[:alnum:]_\-\.\/+]+)$/\1/p'; \ - done \ - | sort \ - | uniq - - if [ -n "$KOKORO_BUILD_NUMBER" ]; then - popd >> /dev/null - fi -} - -# Deletes any previously-posted comment and posts a comment to GitHub with -# the list of source files not in a bazel target. -update_comment() { - if [ -n "$GITHUB_API_TOKEN" ]; then - delete_comment "$COMMENT_IDENTIFIER" - fi - - if [ -n "$1" ]; then - comment_tmp_path=$(mktemp -d) - comment_tmp_file="${comment_tmp_path}/comment.tmp" - echo -e "The following files are not in any BUILD targets:\n" >> "$comment_tmp_file" - echo -e "\`\`\`\n${1}\n\`\`\`\n" >> "$comment_tmp_file" - - cat "$comment_tmp_file" - if [ -n "$GITHUB_API_TOKEN" ]; then - post_comment "$COMMENT_IDENTIFIER" "$comment_tmp_file" - fi - fi -} - -# Determines if any of the modified files are not included in a bazel rule. -check_files_covered() { - update_comment # Deletes any previously-posted comment - - files=$(modified_files) - SAVEIFS=$IFS - IFS=$'\n' - files=($files) - IFS=$SAVEIFS - - if [ -z "$files" ]; then - echo "No source files were modified" - exit 0 - fi - - if [ -n "$KOKORO_BUILD_NUMBER" ]; then - pushd github/repo >> /dev/null - - # We must upgrade bazel prior to running bazel query because we rely on features in bazel - # 0.20. - bazel version - use_bazel.sh 0.20.0 - bazel version - fi - - num_files="${#files[@]}" - current_index=0 - for file in "${files[@]}"; do - targets=$(bazel query "'$file'" --output=package 2>/dev/null) - if [ -z "$targets" ]; then - if [ -z "$missing_targets" ]; then - missing_targets="$file" - else - missing_targets="${missing_targets}\n${file}" - fi - exit_status=1 - fi - ((current_index++)) - if (( current_index % 25==0 )); then - echo "Processing file $current_index / $num_files" - fi - done - - if [ -n "$KOKORO_BUILD_NUMBER" ]; then - popd >> /dev/null - fi - - if (( exit_status != 0 )); then - missing_targets=$(echo -e "$missing_targets" | sort | uniq) - update_comment "$missing_targets" - fi - - exit $exit_status -} - -check_files_covered -