@primer/components 0.0.0-202192563541 → 0.0.0-2021926104410
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 +14 -4
- package/dist/browser.esm.js +21 -21
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +2 -2
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Item.d.ts +6 -0
- package/lib/ActionList/Item.js +5 -1
- package/lib/Autocomplete/Autocomplete.d.ts +9 -9
- package/lib/Autocomplete/AutocompleteInput.d.ts +9 -9
- package/lib/Button/Button.d.ts +11 -11
- package/lib/Button/ButtonBase.d.ts +1 -1
- package/lib/Button/ButtonClose.d.ts +29 -29
- package/lib/Button/ButtonDanger.d.ts +11 -11
- package/lib/Button/ButtonInvisible.d.ts +11 -11
- package/lib/Button/ButtonOutline.d.ts +11 -11
- package/lib/Button/ButtonPrimary.d.ts +11 -11
- package/lib/Button/ButtonStyles.js +1 -1
- package/lib/CircleBadge.d.ts +2 -2
- package/lib/CircleOcticon.d.ts +33 -33
- package/lib/Dialog.d.ts +35 -35
- package/lib/Dropdown.d.ts +110 -110
- package/lib/DropdownMenu/DropdownButton.d.ts +30 -30
- package/lib/FilterList.d.ts +26 -26
- package/lib/Label.d.ts +1 -1
- package/lib/Position.d.ts +4 -4
- package/lib/ProgressBar.d.ts +1 -1
- package/lib/SelectMenu/SelectMenu.d.ts +149 -149
- package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib/TextInputWithTokens.d.ts +9 -9
- package/lib/Timeline.d.ts +33 -33
- package/lib/Token/AvatarToken.d.ts +1 -1
- package/lib/Token/IssueLabelToken.d.ts +1 -1
- package/lib/Token/Token.d.ts +1 -1
- package/lib/_TextInputWrapper.d.ts +1 -1
- package/lib/constants.js +1 -3
- package/lib/utils/testing.d.ts +1 -1
- package/lib-esm/ActionList/Item.d.ts +6 -0
- package/lib-esm/ActionList/Item.js +5 -1
- package/lib-esm/Autocomplete/Autocomplete.d.ts +9 -9
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +9 -9
- package/lib-esm/Button/Button.d.ts +11 -11
- package/lib-esm/Button/ButtonBase.d.ts +1 -1
- package/lib-esm/Button/ButtonClose.d.ts +29 -29
- package/lib-esm/Button/ButtonDanger.d.ts +11 -11
- package/lib-esm/Button/ButtonInvisible.d.ts +11 -11
- package/lib-esm/Button/ButtonOutline.d.ts +11 -11
- package/lib-esm/Button/ButtonPrimary.d.ts +11 -11
- package/lib-esm/Button/ButtonStyles.js +1 -1
- package/lib-esm/CircleBadge.d.ts +2 -2
- package/lib-esm/CircleOcticon.d.ts +33 -33
- package/lib-esm/Dialog.d.ts +35 -35
- package/lib-esm/Dropdown.d.ts +110 -110
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +30 -30
- package/lib-esm/FilterList.d.ts +26 -26
- package/lib-esm/Label.d.ts +1 -1
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/ProgressBar.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenu.d.ts +149 -149
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib-esm/TextInputWithTokens.d.ts +9 -9
- package/lib-esm/Timeline.d.ts +33 -33
- package/lib-esm/Token/AvatarToken.d.ts +1 -1
- package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
- package/lib-esm/Token/Token.d.ts +1 -1
- package/lib-esm/_TextInputWrapper.d.ts +1 -1
- package/lib-esm/constants.js +1 -3
- package/lib-esm/utils/testing.d.ts +1 -1
- package/package.json +1 -1
- package/lib/NewButton/button.d.ts +0 -18
- package/lib/NewButton/button.js +0 -278
- package/lib/NewButton/index.d.ts +0 -4
- package/lib/NewButton/index.js +0 -21
- package/lib-esm/NewButton/button.d.ts +0 -18
- package/lib-esm/NewButton/button.js +0 -256
- package/lib-esm/NewButton/index.d.ts +0 -4
- package/lib-esm/NewButton/index.js +0 -3
package/lib/NewButton/button.js
DELETED
@@ -1,278 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
9
|
-
|
10
|
-
var _Box = _interopRequireDefault(require("../Box"));
|
11
|
-
|
12
|
-
var _styledSystem = require("styled-system");
|
13
|
-
|
14
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
15
|
-
|
16
|
-
var _sx = _interopRequireDefault(require("../sx"));
|
17
|
-
|
18
|
-
var _constants = require("../constants");
|
19
|
-
|
20
|
-
var _ButtonStyles = _interopRequireDefault(require("../Button/ButtonStyles"));
|
21
|
-
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23
|
-
|
24
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
25
|
-
|
26
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
27
|
-
|
28
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
29
|
-
|
30
|
-
const sizes = (0, _styledSystem.variant)({
|
31
|
-
prop: 'size',
|
32
|
-
variants: {
|
33
|
-
small: {
|
34
|
-
p: '4px 12px',
|
35
|
-
fontSize: 0
|
36
|
-
},
|
37
|
-
medium: {
|
38
|
-
fontSize: 1
|
39
|
-
},
|
40
|
-
large: {
|
41
|
-
fontSize: 2,
|
42
|
-
p: '10px 20px'
|
43
|
-
}
|
44
|
-
}
|
45
|
-
});
|
46
|
-
|
47
|
-
const getVariantStyles = (theme, variant = 'default') => {
|
48
|
-
const style = {
|
49
|
-
default: `
|
50
|
-
padding: 5px 16px;
|
51
|
-
color: ${(0, _constants.get)('colors.btn.text')({
|
52
|
-
theme
|
53
|
-
})};
|
54
|
-
background-color: ${(0, _constants.get)('colors.btn.bg')({
|
55
|
-
theme
|
56
|
-
})};
|
57
|
-
border-width: 1px;
|
58
|
-
border-style: solid;
|
59
|
-
border-color: ${(0, _constants.get)('colors.btn.border')({
|
60
|
-
theme
|
61
|
-
})};
|
62
|
-
box-shadow: ${((0, _constants.get)('shadows.btn.shadow')({
|
63
|
-
theme
|
64
|
-
}), (0, _constants.get)('shadows.btn.insetShadow')({
|
65
|
-
theme
|
66
|
-
}))};
|
67
|
-
&:hover {
|
68
|
-
background-color: ${(0, _constants.get)('colors.btn.hoverBg')({
|
69
|
-
theme
|
70
|
-
})};
|
71
|
-
}
|
72
|
-
// focus must come before :active so that the active box shadow overrides
|
73
|
-
&:focus {
|
74
|
-
box-shadow: ${(0, _constants.get)('shadows.btn.focusShadow')({
|
75
|
-
theme
|
76
|
-
})};
|
77
|
-
}
|
78
|
-
&:active {
|
79
|
-
background-color: ${(0, _constants.get)('colors.btn.selectedBg')({
|
80
|
-
theme
|
81
|
-
})};
|
82
|
-
box-shadow: ${(0, _constants.get)('shadows.btn.shadowActive')({
|
83
|
-
theme
|
84
|
-
})};
|
85
|
-
}
|
86
|
-
&:disabled {
|
87
|
-
color: ${(0, _constants.get)('colors.primer.fg.disabled')({
|
88
|
-
theme
|
89
|
-
})};
|
90
|
-
}
|
91
|
-
`,
|
92
|
-
primary: `
|
93
|
-
padding: 5px 16px;
|
94
|
-
color: ${(0, _constants.get)('colors.btn.primary.text')({
|
95
|
-
theme
|
96
|
-
})};
|
97
|
-
background-color: ${(0, _constants.get)('colors.btn.primary.bg')({
|
98
|
-
theme
|
99
|
-
})};
|
100
|
-
border-width: 1px;
|
101
|
-
border-style: solid;
|
102
|
-
border-color: ${(0, _constants.get)('colors.border.subtle')({
|
103
|
-
theme
|
104
|
-
})};
|
105
|
-
box-shadow: ${(0, _constants.get)('shadows.btn.primary.shadow')({
|
106
|
-
theme
|
107
|
-
})};
|
108
|
-
|
109
|
-
&:hover {
|
110
|
-
color: ${(0, _constants.get)('colors.btn.primary.hoverText')({
|
111
|
-
theme
|
112
|
-
})};
|
113
|
-
background-color: ${(0, _constants.get)('colors.btn.primary.hoverBg')({
|
114
|
-
theme
|
115
|
-
})};
|
116
|
-
}
|
117
|
-
// focus must come before :active so that the active box shadow overrides
|
118
|
-
&:focus {
|
119
|
-
box-shadow: ${(0, _constants.get)('shadows.btn.primary.focusShadow')({
|
120
|
-
theme
|
121
|
-
})};
|
122
|
-
}
|
123
|
-
|
124
|
-
&:active {
|
125
|
-
background-color: ${(0, _constants.get)('colors.btn.primary.selectedBg')({
|
126
|
-
theme
|
127
|
-
})};
|
128
|
-
box-shadow: ${(0, _constants.get)('shadows.btn.primary.selectedShadow')({
|
129
|
-
theme
|
130
|
-
})};
|
131
|
-
}
|
132
|
-
|
133
|
-
&:disabled {
|
134
|
-
color: ${(0, _constants.get)('colors.btn.primary.disabledText')({
|
135
|
-
theme
|
136
|
-
})};
|
137
|
-
background-color: ${(0, _constants.get)('colors.btn.primary.disabledBg')({
|
138
|
-
theme
|
139
|
-
})};
|
140
|
-
}`,
|
141
|
-
danger: `
|
142
|
-
padding: 5px 16px;
|
143
|
-
color: ${(0, _constants.get)('colors.btn.danger.text')({
|
144
|
-
theme
|
145
|
-
})};
|
146
|
-
border: 1px solid ${(0, _constants.get)('colors.btn.border')({
|
147
|
-
theme
|
148
|
-
})};
|
149
|
-
background-color: ${(0, _constants.get)('colors.btn.bg')({
|
150
|
-
theme
|
151
|
-
})};
|
152
|
-
box-shadow: ${(0, _constants.get)('shadows.btn.shadow')({
|
153
|
-
theme
|
154
|
-
})};
|
155
|
-
|
156
|
-
&:hover {
|
157
|
-
color: ${(0, _constants.get)('colors.btn.danger.hoverText')({
|
158
|
-
theme
|
159
|
-
})};
|
160
|
-
background-color: ${(0, _constants.get)('colors.btn.danger.hoverBg')({
|
161
|
-
theme
|
162
|
-
})};
|
163
|
-
border-color: ${(0, _constants.get)('colors.btn.danger.hoverBorder')({
|
164
|
-
theme
|
165
|
-
})};
|
166
|
-
box-shadow: ${(0, _constants.get)('shadows.btn.danger.hoverShadow')({
|
167
|
-
theme
|
168
|
-
})};
|
169
|
-
}
|
170
|
-
// focus must come before :active so that the active box shadow overrides
|
171
|
-
&:focus {
|
172
|
-
border-color: ${(0, _constants.get)('colors.btn.danger.focusBorder')({
|
173
|
-
theme
|
174
|
-
})};
|
175
|
-
box-shadow: ${(0, _constants.get)('shadows.btn.danger.focusShadow')({
|
176
|
-
theme
|
177
|
-
})};
|
178
|
-
}
|
179
|
-
|
180
|
-
&:active {
|
181
|
-
color: ${(0, _constants.get)('colors.btn.danger.selectedText')({
|
182
|
-
theme
|
183
|
-
})};
|
184
|
-
background-color: ${(0, _constants.get)('colors.btn.danger.selectedBg')({
|
185
|
-
theme
|
186
|
-
})};
|
187
|
-
box-shadow: ${(0, _constants.get)('shadows.btn.danger.selectedShadow')({
|
188
|
-
theme
|
189
|
-
})};
|
190
|
-
border-color: ${(0, _constants.get)('colors.btn.danger.selectedBorder')({
|
191
|
-
theme
|
192
|
-
})};
|
193
|
-
}
|
194
|
-
|
195
|
-
&:disabled {
|
196
|
-
color: ${(0, _constants.get)('colors.btn.danger.disabledText')({
|
197
|
-
theme
|
198
|
-
})};
|
199
|
-
background-color: ${(0, _constants.get)('colors.btn.danger.disabledBg')({
|
200
|
-
theme
|
201
|
-
})};
|
202
|
-
border-color: ${(0, _constants.get)('colors.btn.danger.disabledBorder')({
|
203
|
-
theme
|
204
|
-
})};
|
205
|
-
}
|
206
|
-
`,
|
207
|
-
invisible: `
|
208
|
-
padding: 6px 16px;
|
209
|
-
color: ${(0, _constants.get)('colors.accent.fg')({
|
210
|
-
theme
|
211
|
-
})};
|
212
|
-
background-color: transparent;
|
213
|
-
border: 0;
|
214
|
-
border-radius: ${(0, _constants.get)('radii.2')({
|
215
|
-
theme
|
216
|
-
})};
|
217
|
-
box-shadow: none;
|
218
|
-
|
219
|
-
&:disabled {
|
220
|
-
color: ${(0, _constants.get)('colors.primer.fg.disabled')({
|
221
|
-
theme
|
222
|
-
})};
|
223
|
-
}
|
224
|
-
&:focus {
|
225
|
-
box-shadow: ${(0, _constants.get)('shadows.btn.focusShadow')({
|
226
|
-
theme
|
227
|
-
})};
|
228
|
-
}
|
229
|
-
&:hover {
|
230
|
-
background-color: ${(0, _constants.get)('colors.btn.hoverBg')({
|
231
|
-
theme
|
232
|
-
})};
|
233
|
-
}
|
234
|
-
&:active {
|
235
|
-
background-color: ${(0, _constants.get)('colors.btn.selectedBg')({
|
236
|
-
theme
|
237
|
-
})};
|
238
|
-
}
|
239
|
-
`,
|
240
|
-
block: ``
|
241
|
-
};
|
242
|
-
return style[variant];
|
243
|
-
};
|
244
|
-
|
245
|
-
const ButtonBase = _styledComponents.default.button.withConfig({
|
246
|
-
displayName: "button__ButtonBase",
|
247
|
-
componentId: "sc-15k5iqk-0"
|
248
|
-
})(["", " ", " ", " ", " ", " ", ""], _ButtonStyles.default, props => getVariantStyles(props.theme, props.variant), sizes, props => props.iconOnly ? `padding: 4px 6px;` : '', _sx.default, _styledSystem.fontSize);
|
249
|
-
|
250
|
-
const Button = /*#__PURE__*/(0, _react.forwardRef)(({
|
251
|
-
icon: Icon,
|
252
|
-
children,
|
253
|
-
...props
|
254
|
-
}) => {
|
255
|
-
let iconOnly = false;
|
256
|
-
|
257
|
-
if (!children) {
|
258
|
-
iconOnly = true;
|
259
|
-
}
|
260
|
-
|
261
|
-
let iconWrapStyles = {
|
262
|
-
display: 'inline-block',
|
263
|
-
...(!iconOnly ? {
|
264
|
-
pr: 3
|
265
|
-
} : {})
|
266
|
-
};
|
267
|
-
return /*#__PURE__*/_react.default.createElement(ButtonBase, _extends({}, props, {
|
268
|
-
iconOnly: iconOnly
|
269
|
-
}), Icon && /*#__PURE__*/_react.default.createElement(_Box.default, {
|
270
|
-
sx: iconWrapStyles
|
271
|
-
}, /*#__PURE__*/_react.default.createElement(Icon, null)), children);
|
272
|
-
});
|
273
|
-
Button.displayName = 'Button';
|
274
|
-
Button.defaultProps = {
|
275
|
-
size: 'medium'
|
276
|
-
};
|
277
|
-
var _default = Button;
|
278
|
-
exports.default = _default;
|
package/lib/NewButton/index.d.ts
DELETED
package/lib/NewButton/index.js
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
Object.defineProperty(exports, "ButtonProps", {
|
7
|
-
enumerable: true,
|
8
|
-
get: function () {
|
9
|
-
return _button.ButtonProps;
|
10
|
-
}
|
11
|
-
});
|
12
|
-
exports.default = void 0;
|
13
|
-
|
14
|
-
var _button = _interopRequireWildcard(require("./button"));
|
15
|
-
|
16
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
17
|
-
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
19
|
-
|
20
|
-
var _default = _button.default;
|
21
|
-
exports.default = _default;
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import React, { ReactNode } from 'react';
|
2
|
-
import { IconProps } from '@primer/octicons-react';
|
3
|
-
import { FontSizeProps } from 'styled-system';
|
4
|
-
import { SxProp } from '../sx';
|
5
|
-
declare type Variant = 'default' | 'primary' | 'invisible' | 'block' | 'danger';
|
6
|
-
export declare type ButtonProps = {
|
7
|
-
children: ReactNode;
|
8
|
-
variant: Variant;
|
9
|
-
size: 'small' | 'medium' | 'large';
|
10
|
-
icon?: React.FunctionComponent<IconProps>;
|
11
|
-
} & SxProp & FontSizeProps;
|
12
|
-
declare const Button: React.ForwardRefExoticComponent<{
|
13
|
-
children: ReactNode;
|
14
|
-
variant: Variant;
|
15
|
-
size: 'small' | 'medium' | 'large';
|
16
|
-
icon?: React.FunctionComponent<IconProps> | undefined;
|
17
|
-
} & SxProp & FontSizeProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
18
|
-
export default Button;
|
@@ -1,256 +0,0 @@
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
|
-
|
3
|
-
import React, { forwardRef } from 'react';
|
4
|
-
import Box from '../Box';
|
5
|
-
import { fontSize, variant } from 'styled-system';
|
6
|
-
import styled from 'styled-components';
|
7
|
-
import sx from '../sx';
|
8
|
-
import { get } from '../constants';
|
9
|
-
import buttonBaseStyles from '../Button/ButtonStyles';
|
10
|
-
const sizes = variant({
|
11
|
-
prop: 'size',
|
12
|
-
variants: {
|
13
|
-
small: {
|
14
|
-
p: '4px 12px',
|
15
|
-
fontSize: 0
|
16
|
-
},
|
17
|
-
medium: {
|
18
|
-
fontSize: 1
|
19
|
-
},
|
20
|
-
large: {
|
21
|
-
fontSize: 2,
|
22
|
-
p: '10px 20px'
|
23
|
-
}
|
24
|
-
}
|
25
|
-
});
|
26
|
-
|
27
|
-
const getVariantStyles = (theme, variant = 'default') => {
|
28
|
-
const style = {
|
29
|
-
default: `
|
30
|
-
padding: 5px 16px;
|
31
|
-
color: ${get('colors.btn.text')({
|
32
|
-
theme
|
33
|
-
})};
|
34
|
-
background-color: ${get('colors.btn.bg')({
|
35
|
-
theme
|
36
|
-
})};
|
37
|
-
border-width: 1px;
|
38
|
-
border-style: solid;
|
39
|
-
border-color: ${get('colors.btn.border')({
|
40
|
-
theme
|
41
|
-
})};
|
42
|
-
box-shadow: ${(get('shadows.btn.shadow')({
|
43
|
-
theme
|
44
|
-
}), get('shadows.btn.insetShadow')({
|
45
|
-
theme
|
46
|
-
}))};
|
47
|
-
&:hover {
|
48
|
-
background-color: ${get('colors.btn.hoverBg')({
|
49
|
-
theme
|
50
|
-
})};
|
51
|
-
}
|
52
|
-
// focus must come before :active so that the active box shadow overrides
|
53
|
-
&:focus {
|
54
|
-
box-shadow: ${get('shadows.btn.focusShadow')({
|
55
|
-
theme
|
56
|
-
})};
|
57
|
-
}
|
58
|
-
&:active {
|
59
|
-
background-color: ${get('colors.btn.selectedBg')({
|
60
|
-
theme
|
61
|
-
})};
|
62
|
-
box-shadow: ${get('shadows.btn.shadowActive')({
|
63
|
-
theme
|
64
|
-
})};
|
65
|
-
}
|
66
|
-
&:disabled {
|
67
|
-
color: ${get('colors.primer.fg.disabled')({
|
68
|
-
theme
|
69
|
-
})};
|
70
|
-
}
|
71
|
-
`,
|
72
|
-
primary: `
|
73
|
-
padding: 5px 16px;
|
74
|
-
color: ${get('colors.btn.primary.text')({
|
75
|
-
theme
|
76
|
-
})};
|
77
|
-
background-color: ${get('colors.btn.primary.bg')({
|
78
|
-
theme
|
79
|
-
})};
|
80
|
-
border-width: 1px;
|
81
|
-
border-style: solid;
|
82
|
-
border-color: ${get('colors.border.subtle')({
|
83
|
-
theme
|
84
|
-
})};
|
85
|
-
box-shadow: ${get('shadows.btn.primary.shadow')({
|
86
|
-
theme
|
87
|
-
})};
|
88
|
-
|
89
|
-
&:hover {
|
90
|
-
color: ${get('colors.btn.primary.hoverText')({
|
91
|
-
theme
|
92
|
-
})};
|
93
|
-
background-color: ${get('colors.btn.primary.hoverBg')({
|
94
|
-
theme
|
95
|
-
})};
|
96
|
-
}
|
97
|
-
// focus must come before :active so that the active box shadow overrides
|
98
|
-
&:focus {
|
99
|
-
box-shadow: ${get('shadows.btn.primary.focusShadow')({
|
100
|
-
theme
|
101
|
-
})};
|
102
|
-
}
|
103
|
-
|
104
|
-
&:active {
|
105
|
-
background-color: ${get('colors.btn.primary.selectedBg')({
|
106
|
-
theme
|
107
|
-
})};
|
108
|
-
box-shadow: ${get('shadows.btn.primary.selectedShadow')({
|
109
|
-
theme
|
110
|
-
})};
|
111
|
-
}
|
112
|
-
|
113
|
-
&:disabled {
|
114
|
-
color: ${get('colors.btn.primary.disabledText')({
|
115
|
-
theme
|
116
|
-
})};
|
117
|
-
background-color: ${get('colors.btn.primary.disabledBg')({
|
118
|
-
theme
|
119
|
-
})};
|
120
|
-
}`,
|
121
|
-
danger: `
|
122
|
-
padding: 5px 16px;
|
123
|
-
color: ${get('colors.btn.danger.text')({
|
124
|
-
theme
|
125
|
-
})};
|
126
|
-
border: 1px solid ${get('colors.btn.border')({
|
127
|
-
theme
|
128
|
-
})};
|
129
|
-
background-color: ${get('colors.btn.bg')({
|
130
|
-
theme
|
131
|
-
})};
|
132
|
-
box-shadow: ${get('shadows.btn.shadow')({
|
133
|
-
theme
|
134
|
-
})};
|
135
|
-
|
136
|
-
&:hover {
|
137
|
-
color: ${get('colors.btn.danger.hoverText')({
|
138
|
-
theme
|
139
|
-
})};
|
140
|
-
background-color: ${get('colors.btn.danger.hoverBg')({
|
141
|
-
theme
|
142
|
-
})};
|
143
|
-
border-color: ${get('colors.btn.danger.hoverBorder')({
|
144
|
-
theme
|
145
|
-
})};
|
146
|
-
box-shadow: ${get('shadows.btn.danger.hoverShadow')({
|
147
|
-
theme
|
148
|
-
})};
|
149
|
-
}
|
150
|
-
// focus must come before :active so that the active box shadow overrides
|
151
|
-
&:focus {
|
152
|
-
border-color: ${get('colors.btn.danger.focusBorder')({
|
153
|
-
theme
|
154
|
-
})};
|
155
|
-
box-shadow: ${get('shadows.btn.danger.focusShadow')({
|
156
|
-
theme
|
157
|
-
})};
|
158
|
-
}
|
159
|
-
|
160
|
-
&:active {
|
161
|
-
color: ${get('colors.btn.danger.selectedText')({
|
162
|
-
theme
|
163
|
-
})};
|
164
|
-
background-color: ${get('colors.btn.danger.selectedBg')({
|
165
|
-
theme
|
166
|
-
})};
|
167
|
-
box-shadow: ${get('shadows.btn.danger.selectedShadow')({
|
168
|
-
theme
|
169
|
-
})};
|
170
|
-
border-color: ${get('colors.btn.danger.selectedBorder')({
|
171
|
-
theme
|
172
|
-
})};
|
173
|
-
}
|
174
|
-
|
175
|
-
&:disabled {
|
176
|
-
color: ${get('colors.btn.danger.disabledText')({
|
177
|
-
theme
|
178
|
-
})};
|
179
|
-
background-color: ${get('colors.btn.danger.disabledBg')({
|
180
|
-
theme
|
181
|
-
})};
|
182
|
-
border-color: ${get('colors.btn.danger.disabledBorder')({
|
183
|
-
theme
|
184
|
-
})};
|
185
|
-
}
|
186
|
-
`,
|
187
|
-
invisible: `
|
188
|
-
padding: 6px 16px;
|
189
|
-
color: ${get('colors.accent.fg')({
|
190
|
-
theme
|
191
|
-
})};
|
192
|
-
background-color: transparent;
|
193
|
-
border: 0;
|
194
|
-
border-radius: ${get('radii.2')({
|
195
|
-
theme
|
196
|
-
})};
|
197
|
-
box-shadow: none;
|
198
|
-
|
199
|
-
&:disabled {
|
200
|
-
color: ${get('colors.primer.fg.disabled')({
|
201
|
-
theme
|
202
|
-
})};
|
203
|
-
}
|
204
|
-
&:focus {
|
205
|
-
box-shadow: ${get('shadows.btn.focusShadow')({
|
206
|
-
theme
|
207
|
-
})};
|
208
|
-
}
|
209
|
-
&:hover {
|
210
|
-
background-color: ${get('colors.btn.hoverBg')({
|
211
|
-
theme
|
212
|
-
})};
|
213
|
-
}
|
214
|
-
&:active {
|
215
|
-
background-color: ${get('colors.btn.selectedBg')({
|
216
|
-
theme
|
217
|
-
})};
|
218
|
-
}
|
219
|
-
`,
|
220
|
-
block: ``
|
221
|
-
};
|
222
|
-
return style[variant];
|
223
|
-
};
|
224
|
-
|
225
|
-
const ButtonBase = styled.button.withConfig({
|
226
|
-
displayName: "button__ButtonBase",
|
227
|
-
componentId: "sc-15k5iqk-0"
|
228
|
-
})(["", " ", " ", " ", " ", " ", ""], buttonBaseStyles, props => getVariantStyles(props.theme, props.variant), sizes, props => props.iconOnly ? `padding: 4px 6px;` : '', sx, fontSize);
|
229
|
-
const Button = /*#__PURE__*/forwardRef(({
|
230
|
-
icon: Icon,
|
231
|
-
children,
|
232
|
-
...props
|
233
|
-
}) => {
|
234
|
-
let iconOnly = false;
|
235
|
-
|
236
|
-
if (!children) {
|
237
|
-
iconOnly = true;
|
238
|
-
}
|
239
|
-
|
240
|
-
let iconWrapStyles = {
|
241
|
-
display: 'inline-block',
|
242
|
-
...(!iconOnly ? {
|
243
|
-
pr: 3
|
244
|
-
} : {})
|
245
|
-
};
|
246
|
-
return /*#__PURE__*/React.createElement(ButtonBase, _extends({}, props, {
|
247
|
-
iconOnly: iconOnly
|
248
|
-
}), Icon && /*#__PURE__*/React.createElement(Box, {
|
249
|
-
sx: iconWrapStyles
|
250
|
-
}, /*#__PURE__*/React.createElement(Icon, null)), children);
|
251
|
-
});
|
252
|
-
Button.displayName = 'Button';
|
253
|
-
Button.defaultProps = {
|
254
|
-
size: 'medium'
|
255
|
-
};
|
256
|
-
export default Button;
|