@primer/components 0.0.0-20219265511 → 0.0.0-202192675438

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