@instructure/ui-checkbox 8.8.1-snapshot.3 → 8.9.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 (66) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/es/Checkbox/CheckboxFacade/index.js +5 -20
  3. package/{src/CheckboxGroup/types.ts → es/Checkbox/CheckboxFacade/props.js} +14 -15
  4. package/es/Checkbox/ToggleFacade/index.js +9 -21
  5. package/{src/Checkbox/CheckboxFacade/types.ts → es/Checkbox/ToggleFacade/props.js} +12 -10
  6. package/es/Checkbox/index.js +7 -72
  7. package/es/Checkbox/props.js +78 -0
  8. package/es/CheckboxGroup/index.js +3 -43
  9. package/es/CheckboxGroup/props.js +65 -0
  10. package/lib/Checkbox/CheckboxFacade/index.js +6 -21
  11. package/lib/Checkbox/CheckboxFacade/props.js +49 -0
  12. package/lib/Checkbox/ToggleFacade/index.js +10 -22
  13. package/{src/Checkbox/types.ts → lib/Checkbox/ToggleFacade/props.js} +23 -26
  14. package/lib/Checkbox/index.js +7 -75
  15. package/lib/Checkbox/props.js +91 -0
  16. package/lib/CheckboxGroup/index.js +3 -50
  17. package/lib/CheckboxGroup/props.js +81 -0
  18. package/package.json +20 -21
  19. package/src/Checkbox/CheckboxFacade/index.tsx +8 -21
  20. package/src/Checkbox/CheckboxFacade/props.ts +67 -0
  21. package/src/Checkbox/CheckboxFacade/styles.ts +1 -1
  22. package/src/Checkbox/ToggleFacade/index.tsx +12 -23
  23. package/src/Checkbox/ToggleFacade/{types.ts → props.ts} +36 -3
  24. package/src/Checkbox/ToggleFacade/styles.ts +1 -1
  25. package/src/Checkbox/index.tsx +10 -68
  26. package/src/Checkbox/props.ts +129 -0
  27. package/src/Checkbox/styles.ts +1 -1
  28. package/src/CheckboxGroup/index.tsx +6 -43
  29. package/src/CheckboxGroup/props.ts +106 -0
  30. package/src/index.ts +4 -4
  31. package/types/Checkbox/CheckboxFacade/index.d.ts +17 -15
  32. package/types/Checkbox/CheckboxFacade/index.d.ts.map +1 -1
  33. package/types/Checkbox/CheckboxFacade/props.d.ts +19 -0
  34. package/types/Checkbox/CheckboxFacade/props.d.ts.map +1 -0
  35. package/types/Checkbox/CheckboxFacade/styles.d.ts +1 -1
  36. package/types/Checkbox/ToggleFacade/index.d.ts +19 -13
  37. package/types/Checkbox/ToggleFacade/index.d.ts.map +1 -1
  38. package/types/Checkbox/ToggleFacade/props.d.ts +20 -0
  39. package/types/Checkbox/ToggleFacade/props.d.ts.map +1 -0
  40. package/types/Checkbox/ToggleFacade/styles.d.ts +1 -1
  41. package/types/Checkbox/index.d.ts +43 -60
  42. package/types/Checkbox/index.d.ts.map +1 -1
  43. package/types/Checkbox/{types.d.ts → props.d.ts} +11 -4
  44. package/types/Checkbox/props.d.ts.map +1 -0
  45. package/types/Checkbox/styles.d.ts +1 -1
  46. package/types/CheckboxGroup/index.d.ts +28 -44
  47. package/types/CheckboxGroup/index.d.ts.map +1 -1
  48. package/types/CheckboxGroup/props.d.ts +24 -0
  49. package/types/CheckboxGroup/props.d.ts.map +1 -0
  50. package/types/index.d.ts +4 -4
  51. package/LICENSE.md +0 -27
  52. package/es/Checkbox/CheckboxFacade/types.js +0 -1
  53. package/es/Checkbox/ToggleFacade/types.js +0 -1
  54. package/es/Checkbox/types.js +0 -1
  55. package/es/CheckboxGroup/types.js +0 -1
  56. package/lib/Checkbox/CheckboxFacade/types.js +0 -1
  57. package/lib/Checkbox/ToggleFacade/types.js +0 -1
  58. package/lib/Checkbox/types.js +0 -1
  59. package/lib/CheckboxGroup/types.js +0 -1
  60. package/types/Checkbox/CheckboxFacade/types.d.ts +0 -10
  61. package/types/Checkbox/CheckboxFacade/types.d.ts.map +0 -1
  62. package/types/Checkbox/ToggleFacade/types.d.ts +0 -11
  63. package/types/Checkbox/ToggleFacade/types.d.ts.map +0 -1
  64. package/types/Checkbox/types.d.ts.map +0 -1
  65. package/types/CheckboxGroup/types.d.ts +0 -15
  66. package/types/CheckboxGroup/types.d.ts.map +0 -1
