@instructure/ui-form-field 8.8.1-snapshot.3 → 8.9.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 +6 -0
- package/es/FormField/index.js +4 -31
- package/es/FormField/props.js +51 -0
- package/es/FormFieldGroup/index.js +3 -39
- package/es/FormFieldGroup/props.js +55 -0
- package/es/FormFieldLabel/index.js +3 -10
- package/{src/FormFieldMessage/types.ts → es/FormFieldLabel/props.js} +7 -8
- package/es/FormFieldLayout/index.js +4 -45
- package/es/FormFieldLayout/props.js +59 -0
- package/es/FormFieldMessage/index.js +3 -10
- package/{src/FormFieldLabel/types.ts → es/FormFieldMessage/props.js} +7 -9
- package/es/FormFieldMessages/index.js +4 -20
- package/{src/FormField/types.ts → es/FormFieldMessages/props.js} +13 -16
- package/lib/FormField/index.js +5 -35
- package/lib/FormField/props.js +63 -0
- package/lib/FormFieldGroup/index.js +4 -41
- package/lib/FormFieldGroup/props.js +67 -0
- package/lib/FormFieldLabel/index.js +4 -11
- package/{src/FormFieldLayout/types.ts → lib/FormFieldLabel/props.js} +18 -18
- package/lib/FormFieldLayout/index.js +5 -47
- package/lib/FormFieldLayout/props.js +71 -0
- package/lib/FormFieldMessage/index.js +4 -11
- package/lib/FormFieldMessage/props.js +41 -0
- package/lib/FormFieldMessages/index.js +5 -22
- package/lib/FormFieldMessages/props.js +48 -0
- package/package.json +15 -16
- package/src/FormField/index.tsx +6 -31
- package/src/FormField/props.ts +91 -0
- package/src/FormFieldGroup/index.tsx +6 -38
- package/src/FormFieldGroup/props.ts +98 -0
- package/src/FormFieldGroup/styles.ts +1 -1
- package/src/FormFieldLabel/index.tsx +7 -13
- package/src/{FormFieldGroup/types.ts → FormFieldLabel/props.ts} +20 -16
- package/src/FormFieldLabel/styles.ts +1 -1
- package/src/FormFieldLayout/index.tsx +8 -44
- package/src/FormFieldLayout/props.ts +97 -0
- package/src/FormFieldLayout/styles.ts +1 -1
- package/src/FormFieldMessage/index.tsx +6 -12
- package/src/FormFieldMessage/props.ts +50 -0
- package/src/FormFieldMessage/styles.ts +1 -1
- package/src/FormFieldMessages/index.tsx +8 -22
- package/src/FormFieldMessages/{types.ts → props.ts} +29 -4
- package/src/index.ts +6 -6
- package/types/FormField/index.d.ts +28 -32
- package/types/FormField/index.d.ts.map +1 -1
- package/types/FormField/props.d.ts +24 -0
- package/types/FormField/props.d.ts.map +1 -0
- package/types/FormFieldGroup/index.d.ts +27 -36
- package/types/FormFieldGroup/index.d.ts.map +1 -1
- package/types/FormFieldGroup/props.d.ts +28 -0
- package/types/FormFieldGroup/props.d.ts.map +1 -0
- package/types/FormFieldGroup/styles.d.ts +1 -1
- package/types/FormFieldLabel/index.d.ts +10 -9
- package/types/FormFieldLabel/index.d.ts.map +1 -1
- package/types/FormFieldLabel/props.d.ts +15 -0
- package/types/FormFieldLabel/props.d.ts.map +1 -0
- package/types/FormFieldLabel/styles.d.ts +1 -1
- package/types/FormFieldLayout/index.d.ts +33 -46
- package/types/FormFieldLayout/index.d.ts.map +1 -1
- package/types/FormFieldLayout/props.d.ts +25 -0
- package/types/FormFieldLayout/props.d.ts.map +1 -0
- package/types/FormFieldLayout/styles.d.ts +1 -1
- package/types/FormFieldMessage/index.d.ts +9 -8
- package/types/FormFieldMessage/index.d.ts.map +1 -1
- package/types/FormFieldMessage/props.d.ts +16 -0
- package/types/FormFieldMessage/props.d.ts.map +1 -0
- package/types/FormFieldMessage/styles.d.ts +1 -1
- package/types/FormFieldMessages/index.d.ts +4 -19
- package/types/FormFieldMessages/index.d.ts.map +1 -1
- package/types/FormFieldMessages/props.d.ts +14 -0
- package/types/FormFieldMessages/props.d.ts.map +1 -0
- package/types/index.d.ts +6 -6
- package/LICENSE.md +0 -27
- package/es/FormField/types.js +0 -1
- package/es/FormFieldGroup/types.js +0 -1
- package/es/FormFieldLabel/types.js +0 -1
- package/es/FormFieldLayout/types.js +0 -1
- package/es/FormFieldMessage/types.js +0 -1
- package/es/FormFieldMessages/types.js +0 -1
- package/lib/FormField/types.js +0 -1
- package/lib/FormFieldGroup/types.js +0 -1
- package/lib/FormFieldLabel/types.js +0 -1
- package/lib/FormFieldLayout/types.js +0 -1
- package/lib/FormFieldMessage/types.js +0 -1
- package/lib/FormFieldMessages/types.js +0 -1
- package/types/FormField/types.d.ts +0 -15
- package/types/FormField/types.d.ts.map +0 -1
- package/types/FormFieldGroup/types.d.ts +0 -21
- package/types/FormFieldGroup/types.d.ts.map +0 -1
- package/types/FormFieldLabel/types.d.ts +0 -8
- package/types/FormFieldLabel/types.d.ts.map +0 -1
- package/types/FormFieldLayout/types.d.ts +0 -18
- package/types/FormFieldLayout/types.d.ts.map +0 -1
- package/types/FormFieldMessage/types.d.ts +0 -7
- package/types/FormFieldMessage/types.d.ts.map +0 -1
- package/types/FormFieldMessages/types.d.ts +0 -7
- package/types/FormFieldMessages/types.d.ts.map +0 -1
|
@@ -11,8 +11,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
|
|
12
12
|
var _react = require("react");
|
|
13
13
|
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
14
|
var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
|
|
17
15
|
|
|
18
16
|
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
|
@@ -35,10 +33,10 @@ var _FormFieldLabel = require("../FormFieldLabel");
|
|
|
35
33
|
|
|
36
34
|
var _FormFieldMessages = require("../FormFieldMessages");
|
|
37
35
|
|
|
38
|
-
var _FormPropTypes = require("../FormPropTypes");
|
|
39
|
-
|
|
40
36
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
41
37
|
|
|
38
|
+
var _props = require("./props");
|
|
39
|
+
|
|
42
40
|
const _excluded = ["makeStyles", "styles"];
|
|
43
41
|
|
|
44
42
|
var _dec, _class, _class2, _temp;
|
|
@@ -136,7 +134,7 @@ let FormFieldLayout = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_cl
|
|
|
136
134
|
return (0, _emotion.jsx)(ElementType, Object.assign({}, (0, _omitProps.omitProps)(props, { ...FormFieldLayout.propTypes,
|
|
137
135
|
..._Grid.Grid.propTypes
|
|
138
136
|
}), {
|
|
139
|
-
css: styles.formFieldLayout,
|
|
137
|
+
css: styles === null || styles === void 0 ? void 0 : styles.formFieldLayout,
|
|
140
138
|
style: {
|
|
141
139
|
width
|
|
142
140
|
},
|
|
@@ -151,52 +149,12 @@ let FormFieldLayout = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_cl
|
|
|
151
149
|
}, children)), this.renderVisibleMessages()));
|
|
152
150
|
}
|
|
153
151
|
|
|
154
|
-
}, _class2.displayName = "FormFieldLayout", _class2.componentId = 'FormFieldLayout', _class2.propTypes = {
|
|
155
|
-
// eslint-disable-next-line react/require-default-props
|
|
156
|
-
makeStyles: _propTypes.default.func,
|
|
157
|
-
// eslint-disable-next-line react/require-default-props
|
|
158
|
-
styles: _propTypes.default.object,
|
|
159
|
-
label: _propTypes.default.node.isRequired,
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* the id of the input (to link it to its label for a11y)
|
|
163
|
-
*/
|
|
164
|
-
id: _propTypes.default.string,
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* the element type to render as
|
|
168
|
-
*/
|
|
169
|
-
as: _propTypes.default.elementType,
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* object with shape: `{
|
|
173
|
-
* text: PropTypes.string,
|
|
174
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
175
|
-
* }`
|
|
176
|
-
*/
|
|
177
|
-
messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* id for the form field messages
|
|
181
|
-
*/
|
|
182
|
-
messagesId: _propTypes.default.string,
|
|
183
|
-
children: _propTypes.default.node,
|
|
184
|
-
inline: _propTypes.default.bool,
|
|
185
|
-
layout: _propTypes.default.oneOf(['stacked', 'inline']),
|
|
186
|
-
labelAlign: _propTypes.default.oneOf(['start', 'end']),
|
|
187
|
-
width: _propTypes.default.string,
|
|
188
|
-
inputContainerRef: _propTypes.default.func
|
|
189
|
-
}, _class2.defaultProps = {
|
|
190
|
-
id: void 0,
|
|
191
|
-
width: void 0,
|
|
192
|
-
messages: void 0,
|
|
193
|
-
messagesId: void 0,
|
|
152
|
+
}, _class2.displayName = "FormFieldLayout", _class2.componentId = 'FormFieldLayout', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
194
153
|
children: null,
|
|
195
154
|
inline: false,
|
|
196
155
|
layout: 'stacked',
|
|
197
156
|
as: 'label',
|
|
198
|
-
labelAlign: 'end'
|
|
199
|
-
inputContainerRef: void 0
|
|
157
|
+
labelAlign: 'end'
|
|
200
158
|
}, _temp)) || _class);
|
|
201
159
|
exports.FormFieldLayout = FormFieldLayout;
|
|
202
160
|
var _default = FormFieldLayout;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _FormPropTypes = require("../FormPropTypes");
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* The MIT License (MIT)
|
|
16
|
+
*
|
|
17
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
18
|
+
*
|
|
19
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
21
|
+
* in the Software without restriction, including without limitation the rights
|
|
22
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
24
|
+
* furnished to do so, subject to the following conditions:
|
|
25
|
+
*
|
|
26
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
27
|
+
* copies or substantial portions of the Software.
|
|
28
|
+
*
|
|
29
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
|
+
* SOFTWARE.
|
|
36
|
+
*/
|
|
37
|
+
const propTypes = {
|
|
38
|
+
label: _propTypes.default.node.isRequired,
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* the id of the input (to link it to its label for a11y)
|
|
42
|
+
*/
|
|
43
|
+
id: _propTypes.default.string,
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* the element type to render as
|
|
47
|
+
*/
|
|
48
|
+
as: _propTypes.default.elementType,
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* object with shape: `{
|
|
52
|
+
* text: PropTypes.string,
|
|
53
|
+
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
54
|
+
* }`
|
|
55
|
+
*/
|
|
56
|
+
messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* id for the form field messages
|
|
60
|
+
*/
|
|
61
|
+
messagesId: _propTypes.default.string,
|
|
62
|
+
children: _propTypes.default.node,
|
|
63
|
+
inline: _propTypes.default.bool,
|
|
64
|
+
layout: _propTypes.default.oneOf(['stacked', 'inline']),
|
|
65
|
+
labelAlign: _propTypes.default.oneOf(['start', 'end']),
|
|
66
|
+
width: _propTypes.default.string,
|
|
67
|
+
inputContainerRef: _propTypes.default.func
|
|
68
|
+
};
|
|
69
|
+
exports.propTypes = propTypes;
|
|
70
|
+
const allowedProps = ['label', 'id', 'as', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef'];
|
|
71
|
+
exports.allowedProps = allowedProps;
|
|
@@ -9,8 +9,6 @@ exports.FormFieldMessage = exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
12
|
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
|
15
13
|
|
|
16
14
|
var _emotion = require("@instructure/emotion");
|
|
@@ -19,6 +17,8 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
19
17
|
|
|
20
18
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
21
19
|
|
|
20
|
+
var _props = require("./props");
|
|
21
|
+
|
|
22
22
|
var _dec, _class, _class2, _temp;
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -50,18 +50,11 @@ let FormFieldMessage = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.d
|
|
|
50
50
|
children = _this$props.children,
|
|
51
51
|
styles = _this$props.styles;
|
|
52
52
|
return this.props.variant !== 'screenreader-only' ? (0, _emotion.jsx)("span", {
|
|
53
|
-
css: styles.formFieldMessage
|
|
53
|
+
css: styles === null || styles === void 0 ? void 0 : styles.formFieldMessage
|
|
54
54
|
}, children) : (0, _emotion.jsx)(_ScreenReaderContent.ScreenReaderContent, null, children);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
}, _class2.displayName = "FormFieldMessage", _class2.componentId = 'FormFieldMessage', _class2.propTypes = {
|
|
58
|
-
// eslint-disable-next-line react/require-default-props
|
|
59
|
-
makeStyles: _propTypes.default.func,
|
|
60
|
-
// eslint-disable-next-line react/require-default-props
|
|
61
|
-
styles: _propTypes.default.object,
|
|
62
|
-
variant: _propTypes.default.oneOf(['error', 'hint', 'success', 'screenreader-only']),
|
|
63
|
-
children: _propTypes.default.node
|
|
64
|
-
}, _class2.defaultProps = {
|
|
57
|
+
}, _class2.displayName = "FormFieldMessage", _class2.componentId = 'FormFieldMessage', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
65
58
|
variant: 'hint',
|
|
66
59
|
children: null
|
|
67
60
|
}, _temp)) || _class);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* The MIT License (MIT)
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
16
|
+
*
|
|
17
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
19
|
+
* in the Software without restriction, including without limitation the rights
|
|
20
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
22
|
+
* furnished to do so, subject to the following conditions:
|
|
23
|
+
*
|
|
24
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
25
|
+
* copies or substantial portions of the Software.
|
|
26
|
+
*
|
|
27
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
|
+
* SOFTWARE.
|
|
34
|
+
*/
|
|
35
|
+
const propTypes = {
|
|
36
|
+
variant: _propTypes.default.oneOf(['error', 'hint', 'success', 'screenreader-only']),
|
|
37
|
+
children: _propTypes.default.node
|
|
38
|
+
};
|
|
39
|
+
exports.propTypes = propTypes;
|
|
40
|
+
const allowedProps = ['variant', 'children'];
|
|
41
|
+
exports.allowedProps = allowedProps;
|
|
@@ -9,20 +9,18 @@ exports.FormFieldMessages = exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
12
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
15
13
|
|
|
16
14
|
var _emotion = require("@instructure/emotion");
|
|
17
15
|
|
|
18
|
-
var _FormPropTypes = require("../FormPropTypes");
|
|
19
|
-
|
|
20
16
|
var _FormFieldMessage = require("../FormFieldMessage");
|
|
21
17
|
|
|
22
18
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
23
19
|
|
|
24
20
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
25
21
|
|
|
22
|
+
var _props = require("./props");
|
|
23
|
+
|
|
26
24
|
var _dec, _class, _class2, _temp;
|
|
27
25
|
|
|
28
26
|
/**
|
|
@@ -57,33 +55,18 @@ let FormFieldMessages = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.
|
|
|
57
55
|
messages = _this$props.messages,
|
|
58
56
|
styles = _this$props.styles;
|
|
59
57
|
return messages && messages.length > 0 ? (0, _emotion.jsx)("span", Object.assign({
|
|
60
|
-
css: styles.formFieldMessages
|
|
58
|
+
css: styles === null || styles === void 0 ? void 0 : styles.formFieldMessages
|
|
61
59
|
}, (0, _omitProps.omitProps)(this.props, FormFieldMessages.propTypes)), messages.map((msg, i) => {
|
|
62
60
|
return (0, _emotion.jsx)("span", {
|
|
63
61
|
key: `error${i}`,
|
|
64
|
-
css: styles.message
|
|
62
|
+
css: styles === null || styles === void 0 ? void 0 : styles.message
|
|
65
63
|
}, (0, _emotion.jsx)(_FormFieldMessage.FormFieldMessage, {
|
|
66
64
|
variant: msg.type
|
|
67
65
|
}, msg.text));
|
|
68
66
|
})) : null;
|
|
69
67
|
}
|
|
70
68
|
|
|
71
|
-
}, _class2.displayName = "FormFieldMessages", _class2.componentId = 'FormFieldMessages', _class2.propTypes = {
|
|
72
|
-
// eslint-disable-next-line react/require-default-props
|
|
73
|
-
makeStyles: _propTypes.default.func,
|
|
74
|
-
// eslint-disable-next-line react/require-default-props
|
|
75
|
-
styles: _propTypes.default.object,
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* object with shape: `{
|
|
79
|
-
* text: PropTypes.string,
|
|
80
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
81
|
-
* }`
|
|
82
|
-
*/
|
|
83
|
-
messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message)
|
|
84
|
-
}, _class2.defaultProps = {
|
|
85
|
-
messages: void 0
|
|
86
|
-
}, _temp)) || _class);
|
|
69
|
+
}, _class2.displayName = "FormFieldMessages", _class2.componentId = 'FormFieldMessages', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {}, _temp)) || _class);
|
|
87
70
|
exports.FormFieldMessages = FormFieldMessages;
|
|
88
71
|
var _default = FormFieldMessages;
|
|
89
72
|
exports.default = _default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _FormPropTypes = require("../FormPropTypes");
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* The MIT License (MIT)
|
|
16
|
+
*
|
|
17
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
18
|
+
*
|
|
19
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
21
|
+
* in the Software without restriction, including without limitation the rights
|
|
22
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
24
|
+
* furnished to do so, subject to the following conditions:
|
|
25
|
+
*
|
|
26
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
27
|
+
* copies or substantial portions of the Software.
|
|
28
|
+
*
|
|
29
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
|
+
* SOFTWARE.
|
|
36
|
+
*/
|
|
37
|
+
const propTypes = {
|
|
38
|
+
/**
|
|
39
|
+
* object with shape: `{
|
|
40
|
+
* text: PropTypes.string,
|
|
41
|
+
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
42
|
+
* }`
|
|
43
|
+
*/
|
|
44
|
+
messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message)
|
|
45
|
+
};
|
|
46
|
+
exports.propTypes = propTypes;
|
|
47
|
+
const allowedProps = ['messages'];
|
|
48
|
+
exports.allowedProps = allowedProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-form-field",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.0",
|
|
4
4
|
"description": "Form layout components.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -24,22 +24,22 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@instructure/
|
|
28
|
-
"@instructure/ui-
|
|
29
|
-
"@instructure/ui-
|
|
30
|
-
"@instructure/ui-themes": "8.8.1-snapshot.3+d5d6d4cd8"
|
|
27
|
+
"@instructure/ui-babel-preset": "8.9.0",
|
|
28
|
+
"@instructure/ui-test-utils": "8.9.0",
|
|
29
|
+
"@instructure/ui-themes": "8.9.0"
|
|
31
30
|
},
|
|
32
31
|
"dependencies": {
|
|
33
32
|
"@babel/runtime": "^7.13.10",
|
|
34
|
-
"@instructure/console": "8.
|
|
35
|
-
"@instructure/emotion": "8.
|
|
36
|
-
"@instructure/
|
|
37
|
-
"@instructure/ui-a11y-
|
|
38
|
-
"@instructure/ui-
|
|
39
|
-
"@instructure/ui-
|
|
40
|
-
"@instructure/ui-
|
|
41
|
-
"@instructure/ui-utils": "8.
|
|
42
|
-
"@instructure/
|
|
33
|
+
"@instructure/console": "8.9.0",
|
|
34
|
+
"@instructure/emotion": "8.9.0",
|
|
35
|
+
"@instructure/shared-types": "8.9.0",
|
|
36
|
+
"@instructure/ui-a11y-content": "8.9.0",
|
|
37
|
+
"@instructure/ui-a11y-utils": "8.9.0",
|
|
38
|
+
"@instructure/ui-grid": "8.9.0",
|
|
39
|
+
"@instructure/ui-icons": "8.9.0",
|
|
40
|
+
"@instructure/ui-react-utils": "8.9.0",
|
|
41
|
+
"@instructure/ui-utils": "8.9.0",
|
|
42
|
+
"@instructure/uid": "8.9.0",
|
|
43
43
|
"prop-types": "^15"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
@@ -47,6 +47,5 @@
|
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
|
-
}
|
|
51
|
-
"gitHead": "d5d6d4cd8f300e8635c69248f5d794c002269e08"
|
|
50
|
+
}
|
|
52
51
|
}
|
package/src/FormField/index.tsx
CHANGED
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React, { Component } from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
26
|
|
|
28
27
|
import { omitProps, pickProps } from '@instructure/ui-react-utils'
|
|
29
28
|
|
|
30
|
-
import { FormPropTypes } from '../FormPropTypes'
|
|
31
29
|
import { FormFieldLayout } from '../FormFieldLayout'
|
|
32
|
-
|
|
30
|
+
|
|
31
|
+
import { propTypes, allowedProps } from './props'
|
|
32
|
+
import type { FormFieldProps } from './props'
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
---
|
|
@@ -39,39 +39,14 @@ category: components
|
|
|
39
39
|
class FormField extends Component<FormFieldProps> {
|
|
40
40
|
static readonly componentId = 'FormField'
|
|
41
41
|
|
|
42
|
-
static propTypes =
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* the id of the input (to link it to its label for a11y)
|
|
46
|
-
*/
|
|
47
|
-
id: PropTypes.string.isRequired,
|
|
48
|
-
/**
|
|
49
|
-
* object with shape: `{
|
|
50
|
-
* text: PropTypes.string,
|
|
51
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
52
|
-
* }`
|
|
53
|
-
*/
|
|
54
|
-
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
55
|
-
messagesId: PropTypes.string,
|
|
56
|
-
children: PropTypes.node,
|
|
57
|
-
inline: PropTypes.bool,
|
|
58
|
-
layout: PropTypes.oneOf(['stacked', 'inline']),
|
|
59
|
-
labelAlign: PropTypes.oneOf(['start', 'end']),
|
|
60
|
-
vAlign: PropTypes.oneOf(['top', 'middle', 'bottom']),
|
|
61
|
-
width: PropTypes.string,
|
|
62
|
-
inputContainerRef: PropTypes.func
|
|
63
|
-
}
|
|
64
|
-
|
|
42
|
+
static propTypes = propTypes
|
|
43
|
+
static allowedProps = allowedProps
|
|
65
44
|
static defaultProps = {
|
|
66
45
|
inline: false,
|
|
67
46
|
layout: 'stacked',
|
|
68
47
|
labelAlign: 'end',
|
|
69
48
|
vAlign: 'middle',
|
|
70
|
-
|
|
71
|
-
messagesId: undefined,
|
|
72
|
-
children: null,
|
|
73
|
-
width: undefined,
|
|
74
|
-
inputContainerRef: undefined
|
|
49
|
+
children: null
|
|
75
50
|
}
|
|
76
51
|
|
|
77
52
|
render() {
|