@instructure/ui-buttons 10.26.1-snapshot-2 → 10.26.1

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 +1 -24
  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
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [10.26.1-snapshot-2](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1-snapshot-2) (2025-10-06)
6
+ ## [10.26.1](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1) (2025-10-06)
7
7
 
8
8
 
9
9
  ### Bug Fixes
@@ -11,29 +11,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
  * **ui-buttons:** fix focus ring distortion on circle shape buttons ([04e93c8](https://github.com/instructure/instructure-ui/commit/04e93c82d4c58b1d8b783933dfdeeb183f2c1335))
12
12
 
13
13
 
14
- ### Features
15
-
16
- * **many:** instUI v11 release ([36f5438](https://github.com/instructure/instructure-ui/commit/36f54382669186227ba24798bbf7201ef2f5cd4c))
17
-
18
-
19
- ### BREAKING CHANGES
20
-
21
- * **many:** InstUI v11 contains the following breaking changes:
22
- - React 16 and 17 are no longer supported
23
- - remove `PropTypes` from all packages
24
- - remove `CodeEditor` component
25
- - remove `@instui/theme-registry` package
26
- - remove `@testable`, `@experimental`, `@hack` decorators
27
- - InstUISettingsProvider's `as` prop is removed
28
- - `canvas.use()`, `canvasHighContrast.use()` functions are removed
29
- - `canvasThemeLocal`, `canvasHighContrastThemeLocal` are removed
30
- - `variables` field on theme objects are removed
31
- - remove deprecated props from Table: Row's `isStacked`, Body's
32
- `isStacked`, `hover`, and `headers`
33
- - `Table`'s `caption` prop is now required
34
- - `ui-dom-utils`'s `getComputedStyle` can now return `undefined`
35
-
36
-
37
14
 
38
15
 
39
16
 
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["type", "size", "elementRef", "as", "href", "color", "focusColor", "textAlign", "shape", "display", "withBackground", "withBorder", "isCondensed", "margin", "cursor", "onClick", "renderIcon", "tabIndex", "styles", "makeStyles", "withFocusOutline"];
3
- var _dec, _class, _BaseButton;
3
+ var _dec, _dec2, _class, _BaseButton;
4
4
  /*
5
5
  * The MIT License (MIT)
6
6
  *
@@ -27,25 +27,23 @@ var _dec, _class, _BaseButton;
27
27
 
28
28
  import { Component } from 'react';
29
29
  import keycode from 'keycode';
30
+ import { testable } from '@instructure/ui-testable';
30
31
  import { getElementType, getInteraction, passthroughProps, callRenderProp } from '@instructure/ui-react-utils';
31
32
  import { isActiveElement } from '@instructure/ui-dom-utils';
32
33
  import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
33
34
  import { View } from '@instructure/ui-view';
34
- // TODO these have to be imported in separate lines because otherwise `isSafari` will be missing from the babel build
35
- // this bug is very likely caused by `babel-plugin-transform-imports` and can be reverted once it is removed from the codebase
36
35
  import { isSafari } from '@instructure/ui-utils';
37
- import { combineDataCid } from '@instructure/ui-utils';
38
36
  import { withStyle } from '@instructure/emotion';
39
37
  import generateStyles from './styles';
40
38
  import generateComponentTheme from './theme';
41
- import { allowedProps } from './props';
39
+ import { propTypes, allowedProps } from './props';
42
40
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
43
41
  /**
44
42
  ---
45
43
  category: components/utilities
46
44
  ---
47
45
  **/
48
- let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec(_class = (_BaseButton = class BaseButton extends Component {
46
+ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_BaseButton = class BaseButton extends Component {
49
47
  constructor(...args) {
50
48
  super(...args);
51
49
  this.ref = null;
@@ -256,14 +254,13 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
256
254
  disabled: isDisabled || isReadOnly,
257
255
  css: styles === null || styles === void 0 ? void 0 : styles.baseButton,
258
256
  withFocusOutline: withFocusOutline,
259
- "data-cid": combineDataCid('BaseButton', this.props),
260
257
  children: _jsx("span", {
261
258
  css: styles === null || styles === void 0 ? void 0 : styles.content,
262
259
  children: this.renderChildren()
263
260
  })
264
261
  });
265
262
  }
266
- }, _BaseButton.displayName = "BaseButton", _BaseButton.componentId = 'BaseButton', _BaseButton.allowedProps = allowedProps, _BaseButton.defaultProps = {
263
+ }, _BaseButton.displayName = "BaseButton", _BaseButton.componentId = 'BaseButton', _BaseButton.propTypes = propTypes, _BaseButton.allowedProps = allowedProps, _BaseButton.defaultProps = {
267
264
  type: 'button',
268
265
  size: 'medium',
269
266
  as: 'button',
@@ -278,6 +275,6 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
278
275
  isCondensed: false,
279
276
  margin: '0',
280
277
  cursor: 'pointer'
281
- }, _BaseButton)) || _class);
278
+ }, _BaseButton)) || _class) || _class);
282
279
  export { BaseButton };