@@ -2,8 +2,6 @@
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
4
 
5
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
@@ -11,14 +9,6 @@ exports.CheckboxGroup = exports.default = void 0;
11
9
 
12
10
  var _react = _interopRequireWildcard(require("react"));
13
11
 
14
- var _propTypes = _interopRequireDefault(require("prop-types"));
15
-
16
- var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
17
-
18
- var _Children = require("@instructure/ui-prop-types/lib/Children.js");
19
-
20
- var _FormPropTypes = require("@instructure/ui-form-field/lib/FormPropTypes.js");
21
-
22
12
  var _FormFieldGroup = require("@instructure/ui-form-field/lib/FormFieldGroup");
23
13
 
24
14
  var _uid = require("@instructure/uid");
@@ -35,6 +25,8 @@ var _testable = require("@instructure/ui-testable/lib/testable.js");
35
25
 
36
26
  var _Checkbox = require("../Checkbox");
37
27
 
28
+ var _props = require("./props");
29
+
38
30
  var _dec, _class, _class2, _temp;
39
31
 
40
32
  /**
@@ -129,50 +121,11 @@ let CheckboxGroup = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _c
129
121
  );
130
122
  }
131
123
 
132
- }, _class2.displayName = "CheckboxGroup", _class2.componentId = 'CheckboxGroup', _class2.propTypes = {
133
- name: _propTypes.default.string.isRequired,
134
- description: _propTypes.default.node.isRequired,
135
-
136
- /**
137
- * value to set on initial render
138
- */
139
- defaultValue: _propTypes.default.array,
140
-
141
- /**
142
- * the selected values (must be accompanied by an `onChange` prop)
143
- */
144
- value: (0, _controllable.controllable)(_propTypes.default.array),
145
-
146
- /**
147
- * when used with the `value` prop, the component will not control its own state
148
- */
149
- onChange: _propTypes.default.func,
150
- disabled: _propTypes.default.bool,
151
- readOnly: _propTypes.default.bool,
152
-
153
- /**
154
- * object with shape: `{
155
- text: PropTypes.string,
156
- type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
157
- }`
158
- */
159
- messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
160
-
161
- /**
162
- * children of type `Checkbox`
163
- */
164
- children: _Children.Children.oneOf([_Checkbox.Checkbox]),
165
- size: _propTypes.default.oneOf(['small', 'medium', 'large']),
166
- layout: _propTypes.default.oneOf(['stacked', 'columns', 'inline'])
167
- }, _class2.defaultProps = {
124
+ }, _class2.displayName = "CheckboxGroup", _class2.componentId = 'CheckboxGroup', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
168
125
  disabled: false,
169
126
  readOnly: false,
170
127
  size: 'medium',
171
128
  layout: 'stacked',
172
- defaultValue: void 0,
173
- messages: void 0,
174
- value: void 0,
175
- onChange: void 0,
176
129
  children: null
177
130
  }, _temp)) || _class);
178
131
  exports.CheckboxGroup = CheckboxGroup;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.allowedProps = exports.propTypes = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _FormPropTypes = require("@instructure/ui-form-field/lib/FormPropTypes.js");
