@instructure/ui-form-field 8.13.1-snapshot.9 → 8.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/es/FormField/index.js +3 -2
  3. package/es/FormField/props.js +0 -15
  4. package/es/FormFieldGroup/index.js +14 -10
  5. package/es/FormFieldGroup/props.js +0 -19
  6. package/es/FormFieldLabel/index.js +13 -7
  7. package/es/FormFieldLabel/props.js +2 -2
  8. package/es/FormFieldLayout/index.js +15 -10
  9. package/es/FormFieldLayout/props.js +5 -24
  10. package/es/FormFieldLayout/styles.js +1 -1
  11. package/es/FormFieldMessage/index.js +12 -8
  12. package/es/FormFieldMessages/index.js +11 -6
  13. package/es/FormFieldMessages/props.js +0 -6
  14. package/lib/FormField/index.js +3 -2
  15. package/lib/FormField/props.js +0 -15
  16. package/lib/FormFieldGroup/index.js +14 -10
  17. package/lib/FormFieldGroup/props.js +0 -19
  18. package/lib/FormFieldLabel/index.js +13 -7
  19. package/lib/FormFieldLabel/props.js +2 -2
  20. package/lib/FormFieldLayout/index.js +15 -10
  21. package/lib/FormFieldLayout/props.js +5 -24
  22. package/lib/FormFieldLayout/styles.js +1 -1
  23. package/lib/FormFieldMessage/index.js +12 -8
  24. package/lib/FormFieldMessages/index.js +11 -6
  25. package/lib/FormFieldMessages/props.js +0 -6
  26. package/package.json +15 -16
  27. package/src/FormField/index.tsx +3 -3
  28. package/src/FormField/props.ts +17 -14
  29. package/src/FormFieldGroup/index.tsx +6 -10
  30. package/src/FormFieldGroup/props.ts +24 -17
  31. package/src/FormFieldLabel/index.tsx +4 -6
  32. package/src/FormFieldLabel/props.ts +3 -3
  33. package/src/FormFieldLayout/index.tsx +10 -16
  34. package/src/FormFieldLayout/props.ts +30 -20
  35. package/src/FormFieldLayout/styles.ts +1 -2
  36. package/src/FormFieldMessage/index.tsx +5 -8
  37. package/src/FormFieldMessages/index.tsx +4 -6
  38. package/src/FormFieldMessages/props.ts +6 -6
  39. package/src/index.ts +1 -1
  40. package/tsconfig.build.json +19 -2
  41. package/tsconfig.build.tsbuildinfo +1 -0
  42. package/types/FormField/index.d.ts +4 -30
  43. package/types/FormField/index.d.ts.map +1 -1
  44. package/types/FormField/props.d.ts +17 -2
  45. package/types/FormField/props.d.ts.map +1 -1
  46. package/types/FormFieldGroup/index.d.ts +4 -4
  47. package/types/FormFieldGroup/index.d.ts.map +1 -1
  48. package/types/FormFieldGroup/props.d.ts +18 -2
  49. package/types/FormFieldGroup/props.d.ts.map +1 -1
  50. package/types/FormFieldLabel/index.d.ts +4 -3
  51. package/types/FormFieldLabel/index.d.ts.map +1 -1
  52. package/types/FormFieldLabel/props.d.ts +1 -1
  53. package/types/FormFieldLabel/props.d.ts.map +1 -1
  54. package/types/FormFieldLayout/index.d.ts +7 -32
  55. package/types/FormFieldLayout/index.d.ts.map +1 -1
  56. package/types/FormFieldLayout/props.d.ts +21 -2
  57. package/types/FormFieldLayout/props.d.ts.map +1 -1
  58. package/types/FormFieldLayout/styles.d.ts +1 -1
  59. package/types/FormFieldLayout/styles.d.ts.map +1 -1
  60. package/types/FormFieldMessage/index.d.ts +2 -2
  61. package/types/FormFieldMessage/index.d.ts.map +1 -1
  62. package/types/FormFieldMessages/index.d.ts +2 -1
  63. package/types/FormFieldMessages/index.d.ts.map +1 -1
  64. package/types/FormFieldMessages/props.d.ts +6 -0
  65. package/types/FormFieldMessages/props.d.ts.map +1 -1
  66. package/types/index.d.ts +1 -1
  67. package/types/index.d.ts.map +1 -1
  68. package/LICENSE.md +0 -27
@@ -36,16 +36,35 @@ import type { FormMessage } from '../FormPropTypes'
36
36
 
