@instructure/ui-checkbox 8.14.1-snapshot.7 → 8.15.1-snapshot.2

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 (50) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/es/Checkbox/CheckboxFacade/index.js +11 -6
  3. package/es/Checkbox/CheckboxFacade/props.js +0 -4
  4. package/es/Checkbox/CheckboxLocator.js +2 -1
  5. package/es/Checkbox/ToggleFacade/index.js +17 -12
  6. package/es/Checkbox/index.js +45 -43
  7. package/es/Checkbox/props.js +0 -29
  8. package/es/Checkbox/styles.js +1 -1
  9. package/es/CheckboxGroup/CheckboxGroupLocator.js +2 -1
  10. package/es/CheckboxGroup/index.js +16 -19
  11. package/lib/Checkbox/CheckboxFacade/index.js +11 -6
  12. package/lib/Checkbox/CheckboxFacade/props.js +0 -4
  13. package/lib/Checkbox/CheckboxLocator.js +1 -0
  14. package/lib/Checkbox/ToggleFacade/index.js +17 -12
  15. package/lib/Checkbox/index.js +47 -43
  16. package/lib/Checkbox/props.js +0 -29
  17. package/lib/Checkbox/styles.js +1 -1
  18. package/lib/CheckboxGroup/CheckboxGroupLocator.js +1 -0
  19. package/lib/CheckboxGroup/index.js +16 -19
  20. package/package.json +20 -20
  21. package/src/Checkbox/CheckboxFacade/index.tsx +4 -6
  22. package/src/Checkbox/CheckboxFacade/props.ts +3 -3
  23. package/src/Checkbox/ToggleFacade/index.tsx +4 -6
  24. package/src/Checkbox/ToggleFacade/props.ts +1 -0
  25. package/src/Checkbox/index.tsx +29 -54
  26. package/src/Checkbox/props.ts +36 -30
  27. package/src/Checkbox/styles.ts +2 -2
  28. package/src/CheckboxGroup/index.tsx +24 -40
  29. package/src/CheckboxGroup/props.ts +11 -5
  30. package/tsconfig.build.tsbuildinfo +1 -1
  31. package/types/Checkbox/CheckboxFacade/index.d.ts +2 -1
  32. package/types/Checkbox/CheckboxFacade/index.d.ts.map +1 -1
  33. package/types/Checkbox/CheckboxFacade/props.d.ts +3 -0
  34. package/types/Checkbox/CheckboxFacade/props.d.ts.map +1 -1
  35. package/types/Checkbox/CheckboxLocator.d.ts +4 -4
  36. package/types/Checkbox/ToggleFacade/index.d.ts +2 -1
  37. package/types/Checkbox/ToggleFacade/index.d.ts.map +1 -1
  38. package/types/Checkbox/ToggleFacade/props.d.ts +1 -1
  39. package/types/Checkbox/ToggleFacade/props.d.ts.map +1 -1
  40. package/types/Checkbox/index.d.ts +32 -29
  41. package/types/Checkbox/index.d.ts.map +1 -1
  42. package/types/Checkbox/props.d.ts +34 -8
  43. package/types/Checkbox/props.d.ts.map +1 -1
  44. package/types/Checkbox/styles.d.ts +2 -1
  45. package/types/Checkbox/styles.d.ts.map +1 -1
  46. package/types/CheckboxGroup/CheckboxGroupLocator.d.ts +4 -4
  47. package/types/CheckboxGroup/index.d.ts +16 -14
  48. package/types/CheckboxGroup/index.d.ts.map +1 -1
  49. package/types/CheckboxGroup/props.d.ts +11 -5
  50. 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'
@@ -37,16 +37,20 @@ import { testable } from '@instructure/ui-testable'
37
37
  import { Checkbox } from '../Checkbox'
38
38
 
39
39
  import { propTypes, allowedProps } from './props'
40
- import type { CheckboxGroupProps } from './props'
40
+ import type {
41
+ CheckboxGroupProps,
42
+ CheckboxGroupState,
43
+ CheckboxChild
44
+ } from './props'
41
45
 
42
46
  /**
43
47
  ---
44
48
  category: components
45
49
  ---
50
+ @tsProps
46
51
  **/
47
-
48
52
  @testable()