283
280
  export default BaseButton;
@@ -22,5 +22,30 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ import PropTypes from 'prop-types';
26
+ const propTypes = {
27
+ children: PropTypes.node,
28
+ type: PropTypes.oneOf(['button', 'submit', 'reset']),
29
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
30
+ elementRef: PropTypes.func,
31
+ as: PropTypes.elementType,
32
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
33
+ color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger', 'ai-primary', 'ai-secondary']),
34
+ focusColor: PropTypes.oneOf(['info', 'inverse']),
35
+ display: PropTypes.oneOf(['inline-block', 'block']),
36
+ textAlign: PropTypes.oneOf(['start', 'center']),
37
+ shape: PropTypes.oneOf(['rectangle', 'circle']),
38
+ withBackground: PropTypes.bool,
39
+ withBorder: PropTypes.bool,
40
+ isCondensed: PropTypes.bool,
41
+ margin: PropTypes.string,
42
+ cursor: PropTypes.string,
43
+ href: PropTypes.string,
44
+ onClick: PropTypes.func,
45
+ onKeyDown: PropTypes.func,
46
+ renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
47
+ tabIndex: PropTypes.number,
48
+ withFocusOutline: PropTypes.bool
49
+ };
25
50
  const allowedProps = ['as', 'children', 'color', 'cursor', 'display', 'elementRef', 'focusColor', 'href', 'interaction', 'isCondensed', 'margin', 'onClick', 'onKeyDown', 'renderIcon', 'shape', 'size', 'tabIndex', 'textAlign', 'type', 'withBackground', 'withBorder'];
26
- export { allowedProps };
51
+ export { propTypes, allowedProps };
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["children", "type", "size", "as", "color", "focusColor", "display", "textAlign", "withBackground", "margin", "cursor", "href", "renderIcon"];
3
- var _dec, _class, _Button;
3
+ var _dec, _dec2, _class, _Button;
4
4
  /*
5
5
  * The MIT License (MIT)
6
6
  *
@@ -26,11 +26,12 @@ var _dec, _class, _Button;
26
26
  */
27
27
 
28
28
  import { Component } from 'react';
29
+ import { testable } from '@instructure/ui-testable';
29
30
  import { getInteraction, passthroughProps } from '@instructure/ui-react-utils';
30
31
  import { withStyle } from '@instructure/emotion';
31
32
  import generateComponentTheme from './theme';
32
33
  import { BaseButton } from '../BaseButton';
33
- import { allowedProps } from './props';
34
+ import { propTypes, allowedProps } from './props';
34
35
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
35
36
  /**
36
37
  ---
@@ -38,7 +39,7 @@ category: components
38
39
  ---
39
40
  **/
40
41
  // needed for listing the available theme variables on docs page
