@instructure/ui-buttons 10.26.1-snapshot-2 → 10.26.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 (64) hide show
  1. package/CHANGELOG.md +5 -20
  2. package/es/BaseButton/index.js +6 -9
  3. package/es/BaseButton/props.js +26 -1
  4. package/es/Button/index.js +6 -6
  5. package/es/Button/props.js +20 -1
  6. package/es/CloseButton/index.js +8 -12
  7. package/es/CloseButton/props.js +18 -1
  8. package/es/CondensedButton/index.js +6 -6
  9. package/es/CondensedButton/props.js +17 -1
  10. package/es/IconButton/index.js +6 -7
  11. package/es/IconButton/props.js +21 -1
  12. package/es/ToggleButton/index.js +6 -10
  13. package/es/ToggleButton/props.js +19 -1
  14. package/lib/BaseButton/index.js +5 -8
  15. package/lib/BaseButton/props.js +27 -1
  16. package/lib/Button/index.js +5 -5
  17. package/lib/Button/props.js +21 -1
  18. package/lib/CloseButton/index.js +7 -11
  19. package/lib/CloseButton/props.js +19 -1
  20. package/lib/CondensedButton/index.js +5 -5
  21. package/lib/CondensedButton/props.js +18 -1
  22. package/lib/IconButton/index.js +5 -6
  23. package/lib/IconButton/props.js +22 -1
  24. package/lib/ToggleButton/index.js +5 -10
  25. package/lib/ToggleButton/props.js +20 -1
  26. package/package.json +23 -20
  27. package/src/BaseButton/index.tsx +4 -7
  28. package/src/BaseButton/props.ts +40 -3
  29. package/src/Button/index.tsx +5 -6
  30. package/src/Button/props.ts +33 -2
  31. package/src/CloseButton/index.tsx +6 -6
  32. package/src/CloseButton/props.ts +25 -3
  33. package/src/CondensedButton/index.tsx +4 -2
  34. package/src/CondensedButton/props.ts +22 -3
  35. package/src/IconButton/index.tsx +4 -3
  36. package/src/IconButton/props.ts +33 -2
  37. package/src/ToggleButton/index.tsx +5 -2
  38. package/src/ToggleButton/props.ts +31 -2
  39. package/tsconfig.build.json +2 -0
  40. package/tsconfig.build.tsbuildinfo +1 -1
  41. package/types/BaseButton/index.d.ts +2 -1
  42. package/types/BaseButton/index.d.ts.map +1 -1
  43. package/types/BaseButton/props.d.ts +4 -3
  44. package/types/BaseButton/props.d.ts.map +1 -1
  45. package/types/Button/index.d.ts +19 -1
  46. package/types/Button/index.d.ts.map +1 -1
  47. package/types/Button/props.d.ts +4 -3
  48. package/types/Button/props.d.ts.map +1 -1
  49. package/types/CloseButton/index.d.ts +17 -1
  50. package/types/CloseButton/index.d.ts.map +1 -1
  51. package/types/CloseButton/props.d.ts +4 -3
  52. package/types/CloseButton/props.d.ts.map +1 -1
  53. package/types/CondensedButton/index.d.ts +16 -1
  54. package/types/CondensedButton/index.d.ts.map +1 -1
  55. package/types/CondensedButton/props.d.ts +4 -3
  56. package/types/CondensedButton/props.d.ts.map +1 -1
  57. package/types/IconButton/index.d.ts +20 -1
  58. package/types/IconButton/index.d.ts.map +1 -1
  59. package/types/IconButton/props.d.ts +4 -3
  60. package/types/IconButton/props.d.ts.map +1 -1
  61. package/types/ToggleButton/index.d.ts +16 -0
  62. package/types/ToggleButton/index.d.ts.map +1 -1
  63. package/types/ToggleButton/props.d.ts +3 -2
  64. package/types/ToggleButton/props.d.ts.map +1 -1
