@instructure/ui-buttons 8.13.1-snapshot.9 → 8.14.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 (81) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/es/BaseButton/index.js +64 -43
  3. package/es/BaseButton/props.js +2 -88
  4. package/es/BaseButton/theme.js +1 -1
  5. package/es/Button/index.js +2 -2
  6. package/es/Button/props.js +3 -65
  7. package/es/CloseButton/index.js +23 -18
  8. package/es/CloseButton/props.js +2 -60
  9. package/es/CondensedButton/index.js +2 -2
  10. package/es/CondensedButton/props.js +3 -48
  11. package/es/IconButton/index.js +2 -2
  12. package/es/IconButton/props.js +3 -68
  13. package/es/ToggleButton/index.js +4 -5
  14. package/es/ToggleButton/props.js +1 -58
  15. package/lib/BaseButton/index.js +67 -43
  16. package/lib/BaseButton/props.js +2 -88
  17. package/lib/BaseButton/theme.js +1 -1
  18. package/lib/Button/index.js +2 -2
  19. package/lib/Button/props.js +3 -65
  20. package/lib/CloseButton/index.js +23 -18
  21. package/lib/CloseButton/props.js +2 -60
  22. package/lib/CondensedButton/index.js +2 -2
  23. package/lib/CondensedButton/props.js +3 -48
  24. package/lib/IconButton/index.js +2 -2
  25. package/lib/IconButton/props.js +3 -68
  26. package/lib/ToggleButton/index.js +4 -5
  27. package/lib/ToggleButton/props.js +1 -58
  28. package/package.json +21 -22
  29. package/src/BaseButton/index.tsx +35 -27
  30. package/src/BaseButton/props.ts +103 -72
  31. package/src/BaseButton/theme.ts +1 -6
  32. package/src/Button/index.tsx +4 -8
  33. package/src/Button/props.ts +74 -48
  34. package/src/CloseButton/index.tsx +4 -6
  35. package/src/CloseButton/props.ts +67 -41
  36. package/src/CondensedButton/index.tsx +3 -7
  37. package/src/CondensedButton/props.ts +56 -34
  38. package/src/IconButton/index.tsx +3 -7
  39. package/src/IconButton/props.ts +77 -50
  40. package/src/ToggleButton/index.tsx +8 -15
  41. package/src/ToggleButton/props.ts +65 -39
  42. package/tsconfig.build.json +25 -2
  43. package/tsconfig.build.tsbuildinfo +1 -0
  44. package/types/BaseButton/BaseButtonLocator.d.ts +57 -56
  45. package/types/BaseButton/BaseButtonLocator.d.ts.map +1 -1
  46. package/types/BaseButton/index.d.ts +16 -15
  47. package/types/BaseButton/index.d.ts.map +1 -1
  48. package/types/BaseButton/props.d.ts +76 -5
  49. package/types/BaseButton/props.d.ts.map +1 -1
  50. package/types/BaseButton/theme.d.ts.map +1 -1
  51. package/types/Button/ButtonLocator.d.ts +57 -56
  52. package/types/Button/ButtonLocator.d.ts.map +1 -1
  53. package/types/Button/index.d.ts +10 -7
  54. package/types/Button/index.d.ts.map +1 -1
  55. package/types/Button/locator.d.ts +52 -52
  56. package/types/Button/props.d.ts +57 -3
  57. package/types/Button/props.d.ts.map +1 -1
  58. package/types/CloseButton/CloseButtonLocator.d.ts +52 -52
  59. package/types/CloseButton/index.d.ts +4 -3
  60. package/types/CloseButton/index.d.ts.map +1 -1
  61. package/types/CloseButton/props.d.ts +55 -5
  62. package/types/CloseButton/props.d.ts.map +1 -1
  63. package/types/CondensedButton/CondensedButtonLocator.d.ts +57 -56
  64. package/types/CondensedButton/CondensedButtonLocator.d.ts.map +1 -1
  65. package/types/CondensedButton/index.d.ts +9 -6
  66. package/types/CondensedButton/index.d.ts.map +1 -1
  67. package/types/CondensedButton/props.d.ts +44 -3
  68. package/types/CondensedButton/props.d.ts.map +1 -1
  69. package/types/IconButton/IconButtonLocator.d.ts +57 -56
  70. package/types/IconButton/IconButtonLocator.d.ts.map +1 -1
  71. package/types/IconButton/index.d.ts +11 -8
  72. package/types/IconButton/index.d.ts.map +1 -1
  73. package/types/IconButton/props.d.ts +60 -4
  74. package/types/IconButton/props.d.ts.map +1 -1
  75. package/types/ToggleButton/ToggleButtonLocator.d.ts +57 -56
  76. package/types/ToggleButton/ToggleButtonLocator.d.ts.map +1 -1
  77. package/types/ToggleButton/index.d.ts +12 -13
  78. package/types/ToggleButton/index.d.ts.map +1 -1
  79. package/types/ToggleButton/props.d.ts +52 -4
  80. package/types/ToggleButton/props.d.ts.map +1 -1
  81. package/LICENSE.md +0 -27