41
- let Button = (_dec = withStyle(null, generateComponentTheme), _dec(_class = (_Button = class Button extends Component {
42
+ let Button = (_dec = withStyle(null, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_Button = class Button extends Component {
42
43
  constructor(...args) {
43
44
  super(...args);
44
45
  this._buttonComponent = null;
@@ -101,11 +102,10 @@ let Button = (_dec = withStyle(null, generateComponentTheme), _dec(_class = (_Bu
101
102
  };
102
103
  return _jsx(BaseButton, {
103
104
  ...buttonProps,
104
- "data-cid": "Button",
105
105
  children: children
106
106
  });
107
107
  }
108
- }, _Button.displayName = "Button", _Button.componentId = 'Button', _Button.allowedProps = allowedProps, _Button.defaultProps = {
108
+ }, _Button.displayName = "Button", _Button.componentId = 'Button', _Button.propTypes = propTypes, _Button.allowedProps = allowedProps, _Button.defaultProps = {
109
109
  type: 'button',
110
110
  size: 'medium',
111
111
  as: 'button',
@@ -117,6 +117,6 @@ let Button = (_dec = withStyle(null, generateComponentTheme), _dec(_class = (_Bu
117
117
  withBackground: true,
118
118
  margin: '0',
119
119
  cursor: 'pointer'
120
- }, _Button)) || _class);
120
+ }, _Button)) || _class) || _class);
121
121
  export default Button;
122
122
  export { Button };
@@ -22,5 +22,24 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ import PropTypes from 'prop-types';
26
+ const propTypes = {
27
+ children: PropTypes.node,
28
+ type: PropTypes.oneOf(['button', 'submit', 'reset']),
29
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
30
+ elementRef: PropTypes.func,
31
+ as: PropTypes.elementType,
32
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
33
+ color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger', 'ai-primary', 'ai-secondary']),
34
+ focusColor: PropTypes.oneOf(['info', 'inverse']),
35
+ display: PropTypes.oneOf(['inline-block', 'block']),
36
+ textAlign: PropTypes.oneOf(['start', 'center']),
37
+ withBackground: PropTypes.bool,
38
+ margin: PropTypes.string,
39
+ cursor: PropTypes.string,
40
+ href: PropTypes.string,
41
+ renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
42
+ onClick: PropTypes.func
43
+ };
25
44
  const allowedProps = ['as', 'children', 'color', 'cursor', 'display', 'elementRef', 'focusColor', 'href', 'interaction', 'margin', 'renderIcon', 'size', 'textAlign', 'type', 'withBackground', 'onClick'];
26
- export { allowedProps };
45
+ export { propTypes, allowedProps };
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["screenReaderLabel", "elementRef", "size", "onClick", "margin", "placement", "offset", "type", "as", "href", "cursor", "tabIndex", "styles"];
3
- var _dec, _class, _CloseButton;
3
+ var _dec, _dec2, _class, _CloseButton;
4
4
  /*
5
5
  * The MIT License (MIT)
6
6
  *
@@ -28,19 +28,20 @@ var _dec, _class, _CloseButton;
28
28
  import { Component } from 'react';
29
29
  import { IconXSolid } from '@instructure/ui-icons';
30
30
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
31
+ import { testable } from '@instructure/ui-testable';
31
32
  import { getInteraction, passthroughProps } from '@instructure/ui-react-utils';
32
33
  import { withStyle } from '@instructure/emotion';
33
34
  import generateStyle from './styles';
34
35
  import generateComponentTheme from './theme';
35
36
  import { BaseButton } from '../BaseButton';
36
- import { allowedProps } from './props';
37
+ import { propTypes, allowedProps } from './props';
37
38
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
38
39
  /**
39
40
  ---
40
41
  category: components
41
42
  ---
42
43
  **/
43
- let CloseButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_CloseButton = class CloseButton extends Component {
44
+ let CloseButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_CloseButton = class CloseButton extends Component {
44
45
  constructor(...args) {
45
46
  super(...args);
46
47
  this.ref = null;
@@ -87,17 +88,13 @@ let CloseButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
87
88
  return _jsx("span", {
88
89
  ...passthroughProps(props),
89
90
  css: styles === null || styles === void 0 ? void 0 : styles.closeButton,
90
- ref: el => {
91
- this.ref = el;
92
- },
91
+ ref: el => this.ref = el,
93
92
  children: _jsx(BaseButton, {
94
93
  renderIcon: IconXSolid,
95
94
  elementRef: this.handleRef,
96
95
  interaction: this.interaction,
97
96
  type: type,
98
- ...(this.color ? {
99
- color: this.color
100
- } : {}),
97
+ color: this.color,
101
98
  size: size,
102
99
  onClick: onClick,
103
100
  margin: margin,
@@ -107,14 +104,13 @@ let CloseButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
107
104
  href: href,
108
105
  cursor: cursor,
109
106
  tabIndex: tabIndex,
110
- "data-cid": "CloseButton",
111
107
  children: _jsx(ScreenReaderContent, {
112
108
  children: screenReaderLabel
113
109
  })
114
110
  })
115
111
  });
116
112
  }
117
- }, _CloseButton.displayName = "CloseButton", _CloseButton.componentId = 'CloseButton', _CloseButton.allowedProps = allowedProps, _CloseButton.defaultProps = {
113
+ }, _CloseButton.displayName = "CloseButton", _CloseButton.componentId = 'CloseButton', _CloseButton.propTypes = propTypes, _CloseButton.allowedProps = allowedProps, _CloseButton.defaultProps = {
118
114
  // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
119
115
  interaction: void 0,
120
116
  type: 'button',
@@ -124,6 +120,6 @@ let CloseButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
124
120
  margin: '0',
125
121
  as: 'button',
126
122
  cursor: 'pointer'
127
- }, _CloseButton)) || _class);
123
+ }, _CloseButton)) || _class) || _class);
128
124
  export default CloseButton;
