@instructure/ui-buttons 8.8.1-snapshot.7 → 8.9.1-snapshot.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 (94) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/es/BaseButton/index.js +12 -133
  3. package/es/BaseButton/props.js +138 -0
  4. package/es/Button/index.js +4 -87
  5. package/es/Button/props.js +107 -0
  6. package/es/CloseButton/index.js +5 -93
  7. package/es/CloseButton/props.js +103 -0
  8. package/es/CondensedButton/index.js +4 -65
  9. package/es/CondensedButton/props.js +86 -0
  10. package/es/IconButton/index.js +4 -91
  11. package/es/IconButton/props.js +111 -0
  12. package/es/ToggleButton/index.js +2 -77
  13. package/es/ToggleButton/props.js +100 -0
  14. package/lib/BaseButton/index.js +12 -133
  15. package/lib/BaseButton/props.js +150 -0
  16. package/lib/Button/index.js +4 -87
  17. package/lib/Button/props.js +119 -0
  18. package/lib/CloseButton/index.js +5 -93
  19. package/lib/CloseButton/props.js +115 -0
  20. package/lib/CondensedButton/index.js +4 -65
  21. package/lib/CondensedButton/props.js +98 -0
  22. package/lib/IconButton/index.js +4 -91
  23. package/lib/IconButton/props.js +123 -0
  24. package/lib/ToggleButton/index.js +3 -79
  25. package/lib/ToggleButton/props.js +112 -0
  26. package/package.json +21 -21
  27. package/src/BaseButton/index.tsx +15 -120
  28. package/src/BaseButton/props.ts +192 -0
  29. package/src/BaseButton/styles.ts +1 -1
  30. package/src/Button/index.tsx +7 -81
  31. package/src/Button/props.ts +149 -0
  32. package/src/CloseButton/index.tsx +8 -82
  33. package/src/CloseButton/props.ts +137 -0
  34. package/src/CloseButton/styles.ts +1 -1
  35. package/src/CondensedButton/index.tsx +7 -57
  36. package/src/CondensedButton/props.ts +118 -0
  37. package/src/IconButton/index.tsx +7 -84
  38. package/src/IconButton/props.ts +154 -0
  39. package/src/ToggleButton/index.tsx +5 -68
  40. package/src/ToggleButton/props.ts +140 -0
  41. package/src/index.ts +6 -6
  42. package/types/BaseButton/index.d.ts +47 -101
  43. package/types/BaseButton/index.d.ts.map +1 -1
  44. package/types/BaseButton/{types.d.ts → props.d.ts} +15 -10
  45. package/types/BaseButton/props.d.ts.map +1 -0
  46. package/types/BaseButton/styles.d.ts +1 -1
  47. package/types/Button/index.d.ts +36 -73
  48. package/types/Button/index.d.ts.map +1 -1
  49. package/types/Button/{types.d.ts → props.d.ts} +12 -4
  50. package/types/Button/props.d.ts.map +1 -0
  51. package/types/CloseButton/index.d.ts +41 -75
  52. package/types/CloseButton/index.d.ts.map +1 -1
  53. package/types/CloseButton/props.d.ts +27 -0
  54. package/types/CloseButton/props.d.ts.map +1 -0
  55. package/types/CloseButton/styles.d.ts +1 -1
  56. package/types/CondensedButton/index.d.ts +28 -55
  57. package/types/CondensedButton/index.d.ts.map +1 -1
  58. package/types/CondensedButton/props.d.ts +24 -0
  59. package/types/CondensedButton/props.d.ts.map +1 -0
  60. package/types/IconButton/index.d.ts +38 -76
  61. package/types/IconButton/index.d.ts.map +1 -1
  62. package/types/IconButton/{types.d.ts → props.d.ts} +11 -3
  63. package/types/IconButton/props.d.ts.map +1 -0
  64. package/types/ToggleButton/index.d.ts +34 -65
  65. package/types/ToggleButton/index.d.ts.map +1 -1
  66. package/types/ToggleButton/{types.d.ts → props.d.ts} +10 -3
  67. package/types/ToggleButton/props.d.ts.map +1 -0
  68. package/types/index.d.ts +6 -6
  69. package/es/BaseButton/types.js +0 -1
  70. package/es/Button/types.js +0 -1
  71. package/es/CloseButton/types.js +0 -1
  72. package/es/CondensedButton/types.js +0 -1
  73. package/es/IconButton/types.js +0 -1
  74. package/es/ToggleButton/types.js +0 -1
  75. package/lib/BaseButton/types.js +0 -1
  76. package/lib/Button/types.js +0 -1
  77. package/lib/CloseButton/types.js +0 -1
  78. package/lib/CondensedButton/types.js +0 -1
  79. package/lib/IconButton/types.js +0 -1
  80. package/lib/ToggleButton/types.js +0 -1
  81. package/src/BaseButton/types.ts +0 -58
  82. package/src/Button/types.ts +0 -44
  83. package/src/CloseButton/types.ts +0 -45
  84. package/src/CondensedButton/types.ts +0 -40
  85. package/src/IconButton/types.ts +0 -45
  86. package/src/ToggleButton/types.ts +0 -48
  87. package/types/BaseButton/types.d.ts.map +0 -1
  88. package/types/Button/types.d.ts.map +0 -1
  89. package/types/CloseButton/types.d.ts +0 -22
  90. package/types/CloseButton/types.d.ts.map +0 -1
  91. package/types/CondensedButton/types.d.ts +0 -16
  92. package/types/CondensedButton/types.d.ts.map +0 -1
  93. package/types/IconButton/types.d.ts.map +0 -1
  94. package/types/ToggleButton/types.d.ts.map +0 -1
