218 Commits

Author SHA1 Message Date
Wenyu Zhang
8e0ed49dc6 [Slider] Set thumbIsSmallerWhenDisabled to NO to match Material spec.
PiperOrigin-RevId: 332867778
2020-09-21 09:36:43 -07:00
Bryan Oltman
39af7115f7 [private/ThumbTrack] Remove ability for thumb view to grow while dragging.
PiperOrigin-RevId: 332327230
2020-09-17 15:19:40 -07:00
Bryan Oltman
c861bd32c9 [Slider] Remove checks for iOS 10 availability.
PiperOrigin-RevId: 332074254
2020-09-16 13:24:05 -07:00
Bryan Oltman
5da1486c9f [Slider] Add call to [super prepareForReuse] in example.
PiperOrigin-RevId: 331836270
2020-09-15 13:06:13 -07:00
Jeff Verkoeyen
7119e0c1fe [Slider] Expose thumbBorderWidth and thumbIsSmallerWhenDisabled.
These APIs enable further configuration of the slider's behavior and style.

PiperOrigin-RevId: 330570657
2020-09-08 13:10:03 -07:00
Wenyu Zhang
e5c046c89a [Slider] Update Slider example to conform to minimum touch size by change frame.
PiperOrigin-RevId: 325465640
2020-08-07 10:56:48 -07:00
Wenyu Zhang
ab519cac9f [ThumbTrack] Turn centerVisibleArea on on ThumbView to ensure its minimum touch target size.
PiperOrigin-RevId: 325297919
2020-08-06 13:32:43 -07:00
Andrew Overton
07c46757cc Replace material.io API doc links with links to the relevant header f…
This PR replaces API links containing "/api-docs/" with links to suitable header files in GitHub because the site previously linked to is being taken down and replaced with something that won't handle API docs.

Closes https://github.com/material-components/material-components-ios/pull/10045

