@instructure/ui-form-field 10.16.1-snapshot-0 → 10.16.1-snapshot-1

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/es/FormField/__new-tests__/FormField.test.js +10 -9
  3. package/es/FormField/index.js +6 -3
  4. package/es/FormFieldGroup/__new-tests__/FormFieldGroup.test.js +48 -19
  5. package/es/FormFieldGroup/index.js +21 -15
  6. package/es/FormFieldLabel/__new-tests__/FormFieldLabel.test.js +11 -6
  7. package/es/FormFieldLabel/index.js +7 -5
  8. package/es/FormFieldLayout/__new-tests__/FormFieldLayout.test.js +12 -10
  9. package/es/FormFieldLayout/index.js +32 -24
  10. package/es/FormFieldMessage/__new-tests__/FormFieldMessage.test.js +10 -4
  11. package/es/FormFieldMessage/index.js +18 -14
  12. package/es/FormFieldMessages/__new-tests__/FormFieldMessages.test.js +7 -5
  13. package/es/FormFieldMessages/index.js +16 -14
  14. package/lib/FormField/__new-tests__/FormField.test.js +14 -14
  15. package/lib/FormField/index.js +6 -4
  16. package/lib/FormFieldGroup/__new-tests__/FormFieldGroup.test.js +52 -24
  17. package/lib/FormFieldGroup/index.js +20 -14
  18. package/lib/FormFieldLabel/__new-tests__/FormFieldLabel.test.js +12 -8
  19. package/lib/FormFieldLabel/index.js +6 -4
  20. package/lib/FormFieldLayout/__new-tests__/FormFieldLayout.test.js +12 -11
  21. package/lib/FormFieldLayout/index.js +31 -23
  22. package/lib/FormFieldMessage/__new-tests__/FormFieldMessage.test.js +11 -6
  23. package/lib/FormFieldMessage/index.js +17 -13
  24. package/lib/FormFieldMessages/__new-tests__/FormFieldMessages.test.js +8 -7
  25. package/lib/FormFieldMessages/index.js +15 -13
  26. package/package.json +15 -15
  27. package/src/FormField/__new-tests__/FormField.test.tsx +0 -1
  28. package/src/FormField/index.tsx +1 -1
  29. package/src/FormFieldGroup/__new-tests__/FormFieldGroup.test.tsx +0 -1
  30. package/src/FormFieldGroup/index.tsx +1 -2
  31. package/src/FormFieldLabel/__new-tests__/FormFieldLabel.test.tsx +0 -1
  32. package/src/FormFieldLabel/index.tsx +1 -2
  33. package/src/FormFieldLayout/__new-tests__/FormFieldLayout.test.tsx +2 -2
  34. package/src/FormFieldLayout/index.tsx +2 -3
  35. package/src/FormFieldMessage/__new-tests__/FormFieldMessage.test.tsx +0 -1
  36. package/src/FormFieldMessage/index.tsx +1 -2
  37. package/src/FormFieldMessages/__new-tests__/FormFieldMessages.test.tsx +0 -1
  38. package/src/FormFieldMessages/index.tsx +1 -2
  39. package/tsconfig.build.tsbuildinfo +1 -1
  40. package/types/FormField/__new-tests__/FormField.test.d.ts.map +1 -1
  41. package/types/FormField/index.d.ts +2 -2
  42. package/types/FormField/index.d.ts.map +1 -1
  43. package/types/FormFieldGroup/__new-tests__/FormFieldGroup.test.d.ts.map +1 -1
  44. package/types/FormFieldGroup/index.d.ts +4 -6
  45. package/types/FormFieldGroup/index.d.ts.map +1 -1
  46. package/types/FormFieldLabel/__new-tests__/FormFieldLabel.test.d.ts.map +1 -1
  47. package/types/FormFieldLabel/index.d.ts +1 -3
  48. package/types/FormFieldLabel/index.d.ts.map +1 -1
  49. package/types/FormFieldLayout/index.d.ts +3 -5
  50. package/types/FormFieldLayout/index.d.ts.map +1 -1
  51. package/types/FormFieldMessage/__new-tests__/FormFieldMessage.test.d.ts.map +1 -1
  52. package/types/FormFieldMessage/index.d.ts +1 -3
  53. package/types/FormFieldMessage/index.d.ts.map +1 -1
  54. package/types/FormFieldMessages/__new-tests__/FormFieldMessages.test.d.ts.map +1 -1
  55. package/types/FormFieldMessages/index.d.ts +1 -3
  56. package/types/FormFieldMessages/index.d.ts.map +1 -1
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
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
- ## [10.16.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1-snapshot-0) (2025-04-15)
6
+ ## [10.16.1-snapshot-1](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1-snapshot-1) (2025-04-22)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-form-field
9
9
 