@@ -13,12 +13,8 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
13
13
 
14
14
  var _react = _interopRequireWildcard(require("react"));
15
15
 
16
- var _propTypes = _interopRequireDefault(require("prop-types"));
17
-
18
16
  var _testable = require("@instructure/ui-testable/lib/testable.js");
19
17
 
20
- var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes.js");
21
-
22
18
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
23
19
 
24
20
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
@@ -27,6 +23,8 @@ var _Tooltip = require("@instructure/ui-tooltip/lib/Tooltip");
27
23
 
28
24
  var _IconButton = require("../IconButton");
29
25
 
26
+ var _props = require("./props");
27
+
30
28
  const _excluded = ["as", "color", "elementRef", "size", "interaction", "mountNode", "renderIcon", "renderTooltipContent", "screenReaderLabel", "status", "placement", "onClick"];
31
29
 
32
30
  var _dec, _class, _class2, _temp;
@@ -94,89 +92,15 @@ let ToggleButton = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _cl
94
92
  }), (0, _callRenderProp.callRenderProp)(renderIcon)));
95
93
  }
96
94
 
97
- }, _class2.displayName = "ToggleButton", _class2.componentId = 'ToggleButton', _class2.propTypes = {
98
- /**
99
- * Text to output only to screen readers
100
- */
101
- screenReaderLabel: _propTypes.default.string.isRequired,
102
-
103
- /**
104
- * Text to render in the tooltip shown on hover/focus
105
- */
106
- renderTooltipContent: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
107
-
108
- /**
109
- * An icon or function that returns an icon
110
- */
111
- renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
112
-
113
- /**
114
- * Toggles the `aria-pressed` attribute on the button (`true` if `pressed`; `false` if `unpressed`)
115
- */
116
- status: _propTypes.default.oneOf(['pressed', 'unpressed']).isRequired,
117
-
118
- /**
119
- * The element to render as the component root; `button` by default
120
- */
121
- as: _propTypes.default.elementType,
122
-
123
- /**
124
- * Specifies if interaction with `ToggleButton` is `enabled`, `disabled`, or `readonly`
125
- */
126
- interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
127
-
128
- /**
129
- * The size of the `ToggleButton`
130
- */
131
- size: _propTypes.default.oneOf(['small', 'medium', 'large']),
132
-
133
- /**
134
- * Provides a reference to `ToggleButton`'s underlying HTML element
135
- */
136
- elementRef: _propTypes.default.func,
137
-
138
- /**
139
- * Callback fired when the `ToggleButton` is clicked
140
- */
141
- onClick: _propTypes.default.func,
142
-
143
- /**
144
- * The color in which to display the icon
145
- */
146
- color: _propTypes.default.string,
147
-
148
- /**
149
- * By default, the tooltip will show on hover/focus. Use this prop if you need to override that behavior.
150
- */
151
- isShowingTooltip: _propTypes.default.bool,
152
-
153
- /**
154
- * An element or a function returning an element to use as the mount node
155
- */
156
- mountNode: _PositionPropTypes.PositionPropTypes.mountNode,
157
-
158
- /**
159
- * The placement of the tooltip in relation to the button
160
- */
161
- placement: _PositionPropTypes.PositionPropTypes.placement,
162
-
163
- /**
164
- * The parent in which to constrain the tooltip.
165
- * One of: 'window', 'scroll-parent', 'parent', 'none', an element,
166
- * or a function returning an element.
167
- */
168
- constrain: _PositionPropTypes.PositionPropTypes.constrain
169
- }, _class2.defaultProps = {
95
+ }, _class2.displayName = "ToggleButton", _class2.componentId = 'ToggleButton', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
170
96
  size: 'medium',
