@primer/components 0.0.0-202111231117 → 0.0.0-202111245715
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 +9 -3
- package/dist/browser.esm.js +586 -604
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +204 -222
- package/dist/browser.umd.js.map +1 -1
- package/lib/Autocomplete/AutocompleteMenu.js +13 -6
- package/lib/Avatar.d.ts +1 -2
- package/lib/Avatar.js +1 -1
- package/lib/BranchName.d.ts +1 -2
- package/lib/BranchName.js +1 -1
- package/lib/Checkbox.d.ts +1 -1
- package/lib/Details.d.ts +1 -2
- package/lib/Details.js +1 -3
- package/lib/Dropdown.d.ts +2 -66
- package/lib/Heading.d.ts +1 -2
- package/lib/Heading.js +1 -6
- package/lib/NewButton/button-base.d.ts +6 -0
- package/lib/NewButton/button-base.js +69 -0
- package/lib/NewButton/button-link.d.ts +26 -0
- package/lib/{ChoiceFieldset/ChoiceFieldLabel.js → NewButton/button-link.js} +14 -18
- package/lib/NewButton/button.d.ts +2 -11
- package/lib/NewButton/button.js +6 -283
- package/lib/NewButton/icon-button.d.ts +4 -0
- package/lib/NewButton/icon-button.js +57 -0
- package/lib/NewButton/index.d.ts +6 -11
- package/lib/NewButton/index.js +18 -0
- package/lib/NewButton/styles.d.ts +202 -0
- package/lib/NewButton/styles.js +248 -0
- package/lib/NewButton/types.d.ts +28 -8
- package/lib/NewButton/types.js +19 -1
- package/lib/ProgressBar.d.ts +16 -11
- package/lib/ProgressBar.js +6 -10
- package/lib/Spinner.d.ts +1 -2
- package/lib/Spinner.js +1 -3
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -38
- package/lib-esm/Autocomplete/AutocompleteMenu.js +13 -3
- package/lib-esm/Avatar.d.ts +1 -2
- package/lib-esm/Avatar.js +2 -2
- package/lib-esm/BranchName.d.ts +1 -2
- package/lib-esm/BranchName.js +2 -2
- package/lib-esm/Checkbox.d.ts +1 -1
- package/lib-esm/Details.d.ts +1 -2
- package/lib-esm/Details.js +1 -2
- package/lib-esm/Dropdown.d.ts +2 -66
- package/lib-esm/Heading.d.ts +1 -2
- package/lib-esm/Heading.js +2 -6
- package/lib-esm/NewButton/button-base.d.ts +6 -0
- package/lib-esm/NewButton/button-base.js +47 -0
- package/lib-esm/NewButton/button-link.d.ts +26 -0
- package/lib-esm/NewButton/button-link.js +15 -0
- package/lib-esm/NewButton/button.d.ts +2 -11
- package/lib-esm/NewButton/button.js +4 -275
- package/lib-esm/NewButton/icon-button.d.ts +4 -0
- package/lib-esm/NewButton/icon-button.js +35 -0
- package/lib-esm/NewButton/index.d.ts +6 -11
- package/lib-esm/NewButton/index.js +4 -1
- package/lib-esm/NewButton/styles.d.ts +202 -0
- package/lib-esm/NewButton/styles.js +229 -0
- package/lib-esm/NewButton/types.d.ts +28 -8
- package/lib-esm/NewButton/types.js +6 -1
- package/lib-esm/ProgressBar.d.ts +16 -11
- package/lib-esm/ProgressBar.js +7 -11
- package/lib-esm/Spinner.d.ts +1 -2
- package/lib-esm/Spinner.js +1 -2
- package/lib-esm/index.d.ts +0 -4
- package/lib-esm/index.js +0 -4
- package/package.json +2 -2
- package/lib/CheckboxInputField.d.ts +0 -11
- package/lib/CheckboxInputField.js +0 -73
- package/lib/ChoiceFieldset/ChoiceFieldCaption.d.ts +0 -3
- package/lib/ChoiceFieldset/ChoiceFieldCaption.js +0 -35
- package/lib/ChoiceFieldset/ChoiceFieldLabel.d.ts +0 -3
- package/lib/ChoiceFieldset/ChoiceFieldset.d.ts +0 -65
- package/lib/ChoiceFieldset/ChoiceFieldset.js +0 -95
- package/lib/ChoiceFieldset/ChoiceFieldsetDescription.d.ts +0 -3
- package/lib/ChoiceFieldset/ChoiceFieldsetDescription.js +0 -29
- package/lib/ChoiceFieldset/ChoiceFieldsetLegend.d.ts +0 -9
- package/lib/ChoiceFieldset/ChoiceFieldsetLegend.js +0 -44
- package/lib/ChoiceFieldset/ChoiceFieldsetList.d.ts +0 -9
- package/lib/ChoiceFieldset/ChoiceFieldsetList.js +0 -80
- package/lib/ChoiceFieldset/ChoiceFieldsetListContext.d.ts +0 -19
- package/lib/ChoiceFieldset/ChoiceFieldsetListContext.js +0 -15
- package/lib/ChoiceFieldset/ChoiceFieldsetListItem.d.ts +0 -25
- package/lib/ChoiceFieldset/ChoiceFieldsetListItem.js +0 -75
- package/lib/ChoiceFieldset/ChoiceFieldsetValidation.d.ts +0 -6
- package/lib/ChoiceFieldset/ChoiceFieldsetValidation.js +0 -17
- package/lib/ChoiceFieldset/index.d.ts +0 -3
- package/lib/ChoiceFieldset/index.js +0 -23
- package/lib/RadioInputField.d.ts +0 -9
- package/lib/RadioInputField.js +0 -82
- package/lib/TextInputField.d.ts +0 -581
- package/lib/TextInputField.js +0 -66
- package/lib/_InputCaption.d.ts +0 -13
- package/lib/_InputCaption.js +0 -27
- package/lib/_InputField/InputField.d.ts +0 -39
- package/lib/_InputField/InputField.js +0 -90
- package/lib/_InputField/InputFieldCaption.d.ts +0 -3
- package/lib/_InputField/InputFieldCaption.js +0 -30
- package/lib/_InputField/InputFieldLabel.d.ts +0 -9
- package/lib/_InputField/InputFieldLabel.js +0 -34
- package/lib/_InputField/InputFieldValidation.d.ts +0 -6
- package/lib/_InputField/InputFieldValidation.js +0 -17
- package/lib/_InputField/ToggleInputField.d.ts +0 -13
- package/lib/_InputField/ToggleInputField.js +0 -71
- package/lib/_InputField/ToggleInputLeadingVisual.d.ts +0 -3
- package/lib/_InputField/ToggleInputLeadingVisual.js +0 -22
- package/lib/_InputField/ValidationAnimationContainer.d.ts +0 -6
- package/lib/_InputField/ValidationAnimationContainer.js +0 -48
- package/lib/_InputField/index.d.ts +0 -1
- package/lib/_InputField/index.js +0 -15
- package/lib/_InputField/slots.d.ts +0 -13
- package/lib/_InputField/slots.js +0 -17
- package/lib/_InputLabel.d.ts +0 -8
- package/lib/_InputLabel.js +0 -44
- package/lib/_InputValidation.d.ts +0 -8
- package/lib/_InputValidation.js +0 -56
- package/lib/_VisuallyHidden.d.ts +0 -6
- package/lib/_VisuallyHidden.js +0 -39
- package/lib/utils/types/FormValidationStatus.d.ts +0 -1
- package/lib/utils/types/FormValidationStatus.js +0 -1
- package/lib-esm/CheckboxInputField.d.ts +0 -11
- package/lib-esm/CheckboxInputField.js +0 -56
- package/lib-esm/ChoiceFieldset/ChoiceFieldCaption.d.ts +0 -3
- package/lib-esm/ChoiceFieldset/ChoiceFieldCaption.js +0 -20
- package/lib-esm/ChoiceFieldset/ChoiceFieldLabel.d.ts +0 -3
- package/lib-esm/ChoiceFieldset/ChoiceFieldLabel.js +0 -20
- package/lib-esm/ChoiceFieldset/ChoiceFieldset.d.ts +0 -65
- package/lib-esm/ChoiceFieldset/ChoiceFieldset.js +0 -72
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetDescription.d.ts +0 -3
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetDescription.js +0 -17
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetLegend.d.ts +0 -9
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetLegend.js +0 -31
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetList.d.ts +0 -9
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetList.js +0 -63
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetListContext.d.ts +0 -19
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetListContext.js +0 -5
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetListItem.d.ts +0 -25
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetListItem.js +0 -51
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetValidation.d.ts +0 -6
- package/lib-esm/ChoiceFieldset/ChoiceFieldsetValidation.js +0 -7
- package/lib-esm/ChoiceFieldset/index.d.ts +0 -3
- package/lib-esm/ChoiceFieldset/index.js +0 -2
- package/lib-esm/RadioInputField.d.ts +0 -9
- package/lib-esm/RadioInputField.js +0 -65
- package/lib-esm/TextInputField.d.ts +0 -581
- package/lib-esm/TextInputField.js +0 -50
- package/lib-esm/_InputCaption.d.ts +0 -13
- package/lib-esm/_InputCaption.js +0 -16
- package/lib-esm/_InputField/InputField.d.ts +0 -39
- package/lib-esm/_InputField/InputField.js +0 -70
- package/lib-esm/_InputField/InputFieldCaption.d.ts +0 -3
- package/lib-esm/_InputField/InputFieldCaption.js +0 -18
- package/lib-esm/_InputField/InputFieldLabel.d.ts +0 -9
- package/lib-esm/_InputField/InputFieldLabel.js +0 -22
- package/lib-esm/_InputField/InputFieldValidation.d.ts +0 -6
- package/lib-esm/_InputField/InputFieldValidation.js +0 -7
- package/lib-esm/_InputField/ToggleInputField.d.ts +0 -13
- package/lib-esm/_InputField/ToggleInputField.js +0 -54
- package/lib-esm/_InputField/ToggleInputLeadingVisual.d.ts +0 -3
- package/lib-esm/_InputField/ToggleInputLeadingVisual.js +0 -11
- package/lib-esm/_InputField/ValidationAnimationContainer.d.ts +0 -6
- package/lib-esm/_InputField/ValidationAnimationContainer.js +0 -33
- package/lib-esm/_InputField/index.d.ts +0 -1
- package/lib-esm/_InputField/index.js +0 -1
- package/lib-esm/_InputField/slots.d.ts +0 -13
- package/lib-esm/_InputField/slots.js +0 -5
- package/lib-esm/_InputLabel.d.ts +0 -8
- package/lib-esm/_InputLabel.js +0 -32
- package/lib-esm/_InputValidation.d.ts +0 -8
- package/lib-esm/_InputValidation.js +0 -43
- package/lib-esm/_VisuallyHidden.d.ts +0 -6
- package/lib-esm/_VisuallyHidden.js +0 -26
- package/lib-esm/utils/types/FormValidationStatus.d.ts +0 -1
- package/lib-esm/utils/types/FormValidationStatus.js +0 -1
@@ -0,0 +1,248 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getButtonStyles = exports.getBaseStyles = exports.getSizeStyles = exports.getVariantStyles = exports.TEXT_ROW_HEIGHT = void 0;
|
7
|
+
const TEXT_ROW_HEIGHT = '20px'; // custom value off the scale
|
8
|
+
|
9
|
+
exports.TEXT_ROW_HEIGHT = TEXT_ROW_HEIGHT;
|
10
|
+
|
11
|
+
const getVariantStyles = (variant = 'default', theme) => {
|
12
|
+
const style = {
|
13
|
+
default: {
|
14
|
+
color: 'btn.text',
|
15
|
+
backgroundColor: 'btn.bg',
|
16
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}, ${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.insetShadow}`,
|
17
|
+
'&:hover:not([disabled])': {
|
18
|
+
backgroundColor: 'btn.hoverBg'
|
19
|
+
},
|
20
|
+
// focus must come before :active so that the active box shadow overrides
|
21
|
+
'&:focus:not([disabled])': {
|
22
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.focusShadow}`
|
23
|
+
},
|
24
|
+
'&:active:not([disabled])': {
|
25
|
+
backgroundColor: 'btn.selectedBg',
|
26
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadowActive}`
|
27
|
+
},
|
28
|
+
'&:disabled': {
|
29
|
+
color: 'primer.fg.disabled',
|
30
|
+
backgroundColor: 'btn.disabledBg'
|
31
|
+
}
|
32
|
+
},
|
33
|
+
primary: {
|
34
|
+
color: 'btn.primary.text',
|
35
|
+
backgroundColor: 'btn.primary.bg',
|
36
|
+
borderColor: 'border.subtle',
|
37
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.shadow}`,
|
38
|
+
'&:hover:not([disabled])': {
|
39
|
+
color: 'btn.primary.hoverText',
|
40
|
+
backgroundColor: 'btn.primary.hoverBg'
|
41
|
+
},
|
42
|
+
// focus must come before :active so that the active box shadow overrides
|
43
|
+
'&:focus:not([disabled])': {
|
44
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.focusShadow}`
|
45
|
+
},
|
46
|
+
'&:active:not([disabled])': {
|
47
|
+
backgroundColor: 'btn.primary.selectedBg',
|
48
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.primary.selectedShadow}`
|
49
|
+
},
|
50
|
+
'&:disabled': {
|
51
|
+
color: 'btn.primary.disabledText',
|
52
|
+
backgroundColor: 'btn.primary.disabledBg'
|
53
|
+
},
|
54
|
+
'[data-component="ButtonCounter"]': {
|
55
|
+
backgroundColor: 'btn.primary.counterBg',
|
56
|
+
color: 'btn.primary.text'
|
57
|
+
}
|
58
|
+
},
|
59
|
+
danger: {
|
60
|
+
color: 'btn.danger.text',
|
61
|
+
backgroundColor: 'btn.bg',
|
62
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}`,
|
63
|
+
'&:hover:not([disabled])': {
|
64
|
+
color: 'btn.danger.hoverText',
|
65
|
+
backgroundColor: 'btn.danger.hoverBg',
|
66
|
+
borderColor: 'btn.danger.hoverBorder',
|
67
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.hoverShadow}`,
|
68
|
+
'[data-component="ButtonCounter"]': {
|
69
|
+
backgroundColor: 'btn.danger.hoverCounterBg',
|
70
|
+
color: 'btn.danger.hoverText'
|
71
|
+
}
|
72
|
+
},
|
73
|
+
// focus must come before :active so that the active box shadow overrides
|
74
|
+
'&:focus:not([disabled])': {
|
75
|
+
borderColor: 'btn.danger.focusBorder',
|
76
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.focusShadow}`
|
77
|
+
},
|
78
|
+
'&:active:not([disabled])': {
|
79
|
+
color: 'btn.danger.selectedText',
|
80
|
+
backgroundColor: 'btn.danger.selectedBg',
|
81
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.danger.selectedShadow}`,
|
82
|
+
borderColor: 'btn.danger.selectedBorder'
|
83
|
+
},
|
84
|
+
'&:disabled': {
|
85
|
+
color: 'btn.danger.disabledText',
|
86
|
+
backgroundColor: 'btn.danger.disabledBg',
|
87
|
+
borderColor: 'btn.danger.disabledBorder',
|
88
|
+
'[data-component="ButtonCounter"]': {
|
89
|
+
backgroundColor: 'btn.danger.disabledCounterBg'
|
90
|
+
}
|
91
|
+
},
|
92
|
+
'[data-component="ButtonCounter"]': {
|
93
|
+
color: 'btn.danger.text',
|
94
|
+
backgroundColor: 'btn.danger.counterBg'
|
95
|
+
}
|
96
|
+
},
|
97
|
+
invisible: {
|
98
|
+
color: 'accent.fg',
|
99
|
+
backgroundColor: 'transparent',
|
100
|
+
border: '0',
|
101
|
+
boxShadow: 'none',
|
102
|
+
'&:hover:not([disabled])': {
|
103
|
+
backgroundColor: 'btn.hoverBg'
|
104
|
+
},
|
105
|
+
// focus must come before :active so that the active box shadow overrides
|
106
|
+
'&:focus:not([disabled])': {
|
107
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.focusShadow}`
|
108
|
+
},
|
109
|
+
'&:active:not([disabled])': {
|
110
|
+
backgroundColor: 'btn.selectedBg'
|
111
|
+
},
|
112
|
+
'&:disabled': {
|
113
|
+
color: 'primer.fg.disabled'
|
114
|
+
}
|
115
|
+
},
|
116
|
+
outline: {
|
117
|
+
color: 'btn.outline.text',
|
118
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.shadow}`,
|
119
|
+
'&:hover': {
|
120
|
+
color: 'btn.outline.hoverText',
|
121
|
+
backgroundColor: 'btn.outline.hoverBg',
|
122
|
+
borderColor: 'outline.hoverBorder',
|
123
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.hoverShadow}`,
|
124
|
+
'[data-component="ButtonCounter"]': {
|
125
|
+
backgroundColor: 'btn.outline.hoverCounterBg',
|
126
|
+
color: 'btn.outline.hoverText'
|
127
|
+
}
|
128
|
+
},
|
129
|
+
// focus must come before :active so that the active box shadow overrides
|
130
|
+
'&:focus': {
|
131
|
+
borderColor: 'btn.outline.focusBorder',
|
132
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.focusShadow}`
|
133
|
+
},
|
134
|
+
'&:active:not([disabled])': {
|
135
|
+
color: 'btn.outline.selectedText',
|
136
|
+
backgroundColor: 'btn.outline.selectedBg',
|
137
|
+
boxShadow: `${theme === null || theme === void 0 ? void 0 : theme.shadows.btn.outline.selectedShadow}`,
|
138
|
+
borderColor: 'btn.outline.selectedBorder'
|
139
|
+
},
|
140
|
+
'&:disabled': {
|
141
|
+
color: 'btn.outline.disabledText',
|
142
|
+
backgroundColor: 'btn.outline.disabledBg',
|
143
|
+
borderColor: 'btn.border',
|
144
|
+
'[data-component="ButtonCounter"]': {
|
145
|
+
backgroundColor: 'btn.outline.disabledCounterBg'
|
146
|
+
}
|
147
|
+
},
|
148
|
+
'[data-component="ButtonCounter"]': {
|
149
|
+
backgroundColor: 'btn.outline.counterBg',
|
150
|
+
color: 'btn.outline.text'
|
151
|
+
}
|
152
|
+
}
|
153
|
+
};
|
154
|
+
return style[variant];
|
155
|
+
};
|
156
|
+
|
157
|
+
exports.getVariantStyles = getVariantStyles;
|
158
|
+
|
159
|
+
const getSizeStyles = (size = 'medium', variant = 'default', iconOnly) => {
|
160
|
+
let paddingY, paddingX, fontSize;
|
161
|
+
|
162
|
+
switch (size) {
|
163
|
+
case 'small':
|
164
|
+
paddingY = 3;
|
165
|
+
paddingX = 12;
|
166
|
+
fontSize = 0;
|
167
|
+
break;
|
168
|
+
|
169
|
+
case 'large':
|
170
|
+
paddingY = 9;
|
171
|
+
paddingX = 20;
|
172
|
+
fontSize = 2;
|
173
|
+
break;
|
174
|
+
|
175
|
+
case 'medium':
|
176
|
+
default:
|
177
|
+
paddingY = 5;
|
178
|
+
paddingX = 16;
|
179
|
+
fontSize = 1;
|
180
|
+
}
|
181
|
+
|
182
|
+
if (iconOnly) {
|
183
|
+
paddingX = paddingY + 2;
|
184
|
+
}
|
185
|
+
|
186
|
+
if (variant === 'invisible') {
|
187
|
+
paddingY = paddingY + 1;
|
188
|
+
}
|
189
|
+
|
190
|
+
return {
|
191
|
+
paddingY: `${paddingY}px`,
|
192
|
+
paddingX: `${paddingX}px`,
|
193
|
+
fontSize,
|
194
|
+
'[data-component="ButtonCounter"]': {
|
195
|
+
fontSize
|
196
|
+
}
|
197
|
+
};
|
198
|
+
};
|
199
|
+
|
200
|
+
exports.getSizeStyles = getSizeStyles;
|
201
|
+
|
202
|
+
const getBaseStyles = theme => ({
|
203
|
+
borderRadius: '2',
|
204
|
+
border: '1px solid',
|
205
|
+
borderColor: theme === null || theme === void 0 ? void 0 : theme.colors.btn.border,
|
206
|
+
fontWeight: 'bold',
|
207
|
+
lineHeight: TEXT_ROW_HEIGHT,
|
208
|
+
whiteSpace: 'nowrap',
|
209
|
+
verticalAlign: 'middle',
|
210
|
+
cursor: 'pointer',
|
211
|
+
appearance: 'none',
|
212
|
+
userSelect: 'none',
|
213
|
+
textDecoration: 'none',
|
214
|
+
textAlign: 'center',
|
215
|
+
'&:focus': {
|
216
|
+
outline: 'none'
|
217
|
+
},
|
218
|
+
'&:disabled': {
|
219
|
+
cursor: 'default'
|
220
|
+
},
|
221
|
+
'&:disabled svg': {
|
222
|
+
opacity: '0.6'
|
223
|
+
}
|
224
|
+
});
|
225
|
+
|
226
|
+
exports.getBaseStyles = getBaseStyles;
|
227
|
+
|
228
|
+
const getButtonStyles = theme => {
|
229
|
+
const styles = { ...getBaseStyles(theme),
|
230
|
+
display: 'grid',
|
231
|
+
gridTemplateAreas: '"leadingIcon text trailingIcon"',
|
232
|
+
'& > :not(:last-child)': {
|
233
|
+
mr: '2'
|
234
|
+
},
|
235
|
+
'[data-component="leadingIcon"]': {
|
236
|
+
gridArea: 'leadingIcon'
|
237
|
+
},
|
238
|
+
'[data-component="text"]': {
|
239
|
+
gridArea: 'text'
|
240
|
+
},
|
241
|
+
'[data-component="trailingIcon"]': {
|
242
|
+
gridArea: 'trailingIcon'
|
243
|
+
}
|
244
|
+
};
|
245
|
+
return styles;
|
246
|
+
};
|
247
|
+
|
248
|
+
exports.getButtonStyles = getButtonStyles;
|
package/lib/NewButton/types.d.ts
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
import React, { HTMLAttributes } from 'react';
|
1
|
+
import React, { HTMLAttributes, ComponentPropsWithRef } from 'react';
|
2
2
|
import { IconProps } from '@primer/octicons-react';
|
3
3
|
import { SxProp } from '../sx';
|
4
|
+
export declare const StyledButton: import("styled-components").StyledComponent<"button", any, SxProp, never>;
|
4
5
|
export declare type VariantType = 'default' | 'primary' | 'invisible' | 'danger' | 'outline';
|
5
6
|
export declare type Size = 'small' | 'medium' | 'large';
|
6
|
-
|
7
|
+
declare type StyledButtonProps = ComponentPropsWithRef<typeof StyledButton>;
|
8
|
+
export declare type ButtonBaseProps = {
|
7
9
|
/**
|
8
10
|
* Determine's the styles on a button one of 'default' | 'primary' | 'invisible' | 'danger'
|
9
11
|
*/
|
@@ -13,9 +15,11 @@ export declare type ButtonProps = {
|
|
13
15
|
*/
|
14
16
|
size?: Size;
|
15
17
|
/**
|
16
|
-
*
|
18
|
+
* Items that are disabled can not be clicked, selected, or navigated through.
|
17
19
|
*/
|
18
|
-
|
20
|
+
disabled?: boolean;
|
21
|
+
} & SxProp & HTMLAttributes<HTMLButtonElement> & StyledButtonProps;
|
22
|
+
export declare type ButtonProps = {
|
19
23
|
/**
|
20
24
|
* The leading icon comes before button content
|
21
25
|
*/
|
@@ -24,9 +28,25 @@ export declare type ButtonProps = {
|
|
24
28
|
* The trailing icon comes after button content
|
25
29
|
*/
|
26
30
|
trailingIcon?: React.FunctionComponent<IconProps>;
|
31
|
+
children: React.ReactNode;
|
32
|
+
} & ButtonBaseProps;
|
33
|
+
export declare type IconButtonProps = {
|
27
34
|
/**
|
28
|
-
*
|
35
|
+
* This is to be used if it is an icon-only button. Will make text visually hidden
|
29
36
|
*/
|
30
|
-
|
31
|
-
|
32
|
-
} &
|
37
|
+
icon: React.FunctionComponent<IconProps>;
|
38
|
+
iconLabel: string;
|
39
|
+
} & ButtonBaseProps;
|
40
|
+
export declare type LinkButtonProps = {
|
41
|
+
underline?: boolean;
|
42
|
+
download?: string;
|
43
|
+
href?: string;
|
44
|
+
hrefLang?: string;
|
45
|
+
media?: string;
|
46
|
+
ping?: string;
|
47
|
+
rel?: string;
|
48
|
+
target?: string;
|
49
|
+
type?: string;
|
50
|
+
referrerPolicy?: React.AnchorHTMLAttributes<HTMLAnchorElement>['referrerPolicy'];
|
51
|
+
};
|
52
|
+
export {};
|
package/lib/NewButton/types.js
CHANGED
@@ -1 +1,19 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.StyledButton = void 0;
|
7
|
+
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
9
|
+
|
10
|
+
var _sx = _interopRequireDefault(require("../sx"));
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
const StyledButton = _styledComponents.default.button.withConfig({
|
15
|
+
displayName: "types__StyledButton",
|
16
|
+
componentId: "sc-1sm8kx1-0"
|
17
|
+
})(_sx.default);
|
18
|
+
|
19
|
+
exports.StyledButton = StyledButton;
|
package/lib/ProgressBar.d.ts
CHANGED
@@ -1,17 +1,22 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { WidthProps } from 'styled-system';
|
3
|
-
import { SystemCommonProps } from './constants';
|
4
3
|
import { SxProp } from './sx';
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}
|
13
|
-
|
14
|
-
|
4
|
+
declare type ProgressProp = {
|
5
|
+
progress?: string | number;
|
6
|
+
};
|
7
|
+
declare const sizeMap: {
|
8
|
+
small: string;
|
9
|
+
large: string;
|
10
|
+
default: string;
|
11
|
+
};
|
12
|
+
declare type StyledProgressContainerProps = {
|
13
|
+
inline?: boolean;
|
14
|
+
barSize?: keyof typeof sizeMap;
|
15
|
+
} & WidthProps & SxProp;
|
16
|
+
export declare type ProgressBarProps = {
|
17
|
+
bg: string;
|
18
|
+
} & StyledProgressContainerProps & ProgressProp;
|
19
|
+
declare function ProgressBar({ progress, bg, ...rest }: ProgressBarProps): JSX.Element;
|
15
20
|
declare namespace ProgressBar {
|
16
21
|
var defaultProps: {
|
17
22
|
bg: string;
|
package/lib/ProgressBar.js
CHANGED
@@ -17,12 +17,10 @@ var _sx = _interopRequireDefault(require("./sx"));
|
|
17
17
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
19
|
|
20
|
-
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); }
|
21
|
-
|
22
20
|
const Bar = _styledComponents.default.span.withConfig({
|
23
21
|
displayName: "ProgressBar__Bar",
|
24
22
|
componentId: "sc-1tiva13-0"
|
25
|
-
})(["width:", ";", ""], props => props.progress ? `${props.progress}%` : 0,
|
23
|
+
})(["width:", ";", ";"], props => props.progress ? `${props.progress}%` : 0, _sx.default);
|
26
24
|
|
27
25
|
const sizeMap = {
|
28
26
|
small: '5px',
|
@@ -33,20 +31,18 @@ const sizeMap = {
|
|
33
31
|
const ProgressContainer = _styledComponents.default.span.withConfig({
|
34
32
|
displayName: "ProgressBar__ProgressContainer",
|
35
33
|
componentId: "sc-1tiva13-1"
|
36
|
-
})(["display:", ";overflow:hidden;background-color:", ";border-radius:", ";height:", ";", " ", "
|
34
|
+
})(["display:", ";overflow:hidden;background-color:", ";border-radius:", ";height:", ";", " ", ";"], props => props.inline ? 'inline-flex' : 'flex', (0, _constants.get)('colors.border.default'), (0, _constants.get)('radii.1'), props => sizeMap[props.barSize || 'default'], _styledSystem.width, _sx.default);
|
37
35
|
|
38
36
|
function ProgressBar({
|
39
37
|
progress,
|
40
38
|
bg,
|
41
|
-
theme,
|
42
39
|
...rest
|
43
40
|
}) {
|
44
|
-
return /*#__PURE__*/_react.default.createElement(ProgressContainer,
|
45
|
-
theme: theme
|
46
|
-
}, rest), /*#__PURE__*/_react.default.createElement(Bar, {
|
41
|
+
return /*#__PURE__*/_react.default.createElement(ProgressContainer, rest, /*#__PURE__*/_react.default.createElement(Bar, {
|
47
42
|
progress: progress,
|
48
|
-
|
49
|
-
|
43
|
+
sx: {
|
44
|
+
bg
|
45
|
+
}
|
50
46
|
}));
|
51
47
|
}
|
52
48
|
|
package/lib/Spinner.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import { SystemCommonProps } from './constants';
|
3
2
|
import { SxProp } from './sx';
|
4
3
|
import { ComponentProps } from './utils/types';
|
5
4
|
declare const sizeMap: {
|
@@ -12,6 +11,6 @@ export interface SpinnerInternalProps {
|
|
12
11
|
size?: keyof typeof sizeMap;
|
13
12
|
}
|
14
13
|
declare function Spinner({ size: sizeKey, ...props }: SpinnerInternalProps): JSX.Element;
|
15
|
-
declare const StyledSpinner: import("styled-components").StyledComponent<typeof Spinner, any,
|
14
|
+
declare const StyledSpinner: import("styled-components").StyledComponent<typeof Spinner, any, SxProp, never>;
|
16
15
|
export declare type SpinnerProps = ComponentProps<typeof StyledSpinner>;
|
17
16
|
export default StyledSpinner;
|
package/lib/Spinner.js
CHANGED
@@ -9,8 +9,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
10
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
11
11
|
|
12
|
-
var _constants = require("./constants");
|
13
|
-
|
14
12
|
var _sx = _interopRequireDefault(require("./sx"));
|
15
13
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -54,7 +52,7 @@ Spinner.displayName = "Spinner";
|
|
54
52
|
const StyledSpinner = (0, _styledComponents.default)(Spinner).withConfig({
|
55
53
|
displayName: "Spinner__StyledSpinner",
|
56
54
|
componentId: "sc-14tspit-0"
|
57
|
-
})(["@keyframes rotate-keyframes{100%{transform:rotate(360deg);}}animation:rotate-keyframes 1s linear infinite;", "
|
55
|
+
})(["@keyframes rotate-keyframes{100%{transform:rotate(360deg);}}animation:rotate-keyframes 1s linear infinite;", ""], _sx.default);
|
58
56
|
StyledSpinner.displayName = 'Spinner';
|
59
57
|
var _default = StyledSpinner;
|
60
58
|
exports.default = _default;
|
package/lib/index.d.ts
CHANGED
@@ -46,8 +46,6 @@ export { default as CircleBadge } from './CircleBadge';
|
|
46
46
|
export type { CircleBadgeProps, CircleBadgeIconProps } from './CircleBadge';
|
47
47
|
export { default as CircleOcticon } from './CircleOcticon';
|
48
48
|
export type { CircleOcticonProps } from './CircleOcticon';
|
49
|
-
export { default as CheckboxInputField } from './CheckboxInputField';
|
50
|
-
export { default as ChoiceFieldset, Item } from './ChoiceFieldset';
|
51
49
|
export { default as CounterLabel } from './CounterLabel';
|
52
50
|
export type { CounterLabelProps } from './CounterLabel';
|
53
51
|
export { default as Details } from './Details';
|
@@ -88,7 +86,6 @@ export { default as Popover } from './Popover';
|
|
88
86
|
export type { PopoverProps, PopoverContentProps } from './Popover';
|
89
87
|
export { default as ProgressBar } from './ProgressBar';
|
90
88
|
export type { ProgressBarProps } from './ProgressBar';
|
91
|
-
export { default as RadioInputField } from './RadioInputField';
|
92
89
|
export { default as SelectMenu } from './SelectMenu';
|
93
90
|
export type { SelectMenuProps, SelectMenuDividerProps, SelectMenuFilterProps, SelectMenuFooterProps, SelectMenuItemProps, SelectMenuListProps, SelectMenuModalProps, SelectMenuTabsProps, SelectMenuHeaderProps, SelectMenuTabProps, SelectMenuTabPanelProps, SelectMenuLoadingAnimationProps } from './SelectMenu';
|
94
91
|
export { default as SideNav } from './SideNav';
|
@@ -105,7 +102,6 @@ export { default as TabNav } from './TabNav';
|
|
105
102
|
export type { TabNavProps, TabNavLinkProps } from './TabNav';
|
106
103
|
export { default as TextInput } from './TextInput';
|
107
104
|
export type { TextInputProps } from './TextInput';
|
108
|
-
export { default as TextInputField } from './TextInputField';
|
109
105
|
export { default as TextInputWithTokens } from './TextInputWithTokens';
|
110
106
|
export type { TextInputWithTokensProps } from './TextInputWithTokens';
|
111
107
|
export { default as Text } from './Text';
|
package/lib/index.js
CHANGED
@@ -267,24 +267,6 @@ Object.defineProperty(exports, "CircleOcticon", {
|
|
267
267
|
return _CircleOcticon.default;
|
268
268
|
}
|
269
269
|
});
|
270
|
-
Object.defineProperty(exports, "CheckboxInputField", {
|
271
|
-
enumerable: true,
|
272
|
-
get: function () {
|
273
|
-
return _CheckboxInputField.default;
|
274
|
-
}
|
275
|
-
});
|
276
|
-
Object.defineProperty(exports, "ChoiceFieldset", {
|
277
|
-
enumerable: true,
|
278
|
-
get: function () {
|
279
|
-
return _ChoiceFieldset.default;
|
280
|
-
}
|
281
|
-
});
|
282
|
-
Object.defineProperty(exports, "Item", {
|
283
|
-
enumerable: true,
|
284
|
-
get: function () {
|
285
|
-
return _ChoiceFieldset.Item;
|
286
|
-
}
|
287
|
-
});
|
288
270
|
Object.defineProperty(exports, "CounterLabel", {
|
289
271
|
enumerable: true,
|
290
272
|
get: function () {
|
@@ -411,12 +393,6 @@ Object.defineProperty(exports, "ProgressBar", {
|
|
411
393
|
return _ProgressBar.default;
|
412
394
|
}
|
413
395
|
});
|
414
|
-
Object.defineProperty(exports, "RadioInputField", {
|
415
|
-
enumerable: true,
|
416
|
-
get: function () {
|
417
|
-
return _RadioInputField.default;
|
418
|
-
}
|
419
|
-
});
|
420
396
|
Object.defineProperty(exports, "SelectMenu", {
|
421
397
|
enumerable: true,
|
422
398
|
get: function () {
|
@@ -465,12 +441,6 @@ Object.defineProperty(exports, "TextInput", {
|
|
465
441
|
return _TextInput.default;
|
466
442
|
}
|
467
443
|
});
|
468
|
-
Object.defineProperty(exports, "TextInputField", {
|
469
|
-
enumerable: true,
|
470
|
-
get: function () {
|
471
|
-
return _TextInputField.default;
|
472
|
-
}
|
473
|
-
});
|
474
444
|
Object.defineProperty(exports, "TextInputWithTokens", {
|
475
445
|
enumerable: true,
|
476
446
|
get: function () {
|
@@ -602,10 +572,6 @@ var _CircleBadge = _interopRequireDefault(require("./CircleBadge"));
|
|
602
572
|
|
603
573
|
var _CircleOcticon = _interopRequireDefault(require("./CircleOcticon"));
|
604
574
|
|
605
|
-
var _CheckboxInputField = _interopRequireDefault(require("./CheckboxInputField"));
|
606
|
-
|
607
|
-
var _ChoiceFieldset = _interopRequireWildcard(require("./ChoiceFieldset"));
|
608
|
-
|
609
575
|
var _CounterLabel = _interopRequireDefault(require("./CounterLabel"));
|
610
576
|
|
611
577
|
var _Details = _interopRequireDefault(require("./Details"));
|
@@ -646,8 +612,6 @@ var _Popover = _interopRequireDefault(require("./Popover"));
|
|
646
612
|
|
647
613
|
var _ProgressBar = _interopRequireDefault(require("./ProgressBar"));
|
648
614
|
|
649
|
-
var _RadioInputField = _interopRequireDefault(require("./RadioInputField"));
|
650
|
-
|
651
615
|
var _SelectMenu = _interopRequireDefault(require("./SelectMenu"));
|
652
616
|
|
653
617
|
var _SideNav = _interopRequireDefault(require("./SideNav"));
|
@@ -664,8 +628,6 @@ var _TabNav = _interopRequireDefault(require("./TabNav"));
|
|
664
628
|
|
665
629
|
var _TextInput = _interopRequireDefault(require("./TextInput"));
|
666
630
|
|
667
|
-
var _TextInputField = _interopRequireDefault(require("./TextInputField"));
|
668
|
-
|
669
631
|
var _TextInputWithTokens = _interopRequireDefault(require("./TextInputWithTokens"));
|
670
632
|
|
671
633
|
var _Text = _interopRequireDefault(require("./Text"));
|
@@ -6,7 +6,6 @@ import { AutocompleteContext } from './AutocompleteContext';
|
|
6
6
|
import { PlusIcon } from '@primer/octicons-react';
|
7
7
|
import { uniqueId } from '../utils/uniqueId';
|
8
8
|
import { scrollIntoViewingArea } from '../behaviors/scrollIntoViewingArea';
|
9
|
-
import VisuallyHidden from '../_VisuallyHidden';
|
10
9
|
|
11
10
|
const getDefaultSortFn = isItemSelectedFn => (itemIdA, itemIdB) => isItemSelectedFn(itemIdA) === isItemSelectedFn(itemIdB) ? 0 : isItemSelectedFn(itemIdA) ? -1 : 1;
|
12
11
|
|
@@ -165,8 +164,19 @@ function AutocompleteMenu(props) {
|
|
165
164
|
setSelectedItemLength(selectedItemIds.length);
|
166
165
|
}
|
167
166
|
}, [selectedItemIds, setSelectedItemLength]);
|
168
|
-
return /*#__PURE__*/React.createElement(
|
169
|
-
|
167
|
+
return /*#__PURE__*/React.createElement(Box, {
|
168
|
+
sx: !showMenu ? {
|
169
|
+
// visually hides this label for sighted users
|
170
|
+
position: 'absolute',
|
171
|
+
width: '1px',
|
172
|
+
height: '1px',
|
173
|
+
padding: '0',
|
174
|
+
margin: '-1px',
|
175
|
+
overflow: 'hidden',
|
176
|
+
clip: 'rect(0, 0, 0, 0)',
|
177
|
+
whiteSpace: 'nowrap',
|
178
|
+
borderWidth: '0'
|
179
|
+
} : {}
|
170
180
|
}, loading ? /*#__PURE__*/React.createElement(Box, {
|
171
181
|
p: 3,
|
172
182
|
display: "flex",
|
package/lib-esm/Avatar.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import { SystemCommonProps } from './constants';
|
2
1
|
import { SxProp } from './sx';
|
3
2
|
import { ComponentProps } from './utils/types';
|
4
3
|
declare const Avatar: import("styled-components").StyledComponent<"img", any, {
|
@@ -10,6 +9,6 @@ declare const Avatar: import("styled-components").StyledComponent<"img", any, {
|
|
10
9
|
src: string;
|
11
10
|
/** Provide alt text when the Avatar is used without the user's name next to it. */
|
12
11
|
alt?: string | undefined;
|
13
|
-
} &
|
12
|
+
} & SxProp, never>;
|
14
13
|
export declare type AvatarProps = ComponentProps<typeof Avatar>;
|
15
14
|
export default Avatar;
|
package/lib-esm/Avatar.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import styled from 'styled-components';
|
2
|
-
import {
|
2
|
+
import { get } from './constants';
|
3
3
|
import sx from './sx';
|
4
4
|
|
5
5
|
function getBorderRadius({
|
@@ -19,7 +19,7 @@ const Avatar = styled.img.attrs(props => ({
|
|
19
19
|
})).withConfig({
|
20
20
|
displayName: "Avatar",
|
21
21
|
componentId: "sc-1waaaky-0"
|
22
|
-
})(["display:inline-block;overflow:hidden;line-height:", ";vertical-align:middle;border-radius:", ";", "
|
22
|
+
})(["display:inline-block;overflow:hidden;line-height:", ";vertical-align:middle;border-radius:", ";", ""], get('lineHeights.condensedUltra'), props => getBorderRadius(props), sx);
|
23
23
|
Avatar.defaultProps = {
|
24
24
|
size: 20,
|
25
25
|
alt: '',
|
package/lib-esm/BranchName.d.ts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
import { SystemCommonProps } from './constants';
|
2
1
|
import { SxProp } from './sx';
|
3
2
|
import { ComponentProps } from './utils/types';
|
4
|
-
declare const BranchName: import("styled-components").StyledComponent<"a", any,
|
3
|
+
declare const BranchName: import("styled-components").StyledComponent<"a", any, SxProp, never>;
|
5
4
|
export declare type BranchNameProps = ComponentProps<typeof BranchName>;
|
6
5
|
export default BranchName;
|
package/lib-esm/BranchName.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import styled from 'styled-components';
|
2
|
-
import {
|
2
|
+
import { get } from './constants';
|
3
3
|
import sx from './sx';
|
4
4
|
const BranchName = styled.a.withConfig({
|
5
5
|
displayName: "BranchName",
|
6
6
|
componentId: "sc-167ouzm-0"
|
7
|
-
})(["display:inline-block;padding:2px 6px;font-size:", ";font-family:", ";color:", ";background-color:", ";border-radius:", ";", ";"
|
7
|
+
})(["display:inline-block;padding:2px 6px;font-size:", ";font-family:", ";color:", ";background-color:", ";border-radius:", ";", ";"], get('fontSizes.0'), get('fonts.mono'), get('colors.fg.muted'), get('colors.accent.subtle'), get('radii.2'), sx);
|
8
8
|
export default BranchName;
|
package/lib-esm/Checkbox.d.ts
CHANGED
@@ -25,5 +25,5 @@ export declare type CheckboxProps = {
|
|
25
25
|
/**
|
26
26
|
* An accessible, native checkbox component
|
27
27
|
*/
|
28
|
-
declare const Checkbox: React.ForwardRefExoticComponent<Pick<CheckboxProps, "sx" | keyof React.InputHTMLAttributes<HTMLInputElement> | "
|
28
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Pick<CheckboxProps, "sx" | keyof React.InputHTMLAttributes<HTMLInputElement> | "indeterminate" | "validationStatus"> & React.RefAttributes<HTMLInputElement>>;
|
29
29
|
export default Checkbox;
|
package/lib-esm/Details.d.ts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
import { SystemCommonProps } from './constants';
|
2
1
|
import { SxProp } from './sx';
|
3
2
|
import { ComponentProps } from './utils/types';
|
4
|
-
declare const Details: import("styled-components").StyledComponent<"details", any,
|
3
|
+
declare const Details: import("styled-components").StyledComponent<"details", any, SxProp, never>;
|
5
4
|
export declare type DetailsProps = ComponentProps<typeof Details>;
|
6
5
|
export default Details;
|
package/lib-esm/Details.js
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
import styled from 'styled-components';
|
2
|
-
import { COMMON } from './constants';
|
3
2
|
import sx from './sx';
|
4
3
|
const Details = styled.details.withConfig({
|
5
4
|
displayName: "Details",
|
6
5
|
componentId: "ssy9qz-0"
|
7
|
-
})(["& > summary{list-style:none;}& > summary::-webkit-details-marker{display:none;}", "
|
6
|
+
})(["& > summary{list-style:none;}& > summary::-webkit-details-marker{display:none;}", ";"], sx);
|
8
7
|
Details.displayName = 'Details';
|
9
8
|
export default Details;
|