@instructure/ui-form-field 11.7.4-snapshot-1 → 11.7.4-snapshot-4
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 +5 -2
- package/es/FormFieldGroup/v2/index.js +14 -6
- package/lib/FormFieldGroup/v2/index.js +13 -4
- package/package.json +14 -14
- package/src/FormFieldGroup/v2/index.tsx +23 -11
- package/src/FormFieldGroup/v2/props.ts +2 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/FormFieldGroup/v2/index.d.ts.map +1 -1
- package/types/FormFieldGroup/v2/props.d.ts +2 -1
- package/types/FormFieldGroup/v2/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +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-4](https://github.com/instructure/instructure-ui/compare/v11.7.3...v11.7.4-snapshot-4) (2026-05-12)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ui-form-field:** disable child inputs when FormFieldGroup is disabled ([7fada35](https://github.com/instructure/instructure-ui/commit/7fada35327a9e53c387efb6cfbfc75a0759756ec))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
|
@@ -23,9 +23,9 @@ var _dec, _class;
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import { Component, Children } from 'react';
|
|
26
|
+
import { Component, Children, isValidElement } from 'react';
|
|
27
27
|
import { Grid } from '@instructure/ui-grid/latest';
|
|
28
|
-
import { pickProps, omitProps } from '@instructure/ui-react-utils';
|
|
28
|
+
import { pickProps, omitProps, safeCloneElement } from '@instructure/ui-react-utils';
|
|
29
29
|
import { withStyleNew } from '@instructure/emotion';
|
|
30
30
|
import { allowedProps as formFieldLayoutAllowedProps } from "../../FormFieldLayout/v2/props.js";
|
|
31
31
|
import { FormFieldLayout } from "../../FormFieldLayout/v2/index.js";
|
|
@@ -71,11 +71,19 @@ let FormFieldGroup = (_dec = withStyleNew(generateStyle), _dec(_class = class Fo
|
|
|
71
71
|
}) >= 0;
|
|
72
72
|
}
|
|
73
73
|
renderColumns() {
|
|
74
|
+
const {
|
|
75
|
+
disabled
|
|
76
|
+
} = this.props;
|
|
74
77
|
return Children.map(this.props.children, (child, index) => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
if (!child) return null;
|
|
79
|
+
const el = child;
|
|
80
|
+
const renderedChild = disabled && /*#__PURE__*/isValidElement(el) ? safeCloneElement(el, {
|
|
81
|
+
disabled: true
|
|
82
|
+
}) : child;
|
|
83
|
+
return _jsx(Grid.Col, {
|
|
84
|
+
width: el.props && el.props.width ? 'auto' : undefined,
|
|
85
|
+
children: renderedChild
|
|
86
|
+
}, index);
|
|
79
87
|
});
|
|
80
88
|
}
|
|
81
89
|
renderChildren() {
|
|
@@ -9,6 +9,7 @@ var _react = require("react");
|
|
|
9
9
|
var _latest = require("@instructure/ui-grid/latest");
|
|
10
10
|
var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
|
|
11
11
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
12
|
+
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
12
13
|
var _emotion = require("@instructure/emotion");
|
|
13
14
|
var _props = require("../../FormFieldLayout/v2/props");
|
|
14
15
|
var _v = require("../../FormFieldLayout/v2");
|
|
@@ -78,11 +79,19 @@ let FormFieldGroup = exports.FormFieldGroup = (_dec = (0, _emotion.withStyleNew)
|
|
|
78
79
|
}) >= 0;
|
|
79
80
|
}
|
|
80
81
|
renderColumns() {
|
|
82
|
+
const {
|
|
83
|
+
disabled
|
|
84
|
+
} = this.props;
|
|
81
85
|
return _react.Children.map(this.props.children, (child, index) => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
if (!child) return null;
|
|
87
|
+
const el = child;
|
|
88
|
+
const renderedChild = disabled && /*#__PURE__*/(0, _react.isValidElement)(el) ? (0, _safeCloneElement.safeCloneElement)(el, {
|
|
89
|
+
disabled: true
|
|
90
|
+
}) : child;
|
|
91
|
+
return (0, _jsxRuntime.jsx)(_latest.Grid.Col, {
|
|
92
|
+
width: el.props && el.props.width ? 'auto' : undefined,
|
|
93
|
+
children: renderedChild
|
|
94
|
+
}, index);
|
|
86
95
|
});
|
|
87
96
|
}
|
|
88
97
|
renderChildren() {
|
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-4",
|
|
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.2",
|
|
18
|
-
"@instructure/console": "11.7.4-snapshot-
|
|
19
|
-
"@instructure/emotion": "11.7.4-snapshot-
|
|
20
|
-
"@instructure/
|
|
21
|
-
"@instructure/
|
|
22
|
-
"@instructure/ui-a11y-utils": "11.7.4-snapshot-
|
|
23
|
-
"@instructure/ui-grid": "11.7.4-snapshot-
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-
|
|
27
|
-
"@instructure/uid": "11.7.4-snapshot-
|
|
28
|
-
"@instructure/ui-
|
|
18
|
+
"@instructure/console": "11.7.4-snapshot-4",
|
|
19
|
+
"@instructure/emotion": "11.7.4-snapshot-4",
|
|
20
|
+
"@instructure/shared-types": "11.7.4-snapshot-4",
|
|
21
|
+
"@instructure/ui-a11y-content": "11.7.4-snapshot-4",
|
|
22
|
+
"@instructure/ui-a11y-utils": "11.7.4-snapshot-4",
|
|
23
|
+
"@instructure/ui-grid": "11.7.4-snapshot-4",
|
|
24
|
+
"@instructure/ui-icons": "11.7.4-snapshot-4",
|
|
25
|
+
"@instructure/ui-react-utils": "11.7.4-snapshot-4",
|
|
26
|
+
"@instructure/ui-utils": "11.7.4-snapshot-4",
|
|
27
|
+
"@instructure/uid": "11.7.4-snapshot-4",
|
|
28
|
+
"@instructure/ui-themes": "11.7.4-snapshot-4"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@testing-library/jest-dom": "^6.6.3",
|
|
32
32
|
"@testing-library/react": "15.0.7",
|
|
33
33
|
"vitest": "^3.2.2",
|
|
34
|
-
"@instructure/ui-axe-check": "11.7.4-snapshot-
|
|
35
|
-
"@instructure/ui-babel-preset": "11.7.4-snapshot-
|
|
34
|
+
"@instructure/ui-axe-check": "11.7.4-snapshot-4",
|
|
35
|
+
"@instructure/ui-babel-preset": "11.7.4-snapshot-4"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": ">=18 <=19"
|
|
@@ -22,10 +22,20 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
Component,
|
|
27
|
+
Children,
|
|
28
|
+
ReactElement,
|
|
29
|
+
AriaAttributes,
|
|
30
|
+
isValidElement
|
|
31
|
+
} from 'react'
|
|
26
32
|
|
|
27
33
|
import { Grid } from '@instructure/ui-grid/latest'
|
|
28
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
pickProps,
|
|
36
|
+
omitProps,
|
|
37
|
+
safeCloneElement
|
|
38
|
+
} from '@instructure/ui-react-utils'
|
|
29
39
|
import { withStyleNew } from '@instructure/emotion'
|
|
30
40
|
|
|
31
41
|
import { allowedProps as formFieldLayoutAllowedProps } from '../../FormFieldLayout/v2/props'
|
|
@@ -86,20 +96,22 @@ class FormFieldGroup extends Component<FormFieldGroupProps> {
|
|
|
86
96
|
}
|
|
87
97
|
|
|
88
98
|
renderColumns() {
|
|
99
|
+
const { disabled } = this.props
|
|
89
100
|
return Children.map(this.props.children, (child, index) => {
|
|
90
|
-
|
|
101
|
+
if (!child) return null
|
|
102
|
+
const el = child as ReactElement<any>
|
|
103
|
+
const renderedChild =
|
|
104
|
+
disabled && isValidElement(el)
|
|
105
|
+
? safeCloneElement(el, { disabled: true })
|
|
106
|
+
: child
|
|
107
|
+
return (
|
|
91
108
|
<Grid.Col
|
|
92
|
-
width={
|
|
93
|
-
(child as ReactElement).props &&
|
|
94
|
-
(child as ReactElement<any>).props.width
|
|
95
|
-
? 'auto'
|
|
96
|
-
: undefined
|
|
97
|
-
}
|
|
109
|
+
width={el.props && el.props.width ? 'auto' : undefined}
|
|
98
110
|
key={index}
|
|
99
111
|
>
|
|
100
|
-
{
|
|
112
|
+
{renderedChild}
|
|
101
113
|
</Grid.Col>
|
|
102
|
-
)
|
|
114
|
+
)
|
|
103
115
|
})
|
|
104
116
|
}
|
|
105
117
|
|
|
@@ -48,7 +48,8 @@ type FormFieldGroupOwnProps = {
|
|
|
48
48
|
*/
|
|
49
49
|
messagesId?: string
|
|
50
50
|
/**
|
|
51
|
-
* Whether the field group is disabled. When true,
|
|
51
|
+
* Whether the field group is disabled. When true, the disabled prop is propagated to all
|
|
52
|
+
* child components, error and success messages will be hidden.
|
|
52
53
|
*/
|
|
53
54
|
disabled?: boolean
|
|
54
55
|
/**
|