@instructure/ui-checkbox 8.14.1-snapshot.6 → 8.14.1-snapshot.63

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 (49) hide show
  1. package/es/Checkbox/CheckboxFacade/index.js +11 -6
  2. package/es/Checkbox/CheckboxFacade/props.js +0 -4
  3. package/es/Checkbox/CheckboxLocator.js +2 -1
  4. package/es/Checkbox/ToggleFacade/index.js +17 -12
  5. package/es/Checkbox/index.js +45 -43
  6. package/es/Checkbox/props.js +0 -29
  7. package/es/Checkbox/styles.js +1 -1
  8. package/es/CheckboxGroup/CheckboxGroupLocator.js +2 -1
  9. package/es/CheckboxGroup/index.js +15 -19
  10. package/lib/Checkbox/CheckboxFacade/index.js +11 -6
  11. package/lib/Checkbox/CheckboxFacade/props.js +0 -4
  12. package/lib/Checkbox/CheckboxLocator.js +1 -0
  13. package/lib/Checkbox/ToggleFacade/index.js +17 -12
  14. package/lib/Checkbox/index.js +47 -43
  15. package/lib/Checkbox/props.js +0 -29
  16. package/lib/Checkbox/styles.js +1 -1
  17. package/lib/CheckboxGroup/CheckboxGroupLocator.js +1 -0
  18. package/lib/CheckboxGroup/index.js +15 -19
  19. package/package.json +20 -20
  20. package/src/Checkbox/CheckboxFacade/index.tsx +4 -6
  21. package/src/Checkbox/CheckboxFacade/props.ts +3 -3
  22. package/src/Checkbox/ToggleFacade/index.tsx +4 -6
  23. package/src/Checkbox/ToggleFacade/props.ts +1 -0
  24. package/src/Checkbox/index.tsx +29 -54
  25. package/src/Checkbox/props.ts +36 -30
  26. package/src/Checkbox/styles.ts +2 -2
  27. package/src/CheckboxGroup/index.tsx +38 -42
  28. package/src/CheckboxGroup/props.ts +9 -5
  29. package/tsconfig.build.tsbuildinfo +1 -1
  30. package/types/Checkbox/CheckboxFacade/index.d.ts +2 -1
  31. package/types/Checkbox/CheckboxFacade/index.d.ts.map +1 -1
  32. package/types/Checkbox/CheckboxFacade/props.d.ts +3 -0
  33. package/types/Checkbox/CheckboxFacade/props.d.ts.map +1 -1
  34. package/types/Checkbox/CheckboxLocator.d.ts +4 -4
  35. package/types/Checkbox/ToggleFacade/index.d.ts +2 -1
  36. package/types/Checkbox/ToggleFacade/index.d.ts.map +1 -1
  37. package/types/Checkbox/ToggleFacade/props.d.ts +1 -1
  38. package/types/Checkbox/ToggleFacade/props.d.ts.map +1 -1
  39. package/types/Checkbox/index.d.ts +32 -29
  40. package/types/Checkbox/index.d.ts.map +1 -1
  41. package/types/Checkbox/props.d.ts +34 -8
  42. package/types/Checkbox/props.d.ts.map +1 -1
  43. package/types/Checkbox/styles.d.ts +2 -1
  44. package/types/Checkbox/styles.d.ts.map +1 -1
  45. package/types/CheckboxGroup/CheckboxGroupLocator.d.ts +4 -4
  46. package/types/CheckboxGroup/index.d.ts +18 -14
  47. package/types/CheckboxGroup/index.d.ts.map +1 -1
  48. package/types/CheckboxGroup/props.d.ts +10 -5
  49. package/types/CheckboxGroup/props.d.ts.map +1 -1
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  /** @jsx jsx */
26
- import { Component } from 'react'
26
+ import React, { Component } from 'react'
27
27
  import keycode from 'keycode'
28
28
 
29
29
  import { FormFieldMessages } from '@instructure/ui-form-field'
@@ -43,7 +43,7 @@ import { ToggleFacade } from './ToggleFacade'
43
43
  import generateStyle from './styles'
44
44
 
45
45
  import { propTypes, allowedProps } from './props'