37
37
  type FormFieldLayoutOwnProps = {
38
38
  label: React.ReactNode
39
+ /**
40
+ * the id of the input (to link it to its label for a11y)
41
+ */
39
42
  id?: string
43
+ /**
44
+ * the element type to render as
45
+ */
40
46
  as?: AsElementType
47
+ /**
48
+ * Array of objects with shape: `{
49
+ * text: React.ReactNode,
50
+ * type: One of: ['error', 'hint', 'success', 'screenreader-only']
51
+ * }`
52
+ */
41
53
  messages?: FormMessage[]
54
+ /**
55
+ * id for the form field messages
56
+ */
42
57
  messagesId?: string
43
58
  children?: React.ReactNode
44
59
  inline?: boolean
45
60
  layout?: 'stacked' | 'inline'
46
61
  labelAlign?: 'start' | 'end'
62
+ vAlign?: 'top' | 'middle' | 'bottom'
47
63
  width?: string
48
- inputContainerRef?: (...args: any[]) => any
64
+ inputContainerRef?: (element: HTMLSpanElement | null) => void
65
+ /**
66
+ * provides a reference to the underlying html root element
67
+ */
49
68
  elementRef?: (element: Element | null) => void
50
69
  }
51
70
 
@@ -61,34 +80,17 @@ type FormFieldLayoutStyle = ComponentStyle<'formFieldLayout'>
61
80
 
62
81
  const propTypes: PropValidators<PropKeys> = {
63
82
  label: PropTypes.node.isRequired,
64
- /**
65
- * the id of the input (to link it to its label for a11y)
66
- */
67
83
  id: PropTypes.string,
68
- /**
69
- * the element type to render as
70
- */
71
84
  as: PropTypes.elementType,
72
- /**
73
- * object with shape: `{
74
- * text: PropTypes.node,
75
- * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
76
- * }`
77
- */
78
85
  messages: PropTypes.arrayOf(FormPropTypes.message),
79
- /**
80
- * id for the form field messages
81
- */
82
86
  messagesId: PropTypes.string,
83
87
  children: PropTypes.node,
84
88
  inline: PropTypes.bool,
85
89
  layout: PropTypes.oneOf(['stacked', 'inline']),
86
90
  labelAlign: PropTypes.oneOf(['start', 'end']),
91
+ vAlign: PropTypes.oneOf(['top', 'middle', 'bottom']),
87
92
  width: PropTypes.string,
88
93
  inputContainerRef: PropTypes.func,
89
- /**
90
- * provides a reference to the underlying html root element
91
- */
92
94
  elementRef: PropTypes.func
93
95
  }
94
96
 
@@ -105,7 +107,15 @@ const allowedProps: AllowedPropKeys = [
105
107
  'width',
106
108
  'inputContainerRef',
107
109
  'elementRef'
110
+
111
+ // added vAlign because FormField and FormFieldGroup passes it, but not adding
112
+ // it to allowedProps to prevent it from getting passed through accidentally
113
+ //'vAlign'
108
114
  ]
109
115
 
110
- export type { FormFieldLayoutProps, FormFieldLayoutStyle }
116
+ export type {
117
+ FormFieldLayoutProps,
118
+ FormFieldLayoutStyle,
119
+ FormFieldLayoutOwnProps
120
+ }
111
121
  export { propTypes, allowedProps }
@@ -35,8 +35,7 @@ import type { FormFieldLayoutProps, FormFieldLayoutStyle } from './props'
35
35
  * @return {Object} The final style object, which will be used in the component
36
36
  */