49
- class CheckboxGroup extends Component<CheckboxGroupProps> {
53
+ class CheckboxGroup extends Component<CheckboxGroupProps, CheckboxGroupState> {
50
54
  static readonly componentId = 'CheckboxGroup'
51
55
 
52
56
  static propTypes = propTypes
@@ -59,21 +63,18 @@ class CheckboxGroup extends Component<CheckboxGroupProps> {
59
63
  children: null
60
64
  }
61
65
 
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()
66
+ constructor(props: CheckboxGroupProps) {
67
+ super(props)
66
68
 
67
69
  if (typeof props.value === 'undefined') {
68
70
  this.state = {
69
- value: props.defaultValue
71
+ value: props.defaultValue || []
70
72
  }
71
73
  }
72
74
 
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
75
  this._messagesId = uid('CheckboxGroup-messages')
75
76
  }
76
-
77
+ private readonly _messagesId: string
77
78
  ref: Element | null = null
78
79
 
79
80
  handleRef = (el: Element | null) => {
@@ -84,9 +85,8 @@ class CheckboxGroup extends Component<CheckboxGroupProps> {
84
85
  return this.props.messages && this.props.messages.length > 0
85
86
  }
86
87
 
87
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'e' implicitly has an 'any' type.
88
- handleChange = (e) => {
89
- const newValue = this.value || []
88
+ handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
89
+ const newValue = this.value
90
90
 
91
91
  if (this.props.disabled || this.props.readOnly) {
92
92
  e.preventDefault()
@@ -109,42 +109,27 @@ class CheckboxGroup extends Component<CheckboxGroupProps> {
109
109
  }
110
110
 
111
111
  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
- }
112
+ return typeof this.props.value === 'undefined'
113
+ ? [...this.state.value]
114
+ : [...this.props.value]
124
115
  }
125
116
 
126
117
  renderChildren() {
127
118
  const { children, name, size, disabled, readOnly } = this.props
128
119
 
129
- // @ts-expect-error ts-migrate(6133) FIXME: 'index' is declared but its value is never read.
130
- return Children.map(children, (child, index) => {
131
- if (matchComponentTypes(child, [Checkbox])) {
132
- return safeCloneElement(child as ReactElement, {
133
- // @ts-expect-error ts-migrate(2533) FIXME: Object is possibly 'null' or 'undefined'.
120
+ return Children.map(children, (child) => {
121
+ if (matchComponentTypes<CheckboxChild>(child, [Checkbox])) {
122
+ return safeCloneElement(child, {
134
123
  key: `${child.props.name}`,
135
124
  name,
136
- // @ts-expect-error ts-migrate(2533) FIXME: Object is possibly 'null' or 'undefined'.
125
+ label: child.props.label,
137
126
  disabled: disabled || child.props.disabled,
138
- // @ts-expect-error ts-migrate(2533) FIXME: Object is possibly 'null' or 'undefined'.
139
127
  readOnly: readOnly || child.props.readOnly,
140
128
  size,
141
- // @ts-expect-error ts-migrate(2533) FIXME: Object is possibly 'null' or 'undefined'.
142
- checked: this.value.indexOf(child.props.value) > -1,
129
+ checked: this.value.indexOf(child.props.value!) > -1,
143
130
  onChange: this.handleChange,
144
- // @ts-expect-error ts-migrate(2533) FIXME: Object is possibly 'null' or 'undefined'.
145
131
  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
132
+ 'aria-describedby': this.hasMessages ? this._messagesId : undefined
148
133
  })
149
134
  } else {
150
135
  return child
@@ -154,13 +139,12 @@ class CheckboxGroup extends Component<CheckboxGroupProps> {
154
139
 
155
140
  render() {
156
141
  return (
157
- // @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
158
142
  <FormFieldGroup
159
143
  {...omitProps(this.props, CheckboxGroup.allowedProps)}
160
144
  {...pickProps(this.props, FormFieldGroup.allowedProps)}
145
+ description={this.props.description}
161
146
  rowSpacing="small"
162
147
  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
148
  messagesId={this._messagesId}
165
149
  elementRef={this.handleRef}
166
150
  >
@@ -35,14 +35,17 @@ 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'
39
+
40
+ type CheckboxChild = React.ComponentElement<CheckboxProps, Checkbox>
38
41
 
39
42
  type CheckboxGroupOwnProps = {
40
- children?: React.ReactNode // TODO: oneOf([Checkbox])
43
+ children?: CheckboxChild[] // TODO: oneOf([Checkbox])
41
44
  name: string
42
45
  description: React.ReactNode
43
- defaultValue?: any[]
44
- value?: any // TODO: controllable(PropTypes.array)
45
- onChange?: (...args: any[]) => any
46
+ defaultValue?: (string | number)[]
47
+ value?: (string | number)[] // TODO: controllable(PropTypes.array)
48
+ onChange?: (value: (string | number)[]) => void
46
49
  disabled?: boolean
47
50
  readOnly?: boolean
48
51
  messages?: FormMessage[]
@@ -102,5 +105,8 @@ const allowedProps: AllowedPropKeys = [
102
105
  'layout'
103
106
  ]
104
107
 
105
- export type { CheckboxGroupProps }
108
+ type CheckboxGroupState = {
109
+ value: (string | number)[]
110
+ }
111
+ export type { CheckboxGroupProps, CheckboxGroupState, CheckboxChild }
106
112
  export { propTypes, allowedProps }