1
+ import PropTypes from 'prop-types' ;
1
2
import {
2
- FormWithConstraints , Input as _Input ,
3
- FieldFeedbacks , Async , FieldFeedback as _FieldFeedback , FieldFeedbackProps
3
+ FormWithConstraints ,
4
+ Input as _Input , InputContext ,
5
+ FieldFeedbacks , Async ,
6
+ FieldFeedback as _FieldFeedback , FieldFeedbackProps , FieldFeedbackContext
4
7
} from 'react-form-with-constraints' ;
5
8
6
9
// ## Error
@@ -40,6 +43,16 @@ import {
40
43
// see https://github.com/twbs/bootstrap/blob/v4.1.2/scss/_forms.scss#L245
41
44
42
45
export class FieldFeedback extends _FieldFeedback {
46
+ // FIXME Copy-pasted from FieldFeedback to support IE <= 10
47
+ // See ["__proto__ is not supported on IE <= 10 so static properties will not be inherited"](https://babeljs.io/docs/en/caveats#classes-10-and-below)
48
+ // [@babel /plugin-transform-proto-to-assign](https://babeljs.io/docs/en/babel-plugin-transform-proto-to-assign) did not work
49
+ static contextTypes : React . ValidationMap < FieldFeedbackContext > = {
50
+ form : PropTypes . instanceOf ( FormWithConstraints ) . isRequired ,
51
+ fieldFeedbacks : PropTypes . instanceOf ( FieldFeedbacks ) . isRequired ,
52
+ async : PropTypes . instanceOf ( Async )
53
+ } ;
54
+ context ! : FieldFeedbackContext ;
55
+
43
56
static defaultProps : FieldFeedbackProps = {
44
57
// See https://github.com/facebook/react/issues/3725#issuecomment-169163998
45
58
// See React.Component.defaultProps objects are overridden, not merged? https://stackoverflow.com/q/40428847
@@ -54,6 +67,16 @@ export class FieldFeedback extends _FieldFeedback {
54
67
}
55
68
56
69
export class FieldFeedbackTooltip extends _FieldFeedback {
70
+ // FIXME Copy-pasted from FieldFeedback to support IE <= 10
71
+ // See ["__proto__ is not supported on IE <= 10 so static properties will not be inherited"](https://babeljs.io/docs/en/caveats#classes-10-and-below)
72
+ // [@babel /plugin-transform-proto-to-assign](https://babeljs.io/docs/en/babel-plugin-transform-proto-to-assign) did not work
73
+ static contextTypes : React . ValidationMap < FieldFeedbackContext > = {
74
+ form : PropTypes . instanceOf ( FormWithConstraints ) . isRequired ,
75
+ fieldFeedbacks : PropTypes . instanceOf ( FieldFeedbacks ) . isRequired ,
76
+ async : PropTypes . instanceOf ( Async )
77
+ } ;
78
+ context ! : FieldFeedbackContext ;
79
+
57
80
static defaultProps : FieldFeedbackProps = {
58
81
// See https://github.com/facebook/react/issues/3725#issuecomment-169163998
59
82
// See React.Component.defaultProps objects are overridden, not merged? https://stackoverflow.com/q/40428847
@@ -68,6 +91,14 @@ export class FieldFeedbackTooltip extends _FieldFeedback {
68
91
}
69
92
70
93
export class Input extends _Input {
94
+ // FIXME Copy-pasted from FieldFeedback to support IE <= 10
95
+ // See ["__proto__ is not supported on IE <= 10 so static properties will not be inherited"](https://babeljs.io/docs/en/caveats#classes-10-and-below)
96
+ // [@babel /plugin-transform-proto-to-assign](https://babeljs.io/docs/en/babel-plugin-transform-proto-to-assign) did not work
97
+ static contextTypes : React . ValidationMap < InputContext > = {
98
+ form : PropTypes . instanceOf ( FormWithConstraints ) . isRequired
99
+ } ;
100
+ context ! : InputContext ;
101
+
71
102
static defaultProps = {
72
103
classes : {
73
104
isPending : 'is-pending' ,
0 commit comments