37
37
  const generateStyle = (
38
- // @ts-expect-error no theme used here
39
- componentTheme,
38
+ _componentTheme: null,
40
39
  props: FormFieldLayoutProps
41
40
  ): FormFieldLayoutStyle => {
42
41
  const { inline } = props
@@ -39,6 +39,7 @@ import type { FormFieldMessageProps } from './props'
39
39
  ---
40
40
  parent: FormField
41
41
  ---
42
+ @tsProps
42
43
 
43
44
  This is a helper component that is used by most of the custom form
44
45
  components. In most cases it shouldn't be used directly.
@@ -57,8 +58,7 @@ class FormFieldMessage extends Component<FormFieldMessageProps> {
57
58
  static propTypes = propTypes
58
59
  static allowedProps = allowedProps
59
60
  static defaultProps = {
60
- variant: 'hint',
61
- children: null
61
+ variant: 'hint'
62
62
  }
63
63
 
64
64
  ref: Element | null = null
@@ -68,14 +68,11 @@ class FormFieldMessage extends Component<FormFieldMessageProps> {
68
68
  }
69
69
 
70
70
  componentDidMount() {
71
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
72
- this.props.makeStyles()
71
+ this.props.makeStyles?.()
73
72
  }
74
73
 
75
- // @ts-expect-error ts-migrate(6133) FIXME: 'prevProps' is declared but its value is never rea... Remove this comment to see the full error message
76
- componentDidUpdate(prevProps, prevState, snapshot) {
77
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
78
- this.props.makeStyles()
74
+ componentDidUpdate() {
75
+ this.props.makeStyles?.()
79
76
  }
80
77
 
81
78
  render() {
@@ -41,6 +41,7 @@ import type { FormFieldMessagesProps } from './props'
41
41
  ---
42
42
  parent: FormField
43
43
  ---
44
+ @tsProps
44
45
 
45
46
  A FormFieldMessages component
46
47
 
@@ -70,14 +71,11 @@ class FormFieldMessages extends Component<FormFieldMessagesProps> {
70
71
  }
71
72
 
72
73
  componentDidMount() {
73
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
74
- this.props.makeStyles()
74
+ this.props.makeStyles?.()
75
75
  }
76
76
 
77
- // @ts-expect-error ts-migrate(6133) FIXME: 'prevProps' is declared but its value is never rea... Remove this comment to see the full error message
78
- componentDidUpdate(prevProps, prevState, snapshot) {
79
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
80
- this.props.makeStyles()
77
+ componentDidUpdate() {
78
+ this.props.makeStyles?.()
81
79
  }
82
80
 
83
81
  render() {
@@ -35,6 +35,12 @@ import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
35
35
  import type { FormMessage } from '../FormPropTypes'
36
36
 
37
37
  type FormFieldMessagesOwnProps = {
38
+ /**
39
+ * Array of objects with shape: `{
40
+ * text: React.ReactNode,
41
+ * type: One of: ['error', 'hint', 'success', 'screenreader-only']
42
+ * }`
43
+ */
38
44
  messages?: FormMessage[]
39
45
  }
40
46
 
@@ -49,12 +55,6 @@ type FormFieldMessagesProps = FormFieldMessagesOwnProps &
49
55
  type FormFieldMessagesStyle = ComponentStyle<'formFieldMessages' | 'message'>
50
56
 
51
57
  const propTypes: PropValidators<PropKeys> = {
52
- /**
53
- * object with shape: `{
54
- * text: PropTypes.node,
55
- * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
56
- * }`
57
- */
58
58
  messages: PropTypes.arrayOf(FormPropTypes.message)
59
59
  }
60
60
 
package/src/index.ts CHANGED
@@ -32,7 +32,7 @@ export { FormFieldGroup } from './FormFieldGroup'
32
32
  export { FormPropTypes } from './FormPropTypes'
33
33
  export type { FormMessageType, FormMessage } from './FormPropTypes'
34
34
 
35
- export type { FormFieldProps } from './FormField/props'
35
+ export type { FormFieldOwnProps, FormFieldProps } from './FormField/props'
36
36
  export type { FormFieldLabelProps } from './FormFieldLabel/props'
37
37
  export type { FormFieldMessageProps } from './FormFieldMessage/props'
38
38
  export type { FormFieldMessagesProps } from './FormFieldMessages/props'
@@ -1,7 +1,24 @@
1
1
  {
2
2
  "extends": "../../tsconfig.build.json",
3
3
  "compilerOptions": {
4
- "outDir": "./types"
4
+ "outDir": "./types",
5
+ "composite": true,
6
+ "rootDir": "./src"
5
7
  },
6
- "include": ["src/**/*"]
8
+ "include": ["src"],
9
+ "references": [
10
+ { "path": "../ui-babel-preset/tsconfig.build.json" },
11
+ { "path": "../ui-test-utils/tsconfig.build.json" },
12
+ { "path": "../ui-themes/tsconfig.build.json" },
13
+ { "path": "../console/tsconfig.build.json" },
14
+ { "path": "../emotion/tsconfig.build.json" },
15
+ { "path": "../shared-types/tsconfig.build.json" },
16
+ { "path": "../ui-a11y-content/tsconfig.build.json" },
17
+ { "path": "../ui-a11y-utils/tsconfig.build.json" },
18
+ { "path": "../ui-grid/tsconfig.build.json" },
19
+ { "path": "../ui-icons/tsconfig.build.json" },
20
+ { "path": "../ui-react-utils/tsconfig.build.json" },
21
+ { "path": "../ui-utils/tsconfig.build.json" },
22
+ { "path": "../uid/tsconfig.build.json" }
23
+ ]
7
24
  }