@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.
- package/CHANGELOG.md +6 -0
- package/es/BaseButton/index.js +12 -133
- package/es/BaseButton/props.js +138 -0
- package/es/Button/index.js +4 -87
- package/es/Button/props.js +107 -0
- package/es/CloseButton/index.js +5 -93
- package/es/CloseButton/props.js +103 -0
- package/es/CondensedButton/index.js +4 -65
- package/es/CondensedButton/props.js +86 -0
- package/es/IconButton/index.js +4 -91
- package/es/IconButton/props.js +111 -0
- package/es/ToggleButton/index.js +2 -77
- package/es/ToggleButton/props.js +100 -0
- package/lib/BaseButton/index.js +12 -133
- package/lib/BaseButton/props.js +150 -0
- package/lib/Button/index.js +4 -87
- package/lib/Button/props.js +119 -0
- package/lib/CloseButton/index.js +5 -93
- package/lib/CloseButton/props.js +115 -0
- package/lib/CondensedButton/index.js +4 -65
- package/lib/CondensedButton/props.js +98 -0
- package/lib/IconButton/index.js +4 -91
- package/lib/IconButton/props.js +123 -0
- package/lib/ToggleButton/index.js +3 -79
- package/lib/ToggleButton/props.js +112 -0
- package/package.json +21 -21
- package/src/BaseButton/index.tsx +15 -120
- package/src/BaseButton/props.ts +192 -0
- package/src/BaseButton/styles.ts +1 -1
- package/src/Button/index.tsx +7 -81
- package/src/Button/props.ts +149 -0
- package/src/CloseButton/index.tsx +8 -82
- package/src/CloseButton/props.ts +137 -0
- package/src/CloseButton/styles.ts +1 -1
- package/src/CondensedButton/index.tsx +7 -57
- package/src/CondensedButton/props.ts +118 -0
- package/src/IconButton/index.tsx +7 -84
- package/src/IconButton/props.ts +154 -0
- package/src/ToggleButton/index.tsx +5 -68
- package/src/ToggleButton/props.ts +140 -0
- package/src/index.ts +6 -6
- package/types/BaseButton/index.d.ts +47 -101
- package/types/BaseButton/index.d.ts.map +1 -1
- package/types/BaseButton/{types.d.ts → props.d.ts} +15 -10
- package/types/BaseButton/props.d.ts.map +1 -0
- package/types/BaseButton/styles.d.ts +1 -1
- package/types/Button/index.d.ts +36 -73
- package/types/Button/index.d.ts.map +1 -1
- package/types/Button/{types.d.ts → props.d.ts} +12 -4
- package/types/Button/props.d.ts.map +1 -0
- package/types/CloseButton/index.d.ts +41 -75
- package/types/CloseButton/index.d.ts.map +1 -1
- package/types/CloseButton/props.d.ts +27 -0
- package/types/CloseButton/props.d.ts.map +1 -0
- package/types/CloseButton/styles.d.ts +1 -1
- package/types/CondensedButton/index.d.ts +28 -55
- package/types/CondensedButton/index.d.ts.map +1 -1
- package/types/CondensedButton/props.d.ts +24 -0
- package/types/CondensedButton/props.d.ts.map +1 -0
- package/types/IconButton/index.d.ts +38 -76
- package/types/IconButton/index.d.ts.map +1 -1
- package/types/IconButton/{types.d.ts → props.d.ts} +11 -3
- package/types/IconButton/props.d.ts.map +1 -0
- package/types/ToggleButton/index.d.ts +34 -65
- package/types/ToggleButton/index.d.ts.map +1 -1
- package/types/ToggleButton/{types.d.ts → props.d.ts} +10 -3
- package/types/ToggleButton/props.d.ts.map +1 -0
- package/types/index.d.ts +6 -6
- package/es/BaseButton/types.js +0 -1
- package/es/Button/types.js +0 -1
- package/es/CloseButton/types.js +0 -1
- package/es/CondensedButton/types.js +0 -1
- package/es/IconButton/types.js +0 -1
- package/es/ToggleButton/types.js +0 -1
- package/lib/BaseButton/types.js +0 -1
- package/lib/Button/types.js +0 -1
- package/lib/CloseButton/types.js +0 -1
- package/lib/CondensedButton/types.js +0 -1
- package/lib/IconButton/types.js +0 -1
- package/lib/ToggleButton/types.js +0 -1
- package/src/BaseButton/types.ts +0 -58
- package/src/Button/types.ts +0 -44
- package/src/CloseButton/types.ts +0 -45
- package/src/CondensedButton/types.ts +0 -40
- package/src/IconButton/types.ts +0 -45
- package/src/ToggleButton/types.ts +0 -48
- package/types/BaseButton/types.d.ts.map +0 -1
- package/types/Button/types.d.ts.map +0 -1
- package/types/CloseButton/types.d.ts +0 -22
- package/types/CloseButton/types.d.ts.map +0 -1
- package/types/CondensedButton/types.d.ts +0 -16
- package/types/CondensedButton/types.d.ts.map +0 -1
- package/types/IconButton/types.d.ts.map +0 -1
- package/types/ToggleButton/types.d.ts.map +0 -1
|
@@ -0,0 +1,150 @@
|
|
|
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 _emotion = require("@instructure/emotion");
|
|
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
|
+
* Specifies the `Button` children.
|
|
40
|
+
*/
|
|
41
|
+
children: _propTypes.default.node,
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Specifies the type of the `Button`'s underlying html element.
|
|
45
|
+
*/
|
|
46
|
+
type: _propTypes.default.oneOf(['button', 'submit', 'reset']),
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The size of the `Button`
|
|
50
|
+
*/
|
|
51
|
+
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Provides a reference to the `Button`'s underlying html element.
|
|
55
|
+
*/
|
|
56
|
+
elementRef: _propTypes.default.func,
|
|
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 the `Button` is enabled, disabled, or readonly.
|
|
65
|
+
*/
|
|
66
|
+
interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Specifies the color for the `Button`.
|
|
70
|
+
*/
|
|
71
|
+
color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Override the `Button`'s default focus outline color.
|
|
75
|
+
*/
|
|
76
|
+
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
|
+
display: _propTypes.default.oneOf(['inline-block', 'block']),
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Sets the alignment of the `Button` children and/or icon.
|
|
86
|
+
*/
|
|
87
|
+
textAlign: _propTypes.default.oneOf(['start', 'center']),
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Specifies if the `Button` shape should be a circle or rectangle.
|
|
91
|
+
*/
|
|
92
|
+
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
|
+
withBackground: _propTypes.default.bool,
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Specifies if the `Button` should render with a border.
|
|
101
|
+
*/
|
|
102
|
+
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
|
+
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
|
+
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
|
+
cursor: _propTypes.default.string,
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Specifies an href attribute for the `Button`'s underlying html element.
|
|
125
|
+
*/
|
|
126
|
+
href: _propTypes.default.string,
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Callback fired when the `Button` is clicked.
|
|
130
|
+
*/
|
|
131
|
+
onClick: _propTypes.default.func,
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Callback fired when the `Button` receives a keydown event.
|
|
135
|
+
*/
|
|
136
|
+
onKeyDown: _propTypes.default.func,
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* An icon, or function that returns an icon.
|
|
140
|
+
*/
|
|
141
|
+
renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Specifies the tabindex of the `Button`.
|
|
145
|
+
*/
|
|
146
|
+
tabIndex: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
147
|
+
};
|
|
148
|
+
exports.propTypes = propTypes;
|
|
149
|
+
const allowedProps = ['as', 'children', 'color', 'cursor', 'display', 'elementRef', 'focusColor', 'href', 'interaction', 'isCondensed', 'margin', 'onClick', 'onKeyDown', 'renderIcon', 'shape', 'size', 'tabIndex', 'textAlign', 'type', 'withBackground', 'withBorder'];
|
|
150
|
+
exports.allowedProps = allowedProps;
|
package/lib/Button/index.js
CHANGED
|
@@ -13,8 +13,6 @@ 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
18
|
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
@@ -27,6 +25,8 @@ var _theme = _interopRequireDefault(require("./theme"));
|
|
|
27
25
|
|
|
28
26
|
var _BaseButton = require("../BaseButton");
|
|
29
27
|
|
|
28
|
+
var _props = require("./props");
|
|
29
|
+
|
|
30
30
|
const _excluded = ["children", "type", "size", "as", "color", "focusColor", "display", "textAlign", "withBackground", "margin", "cursor", "href", "renderIcon"];
|
|
31
31
|
|
|
32
32
|
var _dec, _dec2, _class, _class2, _temp;
|
|
@@ -102,102 +102,19 @@ let Button = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 = (0,
|
|
|
102
102
|
return /*#__PURE__*/_react.default.createElement(_BaseButton.BaseButton, buttonProps, children);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
}, _class2.displayName = "Button", _class2.componentId = 'Button', _class2.propTypes = {
|
|
106
|
-
/**
|
|
107
|
-
* Specifies the `Button` children.
|
|
108
|
-
*/
|
|
109
|
-
children: _propTypes.default.node,
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Specifies the type of the `Button`'s underlying html element.
|
|
113
|
-
*/
|
|
114
|
-
type: _propTypes.default.oneOf(['button', 'submit', 'reset']),
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* The size of the `Button`
|
|
118
|
-
*/
|
|
119
|
-
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Provides a reference to the `Button`'s underlying html element.
|
|
123
|
-
*/
|
|
124
|
-
elementRef: _propTypes.default.func,
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* The element to render as the component root, `Button` by default.
|
|
128
|
-
*/
|
|
129
|
-
as: _propTypes.default.elementType,
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Specifies if interaction with the `Button` is enabled, disabled, or readonly.
|
|
133
|
-
*/
|
|
134
|
-
interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Specifies the color for the `Button`.
|
|
138
|
-
*/
|
|
139
|
-
color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Override the `Button`'s default focus outline color.
|
|
143
|
-
*/
|
|
144
|
-
focusColor: _propTypes.default.oneOf(['info', 'inverse']),
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* The `Button` display property. When set to `inline-block`, the `Button` displays inline with other elements.
|
|
148
|
-
* When set to block, the `Button` expands to fill the width of the container.
|
|
149
|
-
*/
|
|
150
|
-
display: _propTypes.default.oneOf(['inline-block', 'block']),
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Sets the alignment of the `Button` children and/or icon.
|
|
154
|
-
*/
|
|
155
|
-
textAlign: _propTypes.default.oneOf(['start', 'center']),
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Specifies if the `Button` should render with a solid background. When false, the background is transparent.
|
|
159
|
-
*/
|
|
160
|
-
withBackground: _propTypes.default.bool,
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
164
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
165
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
166
|
-
*/
|
|
167
|
-
margin: _emotion.ThemeablePropTypes.spacing,
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Specify a mouse cursor to use when hovering over the button.
|
|
171
|
-
* The `pointer` cursor is used by default.
|
|
172
|
-
*/
|
|
173
|
-
cursor: _propTypes.default.string,
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Specifies an href attribute for the `Button`'s underlying html element.
|
|
177
|
-
*/
|
|
178
|
-
href: _propTypes.default.string,
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* An icon, or function that returns an icon.
|
|
182
|
-
*/
|
|
183
|
-
renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func])
|
|
184
|
-
}, _class2.defaultProps = {
|
|
105
|
+
}, _class2.displayName = "Button", _class2.componentId = 'Button', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
185
106
|
children: null,
|
|
186
107
|
type: 'button',
|
|
187
108
|
size: 'medium',
|
|
188
109
|
elementRef: el => {},
|
|
189
110
|
as: 'button',
|
|
190
111
|
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
191
|
-
interaction: void 0,
|
|
192
112
|
color: 'secondary',
|
|
193
|
-
focusColor: void 0,
|
|
194
113
|
display: 'inline-block',
|
|
195
114
|
textAlign: 'center',
|
|
196
115
|
withBackground: true,
|
|
197
116
|
margin: '0',
|
|
198
|
-
cursor: 'pointer'
|
|
199
|
-
href: void 0,
|
|
200
|
-
renderIcon: void 0
|
|
117
|
+
cursor: 'pointer'
|
|
201
118
|
}, _temp)) || _class) || _class);
|
|
202
119
|
exports.Button = Button;
|
|
203
120
|
var _default = Button;
|
|
@@ -0,0 +1,119 @@
|
|
|
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 _emotion = require("@instructure/emotion");
|
|
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
|
+
* Specifies the `Button` children.
|
|
40
|
+
*/
|
|
41
|
+
children: _propTypes.default.node,
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Specifies the type of the `Button`'s underlying html element.
|
|
45
|
+
*/
|
|
46
|
+
type: _propTypes.default.oneOf(['button', 'submit', 'reset']),
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The size of the `Button`
|
|
50
|
+
*/
|
|
51
|
+
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Provides a reference to the `Button`'s underlying html element.
|
|
55
|
+
*/
|
|
56
|
+
elementRef: _propTypes.default.func,
|
|
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 the `Button` is enabled, disabled, or readonly.
|
|
65
|
+
*/
|
|
66
|
+
interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Specifies the color for the `Button`.
|
|
70
|
+
*/
|
|
71
|
+
color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Override the `Button`'s default focus outline color.
|
|
75
|
+
*/
|
|
76
|
+
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
|
+
display: _propTypes.default.oneOf(['inline-block', 'block']),
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Sets the alignment of the `Button` children and/or icon.
|
|
86
|
+
*/
|
|
87
|
+
textAlign: _propTypes.default.oneOf(['start', 'center']),
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Specifies if the `Button` should render with a solid background. When false, the background is transparent.
|
|
91
|
+
*/
|
|
92
|
+
withBackground: _propTypes.default.bool,
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
96
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
97
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
98
|
+
*/
|
|
99
|
+
margin: _emotion.ThemeablePropTypes.spacing,
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Specify a mouse cursor to use when hovering over the button.
|
|
103
|
+
* The `pointer` cursor is used by default.
|
|
104
|
+
*/
|
|
105
|
+
cursor: _propTypes.default.string,
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Specifies an href attribute for the `Button`'s underlying html element.
|
|
109
|
+
*/
|
|
110
|
+
href: _propTypes.default.string,
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* An icon, or function that returns an icon.
|
|
114
|
+
*/
|
|
115
|
+
renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func])
|
|
116
|
+
};
|
|
117
|
+
exports.propTypes = propTypes;
|
|
118
|
+
const allowedProps = ['as', 'children', 'color', 'cursor', 'display', 'elementRef', 'focusColor', 'href', 'interaction', 'margin', 'renderIcon', 'size', 'textAlign', 'type', 'withBackground'];
|
|
119
|
+
exports.allowedProps = allowedProps;
|
package/lib/CloseButton/index.js
CHANGED
|
@@ -11,8 +11,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
|
|
12
12
|
var _react = require("react");
|
|
13
13
|
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
14
|
var _IconXSolid = require("@instructure/ui-icons/lib/IconXSolid.js");
|
|
17
15
|
|
|
18
16
|
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
|
@@ -31,6 +29,8 @@ var _theme = _interopRequireDefault(require("./theme"));
|
|
|
31
29
|
|
|
32
30
|
var _BaseButton = require("../BaseButton");
|
|
33
31
|
|
|
32
|
+
var _props = require("./props");
|
|
33
|
+
|
|
34
34
|
const _excluded = ["screenReaderLabel", "elementRef", "size", "onClick", "margin", "placement", "offset", "type", "as", "href", "cursor", "tabIndex", "styles"];
|
|
35
35
|
|
|
36
36
|
var _dec, _dec2, _class, _class2, _temp;
|
|
@@ -77,7 +77,7 @@ let CloseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
|
|
|
77
77
|
styles = _this$props.styles,
|
|
78
78
|
props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
79
79
|
return (0, _emotion.jsx)("span", Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
|
|
80
|
-
css: styles.closeButton
|
|
80
|
+
css: styles === null || styles === void 0 ? void 0 : styles.closeButton
|
|
81
81
|
}), (0, _emotion.jsx)(_BaseButton.BaseButton, {
|
|
82
82
|
renderIcon: _IconXSolid.IconXSolid,
|
|
83
83
|
elementRef: elementRef,
|
|
@@ -96,104 +96,16 @@ let CloseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
|
|
|
96
96
|
}, (0, _emotion.jsx)(_ScreenReaderContent.ScreenReaderContent, null, screenReaderLabel)));
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
}, _class2.displayName = "CloseButton", _class2.componentId = 'CloseButton', _class2.propTypes = {
|
|
100
|
-
// eslint-disable-next-line react/require-default-props
|
|
101
|
-
makeStyles: _propTypes.default.func,
|
|
102
|
-
// eslint-disable-next-line react/require-default-props
|
|
103
|
-
styles: _propTypes.default.object,
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* An accessible label for the `CloseButton` (required)
|
|
107
|
-
*/
|
|
108
|
-
screenReaderLabel: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]).isRequired,
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Specifies the color for the `CloseButton`.
|
|
112
|
-
*/
|
|
113
|
-
color: _propTypes.default.oneOf(['primary', 'primary-inverse']),
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Specifies if interaction with the `CloseButton` is enabled, disabled, or readonly.
|
|
117
|
-
*/
|
|
118
|
-
interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Provides a reference to the `CloseButton`'s underlying html element.
|
|
122
|
-
*/
|
|
123
|
-
elementRef: _propTypes.default.func,
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* The size of the `CloseButton`
|
|
127
|
-
*/
|
|
128
|
-
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Callback fired when the `CloseButton` is clicked.
|
|
132
|
-
*/
|
|
133
|
-
onClick: _propTypes.default.func,
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
137
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
138
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
139
|
-
*/
|
|
140
|
-
margin: _emotion.ThemeablePropTypes.spacing,
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Specifies the placement of the `CloseButton`
|
|
144
|
-
*/
|
|
145
|
-
placement: _propTypes.default.oneOf(['start', 'end', 'static']),
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Specifies the offset distance for the `CloseButton` with respect to both the top and start/end of the container.
|
|
149
|
-
* Note that for this property to have an effect, the `placement` prop must be set to either `start` or `end`. The
|
|
150
|
-
* offset will also be created with respect to a positioned parent. If it does not appear to be working, try setting
|
|
151
|
-
* the `position` of the parent container to `relative`.
|
|
152
|
-
*/
|
|
153
|
-
offset: _propTypes.default.oneOf(['none', 'x-small', 'small', 'medium']),
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Specifies the type of the `Button`'s underlying html element.
|
|
157
|
-
*/
|
|
158
|
-
type: _propTypes.default.oneOf(['button', 'submit', 'reset']),
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* The element to render as the component root, `CloseButton` by default.
|
|
162
|
-
*/
|
|
163
|
-
as: _propTypes.default.elementType,
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Specifies an href attribute for the `CloseButton`'s underlying html element.
|
|
167
|
-
*/
|
|
168
|
-
href: _propTypes.default.string,
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Specify a mouse cursor to use when hovering over the `CloseButton`.
|
|
172
|
-
*/
|
|
173
|
-
cursor: _propTypes.default.string,
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Specifies the tabindex of the `CloseButton`.
|
|
177
|
-
*/
|
|
178
|
-
tabIndex: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
179
|
-
}, _class2.defaultProps = {
|
|
180
|
-
screenReaderLabel: void 0,
|
|
99
|
+
}, _class2.displayName = "CloseButton", _class2.componentId = 'CloseButton', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
181
100
|
onClick: event => {},
|
|
182
|
-
elementRef: void 0,
|
|
183
|
-
color: void 0,
|
|
184
101
|
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
185
|
-
interaction: void 0,
|
|
186
|
-
disabled: void 0,
|
|
187
|
-
readOnly: void 0,
|
|
188
102
|
type: 'button',
|
|
189
103
|
placement: 'static',
|
|
190
104
|
offset: 'x-small',
|
|
191
105
|
size: 'small',
|
|
192
106
|
margin: '0',
|
|
193
107
|
as: 'button',
|
|
194
|
-
|
|
195
|
-
cursor: 'pointer',
|
|
196
|
-
tabIndex: void 0
|
|
108
|
+
cursor: 'pointer'
|
|
197
109
|
}, _temp)) || _class) || _class);
|
|
198
110
|
exports.CloseButton = CloseButton;
|
|
199
111
|
var _default = CloseButton;
|