129
125
  export { CloseButton };
@@ -22,5 +22,22 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ import PropTypes from 'prop-types';
26
+ const propTypes = {
27
+ screenReaderLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
28
+ color: PropTypes.oneOf(['primary', 'primary-inverse']),
29
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
30
+ elementRef: PropTypes.func,
31
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
32
+ onClick: PropTypes.func,
33
+ margin: PropTypes.string,
34
+ placement: PropTypes.oneOf(['start', 'end', 'static']),
35
+ offset: PropTypes.oneOf(['none', 'x-small', 'small', 'medium']),
36
+ type: PropTypes.oneOf(['button', 'submit', 'reset']),
37
+ as: PropTypes.elementType,
38
+ href: PropTypes.string,
39
+ cursor: PropTypes.string,
40
+ tabIndex: PropTypes.number
41
+ };
25
42
  const allowedProps = ['as', 'color', 'cursor', 'elementRef', 'href', 'interaction', 'margin', 'offset', 'onClick', 'placement', 'screenReaderLabel', 'size', 'tabIndex', 'type'];
26
- export { allowedProps };
43
+ export { propTypes, allowedProps };
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["children", "type", "size", "elementRef", "as", "interaction", "color", "margin", "cursor", "href", "renderIcon", "display"];
3
- var _dec, _class, _CondensedButton;
3
+ var _dec, _dec2, _class, _CondensedButton;
4
4
  /*
5
5
  * The MIT License (MIT)
6
6
  *
@@ -26,11 +26,12 @@ var _dec, _class, _CondensedButton;
26
26
  */
27
27
 
28
28
  import { Component } from 'react';
29
+ import { testable } from '@instructure/ui-testable';
29
30
  import { passthroughProps } from '@instructure/ui-react-utils';
30
31
  import { withStyle } from '@instructure/emotion';
31
32
  import generateComponentTheme from './theme';
32
33
  import { BaseButton } from '../BaseButton';
33
- import { allowedProps } from './props';
34
+ import { propTypes, allowedProps } from './props';
34
35
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
35
36
  /**
36
37
  ---
@@ -38,7 +39,7 @@ category: components
38
39
  ---
39
40
  **/