@@ -23,13 +23,13 @@ var _FormField, _FormField2, _FormField3, _FormField4;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { render, screen } from '@testing-library/react';
28
27
  import { vi } from 'vitest';
29
28
  import { runAxeCheck } from '@instructure/ui-axe-check';
30
29
  import '@testing-library/jest-dom';
31
30
  import { FormField } from '../index';
32
31
  import { userEvent } from '@testing-library/user-event';
32
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
33
33
  describe('<FormField />', () => {
34
34
  let consoleWarningMock;
35
35
  let consoleErrorMock;
@@ -43,7 +43,7 @@ describe('<FormField />', () => {
43
43
  consoleErrorMock.mockRestore();
44
44
  });
45
45
  it('should render', () => {
46
- render(_FormField || (_FormField = /*#__PURE__*/React.createElement(FormField, {
46
+ render(_FormField || (_FormField = _jsx(FormField, {
47
47
  label: "foo",
48
48
  id: "bar"
49
49
  })));
@@ -51,7 +51,7 @@ describe('<FormField />', () => {
51
51
  expect(formField).toBeInTheDocument();
52
52
  });
53
53
  it('passes props through to FormField', () => {
54
- render(_FormField2 || (_FormField2 = /*#__PURE__*/React.createElement(FormField, {
54
+ render(_FormField2 || (_FormField2 = _jsx(FormField, {
55
55
  label: "foo",
56
56
  id: "bar",
57
57
  "data-automation": "baz"
@@ -60,7 +60,7 @@ describe('<FormField />', () => {
60
60
  expect(formField).toHaveAttribute('data-automation', 'baz');
61
61
  });
62
62
  it('should meet a11y standards', async () => {
63
- const _render = render(_FormField3 || (_FormField3 = /*#__PURE__*/React.createElement(FormField, {
63
+ const _render = render(_FormField3 || (_FormField3 = _jsx(FormField, {
64
64
  label: "foo",
65
65
  id: "bar"
66
66
  }))),
@@ -70,12 +70,13 @@ describe('<FormField />', () => {
70
70
  });
71
71
  it('should focus the control with the supplied id', async () => {
72
72
  const user = userEvent.setup();
73
- render(_FormField4 || (_FormField4 = /*#__PURE__*/React.createElement(FormField, {
73
+ render(_FormField4 || (_FormField4 = _jsxs(FormField, {
74
74
  label: "labelText",
75
- id: "foo"
76
- }, /*#__PURE__*/React.createElement("input", null), /*#__PURE__*/React.createElement("input", {
77
- id: "foo"
78
- }), /*#__PURE__*/React.createElement("input", null))));
75
+ id: "foo",
76
+ children: [_jsx("input", {}), _jsx("input", {
77
+ id: "foo"
78
+ }), _jsx("input", {})]
79
+ })));
79
80
  const label = screen.getByText('labelText').closest('label');
80
81
  await user.click(label);
81
82
  const input = document.getElementById('foo');
@@ -22,10 +22,11 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import React, { Component } from 'react';
25
+ import { Component } from 'react';
26
26
  import { omitProps, pickProps } from '@instructure/ui-react-utils';
27
27
  import { FormFieldLayout } from '../FormFieldLayout';
28
28
  import { propTypes, allowedProps } from './props';
29
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
29
30
  /**
30
31
  ---
31
32
  category: components
@@ -44,7 +45,9 @@ class FormField extends Component {
44
45
  };
45
46
  }
46
47
  render() {
47
- return /*#__PURE__*/React.createElement(FormFieldLayout, Object.assign({}, omitProps(this.props, FormField.allowedProps), pickProps(this.props, FormFieldLayout.allowedProps), {
48
+ return _jsx(FormFieldLayout, {
49
+ ...omitProps(this.props, FormField.allowedProps),
50
+ ...pickProps(this.props, FormFieldLayout.allowedProps),
48
51
  label: this.props.label,
49
52
  vAlign: this.props.vAlign,
50
53
  as: "label"
@@ -55,7 +58,7 @@ class FormField extends Component {
55
58
  htmlFor: this.props.id,
56
59
  elementRef: this.handleRef,
57
60
  margin: this.props.margin
58
- }));
61
+ });
59
62
  }
60
63
  }
61
64
  FormField.displayName = "FormField";
@@ -23,12 +23,12 @@ var _FormFieldGroup, _label, _label2, _label3, _label4, _label5, _label6, _label
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { render, screen } from '@testing-library/react';
28
27
  import { vi } from 'vitest';
29
28
  import { runAxeCheck } from '@instructure/ui-axe-check';
30
29
  import '@testing-library/jest-dom';
31
30
  import { FormFieldGroup } from '../index';
31
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
32
32
  describe('<FormFieldGroup />', () => {
33
33
  let consoleWarningMock;
34
34
  let consoleErrorMock;
@@ -42,9 +42,16 @@ describe('<FormFieldGroup />', () => {
42
42
  consoleErrorMock.mockRestore();
43
43
  });
44
44
  it('should render', () => {
45
- const _render = render(_FormFieldGroup || (_FormFieldGroup = /*#__PURE__*/React.createElement(FormFieldGroup, {
46
- description: "Please enter your full name"
47
- }, /*#__PURE__*/React.createElement("label", null, "First: ", /*#__PURE__*/React.createElement("input", null)), /*#__PURE__*/React.createElement("label", null, "Middle: ", /*#__PURE__*/React.createElement("input", null)), /*#__PURE__*/React.createElement("label", null, "Last: ", /*#__PURE__*/React.createElement("input", null))))),
45
+ const _render = render(_FormFieldGroup || (_FormFieldGroup = _jsxs(FormFieldGroup, {
46
+ description: "Please enter your full name",
47
+ children: [_jsxs("label", {
48
+ children: ["First: ", _jsx("input", {})]
49
+ }), _jsxs("label", {
50
+ children: ["Middle: ", _jsx("input", {})]
51
+ }), _jsxs("label", {
52
+ children: ["Last: ", _jsx("input", {})]
53
+ })]
54
+ }))),
48
55
  container = _render.container;
49
56
  const formFieldGroup = container.querySelector("span[class$='-formFieldLayout__label']");
50
57
  const firstNameInput = screen.getByLabelText('First:');
@@ -57,12 +64,13 @@ describe('<FormFieldGroup />', () => {
57
64
  expect(lastNameInput).toBeInTheDocument();
58
65
  });
59
66
  it('can handle null children', () => {
60
- const children = [_label || (_label = /*#__PURE__*/React.createElement("label", {
61
- key: "first"
62
- }, "First: ", /*#__PURE__*/React.createElement("input", null))), null];
63
- const _render2 = render(/*#__PURE__*/React.createElement(FormFieldGroup, {
64
- description: "Please enter your full name"
65
- }, children)),
67
+ const children = [_label || (_label = _jsxs("label", {
68
+ children: ["First: ", _jsx("input", {})]
69
+ }, "first")), null];
70
+ const _render2 = render(_jsx(FormFieldGroup, {
71
+ description: "Please enter your full name",
72
+ children: children
73
+ })),
66
74
  container = _render2.container;
67
75
  const formFieldGroup = container.querySelector('label');
68
76
  expect(formFieldGroup).toBeInTheDocument();
@@ -72,10 +80,17 @@ describe('<FormFieldGroup />', () => {
72
80
  text: 'Invalid name',
73
81
  type: 'error'
74
82
  }];
75
- const _render3 = render(/*#__PURE__*/React.createElement(FormFieldGroup, {
83
+ const _render3 = render(_jsxs(FormFieldGroup, {
76
84
  description: "Please enter your full name",
77
- messages: messages
78
- }, _label2 || (_label2 = /*#__PURE__*/React.createElement("label", null, "First: ", /*#__PURE__*/React.createElement("input", null))), _label3 || (_label3 = /*#__PURE__*/React.createElement("label", null, "Middle: ", /*#__PURE__*/React.createElement("input", null))), _label4 || (_label4 = /*#__PURE__*/React.createElement("label", null, "Last: ", /*#__PURE__*/React.createElement("input", null))))),
85
+ messages: messages,
86
+ children: [_label2 || (_label2 = _jsxs("label", {
87
+ children: ["First: ", _jsx("input", {})]
88
+ })), _label3 || (_label3 = _jsxs("label", {
89
+ children: ["Middle: ", _jsx("input", {})]
90
+ })), _label4 || (_label4 = _jsxs("label", {
91
+ children: ["Last: ", _jsx("input", {})]
92
+ }))]
93
+ })),
79
94
  container = _render3.container;
80
95
  const formFieldGroup = container.querySelector("fieldset[class$='-formFieldLayout']");
81
96
  const message = container.querySelector("span[id^='FormFieldLayout_']");
@@ -88,18 +103,32 @@ describe('<FormFieldGroup />', () => {
88
103
  });
89
104
  it('displays description message inside the label', () => {
90
105
  const description = 'Please enter your full name';
91
- const _render4 = render(/*#__PURE__*/React.createElement(FormFieldGroup, {
92
- description: description
93
- }, _label5 || (_label5 = /*#__PURE__*/React.createElement("label", null, "First: ", /*#__PURE__*/React.createElement("input", null))), _label6 || (_label6 = /*#__PURE__*/React.createElement("label", null, "Middle: ", /*#__PURE__*/React.createElement("input", null))), _label7 || (_label7 = /*#__PURE__*/React.createElement("label", null, "Last: ", /*#__PURE__*/React.createElement("input", null))))),
106
+ const _render4 = render(_jsxs(FormFieldGroup, {
107
+ description: description,
108
+ children: [_label5 || (_label5 = _jsxs("label", {
109
+ children: ["First: ", _jsx("input", {})]
110
+ })), _label6 || (_label6 = _jsxs("label", {
111
+ children: ["Middle: ", _jsx("input", {})]
112
+ })), _label7 || (_label7 = _jsxs("label", {
113
+ children: ["Last: ", _jsx("input", {})]
114
+ }))]
115
+ })),
94
116
  container = _render4.container;
95
117
  const legend = container.querySelector("span[class$='-formFieldLayout__label']");
96
118
  expect(legend).toBeInTheDocument();
97
119
  expect(legend).toHaveTextContent(description);
98
120
  });
99
121
  it('should meet a11y standards', async () => {
100
- const _render5 = render(_FormFieldGroup2 || (_FormFieldGroup2 = /*#__PURE__*/React.createElement(FormFieldGroup, {
101
- description: "Please enter your full name"
102
- }, /*#__PURE__*/React.createElement("label", null, "First: ", /*#__PURE__*/React.createElement("input", null)), /*#__PURE__*/React.createElement("label", null, "Middle: ", /*#__PURE__*/React.createElement("input", null)), /*#__PURE__*/React.createElement("label", null, "Last: ", /*#__PURE__*/React.createElement("input", null))))),
122
+ const _render5 = render(_FormFieldGroup2 || (_FormFieldGroup2 = _jsxs(FormFieldGroup, {
123
+ description: "Please enter your full name",
124
+ children: [_jsxs("label", {
125
+ children: ["First: ", _jsx("input", {})]
126
+ }), _jsxs("label", {
127
+ children: ["Middle: ", _jsx("input", {})]
128
+ }), _jsxs("label", {
129
+ children: ["Last: ", _jsx("input", {})]
130
+ })]
131
+ }))),
103
132
  container = _render5.container;
104
133
  const axeCheck = await runAxeCheck(container);
105
134
  expect(axeCheck).toBe(true);
@@ -25,15 +25,15 @@ var _dec, _class, _FormFieldGroup;
25
25
  * SOFTWARE.
26
26
  */
27
27
 
28
- /** @jsx jsx */
29
28
  import { Component, Children } from 'react';
30
29
  import { Grid } from '@instructure/ui-grid';
31
30
  import { pickProps, omitProps } from '@instructure/ui-react-utils';
32
- import { withStyle, jsx } from '@instructure/emotion';
31
+ import { withStyle } from '@instructure/emotion';
33
32
  import { FormFieldLayout } from '../FormFieldLayout';
34
33
  import generateStyle from './styles';
35
34
  import generateComponentTheme from './theme';
36
35
  import { propTypes, allowedProps } from './props';
36
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
37
37
  /**
38
38
  ---
39
39
  category: components
@@ -75,26 +75,29 @@ let FormFieldGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _
75
75
  }
76
76
  renderColumns() {
77
77
  return Children.map(this.props.children, (child, index) => {
78
- return child ? jsx(Grid.Col, {
78
+ return child ? _jsx(Grid.Col, {
79
79
  width: child.props && child.props.width ? 'auto' : void 0,
80
- key: index
81
- }, child) : null;
80
+ children: child
81
+ }, index) : null;
82
82
  });
83
83
  }
84
84
  renderChildren() {
85
- return jsx(Grid, {
85
+ return _jsx(Grid, {
86
86
  colSpacing: this.props.colSpacing,
87
87
  rowSpacing: this.props.rowSpacing,
88
88
  vAlign: this.props.vAlign,
89
- startAt: this.props.startAt || (this.props.layout === 'columns' ? 'medium' : null)
90
- }, jsx(Grid.Row, null, this.renderColumns()));
89
+ startAt: this.props.startAt || (this.props.layout === 'columns' ? 'medium' : null),
90
+ children: _jsx(Grid.Row, {
91
+ children: this.renderColumns()
92
+ })
93
+ });
91
94
  }
92
95
  renderFields() {
93
96
  const styles = this.props.styles;
94
- return jsx("span", {
95
- key: "fields",
96
- css: styles === null || styles === void 0 ? void 0 : styles.formFieldGroup
97
- }, this.renderChildren());
97
+ return _jsx("span", {
98
+ css: styles === null || styles === void 0 ? void 0 : styles.formFieldGroup,
99
+ children: this.renderChildren()
100
+ }, "fields");
98
101
  }
99
102
  render() {
100
103
  const _this$props3 = this.props,
@@ -111,15 +114,18 @@ let FormFieldGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _
111
114
  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)) {
112
115
  ariaInvalid = 'true';
113
116
  }
114
- return jsx(FormFieldLayout, Object.assign({}, omitProps(props, FormFieldGroup.allowedProps), pickProps(props, FormFieldLayout.allowedProps), {
117
+ return _jsx(FormFieldLayout, {
118
+ ...omitProps(props, FormFieldGroup.allowedProps),
119
+ ...pickProps(props, FormFieldLayout.allowedProps),
115
120
  vAlign: props.vAlign,
116
121
  layout: props.layout === 'inline' ? 'inline' : 'stacked',
117
122
  label: props.description,
118
123
  "aria-disabled": props.disabled ? 'true' : void 0,
119
124
  "aria-invalid": ariaInvalid,
120
125
  elementRef: this.handleRef,
121
- isGroup: isGroup
122
- }), this.renderFields());
126
+ isGroup: isGroup,
127
+ children: this.renderFields()
128
+ });
123
129
  }
124
130
  }, _FormFieldGroup.displayName = "FormFieldGroup", _FormFieldGroup.componentId = 'FormFieldGroup', _FormFieldGroup.propTypes = propTypes, _FormFieldGroup.allowedProps = allowedProps, _FormFieldGroup.defaultProps = {
125
131
  as: 'fieldset',
@@ -23,12 +23,12 @@ var _FormFieldLabel, _FormFieldLabel2, _FormFieldLabel3;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { render } from '@testing-library/react';
28
27
  import { vi } from 'vitest';
29
28
  import { runAxeCheck } from '@instructure/ui-axe-check';
30
29
  import '@testing-library/jest-dom';
31
30
  import { FormFieldLabel } from '../index';
31
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
32
32
  describe('<FormFieldLabel />', () => {
33
33
  let consoleWarningMock;
34
34
  let consoleErrorMock;
@@ -42,23 +42,28 @@ describe('<FormFieldLabel />', () => {
42
42
  consoleErrorMock.mockRestore();
43
43
  });
44
44
  it('should render', () => {
45
- const _render = render(_FormFieldLabel || (_FormFieldLabel = /*#__PURE__*/React.createElement(FormFieldLabel, null, "Foo"))),
45
+ const _render = render(_FormFieldLabel || (_FormFieldLabel = _jsx(FormFieldLabel, {
46
+ children: "Foo"
47
+ }))),
46
48
  container = _render.container;
47
49
  const formFieldLabel = container.querySelector("span[class$='-formFieldLabel']");
48
50
  expect(formFieldLabel).toBeInTheDocument();
49
51
  expect(formFieldLabel).toHaveTextContent('Foo');
50
52
  });
51
53
  it('should render as specified via the `as` prop', () => {
52
- const _render2 = render(_FormFieldLabel2 || (_FormFieldLabel2 = /*#__PURE__*/React.createElement(FormFieldLabel, {
53
- as: "li"
54
- }, "Foo"))),
54
+ const _render2 = render(_FormFieldLabel2 || (_FormFieldLabel2 = _jsx(FormFieldLabel, {
55
+ as: "li",
56
+ children: "Foo"
57
+ }))),
55
58
  container = _render2.container;
56
59
  const formFieldLabel = container.querySelector('li');
57
60
  expect(formFieldLabel).toBeInTheDocument();
58
61
  expect(formFieldLabel).toHaveTextContent('Foo');
59
62
  });
60
63
  it('should meet a11y standards', async () => {
61
- const _render3 = render(_FormFieldLabel3 || (_FormFieldLabel3 = /*#__PURE__*/React.createElement(FormFieldLabel, null, "Foo"))),
64
+ const _render3 = render(_FormFieldLabel3 || (_FormFieldLabel3 = _jsx(FormFieldLabel, {
65
+ children: "Foo"
66
+ }))),
62
67
  container = _render3.container;
63
68
  const axeCheck = await runAxeCheck(container);
64
69
  expect(axeCheck).toBe(true);
@@ -23,13 +23,13 @@ var _dec, _dec2, _class, _FormFieldLabel;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- /** @jsx jsx */
27
26
  import { Component } from 'react';
28
27
  import { omitProps, getElementType, deprecated } from '@instructure/ui-react-utils';
29
- import { withStyle, jsx } from '@instructure/emotion';
28
+ import { withStyle } from '@instructure/emotion';
30
29
  import generateStyle from './styles';
31
30
  import generateComponentTheme from './theme';
32
31
  import { propTypes, allowedProps } from './props';
32
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
33
33
  /**
34
34
  ---
35
35
  parent: FormField
@@ -69,10 +69,12 @@ let FormFieldLabel = (_dec = withStyle(generateStyle, generateComponentTheme), _
69
69
  const _this$props3 = this.props,
70
70
  styles = _this$props3.styles,
71
71
  children = _this$props3.children;
72
- return jsx(ElementType, Object.assign({}, omitProps(this.props, FormFieldLabel.allowedProps), {
72
+ return _jsx(ElementType, {
73
+ ...omitProps(this.props, FormFieldLabel.allowedProps),
73
74
  css: styles === null || styles === void 0 ? void 0 : styles.formFieldLabel,
74
- ref: this.handleRef
75
- }), children);
75
+ ref: this.handleRef,
76
+ children: children
77
+ });
76
78
  }
77
79
  }, _FormFieldLabel.displayName = "FormFieldLabel", _FormFieldLabel.componentId = 'FormFieldLabel', _FormFieldLabel.propTypes = propTypes, _FormFieldLabel.allowedProps = allowedProps, _FormFieldLabel.defaultProps = {
78
80
  as: 'span'
@@ -23,12 +23,13 @@ var _FormFieldLayout, _FormFieldLayout2;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
26
+ import { createRef } from 'react';
27
27
  import { render } from '@testing-library/react';
28
28
  import { vi } from 'vitest';
29
29
  import { runAxeCheck } from '@instructure/ui-axe-check';
30
30
  import '@testing-library/jest-dom';
31
31
  import { FormFieldLayout } from '../index';
32
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
32
33
  describe('<FormFieldLayout />', () => {
33
34
  let consoleWarningMock;
34
35
  let consoleErrorMock;
@@ -42,7 +43,7 @@ describe('<FormFieldLayout />', () => {
42
43
  consoleErrorMock.mockRestore();
43
44
  });
44
45
  it('should render', () => {
45
- const _render = render(_FormFieldLayout || (_FormFieldLayout = /*#__PURE__*/React.createElement(FormFieldLayout, {
46
+ const _render = render(_FormFieldLayout || (_FormFieldLayout = _jsx(FormFieldLayout, {
46
47
  label: "Username"
47
48
  }))),
48
49
  container = _render.container;
@@ -53,7 +54,7 @@ describe('<FormFieldLayout />', () => {
53
54
  expect(formFieldLabel).toHaveTextContent('Username');
54
55
  });
55
56
  it('should meet a11y standards', async () => {
56
- const _render2 = render(_FormFieldLayout2 || (_FormFieldLayout2 = /*#__PURE__*/React.createElement(FormFieldLayout, {
57
+ const _render2 = render(_FormFieldLayout2 || (_FormFieldLayout2 = _jsx(FormFieldLayout, {
57
58
  label: "Username"
58
59
  }))),
59
60
  container = _render2.container;
@@ -62,14 +63,15 @@ describe('<FormFieldLayout />', () => {
62
63
  });
63
64
  it('should provide a ref to the input container', () => {
64
65
  const inputContainerRef = vi.fn();
65
- const ref = /*#__PURE__*/React.createRef();
66
- render(/*#__PURE__*/React.createElement(FormFieldLayout, {
66
+ const ref = /*#__PURE__*/createRef();
67
+ render(_jsx(FormFieldLayout, {
67
68
  label: "Username",
68
- inputContainerRef: inputContainerRef
69
- }, /*#__PURE__*/React.createElement("input", {
70
- type: "text",
71
- ref: ref
72
- })));
69
+ inputContainerRef: inputContainerRef,
70
+ children: _jsx("input", {
71
+ type: "text",
72
+ ref: ref
73
+ })
74
+ }));
73
75
  expect(ref.current).toBeInstanceOf(HTMLInputElement);
74
76
  expect(inputContainerRef).toHaveBeenCalledWith(ref.current.parentElement);
75
77
  });
@@ -25,11 +25,10 @@ var _dec, _dec2, _class, _FormFieldLayout;
25
25
  * SOFTWARE.
26
26
  */
27
27
 
28
- /** @jsx jsx */
29
28
  import { Component } from 'react';
30
29
  import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
31
30
  import { omitProps, getElementType, withDeterministicId } from '@instructure/ui-react-utils';
32
- import { withStyle, jsx } from '@instructure/emotion';
31
+ import { withStyle } from '@instructure/emotion';
33
32
  import { FormFieldMessages } from '../FormFieldMessages';
34
33
  import generateStyle from './styles';
35
34
  import { propTypes, allowedProps } from './props';
@@ -40,6 +39,7 @@ import generateComponentTheme from './theme';
40
39
  parent: FormField
41
40
  ---
42
41
  **/
42
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
43
43
  let FormFieldLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class = (_FormFieldLayout = class FormFieldLayout extends Component {
44
44
  constructor(props) {
45
45
  super(props);
@@ -91,7 +91,7 @@ let FormFieldLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateS
91
91
  if (typeof msg.text === 'string') {
92
92
  return msg.text.length > 0;
93
93
  }
94
- // this is more complicated (e.g. an array, a React component,...)
94
+ // this is more complicated (e.g. an array, a Component,...)
95
95
  // but we don't try to optimize here for these cases
96
96
  return true;
97
97
  }
@@ -108,37 +108,42 @@ let FormFieldLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateS
108
108
  var _this$props$styles;
109
109
  // `legend` has some special built in CSS, this can only be reset
110
110
  // this way https://stackoverflow.com/a/65866981/319473
111
- return jsx("legend", {
111
+ return _jsx("legend", {
112
112
  style: {
113
113
  display: 'contents'
114
- }
115
- }, jsx("span", {
116
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.formFieldLabel
117
- }, this.props.label));
114
+ },
115
+ children: _jsx("span", {
116
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.formFieldLabel,
117
+ children: this.props.label
118
+ })
119
+ });
118
120
  }
119
- return jsx("span", {
120
- css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.formFieldLabel
121
- }, this.props.label);
121
+ return _jsx("span", {
122
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.formFieldLabel,
123
+ children: this.props.label
124
+ });
122
125
  } else if (this.props.label) {
123
126
  if (this.elementType == 'fieldset') {
124
- return jsx("legend", {
127
+ return _jsx("legend", {
125
128
  id: this._labelId,
126
129
  style: {
127
130
  display: 'contents'
128
- }
129
- }, this.props.label);
131
+ },
132
+ children: this.props.label
133
+ });
130
134
  }
131
135
  // needs to be wrapped because it needs an `id`
132
- return jsx("div", {
136
+ return _jsx("div", {
133
137
  id: this._labelId,
134
138
  style: {
135
139
  display: 'contents'
136
- }
137
- }, this.props.label);
140
+ },
141
+ children: this.props.label
142
+ });
138
143
  } else return null;
139
144
  }
140
145
  renderVisibleMessages() {
141
- return this.hasMessages ? jsx(FormFieldMessages, {
146
+ return this.hasMessages ? _jsx(FormFieldMessages, {
142
147
  id: this._messagesId,
143
148
  messages: this.props.messages,
144
149
  gridArea: "messages"
@@ -156,18 +161,21 @@ let FormFieldLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateS
156
161
  const width = props.width,
157
162
  children = props.children;
158
163
  const hasNewErrorMsgAndIsGroup = !!(messages !== null && messages !== void 0 && messages.find(m => m.type === 'newError')) && isGroup;
159
- return jsx(ElementType, Object.assign({}, omitProps(props, [...FormFieldLayout.allowedProps]), {
164
+ return _jsxs(ElementType, {
165
+ ...omitProps(props, [...FormFieldLayout.allowedProps]),
160
166
  css: styles === null || styles === void 0 ? void 0 : styles.formFieldLayout,
161
167
  "aria-describedby": this.hasMessages ? this._messagesId : void 0,
162
168
  "aria-errormessage": this.props['aria-invalid'] ? this._messagesId : void 0,
163
169
  style: {
164
170
  width
165
171
  },
166
- ref: this.handleRef
167
- }), this.renderLabel(), hasNewErrorMsgAndIsGroup && this.renderVisibleMessages(), jsx("span", {
168
- css: styles === null || styles === void 0 ? void 0 : styles.formFieldChildren,
169
- ref: this.handleInputContainerRef
170
- }, children), !hasNewErrorMsgAndIsGroup && this.renderVisibleMessages());
172
+ ref: this.handleRef,
173
+ children: [this.renderLabel(), hasNewErrorMsgAndIsGroup && this.renderVisibleMessages(), _jsx("span", {
174
+ css: styles === null || styles === void 0 ? void 0 : styles.formFieldChildren,
175
+ ref: this.handleInputContainerRef,
176
+ children: children
177
+ }), !hasNewErrorMsgAndIsGroup && this.renderVisibleMessages()]
178
+ });
171
179
  }
172
180
  }, _FormFieldLayout.displayName = "FormFieldLayout", _FormFieldLayout.componentId = 'FormFieldLayout', _FormFieldLayout.propTypes = propTypes, _FormFieldLayout.allowedProps = allowedProps, _FormFieldLayout.defaultProps = {
173
181
  inline: false,
@@ -23,22 +23,28 @@ var _FormFieldMessage, _FormFieldMessage2, _FormFieldMessage3;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { render } from '@testing-library/react';
28
27
  import { runAxeCheck } from '@instructure/ui-axe-check';
29
28
  import { IconWarningLine } from '@instructure/ui-icons';
30
29
  import '@testing-library/jest-dom';
31
30
  import { FormFieldMessage } from '../index';
31
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
32
32
  describe('<FormFieldMessage />', () => {
33
33
  it('should render message', () => {
34
- const _render = render(_FormFieldMessage || (_FormFieldMessage = /*#__PURE__*/React.createElement(FormFieldMessage, null, "hello world"))),
34
+ const _render = render(_FormFieldMessage || (_FormFieldMessage = _jsx(FormFieldMessage, {
35
+ children: "hello world"
36
+ }))),
35
37
  container = _render.container;
36
38
  const formFieldMessage = container.querySelector("span[class$='-formFieldMessage']");
37
39
  expect(formFieldMessage).toBeInTheDocument();
38
40
  expect(formFieldMessage).toHaveTextContent('hello world');
39
41
  });
40
42
  it('should render message if Node is passed', () => {
41
- const _render2 = render(_FormFieldMessage2 || (_FormFieldMessage2 = /*#__PURE__*/React.createElement(FormFieldMessage, null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(IconWarningLine, null), " Invalid name")))),
43
+ const _render2 = render(_FormFieldMessage2 || (_FormFieldMessage2 = _jsx(FormFieldMessage, {
44
+ children: _jsxs("span", {
45
+ children: [_jsx(IconWarningLine, {}), " Invalid name"]
46
+ })
47
+ }))),
42
48
  container = _render2.container;
43
49
  const formFieldMessage = container.querySelector("span[class$='-formFieldMessage']");
44
50
  const iconSvg = container.querySelector('svg[name="IconWarning"]');
@@ -47,7 +53,7 @@ describe('<FormFieldMessage />', () => {
47
53
  expect(formFieldMessage).toHaveTextContent('Invalid name');
48
54
  });
49
55
  it('should meet a11y standards', async () => {
50
- const _render3 = render(_FormFieldMessage3 || (_FormFieldMessage3 = /*#__PURE__*/React.createElement(FormFieldMessage, null))),
56
+ const _render3 = render(_FormFieldMessage3 || (_FormFieldMessage3 = _jsx(FormFieldMessage, {}))),
51
57
  container = _render3.container;
52
58
  const axeCheck = await runAxeCheck(container);
53
59
  expect(axeCheck).toBe(true);
@@ -23,14 +23,14 @@ var _dec, _class, _FormFieldMessage, _IconWarningSolid;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- /** @jsx jsx */
27
26
  import { Component } from 'react';
28
27
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
29
28
  import { IconWarningSolid } from '@instructure/ui-icons';
30
- import { withStyle, jsx } from '@instructure/emotion';
29
+ import { withStyle } from '@instructure/emotion';
31
30
  import generateStyle from './styles';
32
31
  import generateComponentTheme from './theme';
33
32
  import { propTypes, allowedProps } from './props';
33
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
34
34
  /**
35
35
  ---
36
36
  parent: FormField
@@ -66,20 +66,24 @@ let FormFieldMessage = (_dec = withStyle(generateStyle, generateComponentTheme),
66
66
  const _this$props3 = this.props,
67
67
  children = _this$props3.children,
68
68
  styles = _this$props3.styles;
69
- return this.props.variant !== 'screenreader-only' ? jsx("span", {
69
+ return this.props.variant !== 'screenreader-only' ? _jsxs("span", {
70
70
  css: {
71
71
  display: 'flex'
72
- }
73
- }, this.props.variant === 'newError' && this.props.children && jsx("span", {
74
- css: styles === null || styles === void 0 ? void 0 : styles.errorIcon
75
- }, _IconWarningSolid || (_IconWarningSolid = jsx(IconWarningSolid, {
76
- color: "error"
77
- }))), jsx("span", {
78
- css: styles === null || styles === void 0 ? void 0 : styles.formFieldMessage,
79
- ref: this.handleRef
80
- }, children)) : jsx(ScreenReaderContent, {
81
- elementRef: this.handleRef
82
- }, children);
72
+ },
73
+ children: [this.props.variant === 'newError' && this.props.children && _jsx("span", {
74
+ css: styles === null || styles === void 0 ? void 0 : styles.errorIcon,
75
+ children: _IconWarningSolid || (_IconWarningSolid = _jsx(IconWarningSolid, {
76
+ color: "error"
77
+ }))
78
+ }), _jsx("span", {
79
+ css: styles === null || styles === void 0 ? void 0 : styles.formFieldMessage,
80
+ ref: this.handleRef,
81
+ children: children
82
+ })]
83
+ }) : _jsx(ScreenReaderContent, {
84
+ elementRef: this.handleRef,
85
+ children: children
86
+ });
83
87
  }
84
88
  }, _FormFieldMessage.displayName = "FormFieldMessage", _FormFieldMessage.componentId = 'FormFieldMessage', _FormFieldMessage.propTypes = propTypes, _FormFieldMessage.allowedProps = allowedProps, _FormFieldMessage.defaultProps = {
85
89
  variant: 'hint'