171
97
  as: 'button',
172
98
  // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
173
- interaction: void 0,
174
99
  elementRef: el => {},
175
100
  renderIcon: () => {},
176
101
  onClick: () => {},
177
102
  mountNode: null,
178
103
  color: 'secondary',
179
- isShowingTooltip: void 0,
180
104
  placement: 'top center',
181
105
  constrain: 'window'
182
106
  }, _temp)) || _class);
@@ -0,0 +1,112 @@
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 _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes.js");
13
+
14
+ /*
15
+ * The MIT License (MIT)
16
+ *
17
+ * Copyright (c) 2015 - present Instructure, Inc.
18
+ *
19
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
20
+ * of this software and associated documentation files (the "Software"), to deal
21
+ * in the Software without restriction, including without limitation the rights
22
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
+ * copies of the Software, and to permit persons to whom the Software is
24
+ * furnished to do so, subject to the following conditions:
25
+ *
26
+ * The above copyright notice and this permission notice shall be included in all
27
+ * copies or substantial portions of the Software.
28
+ *
29
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
+ * SOFTWARE.
36
+ */
37
+ const propTypes = {
38
+ /**
39
+ * Text to output only to screen readers
40
+ */
41
+ screenReaderLabel: _propTypes.default.string.isRequired,
42
+
43
+ /**
44
+ * Text to render in the tooltip shown on hover/focus
45
+ */
46
+ renderTooltipContent: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
47
+
48
+ /**
49
+ * An icon or function that returns an icon
50
+ */
51
+ renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
52
+
53
+ /**
54
+ * Toggles the `aria-pressed` attribute on the button (`true` if `pressed`; `false` if `unpressed`)
55
+ */
56
+ status: _propTypes.default.oneOf(['pressed', 'unpressed']).isRequired,
57
+
58
+ /**
59
+ * The element to render as the component root; `button` by default
60
+ */
61
+ as: _propTypes.default.elementType,
62
+
63
+ /**
64
+ * Specifies if interaction with `ToggleButton` is `enabled`, `disabled`, or `readonly`
65
+ */
66
+ interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
67
+
68
+ /**
69
+ * The size of the `ToggleButton`
70
+ */
71
+ size: _propTypes.default.oneOf(['small', 'medium', 'large']),
72
+
73
+ /**
74
+ * Provides a reference to `ToggleButton`'s underlying HTML element
75
+ */
76
+ elementRef: _propTypes.default.func,
77
+
78
+ /**
79
+ * Callback fired when the `ToggleButton` is clicked
80
+ */
81
+ onClick: _propTypes.default.func,
82
+
83
+ /**
84
+ * The color in which to display the icon
85
+ */
86
+ color: _propTypes.default.string,
87
+
88
+ /**
89
+ * By default, the tooltip will show on hover/focus. Use this prop if you need to override that behavior.
90
+ */
91
+ isShowingTooltip: _propTypes.default.bool,
92
+
93
+ /**
94
+ * An element or a function returning an element to use as the mount node
95
+ */
96
+ mountNode: _PositionPropTypes.PositionPropTypes.mountNode,
97
+
98
+ /**
99
+ * The placement of the tooltip in relation to the button
100
+ */
101
+ placement: _PositionPropTypes.PositionPropTypes.placement,
102
+
103
+ /**
104
+ * The parent in which to constrain the tooltip.
105
+ * One of: 'window', 'scroll-parent', 'parent', 'none', an element,
106
+ * or a function returning an element.
107
+ */
108
+ constrain: _PositionPropTypes.PositionPropTypes.constrain
109
+ };
110
+ exports.propTypes = propTypes;
111
+ const allowedProps = ['as', 'color', 'constrain', 'elementRef', 'interaction', 'isShowingTooltip', 'mountNode', 'onClick', 'placement', 'renderIcon', 'renderTooltipContent', 'screenReaderLabel', 'size', 'status'];
112
+ exports.allowedProps = allowedProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-buttons",
3
- "version": "8.8.1-snapshot.7+90b251d58",
3
+ "version": "8.9.1-snapshot.2+7f5faa3df",
4
4
  "description": "Accessible button components",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -24,28 +24,28 @@