40
41
  // needed for listing the available theme variables on docs page
41
- let CondensedButton = (_dec = withStyle(null, generateComponentTheme), _dec(_class = (_CondensedButton = class CondensedButton extends Component {
42
+ let CondensedButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_CondensedButton = class CondensedButton extends Component {
42
43
  constructor(...args) {
43
44
  super(...args);
44
45
  this._baseButton = null;
@@ -93,11 +94,10 @@ let CondensedButton = (_dec = withStyle(null, generateComponentTheme), _dec(_cla
93
94
  ref: component => {
94
95
  this._baseButton = component;
95
96
  },
96
- "data-cid": "CondensedButton",
97
97
  children: children
98
98
  });
99
99
  }
100
- }, _CondensedButton.displayName = "CondensedButton", _CondensedButton.componentId = 'CondensedButton', _CondensedButton.allowedProps = allowedProps, _CondensedButton.defaultProps = {
100
+ }, _CondensedButton.displayName = "CondensedButton", _CondensedButton.componentId = 'CondensedButton', _CondensedButton.propTypes = propTypes, _CondensedButton.allowedProps = allowedProps, _CondensedButton.defaultProps = {
101
101
  type: 'button',
102
102
  size: 'medium',
103
103
  as: 'button',
@@ -107,6 +107,6 @@ let CondensedButton = (_dec = withStyle(null, generateComponentTheme), _dec(_cla
107
107
  margin: '0',
108
108
  cursor: 'pointer',
109
109
  display: 'inline-block'
110
- }, _CondensedButton)) || _class);
110
+ }, _CondensedButton)) || _class) || _class);
111
111
  export default CondensedButton;
112
112
  export { CondensedButton };
@@ -22,5 +22,21 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ import PropTypes from 'prop-types';
26
+ const propTypes = {
27
+ children: PropTypes.node,
28
+ type: PropTypes.oneOf(['button', 'submit', 'reset']),
29
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
30
+ elementRef: PropTypes.func,
31
+ as: PropTypes.elementType,
32
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
33
+ color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary']),
34
+ margin: PropTypes.string,
35
+ cursor: PropTypes.string,
36
+ href: PropTypes.string,
37
+ renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
38
+ onClick: PropTypes.func,
39
+ display: PropTypes.oneOf(['inline-block', 'block'])
40
+ };
25
41
  const allowedProps = ['as', 'children', 'color', 'cursor', 'elementRef', 'href', 'interaction', 'margin', 'renderIcon', 'size', 'type', 'onClick', 'display'];
26
- export { allowedProps };
42
+ export { propTypes, allowedProps };
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["children", "renderIcon", "screenReaderLabel", "type", "size", "elementRef", "as", "interaction", "color", "focusColor", "shape", "withBackground", "withBorder", "margin", "cursor", "href"];
3
- var _dec, _class, _IconButton;
3
+ var _dec, _dec2, _class, _IconButton;
4
4
  /*
5
5
  * The MIT License (MIT)
6
6
  *
@@ -26,13 +26,13 @@ var _dec, _class, _IconButton;
26
26
  */
27
27
 
28
28
  import { Component } from 'react';
29
+ import { testable } from '@instructure/ui-testable';
29
30
  import { passthroughProps } from '@instructure/ui-react-utils';
30
31
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
31
- import { combineDataCid } from '@instructure/ui-utils';
32
32
  import { withStyle } from '@instructure/emotion';
33
33
  import generateComponentTheme from './theme';
34
34
  import { BaseButton } from '../BaseButton';
35
- import { allowedProps } from './props';
35
+ import { propTypes, allowedProps } from './props';
36
36
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
37
37
  /**
38
38
  ---
@@ -40,7 +40,7 @@ category: components
40
40
  ---
41
41
  **/
42
42
  // needed for listing the available theme variables on docs page
