@instructure/ui-checkbox 8.14.1-snapshot.63 → 8.14.1-snapshot.66
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/es/CheckboxGroup/index.js +1 -0
- package/lib/CheckboxGroup/index.js +1 -0
- package/package.json +20 -20
- package/src/CheckboxGroup/index.tsx +13 -25
- package/src/CheckboxGroup/props.ts +4 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/CheckboxGroup/index.d.ts +3 -5
- package/types/CheckboxGroup/index.d.ts.map +1 -1
- package/types/CheckboxGroup/props.d.ts +3 -2
- package/types/CheckboxGroup/props.d.ts.map +1 -1
|
@@ -101,6 +101,7 @@ let CheckboxGroup = (_dec = testable(), _dec(_class = (_temp = _class2 = class C
|
|
|
101
101
|
return safeCloneElement(child, {
|
|
102
102
|
key: `${child.props.name}`,
|
|
103
103
|
name,
|
|
104
|
+
label: child.props.label,
|
|
104
105
|
disabled: disabled || child.props.disabled,
|
|
105
106
|
readOnly: readOnly || child.props.readOnly,
|
|
106
107
|
size,
|
|
@@ -99,6 +99,7 @@ let CheckboxGroup = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
|
|
|
99
99
|
return (0, _safeCloneElement.safeCloneElement)(child, {
|
|
100
100
|
key: `${child.props.name}`,
|
|
101
101
|
name,
|
|
102
|
+
label: child.props.label,
|
|
102
103
|
disabled: disabled || child.props.disabled,
|
|
103
104
|
readOnly: readOnly || child.props.readOnly,
|
|
104
105
|
size,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-checkbox",
|
|
3
|
-
"version": "8.14.1-snapshot.
|
|
3
|
+
"version": "8.14.1-snapshot.66+ff0decd44",
|
|
4
4
|
"description": " styled HTML input type='checkbox' component.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,28 +25,28 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.13.10",
|
|
28
|
-
"@instructure/console": "8.14.1-snapshot.
|
|
29
|
-
"@instructure/emotion": "8.14.1-snapshot.
|
|
30
|
-
"@instructure/shared-types": "8.14.1-snapshot.
|
|
31
|
-
"@instructure/ui-dom-utils": "8.14.1-snapshot.
|
|
32
|
-
"@instructure/ui-form-field": "8.14.1-snapshot.
|
|
33
|
-
"@instructure/ui-icons": "8.14.1-snapshot.
|
|
34
|
-
"@instructure/ui-prop-types": "8.14.1-snapshot.
|
|
35
|
-
"@instructure/ui-react-utils": "8.14.1-snapshot.
|
|
36
|
-
"@instructure/ui-svg-images": "8.14.1-snapshot.
|
|
37
|
-
"@instructure/ui-testable": "8.14.1-snapshot.
|
|
38
|
-
"@instructure/ui-utils": "8.14.1-snapshot.
|
|
39
|
-
"@instructure/ui-view": "8.14.1-snapshot.
|
|
40
|
-
"@instructure/uid": "8.14.1-snapshot.
|
|
28
|
+
"@instructure/console": "8.14.1-snapshot.66+ff0decd44",
|
|
29
|
+
"@instructure/emotion": "8.14.1-snapshot.66+ff0decd44",
|
|
30
|
+
"@instructure/shared-types": "8.14.1-snapshot.66+ff0decd44",
|
|
31
|
+
"@instructure/ui-dom-utils": "8.14.1-snapshot.66+ff0decd44",
|
|
32
|
+
"@instructure/ui-form-field": "8.14.1-snapshot.66+ff0decd44",
|
|
33
|
+
"@instructure/ui-icons": "8.14.1-snapshot.66+ff0decd44",
|
|
34
|
+
"@instructure/ui-prop-types": "8.14.1-snapshot.66+ff0decd44",
|
|
35
|
+
"@instructure/ui-react-utils": "8.14.1-snapshot.66+ff0decd44",
|
|
36
|
+
"@instructure/ui-svg-images": "8.14.1-snapshot.66+ff0decd44",
|
|
37
|
+
"@instructure/ui-testable": "8.14.1-snapshot.66+ff0decd44",
|
|
38
|
+
"@instructure/ui-utils": "8.14.1-snapshot.66+ff0decd44",
|
|
39
|
+
"@instructure/ui-view": "8.14.1-snapshot.66+ff0decd44",
|
|
40
|
+
"@instructure/uid": "8.14.1-snapshot.66+ff0decd44",
|
|
41
41
|
"keycode": "^2",
|
|
42
42
|
"prop-types": "^15"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@instructure/ui-babel-preset": "8.14.1-snapshot.
|
|
46
|
-
"@instructure/ui-color-utils": "8.14.1-snapshot.
|
|
47
|
-
"@instructure/ui-test-locator": "8.14.1-snapshot.
|
|
48
|
-
"@instructure/ui-test-utils": "8.14.1-snapshot.
|
|
49
|
-
"@instructure/ui-themes": "8.14.1-snapshot.
|
|
45
|
+
"@instructure/ui-babel-preset": "8.14.1-snapshot.66+ff0decd44",
|
|
46
|
+
"@instructure/ui-color-utils": "8.14.1-snapshot.66+ff0decd44",
|
|
47
|
+
"@instructure/ui-test-locator": "8.14.1-snapshot.66+ff0decd44",
|
|
48
|
+
"@instructure/ui-test-utils": "8.14.1-snapshot.66+ff0decd44",
|
|
49
|
+
"@instructure/ui-themes": "8.14.1-snapshot.66+ff0decd44"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"react": ">=16.8 <=17"
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
57
|
"sideEffects": false,
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "ff0decd44fd390bd7f50885610373d2c9c793053"
|
|
59
59
|
}
|
|
@@ -35,10 +35,13 @@ import {
|
|
|
35
35
|
import { testable } from '@instructure/ui-testable'
|
|
36
36
|
|
|
37
37
|
import { Checkbox } from '../Checkbox'
|
|
38
|
-
import type { CheckboxProps } from '../Checkbox/props'
|
|
39
38
|
|
|
40
39
|
import { propTypes, allowedProps } from './props'
|
|
41
|
-
import type {
|
|
40
|
+
import type {
|
|
41
|
+
CheckboxGroupProps,
|
|
42
|
+
CheckboxGroupState,
|
|
43
|
+
CheckboxChild
|
|
44
|
+
} from './props'
|
|
42
45
|
|
|
43
46
|
/**
|
|
44
47
|
---
|
|
@@ -46,7 +49,6 @@ category: components
|
|
|
46
49
|
---
|
|
47
50
|
@tsProps
|
|
48
51
|
**/
|
|
49
|
-
|
|
50
52
|
@testable()
|
|
51
53
|
class CheckboxGroup extends Component<CheckboxGroupProps, CheckboxGroupState> {
|
|
52
54
|
static readonly componentId = 'CheckboxGroup'
|
|
@@ -116,31 +118,17 @@ class CheckboxGroup extends Component<CheckboxGroupProps, CheckboxGroupState> {
|
|
|
116
118
|
const { children, name, size, disabled, readOnly } = this.props
|
|
117
119
|
|
|
118
120
|
return Children.map(children, (child) => {
|
|
119
|
-
if (matchComponentTypes(child, [Checkbox])) {
|
|
120
|
-
return safeCloneElement(child
|
|
121
|
-
key: `${
|
|
122
|
-
(child as React.ComponentElement<CheckboxProps, Checkbox>).props
|
|
123
|
-
.name
|
|
124
|
-
}`,
|
|
121
|
+
if (matchComponentTypes<CheckboxChild>(child, [Checkbox])) {
|
|
122
|
+
return safeCloneElement(child, {
|
|
123
|
+
key: `${child.props.name}`,
|
|
125
124
|
name,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
.disabled,
|
|
130
|
-
readOnly:
|
|
131
|
-
readOnly ||
|
|
132
|
-
(child as React.ComponentElement<CheckboxProps, Checkbox>).props
|
|
133
|
-
.readOnly,
|
|
125
|
+
label: child.props.label,
|
|
126
|
+
disabled: disabled || child.props.disabled,
|
|
127
|
+
readOnly: readOnly || child.props.readOnly,
|
|
134
128
|
size,
|
|
135
|
-
checked:
|
|
136
|
-
this.value.indexOf(
|
|
137
|
-
(child as React.ComponentElement<CheckboxProps, Checkbox>).props
|
|
138
|
-
.value!
|
|
139
|
-
) > -1,
|
|
129
|
+
checked: this.value.indexOf(child.props.value!) > -1,
|
|
140
130
|
onChange: this.handleChange,
|
|
141
|
-
width:
|
|
142
|
-
(child as React.ComponentElement<CheckboxProps, Checkbox>).props
|
|
143
|
-
.width || 'auto',
|
|
131
|
+
width: child.props.width || 'auto',
|
|
144
132
|
'aria-describedby': this.hasMessages ? this._messagesId : undefined
|
|
145
133
|
})
|
|
146
134
|
} else {
|
|
@@ -37,8 +37,10 @@ import type { PropValidators } from '@instructure/shared-types'
|
|
|
37
37
|
import { Checkbox } from '../Checkbox'
|
|
38
38
|
import type { CheckboxProps } from '../Checkbox/props'
|
|
39
39
|
|
|
40
|
+
type CheckboxChild = React.ComponentElement<CheckboxProps, Checkbox>
|
|
41
|
+
|
|
40
42
|
type CheckboxGroupOwnProps = {
|
|
41
|
-
children?:
|
|
43
|
+
children?: CheckboxChild[] // TODO: oneOf([Checkbox])
|
|
42
44
|
name: string
|
|
43
45
|
description: React.ReactNode
|
|
44
46
|
defaultValue?: (string | number)[]
|
|
@@ -106,5 +108,5 @@ const allowedProps: AllowedPropKeys = [
|
|
|
106
108
|
type CheckboxGroupState = {
|
|
107
109
|
value: (string | number)[]
|
|
108
110
|
}
|
|
109
|
-
export type { CheckboxGroupProps, CheckboxGroupState }
|
|
111
|
+
export type { CheckboxGroupProps, CheckboxGroupState, CheckboxChild }
|
|
110
112
|
export { propTypes, allowedProps }
|