COPYBARA_INTEGRATE_REVIEW=https://github.com/material-components/material-components-ios/pull/10045 from andrewoverton:replace-mio-api-docs-with-github-links 0d6e56cc11d0c147366a4f6cde829d8b51567ecc
PiperOrigin-RevId: 323424362
2020-07-27 13:09:23 -07:00
Bryan Oltman
0495b79871 [Slider] Add EarlGrey test to expose bug where tapping on slider track opposite anchor point doesn't trigger UIControlEventValueChanged
PiperOrigin-RevId: 322664882
2020-07-22 15:13:08 -07:00
Bryan Oltman
de482d077a [Slider] Remove supplemental directory from examples.
PiperOrigin-RevId: 322598360
2020-07-22 10:09:20 -07:00
Wenyu Zhang
a3381717f7
Fix the bazel BUILD files and snapshot that were restored unintentionally.(#9983) 2020-04-29 11:00:00 -04:00
Randall Li
0100cfe414 [MDC-iOS/BottomSheet] Fix dismissOnDraggingDownSheet behavior
The bottom sheet incorrectly allowed the sheet to be drag dismissed when `dismissOnDraggingDownSheet` was set to NO.

This change permits the gesture to dismiss to begin but prevents it from actually closing the sheet.

https://github.com/material-components/material-components-ios/issues/9723

Closes https://github.com/material-components/material-components-ios/pull/9885

PiperOrigin-RevId: 307802500
2020-04-22 06:21:26 -07:00
Jeff Verkoeyen
8abbb099a9 Delete all bazel support.
We no longer support bazel.

This PR deletes everything related to bazel support from our repo.

Closes https://github.com/material-components/material-components-ios/pull/9968

PiperOrigin-RevId: 306227127
2020-04-13 07:13:47 -07:00
Bryan Oltman
0e9362f933 [Slider] Move protocol definitions into separate header files
PiperOrigin-RevId: 302063293
2020-03-20 11:16:17 -07:00
Yarden Eitan
6326cd055a
[Slider] Allow thumb to stay filled with discrete value label (#9866)
As per Material Design: https://material.io/components/sliders/#discrete-slider a discrete slider can have it thumb stay even when a value label presents itself.

With the current implementation, when a value label on a discrete slider is displayed, the thumb disappears.

Clients can no opt-in to having the thumb continue to display itself when the value label is shown.

Tested by running catalog example on simulator with the property set to YES, as well as with unit test and snapshot test.

Closes #8986
2020-03-10 13:30:09 +02:00
Randall Li
d03c34293f
[Material][Availability] Migrates Slider to MDCAvailability. (#9704)
[Material][Availability] Migrates Slider to MDCAvailability.
2020-02-14 09:08:07 -05:00
Nobody
b8ffaabc73 Internal Change
PiperOrigin-RevId: 293891746
2020-02-07 14:15:39 -08:00
Jacob Lukas
f0816875d7 Add allowAnimatedValueChanges property to MDCSlider
PiperOrigin-RevId: 291975707
2020-01-28 11:25:16 -08:00
Jacob Lukas
a742270f97 Add trackEndsAreInset property to MDCSlider
PiperOrigin-RevId: 291975646
2020-01-28 11:22:27 -08:00
Jacob Lukas
2ee31932b6 Add trackEndsAreRounded property to MDCSlider
PiperOrigin-RevId: 291974805
2020-01-28 11:17:57 -08:00
Robert Moore
3671e05bde
[Slider] Update documentation to match behavior. (#8782)
The MDCSlider documentation needs to be updated to match its current behavior.
This commit corrects an outdated behavioral description for the
`trackTickVisibility` API. It also updates the README to include more recent
changes to the APIs.

Follow-up from #8758
2019-11-12 10:58:19 -05:00
Robert Moore
4194c01fbe
[Slider][ThumbTrack] Fix event handling. (#8759)
Slider/ThumbTrack event handling was broken by the way track tick visibility
was implemented. This PR fixes that event handling.

Fixes #8758
2019-11-11 16:21:44 -05:00
Robert Moore
5d6941b61d
[Slider][ThumbTrack] Continuous sliders show tick marks. (#8745)
Enables showing tick marks for continuous Sliders.

Closes #8737
2019-11-06 22:21:05 -05:00
Robert Moore
ed7b654e4a
[ThumbTrack] Discrete dots scale slowly with track height. (#8744)
The discrete dots in the ThumbTrack originally assumed that the track would
only ever be 2 points high. Now that customizable heights are allowed, the
dots should scale more slowly.

This is still not perfect, since the original positioning of the ticks resulted in the filled track stopping at non-center positions of each tick. However, it is an incremental improvement and better VX will necessitate Material Design inputs.

![Example showing misaligned track and tick mark.](https://user-images.githubusercontent.com/1753199/68304829-95f09600-0074-11ea-90c0-90b1a344327e.png)

Improves #8741
2019-11-06 15:36:41 -05:00
Robert Moore
61f901fdc7
[ThumbTrack][Slider] Add API to control showing tick marks. (#8743)
A new API, `trackTickVisibility` is provided to control the visibility of
track tick marks. Specifically allows showing track tick marks for continuous
sliders and for discrete sliders even when the Thumb is not pressed.

Closes #8737
2019-11-06 14:13:25 -05:00
Bryan Oltman
d6d13cdfac
[Slider] Add trackHeight property (#8740)
* [Slider] Add trackHeight property

* Add track size tests for discrete sliders

* Update doc comment for trackHeight
2019-11-05 17:47:36 -05:00
Yarden Eitan
8f9dd740d0
[Slider] [ThumbTrack] Add Font API and Dynamic Type support (#8708)
In this PR the main goal is to add Dynamic Type support. As part of this support I am doing the following:

1. Adding a Font API to ThumbTrack and Slider to be able to set the font of the discrete label to a scalable font.
2. Deprecating the old fontSize API (which isn't used internally).
3. Adding adjustsFontForContentSizeCategory APIs to Slider and ThumbTrack.
4. Resizing the ThumbTrack view accordingly based on the font size instead of having it static.

The snapshot tests in place allow me to present the new support for dynamic type and custom fonts.

Closes #8646
2019-11-01 10:58:07 -04:00
Yarden Eitan
1b7b249805
[Slider] Add snapshot tests for setting preferredFont with adju… (#8645)
This PR adds 2 snapshot tests to verify the behavior for setting preferredFont on the Banner's text elements when adjustsFontForContentSizeCategory is set to YES.

It is important to note that Slider currently doesn't expose any font property nor allows setting adjustsFontForContentSizeCategory on the label of the thumbtrack. These snapshot tests allow us to verify once we provide these APIs to see the changes to the font size.
Opened b/143287831 for tracking.

Closes #8643
2019-10-31 15:58:38 -04:00
afweiss
8a587b8c61 [Slider] Adding Haptic Feedback When Crossing Anchored Value (#8225)
For sliders that are anchored, there is now a light vibration when the user passes over the slider's anchored value.
2019-09-03 12:30:10 -04:00
Robert Moore
efdbb44938
[Slider] Remove use of NS_ASSUME_NONNULL_BEGIN. (#8300)
The project overwhelmingly uses explicit nullability annotations. This PR
switches a test class for MDCSlider to explicit annotations.

Part of #8297
2019-08-13 12:52:32 -04:00
Robert Moore
be45bbf3ee
[Slider] Use Starlark BUILD macros. (#8194)
Add more Starlark macros to the BUILD file to make releasing easier.

Part of #8150
2019-08-02 16:33:28 -04:00
Cody Weaver
c6ab74349d
[Slider] Add MaterialElevation support (#8127)
Adds conformance to MDCElevatable and MDCElevationOverriding to
MDCSlider.

Closes #8014
2019-07-30 21:57:43 -07:00
Cody Weaver
118840dfc8
[Slider] Add traitCollectionDidChange block (#8057)
Adds a traitCollectionDidChangeBlock to MDCSlider, called when its trait collection changes.

Closes #8042
2019-07-23 20:46:43 -07:00
Wenyu Zhang
4d47e68dd8
[Slider] Add shadowColor to support dynamic color behavior. (#7972)
Closes https://github.com/material-components/material-components-ios/issues/7866.
2019-07-21 15:22:58 -04:00
Wenyu Zhang
cf7ed4c5f9
[Slider] change track background color. (#7967)
Follow up PR to https://github.com/material-components/material-components-ios/pull/7960#pullrequestreview-263953047.
2019-07-18 21:56:17 -04:00
Wenyu Zhang
ceb874acaf
[Slider] Add snapshot test for dynamic color with elevation. (#7960)
Prepare for https://github.com/material-components/material-components-ios/issues/7866.
2019-07-18 19:49:14 -04:00
afweiss
46efae77c6 [Slider] Allowing Full Haptics for Discrete Sliders (#7765)
* haptics for slider

* updating formatting and style for slider haptics

* updated formatting for slider tests

* updating slider test name

* adding full haptics option for discrete sliders

* updated formatting for full haptics

* updating full haptics

* updating formatting for discrete haptics

* fixing formating
2019-07-09 09:18:08 -04:00
afweiss
2674c8cd13 [Slider] Haptics For Slider (#7738)
This adds haptics for sliders. The haptics for sliders are opt-out and cause a light vibration when the slider reaches the min or max value. These decisions were made to match apples implementation of haptics for sliders.
2019-07-01 15:55:13 -04:00
Yarden Eitan
e9ac3ee70d
[Slider] Adds the Ripple behavior to Slider. (#7600)
## Related links
* Bug: Closes #7378  
* Ripple: [MDCRippleView](https://github.com/material-components/material-components-ios/tree/develop/components/Ripple)

## Introduction
This PR integrates [`MDCRippleView`](https://github.com/material-components/material-components-ios/blob/develop/components/Ripple/src/MDCRippleView.h) into [`MDCSlider`](https://github.com/material-components/material-components-ios/tree/develop/components/Slider) by way of [`MDCThumbTrack`](https://github.com/material-components/material-components-ios/tree/develop/components/private/ThumbTrack). This behavior is an opt in flag property added to MDCSlider, `enableRippleBehavior`.  This improves the visual touch feedback for our users as MDCInkView didn't support our current motion guidelines. We are also marking any of the Ink APIs ToBeDeprecated as part of the [Deprecation Policy](cb6b8e9599/contributing/deprecation_policy.md (step-4-add-a-comment-to-the-api-indicating-that-it-will-be-deprecated)).
As you can see in the below videos, Ink was never implemented correctly for Slider, and therefore never appeared. With Ripple enabled, we finally get the right results, as seen [in our spec](https://material.io/design/components/sliders.html#continuous-slider).

## Videos
| Before | After |
| - | - |
|![oldRipple](https://user-images.githubusercontent.com/4066863/59466125-7ffae400-8dfa-11e9-9da2-d2ee87433f28.gif)|![newRipple](https://user-images.githubusercontent.com/4066863/59466127-81c4a780-8dfa-11e9-808a-295f8ca613c9.gif)|
2019-06-16 16:19:50 -04:00
featherless
a1226a9ff5 [Slider] Annotate themer APIs with the recommended APIs. (#7232)
Part of https://github.com/material-components/material-components-ios/issues/7108
2019-04-22 13:07:33 -04:00
Yarden Eitan
c4d24627ee
updated jazzy yaml files to include framework root (#6750)
We have had errors when generating the docs using jazzy specifically around components giving a fatal error around not finding imports when depending on other components. This is because each component for jazzy is isolated and on its own unless we provide the framework root. This caused our website generator to crash each time and fail to generate a new website.

This should resolve this problem.

QA=
Before the fix when running the website generator we got these errors:
```
/material-components-ios/components/BottomAppBar/src/MDCBottomAppBarView.h:17:9: fatal error: 'MaterialButtons.h' file not found
building site
building search index
^C/Library/Ruby/Gems/2.3.0/gems/rouge-3.1.1/lib/rouge/lexer.rb:458:in `load': Interrupt
	from /Library/Ruby/Gems/2.3.0/gems/rouge-3.1.1/lib/rouge/lexer.rb:458:in `load_lexer'
	from /Library/Ruby/Gems/2.3.0/gems/rouge-3.1.1/lib/rouge.rb:50:in `block in <top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/rouge-3.1.1/lib/rouge.rb:49:in `each'
	from /Library/Ruby/Gems/2.3.0/gems/rouge-3.1.1/lib/rouge.rb:49:in `<top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy/jazzy_markdown.rb:2:in `require'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy/jazzy_markdown.rb:2:in `<top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy/doc.rb:7:in `require'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy/doc.rb:7:in `<top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy/config.rb:5:in `require'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy/config.rb:5:in `<top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy.rb:1:in `require'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy.rb:1:in `<top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/bin/jazzy:13:in `require'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/bin/jazzy:13:in `<top (required)>'
	from /usr/local/bin/jazzy:22:in `load'
	from /usr/local/bin/jazzy:22:in `<top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:74:in `load'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:74:in `kernel_load'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:28:in `run'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/cli.rb:463:in `exec'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/cli.rb:27:in `dispatch'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/cli.rb:18:in `start'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/exe/bundle:30:in `block in <top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/exe/bundle:22:in `<top (required)>'
	from /usr/local/bin/bundle:22:in `load'
	from /usr/local/bin/bundle:22:in `<main>'
/material-components-site-generator/scripts/lib/reporter.js:36
      throw e;
      ^

Error: Command failed: bundle exec jazzy         --output "/material-components-site-generator/.stage/ios/catalog/bottomnavigation/api-docs/"         --theme "/material-components-site-generator/ios-api-docs-src/theme"         --head '/components'         --use-safe-filenames
    at checkExecSyncError (child_process.js:601:13)
    at execSync (child_process.js:641:13)
    at JazzyApiGenerator.build (/material-components-site-generator/scripts/lib/jazzy-api-generator.js:34:5)
    at PlatformSite.generateApiDocs (/material-components-site-generator/scripts/lib/platform-site.js:212:17)
    at platformSites.forEach (/material-components-site-generator/scripts/build:86:14)
    at Array.forEach (<anonymous>)
    at reporter.step (/material-components-site-generator/scripts/build:85:21)
    at Reporter.step (/material-components-site-generator/scripts/lib/reporter.js:32:22)
    at Object.<anonymous> (/material-components-site-generator/scripts/build:84:14)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
```
Now we no longer get fatal errors or crash when running the script.
2019-03-01 16:52:02 -05:00
Robert Moore
65426c86f9
[Slider] Add basic snapshot tests. (#6640)
Adding a few snapshot tests to capture the basic styling/appearance of
Sliders.
2019-02-19 09:26:53 -05:00
Robert Moore
800188a649
{clang-format} Format the components. (#6347)
This is a follow-up to https://github.com/material-components/material-components-ios/pull/6027

```
find components \( -name "*.h" -or -name "*.m" \) | xargs clang-format -i
```
2019-01-23 11:08:43 -05:00
Cody Weaver
6684e5329e
[Slider] Add examples to BUILD file (#6351)
Closes #6239
2019-01-16 11:26:07 -05:00
Yarden Eitan
2803125b2c
ran clang-format (#6027) 2019-01-11 13:23:51 -05:00
Robert Moore
b443fa393b
[Slider] Deflake unit tests. (#6143)
Several unit tests were comparing the outcome of arithemtic by using
`XCTAssertEqual`, which requires absolute precision for floating point numbers.
Due to rounding errors, this is neither important nor desirable. Instead,
`XCTAssertEqualWithAccuracy` should be used.

Also corrected the order of the assertion parameters. The test value should
come before the expected value because the failure message has the template,
@"(%@) is not equal to (%@)" and when read it implies that the second value
(sentence object) is the correct value.

Removed some debug messages that managed to creep in there a while back.
2018-12-28 22:40:00 -05:00
Robert Moore
5b1943dd78
[bazel] Use mdc_extension_objc_library in BUILD (#6089)
Changing all component extension targets to use the new macro
`mdc_extension_objc_library` to reduce boilerplate in the target
definitions.
2018-12-20 17:14:19 -05:00
featherless
003cf8bcd9
[automated] Make mdc_unit_test_suite's name explicit. (#6080)
This change was automatically generated by running a find replace of the following strings:

```
mdc_unit_test_suite(

mdc_unit_test_suite(
    name = "unit_tests",
```

And then running buildifier to enforce style:

    find . -name BUILD | xargs ~/buildifier
2018-12-20 12:36:05 -05:00
featherless
dae4e37ea5
[automated] Ran buildifier against all BUILD files. (#5999)
This is an automated change generated by running the following command:

    find . -name BUILD | xargs buildifier

buildifier can be installed from https://github.com/bazelbuild/buildtools

This change formats all of our BUILD files with the buildifier formatter in preparation for us having a BUILD format linter as part of our presubmits and so that we can cleanly run buildozer commands against the codebase.
2018-12-13 11:20:12 -05:00
featherless
d9c801e773
[all]! Remove remaining property coding. (#5792)
Our components should not implement or support property coding unless explicitly required. We generally removed support for this type of behavior early in 2018.

Many components were still implementing coding support.

Property coding has been removed from every component.

This change also removes `NS_DESIGNATED_INITIALIZER` from all initWithCoder APIs.
2018-11-20 09:06:46 -05:00