43
- let IconButton = (_dec = withStyle(null, generateComponentTheme), _dec(_class = (_IconButton = class IconButton extends Component {
43
+ let IconButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_IconButton = class IconButton extends Component {
44
44
  constructor(...args) {
45
45
  super(...args);
46
46
  this._baseButton = null;
@@ -99,13 +99,12 @@ let IconButton = (_dec = withStyle(null, generateComponentTheme), _dec(_class =
99
99
  ref: component => {
100
100
  this._baseButton = component;
101
101
  },
102
- "data-cid": combineDataCid('IconButton', this.props),
103
102
  children: _jsx(ScreenReaderContent, {
104
103
  children: screenReaderLabel
105
104
  })
106
105
  });
107
106
  }
108
- }, _IconButton.displayName = "IconButton", _IconButton.componentId = 'IconButton', _IconButton.allowedProps = allowedProps, _IconButton.defaultProps = {
107
+ }, _IconButton.displayName = "IconButton", _IconButton.componentId = 'IconButton', _IconButton.propTypes = propTypes, _IconButton.allowedProps = allowedProps, _IconButton.defaultProps = {
109
108
  type: 'button',
110
109
  size: 'medium',
111
110
  as: 'button',
@@ -117,6 +116,6 @@ let IconButton = (_dec = withStyle(null, generateComponentTheme), _dec(_class =
117
116
  withBorder: true,
118
117
  margin: '0',
119
118
  cursor: 'pointer'
120
- }, _IconButton)) || _class);
119
+ }, _IconButton)) || _class) || _class);
121
120
  export default IconButton;
122
121
  export { IconButton };
@@ -22,5 +22,25 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ import PropTypes from 'prop-types';
26
+ const propTypes = {
27
+ children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
28
+ renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
29
+ screenReaderLabel: PropTypes.string.isRequired,
30
+ type: PropTypes.oneOf(['button', 'submit', 'reset']),
31
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
32
+ elementRef: PropTypes.func,
33
+ as: PropTypes.elementType,
34
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
35
+ color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger', 'ai-primary', 'ai-secondary']),
36
+ focusColor: PropTypes.oneOf(['info', 'inverse']),
37
+ shape: PropTypes.oneOf(['rectangle', 'circle']),
38
+ withBackground: PropTypes.bool,
39
+ withBorder: PropTypes.bool,
40
+ margin: PropTypes.string,
41
+ cursor: PropTypes.string,
42
+ href: PropTypes.string,
43
+ onClick: PropTypes.func
44
+ };
25
45
  const allowedProps = ['as', 'children', 'color', 'cursor', 'elementRef', 'focusColor', 'href', 'interaction', 'margin', 'renderIcon', 'screenReaderLabel', 'shape', 'size', 'type', 'withBackground', 'withBorder', 'onClick'];
26
- export { allowedProps };
46
+ export { propTypes, allowedProps };
@@ -1,5 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["as", "color", "elementRef", "size", "interaction", "mountNode", "renderIcon", "renderTooltipContent", "screenReaderLabel", "status", "placement", "onClick"];
3
+ var _dec, _class, _ToggleButton;
3
4
  /*
4
5
  * The MIT License (MIT)
5
6
  *
@@ -25,18 +26,18 @@ const _excluded = ["as", "color", "elementRef", "size", "interaction", "mountNod
25
26
  */
26
27
 
27
28
  import { Component } from 'react';
29
+ import { testable } from '@instructure/ui-testable';
28
30
  import { callRenderProp, passthroughProps } from '@instructure/ui-react-utils';
29
31
  import { Tooltip } from '@instructure/ui-tooltip';
30
32
  import { IconButton } from '../IconButton';
31
- import { allowedProps } from './props';
33
+ import { propTypes, allowedProps } from './props';
32
34
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
33
35
  /**
34
36
  ---
35
37
  category: components
36
38
  ---
37
39
  **/