@@ -24,63 +24,18 @@
24
24
  import PropTypes from 'prop-types';
25
25
  import { ThemeablePropTypes } from '@instructure/emotion';
26
26
  const propTypes = {
27
- /**
28
- * Specifies the `CondensedButton` children.
29
- */
30
27
  children: PropTypes.node,
31
-
32
- /**
33
- * Specifies the type of the `CondensedButton`'s underlying html element.
34
- */
35
28
  type: PropTypes.oneOf(['button', 'submit', 'reset']),
36
-
37
- /**
38
- * The size of the `CondensedButton`
39
- */
40
29
  size: PropTypes.oneOf(['small', 'medium', 'large']),
41
-
42
- /**
43
- * Provides a reference to the `CondensedButton`'s underlying html element.
44
- */
45
30
  elementRef: PropTypes.func,
46
-
47
- /**
48
- * The element to render as the component root, `button` by default.
49
- */
50
31
  as: PropTypes.elementType,
51
-
52
- /**
53
- * Specifies if interaction with the `CondensedButton` is enabled, disabled, or readonly.
54
- */
55
32
  interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
56
-
57
- /**
58
- * Specifies the color for the `CondensedButton`.
59
- */
60
33
  color: PropTypes.oneOf(['primary', 'primary-inverse']),
61
-
62
- /**
63
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
64
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
65
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
66
- */
67
34
  margin: ThemeablePropTypes.spacing,
68
-
69
- /**
70
- * Specify a mouse cursor to use when hovering over the button.
71
- * The `pointer` cursor is used by default.
72
- */
73
35
  cursor: PropTypes.string,
74
-
75
- /**
76
- * Specifies an href attribute for the `CondensedButton`'s underlying html element.
77
- */
78
36
  href: PropTypes.string,
79
-
80
- /**
81
- * An icon, or function that returns an icon.
82
- */
83
- renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
37
+ renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
38
+ onClick: PropTypes.func
84
39
  };
85
- const allowedProps = ['as', 'children', 'color', 'cursor', 'elementRef', 'href', 'interaction', 'margin', 'renderIcon', 'size', 'type'];
40
+ const allowedProps = ['as', 'children', 'color', 'cursor', 'elementRef', 'href', 'interaction', 'margin', 'renderIcon', 'size', 'type', 'onClick'];
86
41
  export { propTypes, allowedProps };
@@ -39,6 +39,7 @@ import { propTypes, allowedProps } from './props';
39
39
  ---
40
40
  category: components
41
41
  ---
42
+ @tsProps
42
43
  **/
43
44
  // needed for listing the available theme variables on docs page
44
45
  let IconButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class IconButton extends Component {
@@ -109,12 +110,11 @@ let IconButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = testab
109
110
  }
110
111
 
111
112
  }, _class2.displayName = "IconButton", _class2.componentId = 'IconButton', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
112
- children: null,
113
113
  type: 'button',
114
114
  size: 'medium',
115
- elementRef: el => {},
116
115
  as: 'button',
117
116
  // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
117
+ interaction: void 0,
118
118
  color: 'secondary',
119
119
  shape: 'rectangle',
120
120
  withBackground: true,
@@ -24,88 +24,23 @@
24
24
  import PropTypes from 'prop-types';
25
25
  import { ThemeablePropTypes } from '@instructure/emotion';
