From 0d768e50deec2e0f8d4509d90f210a50453c6ca8 Mon Sep 17 00:00:00 2001 From: Ty Date: Wed, 21 Oct 2015 10:17:19 +0100 Subject: [PATCH] added openDialog() and focus() to docs --- .../components/pages/components/time-picker.jsx | 17 +++++++++++++++++ src/time-picker/time-picker.jsx | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/docs/src/app/components/pages/components/time-picker.jsx b/docs/src/app/components/pages/components/time-picker.jsx index acb7029479cb3f..d19d73635bfce3 100644 --- a/docs/src/app/components/pages/components/time-picker.jsx +++ b/docs/src/app/components/pages/components/time-picker.jsx @@ -63,6 +63,18 @@ let TimePickerPage = React.createClass({ header: 'TimePicker.formatTime(time)', desc: 'Formats the Date object to a current component\'s time format.', }, + { + name: 'openDialog', + header: 'TimePicker.openDialog()', + desc: 'Opens the time-picker dialog programmatically. Use this if you want to open the ' + + 'dialog in response to some event other than focus/tap on the input field, such as an ' + + 'external button click.', + }, + { + name: 'focus', + header: 'TimePicker.focus()', + desc: 'An alias for the `openDialog()` method to allow more generic use alongside `TextField`.', + }, ], }, { @@ -88,6 +100,11 @@ let TimePickerPage = React.createClass({ desc: 'Callback function that is fired when the timepicker field ' + 'gains focus.', }, + { + name: 'onShow', + header: 'function()', + desc: 'Fired when the timepicker dialog is dismissed.', + }, { name: 'onShow', header: 'function()', diff --git a/src/time-picker/time-picker.jsx b/src/time-picker/time-picker.jsx index d6e4c6d210bd78..6b7a0ff83ce97d 100644 --- a/src/time-picker/time-picker.jsx +++ b/src/time-picker/time-picker.jsx @@ -120,6 +120,13 @@ const TimePicker = React.createClass({ this.refs.input.setValue(this.formatTime(t)); }, + /** + * Alias for `openDialog()` for an api consistent with TextField. + */ + focus() { + this.openDialog(); + }, + openDialog() { this.setState({ dialogTime: this.getTime(),