Skip to content

Commit

Permalink
[pickers] Document and deprecate onClose callback on static pickers (
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasTy authored Feb 24, 2023
1 parent f2a590e commit 89c3137
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/pages/x/api/date-pickers/static-date-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
},
"onAccept": { "type": { "name": "func" } },
"onChange": { "type": { "name": "func" } },
"onClose": {
"type": { "name": "func" },
"deprecated": true,
"deprecationInfo": "Please avoid using as it will be removed in next major version."
},
"onError": { "type": { "name": "func" } },
"onMonthChange": { "type": { "name": "func" } },
"onViewChange": { "type": { "name": "func" } },
Expand Down
5 changes: 5 additions & 0 deletions docs/pages/x/api/date-pickers/static-date-range-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
"minDate": { "type": { "name": "any" } },
"onAccept": { "type": { "name": "func" } },
"onChange": { "type": { "name": "func" } },
"onClose": {
"type": { "name": "func" },
"deprecated": true,
"deprecationInfo": "Please avoid using as it will be removed in next major version."
},
"onError": { "type": { "name": "func" } },
"onMonthChange": { "type": { "name": "func" } },
"onRangePositionChange": { "type": { "name": "func" } },
Expand Down
5 changes: 5 additions & 0 deletions docs/pages/x/api/date-pickers/static-date-time-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
},
"onAccept": { "type": { "name": "func" } },
"onChange": { "type": { "name": "func" } },
"onClose": {
"type": { "name": "func" },
"deprecated": true,
"deprecationInfo": "Please avoid using as it will be removed in next major version."
},
"onError": { "type": { "name": "func" } },
"onMonthChange": { "type": { "name": "func" } },
"onViewChange": { "type": { "name": "func" } },
Expand Down
5 changes: 5 additions & 0 deletions docs/pages/x/api/date-pickers/static-time-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
"minutesStep": { "type": { "name": "number" }, "default": "1" },
"onAccept": { "type": { "name": "func" } },
"onChange": { "type": { "name": "func" } },
"onClose": {
"type": { "name": "func" },
"deprecated": true,
"deprecationInfo": "Please avoid using as it will be removed in next major version."
},
"onError": { "type": { "name": "func" } },
"onViewChange": { "type": { "name": "func" } },
"openTo": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"monthsPerRow": "Months rendered per row.",
"onAccept": "Callback fired when the value is accepted.<br><br><strong>Signature:</strong><br><code>function(value: TValue) =&gt; void</code><br><em>value:</em> The value that was just accepted.",
"onChange": "Callback fired when the value changes.<br><br><strong>Signature:</strong><br><code>function(value: TValue, context: FieldChangeHandlerContext&lt;TError&gt;) =&gt; void</code><br><em>value:</em> The new value.<br><em>context:</em> The context containing the validation result of the current value.",
"onClose": "Callback fired when component requests to be closed. Can be fired when selecting (by default on <code>desktop</code> mode) or clearing a value.",
"onError": "Callback fired when the error associated to the current value changes. If the error has a non-null value, then the <code>TextField</code> will be rendered in <code>error</code> state.<br><br><strong>Signature:</strong><br><code>function(error: TError, value: TValue) =&gt; void</code><br><em>error:</em> The new error describing why the current value is not valid.<br><em>value:</em> The value associated to the error.",
"onMonthChange": "Callback fired on month change.<br><br><strong>Signature:</strong><br><code>function(month: TDate) =&gt; void</code><br><em>month:</em> The new month.",
"onViewChange": "Callback fired on view change.<br><br><strong>Signature:</strong><br><code>function(view: TView) =&gt; void</code><br><em>view:</em> The new view.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"minDate": "Minimal selectable date.",
"onAccept": "Callback fired when the value is accepted.<br><br><strong>Signature:</strong><br><code>function(value: TValue) =&gt; void</code><br><em>value:</em> The value that was just accepted.",
"onChange": "Callback fired when the value changes.<br><br><strong>Signature:</strong><br><code>function(value: TValue, context: FieldChangeHandlerContext&lt;TError&gt;) =&gt; void</code><br><em>value:</em> The new value.<br><em>context:</em> The context containing the validation result of the current value.",
"onClose": "Callback fired when component requests to be closed. Can be fired when selecting (by default on <code>desktop</code> mode) or clearing a value.",
"onError": "Callback fired when the error associated to the current value changes. If the error has a non-null value, then the <code>TextField</code> will be rendered in <code>error</code> state.<br><br><strong>Signature:</strong><br><code>function(error: TError, value: TValue) =&gt; void</code><br><em>error:</em> The new error describing why the current value is not valid.<br><em>value:</em> The value associated to the error.",
"onMonthChange": "Callback fired on month change.<br><br><strong>Signature:</strong><br><code>function(month: TDate) =&gt; void</code><br><em>month:</em> The new month.",
"onRangePositionChange": "Callback fired when the range position changes.<br><br><strong>Signature:</strong><br><code>function(rangePosition: RangePosition) =&gt; void</code><br><em>rangePosition:</em> The new range position.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"monthsPerRow": "Months rendered per row.",
"onAccept": "Callback fired when the value is accepted.<br><br><strong>Signature:</strong><br><code>function(value: TValue) =&gt; void</code><br><em>value:</em> The value that was just accepted.",
"onChange": "Callback fired when the value changes.<br><br><strong>Signature:</strong><br><code>function(value: TValue, context: FieldChangeHandlerContext&lt;TError&gt;) =&gt; void</code><br><em>value:</em> The new value.<br><em>context:</em> The context containing the validation result of the current value.",
"onClose": "Callback fired when component requests to be closed. Can be fired when selecting (by default on <code>desktop</code> mode) or clearing a value.",
"onError": "Callback fired when the error associated to the current value changes. If the error has a non-null value, then the <code>TextField</code> will be rendered in <code>error</code> state.<br><br><strong>Signature:</strong><br><code>function(error: TError, value: TValue) =&gt; void</code><br><em>error:</em> The new error describing why the current value is not valid.<br><em>value:</em> The value associated to the error.",
"onMonthChange": "Callback fired on month change.<br><br><strong>Signature:</strong><br><code>function(month: TDate) =&gt; void</code><br><em>month:</em> The new month.",
"onViewChange": "Callback fired on view change.<br><br><strong>Signature:</strong><br><code>function(view: TView) =&gt; void</code><br><em>view:</em> The new view.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"minutesStep": "Step over minutes.",
"onAccept": "Callback fired when the value is accepted.<br><br><strong>Signature:</strong><br><code>function(value: TValue) =&gt; void</code><br><em>value:</em> The value that was just accepted.",
"onChange": "Callback fired when the value changes.<br><br><strong>Signature:</strong><br><code>function(value: TValue, context: FieldChangeHandlerContext&lt;TError&gt;) =&gt; void</code><br><em>value:</em> The new value.<br><em>context:</em> The context containing the validation result of the current value.",
"onClose": "Callback fired when component requests to be closed. Can be fired when selecting (by default on <code>desktop</code> mode) or clearing a value.",
"onError": "Callback fired when the error associated to the current value changes. If the error has a non-null value, then the <code>TextField</code> will be rendered in <code>error</code> state.<br><br><strong>Signature:</strong><br><code>function(error: TError, value: TValue) =&gt; void</code><br><em>error:</em> The new error describing why the current value is not valid.<br><em>value:</em> The value associated to the error.",
"onViewChange": "Callback fired on view change.<br><br><strong>Signature:</strong><br><code>function(view: TView) =&gt; void</code><br><em>view:</em> The new view.",
"openTo": "The default visible view. Used when the component view is not controlled. Must be a valid option from <code>views</code> list.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ StaticDateRangePicker.propTypes = {
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
*/
onChange: PropTypes.func,
/**
* Callback fired when component requests to be closed.
* Can be fired when selecting (by default on `desktop` mode) or clearing a value.
* @deprecated Please avoid using as it will be removed in next major version.
*/
onClose: PropTypes.func,
/**
* Callback fired when the error associated to the current value changes.
* If the error has a non-null value, then the `TextField` will be rendered in `error` state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ StaticDatePicker.propTypes = {
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
*/
onChange: PropTypes.func,
/**
* Callback fired when component requests to be closed.
* Can be fired when selecting (by default on `desktop` mode) or clearing a value.
* @deprecated Please avoid using as it will be removed in next major version.
*/
onClose: PropTypes.func,
/**
* Callback fired when the error associated to the current value changes.
* If the error has a non-null value, then the `TextField` will be rendered in `error` state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ StaticDateTimePicker.propTypes = {
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
*/
onChange: PropTypes.func,
/**
* Callback fired when component requests to be closed.
* Can be fired when selecting (by default on `desktop` mode) or clearing a value.
* @deprecated Please avoid using as it will be removed in next major version.
*/
onClose: PropTypes.func,
/**
* Callback fired when the error associated to the current value changes.
* If the error has a non-null value, then the `TextField` will be rendered in `error` state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ StaticTimePicker.propTypes = {
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
*/
onChange: PropTypes.func,
/**
* Callback fired when component requests to be closed.
* Can be fired when selecting (by default on `desktop` mode) or clearing a value.
* @deprecated Please avoid using as it will be removed in next major version.
*/
onClose: PropTypes.func,
/**
* Callback fired when the error associated to the current value changes.
* If the error has a non-null value, then the `TextField` will be rendered in `error` state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ export interface StaticOnlyPickerProps {
* If `true`, the view is focused during the first mount.
*/
autoFocus?: boolean;
/**
* Callback fired when component requests to be closed.
* Can be fired when selecting (by default on `desktop` mode) or clearing a value.
* @deprecated Please avoid using as it will be removed in next major version.
*/
onClose?: () => void;
}

export interface UseStaticPickerProps<
Expand Down

0 comments on commit 89c3137

Please sign in to comment.