38
-
39
- class ToggleButton extends Component {
40
+ let ToggleButton = (_dec = testable(), _dec(_class = (_ToggleButton = class ToggleButton extends Component {
40
41
  constructor(props) {
41
42
  super(props);
42
43
  this.ref = null;
@@ -98,16 +99,11 @@ class ToggleButton extends Component {
98
99
  onClick: onClick,
99
100
  interaction: interaction,
100
101
  "aria-pressed": status === 'pressed',
101
- "data-cid": "ToggleButton",
102
102
  children: callRenderProp(renderIcon)
103
103
  })
104
104
  });
105
105
  }
106
- }
107
- ToggleButton.displayName = "ToggleButton";
108
- ToggleButton.componentId = 'ToggleButton';
109
- ToggleButton.allowedProps = allowedProps;
110
- ToggleButton.defaultProps = {
106
+ }, _ToggleButton.displayName = "ToggleButton", _ToggleButton.componentId = 'ToggleButton', _ToggleButton.propTypes = propTypes, _ToggleButton.allowedProps = allowedProps, _ToggleButton.defaultProps = {
111
107
  size: 'medium',
112
108
  as: 'button',
113
109
  // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
@@ -116,6 +112,6 @@ ToggleButton.defaultProps = {
116
112
  color: 'secondary',
117
113
  placement: 'top center',
118
114
  constrain: 'window'
119
- };
115
+ }, _ToggleButton)) || _class);
120
116
  export { ToggleButton };
121
117
  export default ToggleButton;
@@ -22,5 +22,23 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ import PropTypes from 'prop-types';
26
+ import { PositionPropTypes } from '@instructure/ui-position';
27
+ const propTypes = {
28
+ screenReaderLabel: PropTypes.string.isRequired,
29
+ renderTooltipContent: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
30
+ renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
31
+ status: PropTypes.oneOf(['pressed', 'unpressed']).isRequired,
32
+ as: PropTypes.elementType,
33
+ interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
34
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
35
+ elementRef: PropTypes.func,
36
+ onClick: PropTypes.func,
37
+ color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
38
+ isShowingTooltip: PropTypes.bool,
39
+ mountNode: PositionPropTypes.mountNode,
40
+ placement: PositionPropTypes.placement,
41
+ constrain: PositionPropTypes.constrain
42
+ };
25
43
  const allowedProps = ['as', 'color', 'constrain', 'elementRef', 'interaction', 'isShowingTooltip', 'mountNode', 'onClick', 'placement', 'renderIcon', 'renderTooltipContent', 'screenReaderLabel', 'size', 'status'];
26
- export { allowedProps };
44
+ export { propTypes, allowedProps };
@@ -8,6 +8,7 @@ exports.default = exports.BaseButton = void 0;
8
8
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
9
  var _react = require("react");
10
10
  var _keycode = _interopRequireDefault(require("keycode"));
11
+ var _testable = require("@instructure/ui-testable/lib/testable.js");
11
12
  var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
12
13
  var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
13
14
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
@@ -16,14 +17,13 @@ var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js
16
17
  var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
17
18
  var _View = require("@instructure/ui-view/lib/View");
18
19
  var _uiUtils = require("@instructure/ui-utils");
19
- var _combineDataCid = require("@instructure/ui-utils/lib/combineDataCid.js");
20
20
  var _emotion = require("@instructure/emotion");
21
21
  var _styles = _interopRequireDefault(require("./styles"));
22
22
  var _theme = _interopRequireDefault(require("./theme"));
23
23
  var _props = require("./props");
24
24
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
25
25
  const _excluded = ["type", "size", "elementRef", "as", "href", "color", "focusColor", "textAlign", "shape", "display", "withBackground", "withBorder", "isCondensed", "margin", "cursor", "onClick", "renderIcon", "tabIndex", "styles", "makeStyles", "withFocusOutline"];
26
- var _dec, _class, _BaseButton;
26
+ var _dec, _dec2, _class, _BaseButton;
27
27
  /*
28
28
  * The MIT License (MIT)
29
29
  *
@@ -47,14 +47,12 @@ var _dec, _class, _BaseButton;
47
47
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
48
48
  * SOFTWARE.
49
49
  */
