@instructure/ui-form-field 8.33.2-snapshot-0 → 8.33.2
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 +1 -5
- package/es/FormField/index.js +1 -6
- package/es/FormField/props.js +1 -0
- package/es/FormFieldGroup/index.js +3 -20
- package/es/FormFieldGroup/props.js +1 -0
- package/es/FormFieldGroup/styles.js +0 -1
- package/es/FormFieldGroup/theme.js +4 -4
- package/es/FormFieldLabel/index.js +2 -11
- package/es/FormFieldLabel/props.js +1 -0
- package/es/FormFieldLabel/styles.js +1 -2
- package/es/FormFieldLabel/theme.js +4 -4
- package/es/FormFieldLayout/index.js +5 -27
- package/es/FormFieldLayout/props.js +5 -1
- package/es/FormFieldLayout/styles.js +0 -1
- package/es/FormFieldMessage/index.js +2 -11
- package/es/FormFieldMessage/props.js +1 -0
- package/es/FormFieldMessage/styles.js +0 -1
- package/es/FormFieldMessage/theme.js +4 -4
- package/es/FormFieldMessages/index.js +2 -11
- package/es/FormFieldMessages/props.js +1 -0
- package/es/FormFieldMessages/styles.js +0 -1
- package/es/FormFieldMessages/theme.js +2 -2
- package/es/FormPropTypes.js +1 -1
- package/es/index.js +1 -0
- package/lib/FormField/index.js +0 -12
- package/lib/FormField/props.js +1 -4
- package/lib/FormFieldGroup/index.js +3 -30
- package/lib/FormFieldGroup/props.js +1 -4
- package/lib/FormFieldGroup/styles.js +0 -2
- package/lib/FormFieldGroup/theme.js +4 -5
- package/lib/FormFieldLabel/index.js +2 -19
- package/lib/FormFieldLabel/props.js +1 -3
- package/lib/FormFieldLabel/styles.js +0 -3
- package/lib/FormFieldLabel/theme.js +4 -5
- package/lib/FormFieldLayout/index.js +5 -41
- package/lib/FormFieldLayout/props.js +4 -5
- package/lib/FormFieldLayout/styles.js +0 -2
- package/lib/FormFieldMessage/index.js +2 -18
- package/lib/FormFieldMessage/props.js +1 -2
- package/lib/FormFieldMessage/styles.js +0 -2
- package/lib/FormFieldMessage/theme.js +4 -5
- package/lib/FormFieldMessages/index.js +2 -19
- package/lib/FormFieldMessages/props.js +1 -4
- package/lib/FormFieldMessages/styles.js +0 -2
- package/lib/FormFieldMessages/theme.js +2 -3
- package/lib/FormPropTypes.js +1 -5
- package/lib/index.js +0 -7
- package/package.json +14 -14
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,14 +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.33.2
|
|
6
|
+
## [8.33.2](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2) (2023-01-25)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-form-field
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
10
|
## [8.33.1](https://github.com/instructure/instructure-ui/compare/v8.33.0...v8.33.1) (2023-01-06)
|
|
15
11
|
|
|
16
12
|
**Note:** Version bump only for package @instructure/ui-form-field
|
package/es/FormField/index.js
CHANGED
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import React, { Component } from 'react';
|
|
25
26
|
import { omitProps, pickProps } from '@instructure/ui-react-utils';
|
|
26
27
|
import { FormFieldLayout } from '../FormFieldLayout';
|
|
27
28
|
import { propTypes, allowedProps } from './props';
|
|
28
|
-
|
|
29
29
|
/**
|
|
30
30
|
---
|
|
31
31
|
category: components
|
|
@@ -36,17 +36,14 @@ class FormField extends Component {
|
|
|
36
36
|
constructor() {
|
|
37
37
|
super(...arguments);
|
|
38
38
|
this.ref = null;
|
|
39
|
-
|
|
40
39
|
this.handleRef = el => {
|
|
41
40
|
const elementRef = this.props.elementRef;
|
|
42
41
|
this.ref = el;
|
|
43
|
-
|
|
44
42
|
if (typeof elementRef === 'function') {
|
|
45
43
|
elementRef(el);
|
|
46
44
|
}
|
|
47
45
|
};
|
|
48
46
|
}
|
|
49
|
-
|
|
50
47
|
render() {
|
|
51
48
|
return /*#__PURE__*/React.createElement(FormFieldLayout, Object.assign({}, omitProps(this.props, FormField.allowedProps), pickProps(this.props, FormFieldLayout.allowedProps), {
|
|
52
49
|
label: this.props.label,
|
|
@@ -56,9 +53,7 @@ class FormField extends Component {
|
|
|
56
53
|
elementRef: this.handleRef
|
|
57
54
|
}));
|
|
58
55
|
}
|
|
59
|
-
|
|
60
56
|
}
|
|
61
|
-
|
|
62
57
|
FormField.displayName = "FormField";
|
|
63
58
|
FormField.componentId = 'FormField';
|
|
64
59
|
FormField.propTypes = propTypes;
|
package/es/FormField/props.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["styles", "makeStyles"];
|
|
3
|
-
|
|
4
3
|
var _dec, _class, _class2;
|
|
5
|
-
|
|
6
4
|
/*
|
|
7
5
|
* The MIT License (MIT)
|
|
8
6
|
*
|
|
@@ -36,7 +34,6 @@ import { FormFieldLayout } from '../FormFieldLayout';
|
|
|
36
34
|
import generateStyle from './styles';
|
|
37
35
|
import generateComponentTheme from './theme';
|
|
38
36
|
import { propTypes, allowedProps } from './props';
|
|
39
|
-
|
|
40
37
|
/**
|
|
41
38
|
---
|
|
42
39
|
category: components
|
|
@@ -47,41 +44,32 @@ let FormFieldGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
47
44
|
constructor() {
|
|
48
45
|
super(...arguments);
|
|
49
46
|
this.ref = null;
|
|
50
|
-
|
|
51
47
|
this.handleRef = el => {
|
|
52
48
|
const elementRef = this.props.elementRef;
|
|
53
49
|
this.ref = el;
|
|
54
|
-
|
|
55
50
|
if (typeof elementRef === 'function') {
|
|
56
51
|
elementRef(el);
|
|
57
52
|
}
|
|
58
53
|
};
|
|
59
54
|
}
|
|
60
|
-
|
|
61
55
|
componentDidMount() {
|
|
62
56
|
var _this$props$makeStyle, _this$props;
|
|
63
|
-
|
|
64
57
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStylesVariables);
|
|
65
58
|
}
|
|
66
|
-
|
|
67
59
|
componentDidUpdate() {
|
|
68
60
|
var _this$props$makeStyle2, _this$props2;
|
|
69
|
-
|
|
70
61
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStylesVariables);
|
|
71
62
|
}
|
|
72
|
-
|
|
73
63
|
get makeStylesVariables() {
|
|
74
64
|
return {
|
|
75
65
|
invalid: this.invalid
|
|
76
66
|
};
|
|
77
67
|
}
|
|
78
|
-
|
|
79
68
|
get invalid() {
|
|
80
69
|
return !!this.props.messages && this.props.messages.findIndex(message => {
|
|
81
70
|
return message.type === 'error';
|
|
82
71
|
}) >= 0;
|
|
83
72
|
}
|
|
84
|
-
|
|
85
73
|
renderColumns() {
|
|
86
74
|
return Children.map(this.props.children, (child, index) => {
|
|
87
75
|
return child ? jsx(Grid.Col, {
|
|
@@ -90,7 +78,6 @@ let FormFieldGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
90
78
|
}, child) : null;
|
|
91
79
|
});
|
|
92
80
|
}
|
|
93
|
-
|
|
94
81
|
renderChildren() {
|
|
95
82
|
return jsx(Grid, {
|
|
96
83
|
colSpacing: this.props.colSpacing,
|
|
@@ -99,7 +86,6 @@ let FormFieldGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
99
86
|
startAt: this.props.startAt || (this.props.layout === 'columns' ? 'medium' : null)
|
|
100
87
|
}, jsx(Grid.Row, null, this.renderColumns()));
|
|
101
88
|
}
|
|
102
|
-
|
|
103
89
|
renderFields() {
|
|
104
90
|
const styles = this.props.styles;
|
|
105
91
|
return jsx("span", {
|
|
@@ -107,13 +93,11 @@ let FormFieldGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
107
93
|
css: styles === null || styles === void 0 ? void 0 : styles.formFieldGroup
|
|
108
94
|
}, this.renderChildren());
|
|
109
95
|
}
|
|
110
|
-
|
|
111
96
|
render() {
|
|
112
97
|
const _this$props3 = this.props,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
98
|
+
styles = _this$props3.styles,
|
|
99
|
+
makeStyles = _this$props3.makeStyles,
|
|
100
|
+
props = _objectWithoutProperties(_this$props3, _excluded);
|
|
117
101
|
return jsx(FormFieldLayout, Object.assign({}, omitProps(props, FormFieldGroup.allowedProps), pickProps(props, FormFieldLayout.allowedProps), {
|
|
118
102
|
vAlign: props.vAlign,
|
|
119
103
|
layout: props.layout === 'inline' ? 'inline' : 'stacked',
|
|
@@ -123,7 +107,6 @@ let FormFieldGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
123
107
|
elementRef: this.handleRef
|
|
124
108
|
}), this.renderFields());
|
|
125
109
|
}
|
|
126
|
-
|
|
127
110
|
}, _class2.displayName = "FormFieldGroup", _class2.componentId = 'FormFieldGroup', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
128
111
|
as: 'fieldset',
|
|
129
112
|
disabled: false,
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const borders = theme.borders,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
colors = theme.colors,
|
|
33
|
+
spacing = theme.spacing;
|
|
34
34
|
const componentVariables = {
|
|
35
35
|
borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
|
|
36
36
|
borderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
|
|
@@ -39,8 +39,8 @@ const generateComponentTheme = theme => {
|
|
|
39
39
|
errorBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderDanger,
|
|
40
40
|
errorFieldsPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall
|
|
41
41
|
};
|
|
42
|
-
return {
|
|
42
|
+
return {
|
|
43
|
+
...componentVariables
|
|
43
44
|
};
|
|
44
45
|
};
|
|
45
|
-
|
|
46
46
|
export default generateComponentTheme;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -31,7 +30,6 @@ import { withStyle, jsx } from '@instructure/emotion';
|
|
|
31
30
|
import generateStyle from './styles';
|
|
32
31
|
import generateComponentTheme from './theme';
|
|
33
32
|
import { propTypes, allowedProps } from './props';
|
|
34
|
-
|
|
35
33
|
/**
|
|
36
34
|
---
|
|
37
35
|
parent: FormField
|
|
@@ -53,35 +51,28 @@ let FormFieldLabel = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
53
51
|
constructor() {
|
|
54
52
|
super(...arguments);
|
|
55
53
|
this.ref = null;
|
|
56
|
-
|
|
57
54
|
this.handleRef = el => {
|
|
58
55
|
this.ref = el;
|
|
59
56
|
};
|
|
60
57
|
}
|
|
61
|
-
|
|
62
58
|
componentDidMount() {
|
|
63
59
|
var _this$props$makeStyle, _this$props;
|
|
64
|
-
|
|
65
60
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
66
61
|
}
|
|
67
|
-
|
|
68
62
|
componentDidUpdate() {
|
|
69
63
|
var _this$props$makeStyle2, _this$props2;
|
|
70
|
-
|
|
71
64
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
72
65
|
}
|
|
73
|
-
|
|
74
66
|
render() {
|
|
75
67
|
const ElementType = getElementType(FormFieldLabel, this.props);
|
|
76
68
|
const _this$props3 = this.props,
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
styles = _this$props3.styles,
|
|
70
|
+
children = _this$props3.children;
|
|
79
71
|
return jsx(ElementType, Object.assign({}, omitProps(this.props, FormFieldLabel.allowedProps), {
|
|
80
72
|
css: styles === null || styles === void 0 ? void 0 : styles.formFieldLabel,
|
|
81
73
|
ref: this.handleRef
|
|
82
74
|
}), children);
|
|
83
75
|
}
|
|
84
|
-
|
|
85
76
|
}, _class2.displayName = "FormFieldLabel", _class2.componentId = 'FormFieldLabel', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
86
77
|
as: 'span'
|
|
87
78
|
}, _class2)) || _class);
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
|
|
25
24
|
|
|
25
|
+
import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
|
|
26
26
|
/**
|
|
27
27
|
* ---
|
|
28
28
|
* private: true
|
|
@@ -59,5 +59,4 @@ const generateStyle = (componentTheme, props) => {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
|
-
|
|
63
62
|
export default generateStyle;
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const colors = theme.colors,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
typography = theme.typography,
|
|
33
|
+
themeName = theme.key;
|
|
34
34
|
const themeSpecificStyle = {
|
|
35
35
|
canvas: {
|
|
36
36
|
color: theme['ic-brand-font-color-dark']
|
|
@@ -43,9 +43,9 @@ const generateComponentTheme = theme => {
|
|
|
43
43
|
fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
|
|
44
44
|
lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeightFit
|
|
45
45
|
};
|
|
46
|
-
return {
|
|
46
|
+
return {
|
|
47
|
+
...componentVariables,
|
|
47
48
|
...themeSpecificStyle[themeName]
|
|
48
49
|
};
|
|
49
50
|
};
|
|
50
|
-
|
|
51
51
|
export default generateComponentTheme;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["makeStyles", "styles"];
|
|
3
|
-
|
|
4
3
|
var _dec, _dec2, _class, _class2;
|
|
5
|
-
|
|
6
4
|
/*
|
|
7
5
|
* The MIT License (MIT)
|
|
8
6
|
*
|
|
@@ -39,7 +37,6 @@ import { FormFieldLabel } from '../FormFieldLabel';
|
|
|
39
37
|
import { FormFieldMessages } from '../FormFieldMessages';
|
|
40
38
|
import generateStyle from './styles';
|
|
41
39
|
import { propTypes, allowedProps } from './props';
|
|
42
|
-
|
|
43
40
|
/**
|
|
44
41
|
---
|
|
45
42
|
parent: FormField
|
|
@@ -51,56 +48,43 @@ let FormFieldLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateS
|
|
|
51
48
|
super(props);
|
|
52
49
|
this._messagesId = void 0;
|
|
53
50
|
this.ref = null;
|
|
54
|
-
|
|
55
51
|
this.handleRef = el => {
|
|
56
52
|
const elementRef = this.props.elementRef;
|
|
57
53
|
this.ref = el;
|
|
58
|
-
|
|
59
54
|
if (typeof elementRef === 'function') {
|
|
60
55
|
elementRef(el);
|
|
61
56
|
}
|
|
62
57
|
};
|
|
63
|
-
|
|
64
58
|
this.handleInputContainerRef = node => {
|
|
65
59
|
if (typeof this.props.inputContainerRef === 'function') {
|
|
66
60
|
this.props.inputContainerRef(node);
|
|
67
61
|
}
|
|
68
62
|
};
|
|
69
|
-
|
|
70
63
|
this._messagesId = props.messagesId || props.deterministicId();
|
|
71
64
|
error(typeof props.width !== 'undefined' || !props.inline || props.layout !== 'inline', `[FormFieldLayout] The 'inline' prop is true, and the 'layout' is set to 'inline'.
|
|
72
65
|
This will cause a layout issue in Internet Explorer 11 unless you also add a value for the 'width' prop.`);
|
|
73
66
|
}
|
|
74
|
-
|
|
75
67
|
componentDidMount() {
|
|
76
68
|
var _this$props$makeStyle, _this$props;
|
|
77
|
-
|
|
78
69
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
79
70
|
}
|
|
80
|
-
|
|
81
71
|
componentDidUpdate() {
|
|
82
72
|
var _this$props$makeStyle2, _this$props2;
|
|
83
|
-
|
|
84
73
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
85
74
|
}
|
|
86
|
-
|
|
87
75
|
get hasVisibleLabel() {
|
|
88
76
|
return this.props.label && hasVisibleChildren(this.props.label);
|
|
89
77
|
}
|
|
90
|
-
|
|
91
78
|
get hasMessages() {
|
|
92
79
|
return this.props.messages && this.props.messages.length > 0;
|
|
93
80
|
}
|
|
94
|
-
|
|
95
81
|
get elementType() {
|
|
96
82
|
return getElementType(FormFieldLayout, this.props);
|
|
97
83
|
}
|
|
98
|
-
|
|
99
84
|
get inlineContainerAndLabel() {
|
|
100
85
|
// Return if both the component container and label will display inline
|
|
101
86
|
return this.props.inline && this.props.layout === 'inline';
|
|
102
87
|
}
|
|
103
|
-
|
|
104
88
|
renderLabel() {
|
|
105
89
|
if (this.hasVisibleLabel) {
|
|
106
90
|
return jsx(Grid.Col, {
|
|
@@ -116,7 +100,6 @@ let FormFieldLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateS
|
|
|
116
100
|
return null;
|
|
117
101
|
}
|
|
118
102
|
}
|
|
119
|
-
|
|
120
103
|
renderLegend() {
|
|
121
104
|
// note: the legend element must be the first child of a fieldset element for SR
|
|
122
105
|
// so we render it twice in that case (once for SR-only and one that is visible)
|
|
@@ -126,7 +109,6 @@ let FormFieldLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateS
|
|
|
126
109
|
messages: this.props.messages
|
|
127
110
|
}));
|
|
128
111
|
}
|
|
129
|
-
|
|
130
112
|
renderVisibleMessages() {
|
|
131
113
|
return this.hasMessages ? jsx(Grid.Row, null, jsx(Grid.Col, {
|
|
132
114
|
offset: this.inlineContainerAndLabel ? void 0 : 3,
|
|
@@ -136,19 +118,16 @@ let FormFieldLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateS
|
|
|
136
118
|
messages: this.props.messages
|
|
137
119
|
}))) : null;
|
|
138
120
|
}
|
|
139
|
-
|
|
140
121
|
render() {
|
|
141
122
|
// any cast is needed to prevent Expression produces a union type that is too complex to represent errors
|
|
142
123
|
const ElementType = this.elementType;
|
|
143
|
-
|
|
144
124
|
const _this$props3 = this.props,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
125
|
+
makeStyles = _this$props3.makeStyles,
|
|
126
|
+
styles = _this$props3.styles,
|
|
127
|
+
props = _objectWithoutProperties(_this$props3, _excluded);
|
|
149
128
|
const width = props.width,
|
|
150
|
-
|
|
151
|
-
|
|
129
|
+
layout = props.layout,
|
|
130
|
+
children = props.children;
|
|
152
131
|
return jsx(ElementType, Object.assign({}, omitProps(props, [...FormFieldLayout.allowedProps, ...Grid.allowedProps]), {
|
|
153
132
|
css: styles === null || styles === void 0 ? void 0 : styles.formFieldLayout,
|
|
154
133
|
style: {
|
|
@@ -165,7 +144,6 @@ let FormFieldLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateS
|
|
|
165
144
|
elementRef: this.handleInputContainerRef
|
|
166
145
|
}, children)), this.renderVisibleMessages()));
|
|
167
146
|
}
|
|
168
|
-
|
|
169
147
|
}, _class2.displayName = "FormFieldLayout", _class2.componentId = 'FormFieldLayout', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
170
148
|
inline: false,
|
|
171
149
|
layout: 'stacked',
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import PropTypes from 'prop-types';
|
|
25
26
|
import { FormPropTypes } from '../FormPropTypes';
|
|
26
27
|
const propTypes = {
|
|
@@ -38,8 +39,11 @@ const propTypes = {
|
|
|
38
39
|
inputContainerRef: PropTypes.func,
|
|
39
40
|
elementRef: PropTypes.func
|
|
40
41
|
};
|
|
41
|
-
const allowedProps = ['label', 'id', 'as', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef', 'elementRef'
|
|
42
|
+
const allowedProps = ['label', 'id', 'as', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef', 'elementRef'
|
|
43
|
+
|
|
44
|
+
// added vAlign because FormField and FormFieldGroup passes it, but not adding
|
|
42
45
|
// it to allowedProps to prevent it from getting passed through accidentally
|
|
43
46
|
//'vAlign'
|
|
44
47
|
];
|
|
48
|
+
|
|
45
49
|
export { propTypes, allowedProps };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -31,7 +30,6 @@ import { withStyle, jsx } from '@instructure/emotion';
|
|
|
31
30
|
import generateStyle from './styles';
|
|
32
31
|
import generateComponentTheme from './theme';
|
|
33
32
|
import { propTypes, allowedProps } from './props';
|
|
34
|
-
|
|
35
33
|
/**
|
|
36
34
|
---
|
|
37
35
|
parent: FormField
|
|
@@ -52,28 +50,22 @@ let FormFieldMessage = (_dec = withStyle(generateStyle, generateComponentTheme),
|
|
|
52
50
|
constructor() {
|
|
53
51
|
super(...arguments);
|
|
54
52
|
this.ref = null;
|
|
55
|
-
|
|
56
53
|
this.handleRef = el => {
|
|
57
54
|
this.ref = el;
|
|
58
55
|
};
|
|
59
56
|
}
|
|
60
|
-
|
|
61
57
|
componentDidMount() {
|
|
62
58
|
var _this$props$makeStyle, _this$props;
|
|
63
|
-
|
|
64
59
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
65
60
|
}
|
|
66
|
-
|
|
67
61
|
componentDidUpdate() {
|
|
68
62
|
var _this$props$makeStyle2, _this$props2;
|
|
69
|
-
|
|
70
63
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
71
64
|
}
|
|
72
|
-
|
|
73
65
|
render() {
|
|
74
66
|
const _this$props3 = this.props,
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
children = _this$props3.children,
|
|
68
|
+
styles = _this$props3.styles;
|
|
77
69
|
return this.props.variant !== 'screenreader-only' ? jsx("span", {
|
|
78
70
|
css: styles === null || styles === void 0 ? void 0 : styles.formFieldMessage,
|
|
79
71
|
ref: this.handleRef
|
|
@@ -81,7 +73,6 @@ let FormFieldMessage = (_dec = withStyle(generateStyle, generateComponentTheme),
|
|
|
81
73
|
elementRef: this.handleRef
|
|
82
74
|
}, children);
|
|
83
75
|
}
|
|
84
|
-
|
|
85
76
|
}, _class2.displayName = "FormFieldMessage", _class2.componentId = 'FormFieldMessage', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
86
77
|
variant: 'hint'
|
|
87
78
|
}, _class2)) || _class);
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const colors = theme.colors,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
typography = theme.typography,
|
|
33
|
+
themeName = theme.key;
|
|
34
34
|
const themeSpecificStyle = {
|
|
35
35
|
canvas: {
|
|
36
36
|
colorHint: theme['ic-brand-font-color-dark']
|
|
@@ -45,9 +45,9 @@ const generateComponentTheme = theme => {
|
|
|
45
45
|
fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeSmall,
|
|
46
46
|
lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeight
|
|
47
47
|
};
|
|
48
|
-
return {
|
|
48
|
+
return {
|
|
49
|
+
...componentVariables,
|
|
49
50
|
...themeSpecificStyle[themeName]
|
|
50
51
|
};
|
|
51
52
|
};
|
|
52
|
-
|
|
53
53
|
export default generateComponentTheme;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -32,7 +31,6 @@ import { FormFieldMessage } from '../FormFieldMessage';
|
|
|
32
31
|
import generateStyle from './styles';
|
|
33
32
|
import generateComponentTheme from './theme';
|
|
34
33
|
import { propTypes, allowedProps } from './props';
|
|
35
|
-
|
|
36
34
|
/**
|
|
37
35
|
---
|
|
38
36
|
parent: FormField
|
|
@@ -56,28 +54,22 @@ let FormFieldMessages = (_dec = withStyle(generateStyle, generateComponentTheme)
|
|
|
56
54
|
constructor() {
|
|
57
55
|
super(...arguments);
|
|
58
56
|
this.ref = null;
|
|
59
|
-
|
|
60
57
|
this.handleRef = el => {
|
|
61
58
|
this.ref = el;
|
|
62
59
|
};
|
|
63
60
|
}
|
|
64
|
-
|
|
65
61
|
componentDidMount() {
|
|
66
62
|
var _this$props$makeStyle, _this$props;
|
|
67
|
-
|
|
68
63
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
69
64
|
}
|
|
70
|
-
|
|
71
65
|
componentDidUpdate() {
|
|
72
66
|
var _this$props$makeStyle2, _this$props2;
|
|
73
|
-
|
|
74
67
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
75
68
|
}
|
|
76
|
-
|
|
77
69
|
render() {
|
|
78
70
|
const _this$props3 = this.props,
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
messages = _this$props3.messages,
|
|
72
|
+
styles = _this$props3.styles;
|
|
81
73
|
return messages && messages.length > 0 ? jsx("span", Object.assign({
|
|
82
74
|
css: styles === null || styles === void 0 ? void 0 : styles.formFieldMessages
|
|
83
75
|
}, omitProps(this.props, FormFieldMessages.allowedProps), {
|
|
@@ -91,7 +83,6 @@ let FormFieldMessages = (_dec = withStyle(generateStyle, generateComponentTheme)
|
|
|
91
83
|
}, msg.text));
|
|
92
84
|
})) : null;
|
|
93
85
|
}
|
|
94
|
-
|
|
95
86
|
}, _class2.displayName = "FormFieldMessages", _class2.componentId = 'FormFieldMessages', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2)) || _class);
|
|
96
87
|
export default FormFieldMessages;
|
|
97
88
|
export { FormFieldMessages };
|
|
@@ -32,8 +32,8 @@ const generateComponentTheme = theme => {
|
|
|
32
32
|
const componentVariables = {
|
|
33
33
|
topMargin: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall
|
|
34
34
|
};
|
|
35
|
-
return {
|
|
35
|
+
return {
|
|
36
|
+
...componentVariables
|
|
36
37
|
};
|
|
37
38
|
};
|
|
38
|
-
|
|
39
39
|
export default generateComponentTheme;
|
package/es/FormPropTypes.js
CHANGED
|
@@ -21,10 +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
|
+
|
|
24
25
|
import PropTypes from 'prop-types';
|
|
25
26
|
const formMessageTypePropType = PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only']);
|
|
26
27
|
const formMessageChildPropType = PropTypes.node;
|
|
27
|
-
|
|
28
28
|
/**
|
|
29
29
|
* ---
|
|
30
30
|
* category: utilities/form
|
package/es/index.js
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
export { FormField } from './FormField';
|
|
25
26
|
export { FormFieldLabel } from './FormFieldLabel';
|
|
26
27
|
export { FormFieldMessage } from './FormFieldMessage';
|