primer_view_components 0.0.112 → 0.0.113
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +38 -0
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/assets/styles/primer_view_components.css +3 -1
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.json +1 -1
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_list.pcss +0 -15
- data/app/components/primer/alpha/auto_complete.css +1 -1
- data/app/components/primer/alpha/auto_complete.css.map +1 -1
- data/app/components/primer/alpha/auto_complete.pcss +1 -1
- data/app/components/primer/alpha/banner.css +1 -1
- data/app/components/primer/alpha/banner.css.map +1 -1
- data/app/components/primer/alpha/banner.pcss +2 -2
- data/app/components/primer/alpha/dialog/body.rb +3 -0
- data/app/components/primer/alpha/dialog/footer.rb +3 -0
- data/app/components/primer/alpha/dialog/header.rb +3 -0
- data/app/components/primer/alpha/dialog.css +1 -0
- data/app/components/primer/alpha/dialog.css.json +1 -0
- data/app/components/primer/alpha/dialog.css.map +1 -0
- data/app/components/primer/alpha/dialog.pcss +484 -0
- data/app/components/primer/alpha/dialog.rb +3 -0
- data/app/components/primer/alpha/segmented_control.css +1 -1
- data/app/components/primer/alpha/segmented_control.css.map +1 -1
- data/app/components/primer/alpha/text_field.css +3 -0
- data/app/components/primer/alpha/text_field.css.json +1 -0
- data/app/components/primer/alpha/text_field.css.map +1 -0
- data/app/components/primer/alpha/text_field.pcss +683 -0
- data/app/components/primer/alpha/toggle_switch.d.ts +1 -1
- data/app/components/primer/alpha/toggle_switch.js +7 -4
- data/app/components/primer/alpha/toggle_switch.ts +7 -3
- data/app/components/primer/beta/button_group.css +1 -0
- data/app/components/primer/beta/button_group.css.json +1 -0
- data/app/components/primer/beta/button_group.css.map +1 -0
- data/app/components/primer/beta/button_group.pcss +92 -0
- data/app/components/primer/{clipboard_copy.d.ts → beta/clipboard_copy.d.ts} +0 -0
- data/app/components/primer/{clipboard_copy.html.erb → beta/clipboard_copy.html.erb} +0 -0
- data/app/components/primer/{clipboard_copy.js → beta/clipboard_copy.js} +0 -0
- data/app/components/primer/beta/clipboard_copy.rb +50 -0
- data/app/components/primer/{clipboard_copy.ts → beta/clipboard_copy.ts} +0 -0
- data/app/components/primer/beta/popover.css.map +1 -1
- data/app/components/primer/beta/popover.pcss +5 -5
- data/app/components/primer/beta/relative_time.rb +160 -0
- data/app/components/primer/button_component.css +1 -0
- data/app/components/primer/button_component.css.json +1 -0
- data/app/components/primer/button_component.css.map +1 -0
- data/app/components/primer/button_component.pcss +557 -0
- data/app/components/primer/button_component.rb +1 -1
- data/app/components/primer/clipboard_copy.rb +2 -43
- data/app/components/primer/component.rb +4 -0
- data/app/components/primer/local_time.d.ts +1 -1
- data/app/components/primer/local_time.js +1 -1
- data/app/components/primer/local_time.rb +3 -1
- data/app/components/primer/local_time.ts +1 -1
- data/app/components/primer/primer.d.ts +1 -1
- data/app/components/primer/primer.js +1 -1
- data/app/components/primer/primer.pcss +10 -0
- data/app/components/primer/primer.ts +1 -1
- data/app/components/primer/time_ago_component.d.ts +1 -1
- data/app/components/primer/time_ago_component.js +1 -1
- data/app/components/primer/time_ago_component.rb +2 -1
- data/app/components/primer/time_ago_component.ts +1 -1
- data/app/forms/submit_button_form.rb +8 -2
- data/app/helpers/primer/form_helper.rb +12 -0
- data/lib/postcss_mixins/clearfix.pcss +12 -0
- data/lib/primer/deprecations.rb +96 -26
- data/lib/primer/deprecations.yml +68 -0
- data/lib/primer/forms/base.rb +7 -20
- data/lib/primer/forms/base_component.rb +15 -1
- data/lib/primer/forms/button.html.erb +4 -0
- data/lib/primer/forms/button.rb +68 -0
- data/lib/primer/forms/check_box.html.erb +2 -2
- data/lib/primer/forms/check_box.rb +1 -1
- data/lib/primer/forms/check_box_group.html.erb +2 -2
- data/lib/primer/forms/dsl/button_input.rb +29 -0
- data/lib/primer/forms/dsl/input_methods.rb +7 -2
- data/lib/primer/forms/dsl/submit_button_input.rb +1 -0
- data/lib/primer/forms/dsl/text_field_input.rb +0 -7
- data/lib/primer/forms/radio_button.html.erb +2 -2
- data/lib/primer/forms/radio_button.rb +1 -1
- data/lib/primer/forms/radio_button_group.html.erb +2 -2
- data/lib/primer/forms/select_list.html.erb +1 -1
- data/lib/primer/forms/select_list.rb +4 -1
- data/lib/primer/forms/submit_button.html.erb +1 -4
- data/lib/primer/forms/submit_button.rb +1 -37
- data/lib/primer/forms/text_area.html.erb +1 -1
- data/lib/primer/forms/text_area.rb +5 -1
- data/lib/primer/forms/text_field.html.erb +1 -1
- data/lib/primer/forms/text_field.rb +11 -0
- data/lib/primer/forms/utils.rb +28 -0
- data/lib/primer/view_components/audited.rb +14 -0
- data/lib/primer/view_components/engine.rb +1 -0
- data/lib/primer/view_components/linters/clipboard_copy_component_migration_counter.rb +2 -2
- data/lib/primer/view_components/linters/helpers/deprecated_components_helpers.rb +3 -18
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/rubocop/cop/primer/component_name_migration.rb +2 -2
- data/lib/tasks/docs.rake +3 -2
- data/previews/primer/alpha/auto_complete_preview.rb +12 -0
- data/previews/primer/alpha/segmented_control_preview.rb +9 -6
- data/previews/primer/alpha/text_field_preview.rb +77 -52
- data/previews/primer/beta/clipboard_copy_preview/element.html.erb +2 -0
- data/previews/primer/beta/clipboard_copy_preview.rb +39 -0
- data/previews/primer/beta/relative_time_preview.rb +271 -0
- data/previews/primer/forms/forms_preview.rb +1 -0
- data/static/arguments.json +143 -33
- data/static/audited_at.json +6 -4
- data/static/constants.json +124 -0
- data/static/statuses.json +4 -2
- metadata +34 -8
- data/previews/primer/clipboard_copy_preview/element.html.erb +0 -2
- data/previews/primer/clipboard_copy_preview.rb +0 -37
@@ -0,0 +1,557 @@
|
|
1
|
+
/* btn */
|
2
|
+
|
3
|
+
/* Base button styles */
|
4
|
+
.btn {
|
5
|
+
position: relative;
|
6
|
+
display: inline-block;
|
7
|
+
padding: 5px var(--primer-control-medium-paddingInline-spacious, 16px);
|
8
|
+
font-size: var(--primer-text-body-size-medium, 14px);
|
9
|
+
font-weight: var(--base-text-weight-medium, 500);
|
10
|
+
line-height: 20px; /* Specifically not inherit our `<body>` default */
|
11
|
+
white-space: nowrap;
|
12
|
+
vertical-align: middle;
|
13
|
+
cursor: pointer;
|
14
|
+
user-select: none;
|
15
|
+
border: var(--primer-borderWidth-thin, 1px) solid;
|
16
|
+
border-radius: var(--primer-borderRadius-medium, 6px);
|
17
|
+
appearance: none; /* Corrects inability to style clickable `input` types in iOS. */
|
18
|
+
|
19
|
+
&:hover {
|
20
|
+
text-decoration: none;
|
21
|
+
}
|
22
|
+
|
23
|
+
&:disabled,
|
24
|
+
&.disabled,
|
25
|
+
&[aria-disabled='true'] {
|
26
|
+
cursor: default;
|
27
|
+
}
|
28
|
+
|
29
|
+
& i {
|
30
|
+
font-style: normal;
|
31
|
+
font-weight: var(--base-text-weight-medium, 500);
|
32
|
+
opacity: 0.75;
|
33
|
+
}
|
34
|
+
|
35
|
+
& .octicon {
|
36
|
+
margin-right: var(--primer-control-small-gap, 4px);
|
37
|
+
color: var(--color-fg-muted);
|
38
|
+
vertical-align: text-bottom;
|
39
|
+
|
40
|
+
&:only-child {
|
41
|
+
margin-right: 0;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
& .Counter {
|
46
|
+
margin-left: 2px;
|
47
|
+
color: inherit;
|
48
|
+
text-shadow: none;
|
49
|
+
vertical-align: top;
|
50
|
+
background-color: var(--color-btn-counter-bg);
|
51
|
+
}
|
52
|
+
|
53
|
+
& .dropdown-caret {
|
54
|
+
margin-left: var(--primer-control-small-gap, 4px);
|
55
|
+
opacity: 0.8;
|
56
|
+
}
|
57
|
+
|
58
|
+
/* Default button */
|
59
|
+
|
60
|
+
color: var(--color-btn-text);
|
61
|
+
background-color: var(--color-btn-bg);
|
62
|
+
border-color: var(--color-btn-border);
|
63
|
+
box-shadow: var(--color-btn-shadow), var(--color-btn-inset-shadow);
|
64
|
+
transition: 80ms cubic-bezier(0.33, 1, 0.68, 1);
|
65
|
+
transition-property: color, background-color, box-shadow, border-color;
|
66
|
+
|
67
|
+
&:hover,
|
68
|
+
&.hover,
|
69
|
+
& [open] > & {
|
70
|
+
background-color: var(--color-btn-hover-bg);
|
71
|
+
border-color: var(--color-btn-hover-border);
|
72
|
+
transition-duration: 0.1s;
|
73
|
+
}
|
74
|
+
|
75
|
+
&:active {
|
76
|
+
background-color: var(--color-btn-active-bg);
|
77
|
+
border-color: var(--color-btn-active-border);
|
78
|
+
transition: none;
|
79
|
+
}
|
80
|
+
|
81
|
+
&.selected,
|
82
|
+
&[aria-selected='true'] {
|
83
|
+
background-color: var(--color-btn-selected-bg);
|
84
|
+
box-shadow: var(--color-primer-shadow-inset);
|
85
|
+
}
|
86
|
+
|
87
|
+
&.disabled,
|
88
|
+
&[aria-disabled='true'] {
|
89
|
+
color: var(--color-primer-fg-disabled);
|
90
|
+
background-color: var(--color-btn-bg);
|
91
|
+
border-color: var(--color-btn-border);
|
92
|
+
|
93
|
+
& .octicon {
|
94
|
+
color: var(--color-primer-fg-disabled);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
/* Primary button */
|
100
|
+
|
101
|
+
.btn-primary {
|
102
|
+
color: var(--color-btn-primary-text);
|
103
|
+
background-color: var(--color-btn-primary-bg);
|
104
|
+
border-color: var(--color-btn-primary-border);
|
105
|
+
box-shadow: var(--color-btn-primary-shadow), var(--color-btn-primary-inset-shadow);
|
106
|
+
|
107
|
+
&:hover,
|
108
|
+
&.hover,
|
109
|
+
& [open] > & {
|
110
|
+
background-color: var(--color-btn-primary-hover-bg);
|
111
|
+
border-color: var(--color-btn-primary-hover-border);
|
112
|
+
}
|
113
|
+
|
114
|
+
/* fallback :focus state */
|
115
|
+
&:focus {
|
116
|
+
@mixin focusOutlineOnEmphasis;
|
117
|
+
|
118
|
+
/* remove fallback :focus if :focus-visible is supported */
|
119
|
+
&:not(:focus-visible) {
|
120
|
+
outline: solid 1px transparent;
|
121
|
+
box-shadow: none;
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
/* default focus state */
|
126
|
+
&:focus-visible {
|
127
|
+
@mixin focusOutlineOnEmphasis;
|
128
|
+
}
|
129
|
+
|
130
|
+
&:active,
|
131
|
+
&.selected,
|
132
|
+
&[aria-selected='true'] {
|
133
|
+
background-color: var(--color-btn-primary-selected-bg);
|
134
|
+
box-shadow: var(--color-btn-primary-selected-shadow);
|
135
|
+
}
|
136
|
+
|
137
|
+
&:disabled,
|
138
|
+
&.disabled,
|
139
|
+
&[aria-disabled='true'] {
|
140
|
+
color: var(--color-btn-primary-disabled-text);
|
141
|
+
background-color: var(--color-btn-primary-disabled-bg);
|
142
|
+
border-color: var(--color-btn-primary-disabled-border);
|
143
|
+
|
144
|
+
& .octicon {
|
145
|
+
color: var(--color-btn-primary-disabled-text);
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
& .Counter {
|
150
|
+
color: inherit;
|
151
|
+
background-color: var(--color-btn-primary-counter-bg);
|
152
|
+
}
|
153
|
+
|
154
|
+
& .octicon {
|
155
|
+
color: var(--color-btn-primary-icon);
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
/* ensure links styled as button primary gets proper focus style */
|
160
|
+
a.btn-primary {
|
161
|
+
/* fallback :focus state */
|
162
|
+
&:focus {
|
163
|
+
@mixin focusOutlineOnEmphasis;
|
164
|
+
|
165
|
+
/* remove fallback :focus if :focus-visible is supported */
|
166
|
+
&:not(:focus-visible) {
|
167
|
+
outline: solid 1px transparent;
|
168
|
+
box-shadow: none;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
/* default focus state */
|
173
|
+
&:focus-visible {
|
174
|
+
@mixin focusOutlineOnEmphasis;
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
/* Outline button */
|
179
|
+
|
180
|
+
.btn-outline {
|
181
|
+
color: var(--color-btn-outline-text);
|
182
|
+
|
183
|
+
&:hover,
|
184
|
+
& [open] > & {
|
185
|
+
color: var(--color-btn-outline-hover-text);
|
186
|
+
background-color: var(--color-btn-outline-hover-bg);
|
187
|
+
border-color: var(--color-btn-outline-hover-border);
|
188
|
+
box-shadow: var(--color-btn-outline-hover-shadow), var(--color-btn-outline-hover-inset-shadow);
|
189
|
+
|
190
|
+
& .Counter {
|
191
|
+
background-color: var(--color-btn-outline-hover-counter-bg);
|
192
|
+
}
|
193
|
+
|
194
|
+
& .octicon {
|
195
|
+
color: inherit;
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
&:active,
|
200
|
+
&.selected,
|
201
|
+
&[aria-selected='true'] {
|
202
|
+
color: var(--color-btn-outline-selected-text);
|
203
|
+
background-color: var(--color-btn-outline-selected-bg);
|
204
|
+
border-color: var(--color-btn-outline-selected-border);
|
205
|
+
box-shadow: var(--color-btn-outline-selected-shadow);
|
206
|
+
|
207
|
+
/* fallback :focus state */
|
208
|
+
&:focus {
|
209
|
+
@mixin focusOutlineOnEmphasis;
|
210
|
+
|
211
|
+
/* remove fallback :focus if :focus-visible is supported */
|
212
|
+
&:not(:focus-visible) {
|
213
|
+
outline: solid 1px transparent;
|
214
|
+
box-shadow: none;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
/* default focus state */
|
219
|
+
&:focus-visible {
|
220
|
+
@mixin focusOutlineOnEmphasis;
|
221
|
+
}
|
222
|
+
}
|
223
|
+
|
224
|
+
&:disabled,
|
225
|
+
&.disabled,
|
226
|
+
&[aria-disabled='true'] {
|
227
|
+
color: var(--color-btn-outline-disabled-text);
|
228
|
+
background-color: var(--color-btn-outline-disabled-bg);
|
229
|
+
border-color: var(--color-btn-border);
|
230
|
+
box-shadow: none;
|
231
|
+
|
232
|
+
& .Counter {
|
233
|
+
background-color: var(--color-btn-outline-disabled-counter-bg);
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
& .Counter {
|
238
|
+
color: inherit;
|
239
|
+
background-color: var(--color-btn-outline-counter-bg);
|
240
|
+
}
|
241
|
+
}
|
242
|
+
|
243
|
+
/* Danger button */
|
244
|
+
|
245
|
+
.btn-danger {
|
246
|
+
color: var(--color-btn-danger-text);
|
247
|
+
|
248
|
+
& .octicon {
|
249
|
+
color: var(--color-btn-danger-icon);
|
250
|
+
}
|
251
|
+
|
252
|
+
&:hover,
|
253
|
+
& [open] > & {
|
254
|
+
color: var(--color-btn-danger-hover-text);
|
255
|
+
background-color: var(--color-btn-danger-hover-bg);
|
256
|
+
border-color: var(--color-btn-danger-hover-border);
|
257
|
+
box-shadow: var(--color-btn-danger-hover-shadow), var(--color-btn-danger-hover-inset-shadow);
|
258
|
+
|
259
|
+
& .Counter {
|
260
|
+
background-color: var(--color-btn-danger-hover-counter-bg);
|
261
|
+
}
|
262
|
+
|
263
|
+
& .octicon {
|
264
|
+
color: var(--color-btn-danger-hover-icon);
|
265
|
+
}
|
266
|
+
}
|
267
|
+
|
268
|
+
&:active,
|
269
|
+
&.selected,
|
270
|
+
&[aria-selected='true'] {
|
271
|
+
color: var(--color-btn-danger-selected-text);
|
272
|
+
background-color: var(--color-btn-danger-selected-bg);
|
273
|
+
border-color: var(--color-btn-danger-selected-border);
|
274
|
+
box-shadow: var(--color-btn-danger-selected-shadow);
|
275
|
+
}
|
276
|
+
|
277
|
+
&:disabled,
|
278
|
+
&.disabled,
|
279
|
+
&[aria-disabled='true'] {
|
280
|
+
color: var(--color-btn-danger-disabled-text);
|
281
|
+
background-color: var(--color-btn-danger-disabled-bg);
|
282
|
+
border-color: var(--color-btn-border);
|
283
|
+
box-shadow: none;
|
284
|
+
|
285
|
+
& .Counter {
|
286
|
+
background-color: var(--color-btn-danger-disabled-counter-bg);
|
287
|
+
}
|
288
|
+
|
289
|
+
& .octicon {
|
290
|
+
color: var(--color-btn-danger-disabled-text);
|
291
|
+
}
|
292
|
+
}
|
293
|
+
|
294
|
+
& .Counter {
|
295
|
+
color: inherit;
|
296
|
+
background-color: var(--color-btn-danger-counter-bg);
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
/* Sizes
|
301
|
+
**
|
302
|
+
** Tweak `line-height` to make them smaller. */
|
303
|
+
.btn-sm {
|
304
|
+
padding: 3px 12px;
|
305
|
+
font-size: var(--primer-text-body-size-small, 12px);
|
306
|
+
line-height: 20px;
|
307
|
+
|
308
|
+
& .octicon {
|
309
|
+
vertical-align: text-top;
|
310
|
+
}
|
311
|
+
}
|
312
|
+
|
313
|
+
/* Large button adds more padding around text. Use font-size utils to increase font-size..
|
314
|
+
** e.g, <p class="text-gamma"><button class="btn btn-large btn-primary" type="button">Big green button</button></p> */
|
315
|
+
.btn-large {
|
316
|
+
padding: 0.75em 1.5em;
|
317
|
+
font-size: inherit;
|
318
|
+
line-height: 1.5;
|
319
|
+
border-radius: 0.5em;
|
320
|
+
}
|
321
|
+
|
322
|
+
/* Full-width button
|
323
|
+
**
|
324
|
+
** These buttons expand to the full width of their parent container */
|
325
|
+
.btn-block {
|
326
|
+
display: block;
|
327
|
+
width: 100%;
|
328
|
+
text-align: center;
|
329
|
+
}
|
330
|
+
|
331
|
+
|
332
|
+
/* Link-like buttons
|
333
|
+
**
|
334
|
+
** This class is for styling <button> and <input> elements to look like links */
|
335
|
+
|
336
|
+
.btn-link {
|
337
|
+
display: inline-block;
|
338
|
+
padding: 0;
|
339
|
+
font-size: inherit;
|
340
|
+
color: var(--color-accent-fg);
|
341
|
+
text-decoration: none;
|
342
|
+
white-space: nowrap;
|
343
|
+
cursor: pointer;
|
344
|
+
user-select: none;
|
345
|
+
background-color: transparent;
|
346
|
+
border: 0;
|
347
|
+
appearance: none; /* Corrects inability to style clickable `input` types in iOS. */
|
348
|
+
|
349
|
+
&:hover {
|
350
|
+
text-decoration: underline;
|
351
|
+
}
|
352
|
+
|
353
|
+
&:disabled,
|
354
|
+
&[aria-disabled='true'] {
|
355
|
+
&,
|
356
|
+
&:hover {
|
357
|
+
color: var(--color-primer-fg-disabled);
|
358
|
+
cursor: default;
|
359
|
+
}
|
360
|
+
}
|
361
|
+
|
362
|
+
&:not(.dropdown-item) {
|
363
|
+
&:focus,
|
364
|
+
&:focus-visible {
|
365
|
+
border-radius: var(--primer-borderRadius-medium, 6px);
|
366
|
+
outline-offset: 0;
|
367
|
+
}
|
368
|
+
}
|
369
|
+
}
|
370
|
+
|
371
|
+
/* Invisible button
|
372
|
+
**
|
373
|
+
** Typically used as a "cancel" button next to a .btn */
|
374
|
+
|
375
|
+
.btn-invisible {
|
376
|
+
color: var(--color-accent-fg);
|
377
|
+
background-color: transparent; /* Reset default gradient backgrounds and colors */
|
378
|
+
border: 0;
|
379
|
+
border-radius: var(--primer-borderRadius-medium, 6px);
|
380
|
+
box-shadow: none;
|
381
|
+
|
382
|
+
&:hover,
|
383
|
+
&.zeroclipboard-is-hover {
|
384
|
+
color: var(--color-accent-fg);
|
385
|
+
background-color: var(--color-btn-hover-bg);
|
386
|
+
outline: none;
|
387
|
+
box-shadow: none;
|
388
|
+
}
|
389
|
+
|
390
|
+
&:active,
|
391
|
+
&.selected,
|
392
|
+
&[aria-selected='true'],
|
393
|
+
&.zeroclipboard-is-active {
|
394
|
+
color: var(--color-accent-fg);
|
395
|
+
background: none;
|
396
|
+
border-color: var(--color-btn-active-border);
|
397
|
+
|
398
|
+
@mixin focusOutline;
|
399
|
+
}
|
400
|
+
|
401
|
+
&:active &.zeroclipboard-is-active {
|
402
|
+
background-color: var(--color-btn-selected-bg);
|
403
|
+
}
|
404
|
+
|
405
|
+
&:disabled,
|
406
|
+
&.disabled,
|
407
|
+
&[aria-disabled='true'] {
|
408
|
+
color: var(--color-primer-fg-disabled);
|
409
|
+
background-color: transparent;
|
410
|
+
}
|
411
|
+
}
|
412
|
+
|
413
|
+
/* Octicon button
|
414
|
+
**
|
415
|
+
** Icon-only buttons */
|
416
|
+
|
417
|
+
.btn-octicon {
|
418
|
+
display: inline-block;
|
419
|
+
padding: 5px;
|
420
|
+
margin-left: 5px;
|
421
|
+
line-height: 1;
|
422
|
+
color: var(--color-fg-muted);
|
423
|
+
vertical-align: middle;
|
424
|
+
|
425
|
+
/* For `<button>` elements */
|
426
|
+
background: transparent;
|
427
|
+
border: 0;
|
428
|
+
box-shadow: none;
|
429
|
+
|
430
|
+
&:hover {
|
431
|
+
color: var(--color-accent-fg);
|
432
|
+
}
|
433
|
+
|
434
|
+
&:focus,
|
435
|
+
&:focus-visible {
|
436
|
+
border-radius: var(--primer-borderRadius-medium, 6px);
|
437
|
+
}
|
438
|
+
|
439
|
+
&.disabled,
|
440
|
+
&[aria-disabled='true'] {
|
441
|
+
color: var(--color-primer-fg-disabled);
|
442
|
+
cursor: default;
|
443
|
+
|
444
|
+
&:hover {
|
445
|
+
color: var(--color-primer-fg-disabled);
|
446
|
+
}
|
447
|
+
}
|
448
|
+
}
|
449
|
+
|
450
|
+
.btn-octicon-danger:hover {
|
451
|
+
color: var(--color-danger-fg);
|
452
|
+
}
|
453
|
+
|
454
|
+
/* Close button
|
455
|
+
**
|
456
|
+
** Typically used with an octicon-x */
|
457
|
+
|
458
|
+
.close-button {
|
459
|
+
padding: 0;
|
460
|
+
color: var(--color-fg-muted);
|
461
|
+
background: transparent;
|
462
|
+
border: 0;
|
463
|
+
|
464
|
+
&:hover {
|
465
|
+
color: var(--color-fg-default);
|
466
|
+
}
|
467
|
+
|
468
|
+
&:active {
|
469
|
+
@mixin focusOutline;
|
470
|
+
}
|
471
|
+
}
|
472
|
+
|
473
|
+
/* Hidden text button
|
474
|
+
**
|
475
|
+
** Use `.hidden-text-expander` to indicate and expand hidden text. */
|
476
|
+
|
477
|
+
.hidden-text-expander {
|
478
|
+
display: block;
|
479
|
+
|
480
|
+
&.inline {
|
481
|
+
position: relative;
|
482
|
+
top: -1px;
|
483
|
+
display: inline-block;
|
484
|
+
margin-left: 5px;
|
485
|
+
line-height: 0;
|
486
|
+
}
|
487
|
+
}
|
488
|
+
|
489
|
+
.hidden-text-expander a,
|
490
|
+
.ellipsis-expander {
|
491
|
+
display: inline-block;
|
492
|
+
height: 12px;
|
493
|
+
padding: 0 5px 5px;
|
494
|
+
font-size: var(--primer-text-body-size-small, 12px);
|
495
|
+
font-weight: var(--base-text-weight-semibold, 600);
|
496
|
+
line-height: 6px;
|
497
|
+
color: var(--color-fg-default);
|
498
|
+
text-decoration: none;
|
499
|
+
vertical-align: middle;
|
500
|
+
background: var(--color-neutral-muted);
|
501
|
+
border: 0;
|
502
|
+
border-radius: 1px;
|
503
|
+
|
504
|
+
&:hover {
|
505
|
+
text-decoration: none;
|
506
|
+
background-color: var(--color-accent-muted);
|
507
|
+
}
|
508
|
+
|
509
|
+
&:active {
|
510
|
+
color: var(--color-fg-on-emphasis);
|
511
|
+
background-color: var(--color-accent-emphasis);
|
512
|
+
}
|
513
|
+
}
|
514
|
+
|
515
|
+
/* Social button count
|
516
|
+
** TODO: Deprecate? Use BtnGroup instead? */
|
517
|
+
|
518
|
+
.btn-with-count {
|
519
|
+
float: left;
|
520
|
+
border-top-right-radius: 0;
|
521
|
+
border-bottom-right-radius: 0;
|
522
|
+
|
523
|
+
&:focus {
|
524
|
+
z-index: 1;
|
525
|
+
}
|
526
|
+
}
|
527
|
+
|
528
|
+
/* Social count bubble
|
529
|
+
**
|
530
|
+
** A container that is used for social bubbles counts. */
|
531
|
+
|
532
|
+
.social-count {
|
533
|
+
position: relative;
|
534
|
+
float: left;
|
535
|
+
padding: 3px 12px;
|
536
|
+
font-size: var(--primer-text-body-size-small, 12px);
|
537
|
+
font-weight: var(--base-text-weight-semibold, 600);
|
538
|
+
line-height: 20px;
|
539
|
+
color: var(--color-fg-default);
|
540
|
+
vertical-align: middle;
|
541
|
+
background-color: var(--color-canvas-default);
|
542
|
+
border: var(--primer-borderWidth-thin, 1px) solid var(--color-btn-border);
|
543
|
+
border-left: 0;
|
544
|
+
border-top-right-radius: var(--primer-borderRadius-medium, 6px);
|
545
|
+
border-bottom-right-radius: var(--primer-borderRadius-medium, 6px);
|
546
|
+
box-shadow: var(--color-shadow-small), var(--color-primer-shadow-highlight);
|
547
|
+
|
548
|
+
&:hover,
|
549
|
+
&:active {
|
550
|
+
text-decoration: none;
|
551
|
+
}
|
552
|
+
|
553
|
+
&:hover {
|
554
|
+
color: var(--color-accent-fg);
|
555
|
+
cursor: pointer;
|
556
|
+
}
|
557
|
+
}
|
@@ -1,48 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Primer
|
4
|
-
|
5
|
-
|
6
|
-
# @accessibility
|
7
|
-
# Always set an accessible label to help the user interact with the component.
|
8
|
-
class ClipboardCopy < Primer::Component
|
9
|
-
status :beta
|
10
|
-
|
11
|
-
# @example Default
|
12
|
-
# <%= render(Primer::ClipboardCopy.new(value: "Text to copy", "aria-label": "Copy text to the system clipboard")) %>
|
13
|
-
#
|
14
|
-
# @example With text instead of icons
|
15
|
-
# <%= render(Primer::ClipboardCopy.new(value: "Text to copy")) do %>
|
16
|
-
# Click to copy!
|
17
|
-
# <% end %>
|
18
|
-
#
|
19
|
-
# @example Copying from an element
|
20
|
-
# <%= render(Primer::ClipboardCopy.new(for: "blob-path", "aria-label": "Copy text to the system clipboard")) %>
|
21
|
-
# <div id="blob-path">src/index.js</div>
|
22
|
-
#
|
23
|
-
# @param aria-label [String] String that will be read to screenreaders when the component is focused
|
24
|
-
# @param value [String] Text to copy into the users clipboard when they click the component.
|
25
|
-
# @param for [String] Element id from where to get the copied value.
|
26
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
27
|
-
def initialize(value: nil, **system_arguments)
|
28
|
-
@system_arguments = deny_tag_argument(**system_arguments)
|
29
|
-
@value = value
|
30
|
-
|
31
|
-
validate!
|
32
|
-
|
33
|
-
@system_arguments[:tag] = "clipboard-copy"
|
34
|
-
@system_arguments[:value] = value if value.present?
|
35
|
-
end
|
36
|
-
|
37
|
-
# :nodoc:
|
38
|
-
def before_render
|
39
|
-
validate_aria_label if content.blank?
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def validate!
|
45
|
-
raise ArgumentError, "Must provide either `value` or `for`" if @value.nil? && @system_arguments[:for].nil?
|
46
|
-
end
|
4
|
+
class ClipboardCopy < Primer::Beta::ClipboardCopy
|
5
|
+
status :deprecated
|
47
6
|
end
|
48
7
|
end
|
@@ -1 +1 @@
|
|
1
|
-
import '@github/time-
|
1
|
+
import '@github/relative-time-element';
|
@@ -1 +1 @@
|
|
1
|
-
import '@github/time-
|
1
|
+
import '@github/relative-time-element';
|
@@ -37,7 +37,9 @@ module Primer
|
|
37
37
|
|
38
38
|
@datetime = datetime
|
39
39
|
|
40
|
-
@system_arguments[:tag] = "
|
40
|
+
@system_arguments[:tag] = "relative-time"
|
41
|
+
@system_arguments[:threshold] = "PT0S"
|
42
|
+
@system_arguments[:prefix] = ""
|
41
43
|
@system_arguments[:datetime] = datetime
|
42
44
|
|
43
45
|
@initial_text = initial_text
|
@@ -1 +1 @@
|
|
1
|
-
import '@github/time-
|
1
|
+
import '@github/relative-time-element'
|
@@ -7,7 +7,7 @@ import './alpha/toggle_switch';
|
|
7
7
|
import './alpha/tool_tip';
|
8
8
|
import './alpha/x_banner';
|
9
9
|
import './beta/auto_complete/auto_complete';
|
10
|
-
import './clipboard_copy';
|
10
|
+
import './beta/clipboard_copy';
|
11
11
|
import './local_time';
|
12
12
|
import './tab_container_component';
|
13
13
|
import './time_ago_component';
|
@@ -7,7 +7,7 @@ import './alpha/toggle_switch';
|
|
7
7
|
import './alpha/tool_tip';
|
8
8
|
import './alpha/x_banner';
|
9
9
|
import './beta/auto_complete/auto_complete';
|
10
|
-
import './clipboard_copy';
|
10
|
+
import './beta/clipboard_copy';
|
11
11
|
import './local_time';
|
12
12
|
import './tab_container_component';
|
13
13
|
import './time_ago_component';
|
@@ -1,19 +1,26 @@
|
|
1
1
|
/* CSS component styles here */
|
2
|
+
|
3
|
+
/* alpha */
|
2
4
|
@import "./alpha/action_list.pcss";
|
3
5
|
@import "./alpha/auto_complete.pcss";
|
4
6
|
@import "./alpha/banner.pcss";
|
7
|
+
@import "./alpha/dialog.pcss";
|
5
8
|
@import "./alpha/dropdown.pcss";
|
6
9
|
@import "./alpha/tab_nav.pcss";
|
10
|
+
@import "./alpha/text_field.pcss";
|
7
11
|
@import "./alpha/button_marketing.pcss";
|
8
12
|
@import "./alpha/toggle_switch.pcss";
|
9
13
|
@import "./alpha/underline_nav.pcss";
|
10
14
|
@import "./alpha/segmented_control.pcss";
|
15
|
+
|
16
|
+
/* beta */
|
11
17
|
@import "./beta/avatar.pcss";
|
12
18
|
@import "./beta/avatar_stack.pcss";
|
13
19
|
@import "./beta/border_box.pcss";
|
14
20
|
@import "./beta/blankslate.pcss";
|
15
21
|
@import "./beta/breadcrumbs.pcss";
|
16
22
|
@import "./beta/button.pcss";
|
23
|
+
@import "./beta/button_group.pcss";
|
17
24
|
@import "./beta/counter.pcss";
|
18
25
|
@import "./beta/flash.pcss";
|
19
26
|
@import "./beta/label.pcss";
|
@@ -21,6 +28,9 @@
|
|
21
28
|
@import "./beta/popover.pcss";
|
22
29
|
@import "./beta/progress_bar.pcss";
|
23
30
|
@import "./beta/truncate.pcss";
|
31
|
+
|
32
|
+
/* to be renamed */
|
33
|
+
@import "./button_component.pcss";
|
24
34
|
@import "./menu_component.pcss";
|
25
35
|
@import "./state_component.pcss";
|
26
36
|
@import "./subhead_component.pcss";
|