50
- // TODO these have to be imported in separate lines because otherwise `isSafari` will be missing from the babel build
51
- // this bug is very likely caused by `babel-plugin-transform-imports` and can be reverted once it is removed from the codebase
52
50
  /**
53
51
  ---
54
52
  category: components/utilities
55
53
  ---
56
54
  **/
57
- let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_BaseButton = class BaseButton extends _react.Component {
55
+ let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_BaseButton = class BaseButton extends _react.Component {
58
56
  constructor(...args) {
59
57
  super(...args);
60
58
  this.ref = null;
@@ -265,14 +263,13 @@ let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyle)(_styles.de
265
263
  disabled: isDisabled || isReadOnly,
266
264
  css: styles === null || styles === void 0 ? void 0 : styles.baseButton,
267
265
  withFocusOutline: withFocusOutline,
268
- "data-cid": (0, _combineDataCid.combineDataCid)('BaseButton', this.props),
269
266
  children: (0, _jsxRuntime.jsx)("span", {
270
267
  css: styles === null || styles === void 0 ? void 0 : styles.content,
271
268
  children: this.renderChildren()
272
269
  })
273
270
  });
274
271
  }
275
- }, _BaseButton.displayName = "BaseButton", _BaseButton.componentId = 'BaseButton', _BaseButton.allowedProps = _props.allowedProps, _BaseButton.defaultProps = {
272
+ }, _BaseButton.displayName = "BaseButton", _BaseButton.componentId = 'BaseButton', _BaseButton.propTypes = _props.propTypes, _BaseButton.allowedProps = _props.allowedProps, _BaseButton.defaultProps = {
276
273
  type: 'button',
277
274
  size: 'medium',
278
275
  as: 'button',
@@ -287,5 +284,5 @@ let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyle)(_styles.de
287
284
  isCondensed: false,
288
285
  margin: '0',
289
286
  cursor: 'pointer'
290
- }, _BaseButton)) || _class);
287
+ }, _BaseButton)) || _class) || _class);
291
288
  var _default = exports.default = BaseButton;
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.allowedProps = void 0;
7
+ exports.propTypes = exports.allowedProps = void 0;
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
7
9
  /*
8
10
  * The MIT License (MIT)
9
11
  *
@@ -28,4 +30,28 @@ exports.allowedProps = void 0;
28
30
  * SOFTWARE.
29
31
  */
30
32
 
33
+ const propTypes = exports.propTypes = {
34
+ children: _propTypes.default.node,
35
+ type: _propTypes.default.oneOf(['button', 'submit', 'reset']),
36
+ size: _propTypes.default.oneOf(['small', 'medium', 'large']),
37
+ elementRef: _propTypes.default.func,
38
+ as: _propTypes.default.elementType,
39
+ interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
40
+ color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger', 'ai-primary', 'ai-secondary']),
41
+ focusColor: _propTypes.default.oneOf(['info', 'inverse']),
42
+ display: _propTypes.default.oneOf(['inline-block', 'block']),
43
+ textAlign: _propTypes.default.oneOf(['start', 'center']),
44
+ shape: _propTypes.default.oneOf(['rectangle', 'circle']),
45
+ withBackground: _propTypes.default.bool,
46
+ withBorder: _propTypes.default.bool,
47
+ isCondensed: _propTypes.default.bool,
48
+ margin: _propTypes.default.string,
49
+ cursor: _propTypes.default.string,
50
+ href: _propTypes.default.string,
51
+ onClick: _propTypes.default.func,
52
+ onKeyDown: _propTypes.default.func,
53
+ renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
54
+ tabIndex: _propTypes.default.number,
55
+ withFocusOutline: _propTypes.default.bool
56
+ };
31
57
  const allowedProps = exports.allowedProps = ['as', 'children', 'color', 'cursor', 'display', 'elementRef', 'focusColor', 'href', 'interaction', 'isCondensed', 'margin', 'onClick', 'onKeyDown', 'renderIcon', 'shape', 'size', 'tabIndex', 'textAlign', 'type', 'withBackground', 'withBorder'];