24
24
  },
25
25
  "license": "MIT",
26
26
  "devDependencies": {
27
- "@instructure/shared-types": "8.8.1-snapshot.7+90b251d58",
28
- "@instructure/ui-babel-preset": "8.8.1-snapshot.7+90b251d58",
29
- "@instructure/ui-test-locator": "8.8.1-snapshot.7+90b251d58",
30
- "@instructure/ui-test-queries": "8.8.1-snapshot.7+90b251d58",
31
- "@instructure/ui-test-utils": "8.8.1-snapshot.7+90b251d58",
32
- "@instructure/ui-themes": "8.8.1-snapshot.7+90b251d58"
27
+ "@instructure/ui-babel-preset": "8.9.1-snapshot.2+7f5faa3df",
28
+ "@instructure/ui-test-locator": "8.9.1-snapshot.2+7f5faa3df",
29
+ "@instructure/ui-test-queries": "8.9.1-snapshot.2+7f5faa3df",
30
+ "@instructure/ui-test-utils": "8.9.1-snapshot.2+7f5faa3df",
31
+ "@instructure/ui-themes": "8.9.1-snapshot.2+7f5faa3df"
33
32
  },
34
33
  "dependencies": {
35
34
  "@babel/runtime": "^7.13.10",
36
- "@instructure/console": "8.8.1-snapshot.7+90b251d58",
37
- "@instructure/emotion": "8.8.1-snapshot.7+90b251d58",
38
- "@instructure/ui-a11y-content": "8.8.1-snapshot.7+90b251d58",
39
- "@instructure/ui-a11y-utils": "8.8.1-snapshot.7+90b251d58",
40
- "@instructure/ui-color-utils": "8.8.1-snapshot.7+90b251d58",
41
- "@instructure/ui-dom-utils": "8.8.1-snapshot.7+90b251d58",
42
- "@instructure/ui-icons": "8.8.1-snapshot.7+90b251d58",
43
- "@instructure/ui-position": "8.8.1-snapshot.7+90b251d58",
44
- "@instructure/ui-react-utils": "8.8.1-snapshot.7+90b251d58",
45
- "@instructure/ui-testable": "8.8.1-snapshot.7+90b251d58",
46
- "@instructure/ui-tooltip": "8.8.1-snapshot.7+90b251d58",
47
- "@instructure/ui-utils": "8.8.1-snapshot.7+90b251d58",
48
- "@instructure/ui-view": "8.8.1-snapshot.7+90b251d58",
35
+ "@instructure/console": "8.9.1-snapshot.2+7f5faa3df",
36
+ "@instructure/emotion": "8.9.1-snapshot.2+7f5faa3df",
37
+ "@instructure/shared-types": "8.9.1-snapshot.2+7f5faa3df",
38
+ "@instructure/ui-a11y-content": "8.9.1-snapshot.2+7f5faa3df",
39
+ "@instructure/ui-a11y-utils": "8.9.1-snapshot.2+7f5faa3df",
40
+ "@instructure/ui-color-utils": "8.9.1-snapshot.2+7f5faa3df",
41
+ "@instructure/ui-dom-utils": "8.9.1-snapshot.2+7f5faa3df",
42
+ "@instructure/ui-icons": "8.9.1-snapshot.2+7f5faa3df",
43
+ "@instructure/ui-position": "8.9.1-snapshot.2+7f5faa3df",
44
+ "@instructure/ui-react-utils": "8.9.1-snapshot.2+7f5faa3df",
45
+ "@instructure/ui-testable": "8.9.1-snapshot.2+7f5faa3df",
46
+ "@instructure/ui-tooltip": "8.9.1-snapshot.2+7f5faa3df",
47
+ "@instructure/ui-utils": "8.9.1-snapshot.2+7f5faa3df",
48
+ "@instructure/ui-view": "8.9.1-snapshot.2+7f5faa3df",
49
49
  "keycode": "^2",
50
50
  "prop-types": "^15"
51
51
  },
