@instructure/ui-form-field 8.13.1-snapshot.9 → 8.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/es/FormField/index.js +3 -2
- package/es/FormField/props.js +0 -15
- package/es/FormFieldGroup/index.js +14 -10
- package/es/FormFieldGroup/props.js +0 -19
- package/es/FormFieldLabel/index.js +13 -7
- package/es/FormFieldLabel/props.js +2 -2
- package/es/FormFieldLayout/index.js +15 -10
- package/es/FormFieldLayout/props.js +5 -24
- package/es/FormFieldLayout/styles.js +1 -1
- package/es/FormFieldMessage/index.js +12 -8
- package/es/FormFieldMessages/index.js +11 -6
- package/es/FormFieldMessages/props.js +0 -6
- package/lib/FormField/index.js +3 -2
- package/lib/FormField/props.js +0 -15
- package/lib/FormFieldGroup/index.js +14 -10
- package/lib/FormFieldGroup/props.js +0 -19
- package/lib/FormFieldLabel/index.js +13 -7
- package/lib/FormFieldLabel/props.js +2 -2
- package/lib/FormFieldLayout/index.js +15 -10
- package/lib/FormFieldLayout/props.js +5 -24
- package/lib/FormFieldLayout/styles.js +1 -1
- package/lib/FormFieldMessage/index.js +12 -8
- package/lib/FormFieldMessages/index.js +11 -6
- package/lib/FormFieldMessages/props.js +0 -6
- package/package.json +15 -16
- package/src/FormField/index.tsx +3 -3
- package/src/FormField/props.ts +17 -14
- package/src/FormFieldGroup/index.tsx +6 -10
- package/src/FormFieldGroup/props.ts +24 -17
- package/src/FormFieldLabel/index.tsx +4 -6
- package/src/FormFieldLabel/props.ts +3 -3
- package/src/FormFieldLayout/index.tsx +10 -16
- package/src/FormFieldLayout/props.ts +30 -20
- package/src/FormFieldLayout/styles.ts +1 -2
- package/src/FormFieldMessage/index.tsx +5 -8
- package/src/FormFieldMessages/index.tsx +4 -6
- package/src/FormFieldMessages/props.ts +6 -6
- package/src/index.ts +1 -1
- package/tsconfig.build.json +19 -2
- package/tsconfig.build.tsbuildinfo +1 -0
- package/types/FormField/index.d.ts +4 -30
- package/types/FormField/index.d.ts.map +1 -1
- package/types/FormField/props.d.ts +17 -2
- package/types/FormField/props.d.ts.map +1 -1
- package/types/FormFieldGroup/index.d.ts +4 -4
- package/types/FormFieldGroup/index.d.ts.map +1 -1
- package/types/FormFieldGroup/props.d.ts +18 -2
- package/types/FormFieldGroup/props.d.ts.map +1 -1
- package/types/FormFieldLabel/index.d.ts +4 -3
- package/types/FormFieldLabel/index.d.ts.map +1 -1
- package/types/FormFieldLabel/props.d.ts +1 -1
- package/types/FormFieldLabel/props.d.ts.map +1 -1
- package/types/FormFieldLayout/index.d.ts +7 -32
- package/types/FormFieldLayout/index.d.ts.map +1 -1
- package/types/FormFieldLayout/props.d.ts +21 -2
- package/types/FormFieldLayout/props.d.ts.map +1 -1
- package/types/FormFieldLayout/styles.d.ts +1 -1
- package/types/FormFieldLayout/styles.d.ts.map +1 -1
- package/types/FormFieldMessage/index.d.ts +2 -2
- package/types/FormFieldMessage/index.d.ts.map +1 -1
- package/types/FormFieldMessages/index.d.ts +2 -1
- package/types/FormFieldMessages/index.d.ts.map +1 -1
- package/types/FormFieldMessages/props.d.ts +6 -0
- package/types/FormFieldMessages/props.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/LICENSE.md +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [8.14.0](https://github.com/instructure/instructure-ui/compare/v8.13.0...v8.14.0) (2021-12-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-form-field
|
|
9
|
+
|
|
6
10
|
# [8.13.0](https://github.com/instructure/instructure-ui/compare/v8.12.0...v8.13.0) (2021-12-01)
|
|
7
11
|
|
|
8
12
|
### Features
|
package/es/FormField/index.js
CHANGED
|
@@ -30,6 +30,7 @@ import { propTypes, allowedProps } from './props';
|
|
|
30
30
|
---
|
|
31
31
|
category: components
|
|
32
32
|
---
|
|
33
|
+
@tsProps
|
|
33
34
|
**/
|
|
34
35
|
class FormField extends Component {
|
|
35
36
|
constructor() {
|
|
@@ -48,6 +49,7 @@ class FormField extends Component {
|
|
|
48
49
|
|
|
49
50
|
render() {
|
|
50
51
|
return /*#__PURE__*/React.createElement(FormFieldLayout, Object.assign({}, omitProps(this.props, FormField.allowedProps), pickProps(this.props, FormFieldLayout.allowedProps), {
|
|
52
|
+
label: this.props.label,
|
|
51
53
|
vAlign: this.props.vAlign,
|
|
52
54
|
as: "label",
|
|
53
55
|
htmlFor: this.props.id,
|
|
@@ -65,8 +67,7 @@ FormField.defaultProps = {
|
|
|
65
67
|
inline: false,
|
|
66
68
|
layout: 'stacked',
|
|
67
69
|
labelAlign: 'end',
|
|
68
|
-
vAlign: 'middle'
|
|
69
|
-
children: null
|
|
70
|
+
vAlign: 'middle'
|
|
70
71
|
};
|
|
71
72
|
export default FormField;
|
|
72
73
|
export { FormField };
|
package/es/FormField/props.js
CHANGED
|
@@ -25,18 +25,7 @@ import PropTypes from 'prop-types';
|
|
|
25
25
|
import { FormPropTypes } from '../FormPropTypes';
|
|
26
26
|
const propTypes = {
|
|
27
27
|
label: PropTypes.node.isRequired,
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* the id of the input (to link it to its label for a11y)
|
|
31
|
-
*/
|
|
32
28
|
id: PropTypes.string.isRequired,
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* object with shape: `{
|
|
36
|
-
* text: PropTypes.node,
|
|
37
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
38
|
-
* }`
|
|
39
|
-
*/
|
|
40
29
|
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
41
30
|
messagesId: PropTypes.string,
|
|
42
31
|
children: PropTypes.node,
|
|
@@ -46,10 +35,6 @@ const propTypes = {
|
|
|
46
35
|
vAlign: PropTypes.oneOf(['top', 'middle', 'bottom']),
|
|
47
36
|
width: PropTypes.string,
|
|
48
37
|
inputContainerRef: PropTypes.func,
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* provides a reference to the underlying html root element
|
|
52
|
-
*/
|
|
53
38
|
elementRef: PropTypes.func
|
|
54
39
|
};
|
|
55
40
|
const allowedProps = ['label', 'id', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'vAlign', 'width', 'inputContainerRef', 'elementRef'];
|
|
@@ -41,6 +41,7 @@ import { propTypes, allowedProps } from './props';
|
|
|
41
41
|
---
|
|
42
42
|
category: components
|
|
43
43
|
---
|
|
44
|
+
@tsProps
|
|
44
45
|
**/
|
|
45
46
|
let FormFieldGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class FormFieldGroup extends Component {
|
|
46
47
|
constructor() {
|
|
@@ -58,11 +59,15 @@ let FormFieldGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
componentDidMount() {
|
|
61
|
-
|
|
62
|
+
var _this$props$makeStyle, _this$props;
|
|
63
|
+
|
|
64
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStylesVariables);
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
componentDidUpdate(
|
|
65
|
-
|
|
67
|
+
componentDidUpdate() {
|
|
68
|
+
var _this$props$makeStyle2, _this$props2;
|
|
69
|
+
|
|
70
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStylesVariables);
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
get makeStylesVariables() {
|
|
@@ -104,23 +109,22 @@ let FormFieldGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
104
109
|
}
|
|
105
110
|
|
|
106
111
|
render() {
|
|
107
|
-
const _this$
|
|
108
|
-
styles = _this$
|
|
109
|
-
makeStyles = _this$
|
|
110
|
-
props = _objectWithoutProperties(_this$
|
|
112
|
+
const _this$props3 = this.props,
|
|
113
|
+
styles = _this$props3.styles,
|
|
114
|
+
makeStyles = _this$props3.makeStyles,
|
|
115
|
+
props = _objectWithoutProperties(_this$props3, _excluded);
|
|
111
116
|
|
|
112
117
|
return jsx(FormFieldLayout, Object.assign({}, omitProps(props, FormFieldGroup.allowedProps), pickProps(props, FormFieldLayout.allowedProps), {
|
|
113
118
|
vAlign: props.vAlign,
|
|
114
119
|
layout: props.layout === 'inline' ? 'inline' : 'stacked',
|
|
115
120
|
label: props.description,
|
|
116
|
-
"aria-disabled": props.disabled ? 'true' :
|
|
117
|
-
"aria-invalid": this.invalid ? 'true' :
|
|
121
|
+
"aria-disabled": props.disabled ? 'true' : void 0,
|
|
122
|
+
"aria-invalid": this.invalid ? 'true' : void 0,
|
|
118
123
|
elementRef: this.handleRef
|
|
119
124
|
}), this.renderFields());
|
|
120
125
|
}
|
|
121
126
|
|
|
122
127
|
}, _class2.displayName = "FormFieldGroup", _class2.componentId = 'FormFieldGroup', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
123
|
-
children: null,
|
|
124
128
|
as: 'fieldset',
|
|
125
129
|
disabled: false,
|
|
126
130
|
rowSpacing: 'medium',
|
|
@@ -25,23 +25,8 @@ import PropTypes from 'prop-types';
|
|
|
25
25
|
import { FormPropTypes } from '../FormPropTypes';
|
|
26
26
|
const propTypes = {
|
|
27
27
|
description: PropTypes.node.isRequired,
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* the element type to render as
|
|
31
|
-
*/
|
|
32
28
|
as: PropTypes.elementType,
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* object with shape: `{
|
|
36
|
-
* text: PropTypes.node,
|
|
37
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
38
|
-
* }`
|
|
39
|
-
*/
|
|
40
29
|
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* id for the form field messages
|
|
44
|
-
*/
|
|
45
30
|
messagesId: PropTypes.string,
|
|
46
31
|
disabled: PropTypes.bool,
|
|
47
32
|
children: PropTypes.node,
|
|
@@ -50,10 +35,6 @@ const propTypes = {
|
|
|
50
35
|
colSpacing: PropTypes.oneOf(['none', 'small', 'medium', 'large']),
|
|
51
36
|
vAlign: PropTypes.oneOf(['top', 'middle', 'bottom']),
|
|
52
37
|
startAt: PropTypes.oneOf(['small', 'medium', 'large', 'x-large', null]),
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* provides a reference to the underlying html root element
|
|
56
|
-
*/
|
|
57
38
|
elementRef: PropTypes.func
|
|
58
39
|
};
|
|
59
40
|
const allowedProps = ['description', 'as', 'messages', 'messagesId', 'disabled', 'children', 'layout', 'rowSpacing', 'colSpacing', 'vAlign', 'startAt', 'elementRef'];
|
|
@@ -36,6 +36,7 @@ import { propTypes, allowedProps } from './props';
|
|
|
36
36
|
---
|
|
37
37
|
parent: FormField
|
|
38
38
|
---
|
|
39
|
+
@tsProps
|
|
39
40
|
|
|
40
41
|
This is a helper component that is used by most of the custom form
|
|
41
42
|
components. In most cases it shouldn't be used directly.
|
|
@@ -59,19 +60,24 @@ let FormFieldLabel = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
componentDidMount() {
|
|
62
|
-
|
|
63
|
+
var _this$props$makeStyle, _this$props;
|
|
64
|
+
|
|
65
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
componentDidUpdate(
|
|
66
|
-
|
|
68
|
+
componentDidUpdate() {
|
|
69
|
+
var _this$props$makeStyle2, _this$props2;
|
|
70
|
+
|
|
71
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
render() {
|
|
70
75
|
const ElementType = getElementType(FormFieldLabel, this.props);
|
|
71
|
-
const _this$
|
|
72
|
-
styles = _this$
|
|
73
|
-
children = _this$
|
|
74
|
-
return jsx(ElementType
|
|
76
|
+
const _this$props3 = this.props,
|
|
77
|
+
styles = _this$props3.styles,
|
|
78
|
+
children = _this$props3.children;
|
|
79
|
+
return jsx(ElementType // @ts-expect-error TODO: `ref` prop causes: "Expression produces a union type that is too complex to represent.ts(2590)"
|
|
80
|
+
, Object.assign({}, omitProps(this.props, FormFieldLabel.allowedProps), {
|
|
75
81
|
css: styles === null || styles === void 0 ? void 0 : styles.formFieldLabel,
|
|
76
82
|
ref: this.handleRef
|
|
77
83
|
}), children);
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import PropTypes from 'prop-types';
|
|
25
25
|
const propTypes = {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
children: PropTypes.node.isRequired,
|
|
27
|
+
as: PropTypes.elementType
|
|
28
28
|
};
|
|
29
29
|
const allowedProps = ['as', 'children'];
|
|
30
30
|
export { propTypes, allowedProps };
|
|
@@ -45,10 +45,12 @@ import { propTypes, allowedProps } from './props';
|
|
|
45
45
|
---
|
|
46
46
|
parent: FormField
|
|
47
47
|
---
|
|
48
|
+
@tsProps
|
|
48
49
|
**/
|
|
49
50
|
let FormFieldLayout = (_dec = withStyle(generateStyle, null), _dec(_class = (_temp = _class2 = class FormFieldLayout extends Component {
|
|
50
51
|
constructor(props) {
|
|
51
52
|
super(props);
|
|
53
|
+
this._messagesId = void 0;
|
|
52
54
|
this.ref = null;
|
|
53
55
|
|
|
54
56
|
this.handleRef = el => {
|
|
@@ -61,7 +63,7 @@ let FormFieldLayout = (_dec = withStyle(generateStyle, null), _dec(_class = (_te
|
|
|
61
63
|
};
|
|
62
64
|
|
|
63
65
|
this.handleInputContainerRef = node => {
|
|
64
|
-
if (this.props.inputContainerRef) {
|
|
66
|
+
if (typeof this.props.inputContainerRef === 'function') {
|
|
65
67
|
this.props.inputContainerRef(node);
|
|
66
68
|
}
|
|
67
69
|
};
|
|
@@ -72,11 +74,15 @@ let FormFieldLayout = (_dec = withStyle(generateStyle, null), _dec(_class = (_te
|
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
componentDidMount() {
|
|
75
|
-
|
|
77
|
+
var _this$props$makeStyle, _this$props;
|
|
78
|
+
|
|
79
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
76
80
|
}
|
|
77
81
|
|
|
78
|
-
componentDidUpdate(
|
|
79
|
-
|
|
82
|
+
componentDidUpdate() {
|
|
83
|
+
var _this$props$makeStyle2, _this$props2;
|
|
84
|
+
|
|
85
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
80
86
|
}
|
|
81
87
|
|
|
82
88
|
get hasVisibleLabel() {
|
|
@@ -135,10 +141,10 @@ let FormFieldLayout = (_dec = withStyle(generateStyle, null), _dec(_class = (_te
|
|
|
135
141
|
render() {
|
|
136
142
|
const ElementType = this.elementType;
|
|
137
143
|
|
|
138
|
-
const _this$
|
|
139
|
-
makeStyles = _this$
|
|
140
|
-
styles = _this$
|
|
141
|
-
props = _objectWithoutProperties(_this$
|
|
144
|
+
const _this$props3 = this.props,
|
|
145
|
+
makeStyles = _this$props3.makeStyles,
|
|
146
|
+
styles = _this$props3.styles,
|
|
147
|
+
props = _objectWithoutProperties(_this$props3, _excluded);
|
|
142
148
|
|
|
143
149
|
const width = props.width,
|
|
144
150
|
layout = props.layout,
|
|
@@ -148,7 +154,7 @@ let FormFieldLayout = (_dec = withStyle(generateStyle, null), _dec(_class = (_te
|
|
|
148
154
|
style: {
|
|
149
155
|
width
|
|
150
156
|
},
|
|
151
|
-
"aria-describedby": this.hasMessages ? this._messagesId :
|
|
157
|
+
"aria-describedby": this.hasMessages ? this._messagesId : void 0,
|
|
152
158
|
ref: this.handleRef
|
|
153
159
|
}), this.elementType === 'fieldset' && this.renderLegend(), jsx(Grid, Object.assign({
|
|
154
160
|
rowSpacing: "small",
|
|
@@ -161,7 +167,6 @@ let FormFieldLayout = (_dec = withStyle(generateStyle, null), _dec(_class = (_te
|
|
|
161
167
|
}
|
|
162
168
|
|
|
163
169
|
}, _class2.displayName = "FormFieldLayout", _class2.componentId = 'FormFieldLayout', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
164
|
-
children: null,
|
|
165
170
|
inline: false,
|
|
166
171
|
layout: 'stacked',
|
|
167
172
|
as: 'label',
|
|
@@ -25,40 +25,21 @@ import PropTypes from 'prop-types';
|
|
|
25
25
|
import { FormPropTypes } from '../FormPropTypes';
|
|
26
26
|
const propTypes = {
|
|
27
27
|
label: PropTypes.node.isRequired,
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* the id of the input (to link it to its label for a11y)
|
|
31
|
-
*/
|
|
32
28
|
id: PropTypes.string,
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* the element type to render as
|
|
36
|
-
*/
|
|
37
29
|
as: PropTypes.elementType,
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* object with shape: `{
|
|
41
|
-
* text: PropTypes.node,
|
|
42
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
43
|
-
* }`
|
|
44
|
-
*/
|
|
45
30
|
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* id for the form field messages
|
|
49
|
-
*/
|
|
50
31
|
messagesId: PropTypes.string,
|
|
51
32
|
children: PropTypes.node,
|
|
52
33
|
inline: PropTypes.bool,
|
|
53
34
|
layout: PropTypes.oneOf(['stacked', 'inline']),
|
|
54
35
|
labelAlign: PropTypes.oneOf(['start', 'end']),
|
|
36
|
+
vAlign: PropTypes.oneOf(['top', 'middle', 'bottom']),
|
|
55
37
|
width: PropTypes.string,
|
|
56
38
|
inputContainerRef: PropTypes.func,
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* provides a reference to the underlying html root element
|
|
60
|
-
*/
|
|
61
39
|
elementRef: PropTypes.func
|
|
62
40
|
};
|
|
63
|
-
const allowedProps = ['label', 'id', 'as', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef', 'elementRef'
|
|
41
|
+
const allowedProps = ['label', 'id', 'as', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef', 'elementRef' // added vAlign because FormField and FormFieldGroup passes it, but not adding
|
|
42
|
+
// it to allowedProps to prevent it from getting passed through accidentally
|
|
43
|
+
//'vAlign'
|
|
44
|
+
];
|
|
64
45
|
export { propTypes, allowedProps };
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* @param {Object} state the state of the component, the style is applied to
|
|
33
33
|
* @return {Object} The final style object, which will be used in the component
|
|
34
34
|
*/
|
|
35
|
-
const generateStyle = (
|
|
35
|
+
const generateStyle = (_componentTheme, props) => {
|
|
36
36
|
const inline = props.inline;
|
|
37
37
|
return {
|
|
38
38
|
formFieldLayout: {
|
|
@@ -36,6 +36,7 @@ import { propTypes, allowedProps } from './props';
|
|
|
36
36
|
---
|
|
37
37
|
parent: FormField
|
|
38
38
|
---
|
|
39
|
+
@tsProps
|
|
39
40
|
|
|
40
41
|
This is a helper component that is used by most of the custom form
|
|
41
42
|
components. In most cases it shouldn't be used directly.
|
|
@@ -58,17 +59,21 @@ let FormFieldMessage = (_dec = withStyle(generateStyle, generateComponentTheme),
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
componentDidMount() {
|
|
61
|
-
|
|
62
|
+
var _this$props$makeStyle, _this$props;
|
|
63
|
+
|
|
64
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
componentDidUpdate(
|
|
65
|
-
|
|
67
|
+
componentDidUpdate() {
|
|
68
|
+
var _this$props$makeStyle2, _this$props2;
|
|
69
|
+
|
|
70
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
render() {
|
|
69
|
-
const _this$
|
|
70
|
-
children = _this$
|
|
71
|
-
styles = _this$
|
|
74
|
+
const _this$props3 = this.props,
|
|
75
|
+
children = _this$props3.children,
|
|
76
|
+
styles = _this$props3.styles;
|
|
72
77
|
return this.props.variant !== 'screenreader-only' ? jsx("span", {
|
|
73
78
|
css: styles === null || styles === void 0 ? void 0 : styles.formFieldMessage,
|
|
74
79
|
ref: this.handleRef
|
|
@@ -78,8 +83,7 @@ let FormFieldMessage = (_dec = withStyle(generateStyle, generateComponentTheme),
|
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
}, _class2.displayName = "FormFieldMessage", _class2.componentId = 'FormFieldMessage', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
81
|
-
variant: 'hint'
|
|
82
|
-
children: null
|
|
86
|
+
variant: 'hint'
|
|
83
87
|
}, _temp)) || _class);
|
|
84
88
|
export default FormFieldMessage;
|
|
85
89
|
export { FormFieldMessage };
|
|
@@ -37,6 +37,7 @@ import { propTypes, allowedProps } from './props';
|
|
|
37
37
|
---
|
|
38
38
|
parent: FormField
|
|
39
39
|
---
|
|
40
|
+
@tsProps
|
|
40
41
|
|
|
41
42
|
A FormFieldMessages component
|
|
42
43
|
|
|
@@ -62,17 +63,21 @@ let FormFieldMessages = (_dec = withStyle(generateStyle, generateComponentTheme)
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
componentDidMount() {
|
|
65
|
-
|
|
66
|
+
var _this$props$makeStyle, _this$props;
|
|
67
|
+
|
|
68
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
componentDidUpdate(
|
|
69
|
-
|
|
71
|
+
componentDidUpdate() {
|
|
72
|
+
var _this$props$makeStyle2, _this$props2;
|
|
73
|
+
|
|
74
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
70
75
|
}
|
|
71
76
|
|
|
72
77
|
render() {
|
|
73
|
-
const _this$
|
|
74
|
-
messages = _this$
|
|
75
|
-
styles = _this$
|
|
78
|
+
const _this$props3 = this.props,
|
|
79
|
+
messages = _this$props3.messages,
|
|
80
|
+
styles = _this$props3.styles;
|
|
76
81
|
return messages && messages.length > 0 ? jsx("span", Object.assign({
|
|
77
82
|
css: styles === null || styles === void 0 ? void 0 : styles.formFieldMessages
|
|
78
83
|
}, omitProps(this.props, FormFieldMessages.allowedProps), {
|
|
@@ -24,12 +24,6 @@
|
|
|
24
24
|
import PropTypes from 'prop-types';
|
|
25
25
|
import { FormPropTypes } from '../FormPropTypes';
|
|
26
26
|
const propTypes = {
|
|
27
|
-
/**
|
|
28
|
-
* object with shape: `{
|
|
29
|
-
* text: PropTypes.node,
|
|
30
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
31
|
-
* }`
|
|
32
|
-
*/
|
|
33
27
|
messages: PropTypes.arrayOf(FormPropTypes.message)
|
|
34
28
|
};
|
|
35
29
|
const allowedProps = ['messages'];
|
package/lib/FormField/index.js
CHANGED
|
@@ -45,6 +45,7 @@ var _props = require("./props");
|
|
|
45
45
|
---
|
|
46
46
|
category: components
|
|
47
47
|
---
|
|
48
|
+
@tsProps
|
|
48
49
|
**/
|
|
49
50
|
class FormField extends _react.Component {
|
|
50
51
|
constructor() {
|
|
@@ -63,6 +64,7 @@ class FormField extends _react.Component {
|
|
|
63
64
|
|
|
64
65
|
render() {
|
|
65
66
|
return /*#__PURE__*/_react.default.createElement(_FormFieldLayout.FormFieldLayout, Object.assign({}, (0, _omitProps.omitProps)(this.props, FormField.allowedProps), (0, _pickProps.pickProps)(this.props, _FormFieldLayout.FormFieldLayout.allowedProps), {
|
|
67
|
+
label: this.props.label,
|
|
66
68
|
vAlign: this.props.vAlign,
|
|
67
69
|
as: "label",
|
|
68
70
|
htmlFor: this.props.id,
|
|
@@ -81,8 +83,7 @@ FormField.defaultProps = {
|
|
|
81
83
|
inline: false,
|
|
82
84
|
layout: 'stacked',
|
|
83
85
|
labelAlign: 'end',
|
|
84
|
-
vAlign: 'middle'
|
|
85
|
-
children: null
|
|
86
|
+
vAlign: 'middle'
|
|
86
87
|
};
|
|
87
88
|
var _default = FormField;
|
|
88
89
|
exports.default = _default;
|
package/lib/FormField/props.js
CHANGED
|
@@ -36,18 +36,7 @@ var _FormPropTypes = require("../FormPropTypes");
|
|
|
36
36
|
*/
|
|
37
37
|
const propTypes = {
|
|
38
38
|
label: _propTypes.default.node.isRequired,
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* the id of the input (to link it to its label for a11y)
|
|
42
|
-
*/
|
|
43
39
|
id: _propTypes.default.string.isRequired,
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* object with shape: `{
|
|
47
|
-
* text: PropTypes.node,
|
|
48
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
49
|
-
* }`
|
|
50
|
-
*/
|
|
51
40
|
messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
|
|
52
41
|
messagesId: _propTypes.default.string,
|
|
53
42
|
children: _propTypes.default.node,
|
|
@@ -57,10 +46,6 @@ const propTypes = {
|
|
|
57
46
|
vAlign: _propTypes.default.oneOf(['top', 'middle', 'bottom']),
|
|
58
47
|
width: _propTypes.default.string,
|
|
59
48
|
inputContainerRef: _propTypes.default.func,
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* provides a reference to the underlying html root element
|
|
63
|
-
*/
|
|
64
49
|
elementRef: _propTypes.default.func
|
|
65
50
|
};
|
|
66
51
|
exports.propTypes = propTypes;
|
|
@@ -35,6 +35,7 @@ var _dec, _class, _class2, _temp;
|
|
|
35
35
|
---
|
|
36
36
|
category: components
|
|
37
37
|
---
|
|
38
|
+
@tsProps
|
|
38
39
|
**/
|
|
39
40
|
let FormFieldGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class FormFieldGroup extends _react.Component {
|
|
40
41
|
constructor() {
|
|
@@ -52,11 +53,15 @@ let FormFieldGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
componentDidMount() {
|
|
55
|
-
|
|
56
|
+
var _this$props$makeStyle, _this$props;
|
|
57
|
+
|
|
58
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStylesVariables);
|
|
56
59
|
}
|
|
57
60
|
|
|
58
|
-
componentDidUpdate(
|
|
59
|
-
|
|
61
|
+
componentDidUpdate() {
|
|
62
|
+
var _this$props$makeStyle2, _this$props2;
|
|
63
|
+
|
|
64
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStylesVariables);
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
get makeStylesVariables() {
|
|
@@ -98,22 +103,21 @@ let FormFieldGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
|
|
|
98
103
|
}
|
|
99
104
|
|
|
100
105
|
render() {
|
|
101
|
-
const _this$
|
|
102
|
-
styles = _this$
|
|
103
|
-
makeStyles = _this$
|
|
104
|
-
props = (0, _objectWithoutProperties2.default)(_this$
|
|
106
|
+
const _this$props3 = this.props,
|
|
107
|
+
styles = _this$props3.styles,
|
|
108
|
+
makeStyles = _this$props3.makeStyles,
|
|
109
|
+
props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
105
110
|
return (0, _emotion.jsx)(_FormFieldLayout.FormFieldLayout, Object.assign({}, (0, _omitProps.omitProps)(props, FormFieldGroup.allowedProps), (0, _pickProps.pickProps)(props, _FormFieldLayout.FormFieldLayout.allowedProps), {
|
|
106
111
|
vAlign: props.vAlign,
|
|
107
112
|
layout: props.layout === 'inline' ? 'inline' : 'stacked',
|
|
108
113
|
label: props.description,
|
|
109
|
-
"aria-disabled": props.disabled ? 'true' :
|
|
110
|
-
"aria-invalid": this.invalid ? 'true' :
|
|
114
|
+
"aria-disabled": props.disabled ? 'true' : void 0,
|
|
115
|
+
"aria-invalid": this.invalid ? 'true' : void 0,
|
|
111
116
|
elementRef: this.handleRef
|
|
112
117
|
}), this.renderFields());
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
}, _class2.displayName = "FormFieldGroup", _class2.componentId = 'FormFieldGroup', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
116
|
-
children: null,
|
|
117
121
|
as: 'fieldset',
|
|
118
122
|
disabled: false,
|
|
119
123
|
rowSpacing: 'medium',
|
|
@@ -36,23 +36,8 @@ var _FormPropTypes = require("../FormPropTypes");
|
|
|
36
36
|
*/
|
|
37
37
|
const propTypes = {
|
|
38
38
|
description: _propTypes.default.node.isRequired,
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* the element type to render as
|
|
42
|
-
*/
|
|
43
39
|
as: _propTypes.default.elementType,
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* object with shape: `{
|
|
47
|
-
* text: PropTypes.node,
|
|
48
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
49
|
-
* }`
|
|
50
|
-
*/
|
|
51
40
|
messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* id for the form field messages
|
|
55
|
-
*/
|
|
56
41
|
messagesId: _propTypes.default.string,
|
|
57
42
|
disabled: _propTypes.default.bool,
|
|
58
43
|
children: _propTypes.default.node,
|
|
@@ -61,10 +46,6 @@ const propTypes = {
|
|
|
61
46
|
colSpacing: _propTypes.default.oneOf(['none', 'small', 'medium', 'large']),
|
|
62
47
|
vAlign: _propTypes.default.oneOf(['top', 'middle', 'bottom']),
|
|
63
48
|
startAt: _propTypes.default.oneOf(['small', 'medium', 'large', 'x-large', null]),
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* provides a reference to the underlying html root element
|
|
67
|
-
*/
|
|
68
49
|
elementRef: _propTypes.default.func
|
|
69
50
|
};
|
|
70
51
|
exports.propTypes = propTypes;
|
|
@@ -27,6 +27,7 @@ var _dec, _class, _class2, _temp;
|
|
|
27
27
|
---
|
|
28
28
|
parent: FormField
|
|
29
29
|
---
|
|
30
|
+
@tsProps
|
|
30
31
|
|
|
31
32
|
This is a helper component that is used by most of the custom form
|
|
32
33
|
components. In most cases it shouldn't be used directly.
|
|
@@ -50,19 +51,24 @@ let FormFieldLabel = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
componentDidMount() {
|
|
53
|
-
|
|
54
|
+
var _this$props$makeStyle, _this$props;
|
|
55
|
+
|
|
56
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
componentDidUpdate(
|
|
57
|
-
|
|
59
|
+
componentDidUpdate() {
|
|
60
|
+
var _this$props$makeStyle2, _this$props2;
|
|
61
|
+
|
|
62
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
render() {
|
|
61
66
|
const ElementType = (0, _getElementType.getElementType)(FormFieldLabel, this.props);
|
|
62
|
-
const _this$
|
|
63
|
-
styles = _this$
|
|
64
|
-
children = _this$
|
|
65
|
-
return (0, _emotion.jsx)(ElementType
|
|
67
|
+
const _this$props3 = this.props,
|
|
68
|
+
styles = _this$props3.styles,
|
|
69
|
+
children = _this$props3.children;
|
|
70
|
+
return (0, _emotion.jsx)(ElementType // @ts-expect-error TODO: `ref` prop causes: "Expression produces a union type that is too complex to represent.ts(2590)"
|
|
71
|
+
, Object.assign({}, (0, _omitProps.omitProps)(this.props, FormFieldLabel.allowedProps), {
|
|
66
72
|
css: styles === null || styles === void 0 ? void 0 : styles.formFieldLabel,
|
|
67
73
|
ref: this.handleRef
|
|
68
74
|
}), children);
|
|
@@ -33,8 +33,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
33
33
|
* SOFTWARE.
|
|
34
34
|
*/
|
|
35
35
|
const propTypes = {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
children: _propTypes.default.node.isRequired,
|
|
37
|
+
as: _propTypes.default.elementType
|
|
38
38
|
};
|
|
39
39
|
exports.propTypes = propTypes;
|
|
40
40
|
const allowedProps = ['as', 'children'];
|