@instructure/ui-form-field 8.17.0 → 8.17.1-snapshot.17

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/LICENSE.md ADDED
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: The MIT License (MIT)
3
+ category: Getting Started
4
+ order: 9
5
+ ---
6
+
7
+ # The MIT License (MIT)
8
+
9
+ Copyright (c) 2015 Instructure, Inc.
10
+
11
+ **Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions.**
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
@@ -76,7 +76,7 @@ let FormFieldLabel = (_dec = withStyle(generateStyle, generateComponentTheme), _
76
76
  const _this$props3 = this.props,
77
77
  styles = _this$props3.styles,
78
78
  children = _this$props3.children;
79
- return jsx(ElementType // @ts-expect-error TODO: `ref` prop causes: "Expression produces a union type that is too complex to represent.ts(2590)"
79
+ return jsx(ElementType //@ts-expect-error too complex union type
80
80
  , Object.assign({}, omitProps(this.props, FormFieldLabel.allowedProps), {
81
81
  css: styles === null || styles === void 0 ? void 0 : styles.formFieldLabel,
82
82
  ref: this.handleRef
@@ -1,7 +1,7 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["makeStyles", "styles"];
3
3
 
4
- var _dec, _class, _class2, _temp;
4
+ var _dec, _dec2, _class, _class2, _temp;
5
5
 
6
6
  /*
7
7
  * The MIT License (MIT)
@@ -33,8 +33,7 @@ import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
33
33
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
34
34
  import { Grid } from '@instructure/ui-grid';
35
35
  import { logError as error } from '@instructure/console';
36
- import { omitProps, pickProps, getElementType } from '@instructure/ui-react-utils';
37
- import { uid } from '@instructure/uid';
36
+ import { omitProps, pickProps, getElementType, withDeterministicId } from '@instructure/ui-react-utils';
38
37
  import { withStyle, jsx } from '@instructure/emotion';
39
38
  import { FormFieldLabel } from '../FormFieldLabel';
40
39
  import { FormFieldMessages } from '../FormFieldMessages';
@@ -47,7 +46,7 @@ parent: FormField
47
46
  ---
48
47
  @tsProps
49
48
  **/
50
- let FormFieldLayout = (_dec = withStyle(generateStyle, null), _dec(_class = (_temp = _class2 = class FormFieldLayout extends Component {
49
+ let FormFieldLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, null), _dec(_class = _dec2(_class = (_temp = _class2 = class FormFieldLayout extends Component {
51
50
  constructor(props) {
52
51
  super(props);
53
52
  this._messagesId = void 0;
@@ -68,7 +67,7 @@ let FormFieldLayout = (_dec = withStyle(generateStyle, null), _dec(_class = (_te
68
67
  }
69
68
  };
70
69
 
71
- this._messagesId = props.messagesId || uid('FormFieldLayout-messages');
70
+ this._messagesId = props.messagesId || props.deterministicId();
72
71
  error(typeof props.width !== 'undefined' || !props.inline || props.layout !== 'inline', `[FormFieldLayout] The 'inline' prop is true, and the 'layout' is set to 'inline'.
73
72
  This will cause a layout issue in Internet Explorer 11 unless you also add a value for the 'width' prop.`);
74
73
  }
@@ -139,6 +138,7 @@ let FormFieldLayout = (_dec = withStyle(generateStyle, null), _dec(_class = (_te
139
138
  }
140
139
 
141
140
  render() {
141
+ // any cast is needed to prevent Expression produces a union type that is too complex to represent errors
142
142
  const ElementType = this.elementType;
143
143
 
144
144
  const _this$props3 = this.props,
@@ -171,6 +171,6 @@ let FormFieldLayout = (_dec = withStyle(generateStyle, null), _dec(_class = (_te
171
171
  layout: 'stacked',
172
172
  as: 'label',
173
173
  labelAlign: 'end'
174
- }, _temp)) || _class);
174
+ }, _temp)) || _class) || _class);
175
175
  export default FormFieldLayout;
176
176
  export { FormFieldLayout };
@@ -67,7 +67,7 @@ let FormFieldLabel = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
67
67
  const _this$props3 = this.props,
68
68
  styles = _this$props3.styles,
69
69
  children = _this$props3.children;
70
- return (0, _emotion.jsx)(ElementType // @ts-expect-error TODO: `ref` prop causes: "Expression produces a union type that is too complex to represent.ts(2590)"
70
+ return (0, _emotion.jsx)(ElementType //@ts-expect-error too complex union type
71
71
  , Object.assign({}, (0, _omitProps.omitProps)(this.props, FormFieldLabel.allowedProps), {
72
72
  css: styles === null || styles === void 0 ? void 0 : styles.formFieldLabel,
73
73
  ref: this.handleRef
@@ -25,7 +25,7 @@ var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
25
25
 
26
26
  var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
27
27
 
28
- var _uid = require("@instructure/uid");
28
+ var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
29
29
 
30
30
  var _emotion = require("@instructure/emotion");
31
31
 
@@ -39,7 +39,7 @@ var _props = require("./props");
39
39
 
40
40
  const _excluded = ["makeStyles", "styles"];
41
41
 
42
- var _dec, _class, _class2, _temp;
42
+ var _dec, _dec2, _class, _class2, _temp;
43
43
 
44
44
  /**
45
45
  ---
@@ -47,7 +47,7 @@ parent: FormField
47
47
  ---
48
48
  @tsProps
49
49
  **/
50
- let FormFieldLayout = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_class = (_temp = _class2 = class FormFieldLayout extends _react.Component {
50
+ let FormFieldLayout = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, null), _dec(_class = _dec2(_class = (_temp = _class2 = class FormFieldLayout extends _react.Component {
51
51
  constructor(props) {
52
52
  super(props);
53
53
  this._messagesId = void 0;
@@ -68,7 +68,7 @@ let FormFieldLayout = (_dec = (0, _emotion.withStyle)(_styles.default, null), _d
68
68
  }
69
69
  };
70
70
 
71
- this._messagesId = props.messagesId || (0, _uid.uid)('FormFieldLayout-messages');
71
+ this._messagesId = props.messagesId || props.deterministicId();
72
72
  (0, _console.logError)(typeof props.width !== 'undefined' || !props.inline || props.layout !== 'inline', `[FormFieldLayout] The 'inline' prop is true, and the 'layout' is set to 'inline'.
73
73
  This will cause a layout issue in Internet Explorer 11 unless you also add a value for the 'width' prop.`);
74
74
  }
@@ -139,6 +139,7 @@ let FormFieldLayout = (_dec = (0, _emotion.withStyle)(_styles.default, null), _d
139
139
  }
140
140
 
141
141
  render() {
142
+ // any cast is needed to prevent Expression produces a union type that is too complex to represent errors
142
143
  const ElementType = this.elementType;
143
144
  const _this$props3 = this.props,
144
145
  makeStyles = _this$props3.makeStyles,
@@ -169,7 +170,7 @@ let FormFieldLayout = (_dec = (0, _emotion.withStyle)(_styles.default, null), _d
169
170
  layout: 'stacked',
170
171
  as: 'label',
171
172
  labelAlign: 'end'
172
- }, _temp)) || _class);
173
+ }, _temp)) || _class) || _class);
173
174
  exports.FormFieldLayout = FormFieldLayout;
174
175
  var _default = FormFieldLayout;
175
176
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-form-field",
3
- "version": "8.17.0",
3
+ "version": "8.17.1-snapshot.17+8e38d5a2e",
4
4
  "description": "Form layout components.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,22 +23,22 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "8.17.0",
27
- "@instructure/ui-test-utils": "8.17.0",
28
- "@instructure/ui-themes": "8.17.0"
26
+ "@instructure/ui-babel-preset": "8.17.1-snapshot.17+8e38d5a2e",
27
+ "@instructure/ui-test-utils": "8.17.1-snapshot.17+8e38d5a2e",
28
+ "@instructure/ui-themes": "8.17.1-snapshot.17+8e38d5a2e"
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.13.10",
32
- "@instructure/console": "8.17.0",
33
- "@instructure/emotion": "8.17.0",
34
- "@instructure/shared-types": "8.17.0",
35
- "@instructure/ui-a11y-content": "8.17.0",
36
- "@instructure/ui-a11y-utils": "8.17.0",
37
- "@instructure/ui-grid": "8.17.0",
38
- "@instructure/ui-icons": "8.17.0",
39
- "@instructure/ui-react-utils": "8.17.0",
40
- "@instructure/ui-utils": "8.17.0",
41
- "@instructure/uid": "8.17.0",
32
+ "@instructure/console": "8.17.1-snapshot.17+8e38d5a2e",
33
+ "@instructure/emotion": "8.17.1-snapshot.17+8e38d5a2e",
34
+ "@instructure/shared-types": "8.17.1-snapshot.17+8e38d5a2e",
35
+ "@instructure/ui-a11y-content": "8.17.1-snapshot.17+8e38d5a2e",
36
+ "@instructure/ui-a11y-utils": "8.17.1-snapshot.17+8e38d5a2e",
37
+ "@instructure/ui-grid": "8.17.1-snapshot.17+8e38d5a2e",
38
+ "@instructure/ui-icons": "8.17.1-snapshot.17+8e38d5a2e",
39
+ "@instructure/ui-react-utils": "8.17.1-snapshot.17+8e38d5a2e",
40
+ "@instructure/ui-utils": "8.17.1-snapshot.17+8e38d5a2e",
41
+ "@instructure/uid": "8.17.1-snapshot.17+8e38d5a2e",
42
42
  "prop-types": "^15"
43
43
  },
44
44
  "peerDependencies": {
@@ -46,5 +46,6 @@
46
46
  },
47
47
  "publishConfig": {
48
48
  "access": "public"
49
- }
49
+ },
50
+ "gitHead": "8e38d5a2e11e842eafa2fa270e47a261c6ebb626"
50
51
  }
@@ -82,7 +82,7 @@ class FormFieldLabel extends Component<FormFieldLabelProps> {
82
82
 
83
83
  return (
84
84
  <ElementType
85
- // @ts-expect-error TODO: `ref` prop causes: "Expression produces a union type that is too complex to represent.ts(2590)"
85
+ //@ts-expect-error too complex union type
86
86
  {...omitProps(this.props, FormFieldLabel.allowedProps)}
87
87
  css={styles?.formFieldLabel}
88
88
  ref={this.handleRef}
@@ -32,9 +32,9 @@ import { logError as error } from '@instructure/console'
32
32
  import {
33
33
  omitProps,
34
34
  pickProps,
35
- getElementType
35
+ getElementType,
36
+ withDeterministicId
36
37
  } from '@instructure/ui-react-utils'
37
- import { uid } from '@instructure/uid'
38
38
 
39
39
  import { withStyle, jsx } from '@instructure/emotion'
40
40
 
@@ -52,6 +52,7 @@ parent: FormField
52
52
  ---
53
53
  @tsProps
54
54
  **/
55
+ @withDeterministicId()
55
56
  @withStyle(generateStyle, null)
56
57
  class FormFieldLayout extends Component<FormFieldLayoutProps> {
57
58
  static readonly componentId = 'FormFieldLayout'
@@ -68,7 +69,7 @@ class FormFieldLayout extends Component<FormFieldLayoutProps> {
68
69
  constructor(props: FormFieldLayoutProps) {
69
70
  super(props)
70
71
 
71
- this._messagesId = props.messagesId || uid('FormFieldLayout-messages')
72
+ this._messagesId = props.messagesId || props.deterministicId!()
72
73
 
73
74
  error(
74
75
  typeof props.width !== 'undefined' ||
@@ -176,7 +177,8 @@ class FormFieldLayout extends Component<FormFieldLayoutProps> {
176
177
  }
177
178
 
178
179
  render() {
179
- const ElementType = this.elementType
180
+ // any cast is needed to prevent Expression produces a union type that is too complex to represent errors
181
+ const ElementType = this.elementType as any
180
182
 
181
183
  const { makeStyles, styles, ...props } = this.props
182
184
 
@@ -33,6 +33,7 @@ import type {
33
33
  } from '@instructure/shared-types'
34
34
  import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
35
35
  import type { FormMessage } from '../FormPropTypes'
36
+ import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
36
37
 
37
38
  type FormFieldLayoutOwnProps = {
38
39
  label: React.ReactNode
@@ -74,7 +75,7 @@ type AllowedPropKeys = Readonly<Array<PropKeys>>
74
75
 
75
76
  type FormFieldLayoutProps = FormFieldLayoutOwnProps &
76
77
  WithStyleProps<null, FormFieldLayoutStyle> &
77
- OtherHTMLAttributes<FormFieldLayoutOwnProps>
78
+ OtherHTMLAttributes<FormFieldLayoutOwnProps> & WithDeterministicIdProps
78
79
 
79
80
  type FormFieldLayoutStyle = ComponentStyle<'formFieldLayout'>
80
81