13
+
14
+ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
15
+
16
+ var _Children = require("@instructure/ui-prop-types/lib/Children.js");
17
+
18
+ var _Checkbox = require("../Checkbox");
19
+
20
+ /*
21
+ * The MIT License (MIT)
22
+ *
23
+ * Copyright (c) 2015 - present Instructure, Inc.
24
+ *
25
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
26
+ * of this software and associated documentation files (the "Software"), to deal
27
+ * in the Software without restriction, including without limitation the rights
28
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29
+ * copies of the Software, and to permit persons to whom the Software is
30
+ * furnished to do so, subject to the following conditions:
31
+ *
32
+ * The above copyright notice and this permission notice shall be included in all
33
+ * copies or substantial portions of the Software.
34
+ *
35
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41
+ * SOFTWARE.
42
+ */
43
+ const propTypes = {
44
+ name: _propTypes.default.string.isRequired,
45
+ description: _propTypes.default.node.isRequired,
46
+
47
+ /**
48
+ * value to set on initial render
49
+ */
50
+ defaultValue: _propTypes.default.array,
51
+
52
+ /**
53
+ * the selected values (must be accompanied by an `onChange` prop)
54
+ */
55
+ value: (0, _controllable.controllable)(_propTypes.default.array),
56
+
57
+ /**
58
+ * when used with the `value` prop, the component will not control its own state
59
+ */
60
+ onChange: _propTypes.default.func,
61
+ disabled: _propTypes.default.bool,
62
+ readOnly: _propTypes.default.bool,
63
+
64
+ /**
65
+ * object with shape: `{
66
+ text: PropTypes.string,
67
+ type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
68
+ }`
69
+ */
70
+ messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
71
+
72
+ /**
73
+ * children of type `Checkbox`
74
+ */
75
+ children: _Children.Children.oneOf([_Checkbox.Checkbox]),
76
+ size: _propTypes.default.oneOf(['small', 'medium', 'large']),
77
+ layout: _propTypes.default.oneOf(['stacked', 'columns', 'inline'])
78
+ };
79
+ exports.propTypes = propTypes;
80
+ const allowedProps = ['name', 'description', 'defaultValue', 'value', 'onChange', 'disabled', 'readOnly', 'messages', 'children', 'size', 'layout'];
81
+ exports.allowedProps = allowedProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-checkbox",
3
- "version": "8.8.1-snapshot.3+d5d6d4cd8",
3
+ "version": "8.9.0",
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.8.1-snapshot.3+d5d6d4cd8",
29
- "@instructure/emotion": "8.8.1-snapshot.3+d5d6d4cd8",
30
- "@instructure/ui-dom-utils": "8.8.1-snapshot.3+d5d6d4cd8",
31
- "@instructure/ui-form-field": "8.8.1-snapshot.3+d5d6d4cd8",
32
- "@instructure/ui-icons": "8.8.1-snapshot.3+d5d6d4cd8",
33
- "@instructure/ui-prop-types": "8.8.1-snapshot.3+d5d6d4cd8",
34
- "@instructure/ui-react-utils": "8.8.1-snapshot.3+d5d6d4cd8",
35
- "@instructure/ui-svg-images": "8.8.1-snapshot.3+d5d6d4cd8",
36
- "@instructure/ui-testable": "8.8.1-snapshot.3+d5d6d4cd8",
37
- "@instructure/ui-utils": "8.8.1-snapshot.3+d5d6d4cd8",
38
- "@instructure/ui-view": "8.8.1-snapshot.3+d5d6d4cd8",
39
- "@instructure/uid": "8.8.1-snapshot.3+d5d6d4cd8",
28
+ "@instructure/console": "8.9.0",
29
+ "@instructure/emotion": "8.9.0",
30
+ "@instructure/shared-types": "8.9.0",
31
+ "@instructure/ui-dom-utils": "8.9.0",
32
+ "@instructure/ui-form-field": "8.9.0",
33
+ "@instructure/ui-icons": "8.9.0",
34
+ "@instructure/ui-prop-types": "8.9.0",
35
+ "@instructure/ui-react-utils": "8.9.0",
36
+ "@instructure/ui-svg-images": "8.9.0",
37
+ "@instructure/ui-testable": "8.9.0",
38
+ "@instructure/ui-utils": "8.9.0",
39
+ "@instructure/ui-view": "8.9.0",
40
+ "@instructure/uid": "8.9.0",
40
41
  "keycode": "^2",
41
42
  "prop-types": "^15"
42
43
  },
43
44
  "devDependencies": {
44
- "@instructure/shared-types": "8.8.1-snapshot.3+d5d6d4cd8",
45
- "@instructure/ui-babel-preset": "8.8.1-snapshot.3+d5d6d4cd8",
46
- "@instructure/ui-color-utils": "8.8.1-snapshot.3+d5d6d4cd8",
47
- "@instructure/ui-test-locator": "8.8.1-snapshot.3+d5d6d4cd8",
48
- "@instructure/ui-test-utils": "8.8.1-snapshot.3+d5d6d4cd8",
49
- "@instructure/ui-themes": "8.8.1-snapshot.3+d5d6d4cd8"
45
+ "@instructure/ui-babel-preset": "8.9.0",
46
+ "@instructure/ui-color-utils": "8.9.0",
47
+ "@instructure/ui-test-locator": "8.9.0",
48
+ "@instructure/ui-test-utils": "8.9.0",
49
+ "@instructure/ui-themes": "8.9.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": ">=16.8 <=17"
@@ -54,6 +54,5 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "sideEffects": false,
58
- "gitHead": "d5d6d4cd8f300e8635c69248f5d794c002269e08"
57
+ "sideEffects": false
59
58
  }
@@ -24,7 +24,6 @@
24
24
 
25
25
  /** @jsx jsx */