26
26
  const propTypes = {
27
- /**
28
- * An icon, or function returning an icon (identical to the `renderIcon` prop).
29
- */
30
27
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
31
-
32
- /**
33
- * An icon, or function that returns an icon (identical to the `children` prop).
34
- */
35
28
  renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
36
-
37
- /**
38
- * An accessible label for the `IconButton`.
39
- */
40
29
  screenReaderLabel: PropTypes.string.isRequired,
41
-
42
- /**
43
- * Specifies the type of the `IconButton`'s underlying html element.
44
- */
45
30
  type: PropTypes.oneOf(['button', 'submit', 'reset']),
46
-
47
- /**
48
- * The size of the `IconButton`
49
- */
50
31
  size: PropTypes.oneOf(['small', 'medium', 'large']),
51
-
52
- /**
53
- * Provides a reference to the `IconButton`'s underlying html element.
54
- */
55
32
  elementRef: PropTypes.func,
56
-
57
- /**
58
- * The element to render as the component root, `button` by default.
59
- */
60
33
  as: PropTypes.elementType,
61
-
62
- /**
63
- * Specifies if interaction with the `IconButton` is enabled, disabled, or readonly.
64
- */
65
34
  interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
66
-
67
- /**
68
- * Specifies the color for the `IconButton`.
69
- */
70
35
  color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
71
-
72
- /**
73
- * Override the `Button`'s default focus outline color.
74
- */
75
36
  focusColor: PropTypes.oneOf(['info', 'inverse']),
76
-
77
- /**
78
- * Specifies if the `IconButton` shape should be a circle or rectangle.
79
- */
80
37
  shape: PropTypes.oneOf(['rectangle', 'circle']),
81
-
82
- /**
83
- * Specifies if the `IconButton` should render with a solid background. When false, the background is transparent.
84
- */
85
38
  withBackground: PropTypes.bool,
86
-
87
- /**
88
- * Specifies if the `IconButton` should render with a border.
89
- */
90
39
  withBorder: PropTypes.bool,
91
-
92
- /**
93
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
94
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
95
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
96
- */
97
40
  margin: ThemeablePropTypes.spacing,
98
-
99
- /**
100
- * Specify a mouse cursor to use when hovering over the button.
101
- * The `pointer` cursor is used by default.
102
- */
103
41
  cursor: PropTypes.string,
104
-
105
- /**
106
- * Specifies an href attribute for the `IconButton`'s underlying html element.
107
- */
108
- href: PropTypes.string
42
+ href: PropTypes.string,
43
+ onClick: PropTypes.func
109
44
  };
110
- const allowedProps = ['as', 'children', 'color', 'cursor', 'elementRef', 'focusColor', 'href', 'interaction', 'margin', 'renderIcon', 'screenReaderLabel', 'shape', 'size', 'type', 'withBackground', 'withBorder'];
45
+ const allowedProps = ['as', 'children', 'color', 'cursor', 'elementRef', 'focusColor', 'href', 'interaction', 'margin', 'renderIcon', 'screenReaderLabel', 'shape', 'size', 'type', 'withBackground', 'withBorder', 'onClick'];
111
46
  export { propTypes, allowedProps };
@@ -37,6 +37,7 @@ import { propTypes, allowedProps } from './props';
37
37
  ---
38
38
  category: components
39
39
  ---
40
+ @tsProps
40
41
  **/