@@ -56,5 +56,5 @@
56
56
  "access": "public"
57
57
  },
58
58
  "sideEffects": false,
59
- "gitHead": "90b251d580c75205b6cbb884fe922059cfc494dd"
59
+ "gitHead": "7f5faa3df83667636304e0901ef1008d98dffc9a"
60
60
  }
@@ -24,7 +24,6 @@
24
24
 
25
25
  /** @jsx jsx */
26
26
  import { Component } from 'react'
27
- import PropTypes from 'prop-types'
28
27
  import keycode from 'keycode'
29
28
 
30
29
  import { testable } from '@instructure/ui-testable'
@@ -38,11 +37,13 @@ import { isActiveElement } from '@instructure/ui-dom-utils'
38
37
  import { hasVisibleChildren } from '@instructure/ui-a11y-utils'
39
38
  import { View } from '@instructure/ui-view'
40
39
 
41
- import { withStyle, jsx, ThemeablePropTypes } from '@instructure/emotion'
40
+ import { withStyle, jsx } from '@instructure/emotion'
42
41
 
43
42
  import generateStyles from './styles'
44
43
  import generateComponentTheme from './theme'
45
- import { BaseButtonProps, BaseButtonStyleProps } from './types'
44
+
45
+ import { propTypes, allowedProps } from './props'
46
+ import type { BaseButtonProps, BaseButtonStyleProps } from './props'
46
47
 
