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