41
42
  let ToggleButton = (_dec = testable(), _dec(_class = (_temp = _class2 = class ToggleButton extends Component {
42
43
  constructor(props) {
@@ -83,12 +84,12 @@ let ToggleButton = (_dec = testable(), _dec(_class = (_temp = _class2 = class To
83
84
  placement: placement,
84
85
  color: color === 'primary-inverse' ? 'primary-inverse' : 'primary',
85
86
  isShowingContent: this.isShowingTooltip,
86
- onShowContent: event => {
87
+ onShowContent: () => {
87
88
  this.setState({
88
89
  isShowingTooltip: true
89
90
  });
90
91
  },
91
- onHideContent: event => {
92
+ onHideContent: () => {
92
93
  this.setState({
93
94
  isShowingTooltip: false
94
95
  });
@@ -112,9 +113,7 @@ let ToggleButton = (_dec = testable(), _dec(_class = (_temp = _class2 = class To
112
113
  size: 'medium',
113
114
  as: 'button',
114
115
  // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
115
- elementRef: el => {},
116
- renderIcon: () => {},
117
- onClick: () => {},
116
+ interaction: void 0,
118
117
  mountNode: null,
119
118
  color: 'secondary',
120
119
  placement: 'top center',
@@ -24,76 +24,19 @@
24
24
  import PropTypes from 'prop-types';
25
25
  import { PositionPropTypes } from '@instructure/ui-position';
26
26
  const propTypes = {
27
- /**
28
- * Text to output only to screen readers
29
- */
30
27
  screenReaderLabel: PropTypes.string.isRequired,
31
-
32
- /**
33
- * Text to render in the tooltip shown on hover/focus
34
- */
35
28
  renderTooltipContent: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
36
-
37
- /**
38
- * An icon or function that returns an icon
39
- */
40
29
  renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
41
-
42
- /**
43
- * Toggles the `aria-pressed` attribute on the button (`true` if `pressed`; `false` if `unpressed`)
44
- */
45
30
  status: PropTypes.oneOf(['pressed', 'unpressed']).isRequired,
46
-
47
- /**
48
- * The element to render as the component root; `button` by default
49
- */
50
31
  as: PropTypes.elementType,
51
-
52
- /**
53
- * Specifies if interaction with `ToggleButton` is `enabled`, `disabled`, or `readonly`
54
- */
55
32
  interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
56
-
57
- /**
58
- * The size of the `ToggleButton`
59
- */
60
33
  size: PropTypes.oneOf(['small', 'medium', 'large']),
61
-
62
- /**
63
- * Provides a reference to `ToggleButton`'s underlying HTML element
64
- */
65
34
  elementRef: PropTypes.func,
66
-
67
- /**
68
- * Callback fired when the `ToggleButton` is clicked
69
- */
70
35
  onClick: PropTypes.func,
71
-
72
- /**
73
- * The color in which to display the icon
74
- */
75
- color: PropTypes.string,
76
-
77
- /**
78
- * By default, the tooltip will show on hover/focus. Use this prop if you need to override that behavior.
79
- */
36
+ color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
80
37
  isShowingTooltip: PropTypes.bool,
81
-
82
- /**
83
- * An element or a function returning an element to use as the mount node
84
- */
85
38
  mountNode: PositionPropTypes.mountNode,
86
-
87
- /**
88
- * The placement of the tooltip in relation to the button
89
- */
90
39
  placement: PositionPropTypes.placement,
91
-
92
- /**
93
- * The parent in which to constrain the tooltip.
94
- * One of: 'window', 'scroll-parent', 'parent', 'none', an element,
95
- * or a function returning an element.
96
- */
97
40
  constrain: PositionPropTypes.constrain
98
41
  };
99
42
  const allowedProps = ['as', 'color', 'constrain', 'elementRef', 'interaction', 'isShowingTooltip', 'mountNode', 'onClick', 'placement', 'renderIcon', 'renderTooltipContent', 'screenReaderLabel', 'size', 'status'];
@@ -2,6 +2,8 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
@@ -9,10 +11,12 @@ exports.default = exports.BaseButton = void 0;
9
11
 
10
12
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
13
 
12
- var _react = require("react");
14
+ var _react = _interopRequireWildcard(require("react"));
13
15
 
14
16
  var _keycode = _interopRequireDefault(require("keycode"));
15
17
 
18
+ var _console = require("@instructure/console");
19
+
16
20
  var _testable = require("@instructure/ui-testable/lib/testable.js");
17
21
 
18
22
  var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
@@ -45,6 +49,7 @@ var _dec, _dec2, _class, _class2, _temp;
45
49
  ---
46
50
  category: components/utilities
47
51
  ---
52
+ @tsProps
48
53
  **/
49
54
  let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class BaseButton extends _react.Component {
50
55
  constructor() {
@@ -81,7 +86,11 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
81
86
  onKeyDown = _this$props.onKeyDown,
82
87
  href = _this$props.href;
83
88
  const interaction = this.interaction;
84
- onKeyDown(event); // behave like a button when space key is pressed
89
+
90
+ if (typeof onKeyDown === 'function') {
91
+ onKeyDown(event);
92
+ } // behave like a button when space key is pressed
93
+
85
94
 
86
95
  const _keycode$codes = _keycode.default.codes,
87
96
  space = _keycode$codes.space,
@@ -103,11 +112,15 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
103
112
  }
104
113
 
105
114
  componentDidMount() {
106
- this.props.makeStyles(this.makeStylesVariables);
115
+ var _this$props$makeStyle, _this$props2;
116
+
117
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2, this.makeStylesVariables);
107
118
  }
108
119
 
109
- componentDidUpdate(prevProps, prevState, snapshot) {
110
- this.props.makeStyles(this.makeStylesVariables);
120
+ componentDidUpdate() {
121
+ var _this$props$makeStyle2, _this$props3;
122
+
123
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStylesVariables);
111
124
  }
112
125
 
113
126
  get _rootElement() {
@@ -122,9 +135,9 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
122
135
  }
123
136
 
124
137
  get hasOnlyIconVisible() {
125
- const _this$props2 = this.props,
126
- children = _this$props2.children,
127
- renderIcon = _this$props2.renderIcon;
138
+ const _this$props4 = this.props,
139
+ children = _this$props4.children,
140
+ renderIcon = _this$props4.renderIcon;
128
141
  return !!(renderIcon && !(0, _hasVisibleChildren.hasVisibleChildren)(children));
129
142
  }
130
143
 
@@ -148,13 +161,25 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
148
161
 
149
162
  get isEnabled() {
150
163
  return this.interaction === 'enabled';
164
+ } // TODO: delete once the type of tabIndex is changed to number only
165
+
166
+
167
+ get tabIndex() {
168
+ const tabIndex = this.props.tabIndex;
169
+
170
+ if (typeof tabIndex === 'string') {
171
+ (0, _console.warn)(false, 'The `string` value for `tabIndex` is deprecated. Only `number` type will be accepted from V9.0.0.');
172
+ return parseInt(tabIndex);
173
+ }
174
+
175
+ return tabIndex;
151
176
  }
152
177
 
153
178
  get focusColor() {
154
- const _this$props3 = this.props,
155
- color = _this$props3.color,
156
- focusColor = _this$props3.focusColor,
157
- withBackground = _this$props3.withBackground; // Give user specified focusColor preference
179
+ const _this$props5 = this.props,
180
+ color = _this$props5.color,
181
+ focusColor = _this$props5.focusColor,
182
+ withBackground = _this$props5.withBackground; // Give user specified focusColor preference
158
183
 
159
184
  if (focusColor) {
160
185
  return focusColor;
@@ -180,10 +205,10 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
180
205
  }
181
206
 
182
207
  renderChildren() {
183
- const _this$props4 = this.props,
184
- renderIcon = _this$props4.renderIcon,
185
- children = _this$props4.children,
186
- styles = _this$props4.styles;
208
+ const _this$props6 = this.props,
209
+ renderIcon = _this$props6.renderIcon,
210
+ children = _this$props6.children,
211
+ styles = _this$props6.styles;
187
212
  const wrappedChildren = (0, _emotion.jsx)("span", {
188
213
  css: styles === null || styles === void 0 ? void 0 : styles.children
189
214
  }, children);
@@ -211,31 +236,32 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
211
236
  }
212
237
 
213
238
  render() {
214
- const _this$props5 = this.props,
215
- type = _this$props5.type,
216
- size = _this$props5.size,
217
- elementRef = _this$props5.elementRef,
218
- as = _this$props5.as,
219
- href = _this$props5.href,
220
- color = _this$props5.color,
221
- focusColor = _this$props5.focusColor,
222
- textAlign = _this$props5.textAlign,
223
- shape = _this$props5.shape,
224
- display = _this$props5.display,
225
- withBackground = _this$props5.withBackground,
226
- withBorder = _this$props5.withBorder,
227
- isCondensed = _this$props5.isCondensed,
228
- margin = _this$props5.margin,
229
- cursor = _this$props5.cursor,
230
- onClick = _this$props5.onClick,
231
- renderIcon = _this$props5.renderIcon,
232
- tabIndex = _this$props5.tabIndex,
233
- styles = _this$props5.styles,
234
- makeStyles = _this$props5.makeStyles,
235
- props = (0, _objectWithoutProperties2.default)(_this$props5, _excluded);
239
+ const _this$props7 = this.props,
240
+ type = _this$props7.type,
241
+ size = _this$props7.size,
242
+ elementRef = _this$props7.elementRef,
243
+ as = _this$props7.as,
244
+ href = _this$props7.href,
245
+ color = _this$props7.color,
246
+ focusColor = _this$props7.focusColor,
247
+ textAlign = _this$props7.textAlign,
248
+ shape = _this$props7.shape,
249
+ display = _this$props7.display,
250
+ withBackground = _this$props7.withBackground,
251
+ withBorder = _this$props7.withBorder,
252
+ isCondensed = _this$props7.isCondensed,
253
+ margin = _this$props7.margin,
254
+ cursor = _this$props7.cursor,
255
+ onClick = _this$props7.onClick,
256
+ renderIcon = _this$props7.renderIcon,
257
+ tabIndex = _this$props7.tabIndex,
258
+ styles = _this$props7.styles,
259
+ makeStyles = _this$props7.makeStyles,
260
+ props = (0, _objectWithoutProperties2.default)(_this$props7, _excluded);
236
261
  const isDisabled = this.isDisabled,
237
262
  isEnabled = this.isEnabled,
238
263
  isReadOnly = this.isReadOnly;
264
+ const tabIndexNumber = this.tabIndex;
239
265
  return (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
240
266
  as: this.elementType,
241
267
  focusColor: this.focusColor,
@@ -254,7 +280,7 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
254
280
  onClick: this.handleClick,
255
281
  onKeyDown: this.handleKeyDown,
256
282
  role: onClick && as !== 'button' ? 'button' : void 0,
257
- tabIndex: onClick && as ? tabIndex || '0' : tabIndex,
283
+ tabIndex: onClick && as ? tabIndexNumber || 0 : tabIndexNumber,
258
284
  disabled: isDisabled || isReadOnly,
259
285
  css: isEnabled ? styles === null || styles === void 0 ? void 0 : styles.baseButton : null
260
286
  }), (0, _emotion.jsx)("span", {
@@ -263,12 +289,11 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
263
289
  }
264
290
 
265
291
  }, _class2.displayName = "BaseButton", _class2.componentId = 'BaseButton', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
266
- children: null,
267
292
  type: 'button',
268
293
  size: 'medium',
269
- elementRef: el => {},
270
294
  as: 'button',
271
295
  // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
296
+ interaction: void 0,
272
297
  color: 'secondary',
273
298
  shape: 'rectangle',
274
299
  display: 'inline-block',
@@ -277,8 +302,7 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
277
302
  withBorder: true,
278
303
  isCondensed: false,
279
304
  margin: '0',
280
- cursor: 'pointer',
281
- onKeyDown: event => {}
305
+ cursor: 'pointer'
282
306
  }, _temp)) || _class) || _class);
283
307
  exports.BaseButton = BaseButton;
284
308
  var _default = BaseButton;
@@ -35,114 +35,28 @@ var _emotion = require("@instructure/emotion");
35
35
  * SOFTWARE.
36
36
  */
37
37
  const propTypes = {
38
- /**
39
- * Specifies the `Button` children.
40
- */
41
38
  children: _propTypes.default.node,
42
-
43
- /**
44
- * Specifies the type of the `Button`'s underlying html element.
45
- */
46
39
  type: _propTypes.default.oneOf(['button', 'submit', 'reset']),
47
-
48
- /**
49
- * The size of the `Button`
50
- */
51
40
  size: _propTypes.default.oneOf(['small', 'medium', 'large']),
52
-
53
- /**
54
- * Provides a reference to the `Button`'s underlying html element.
55
- */
56
41
  elementRef: _propTypes.default.func,
57
-
58
- /**
59
- * The element to render as the component root, `Button` by default.
60
- */
61
42
  as: _propTypes.default.elementType,
62
-
63
- /**
64
- * Specifies if interaction with the `Button` is enabled, disabled, or readonly.
65
- */
66
43
  interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
67
-
68
- /**
69
- * Specifies the color for the `Button`.
70
- */
71
44
  color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
72
-
73
- /**
74
- * Override the `Button`'s default focus outline color.
75
- */
76
45
  focusColor: _propTypes.default.oneOf(['info', 'inverse']),
77
-
78
- /**
79
- * The `Button` display property. When set to `inline-block`, the `Button` displays inline with other elements.
80
- * When set to block, the `Button` expands to fill the width of the container.
81
- */
82
46
  display: _propTypes.default.oneOf(['inline-block', 'block']),
83
-
84
- /**
85
- * Sets the alignment of the `Button` children and/or icon.
86
- */
87
47
  textAlign: _propTypes.default.oneOf(['start', 'center']),
88
-
89
- /**
90
- * Specifies if the `Button` shape should be a circle or rectangle.
91
- */
92
48
  shape: _propTypes.default.oneOf(['rectangle', 'circle']),
93
-
94
- /**
95
- * Specifies if the `Button` should render with a solid background. When false, the background is transparent.
96
- */
97
49
  withBackground: _propTypes.default.bool,
98
-
99
- /**
100
- * Specifies if the `Button` should render with a border.
101
- */
102
50
  withBorder: _propTypes.default.bool,
103
-
104
- /**
105
- * Designates if the `Button` should render without padding. This option should only be set when `withBorder` and
106
- * `withBackground` are also set to false.
107
- */
108
51
  isCondensed: _propTypes.default.bool,
109
-
110
- /**
111
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
112
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
113
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
114
- */
115
52
  margin: _emotion.ThemeablePropTypes.spacing,
116
-
117
- /**
118
- * Specify a mouse cursor to use when hovering over the button.
119
- * The `pointer` cursor is used by default.
120
- */
121
53
  cursor: _propTypes.default.string,
122
-
123
- /**
124
- * Specifies an href attribute for the `Button`'s underlying html element.
125
- */
126
54
  href: _propTypes.default.string,
127
-
128
- /**
129
- * Callback fired when the `Button` is clicked.
130
- */
131
55
  onClick: _propTypes.default.func,
132
-
133
- /**
134
- * Callback fired when the `Button` receives a keydown event.
135
- */
136
56
  onKeyDown: _propTypes.default.func,
137
-
138
- /**
139
- * An icon, or function that returns an icon.
140
- */
141
57
  renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
142
-
143
- /**
144
- * Specifies the tabindex of the `Button`.
145
- */
58
+ // Deprecated `string` tabIndex type
59
+ // TODO: remove string type in v9
146
60
  tabIndex: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
147
61
  };
148
62
  exports.propTypes = propTypes;
@@ -48,7 +48,7 @@ const generateButtonThemeVars = _ref => {
48
48
  [`${style}Background`]: backgroundColor,
49
49
  [`${style}HoverBackground`]: (0, _darken.darken)(backgroundColor, 10),
50
50
  [`${style}ActiveBackground`]: (0, _darken.darken)(backgroundColor, 10),
51
- [`${style}ActiveBoxShadow`]: `${activeShadow} ${(0, _darken.darken)(borderColor, 20, 0.45)}`,
51
+ [`${style}ActiveBoxShadow`]: `${activeShadow} ${(0, _darken.darken)(borderColor, 20)}`,
52
52
  [`${style}GhostColor`]: ghostTextColor,
53
53
  [`${style}GhostBorderColor`]: ghostBorderColor,
54
54
  [`${style}GhostBackground`]: 'transparent',
@@ -35,6 +35,7 @@ var _dec, _dec2, _class, _class2, _temp;
35
35
  ---
36
36
  category: components
37
37
  ---
38
+ @tsProps
38
39
  **/
39
40
  // needed for listing the available theme variables on docs page
40
41
  let Button = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class Button extends _react.Component {
@@ -107,12 +108,11 @@ let Button = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 = (0,
107
108
  }
108
109
 
109
110
  }, _class2.displayName = "Button", _class2.componentId = 'Button', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
110
- children: null,
111
111
  type: 'button',
112
112
  size: 'medium',
113
- elementRef: el => {},
114
113
  as: 'button',
115
114
  // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
115
+ interaction: void 0,
116
116
  color: 'secondary',
117
117
  display: 'inline-block',
118
118
  textAlign: 'center',