@primer/components 0.0.0-202192724324 → 0.0.0-2021928152548
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 +4 -14
- package/dist/browser.esm.js +806 -803
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +450 -447
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Item.d.ts +0 -6
- package/lib/ActionList/Item.js +1 -5
- package/lib/ActionList2/Description.d.ts +6 -0
- package/lib/ActionList2/Description.js +53 -0
- package/lib/ActionList2/Divider.d.ts +5 -0
- package/lib/ActionList2/Divider.js +33 -0
- package/lib/ActionList2/Group.d.ts +5 -0
- package/lib/ActionList2/Group.js +46 -0
- package/lib/ActionList2/Header.d.ts +26 -0
- package/lib/ActionList2/Header.js +55 -0
- package/lib/ActionList2/Item.d.ts +48 -0
- package/lib/ActionList2/Item.js +204 -0
- package/lib/ActionList2/List.d.ts +26 -0
- package/lib/ActionList2/List.js +56 -0
- package/lib/ActionList2/Selection.d.ts +5 -0
- package/lib/ActionList2/Selection.js +64 -0
- package/lib/ActionList2/Visuals.d.ts +11 -0
- package/lib/ActionList2/Visuals.js +90 -0
- package/lib/ActionList2/hacks.d.ts +30 -0
- package/lib/ActionList2/hacks.js +38 -0
- package/lib/ActionList2/index.d.ts +25 -0
- package/lib/ActionList2/index.js +36 -0
- package/lib/ActionMenu.js +2 -2
- 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/Dialog.d.ts +5 -5
- package/lib/Dialog/Dialog.js +22 -13
- package/lib/Dialog.d.ts +35 -35
- package/lib/Dropdown.d.ts +692 -60
- package/lib/Dropdown.js +5 -6
- 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/index.d.ts +1 -0
- package/lib/index.js +8 -0
- package/lib/sx.d.ts +2 -0
- package/lib/sx.js +8 -0
- package/lib/utils/create-slots.d.ts +17 -0
- package/lib/utils/create-slots.js +105 -0
- package/lib/utils/testing.d.ts +1 -1
- package/lib/utils/use-force-update.d.ts +1 -0
- package/lib/utils/use-force-update.js +19 -0
- package/lib-esm/ActionList/Item.d.ts +0 -6
- package/lib-esm/ActionList/Item.js +1 -5
- package/lib-esm/ActionList2/Description.d.ts +6 -0
- package/lib-esm/ActionList2/Description.js +37 -0
- package/lib-esm/ActionList2/Divider.d.ts +5 -0
- package/lib-esm/ActionList2/Divider.js +21 -0
- package/lib-esm/ActionList2/Group.d.ts +5 -0
- package/lib-esm/ActionList2/Group.js +32 -0
- package/lib-esm/ActionList2/Header.d.ts +26 -0
- package/lib-esm/ActionList2/Header.js +45 -0
- package/lib-esm/ActionList2/Item.d.ts +48 -0
- package/lib-esm/ActionList2/Item.js +176 -0
- package/lib-esm/ActionList2/List.d.ts +26 -0
- package/lib-esm/ActionList2/List.js +38 -0
- package/lib-esm/ActionList2/Selection.d.ts +5 -0
- package/lib-esm/ActionList2/Selection.js +48 -0
- package/lib-esm/ActionList2/Visuals.d.ts +11 -0
- package/lib-esm/ActionList2/Visuals.js +68 -0
- package/lib-esm/ActionList2/hacks.d.ts +30 -0
- package/lib-esm/ActionList2/hacks.js +30 -0
- package/lib-esm/ActionList2/index.d.ts +25 -0
- package/lib-esm/ActionList2/index.js +23 -0
- package/lib-esm/ActionMenu.js +2 -2
- 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/Dialog.d.ts +5 -5
- package/lib-esm/Dialog/Dialog.js +21 -13
- package/lib-esm/Dialog.d.ts +35 -35
- package/lib-esm/Dropdown.d.ts +692 -60
- package/lib-esm/Dropdown.js +3 -4
- 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/index.d.ts +1 -0
- package/lib-esm/index.js +1 -0
- package/lib-esm/sx.d.ts +2 -0
- package/lib-esm/sx.js +3 -1
- package/lib-esm/utils/create-slots.d.ts +17 -0
- package/lib-esm/utils/create-slots.js +84 -0
- package/lib-esm/utils/testing.d.ts +1 -1
- package/lib-esm/utils/use-force-update.d.ts +1 -0
- package/lib-esm/utils/use-force-update.js +6 -0
- package/package.json +6 -6
- package/lib/NewButton/button.d.ts +0 -24
- package/lib/NewButton/button.js +0 -292
- package/lib/NewButton/counter.d.ts +0 -6
- package/lib/NewButton/counter.js +0 -33
- package/lib/NewButton/index.d.ts +0 -4
- package/lib/NewButton/index.js +0 -21
- package/lib-esm/NewButton/button.d.ts +0 -24
- package/lib-esm/NewButton/button.js +0 -268
- package/lib-esm/NewButton/counter.d.ts +0 -6
- package/lib-esm/NewButton/counter.js +0 -21
- package/lib-esm/NewButton/index.d.ts +0 -4
- package/lib-esm/NewButton/index.js +0 -3
@@ -1,268 +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 { TriangleDownIcon } from '@primer/octicons-react';
|
5
|
-
import Box from '../Box';
|
6
|
-
import { fontSize, variant } from 'styled-system';
|
7
|
-
import styled from 'styled-components';
|
8
|
-
import sx from '../sx';
|
9
|
-
import { get } from '../constants';
|
10
|
-
import buttonBaseStyles from '../Button/ButtonStyles';
|
11
|
-
import Counter from './counter';
|
12
|
-
const sizes = variant({
|
13
|
-
prop: 'size',
|
14
|
-
variants: {
|
15
|
-
small: {
|
16
|
-
p: '4px 12px',
|
17
|
-
fontSize: 0
|
18
|
-
},
|
19
|
-
medium: {
|
20
|
-
fontSize: 1
|
21
|
-
},
|
22
|
-
large: {
|
23
|
-
fontSize: 2,
|
24
|
-
p: '10px 20px'
|
25
|
-
}
|
26
|
-
}
|
27
|
-
});
|
28
|
-
|
29
|
-
const getVariantStyles = (theme, variant = 'default') => {
|
30
|
-
const style = {
|
31
|
-
default: `
|
32
|
-
padding: 5px 16px;
|
33
|
-
color: ${get('colors.btn.text')({
|
34
|
-
theme
|
35
|
-
})};
|
36
|
-
background-color: ${get('colors.btn.bg')({
|
37
|
-
theme
|
38
|
-
})};
|
39
|
-
border-width: 1px;
|
40
|
-
border-style: solid;
|
41
|
-
border-color: ${get('colors.btn.border')({
|
42
|
-
theme
|
43
|
-
})};
|
44
|
-
box-shadow: ${(get('shadows.btn.shadow')({
|
45
|
-
theme
|
46
|
-
}), get('shadows.btn.insetShadow')({
|
47
|
-
theme
|
48
|
-
}))};
|
49
|
-
&:hover {
|
50
|
-
background-color: ${get('colors.btn.hoverBg')({
|
51
|
-
theme
|
52
|
-
})};
|
53
|
-
}
|
54
|
-
// focus must come before :active so that the active box shadow overrides
|
55
|
-
&:focus {
|
56
|
-
box-shadow: ${get('shadows.btn.focusShadow')({
|
57
|
-
theme
|
58
|
-
})};
|
59
|
-
}
|
60
|
-
&:active {
|
61
|
-
background-color: ${get('colors.btn.selectedBg')({
|
62
|
-
theme
|
63
|
-
})};
|
64
|
-
box-shadow: ${get('shadows.btn.shadowActive')({
|
65
|
-
theme
|
66
|
-
})};
|
67
|
-
}
|
68
|
-
&:disabled {
|
69
|
-
color: ${get('colors.primer.fg.disabled')({
|
70
|
-
theme
|
71
|
-
})};
|
72
|
-
}
|
73
|
-
`,
|
74
|
-
primary: `
|
75
|
-
padding: 5px 16px;
|
76
|
-
color: ${get('colors.btn.primary.text')({
|
77
|
-
theme
|
78
|
-
})};
|
79
|
-
background-color: ${get('colors.btn.primary.bg')({
|
80
|
-
theme
|
81
|
-
})};
|
82
|
-
border-width: 1px;
|
83
|
-
border-style: solid;
|
84
|
-
border-color: ${get('colors.border.subtle')({
|
85
|
-
theme
|
86
|
-
})};
|
87
|
-
box-shadow: ${get('shadows.btn.primary.shadow')({
|
88
|
-
theme
|
89
|
-
})};
|
90
|
-
|
91
|
-
&:hover {
|
92
|
-
color: ${get('colors.btn.primary.hoverText')({
|
93
|
-
theme
|
94
|
-
})};
|
95
|
-
background-color: ${get('colors.btn.primary.hoverBg')({
|
96
|
-
theme
|
97
|
-
})};
|
98
|
-
}
|
99
|
-
// focus must come before :active so that the active box shadow overrides
|
100
|
-
&:focus {
|
101
|
-
box-shadow: ${get('shadows.btn.primary.focusShadow')({
|
102
|
-
theme
|
103
|
-
})};
|
104
|
-
}
|
105
|
-
|
106
|
-
&:active {
|
107
|
-
background-color: ${get('colors.btn.primary.selectedBg')({
|
108
|
-
theme
|
109
|
-
})};
|
110
|
-
box-shadow: ${get('shadows.btn.primary.selectedShadow')({
|
111
|
-
theme
|
112
|
-
})};
|
113
|
-
}
|
114
|
-
|
115
|
-
&:disabled {
|
116
|
-
color: ${get('colors.btn.primary.disabledText')({
|
117
|
-
theme
|
118
|
-
})};
|
119
|
-
background-color: ${get('colors.btn.primary.disabledBg')({
|
120
|
-
theme
|
121
|
-
})};
|
122
|
-
}`,
|
123
|
-
danger: `
|
124
|
-
padding: 5px 16px;
|
125
|
-
color: ${get('colors.btn.danger.text')({
|
126
|
-
theme
|
127
|
-
})};
|
128
|
-
border: 1px solid ${get('colors.btn.border')({
|
129
|
-
theme
|
130
|
-
})};
|
131
|
-
background-color: ${get('colors.btn.bg')({
|
132
|
-
theme
|
133
|
-
})};
|
134
|
-
box-shadow: ${get('shadows.btn.shadow')({
|
135
|
-
theme
|
136
|
-
})};
|
137
|
-
|
138
|
-
&:hover {
|
139
|
-
color: ${get('colors.btn.danger.hoverText')({
|
140
|
-
theme
|
141
|
-
})};
|
142
|
-
background-color: ${get('colors.btn.danger.hoverBg')({
|
143
|
-
theme
|
144
|
-
})};
|
145
|
-
border-color: ${get('colors.btn.danger.hoverBorder')({
|
146
|
-
theme
|
147
|
-
})};
|
148
|
-
box-shadow: ${get('shadows.btn.danger.hoverShadow')({
|
149
|
-
theme
|
150
|
-
})};
|
151
|
-
}
|
152
|
-
// focus must come before :active so that the active box shadow overrides
|
153
|
-
&:focus {
|
154
|
-
border-color: ${get('colors.btn.danger.focusBorder')({
|
155
|
-
theme
|
156
|
-
})};
|
157
|
-
box-shadow: ${get('shadows.btn.danger.focusShadow')({
|
158
|
-
theme
|
159
|
-
})};
|
160
|
-
}
|
161
|
-
|
162
|
-
&:active {
|
163
|
-
color: ${get('colors.btn.danger.selectedText')({
|
164
|
-
theme
|
165
|
-
})};
|
166
|
-
background-color: ${get('colors.btn.danger.selectedBg')({
|
167
|
-
theme
|
168
|
-
})};
|
169
|
-
box-shadow: ${get('shadows.btn.danger.selectedShadow')({
|
170
|
-
theme
|
171
|
-
})};
|
172
|
-
border-color: ${get('colors.btn.danger.selectedBorder')({
|
173
|
-
theme
|
174
|
-
})};
|
175
|
-
}
|
176
|
-
|
177
|
-
&:disabled {
|
178
|
-
color: ${get('colors.btn.danger.disabledText')({
|
179
|
-
theme
|
180
|
-
})};
|
181
|
-
background-color: ${get('colors.btn.danger.disabledBg')({
|
182
|
-
theme
|
183
|
-
})};
|
184
|
-
border-color: ${get('colors.btn.danger.disabledBorder')({
|
185
|
-
theme
|
186
|
-
})};
|
187
|
-
}
|
188
|
-
`,
|
189
|
-
invisible: `
|
190
|
-
padding: 6px 16px;
|
191
|
-
color: ${get('colors.accent.fg')({
|
192
|
-
theme
|
193
|
-
})};
|
194
|
-
background-color: transparent;
|
195
|
-
border: 0;
|
196
|
-
border-radius: ${get('radii.2')({
|
197
|
-
theme
|
198
|
-
})};
|
199
|
-
box-shadow: none;
|
200
|
-
|
201
|
-
&:disabled {
|
202
|
-
color: ${get('colors.primer.fg.disabled')({
|
203
|
-
theme
|
204
|
-
})};
|
205
|
-
}
|
206
|
-
&:focus {
|
207
|
-
box-shadow: ${get('shadows.btn.focusShadow')({
|
208
|
-
theme
|
209
|
-
})};
|
210
|
-
}
|
211
|
-
&:hover {
|
212
|
-
background-color: ${get('colors.btn.hoverBg')({
|
213
|
-
theme
|
214
|
-
})};
|
215
|
-
}
|
216
|
-
&:active {
|
217
|
-
background-color: ${get('colors.btn.selectedBg')({
|
218
|
-
theme
|
219
|
-
})};
|
220
|
-
}
|
221
|
-
`
|
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
|
-
caret,
|
233
|
-
children,
|
234
|
-
...props
|
235
|
-
}) => {
|
236
|
-
let iconOnly = false;
|
237
|
-
|
238
|
-
if (!children) {
|
239
|
-
iconOnly = true;
|
240
|
-
}
|
241
|
-
|
242
|
-
let iconWrapStyles = {
|
243
|
-
display: 'inline-block',
|
244
|
-
...(!iconOnly ? {
|
245
|
-
pr: 3
|
246
|
-
} : {})
|
247
|
-
};
|
248
|
-
return /*#__PURE__*/React.createElement(ButtonBase, _extends({}, props, {
|
249
|
-
iconOnly: iconOnly
|
250
|
-
}), Icon && /*#__PURE__*/React.createElement(Box, {
|
251
|
-
sx: iconWrapStyles,
|
252
|
-
"aria-hidden": !iconOnly
|
253
|
-
}, /*#__PURE__*/React.createElement(Icon, null)), children, caret && /*#__PURE__*/React.createElement(Box, {
|
254
|
-
sx: {
|
255
|
-
display: 'inline-block',
|
256
|
-
pl: 3
|
257
|
-
},
|
258
|
-
"aria-hidden": true
|
259
|
-
}, /*#__PURE__*/React.createElement(TriangleDownIcon, null)));
|
260
|
-
});
|
261
|
-
Button.displayName = 'Button';
|
262
|
-
Button.defaultProps = {
|
263
|
-
size: 'medium'
|
264
|
-
};
|
265
|
-
const NewButton = Object.assign(Button, {
|
266
|
-
Counter
|
267
|
-
});
|
268
|
-
export default NewButton;
|
@@ -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;
|