@@ -23,6 +23,8 @@
23
23
  */
24
24
 
25
25
  import React from 'react'
26
+ import PropTypes from 'prop-types'
27
+
26
28
  import type { InteractionType } from '@instructure/ui-react-utils'
27
29
  import type {
28
30
  Spacing,
@@ -33,9 +35,10 @@ import type {
33
35
  ToProp,
34
36
  AsElementType,
35
37
  BaseButtonTheme,
36
- OtherHTMLAttributes
38
+ OtherHTMLAttributes,
39
+ PropValidators
37
40
  } from '@instructure/shared-types'
38
- import type { Cursor } from '@instructure/shared-types'
41
+ import type { Cursor } from '@instructure/ui-prop-types'
39
42
  import type { ViewProps } from '@instructure/ui-view'
40
43
  import { Renderable } from '@instructure/shared-types'
41
44
 
@@ -193,6 +196,40 @@ type BaseButtonStyle = ComponentStyle<
193
196
  | 'iconWrapper'
194
197
  | 'childrenWrapper'
195
198
  >
199
+
200
+ const propTypes: PropValidators<PropKeys> = {
201
+ children: PropTypes.node,
202
+ type: PropTypes.oneOf(['button', 'submit', 'reset']),
203
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
204
+ elementRef: PropTypes.func,
205
+ as: PropTypes.elementType,
206
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
207
+ color: PropTypes.oneOf([
208
+ 'primary',
209
+ 'primary-inverse',
210
+ 'secondary',
211
+ 'success',
212
+ 'danger',
213
+ 'ai-primary',
214
+ 'ai-secondary'
215
+ ]),
216
+ focusColor: PropTypes.oneOf(['info', 'inverse']),
217
+ display: PropTypes.oneOf(['inline-block', 'block']),
218
+ textAlign: PropTypes.oneOf(['start', 'center']),
219
+ shape: PropTypes.oneOf(['rectangle', 'circle']),
220
+ withBackground: PropTypes.bool,
221
+ withBorder: PropTypes.bool,
222
+ isCondensed: PropTypes.bool,
223
+ margin: PropTypes.string,
224
+ cursor: PropTypes.string,
225
+ href: PropTypes.string,
226
+ onClick: PropTypes.func,
227
+ onKeyDown: PropTypes.func,
228
+ renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
229
+ tabIndex: PropTypes.number,
230
+ withFocusOutline: PropTypes.bool
231
+ }
232
+
196
233
  const allowedProps: AllowedPropKeys = [
197
234
  'as',
198
235
  'children',
@@ -223,4 +260,4 @@ export type {
223
260
  BaseButtonStyleProps,
224
261
  BaseButtonStyle
225
262
  }
226
- export { allowedProps }
263
+ export { propTypes, allowedProps }
@@ -24,6 +24,7 @@
24
24
 
25
25
  import { Component } from 'react'
26
26
 
27
+ import { testable } from '@instructure/ui-testable'
27
28
  import { getInteraction, passthroughProps } from '@instructure/ui-react-utils'
28
29
 
29
30
  import { withStyle } from '@instructure/emotion'
@@ -31,7 +32,7 @@ import { withStyle } from '@instructure/emotion'
31
32
  import generateComponentTheme from './theme'
32
33
  import { BaseButton } from '../BaseButton'
33
34
 
34
- import { allowedProps } from './props'
35
+ import { propTypes, allowedProps } from './props'
35
36
  import type { ButtonProps } from './props'
36
37
 
37
38
  /**
@@ -41,9 +42,11 @@ category: components
41
42
  **/
42
43
  // needed for listing the available theme variables on docs page
43
44
  @withStyle(null, generateComponentTheme)
45
+ @testable()
44
46
  class Button extends Component<ButtonProps> {
45
47
  static readonly componentId = 'Button'
46
48
 
49
+ static propTypes = propTypes
47
50
  static allowedProps = allowedProps
48
51
  static defaultProps = {
49
52
  type: 'button',
@@ -127,11 +130,7 @@ class Button extends Component<ButtonProps> {
127
130
  themeOverride
128
131
  }
129
132
 
130
- return (
131
- <BaseButton {...buttonProps} data-cid="Button">
132
- {children}
133
- </BaseButton>
134
- )
133
+ return <BaseButton {...buttonProps}>{children}</BaseButton>
135
134
  }
136
135
  }
137
136
 
@@ -23,14 +23,17 @@
23
23
  */
24
24
 
25
25
  import React from 'react'
26
+ import PropTypes from 'prop-types'
27
+
26
28
  import type { Spacing, WithStyleProps } from '@instructure/emotion'
27
29
  import type {
28
30
  ToProp,
29
31
  AsElementType,
32
+ PropValidators,
30
33
  BaseButtonTheme,
31
34
  OtherHTMLAttributes
32
35
  } from '@instructure/shared-types'
33
- import type { Cursor } from '@instructure/shared-types'
36
+ import type { Cursor } from '@instructure/ui-prop-types'
34
37
  import type { ViewProps } from '@instructure/ui-view'
35
38
 
36
39
  type ButtonOwnProps = {
@@ -136,6 +139,34 @@ type ButtonProps = ButtonOwnProps &
136
139
  WithStyleProps<BaseButtonTheme, null> &
137
140
  OtherHTMLAttributes<ButtonOwnProps> &
138
141
  ToProp
142
+
143
+ const propTypes: PropValidators<PropKeys> = {
144
+ children: PropTypes.node,
145
+ type: PropTypes.oneOf(['button', 'submit', 'reset']),
146
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
147
+ elementRef: PropTypes.func,
148
+ as: PropTypes.elementType,
149
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
150
+ color: PropTypes.oneOf([
151
+ 'primary',
152
+ 'primary-inverse',
153
+ 'secondary',
154
+ 'success',
155
+ 'danger',
156
+ 'ai-primary',
157
+ 'ai-secondary'
158
+ ]),
159
+ focusColor: PropTypes.oneOf(['info', 'inverse']),
160
+ display: PropTypes.oneOf(['inline-block', 'block']),
161
+ textAlign: PropTypes.oneOf(['start', 'center']),
162
+ withBackground: PropTypes.bool,
163
+ margin: PropTypes.string,
164
+ cursor: PropTypes.string,
165
+ href: PropTypes.string,
166
+ renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
167
+ onClick: PropTypes.func
168
+ }
169
+
139
170
  const allowedProps: AllowedPropKeys = [
140
171
  'as',
141
172
  'children',
@@ -156,4 +187,4 @@ const allowedProps: AllowedPropKeys = [
156
187
  ]
157
188
 
158
189
  export type { ButtonProps }
159
- export { allowedProps }
190
+ export { propTypes, allowedProps }
@@ -26,6 +26,7 @@ import { Component } from 'react'
26
26
 
27
27
  import { IconXSolid } from '@instructure/ui-icons'
28
28
  import { ScreenReaderContent } from '@instructure/ui-a11y-content'
29
+ import { testable } from '@instructure/ui-testable'
29
30
  import { getInteraction, passthroughProps } from '@instructure/ui-react-utils'
30
31
 
31
32
  import { withStyle } from '@instructure/emotion'
@@ -34,7 +35,7 @@ import generateStyle from './styles'
34
35
  import generateComponentTheme from './theme'
35
36
  import { BaseButton } from '../BaseButton'
36
37
 
37
- import { allowedProps } from './props'
38
+ import { propTypes, allowedProps } from './props'
38
39
  import type { CloseButtonProps } from './props'
39
40
 
40
41
  /**
@@ -43,9 +44,11 @@ category: components
43
44
  ---
44
45
  **/
45
46
  @withStyle(generateStyle, generateComponentTheme)
47
+ @testable()
46
48
  class CloseButton extends Component<CloseButtonProps> {
47
49
  static readonly componentId = 'CloseButton'
48
50
 
51
+ static propTypes = propTypes
49
52
  static allowedProps = allowedProps
50
53
  static defaultProps = {
51
54
  // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
@@ -108,16 +111,14 @@ class CloseButton extends Component<CloseButtonProps> {
108
111
  <span
109
112
  {...passthroughProps(props)}
110
113
  css={styles?.closeButton}
111
- ref={(el) => {
112
- this.ref = el
113
- }}
114
+ ref={(el) => (this.ref = el)}
114
115
  >
115
116
  <BaseButton
116
117
  renderIcon={IconXSolid}
117
118
  elementRef={this.handleRef}
118
119
  interaction={this.interaction}
119
120
  type={type}
120
- {...(this.color ? { color: this.color } : {})}
121
+ color={this.color}
121
122
  size={size}
122
123
  onClick={onClick}
123
124
  margin={margin}
@@ -127,7 +128,6 @@ class CloseButton extends Component<CloseButtonProps> {
127
128
  href={href}
128
129
  cursor={cursor}
129
130
  tabIndex={tabIndex}
130
- data-cid="CloseButton"
131
131
  >
132
132
  <ScreenReaderContent>{screenReaderLabel}</ScreenReaderContent>
133
133
  </BaseButton>
@@ -23,6 +23,8 @@
23
23
  */
24
24
 
25
25
  import React from 'react'
26
+ import PropTypes from 'prop-types'
27
+
26
28
  import type {
27
29
  Spacing,
28
30
  WithStyleProps,
@@ -32,9 +34,10 @@ import type {
32
34
  ToProp,
33
35
  AsElementType,
34
36
  CloseButtonTheme,
35
- OtherHTMLAttributes
37
+ OtherHTMLAttributes,
38
+ PropValidators
36
39
  } from '@instructure/shared-types'
37
- import type { Cursor } from '@instructure/shared-types'
40
+ import type { Cursor } from '@instructure/ui-prop-types'
38
41
  import type { ViewProps } from '@instructure/ui-view'
39
42
 
40
43
  type CloseButtonOwnProps = {
@@ -127,6 +130,25 @@ type CloseButtonProps = CloseButtonOwnProps &
127
130
  ToProp
128
131
 
129
132
  type CloseButtonStyle = ComponentStyle<'closeButton'>
133
+
134
+ const propTypes: PropValidators<PropKeys> = {
135
+ screenReaderLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
136
+ .isRequired,
137
+ color: PropTypes.oneOf(['primary', 'primary-inverse']),
138
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
139
+ elementRef: PropTypes.func,
140
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
141
+ onClick: PropTypes.func,
142
+ margin: PropTypes.string,
143
+ placement: PropTypes.oneOf(['start', 'end', 'static']),
144
+ offset: PropTypes.oneOf(['none', 'x-small', 'small', 'medium']),
145
+ type: PropTypes.oneOf(['button', 'submit', 'reset']),
146
+ as: PropTypes.elementType,
147
+ href: PropTypes.string,
148
+ cursor: PropTypes.string,
149
+ tabIndex: PropTypes.number
150
+ }
151
+
130
152
  const allowedProps: AllowedPropKeys = [
131
153
  'as',
132
154
  'color',
@@ -145,4 +167,4 @@ const allowedProps: AllowedPropKeys = [
145
167
  ]
146
168
 
147
169
  export type { CloseButtonProps, CloseButtonStyle }
148
- export { allowedProps }
170
+ export { propTypes, allowedProps }
@@ -24,6 +24,7 @@
24
24
 
25
25
  import { Component } from 'react'
26
26
 
27
+ import { testable } from '@instructure/ui-testable'
27
28
  import { passthroughProps } from '@instructure/ui-react-utils'
28
29
 
29
30
  import { withStyle } from '@instructure/emotion'
@@ -31,7 +32,7 @@ import { withStyle } from '@instructure/emotion'
31
32
  import generateComponentTheme from './theme'
32
33
  import { BaseButton } from '../BaseButton'
33
34
 
34
- import { allowedProps } from './props'
35
+ import { propTypes, allowedProps } from './props'
35
36
  import type { CondensedButtonProps } from './props'
36
37
 
37
38
  /**
@@ -41,9 +42,11 @@ category: components
41
42
  **/
42
43
  // needed for listing the available theme variables on docs page
43
44
  @withStyle(null, generateComponentTheme)
45
+ @testable()
44
46
  class CondensedButton extends Component<CondensedButtonProps> {
45
47
  static readonly componentId = 'CondensedButton'
46
48
 
49
+ static propTypes = propTypes
47
50
  static allowedProps = allowedProps
48
51
  static defaultProps = {
49
52
  type: 'button',
@@ -119,7 +122,6 @@ class CondensedButton extends Component<CondensedButtonProps> {
119
122
  ref={(component) => {
120
123
  this._baseButton = component
121
124
  }}
122
- data-cid="CondensedButton"
123
125
  >
124
126
  {children}
125
127
  </BaseButton>
@@ -23,14 +23,17 @@
23
23
  */
24
24
 
25
25
  import React from 'react'
26
+ import PropTypes from 'prop-types'
27
+
26
28
  import type { Spacing, WithStyleProps } from '@instructure/emotion'
27
29
  import type {
28
30
  ToProp,
29
31
  AsElementType,
30
32
  BaseButtonTheme,
31
- OtherHTMLAttributes
33
+ OtherHTMLAttributes,
34
+ PropValidators
32
35
  } from '@instructure/shared-types'
33
- import type { Cursor } from '@instructure/shared-types'
36
+ import type { Cursor } from '@instructure/ui-prop-types'
34
37
  import type { ViewProps } from '@instructure/ui-view'
35
38
 
36
39
  type CondensedButtonOwnProps = {
@@ -114,6 +117,22 @@ type CondensedButtonProps = CondensedButtonOwnProps &
114
117
  OtherHTMLAttributes<CondensedButtonOwnProps> &
115
118
  ToProp
116
119
 
120
+ const propTypes: PropValidators<PropKeys> = {
121
+ children: PropTypes.node,
122
+ type: PropTypes.oneOf(['button', 'submit', 'reset']),
123
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
124
+ elementRef: PropTypes.func,
125
+ as: PropTypes.elementType,
126
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
127
+ color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary']),
128
+ margin: PropTypes.string,
129
+ cursor: PropTypes.string,
130
+ href: PropTypes.string,
131
+ renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
132
+ onClick: PropTypes.func,
133
+ display: PropTypes.oneOf(['inline-block', 'block'])
134
+ }
135
+
117
136
  const allowedProps: AllowedPropKeys = [
118
137
  'as',
119
138
  'children',
@@ -131,4 +150,4 @@ const allowedProps: AllowedPropKeys = [
131
150
  ]
132
151
 
133
152
  export type { CondensedButtonProps }
134
- export { allowedProps }
153
+ export { propTypes, allowedProps }
@@ -24,16 +24,16 @@
24
24
 
25
25
  import { Component } from 'react'
26
26
 
27
+ import { testable } from '@instructure/ui-testable'
27
28
  import { passthroughProps } from '@instructure/ui-react-utils'
28
29
  import { ScreenReaderContent } from '@instructure/ui-a11y-content'
29
- import { combineDataCid } from '@instructure/ui-utils'
30
30
 
31
31
  import { withStyle } from '@instructure/emotion'
32
32
 
33
33
  import generateComponentTheme from './theme'
34
34
  import { BaseButton } from '../BaseButton'
35
35
 
36
- import { allowedProps } from './props'
36
+ import { propTypes, allowedProps } from './props'
37
37
  import type { IconButtonProps } from './props'
38
38
 
39
39
  /**
@@ -44,9 +44,11 @@ category: components
44
44
 
45
45
  // needed for listing the available theme variables on docs page
46
46
  @withStyle(null, generateComponentTheme)
47
+ @testable()
47
48
  class IconButton extends Component<IconButtonProps> {
48
49
  static readonly componentId = 'IconButton'
49
50
 
51
+ static propTypes = propTypes
50
52
  static allowedProps = allowedProps
51
53
  static defaultProps = {
52
54
  type: 'button',
@@ -128,7 +130,6 @@ class IconButton extends Component<IconButtonProps> {
128
130
  ref={(component) => {
129
131
  this._baseButton = component
130
132
  }}
131
- data-cid={combineDataCid('IconButton', this.props)}
132
133
  >
133
134
  <ScreenReaderContent>{screenReaderLabel}</ScreenReaderContent>
134
135
  </BaseButton>
@@ -23,16 +23,18 @@
23
23
  */
24
24
 
25
25
  import { ReactNode } from 'react'
26
+ import PropTypes from 'prop-types'
26
27
 
27
28
  import type { Spacing, WithStyleProps } from '@instructure/emotion'
28
29
  import type {
29
30
  ToProp,
30
31
  AsElementType,
32
+ PropValidators,
31
33
  BaseButtonTheme,
32
34
  OtherHTMLAttributes,
33
35
  Renderable
34
36
  } from '@instructure/shared-types'
35
- import type { Cursor } from '@instructure/shared-types'
37
+ import type { Cursor } from '@instructure/ui-prop-types'
36
38
  import type { ViewProps } from '@instructure/ui-view'
37
39
 
38
40
  type IconButtonOwnProps = {
@@ -142,6 +144,35 @@ type IconButtonProps = IconButtonOwnProps &
142
144
  WithStyleProps<BaseButtonTheme, null> &
143
145
  OtherHTMLAttributes<IconButtonOwnProps> &
144
146
  ToProp
147
+
148
+ const propTypes: PropValidators<PropKeys> = {
149
+ children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
150
+ renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
151
+ screenReaderLabel: PropTypes.string.isRequired,
152
+ type: PropTypes.oneOf(['button', 'submit', 'reset']),
153
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
154
+ elementRef: PropTypes.func,
155
+ as: PropTypes.elementType,
156
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
157
+ color: PropTypes.oneOf([
158
+ 'primary',
159
+ 'primary-inverse',
160
+ 'secondary',
161
+ 'success',
162
+ 'danger',
163
+ 'ai-primary',
164
+ 'ai-secondary'
165
+ ]),
166
+ focusColor: PropTypes.oneOf(['info', 'inverse']),
167
+ shape: PropTypes.oneOf(['rectangle', 'circle']),
168
+ withBackground: PropTypes.bool,
169
+ withBorder: PropTypes.bool,
170
+ margin: PropTypes.string,
171
+ cursor: PropTypes.string,
172
+ href: PropTypes.string,
173
+ onClick: PropTypes.func
174
+ }
175
+
145
176
  const allowedProps: AllowedPropKeys = [
146
177
  'as',
147
178
  'children',
@@ -163,4 +194,4 @@ const allowedProps: AllowedPropKeys = [
163
194
  ]
164
195
 
165
196
  export type { IconButtonProps }
166
- export { allowedProps }
197
+ export { propTypes, allowedProps }
@@ -24,12 +24,14 @@
24
24
 
25
25
  import { Component } from 'react'
26
26
 
27
+ import { testable } from '@instructure/ui-testable'
28
+
27
29
  import { callRenderProp, passthroughProps } from '@instructure/ui-react-utils'
28
30
 
29
31
  import { Tooltip } from '@instructure/ui-tooltip'
30
32
  import { IconButton } from '../IconButton'
31
33
 
32
- import { allowedProps } from './props'
34
+ import { propTypes, allowedProps } from './props'
33
35
  import type { ToggleButtonProps, ToggleButtonState } from './props'
34
36
 
35
37
  /**
@@ -38,9 +40,11 @@ category: components
38
40
  ---
39
41
  **/
40
42
 
43
+ @testable()
41
44
  class ToggleButton extends Component<ToggleButtonProps, ToggleButtonState> {
42
45
  static readonly componentId = 'ToggleButton'
43
46
 
47
+ static propTypes = propTypes
44
48
  static allowedProps = allowedProps
45
49
  static defaultProps = {
46
50
  size: 'medium',
@@ -121,7 +125,6 @@ class ToggleButton extends Component<ToggleButtonProps, ToggleButtonState> {
121
125
  onClick={onClick}
122
126
  interaction={interaction}
123
127
  aria-pressed={status === 'pressed'}
124
- data-cid="ToggleButton"
125
128
  >
126
129
  {callRenderProp(renderIcon)}
127
130
  </IconButton>
@@ -23,10 +23,14 @@
23
23
  */
24
24
 
25
25
  import React from 'react'
26
+ import PropTypes from 'prop-types'
27
+
28
+ import { PositionPropTypes } from '@instructure/ui-position'
26
29
 
27
30
  import type {
28
31
  AsElementType,
29
- OtherHTMLAttributes
32
+ OtherHTMLAttributes,
33
+ PropValidators
30
34
  } from '@instructure/shared-types'
31
35
  import type {
32
36
  PlacementPropValues,
@@ -122,6 +126,31 @@ type ToggleButtonProps = ToggleButtonOwnProps &
122
126
  type ToggleButtonState = {
123
127
  isShowingTooltip: boolean
124
128
  }
129
+
130
+ const propTypes: PropValidators<PropKeys> = {
131
+ screenReaderLabel: PropTypes.string.isRequired,
132
+ renderTooltipContent: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
133
+ .isRequired,
134
+ renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
135
+ status: PropTypes.oneOf(['pressed', 'unpressed']).isRequired,
136
+ as: PropTypes.elementType,
137
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
138
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
139
+ elementRef: PropTypes.func,
140
+ onClick: PropTypes.func,
141
+ color: PropTypes.oneOf([
142
+ 'primary',
143
+ 'primary-inverse',
144
+ 'secondary',
145
+ 'success',
146
+ 'danger'
147
+ ]),
148
+ isShowingTooltip: PropTypes.bool,
149
+ mountNode: PositionPropTypes.mountNode,
150
+ placement: PositionPropTypes.placement,
151
+ constrain: PositionPropTypes.constrain
152
+ }
153
+
125
154
  const allowedProps: AllowedPropKeys = [
126
155
  'as',
127
156
  'color',
@@ -140,4 +169,4 @@ const allowedProps: AllowedPropKeys = [
140
169
  ]
141
170
 
142
171
  export type { ToggleButtonProps, ToggleButtonState }
143
- export { allowedProps }
172
+ export { propTypes, allowedProps }
@@ -17,8 +17,10 @@
17
17
  { "path": "../ui-color-utils/tsconfig.build.json" },
18
18
  { "path": "../ui-dom-utils/tsconfig.build.json" },
19
19
  { "path": "../ui-icons/tsconfig.build.json" },
20
+ { "path": "../ui-prop-types/tsconfig.build.json" },
20
21
  { "path": "../ui-position/tsconfig.build.json" },
21
22
  { "path": "../ui-react-utils/tsconfig.build.json" },
23
+ { "path": "../ui-testable/tsconfig.build.json" },
22
24
  { "path": "../ui-tooltip/tsconfig.build.json" },
23
25
  { "path": "../ui-utils/tsconfig.build.json" },
24
26
  { "path": "../ui-view/tsconfig.build.json" },