47
48
  /**
48
49
  ---
@@ -55,108 +56,8 @@ category: components/utilities
55
56
  class BaseButton extends Component<BaseButtonProps> {
56
57
  static readonly componentId = 'BaseButton'
57
58
 
58
- static propTypes = {
59
- // eslint-disable-next-line react/require-default-props
60
- makeStyles: PropTypes.func,
61
- // eslint-disable-next-line react/require-default-props
62
- styles: PropTypes.object,
63
- /**
64
- * Specifies the `Button` children.
65
- */
66
- children: PropTypes.node,
67
- /**
68
- * Specifies the type of the `Button`'s underlying html element.
69
- */
70
- type: PropTypes.oneOf(['button', 'submit', 'reset']),
71
- /**
72
- * The size of the `Button`
73
- */
74
- size: PropTypes.oneOf(['small', 'medium', 'large']),
75
- /**
76
- * Provides a reference to the `Button`'s underlying html element.
77
- */
78
- elementRef: PropTypes.func,
79
- /**
80
- * The element to render as the component root, `Button` by default.
81
- */
82
- as: PropTypes.elementType,
83
- /**
84
- * Specifies if interaction with the `Button` is enabled, disabled, or readonly.
85
- */
86
- interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
87
- /**
88
- * Specifies the color for the `Button`.
89
- */
90
- color: PropTypes.oneOf([
91
- 'primary',
92
- 'primary-inverse',
93
- 'secondary',
94
- 'success',
95
- 'danger'
96
- ]),
97
- /**
98
- * Override the `Button`'s default focus outline color.
99
- */
100
- focusColor: PropTypes.oneOf(['info', 'inverse']),
101
- /**
102
- * The `Button` display property. When set to `inline-block`, the `Button` displays inline with other elements.
103
- * When set to block, the `Button` expands to fill the width of the container.
104
- */
105
- display: PropTypes.oneOf(['inline-block', 'block']),
106
- /**
107
- * Sets the alignment of the `Button` children and/or icon.
108
- */
109
- textAlign: PropTypes.oneOf(['start', 'center']),
110
- /**
111
- * Specifies if the `Button` shape should be a circle or rectangle.
112
- */
113
- shape: PropTypes.oneOf(['rectangle', 'circle']),
114
- /**
115
- * Specifies if the `Button` should render with a solid background. When false, the background is transparent.
116
- */
117
- withBackground: PropTypes.bool,
118
- /**
119
- * Specifies if the `Button` should render with a border.
120
- */
121
- withBorder: PropTypes.bool,
122
- /**
123
- * Designates if the `Button` should render without padding. This option should only be set when `withBorder` and
124
- * `withBackground` are also set to false.
125
- */
126
- isCondensed: PropTypes.bool,
127
- /**
128
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
129
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
130
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
131
- */
132
- margin: ThemeablePropTypes.spacing,
133
- /**
134
- * Specify a mouse cursor to use when hovering over the button.
135
- * The `pointer` cursor is used by default.
136
- */
137
- cursor: PropTypes.string,
138
- /**
139
- * Specifies an href attribute for the `Button`'s underlying html element.
140
- */
141
- href: PropTypes.string,
142
- /**
143
- * Callback fired when the `Button` is clicked.
144
- */
145
- onClick: PropTypes.func,
146
- /**
147
- * Callback fired when the `Button` receives a keydown event.
148
- */
149
- onKeyDown: PropTypes.func,
150
- /**
151
- * An icon, or function that returns an icon.
152
- */
153
- renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
154
- /**
155
- * Specifies the tabindex of the `Button`.
156
- */
157
- tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
158
- } as const
159
-
59
+ static propTypes = propTypes
60
+ static allowedProps = allowedProps
160
61
  static defaultProps = {
161
62
  children: null,
162
63
  type: 'button',
@@ -165,9 +66,7 @@ class BaseButton extends Component<BaseButtonProps> {
165
66
  elementRef: (el) => {},
166
67
  as: 'button',
167
68
  // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
168
- interaction: undefined,
169
69
  color: 'secondary',
170
- focusColor: undefined,
171
70
  shape: 'rectangle',
172
71
  display: 'inline-block',
173
72
  textAlign: 'start',
@@ -176,12 +75,8 @@ class BaseButton extends Component<BaseButtonProps> {
176
75
  isCondensed: false,
177
76
  margin: '0',
178
77
  cursor: 'pointer',
179
- href: undefined,
180
- onClick: undefined,
181
78
  // @ts-expect-error ts-migrate(6133) FIXME: 'event' is declared but its value is never read.
182
- onKeyDown: (event) => {},
183
- renderIcon: undefined,
184
- tabIndex: undefined
79
+ onKeyDown: (event) => {}
185
80
  } as const
186
81
 
187
82
  _rootElement = null
@@ -313,7 +208,7 @@ class BaseButton extends Component<BaseButtonProps> {
313
208
  renderChildren() {
314
209
  const { renderIcon, children, styles } = this.props
315
210
 
316
- const wrappedChildren = <span css={styles.children}>{children}</span>
211
+ const wrappedChildren = <span css={styles?.children}>{children}</span>
317
212
 
318
213
  if (!renderIcon) {
319
214
  return wrappedChildren
@@ -321,25 +216,25 @@ class BaseButton extends Component<BaseButtonProps> {
321
216
 
322
217
  const { hasOnlyIconVisible } = this
323
218
  const wrappedIcon = (
324
- <span css={styles.iconSVG}>{callRenderProp(renderIcon)}</span>
219
+ <span css={styles?.iconSVG}>{callRenderProp(renderIcon)}</span>
325
220
  )
326
221
 
327
222
  const flexChildren = hasOnlyIconVisible ? (
328
- <span css={styles.iconOnly}>
223
+ <span css={styles?.iconOnly}>
329
224
  {wrappedIcon}
330
225
  {children}
331
226
  </span>
332
227
  ) : (
333
228
  [
334
- <span key="icon" css={styles.iconWrapper}>
229
+ <span key="icon" css={styles?.iconWrapper}>
335
230
  {wrappedIcon}
336
231
  </span>,
337
- <span key="children" css={styles.childrenWrapper}>
232
+ <span key="children" css={styles?.childrenWrapper}>
338
233
  {wrappedChildren}
339
234
  </span>
340
235
  ]
341
236
  )
342
- return <span css={styles.childrenLayout}>{flexChildren}</span>
237
+ return <span css={styles?.childrenLayout}>{flexChildren}</span>
343
238
  }
344
239
 
345
240
  render() {
@@ -392,9 +287,9 @@ class BaseButton extends Component<BaseButtonProps> {
392
287
  //@ts-expect-error fix this later to be number
393
288
  tabIndex={onClick && as ? tabIndex || '0' : tabIndex}
394
289
  disabled={isDisabled || isReadOnly}
395
- css={isEnabled ? styles.baseButton : null}
290
+ css={isEnabled ? styles?.baseButton : null}
396
291
  >
397
- <span css={styles.content}>{this.renderChildren()}</span>
292
+ <span css={styles?.content}>{this.renderChildren()}</span>
398
293
  </View>
399
294
  )
400
295
  }