46
- import type { CheckboxProps } from './props'
46
+ import type { CheckboxProps, CheckboxState } from './props'
47
47
 
48
48
  import type {
49
49
  CheckboxFacadeTheme,
@@ -55,11 +55,12 @@ import type {
55
55
  category: components
56
56
  tags: toggle, switch
57
57
  ---
58
+ @tsProps
58
59
  **/
59
60
 
60
61
  @withStyle(generateStyle, null)
61
62
  @testable()
62
- class Checkbox extends Component<CheckboxProps> {
63
+ class Checkbox extends Component<CheckboxProps, CheckboxState> {
63
64
  static readonly componentId = 'Checkbox'
64
65
 
65
66
  static propTypes = propTypes
@@ -74,23 +75,22 @@ class Checkbox extends Component<CheckboxProps> {
74
75
  labelPlacement: 'end'
75
76
  }
76
77
 
77
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
78
- constructor(props) {
78
+ constructor(props: CheckboxProps) {
79
79
  super(props)
80
80
 
81
81
  this.state = {
82
82
  focused: false,
83
- hovered: false
84
- }
85
-
86
- if (typeof props.checked === 'undefined') {
87
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'checked' does not exist on type 'Readonl... Remove this comment to see the full error message
88
- this.state.checked = !!props.defaultChecked
83
+ hovered: false,
84
+ checked:
85
+ typeof props.checked === 'undefined'
86
+ ? !!props.defaultChecked
87
+ : undefined
89
88
  }
90
89
 
91
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_defaultId' does not exist on type 'Chec... Remove this comment to see the full error message
92
90
  this._defaultId = uid('Checkbox')
93
91
  }
92
+ private readonly _defaultId: string
93
+ private _input: HTMLInputElement | null = null
94
94
 
95
95
  ref: Element | null = null
96
96
 
@@ -99,28 +99,22 @@ class Checkbox extends Component<CheckboxProps> {
99
99
  }
100
100
 
101
101
  componentDidMount() {
102
- // see https://github.com/facebook/react/issues/1798
103
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_input' does not exist on type 'Checkbox... Remove this comment to see the full error message
104
- this._input.indeterminate = this.props.indeterminate
102
+ if (this._input) {
103
+ this._input.indeterminate = this.props.indeterminate!
104
+ }
105
105
 
106
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
107
- this.props.makeStyles()
106
+ this.props.makeStyles?.()
108
107
  }
109
108
 
110
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'prevProps' implicitly has an 'any' type... Remove this comment to see the full error message
111
- componentDidUpdate(prevProps) {
112
- // see https://github.com/facebook/react/issues/1798
113
- if (prevProps.indeterminate !== this.props.indeterminate) {
114
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_input' does not exist on type 'Checkbox... Remove this comment to see the full error message
115
- this._input.indeterminate = this.props.indeterminate
109
+ componentDidUpdate(prevProps: CheckboxProps) {
110
+ if (prevProps.indeterminate !== this.props.indeterminate && this._input) {
111
+ this._input.indeterminate = this.props.indeterminate || false
116
112
  }
117
113
 
118
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
119
- this.props.makeStyles()
114
+ this.props.makeStyles?.()
120
115
  }
121
116
 
122
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'e' implicitly has an 'any' type.
123
- handleChange = (e) => {
117
+ handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
124
118
  const { onChange, disabled, checked, readOnly } = this.props
125
119
 
126
120
  if (disabled || readOnly) {
@@ -129,7 +123,6 @@ class Checkbox extends Component<CheckboxProps> {
129
123
  }
130
124
 
131
125
  if (typeof checked === 'undefined') {
132
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'checked' does not exist on type 'Readonl... Remove this comment to see the full error message
133
126
  this.setState({ checked: !this.state.checked })
134
127
  }
135
128
 
@@ -138,66 +131,52 @@ class Checkbox extends Component<CheckboxProps> {
138
131
  }
139
132
  }
140
133
 
141
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'e' implicitly has an 'any' type.
142
- handleKeyDown = (e) => {
143
- if (
144
- this.props.variant === 'toggle' &&
145
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'return' does not exist on type 'CodesMap... Remove this comment to see the full error message
146
- (e.keyCode === keycode.codes.enter || e.keyCode === keycode.codes.return)
147
- ) {
148
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_input' does not exist on type 'Checkbox... Remove this comment to see the full error message
149
- this._input.click()
134
+ handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
135
+ if (this.props.variant === 'toggle' && e.keyCode === keycode.codes.enter) {
136
+ this._input && this._input.click()
150
137
  e.preventDefault()
151
138
  }
152
139
  }
153
140
 
154
- // @ts-expect-error ts-migrate(6133) FIXME: 'e' is declared but its value is never read.
155
- handleFocus = (e) => {
141
+ handleFocus = () => {
156
142
  this.setState({
157
143
  focused: true
158
144
  })
159
145
  }
160
146
 
161
- // @ts-expect-error ts-migrate(6133) FIXME: 'e' is declared but its value is never read.
162
- handleBlur = (e) => {
147
+ handleBlur = () => {
163
148
  this.setState({
164
149
  focused: false
165
150
  })
166
151
  }
167
152
 
168
- // @ts-expect-error ts-migrate(6133) FIXME: 'e' is declared but its value is never read.
169
- handleMouseOver = (e) => {
153
+ handleMouseOver = () => {
170
154
  this.setState({
171
155
  hovered: true
172
156
  })
173
157
  }
174
158
 
175
- // @ts-expect-error ts-migrate(6133) FIXME: 'e' is declared but its value is never read.
176
- handleMouseOut = (e) => {
159
+ handleMouseOut = () => {
177
160
  this.setState({
178
161
  hovered: false
179
162
  })
180
163
  }
181
164
 
182
165
  get id() {
183
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_defaultId' does not exist on type 'Chec... Remove this comment to see the full error message
184
166
  return this.props.id || this._defaultId
185
167
  }
186
168
 
187
169
  get checked() {
188
170
  return typeof this.props.checked === 'undefined'
189
- ? // @ts-expect-error ts-migrate(2339) FIXME: Property 'checked' does not exist on type 'Readonl... Remove this comment to see the full error message
190
- this.state.checked
171
+ ? this.state.checked
191
172
  : this.props.checked
192
173
  }
193
174
 
194
175
  get focused() {
195
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_input' does not exist on type 'Checkbox... Remove this comment to see the full error message
196
176
  return isActiveElement(this._input)
197
177
  }
198
178
 
199
179
  focus() {
200
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_input' does not exist on type 'Checkbox... Remove this comment to see the full error message
201
180
  this._input && this._input.focus()
202
181
  }
203
182
 
@@ -213,7 +192,6 @@ class Checkbox extends Component<CheckboxProps> {
213
192
  themeOverride
214
193
  } = this.props
215
194
 
216
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'hovered' does not exist on type 'Readonl... Remove this comment to see the full error message
217
195
  const { hovered, focused } = this.state
218
196
 
219
197
  error(
@@ -226,8 +204,6 @@ class Checkbox extends Component<CheckboxProps> {
226
204
  <ToggleFacade
227
205
  disabled={disabled}
228
206
  size={size}
229
- // @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
230
- hovered={hovered}
231
207
  focused={focused}
232
208
  checked={this.checked}
233
209
  readOnly={readOnly}
@@ -300,7 +276,6 @@ class Checkbox extends Component<CheckboxProps> {
300
276
  value={value}
301
277
  type="checkbox"
302
278
  ref={(c) => {
303
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_input' does not exist on type 'Checkbox... Remove this comment to see the full error message
304
279
  this._input = c
305
280
  }}
306
281
  disabled={disabled || readOnly}
@@ -40,17 +40,39 @@ type CheckboxOwnProps = {
40
40
  label: React.ReactNode
41
41
  id?: string
42
42
  value?: string | number
43
+ /**
44
+ * Array of objects with shape: `{
45
+ * text: ReactNode,
46
+ * type: One of: ['error', 'hint', 'success', 'screenreader-only']
47
+ * }`
48
+ */
43
49
  messages?: FormMessage[]
50
+ /* whether to set the input to checked or not on initial render */
44
51
  defaultChecked?: boolean
45
- checked?: any // TODO: controllable(PropTypes.bool, 'onChange', 'defaultChecked')
46
- onChange?: (...args: any[]) => any
47
- onKeyDown?: (...args: any[]) => any
48
- onFocus?: (...args: any[]) => any
49
- onBlur?: (...args: any[]) => any
50
- onMouseOver?: (...args: any[]) => any
51
- onMouseOut?: (...args: any[]) => any
52
+ /**
53
+ * whether the input is checked or not (must be accompanied by an `onChange` prop)
54
+ */
55
+ checked?: boolean // TODO: controllable(PropTypes.bool, 'onChange', 'defaultChecked')
56
+ /**
57
+ * when used with the `checked` prop, the component will not control its own state
58
+ */
59
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void
60
+ onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void
61
+ onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void
62
+ onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void
63
+ onMouseOver?: (e: React.MouseEvent<HTMLInputElement>) => void
64
+ onMouseOut?: (e: React.MouseEvent<HTMLInputElement>) => void
65
+ /**
66
+ * Whether or not to disable the checkbox
67
+ */
52
68
  disabled?: boolean
69
+ /**
70
+ * Works just like disabled but keeps the same styles as if it were active
71
+ */
53
72
  readOnly?: boolean
73
+ /**
74
+ * Visual state showing that child checkboxes are a combination of checked and unchecked
75
+ */
54
76
  indeterminate?: boolean
55
77
  size?: 'small' | 'medium' | 'large'
56
78
  variant?: 'simple' | 'toggle'
@@ -72,39 +94,17 @@ const propTypes: PropValidators<PropKeys> = {
72
94
  label: PropTypes.node.isRequired,
73
95
  id: PropTypes.string,
74
96
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
75
- /**
76
- * object with shape: `{
77
- * text: PropTypes.node,
78
- * type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
79
- * }`
80
- */
81
97
  messages: PropTypes.arrayOf(FormPropTypes.message),
82
- /* whether to set the input to checked or not on initial render */
83
98
  defaultChecked: PropTypes.bool,
84
- /**
85
- * whether the input is checked or not (must be accompanied by an `onChange` prop)
86
- */
87
99
  checked: controllable(PropTypes.bool, 'onChange', 'defaultChecked'),
88
- /**
89
- * when used with the `checked` prop, the component will not control its own state
90
- */
91
100
  onChange: PropTypes.func,
92
101
  onKeyDown: PropTypes.func,
93
102
  onFocus: PropTypes.func,
94
103
  onBlur: PropTypes.func,
95
104
  onMouseOver: PropTypes.func,
96
105
  onMouseOut: PropTypes.func,
97
- /**
98
- * Whether or not to disable the checkbox
99
- */
100
106
  disabled: PropTypes.bool,
101
- /**
102
- * Works just like disabled but keeps the same styles as if it were active
103
- */
104
107
  readOnly: PropTypes.bool,
105
- /**
106
- * Visual state showing that child checkboxes are a combination of checked and unchecked
107
- */
108
108
  indeterminate: PropTypes.bool,
109
109
  size: PropTypes.oneOf(['small', 'medium', 'large']),
110
110
  variant: PropTypes.oneOf(['simple', 'toggle']),
@@ -134,5 +134,11 @@ const allowedProps: AllowedPropKeys = [
134
134
  'labelPlacement'
135
135
  ]
136
136
 
137
- export type { CheckboxProps, CheckboxStyle }
137
+ type CheckboxState = {
138
+ focused: boolean
139
+ hovered: boolean
140
+ checked?: boolean
141
+ }
142
+
143
+ export type { CheckboxProps, CheckboxStyle, CheckboxState }
138
144
  export { propTypes, allowedProps }
@@ -23,6 +23,7 @@
23
23
  */
24
24
 
25
25
  import type { CheckboxProps, CheckboxStyle } from './props'
26
+ import type { ComponentTheme } from '@instructure/shared-types'
26
27
 
27
28
  /**
28
29
  * ---
@@ -35,8 +36,7 @@ import type { CheckboxProps, CheckboxStyle } from './props'
35
36
  * @return {Object} The final style object, which will be used in the component
36
37
  */
37
38
  const generateStyle = (
38
- // @ts-expect-error no theme variables used here
39
- componentTheme: any,
39
+ _componentTheme: ComponentTheme,
40
40
  props: CheckboxProps
41
41
  ): CheckboxStyle => {
42
42
  const { inline, disabled } = props
@@ -22,7 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import React, { Children, Component, ReactElement } from 'react'
25
+ import React, { Children, Component } from 'react'
26
26
 
27
27
  import { FormFieldGroup } from '@instructure/ui-form-field'
28
28
  import { uid } from '@instructure/uid'
@@ -35,18 +35,20 @@ import {
35
35
  import { testable } from '@instructure/ui-testable'
36
36
 
37
37
  import { Checkbox } from '../Checkbox'
38
+ import type { CheckboxProps } from '../Checkbox/props'
38
39
 
39
40
  import { propTypes, allowedProps } from './props'
40
- import type { CheckboxGroupProps } from './props'
41
+ import type { CheckboxGroupProps, CheckboxGroupState } from './props'
41
42
 
42
43
  /**
43
44
  ---
44
45
  category: components
45
46
  ---
47
+ @tsProps
46
48
  **/
47
49
 
48
50
  @testable()
49
- class CheckboxGroup extends Component<CheckboxGroupProps> {
51
+ class CheckboxGroup extends Component<CheckboxGroupProps, CheckboxGroupState> {
50
52
  static readonly componentId = 'CheckboxGroup'
51
53
 
52
54
  static propTypes = propTypes
@@ -59,21 +61,18 @@ class CheckboxGroup extends Component<CheckboxGroupProps> {
59
61
  children: null
60
62
  }
61
63
 
62
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
63
- constructor(props) {
64
- // @ts-expect-error ts-migrate(2554) FIXME: Expected 1-2 arguments, but got 0.
65
- super()
64
+ constructor(props: CheckboxGroupProps) {
65
+ super(props)
66
66
 
67
67
  if (typeof props.value === 'undefined') {
68
68
  this.state = {
69
- value: props.defaultValue
69
+ value: props.defaultValue || []
70
70
  }
71
71
  }
72
72
 
73
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_messagesId' does not exist on type 'Che... Remove this comment to see the full error message
74
73
  this._messagesId = uid('CheckboxGroup-messages')
75
74
  }
76
-
75
+ private readonly _messagesId: string
77
76
  ref: Element | null = null
78
77
 
79
78
  handleRef = (el: Element | null) => {
@@ -84,9 +83,8 @@ class CheckboxGroup extends Component<CheckboxGroupProps> {
84
83
  return this.props.messages && this.props.messages.length > 0
85
84
  }
86
85
 
87
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'e' implicitly has an 'any' type.
88
- handleChange = (e) => {
89
- const newValue = this.value || []
86
+ handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
87
+ const newValue = this.value
90
88
 
91
89
  if (this.props.disabled || this.props.readOnly) {
92
90
  e.preventDefault()
@@ -109,42 +107,41 @@ class CheckboxGroup extends Component<CheckboxGroupProps> {
109
107
  }
110
108
 
111
109
  get value() {
112
- if (
113
- typeof this.props.value === 'undefined' &&
114
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'value' does not exist on type 'Readonly<... Remove this comment to see the full error message
115
- typeof this.state.value === 'undefined'
116
- ) {
117
- return []
118
- } else {
119
- return typeof this.props.value === 'undefined'
120
- ? // @ts-expect-error ts-migrate(2339) FIXME: Property 'value' does not exist on type 'Readonly<... Remove this comment to see the full error message
121
- [...this.state.value]
122
- : [...this.props.value]
123
- }
110
+ return typeof this.props.value === 'undefined'
111
+ ? [...this.state.value]
112
+ : [...this.props.value]
124
113
  }
125
114
 
126
115
  renderChildren() {
127
116
  const { children, name, size, disabled, readOnly } = this.props
128
117
 
129
- // @ts-expect-error ts-migrate(6133) FIXME: 'index' is declared but its value is never read.
130
- return Children.map(children, (child, index) => {
118
+ return Children.map(children, (child) => {
131
119
  if (matchComponentTypes(child, [Checkbox])) {
132
- return safeCloneElement(child as ReactElement, {
133
- // @ts-expect-error ts-migrate(2533) FIXME: Object is possibly 'null' or 'undefined'.
134
- key: `${child.props.name}`,
120
+ return safeCloneElement(child as React.ReactElement, {
121
+ key: `${
122
+ (child as React.ComponentElement<CheckboxProps, Checkbox>).props
123
+ .name
124
+ }`,
135
125
  name,
136
- // @ts-expect-error ts-migrate(2533) FIXME: Object is possibly 'null' or 'undefined'.
137
- disabled: disabled || child.props.disabled,
138
- // @ts-expect-error ts-migrate(2533) FIXME: Object is possibly 'null' or 'undefined'.
139
- readOnly: readOnly || child.props.readOnly,
126
+ disabled:
127
+ disabled ||
128
+ (child as React.ComponentElement<CheckboxProps, Checkbox>).props
129
+ .disabled,
130
+ readOnly:
131
+ readOnly ||
132
+ (child as React.ComponentElement<CheckboxProps, Checkbox>).props
133
+ .readOnly,
140
134
  size,
141
- // @ts-expect-error ts-migrate(2533) FIXME: Object is possibly 'null' or 'undefined'.
142
- checked: this.value.indexOf(child.props.value) > -1,
135
+ checked:
136
+ this.value.indexOf(
137
+ (child as React.ComponentElement<CheckboxProps, Checkbox>).props
138
+ .value!
139
+ ) > -1,
143
140
  onChange: this.handleChange,
144
- // @ts-expect-error ts-migrate(2533) FIXME: Object is possibly 'null' or 'undefined'.
145
- width: child.props.width || 'auto',
146
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_messagesId' does not exist on type 'Che... Remove this comment to see the full error message
147
- 'aria-describedby': this.hasMessages && this._messagesId
141
+ width:
142
+ (child as React.ComponentElement<CheckboxProps, Checkbox>).props
143
+ .width || 'auto',
144
+ 'aria-describedby': this.hasMessages ? this._messagesId : undefined
148
145
  })
149
146
  } else {
150
147
  return child
@@ -154,13 +151,12 @@ class CheckboxGroup extends Component<CheckboxGroupProps> {
154
151
 
155
152
  render() {
156
153
  return (
157
- // @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
158
154
  <FormFieldGroup
159
155
  {...omitProps(this.props, CheckboxGroup.allowedProps)}
160
156
  {...pickProps(this.props, FormFieldGroup.allowedProps)}
157
+ description={this.props.description}
161
158
  rowSpacing="small"
162
159
  vAlign="top"
163
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_messagesId' does not exist on type 'Che... Remove this comment to see the full error message
164
160
  messagesId={this._messagesId}
165
161
  elementRef={this.handleRef}
166
162
  >
@@ -35,14 +35,15 @@ import type { FormMessage } from '@instructure/ui-form-field'
35
35
  import type { PropValidators } from '@instructure/shared-types'
36
36
 
37
37
  import { Checkbox } from '../Checkbox'
38
+ import type { CheckboxProps } from '../Checkbox/props'
38
39
 
39
40
  type CheckboxGroupOwnProps = {
40
- children?: React.ReactNode // TODO: oneOf([Checkbox])
41
+ children?: React.ComponentElement<CheckboxProps, Checkbox>[] // TODO: oneOf([Checkbox])
41
42
  name: string
42
43
  description: React.ReactNode
43
- defaultValue?: any[]
44
- value?: any // TODO: controllable(PropTypes.array)
45
- onChange?: (...args: any[]) => any
44
+ defaultValue?: (string | number)[]
45
+ value?: (string | number)[] // TODO: controllable(PropTypes.array)
46
+ onChange?: (value: (string | number)[]) => void
46
47
  disabled?: boolean
47
48
  readOnly?: boolean
48
49
  messages?: FormMessage[]
@@ -102,5 +103,8 @@ const allowedProps: AllowedPropKeys = [
102
103
  'layout'
103
104
  ]
104
105
 
105
- export type { CheckboxGroupProps }
106
+ type CheckboxGroupState = {
107
+ value: (string | number)[]
108
+ }
109
+ export type { CheckboxGroupProps, CheckboxGroupState }
106
110
  export { propTypes, allowedProps }