26
26
  import { Component } from 'react'
27
- import PropTypes from 'prop-types'
28
27
 
29
28
  import { SVGIcon } from '@instructure/ui-svg-images'
30
29
  import { IconCheckMarkSolid } from '@instructure/ui-icons'
@@ -33,7 +32,9 @@ import { withStyle, jsx } from '@instructure/emotion'
33
32
 
34
33
  import generateStyle from './styles'
35
34
  import generateComponentTheme from './theme'
36
- import { CheckboxFacadeProps } from './types'
35
+
36
+ import { propTypes, allowedProps } from './props'
37
+ import type { CheckboxFacadeProps } from './props'
37
38
 
38
39
  /**
39
40
  ---
@@ -44,22 +45,8 @@ parent: Checkbox
44
45
  class CheckboxFacade extends Component<CheckboxFacadeProps> {
45
46
  static readonly componentId = 'CheckboxFacade'
46
47
 
47
- static propTypes = {
48
- // eslint-disable-next-line react/require-default-props
49
- makeStyles: PropTypes.func,
50
- // eslint-disable-next-line react/require-default-props
51
- styles: PropTypes.object,
52
- children: PropTypes.node.isRequired,
53
- checked: PropTypes.bool,
54
- focused: PropTypes.bool,
55
- hovered: PropTypes.bool,
56
- size: PropTypes.oneOf(['small', 'medium', 'large']),
57
- /**
58
- * Visual state showing that child checkboxes are a combination of checked and unchecked
59
- */
60
- indeterminate: PropTypes.bool
61
- }
62
-
48
+ static propTypes = propTypes
49
+ static allowedProps = allowedProps
63
50
  static defaultProps = {
64
51
  checked: false,
65
52
  focused: false,
@@ -98,11 +85,11 @@ class CheckboxFacade extends Component<CheckboxFacadeProps> {
98
85
  const { children, styles } = this.props
99
86
 
100
87
  return (
101
- <span css={styles.checkboxFacade}>
102
- <span css={styles.facade} aria-hidden="true">
88
+ <span css={styles?.checkboxFacade}>
89
+ <span css={styles?.facade} aria-hidden="true">
103
90
  {this.renderIcon()}
104
91
  </span>
105
- <span css={styles.label}>{children}</span>
92
+ <span css={styles?.label}>{children}</span>
106
93
  </span>
107
94
  )
108
95
  }
@@ -0,0 +1,67 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import PropTypes from 'prop-types'
26
+
27
+ import type { PropValidators } from '@instructure/shared-types'
28
+ import type { WithStyleProps } from '@instructure/emotion'
29
+
30
+ type CheckboxFacadeOwnProps = {
31
+ children: React.ReactNode
32
+ checked?: boolean
33
+ focused?: boolean
34
+ hovered?: boolean
35
+ size?: 'small' | 'medium' | 'large'
36
+ indeterminate?: boolean
37
+ }
38
+
39
+ type PropKeys = keyof CheckboxFacadeOwnProps
40
+
41
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
42
+
43
+ type CheckboxFacadeProps = CheckboxFacadeOwnProps & WithStyleProps
44
+
45
+ const propTypes: PropValidators<PropKeys> = {
46
+ children: PropTypes.node.isRequired,
47
+ checked: PropTypes.bool,
48
+ focused: PropTypes.bool,
49
+ hovered: PropTypes.bool,
50
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
51
+ /**
52
+ * Visual state showing that child checkboxes are a combination of checked and unchecked
53
+ */
54
+ indeterminate: PropTypes.bool
55
+ }
56
+
57
+ const allowedProps: AllowedPropKeys = [
58
+ 'children',
59
+ 'checked',
60
+ 'focused',
61
+ 'hovered',
62
+ 'size',
63
+ 'indeterminate'
64
+ ]
65
+
66
+ export type { CheckboxFacadeProps }
67
+ export { propTypes, allowedProps }
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  import { CheckboxFacadeTheme } from '@instructure/shared-types'
26
- import { CheckboxFacadeProps } from './types'
26
+ import { CheckboxFacadeProps } from './props'
27
27
 
28
28
  /**
29
29
  * ---
@@ -24,7 +24,6 @@
24
24
 
25
25
  /** @jsx jsx */
26
26
  import { Component } from 'react'
27
- import PropTypes from 'prop-types'
28
27
 
29
28
  import { IconCheckSolid, IconXSolid } from '@instructure/ui-icons'
30
29
 
@@ -32,7 +31,9 @@ import { withStyle, jsx } from '@instructure/emotion'
32
31
 
33
32
  import generateStyle from './styles'
34
33
  import generateComponentTheme from './theme'
35
- import { ToggleFacadeProps } from './types'
34
+
35
+ import { propTypes, allowedProps } from './props'
36
+ import type { ToggleFacadeProps } from './props'
36
37
 
37
38
  /**
38
39
  ---
@@ -43,20 +44,8 @@ parent: Checkbox
43
44
  class ToggleFacade extends Component<ToggleFacadeProps> {
44
45
  static readonly componentId = 'ToggleFacade'
45
46
 
46
- static propTypes = {
47
- // eslint-disable-next-line react/require-default-props
48
- makeStyles: PropTypes.func,
49
- // eslint-disable-next-line react/require-default-props
50
- styles: PropTypes.object,
51
- children: PropTypes.node.isRequired,
52
- checked: PropTypes.bool,
53
- disabled: PropTypes.bool,
54
- readOnly: PropTypes.bool,
55
- focused: PropTypes.bool,
56
- size: PropTypes.oneOf(['small', 'medium', 'large']),
57
- labelPlacement: PropTypes.oneOf(['top', 'start', 'end'])
58
- }
59
-
47
+ static propTypes = propTypes
48
+ static allowedProps = allowedProps
60
49
  static defaultProps = {
61
50
  checked: false,
62
51
  focused: false,
@@ -81,28 +70,28 @@ class ToggleFacade extends Component<ToggleFacadeProps> {
81
70
  const { styles, checked } = this.props
82
71
 
83
72
  if (checked) {
84
- return <IconCheckSolid css={styles.iconSVG} />
73
+ return <IconCheckSolid css={styles?.iconSVG} />
85
74
  } else {
86
- return <IconXSolid css={styles.iconSVG} />
75
+ return <IconXSolid css={styles?.iconSVG} />
87
76
  }
88
77
  }
89
78
 
90
79
  renderLabel() {
91
80
  const { children, styles } = this.props
92
81
 
93
- return <span css={styles.label}>{children}</span>
82
+ return <span css={styles?.label}>{children}</span>
94
83
  }
95
84
 
96
85
  render() {
97
86
  const { labelPlacement, styles } = this.props
98
87
 
99
88
  return (
100
- <span css={styles.toggleFacade}>
89
+ <span css={styles?.toggleFacade}>
101
90
  {(labelPlacement === 'top' || labelPlacement === 'start') &&
102
91
  this.renderLabel()}
103
- <span css={styles.facade} aria-hidden="true">
104
- <span css={styles.icon}>
105
- <span css={styles.iconToggle}>{this.renderIcon()}</span>
92
+ <span css={styles?.facade} aria-hidden="true">
93
+ <span css={styles?.icon}>
94
+ <span css={styles?.iconToggle}>{this.renderIcon()}</span>
106
95
  </span>
107
96
  </span>
108
97
  {labelPlacement === 'end' && this.renderLabel()}
@@ -22,9 +22,13 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- export type ToggleFacadeProps = {
26
- makeStyles?: (...args: any[]) => any
27
- styles?: any
25
+ import PropTypes from 'prop-types'
26
+
27
+ import type { PropValidators } from '@instructure/shared-types'
28
+ import type { WithStyleProps } from '@instructure/emotion'
29
+
30
+ type ToggleFacadeOwnProps = {
31
+ children: React.ReactNode
28
32
  checked?: boolean
29
33
  disabled?: boolean
30
34
  readOnly?: boolean
@@ -32,3 +36,32 @@ export type ToggleFacadeProps = {
32
36
  size?: 'small' | 'medium' | 'large'
33
37
  labelPlacement?: 'top' | 'start' | 'end'
34
38
  }
39
+
40
+ type PropKeys = keyof ToggleFacadeOwnProps
41
+
42
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
43
+
44
+ type ToggleFacadeProps = ToggleFacadeOwnProps & WithStyleProps
45
+
46
+ const propTypes: PropValidators<PropKeys> = {
47
+ children: PropTypes.node.isRequired,
48
+ checked: PropTypes.bool,
49
+ disabled: PropTypes.bool,
50
+ readOnly: PropTypes.bool,
51
+ focused: PropTypes.bool,
52
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
53
+ labelPlacement: PropTypes.oneOf(['top', 'start', 'end'])
54
+ }
55
+
56
+ const allowedProps: AllowedPropKeys = [
57
+ 'children',
58
+ 'checked',
59
+ 'disabled',
60
+ 'readOnly',
61
+ 'focused',
62
+ 'size',
63
+ 'labelPlacement'
64
+ ]
65
+
66
+ export type { ToggleFacadeProps }
67
+ export { propTypes, allowedProps }