@instructure/ui-form-field 7.10.0 → 7.14.0

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 CHANGED
@@ -3,6 +3,24 @@
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
+ # [7.14.0](https://github.com/instructure/instructure-ui/compare/v7.13.0...v7.14.0) (2021-12-01)
7
+
8
+ ### Features
9
+
10
+ - **ui-form-field:** make FormField messages accept `node` text, not just `string` ([d9e1a7a](https://github.com/instructure/instructure-ui/commit/d9e1a7a)), closes [PR#819](https://github.com/PR/issues/819)
11
+
12
+ # [7.13.0](https://github.com/instructure/instructure-ui/compare/v7.12.0...v7.13.0) (2021-11-18)
13
+
14
+ **Note:** Version bump only for package @instructure/ui-form-field
15
+
16
+ # [7.12.0](https://github.com/instructure/instructure-ui/compare/v7.11.0...v7.12.0) (2021-10-15)
17
+
18
+ **Note:** Version bump only for package @instructure/ui-form-field
19
+
20
+ # [7.11.0](https://github.com/instructure/instructure-ui/compare/v7.10.0...v7.11.0) (2021-09-17)
21
+
22
+ **Note:** Version bump only for package @instructure/ui-form-field
23
+
6
24
  # [7.10.0](https://github.com/instructure/instructure-ui/compare/v7.9.0...v7.10.0) (2021-08-27)
7
25
 
8
26
  **Note:** Version bump only for package @instructure/ui-form-field
@@ -73,7 +73,7 @@ FormField.propTypes = {
73
73
 
74
74
  /**
75
75
  * object with shape: `{
76
- * text: PropTypes.string,
76
+ * text: PropTypes.node,
77
77
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
78
78
  * }`
79
79
  */
@@ -126,7 +126,7 @@ var FormFieldGroup = (_dec = themeable(theme, styles), _dec(_class = (_temp = _c
126
126
 
127
127
  /**
128
128
  * object with shape: `{
129
- * text: PropTypes.string,
129
+ * text: PropTypes.node,
130
130
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
131
131
  * }`
132
132
  */
@@ -195,7 +195,7 @@ var FormFieldLayout = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
195
195
 
196
196
  /**
197
197
  * object with shape: `{
198
- * text: PropTypes.string,
198
+ * text: PropTypes.node,
199
199
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
200
200
  * }`
201
201
  */
@@ -30,10 +30,10 @@ var _dec, _class, _class2, _temp;
30
30
  * SOFTWARE.
31
31
  */
32
32
  import React, { Component } from 'react';
33
- import PropTypes from 'prop-types';
34
33
  import classnames from 'classnames';
35
34
  import { themeable } from '@instructure/ui-themeable';
36
35
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
36
+ import { formMessageChildPropType, formMessageTypePropType } from "../FormPropTypes.js";
37
37
  var styles = {
38
38
  componentId: 'bVlfD',
39
39
  template: function template(theme) {
@@ -87,8 +87,8 @@ var FormFieldMessage = (_dec = themeable(theme, styles), _dec(_class = (_temp =
87
87
  FormFieldMessage.displayName = "FormFieldMessage";
88
88
  return FormFieldMessage;
89
89
  }(Component), _class2.propTypes = {
90
- variant: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only']),
91
- children: PropTypes.node
90
+ variant: formMessageTypePropType,
91
+ children: formMessageChildPropType
92
92
  }, _class2.defaultProps = {
93
93
  variant: 'hint',
94
94
  children: null
@@ -95,7 +95,7 @@ var FormFieldMessages = (_dec = themeable(theme, styles), _dec(_class = (_temp =
95
95
  }(Component), _class2.propTypes = {
96
96
  /**
97
97
  * object with shape: `{
98
- * text: PropTypes.string,
98
+ * text: PropTypes.node,
99
99
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
100
100
  * }`
101
101
  */
@@ -22,6 +22,8 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
  import PropTypes from 'prop-types';
25
+ var formMessageChildPropType = PropTypes.node;
26
+ var formMessageTypePropType = PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only']);
25
27
  /**
26
28
  * ---
27
29
  * category: utilities/form
@@ -32,9 +34,9 @@ import PropTypes from 'prop-types';
32
34
 
33
35
  var FormPropTypes = {
34
36
  message: PropTypes.shape({
35
- text: PropTypes.string,
36
- type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
37
+ text: formMessageChildPropType,
38
+ type: formMessageTypePropType
37
39
  })
38
40
  };
39
41
  export default FormPropTypes;
40
- export { FormPropTypes };
42
+ export { FormPropTypes, formMessageTypePropType, formMessageChildPropType };
@@ -93,7 +93,7 @@ FormField.propTypes = {
93
93
 
94
94
  /**
95
95
  * object with shape: `{
96
- * text: PropTypes.string,
96
+ * text: PropTypes.node,
97
97
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
98
98
  * }`
99
99
  */
@@ -127,7 +127,7 @@ var FormFieldGroup = (_dec = (0, _themeable.themeable)(_theme.default, styles),
127
127
 
128
128
  /**
129
129
  * object with shape: `{
130
- * text: PropTypes.string,
130
+ * text: PropTypes.node,
131
131
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
132
132
  * }`
133
133
  */
@@ -201,7 +201,7 @@ var FormFieldLayout = (_dec = (0, _themeable.themeable)(_theme.default, styles),
201
201
 
202
202
  /**
203
203
  * object with shape: `{
204
- * text: PropTypes.string,
204
+ * text: PropTypes.node,
205
205
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
206
206
  * }`
207
207
  */
@@ -21,14 +21,14 @@ var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
21
21
 
22
22
  var _react = _interopRequireWildcard(require("react"));
23
23
 
24
- var _propTypes = _interopRequireDefault(require("prop-types"));
25
-
26
24
  var _classnames = _interopRequireDefault(require("classnames"));
27
25
 
28
26
  var _themeable = require("@instructure/ui-themeable/lib/themeable.js");
29
27
 
30
28
  var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
31
29
 
30
+ var _FormPropTypes = require("../FormPropTypes.js");
31
+
32
32
  var _theme = _interopRequireDefault(require("./theme.js"));
33
33
 
34
34
  var _dec, _class, _class2, _temp;
@@ -83,8 +83,8 @@ var FormFieldMessage = (_dec = (0, _themeable.themeable)(_theme.default, styles)
83
83
  FormFieldMessage.displayName = "FormFieldMessage";
84
84
  return FormFieldMessage;
85
85
  }(_react.Component), _class2.propTypes = {
86
- variant: _propTypes.default.oneOf(['error', 'hint', 'success', 'screenreader-only']),
87
- children: _propTypes.default.node
86
+ variant: _FormPropTypes.formMessageTypePropType,
87
+ children: _FormPropTypes.formMessageChildPropType
88
88
  }, _class2.defaultProps = {
89
89
  variant: 'hint',
90
90
  children: null
@@ -91,7 +91,7 @@ var FormFieldMessages = (_dec = (0, _themeable.themeable)(_theme.default, styles
91
91
  }(_react.Component), _class2.propTypes = {
92
92
  /**
93
93
  * object with shape: `{
94
- * text: PropTypes.string,
94
+ * text: PropTypes.node,
95
95
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
96
96
  * }`
97
97
  */
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.FormPropTypes = exports.default = void 0;
8
+ exports.formMessageChildPropType = exports.formMessageTypePropType = exports.FormPropTypes = exports.default = void 0;
9
9
 
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
@@ -32,7 +32,10 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
32
32
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
33
  * SOFTWARE.
34
34
  */
35
+ var formMessageChildPropType = _propTypes.default.node;
36
+ exports.formMessageChildPropType = formMessageChildPropType;
35
37
 
38
+ var formMessageTypePropType = _propTypes.default.oneOf(['error', 'hint', 'success', 'screenreader-only']);
36
39
  /**
37
40
  * ---
38
41
  * category: utilities/form
@@ -40,10 +43,13 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
40
43
  * Custom prop types for React components.
41
44
  * @module FormPropTypes
42
45
  */
46
+
47
+
48
+ exports.formMessageTypePropType = formMessageTypePropType;
43
49
  var FormPropTypes = {
44
50
  message: _propTypes.default.shape({
45
- text: _propTypes.default.string,
46
- type: _propTypes.default.oneOf(['error', 'hint', 'success', 'screenreader-only'])
51
+ text: formMessageChildPropType,
52
+ type: formMessageTypePropType
47
53
  })
48
54
  };
49
55
  exports.FormPropTypes = FormPropTypes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-form-field",
3
- "version": "7.10.0",
3
+ "version": "7.14.0",
4
4
  "description": "Form layout components.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -23,20 +23,20 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "^7.10.0",
27
- "@instructure/ui-test-utils": "^7.10.0"
26
+ "@instructure/ui-babel-preset": "^7.14.0",
27
+ "@instructure/ui-test-utils": "^7.14.0"
28
28
  },
29
29
  "dependencies": {
30
30
  "@babel/runtime": "^7.9.2",
31
- "@instructure/console": "^7.10.0",
32
- "@instructure/ui-a11y-content": "^7.10.0",
33
- "@instructure/ui-a11y-utils": "^7.10.0",
34
- "@instructure/ui-grid": "^7.10.0",
35
- "@instructure/ui-icons": "^7.10.0",
36
- "@instructure/ui-react-utils": "^7.10.0",
37
- "@instructure/ui-themeable": "^7.10.0",
38
- "@instructure/ui-utils": "^7.10.0",
39
- "@instructure/uid": "^7.10.0",
31
+ "@instructure/console": "^7.14.0",
32
+ "@instructure/ui-a11y-content": "^7.14.0",
33
+ "@instructure/ui-a11y-utils": "^7.14.0",
34
+ "@instructure/ui-grid": "^7.14.0",
35
+ "@instructure/ui-icons": "^7.14.0",
36
+ "@instructure/ui-react-utils": "^7.14.0",
37
+ "@instructure/ui-themeable": "^7.14.0",
38
+ "@instructure/ui-utils": "^7.14.0",
39
+ "@instructure/uid": "^7.14.0",
40
40
  "classnames": "^2",
41
41
  "prop-types": "^15"
42
42
  },
@@ -44,7 +44,7 @@ class FormField extends Component {
44
44
  id: PropTypes.string.isRequired,
45
45
  /**
46
46
  * object with shape: `{
47
- * text: PropTypes.string,
47
+ * text: PropTypes.node,
48
48
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
49
49
  * }`
50
50
  */
@@ -51,7 +51,7 @@ class FormFieldGroup extends Component {
51
51
  as: PropTypes.elementType,
52
52
  /**
53
53
  * object with shape: `{
54
- * text: PropTypes.string,
54
+ * text: PropTypes.node,
55
55
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
56
56
  * }`
57
57
  */
@@ -64,7 +64,7 @@ class FormFieldLayout extends Component {
64
64
  as: PropTypes.elementType,
65
65
  /**
66
66
  * object with shape: `{
67
- * text: PropTypes.string,
67
+ * text: PropTypes.node,
68
68
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
69
69
  * }`
70
70
  */
@@ -23,12 +23,16 @@
23
23
  */
24
24
 
25
25
  import React, { Component } from 'react'
26
- import PropTypes from 'prop-types'
27
26
  import classnames from 'classnames'
28
27
 
29
28
  import { themeable } from '@instructure/ui-themeable'
30
29
  import { ScreenReaderContent } from '@instructure/ui-a11y-content'
31
30
 
31
+ import {
32
+ formMessageChildPropType,
33
+ formMessageTypePropType
34
+ } from '../FormPropTypes'
35
+
32
36
  import styles from './styles.css'
33
37
  import theme from './theme'
34
38
 
@@ -50,8 +54,8 @@ example: true
50
54
  @themeable(theme, styles)
51
55
  class FormFieldMessage extends Component {
52
56
  static propTypes = {
53
- variant: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only']),
54
- children: PropTypes.node
57
+ variant: formMessageTypePropType,
58
+ children: formMessageChildPropType
55
59
  }
56
60
 
57
61
  static defaultProps = {
@@ -57,7 +57,7 @@ class FormFieldMessages extends Component {
57
57
  static propTypes = {
58
58
  /**
59
59
  * object with shape: `{
60
- * text: PropTypes.string,
60
+ * text: PropTypes.node,
61
61
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
62
62
  * }`
63
63
  */
@@ -24,6 +24,14 @@
24
24
 
25
25
  import PropTypes from 'prop-types'
26
26
 
27
+ const formMessageChildPropType = PropTypes.node
28
+ const formMessageTypePropType = PropTypes.oneOf([
29
+ 'error',
30
+ 'hint',
31
+ 'success',
32
+ 'screenreader-only'
33
+ ])
34
+
27
35
  /**
28
36
  * ---
29
37
  * category: utilities/form
@@ -33,10 +41,10 @@ import PropTypes from 'prop-types'
33
41
  */
34
42
  const FormPropTypes = {
35
43
  message: PropTypes.shape({
36
- text: PropTypes.string,
37
- type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
44
+ text: formMessageChildPropType,
45
+ type: formMessageTypePropType
38
46
  })
39
47
  }
40
48
 
41
49
  export default FormPropTypes
42
- export { FormPropTypes }
50
+ export { FormPropTypes, formMessageTypePropType, formMessageChildPropType }
package/types/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export interface FormFieldProps {
14
14
  id: string;
15
15
  /**
16
16
  * object with shape: `{
17
- * text: PropTypes.string,
17
+ * text: PropTypes.node,
18
18
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
19
19
  * }`
20
20
  */
@@ -55,7 +55,7 @@ export interface FormFieldGroupProps {
55
55
  as?: any;
56
56
  /**
57
57
  * object with shape: `{
58
- * text: PropTypes.string,
58
+ * text: PropTypes.node,
59
59
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
60
60
  * }`
61
61
  */
@@ -110,7 +110,7 @@ export interface FormFieldLayoutProps {
110
110
  as?: any;
111
111
  /**
112
112
  * object with shape: `{
113
- * text: PropTypes.string,
113
+ * text: PropTypes.node,
114
114
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
115
115
  * }`
116
116
  */
@@ -135,11 +135,9 @@ export class FormFieldLayout extends React.Component<FormFieldLayoutProps, any>
135
135
 
136
136
 
137
137
 
138
- export type FormFieldMessageVariant = "error" | "hint" | "success" | "screenreader-only";
139
-
140
138
  export interface FormFieldMessageProps {
141
- variant?: FormFieldMessageVariant;
142
- children?: React.ReactNode;
139
+ variant?: any;
140
+ children?: any;
143
141
  }
144
142
 
145
143
  export class FormFieldMessage extends React.Component<FormFieldMessageProps, any> {
@@ -153,7 +151,7 @@ export class FormFieldMessage extends React.Component<FormFieldMessageProps, any
153
151
  export interface FormFieldMessagesProps {
154
152
  /**
155
153
  * object with shape: `{
156
- * text: PropTypes.string,
154
+ * text: PropTypes.node,
157
155
  * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
158
156
  * }`
159
157
  */