@instructure/ui-form-field 11.7.8 → 11.7.9-pr-snapshot-1792147648392
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 +13 -0
- package/es/FormField/v1/index.js +39 -65
- package/es/FormField/v1/props.js +16 -26
- package/es/FormField/v2/index.js +42 -68
- package/es/FormField/v2/props.js +20 -26
- package/es/FormFieldGroup/v1/index.js +114 -130
- package/es/FormFieldGroup/v1/props.js +15 -26
- package/es/FormFieldGroup/v1/styles.js +21 -59
- package/es/FormFieldGroup/v1/theme.js +14 -47
- package/es/FormFieldGroup/v2/index.js +112 -129
- package/es/FormFieldGroup/v2/props.js +17 -26
- package/es/FormFieldGroup/v2/styles.js +14 -49
- package/es/FormFieldLabel/v1/index.js +43 -76
- package/es/FormFieldLabel/v1/props.js +5 -26
- package/es/FormFieldLabel/v1/styles.js +25 -62
- package/es/FormFieldLabel/v1/theme.js +19 -52
- package/es/FormFieldLayout/v1/index.js +139 -174
- package/es/FormFieldLayout/v1/props.js +17 -26
- package/es/FormFieldLayout/v1/styles.js +101 -155
- package/es/FormFieldLayout/v1/theme.js +22 -57
- package/es/FormFieldLayout/v2/index.js +146 -192
- package/es/FormFieldLayout/v2/props.js +21 -26
- package/es/FormFieldLayout/v2/styles.js +99 -151
- package/es/FormFieldMessage/v1/index.js +57 -84
- package/es/FormFieldMessage/v1/props.js +5 -26
- package/es/FormFieldMessage/v1/styles.js +34 -70
- package/es/FormFieldMessage/v1/theme.js +22 -56
- package/es/FormFieldMessage/v2/index.js +47 -87
- package/es/FormFieldMessage/v2/props.js +5 -26
- package/es/FormFieldMessage/v2/styles.js +34 -70
- package/es/FormFieldMessages/v1/index.js +48 -81
- package/es/FormFieldMessages/v1/props.js +5 -26
- package/es/FormFieldMessages/v1/styles.js +17 -50
- package/es/FormFieldMessages/v1/theme.js +9 -40
- package/es/FormFieldMessages/v2/index.js +48 -83
- package/es/FormFieldMessages/v2/props.js +5 -26
- package/es/FormFieldMessages/v2/styles.js +16 -49
- package/es/exports/a.js +1 -25
- package/es/exports/b.js +1 -25
- package/es/utils/v1/FormPropTypes.js +1 -1
- package/package.json +16 -22
- package/tsconfig.build.json +0 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/lib/FormField/v1/index.js +0 -80
- package/lib/FormField/v1/props.js +0 -31
- package/lib/FormField/v2/index.js +0 -84
- package/lib/FormField/v2/props.js +0 -31
- package/lib/FormFieldGroup/v1/index.js +0 -148
- package/lib/FormFieldGroup/v1/props.js +0 -31
- package/lib/FormFieldGroup/v1/styles.js +0 -66
- package/lib/FormFieldGroup/v1/theme.js +0 -54
- package/lib/FormFieldGroup/v2/index.js +0 -147
- package/lib/FormFieldGroup/v2/props.js +0 -31
- package/lib/FormFieldGroup/v2/styles.js +0 -56
- package/lib/FormFieldLabel/v1/index.js +0 -89
- package/lib/FormFieldLabel/v1/props.js +0 -31
- package/lib/FormFieldLabel/v1/styles.js +0 -70
- package/lib/FormFieldLabel/v1/theme.js +0 -59
- package/lib/FormFieldLayout/v1/index.js +0 -195
- package/lib/FormFieldLayout/v1/props.js +0 -31
- package/lib/FormFieldLayout/v1/styles.js +0 -174
- package/lib/FormFieldLayout/v1/theme.js +0 -64
- package/lib/FormFieldLayout/v2/index.js +0 -221
- package/lib/FormFieldLayout/v2/props.js +0 -31
- package/lib/FormFieldLayout/v2/styles.js +0 -170
- package/lib/FormFieldMessage/v1/index.js +0 -97
- package/lib/FormFieldMessage/v1/props.js +0 -31
- package/lib/FormFieldMessage/v1/styles.js +0 -77
- package/lib/FormFieldMessage/v1/theme.js +0 -63
- package/lib/FormFieldMessage/v2/index.js +0 -101
- package/lib/FormFieldMessage/v2/props.js +0 -31
- package/lib/FormFieldMessage/v2/styles.js +0 -77
- package/lib/FormFieldMessages/v1/index.js +0 -94
- package/lib/FormFieldMessages/v1/props.js +0 -31
- package/lib/FormFieldMessages/v1/styles.js +0 -57
- package/lib/FormFieldMessages/v1/theme.js +0 -47
- package/lib/FormFieldMessages/v2/index.js +0 -95
- package/lib/FormFieldMessages/v2/props.js +0 -31
- package/lib/FormFieldMessages/v2/styles.js +0 -56
- package/lib/exports/a.js +0 -47
- package/lib/exports/b.js +0 -40
- package/lib/package.json +0 -1
- package/lib/utils/v1/FormPropTypes.js +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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
|
+
## [11.7.9-pr-snapshot-1792147648392](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-pr-snapshot-1792147648392) (2026-10-16)
|
|
7
|
+
|
|
8
|
+
### Build System
|
|
9
|
+
|
|
10
|
+
* **many:** replace babel with swc ([7e36c54](https://github.com/instructure/instructure-ui/commit/7e36c54d240b4fa483801c03ab18e7f860f561e2))
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
* **many:** `@instructure/ui-babel-preset` and
|
|
15
|
+
`@instructure/browserslist-config-instui` are removed and will no longer be
|
|
16
|
+
published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
20
|
|
|
8
21
|
### Bug Fixes
|
package/es/FormField/v1/index.js
CHANGED
|
@@ -1,73 +1,47 @@
|
|
|
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
|
-
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
25
2
|
import { Component } from 'react';
|
|
26
3
|
import { omitProps, pickProps } from '@instructure/ui-react-utils';
|
|
27
4
|
import { FormFieldLayout } from '../../FormFieldLayout/v1/index.js';
|
|
28
5
|
import { allowedProps } from './props.js';
|
|
29
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
30
|
-
/**
|
|
31
|
-
---
|
|
32
|
-
category: components
|
|
33
|
-
---
|
|
34
|
-
**/
|
|
35
6
|
class FormField extends Component {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
7
|
+
static{
|
|
8
|
+
this.displayName = 'FormField';
|
|
9
|
+
}
|
|
10
|
+
static{
|
|
11
|
+
this.componentId = 'FormField';
|
|
12
|
+
}
|
|
13
|
+
static{
|
|
14
|
+
this.allowedProps = allowedProps;
|
|
15
|
+
}
|
|
16
|
+
static{
|
|
17
|
+
this.defaultProps = {
|
|
18
|
+
inline: false,
|
|
19
|
+
layout: 'stacked',
|
|
20
|
+
labelAlign: 'end',
|
|
21
|
+
vAlign: 'middle'
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return /*#__PURE__*/ _jsx(FormFieldLayout, {
|
|
26
|
+
...omitProps(this.props, FormField.allowedProps),
|
|
27
|
+
...pickProps(this.props, FormFieldLayout.allowedProps),
|
|
28
|
+
label: this.props.label,
|
|
29
|
+
vAlign: this.props.vAlign,
|
|
30
|
+
as: "label",
|
|
31
|
+
htmlFor: this.props.id,
|
|
32
|
+
elementRef: this.handleRef,
|
|
33
|
+
margin: this.props.margin
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
constructor(...args){
|
|
37
|
+
super(...args), this.ref = null, this.handleRef = (el)=>{
|
|
38
|
+
const { elementRef } = this.props;
|
|
39
|
+
this.ref = el;
|
|
40
|
+
if (typeof elementRef === 'function') {
|
|
41
|
+
elementRef(el);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
53
44
|
}
|
|
54
|
-
};
|
|
55
|
-
render() {
|
|
56
|
-
return _jsx(FormFieldLayout, {
|
|
57
|
-
...omitProps(this.props, FormField.allowedProps),
|
|
58
|
-
...pickProps(this.props, FormFieldLayout.allowedProps),
|
|
59
|
-
label: this.props.label,
|
|
60
|
-
vAlign: this.props.vAlign,
|
|
61
|
-
as: "label"
|
|
62
|
-
// This makes the control in focus when the label is clicked
|
|
63
|
-
// This is needed to prevent the wrong element to be focused, e.g.
|
|
64
|
-
// multi selects Tag-s
|
|
65
|
-
,
|
|
66
|
-
htmlFor: this.props.id,
|
|
67
|
-
elementRef: this.handleRef,
|
|
68
|
-
margin: this.props.margin
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
45
|
}
|
|
72
46
|
export default FormField;
|
|
73
|
-
export { FormField };
|
|
47
|
+
export { FormField };
|
package/es/FormField/v1/props.js
CHANGED
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
25
|
-
const allowedProps = ['label', 'id', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'vAlign', 'width', 'inputContainerRef', 'elementRef', 'margin'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'label',
|
|
3
|
+
'id',
|
|
4
|
+
'messages',
|
|
5
|
+
'messagesId',
|
|
6
|
+
'children',
|
|
7
|
+
'inline',
|
|
8
|
+
'layout',
|
|
9
|
+
'labelAlign',
|
|
10
|
+
'vAlign',
|
|
11
|
+
'width',
|
|
12
|
+
'inputContainerRef',
|
|
13
|
+
'elementRef',
|
|
14
|
+
'margin'
|
|
15
|
+
];
|
|
16
|
+
export { allowedProps };
|
package/es/FormField/v2/index.js
CHANGED
|
@@ -1,77 +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
|
-
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
25
2
|
import { Component } from 'react';
|
|
26
3
|
import { omitProps, pickProps } from '@instructure/ui-react-utils';
|
|
27
4
|
import { allowedProps as formFieldLayoutAllowedProps } from '../../FormFieldLayout/v2/props.js';
|
|
28
5
|
import { FormFieldLayout } from '../../FormFieldLayout/v2/index.js';
|
|
29
6
|
import { allowedProps } from './props.js';
|
|
30
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
31
|
-
/**
|
|
32
|
-
---
|
|
33
|
-
category: components
|
|
34
|
-
---
|
|
35
|
-
**/
|
|
36
7
|
class FormField extends Component {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
8
|
+
static{
|
|
9
|
+
this.displayName = 'FormField';
|
|
10
|
+
}
|
|
11
|
+
static{
|
|
12
|
+
this.componentId = 'FormField';
|
|
13
|
+
}
|
|
14
|
+
static{
|
|
15
|
+
this.allowedProps = allowedProps;
|
|
16
|
+
}
|
|
17
|
+
static{
|
|
18
|
+
this.defaultProps = {
|
|
19
|
+
inline: false,
|
|
20
|
+
layout: 'stacked',
|
|
21
|
+
labelAlign: 'end',
|
|
22
|
+
vAlign: 'middle'
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
return /*#__PURE__*/ _jsx(FormFieldLayout, {
|
|
27
|
+
...omitProps(this.props, FormField.allowedProps),
|
|
28
|
+
...pickProps(this.props, formFieldLayoutAllowedProps),
|
|
29
|
+
label: this.props.label,
|
|
30
|
+
vAlign: this.props.vAlign,
|
|
31
|
+
as: "label",
|
|
32
|
+
htmlFor: this.props.id,
|
|
33
|
+
elementRef: this.handleRef,
|
|
34
|
+
margin: this.props.margin,
|
|
35
|
+
isRequired: this.props.isRequired,
|
|
36
|
+
disabled: this.props.disabled,
|
|
37
|
+
readOnly: this.props.readOnly
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
constructor(...args){
|
|
41
|
+
super(...args), this.ref = null, this.handleRef = (el)=>{
|
|
42
|
+
const { elementRef } = this.props;
|
|
43
|
+
this.ref = el;
|
|
44
|
+
if (typeof elementRef === 'function') {
|
|
45
|
+
elementRef(el);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
54
48
|
}
|
|
55
|
-
};
|
|
56
|
-
render() {
|
|
57
|
-
return _jsx(FormFieldLayout, {
|
|
58
|
-
...omitProps(this.props, FormField.allowedProps),
|
|
59
|
-
...pickProps(this.props, formFieldLayoutAllowedProps),
|
|
60
|
-
label: this.props.label,
|
|
61
|
-
vAlign: this.props.vAlign,
|
|
62
|
-
as: "label"
|
|
63
|
-
// This makes the control in focus when the label is clicked
|
|
64
|
-
// This is needed to prevent the wrong element to be focused, e.g.
|
|
65
|
-
// multi selects Tag-s
|
|
66
|
-
,
|
|
67
|
-
htmlFor: this.props.id,
|
|
68
|
-
elementRef: this.handleRef,
|
|
69
|
-
margin: this.props.margin,
|
|
70
|
-
isRequired: this.props.isRequired,
|
|
71
|
-
disabled: this.props.disabled,
|
|
72
|
-
readOnly: this.props.readOnly
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
49
|
}
|
|
76
50
|
export default FormField;
|
|
77
|
-
export { FormField };
|
|
51
|
+
export { FormField };
|
package/es/FormField/v2/props.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const allowedProps = ['label', 'id', 'messages', 'messagesId', 'labelId', 'children', 'inline', 'layout', 'labelAlign', 'vAlign', 'width', 'inputContainerRef', 'elementRef', 'isRequired', 'margin', 'disabled', 'readOnly'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'label',
|
|
3
|
+
'id',
|
|
4
|
+
'messages',
|
|
5
|
+
'messagesId',
|
|
6
|
+
'labelId',
|
|
7
|
+
'children',
|
|
8
|
+
'inline',
|
|
9
|
+
'layout',
|
|
10
|
+
'labelAlign',
|
|
11
|
+
'vAlign',
|
|
12
|
+
'width',
|
|
13
|
+
'inputContainerRef',
|
|
14
|
+
'elementRef',
|
|
15
|
+
'isRequired',
|
|
16
|
+
'margin',
|
|
17
|
+
'disabled',
|
|
18
|
+
'readOnly'
|
|
19
|
+
];
|
|
20
|
+
export { allowedProps };
|
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* The MIT License (MIT)
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
1
|
+
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
|
|
2
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
26
3
|
import { Component, Children } from 'react';
|
|
27
4
|
import { Grid } from '@instructure/ui-grid/v11_6';
|
|
28
5
|
import { pickProps, omitProps } from '@instructure/ui-react-utils';
|
|
@@ -32,111 +9,118 @@ import { FormFieldLayout } from '../../FormFieldLayout/v1/index.js';
|
|
|
32
9
|
import generateStyle from './styles.js';
|
|
33
10
|
import generateComponentTheme from './theme.js';
|
|
34
11
|
import { allowedProps } from './props.js';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
12
|
+
class FormFieldGroup extends Component {
|
|
13
|
+
static{
|
|
14
|
+
this.displayName = 'FormFieldGroup';
|
|
15
|
+
}
|
|
16
|
+
static{
|
|
17
|
+
this.componentId = 'FormFieldGroup';
|
|
18
|
+
}
|
|
19
|
+
static{
|
|
20
|
+
this.allowedProps = allowedProps;
|
|
21
|
+
}
|
|
22
|
+
static{
|
|
23
|
+
this.defaultProps = {
|
|
24
|
+
as: 'fieldset',
|
|
25
|
+
disabled: false,
|
|
26
|
+
rowSpacing: 'medium',
|
|
27
|
+
colSpacing: 'small',
|
|
28
|
+
vAlign: 'middle',
|
|
29
|
+
isGroup: true
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
componentDidMount() {
|
|
33
|
+
this.props.makeStyles?.(this.makeStylesVariables);
|
|
34
|
+
}
|
|
35
|
+
componentDidUpdate() {
|
|
36
|
+
this.props.makeStyles?.(this.makeStylesVariables);
|
|
37
|
+
}
|
|
38
|
+
get makeStylesVariables() {
|
|
39
|
+
const oldInvalid = !!this.props.messages && this.props.messages.findIndex((message)=>{
|
|
40
|
+
return message.type === 'error';
|
|
41
|
+
}) >= 0;
|
|
42
|
+
return {
|
|
43
|
+
invalid: oldInvalid
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
get invalid() {
|
|
47
|
+
return !!this.props.messages && this.props.messages.findIndex((message)=>{
|
|
48
|
+
return message.type === 'error' || message.type === 'newError';
|
|
49
|
+
}) >= 0;
|
|
50
|
+
}
|
|
51
|
+
renderColumns() {
|
|
52
|
+
return Children.map(this.props.children, (child, index)=>{
|
|
53
|
+
return child ? /*#__PURE__*/ _jsx(Grid.Col, {
|
|
54
|
+
width: child.props && child.props.width ? 'auto' : undefined,
|
|
55
|
+
children: child
|
|
56
|
+
}, index) : null;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
renderChildren() {
|
|
60
|
+
return /*#__PURE__*/ _jsx(Grid, {
|
|
61
|
+
colSpacing: this.props.colSpacing,
|
|
62
|
+
rowSpacing: this.props.rowSpacing,
|
|
63
|
+
vAlign: this.props.vAlign,
|
|
64
|
+
startAt: this.props.startAt || (this.props.layout === 'columns' ? 'medium' : null),
|
|
65
|
+
children: /*#__PURE__*/ _jsx(Grid.Row, {
|
|
66
|
+
children: this.renderColumns()
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
renderFields() {
|
|
71
|
+
const { styles } = this.props;
|
|
72
|
+
return /*#__PURE__*/ _jsx("span", {
|
|
73
|
+
css: styles?.formFieldGroup,
|
|
74
|
+
children: this.renderChildren()
|
|
75
|
+
}, "fields");
|
|
76
|
+
}
|
|
77
|
+
render() {
|
|
78
|
+
const { styles, makeStyles, isGroup, ...props } = this.props;
|
|
79
|
+
let ariaInvalid = undefined;
|
|
80
|
+
if (this.props.role && this.invalid && [
|
|
81
|
+
'application',
|
|
82
|
+
'checkbox',
|
|
83
|
+
'combobox',
|
|
84
|
+
'gridcell',
|
|
85
|
+
'listbox',
|
|
86
|
+
'radiogroup',
|
|
87
|
+
'slider',
|
|
88
|
+
'spinbutton',
|
|
89
|
+
'textbox',
|
|
90
|
+
'tree',
|
|
91
|
+
'columnheader',
|
|
92
|
+
'rowheader',
|
|
93
|
+
'searchbox',
|
|
94
|
+
'switch',
|
|
95
|
+
'treegrid'
|
|
96
|
+
].includes(this.props.role)) {
|
|
97
|
+
ariaInvalid = 'true';
|
|
98
|
+
}
|
|
99
|
+
return /*#__PURE__*/ _jsx(FormFieldLayout, {
|
|
100
|
+
...omitProps(props, FormFieldGroup.allowedProps),
|
|
101
|
+
...pickProps(props, FormFieldLayoutAllowedProps),
|
|
102
|
+
vAlign: props.vAlign,
|
|
103
|
+
layout: props.layout === 'inline' ? 'inline' : 'stacked',
|
|
104
|
+
label: props.description,
|
|
105
|
+
"aria-disabled": props.disabled ? 'true' : undefined,
|
|
106
|
+
"aria-invalid": ariaInvalid,
|
|
107
|
+
elementRef: this.handleRef,
|
|
108
|
+
isGroup: isGroup,
|
|
109
|
+
children: this.renderFields()
|
|
110
|
+
});
|
|
61
111
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// new form errors dont need borders
|
|
71
|
-
const oldInvalid = !!this.props.messages && this.props.messages.findIndex(message => {
|
|
72
|
-
return message.type === 'error';
|
|
73
|
-
}) >= 0;
|
|
74
|
-
return {
|
|
75
|
-
invalid: oldInvalid
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
get invalid() {
|
|
79
|
-
return !!this.props.messages && this.props.messages.findIndex(message => {
|
|
80
|
-
return message.type === 'error' || message.type === 'newError';
|
|
81
|
-
}) >= 0;
|
|
82
|
-
}
|
|
83
|
-
renderColumns() {
|
|
84
|
-
return Children.map(this.props.children, (child, index) => {
|
|
85
|
-
return child ? _jsx(Grid.Col, {
|
|
86
|
-
width: child.props && child.props.width ? 'auto' : undefined,
|
|
87
|
-
children: child
|
|
88
|
-
}, index) : null;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
renderChildren() {
|
|
92
|
-
return _jsx(Grid, {
|
|
93
|
-
colSpacing: this.props.colSpacing,
|
|
94
|
-
rowSpacing: this.props.rowSpacing,
|
|
95
|
-
vAlign: this.props.vAlign,
|
|
96
|
-
startAt: this.props.startAt || (this.props.layout === 'columns' ? 'medium' : null),
|
|
97
|
-
children: _jsx(Grid.Row, {
|
|
98
|
-
children: this.renderColumns()
|
|
99
|
-
})
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
renderFields() {
|
|
103
|
-
const {
|
|
104
|
-
styles
|
|
105
|
-
} = this.props;
|
|
106
|
-
return _jsx("span", {
|
|
107
|
-
css: styles?.formFieldGroup,
|
|
108
|
-
children: this.renderChildren()
|
|
109
|
-
}, "fields");
|
|
110
|
-
}
|
|
111
|
-
render() {
|
|
112
|
-
const {
|
|
113
|
-
styles,
|
|
114
|
-
makeStyles,
|
|
115
|
-
isGroup,
|
|
116
|
-
...props
|
|
117
|
-
} = this.props;
|
|
118
|
-
// This is quite ugly, but according to ARIA spec the `aria-invalid` prop
|
|
119
|
-
// can only be used with certain roles see
|
|
120
|
-
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid#associated_roles
|
|
121
|
-
// `aria-invalid` is put on in FormFieldLayout because the error message
|
|
122
|
-
// DOM part gets there its ID.
|
|
123
|
-
let ariaInvalid = undefined;
|
|
124
|
-
if (this.props.role && this.invalid && ['application', 'checkbox', 'combobox', 'gridcell', 'listbox', 'radiogroup', 'slider', 'spinbutton', 'textbox', 'tree', 'columnheader', 'rowheader', 'searchbox', 'switch', 'treegrid'].includes(this.props.role)) {
|
|
125
|
-
ariaInvalid = 'true';
|
|
112
|
+
constructor(...args){
|
|
113
|
+
super(...args), this.ref = null, this.handleRef = (el)=>{
|
|
114
|
+
const { elementRef } = this.props;
|
|
115
|
+
this.ref = el;
|
|
116
|
+
if (typeof elementRef === 'function') {
|
|
117
|
+
elementRef(el);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
126
120
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
layout: props.layout === 'inline' ? 'inline' : 'stacked',
|
|
132
|
-
label: props.description,
|
|
133
|
-
"aria-disabled": props.disabled ? 'true' : undefined,
|
|
134
|
-
"aria-invalid": ariaInvalid,
|
|
135
|
-
elementRef: this.handleRef,
|
|
136
|
-
isGroup: isGroup,
|
|
137
|
-
children: this.renderFields()
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}) || _class);
|
|
121
|
+
}
|
|
122
|
+
FormFieldGroup = _ts_decorate([
|
|
123
|
+
withStyle(generateStyle, generateComponentTheme)
|
|
124
|
+
], FormFieldGroup);
|
|
141
125
|
export default FormFieldGroup;
|
|
142
|
-
export { FormFieldGroup };
|
|
126
|
+
export { FormFieldGroup };
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
25
|
-
const allowedProps = ['description', 'as', 'messages', 'messagesId', 'disabled', 'children', 'layout', 'rowSpacing', 'colSpacing', 'vAlign', 'startAt', 'elementRef'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'description',
|
|
3
|
+
'as',
|
|
4
|
+
'messages',
|
|
5
|
+
'messagesId',
|
|
6
|
+
'disabled',
|
|
7
|
+
'children',
|
|
8
|
+
'layout',
|
|
9
|
+
'rowSpacing',
|
|
10
|
+
'colSpacing',
|
|
11
|
+
'vAlign',
|
|
12
|
+
'startAt',
|
|
13
|
+
'elementRef'
|
|
14
|
+
];
|
|
15
|
+
export { allowedProps };
|