@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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.9.0](https://github.com/instructure/instructure-ui/compare/v8.8.0...v8.9.0) (2021-09-15)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- fix shared-types TS errors ([7b83164](https://github.com/instructure/instructure-ui/commit/7b83164f4c5872f3a217e010563f59bf584ae4fc))
|
|
11
|
+
|
|
6
12
|
# [8.8.0](https://github.com/instructure/instructure-ui/compare/v8.7.0...v8.8.0) (2021-08-27)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @instructure/ui-form-field
|
package/es/FormField/index.js
CHANGED
|
@@ -22,10 +22,9 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
import React, { Component } from 'react';
|
|
25
|
-
import PropTypes from 'prop-types';
|
|
26
25
|
import { omitProps, pickProps } from '@instructure/ui-react-utils';
|
|
27
|
-
import { FormPropTypes } from '../FormPropTypes';
|
|
28
26
|
import { FormFieldLayout } from '../FormFieldLayout';
|
|
27
|
+
import { propTypes, allowedProps } from './props';
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
30
|
---
|
|
@@ -45,40 +44,14 @@ class FormField extends Component {
|
|
|
45
44
|
|
|
46
45
|
FormField.displayName = "FormField";
|
|
47
46
|
FormField.componentId = 'FormField';
|
|
48
|
-
FormField.propTypes =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* the id of the input (to link it to its label for a11y)
|
|
53
|
-
*/
|
|
54
|
-
id: PropTypes.string.isRequired,
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* object with shape: `{
|
|
58
|
-
* text: PropTypes.string,
|
|
59
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
60
|
-
* }`
|
|
61
|
-
*/
|
|
62
|
-
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
63
|
-
messagesId: PropTypes.string,
|
|
64
|
-
children: PropTypes.node,
|
|
65
|
-
inline: PropTypes.bool,
|
|
66
|
-
layout: PropTypes.oneOf(['stacked', 'inline']),
|
|
67
|
-
labelAlign: PropTypes.oneOf(['start', 'end']),
|
|
68
|
-
vAlign: PropTypes.oneOf(['top', 'middle', 'bottom']),
|
|
69
|
-
width: PropTypes.string,
|
|
70
|
-
inputContainerRef: PropTypes.func
|
|
71
|
-
};
|
|
47
|
+
FormField.propTypes = propTypes;
|
|
48
|
+
FormField.allowedProps = allowedProps;
|
|
72
49
|
FormField.defaultProps = {
|
|
73
50
|
inline: false,
|
|
74
51
|
layout: 'stacked',
|
|
75
52
|
labelAlign: 'end',
|
|
76
53
|
vAlign: 'middle',
|
|
77
|
-
|
|
78
|
-
messagesId: void 0,
|
|
79
|
-
children: null,
|
|
80
|
-
width: void 0,
|
|
81
|
-
inputContainerRef: void 0
|
|
54
|
+
children: null
|
|
82
55
|
};
|
|
83
56
|
export default FormField;
|
|
84
57
|
export { FormField };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
25
|
+
import { FormPropTypes } from '../FormPropTypes';
|
|
26
|
+
const propTypes = {
|
|
27
|
+
label: PropTypes.node.isRequired,
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* the id of the input (to link it to its label for a11y)
|
|
31
|
+
*/
|
|
32
|
+
id: PropTypes.string.isRequired,
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* object with shape: `{
|
|
36
|
+
* text: PropTypes.string,
|
|
37
|
+
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
38
|
+
* }`
|
|
39
|
+
*/
|
|
40
|
+
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
41
|
+
messagesId: PropTypes.string,
|
|
42
|
+
children: PropTypes.node,
|
|
43
|
+
inline: PropTypes.bool,
|
|
44
|
+
layout: PropTypes.oneOf(['stacked', 'inline']),
|
|
45
|
+
labelAlign: PropTypes.oneOf(['start', 'end']),
|
|
46
|
+
vAlign: PropTypes.oneOf(['top', 'middle', 'bottom']),
|
|
47
|
+
width: PropTypes.string,
|
|
48
|
+
inputContainerRef: PropTypes.func
|
|
49
|
+
};
|
|
50
|
+
const allowedProps = ['label', 'id', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'vAlign', 'width', 'inputContainerRef'];
|
|
51
|
+
export { propTypes, allowedProps };
|
|
@@ -29,14 +29,13 @@ var _dec, _class, _class2, _temp;
|
|
|
29
29
|
|
|
30
30
|
/** @jsx jsx */
|
|
31
31
|
import { Component, Children } from 'react';
|
|
32
|
-
import PropTypes from 'prop-types';
|
|
33
32
|
import { Grid } from '@instructure/ui-grid';
|
|
34
33
|
import { pickProps, omitProps } from '@instructure/ui-react-utils';
|
|
35
34
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
36
35
|
import { FormFieldLayout } from '../FormFieldLayout';
|
|
37
|
-
import { FormPropTypes } from '../FormPropTypes';
|
|
38
36
|
import generateStyle from './styles';
|
|
39
37
|
import generateComponentTheme from './theme';
|
|
38
|
+
import { propTypes, allowedProps } from './props';
|
|
40
39
|
|
|
41
40
|
/**
|
|
42
41
|
---
|
|
@@ -86,7 +85,7 @@ let FormFieldGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
86
85
|
const styles = this.props.styles;
|
|
87
86
|
return jsx("span", {
|
|
88
87
|
key: "fields",
|
|
89
|
-
css: styles.formFieldGroup
|
|
88
|
+
css: styles === null || styles === void 0 ? void 0 : styles.formFieldGroup
|
|
90
89
|
}, this.renderChildren());
|
|
91
90
|
}
|
|
92
91
|
|
|
@@ -105,43 +104,8 @@ let FormFieldGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
105
104
|
}), this.renderFields());
|
|
106
105
|
}
|
|
107
106
|
|
|
108
|
-
}, _class2.displayName = "FormFieldGroup", _class2.componentId = 'FormFieldGroup', _class2.propTypes = {
|
|
109
|
-
// eslint-disable-next-line react/require-default-props
|
|
110
|
-
makeStyles: PropTypes.func,
|
|
111
|
-
// eslint-disable-next-line react/require-default-props
|
|
112
|
-
styles: PropTypes.object,
|
|
113
|
-
description: PropTypes.node.isRequired,
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* the element type to render as
|
|
117
|
-
*/
|
|
118
|
-
as: PropTypes.elementType,
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* object with shape: `{
|
|
122
|
-
* text: PropTypes.string,
|
|
123
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
124
|
-
* }`
|
|
125
|
-
*/
|
|
126
|
-
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* id for the form field messages
|
|
130
|
-
*/
|
|
131
|
-
messagesId: PropTypes.string,
|
|
132
|
-
disabled: PropTypes.bool,
|
|
133
|
-
children: PropTypes.node,
|
|
134
|
-
layout: PropTypes.oneOf(['stacked', 'columns', 'inline']),
|
|
135
|
-
rowSpacing: PropTypes.oneOf(['none', 'small', 'medium', 'large']),
|
|
136
|
-
colSpacing: PropTypes.oneOf(['none', 'small', 'medium', 'large']),
|
|
137
|
-
vAlign: PropTypes.oneOf(['top', 'middle', 'bottom']),
|
|
138
|
-
startAt: PropTypes.oneOf(['small', 'medium', 'large', 'x-large', null])
|
|
139
|
-
}, _class2.defaultProps = {
|
|
107
|
+
}, _class2.displayName = "FormFieldGroup", _class2.componentId = 'FormFieldGroup', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
140
108
|
children: null,
|
|
141
|
-
layout: void 0,
|
|
142
|
-
startAt: void 0,
|
|
143
|
-
messages: void 0,
|
|
144
|
-
messagesId: void 0,
|
|
145
109
|
as: 'fieldset',
|
|
146
110
|
disabled: false,
|
|
147
111
|
rowSpacing: 'medium',
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
25
|
+
import { FormPropTypes } from '../FormPropTypes';
|
|
26
|
+
const propTypes = {
|
|
27
|
+
description: PropTypes.node.isRequired,
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* the element type to render as
|
|
31
|
+
*/
|
|
32
|
+
as: PropTypes.elementType,
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* object with shape: `{
|
|
36
|
+
* text: PropTypes.string,
|
|
37
|
+
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
38
|
+
* }`
|
|
39
|
+
*/
|
|
40
|
+
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* id for the form field messages
|
|
44
|
+
*/
|
|
45
|
+
messagesId: PropTypes.string,
|
|
46
|
+
disabled: PropTypes.bool,
|
|
47
|
+
children: PropTypes.node,
|
|
48
|
+
layout: PropTypes.oneOf(['stacked', 'columns', 'inline']),
|
|
49
|
+
rowSpacing: PropTypes.oneOf(['none', 'small', 'medium', 'large']),
|
|
50
|
+
colSpacing: PropTypes.oneOf(['none', 'small', 'medium', 'large']),
|
|
51
|
+
vAlign: PropTypes.oneOf(['top', 'middle', 'bottom']),
|
|
52
|
+
startAt: PropTypes.oneOf(['small', 'medium', 'large', 'x-large', null])
|
|
53
|
+
};
|
|
54
|
+
const allowedProps = ['description', 'as', 'messages', 'messagesId', 'disabled', 'children', 'layout', 'rowSpacing', 'colSpacing', 'vAlign', 'startAt'];
|
|
55
|
+
export { propTypes, allowedProps };
|
|
@@ -26,11 +26,11 @@ var _dec, _class, _class2, _temp;
|
|
|
26
26
|
|
|
27
27
|
/** @jsx jsx */
|
|
28
28
|
import { Component } from 'react';
|
|
29
|
-
import PropTypes from 'prop-types';
|
|
30
29
|
import { omitProps, getElementType } from '@instructure/ui-react-utils';
|
|
31
30
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
32
31
|
import generateStyle from './styles';
|
|
33
32
|
import generateComponentTheme from './theme';
|
|
33
|
+
import { propTypes, allowedProps } from './props';
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
---
|
|
@@ -63,18 +63,11 @@ let FormFieldLabel = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
63
63
|
styles = _this$props.styles,
|
|
64
64
|
children = _this$props.children;
|
|
65
65
|
return jsx(ElementType, Object.assign({}, omitProps(this.props, FormFieldLabel.propTypes), {
|
|
66
|
-
css: styles.formFieldLabel
|
|
66
|
+
css: styles === null || styles === void 0 ? void 0 : styles.formFieldLabel
|
|
67
67
|
}), children);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
}, _class2.displayName = "FormFieldLabel", _class2.componentId = 'FormFieldLabel', _class2.propTypes = {
|
|
71
|
-
// eslint-disable-next-line react/require-default-props
|
|
72
|
-
makeStyles: PropTypes.func,
|
|
73
|
-
// eslint-disable-next-line react/require-default-props
|
|
74
|
-
styles: PropTypes.object,
|
|
75
|
-
as: PropTypes.elementType,
|
|
76
|
-
children: PropTypes.node.isRequired
|
|
77
|
-
}, _class2.defaultProps = {
|
|
70
|
+
}, _class2.displayName = "FormFieldLabel", _class2.componentId = 'FormFieldLabel', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
78
71
|
as: 'span'
|
|
79
72
|
}, _temp)) || _class);
|
|
80
73
|
export default FormFieldLabel;
|
|
@@ -21,11 +21,10 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
25
|
+
const propTypes = {
|
|
26
|
+
as: PropTypes.elementType,
|
|
27
|
+
children: PropTypes.node.isRequired
|
|
28
|
+
};
|
|
29
|
+
const allowedProps = ['as', 'children'];
|
|
30
|
+
export { propTypes, allowedProps };
|
|
@@ -29,7 +29,6 @@ var _dec, _class, _class2, _temp;
|
|
|
29
29
|
|
|
30
30
|
/** @jsx jsx */
|
|
31
31
|
import { Component } from 'react';
|
|
32
|
-
import PropTypes from 'prop-types';
|
|
33
32
|
import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
|
|
34
33
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
35
34
|
import { Grid } from '@instructure/ui-grid';
|
|
@@ -39,8 +38,8 @@ import { uid } from '@instructure/uid';
|
|
|
39
38
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
40
39
|
import { FormFieldLabel } from '../FormFieldLabel';
|
|
41
40
|
import { FormFieldMessages } from '../FormFieldMessages';
|
|
42
|
-
import { FormPropTypes } from '../FormPropTypes';
|
|
43
41
|
import generateStyle from './styles';
|
|
42
|
+
import { propTypes, allowedProps } from './props';
|
|
44
43
|
|
|
45
44
|
/**
|
|
46
45
|
---
|
|
@@ -137,7 +136,7 @@ let FormFieldLayout = (_dec = withStyle(generateStyle), _dec(_class = (_temp = _
|
|
|
137
136
|
return jsx(ElementType, Object.assign({}, omitProps(props, { ...FormFieldLayout.propTypes,
|
|
138
137
|
...Grid.propTypes
|
|
139
138
|
}), {
|
|
140
|
-
css: styles.formFieldLayout,
|
|
139
|
+
css: styles === null || styles === void 0 ? void 0 : styles.formFieldLayout,
|
|
141
140
|
style: {
|
|
142
141
|
width
|
|
143
142
|
},
|
|
@@ -152,52 +151,12 @@ let FormFieldLayout = (_dec = withStyle(generateStyle), _dec(_class = (_temp = _
|
|
|
152
151
|
}, children)), this.renderVisibleMessages()));
|
|
153
152
|
}
|
|
154
153
|
|
|
155
|
-
}, _class2.displayName = "FormFieldLayout", _class2.componentId = 'FormFieldLayout', _class2.propTypes = {
|
|
156
|
-
// eslint-disable-next-line react/require-default-props
|
|
157
|
-
makeStyles: PropTypes.func,
|
|
158
|
-
// eslint-disable-next-line react/require-default-props
|
|
159
|
-
styles: PropTypes.object,
|
|
160
|
-
label: PropTypes.node.isRequired,
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* the id of the input (to link it to its label for a11y)
|
|
164
|
-
*/
|
|
165
|
-
id: PropTypes.string,
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* the element type to render as
|
|
169
|
-
*/
|
|
170
|
-
as: PropTypes.elementType,
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* object with shape: `{
|
|
174
|
-
* text: PropTypes.string,
|
|
175
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
176
|
-
* }`
|
|
177
|
-
*/
|
|
178
|
-
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* id for the form field messages
|
|
182
|
-
*/
|
|
183
|
-
messagesId: PropTypes.string,
|
|
184
|
-
children: PropTypes.node,
|
|
185
|
-
inline: PropTypes.bool,
|
|
186
|
-
layout: PropTypes.oneOf(['stacked', 'inline']),
|
|
187
|
-
labelAlign: PropTypes.oneOf(['start', 'end']),
|
|
188
|
-
width: PropTypes.string,
|
|
189
|
-
inputContainerRef: PropTypes.func
|
|
190
|
-
}, _class2.defaultProps = {
|
|
191
|
-
id: void 0,
|
|
192
|
-
width: void 0,
|
|
193
|
-
messages: void 0,
|
|
194
|
-
messagesId: void 0,
|
|
154
|
+
}, _class2.displayName = "FormFieldLayout", _class2.componentId = 'FormFieldLayout', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
195
155
|
children: null,
|
|
196
156
|
inline: false,
|
|
197
157
|
layout: 'stacked',
|
|
198
158
|
as: 'label',
|
|
199
|
-
labelAlign: 'end'
|
|
200
|
-
inputContainerRef: void 0
|
|
159
|
+
labelAlign: 'end'
|
|
201
160
|
}, _temp)) || _class);
|
|
202
161
|
export default FormFieldLayout;
|
|
203
162
|
export { FormFieldLayout };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
25
|
+
import { FormPropTypes } from '../FormPropTypes';
|
|
26
|
+
const propTypes = {
|
|
27
|
+
label: PropTypes.node.isRequired,
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* the id of the input (to link it to its label for a11y)
|
|
31
|
+
*/
|
|
32
|
+
id: PropTypes.string,
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* the element type to render as
|
|
36
|
+
*/
|
|
37
|
+
as: PropTypes.elementType,
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* object with shape: `{
|
|
41
|
+
* text: PropTypes.string,
|
|
42
|
+
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
43
|
+
* }`
|
|
44
|
+
*/
|
|
45
|
+
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* id for the form field messages
|
|
49
|
+
*/
|
|
50
|
+
messagesId: PropTypes.string,
|
|
51
|
+
children: PropTypes.node,
|
|
52
|
+
inline: PropTypes.bool,
|
|
53
|
+
layout: PropTypes.oneOf(['stacked', 'inline']),
|
|
54
|
+
labelAlign: PropTypes.oneOf(['start', 'end']),
|
|
55
|
+
width: PropTypes.string,
|
|
56
|
+
inputContainerRef: PropTypes.func
|
|
57
|
+
};
|
|
58
|
+
const allowedProps = ['label', 'id', 'as', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef'];
|
|
59
|
+
export { propTypes, allowedProps };
|
|
@@ -26,11 +26,11 @@ var _dec, _class, _class2, _temp;
|
|
|
26
26
|
|
|
27
27
|
/** @jsx jsx */
|
|
28
28
|
import { Component } from 'react';
|
|
29
|
-
import PropTypes from 'prop-types';
|
|
30
29
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
31
30
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
32
31
|
import generateStyle from './styles';
|
|
33
32
|
import generateComponentTheme from './theme';
|
|
33
|
+
import { propTypes, allowedProps } from './props';
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
---
|
|
@@ -61,18 +61,11 @@ let FormFieldMessage = (_dec = withStyle(generateStyle, generateComponentTheme),
|
|
|
61
61
|
children = _this$props.children,
|
|
62
62
|
styles = _this$props.styles;
|
|
63
63
|
return this.props.variant !== 'screenreader-only' ? jsx("span", {
|
|
64
|
-
css: styles.formFieldMessage
|
|
64
|
+
css: styles === null || styles === void 0 ? void 0 : styles.formFieldMessage
|
|
65
65
|
}, children) : jsx(ScreenReaderContent, null, children);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
}, _class2.displayName = "FormFieldMessage", _class2.componentId = 'FormFieldMessage', _class2.propTypes = {
|
|
69
|
-
// eslint-disable-next-line react/require-default-props
|
|
70
|
-
makeStyles: PropTypes.func,
|
|
71
|
-
// eslint-disable-next-line react/require-default-props
|
|
72
|
-
styles: PropTypes.object,
|
|
73
|
-
variant: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only']),
|
|
74
|
-
children: PropTypes.node
|
|
75
|
-
}, _class2.defaultProps = {
|
|
68
|
+
}, _class2.displayName = "FormFieldMessage", _class2.componentId = 'FormFieldMessage', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
76
69
|
variant: 'hint',
|
|
77
70
|
children: null
|
|
78
71
|
}, _temp)) || _class);
|