@instructure/ui-form-field 11.7.4-snapshot-121 → 11.7.4-snapshot-126
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 +2 -1
- package/es/FormField/v2/props.js +1 -1
- package/es/FormFieldLayout/v2/index.js +5 -1
- package/es/FormFieldLayout/v2/props.js +1 -1
- package/lib/FormField/v2/props.js +1 -1
- package/lib/FormFieldLayout/v2/index.js +5 -1
- package/lib/FormFieldLayout/v2/props.js +1 -1
- package/package.json +14 -14
- package/src/FormField/v2/props.ts +9 -1
- package/src/FormFieldLayout/v2/index.tsx +10 -2
- package/src/FormFieldLayout/v2/props.ts +6 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/FormField/v2/props.d.ts +8 -1
- package/types/FormField/v2/props.d.ts.map +1 -1
- package/types/FormFieldLayout/v2/index.d.ts.map +1 -1
- package/types/FormFieldLayout/v2/props.d.ts +5 -0
- package/types/FormFieldLayout/v2/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,11 +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
|
-
## [11.7.4-snapshot-
|
|
6
|
+
## [11.7.4-snapshot-126](https://github.com/instructure/instructure-ui/compare/v11.7.3...v11.7.4-snapshot-126) (2026-07-22)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
10
10
|
|
|
11
|
+
* **many:** keep form field messages out of the control's accessible name ([409d077](https://github.com/instructure/instructure-ui/commit/409d077a3095b318fd7d2e150bb01bc2732c9bf5))
|
|
11
12
|
* **ui-form-field:** disable child inputs when FormFieldGroup is disabled ([d30fc64](https://github.com/instructure/instructure-ui/commit/d30fc642a3586f708d86ab570ae73086107e2695))
|
|
12
13
|
|
|
13
14
|
|
package/es/FormField/v2/props.js
CHANGED
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const allowedProps = ['label', 'id', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'vAlign', 'width', 'inputContainerRef', 'elementRef', 'isRequired', 'margin', 'disabled', 'readOnly'];
|
|
25
|
+
const allowedProps = ['label', 'id', 'messages', 'messagesId', 'labelId', 'children', 'inline', 'layout', 'labelAlign', 'vAlign', 'width', 'inputContainerRef', 'elementRef', 'isRequired', 'margin', 'disabled', 'readOnly'];
|
|
26
26
|
export { allowedProps };
|
|
@@ -45,6 +45,7 @@ const FormFieldLayout = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
45
45
|
label,
|
|
46
46
|
messages,
|
|
47
47
|
messagesId: messagesIdProp,
|
|
48
|
+
labelId: labelIdProp,
|
|
48
49
|
children,
|
|
49
50
|
width,
|
|
50
51
|
elementRef,
|
|
@@ -65,7 +66,9 @@ const FormFieldLayout = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
65
66
|
setDeterministicId(getId());
|
|
66
67
|
}, []);
|
|
67
68
|
const messagesId = messagesIdProp || deterministicId;
|
|
68
|
-
|
|
69
|
+
// Give the label an id so controls can reference only the label text via
|
|
70
|
+
// `aria-labelledby`, keeping messages out of the accessible name.
|
|
71
|
+
const labelId = labelIdProp || (deterministicId ? `${deterministicId}-Label` : undefined);
|
|
69
72
|
|
|
70
73
|
// Filter out error and success messages when disabled or readOnly
|
|
71
74
|
const filteredMessages = disabled || readOnly ? messages?.filter(msg => msg.type !== 'error' && msg.type !== 'newError' && msg.type !== 'success') : messages;
|
|
@@ -145,6 +148,7 @@ const FormFieldLayout = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
145
148
|
}
|
|
146
149
|
return _jsx("span", {
|
|
147
150
|
css: styles?.formFieldLabel,
|
|
151
|
+
id: labelId,
|
|
148
152
|
children: labelContent
|
|
149
153
|
});
|
|
150
154
|
} else if (label) {
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const allowedProps = ['label', 'id', 'as', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef', 'elementRef', 'margin', 'vAlign', 'isRequired', 'disabled', 'readOnly'];
|
|
25
|
+
const allowedProps = ['label', 'id', 'as', 'messages', 'messagesId', 'labelId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef', 'elementRef', 'margin', 'vAlign', 'isRequired', 'disabled', 'readOnly'];
|
|
26
26
|
export { allowedProps };
|
|
@@ -28,4 +28,4 @@ exports.allowedProps = void 0;
|
|
|
28
28
|
* SOFTWARE.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
const allowedProps = exports.allowedProps = ['label', 'id', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'vAlign', 'width', 'inputContainerRef', 'elementRef', 'isRequired', 'margin', 'disabled', 'readOnly'];
|
|
31
|
+
const allowedProps = exports.allowedProps = ['label', 'id', 'messages', 'messagesId', 'labelId', 'children', 'inline', 'layout', 'labelAlign', 'vAlign', 'width', 'inputContainerRef', 'elementRef', 'isRequired', 'margin', 'disabled', 'readOnly'];
|
|
@@ -60,6 +60,7 @@ const FormFieldLayout = exports.FormFieldLayout = /*#__PURE__*/(0, _react.forwar
|
|
|
60
60
|
label,
|
|
61
61
|
messages,
|
|
62
62
|
messagesId: messagesIdProp,
|
|
63
|
+
labelId: labelIdProp,
|
|
63
64
|
children,
|
|
64
65
|
width,
|
|
65
66
|
elementRef,
|
|
@@ -80,7 +81,9 @@ const FormFieldLayout = exports.FormFieldLayout = /*#__PURE__*/(0, _react.forwar
|
|
|
80
81
|
setDeterministicId(getId());
|
|
81
82
|
}, []);
|
|
82
83
|
const messagesId = messagesIdProp || deterministicId;
|
|
83
|
-
|
|
84
|
+
// Give the label an id so controls can reference only the label text via
|
|
85
|
+
// `aria-labelledby`, keeping messages out of the accessible name.
|
|
86
|
+
const labelId = labelIdProp || (deterministicId ? `${deterministicId}-Label` : undefined);
|
|
84
87
|
|
|
85
88
|
// Filter out error and success messages when disabled or readOnly
|
|
86
89
|
const filteredMessages = disabled || readOnly ? messages?.filter(msg => msg.type !== 'error' && msg.type !== 'newError' && msg.type !== 'success') : messages;
|
|
@@ -160,6 +163,7 @@ const FormFieldLayout = exports.FormFieldLayout = /*#__PURE__*/(0, _react.forwar
|
|
|
160
163
|
}
|
|
161
164
|
return (0, _jsxRuntime.jsx)("span", {
|
|
162
165
|
css: styles?.formFieldLabel,
|
|
166
|
+
id: labelId,
|
|
163
167
|
children: labelContent
|
|
164
168
|
});
|
|
165
169
|
} else if (label) {
|
|
@@ -28,4 +28,4 @@ exports.allowedProps = void 0;
|
|
|
28
28
|
* SOFTWARE.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
const allowedProps = exports.allowedProps = ['label', 'id', 'as', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef', 'elementRef', 'margin', 'vAlign', 'isRequired', 'disabled', 'readOnly'];
|
|
31
|
+
const allowedProps = exports.allowedProps = ['label', 'id', 'as', 'messages', 'messagesId', 'labelId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef', 'elementRef', 'margin', 'vAlign', 'isRequired', 'disabled', 'readOnly'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-form-field",
|
|
3
|
-
"version": "11.7.4-snapshot-
|
|
3
|
+
"version": "11.7.4-snapshot-126",
|
|
4
4
|
"description": "Form layout components.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,24 +15,24 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
|
-
"@instructure/console": "11.7.4-snapshot-
|
|
19
|
-
"@instructure/
|
|
20
|
-
"@instructure/
|
|
21
|
-
"@instructure/ui-a11y-
|
|
22
|
-
"@instructure/ui-
|
|
23
|
-
"@instructure/
|
|
24
|
-
"@instructure/ui-icons": "11.7.4-snapshot-
|
|
25
|
-
"@instructure/ui-themes": "11.7.4-snapshot-
|
|
26
|
-
"@instructure/ui-react-utils": "11.7.4-snapshot-
|
|
27
|
-
"@instructure/
|
|
28
|
-
"@instructure/
|
|
18
|
+
"@instructure/console": "11.7.4-snapshot-126",
|
|
19
|
+
"@instructure/shared-types": "11.7.4-snapshot-126",
|
|
20
|
+
"@instructure/emotion": "11.7.4-snapshot-126",
|
|
21
|
+
"@instructure/ui-a11y-content": "11.7.4-snapshot-126",
|
|
22
|
+
"@instructure/ui-a11y-utils": "11.7.4-snapshot-126",
|
|
23
|
+
"@instructure/ui-grid": "11.7.4-snapshot-126",
|
|
24
|
+
"@instructure/ui-icons": "11.7.4-snapshot-126",
|
|
25
|
+
"@instructure/ui-themes": "11.7.4-snapshot-126",
|
|
26
|
+
"@instructure/ui-react-utils": "11.7.4-snapshot-126",
|
|
27
|
+
"@instructure/ui-utils": "11.7.4-snapshot-126",
|
|
28
|
+
"@instructure/uid": "11.7.4-snapshot-126"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@testing-library/jest-dom": "^6.9.1",
|
|
32
32
|
"@testing-library/react": "16.3.2",
|
|
33
33
|
"vitest": "^4.1.9",
|
|
34
|
-
"@instructure/ui-
|
|
35
|
-
"@instructure/ui-
|
|
34
|
+
"@instructure/ui-babel-preset": "11.7.4-snapshot-126",
|
|
35
|
+
"@instructure/ui-axe-check": "11.7.4-snapshot-126"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": ">=18 <=19"
|
|
@@ -46,6 +46,11 @@ type FormFieldOwnProps = {
|
|
|
46
46
|
* id for the form field messages
|
|
47
47
|
*/
|
|
48
48
|
messagesId?: string
|
|
49
|
+
/**
|
|
50
|
+
* id for the label element, so a single form control can reference just the
|
|
51
|
+
* label text via `aria-labelledby` (keeping messages out of its accessible name)
|
|
52
|
+
*/
|
|
53
|
+
labelId?: string
|
|
49
54
|
children?: React.ReactNode
|
|
50
55
|
inline?: boolean
|
|
51
56
|
layout?: 'stacked' | 'inline'
|
|
@@ -63,7 +68,9 @@ type FormFieldOwnProps = {
|
|
|
63
68
|
isRequired?: boolean
|
|
64
69
|
|
|
65
70
|
/**
|
|
66
|
-
*
|
|
71
|
+
* Valid values are `0`, `none`, `auto`, and Spacing token values,
|
|
72
|
+
* see https://instructure.design/layout-spacing. Apply these values via
|
|
73
|
+
* familiar CSS-like shorthand. For example, `margin="general.spaceMd auto"`.
|
|
67
74
|
*/
|
|
68
75
|
margin?: Spacing
|
|
69
76
|
/**
|
|
@@ -86,6 +93,7 @@ const allowedProps: AllowedPropKeys = [
|
|
|
86
93
|
'id',
|
|
87
94
|
'messages',
|
|
88
95
|
'messagesId',
|
|
96
|
+
'labelId',
|
|
89
97
|
'children',
|
|
90
98
|
'inline',
|
|
91
99
|
'layout',
|
|
@@ -48,6 +48,7 @@ const FormFieldLayout = forwardRef<Element, FormFieldLayoutProps>(
|
|
|
48
48
|
label,
|
|
49
49
|
messages,
|
|
50
50
|
messagesId: messagesIdProp,
|
|
51
|
+
labelId: labelIdProp,
|
|
51
52
|
children,
|
|
52
53
|
width,
|
|
53
54
|
elementRef,
|
|
@@ -69,7 +70,10 @@ const FormFieldLayout = forwardRef<Element, FormFieldLayoutProps>(
|
|
|
69
70
|
}, [])
|
|
70
71
|
|
|
71
72
|
const messagesId = messagesIdProp || deterministicId
|
|
72
|
-
|
|
73
|
+
// Give the label an id so controls can reference only the label text via
|
|
74
|
+
// `aria-labelledby`, keeping messages out of the accessible name.
|
|
75
|
+
const labelId =
|
|
76
|
+
labelIdProp || (deterministicId ? `${deterministicId}-Label` : undefined)
|
|
73
77
|
|
|
74
78
|
// Filter out error and success messages when disabled or readOnly
|
|
75
79
|
const filteredMessages =
|
|
@@ -183,7 +187,11 @@ const FormFieldLayout = forwardRef<Element, FormFieldLayoutProps>(
|
|
|
183
187
|
</legend>
|
|
184
188
|
)
|
|
185
189
|
}
|
|
186
|
-
return
|
|
190
|
+
return (
|
|
191
|
+
<span css={styles?.formFieldLabel} id={labelId}>
|
|
192
|
+
{labelContent}
|
|
193
|
+
</span>
|
|
194
|
+
)
|
|
187
195
|
} else if (label) {
|
|
188
196
|
if (ElementType === 'fieldset') {
|
|
189
197
|
return (
|
|
@@ -56,6 +56,11 @@ type FormFieldLayoutOwnProps = {
|
|
|
56
56
|
* id for the form field messages
|
|
57
57
|
*/
|
|
58
58
|
messagesId?: string
|
|
59
|
+
/**
|
|
60
|
+
* id for the label element, so a single form control can reference just the
|
|
61
|
+
* label text via `aria-labelledby` (keeping messages out of its accessible name)
|
|
62
|
+
*/
|
|
63
|
+
labelId?: string
|
|
59
64
|
children?: React.ReactNode
|
|
60
65
|
/**
|
|
61
66
|
* If `true` use an inline layout -- content will flow on the left/right side
|
|
@@ -129,6 +134,7 @@ const allowedProps: AllowedPropKeys = [
|
|
|
129
134
|
'as',
|
|
130
135
|
'messages',
|
|
131
136
|
'messagesId',
|
|
137
|
+
'labelId',
|
|
132
138
|
'children',
|
|
133
139
|
'inline',
|
|
134
140
|
'layout',
|