primer_view_components 0.0.96 → 0.0.98
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -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 +1 -1
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_list/action-list-selection.pcss +92 -0
- data/app/components/primer/alpha/action_list/action-list.pcss +620 -0
- data/app/components/primer/alpha/action_list/divider.rb +35 -0
- data/app/components/primer/alpha/action_list/heading.html.erb +8 -0
- data/app/components/primer/alpha/action_list/heading.rb +38 -0
- data/app/components/primer/alpha/action_list/item.html.erb +39 -0
- data/app/components/primer/alpha/action_list/item.rb +230 -0
- data/app/components/primer/alpha/action_list.html.erb +15 -0
- data/app/components/primer/alpha/action_list.rb +112 -0
- data/app/components/primer/alpha/dialog/header.rb +1 -1
- data/app/components/primer/alpha/nav_list/item.html.erb +13 -0
- data/app/components/primer/alpha/nav_list/item.rb +89 -0
- data/app/components/primer/alpha/nav_list/section.html.erb +3 -0
- data/app/components/primer/alpha/nav_list/section.rb +88 -0
- data/app/components/primer/alpha/nav_list.d.ts +25 -0
- data/app/components/primer/alpha/nav_list.html.erb +10 -0
- data/app/components/primer/alpha/nav_list.js +130 -0
- data/app/components/primer/alpha/nav_list.rb +112 -0
- data/app/components/primer/alpha/nav_list.ts +129 -0
- data/app/components/primer/beta/avatar.rb +10 -10
- data/app/components/primer/beta/avatar_stack.rb +9 -9
- data/app/components/primer/beta/blankslate.rb +2 -2
- data/app/components/primer/button_component.rb +1 -1
- data/app/components/primer/image.rb +4 -4
- data/app/components/primer/image_crop.rb +3 -3
- data/app/components/primer/primer.d.ts +1 -0
- data/app/components/primer/primer.js +1 -0
- data/app/components/primer/primer.pcss +1 -0
- data/app/components/primer/primer.ts +1 -0
- data/app/components/primer/timeline_item_component.rb +1 -1
- data/lib/postcss_mixins/activeIndicatorLine.pcss +11 -0
- data/lib/primer/deprecations.rb +0 -1
- data/lib/primer/example_image.rb +7 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/tasks/docs.rake +55 -26
- data/lib/tasks/test.rake +1 -1
- data/lib/yard/docs_helper.rb +3 -3
- data/previews/primer/alpha/action_list_preview/heading.html.erb +4 -0
- data/previews/primer/alpha/action_list_preview.rb +308 -0
- data/previews/primer/alpha/auto_complete_preview.rb +42 -0
- data/previews/primer/alpha/button_marketing_preview.rb +17 -0
- data/previews/primer/alpha/dialog_preview/custom_header.html.erb +7 -0
- data/previews/primer/alpha/dialog_preview/test.html.erb +7 -0
- data/previews/primer/alpha/dialog_preview/with_footer.html.erb +8 -0
- data/previews/primer/alpha/dialog_preview/with_form.html.erb +12 -0
- data/previews/primer/alpha/dialog_preview.rb +85 -0
- data/previews/primer/alpha/hidden_text_expander_preview.rb +15 -0
- data/previews/primer/alpha/layout_preview.rb +23 -0
- data/previews/primer/alpha/nav_list_preview.rb +64 -0
- data/previews/primer/alpha/tab_panels_preview.rb +23 -0
- data/previews/primer/alpha/text_field_preview.rb +66 -0
- data/previews/primer/alpha/toggle_switch_preview.rb +50 -0
- data/previews/primer/alpha/tooltip_preview/with_multiple_on_a_page.html.erb +14 -0
- data/previews/primer/alpha/tooltip_preview/with_right_most_position.html.erb +7 -0
- data/previews/primer/alpha/tooltip_preview.rb +83 -0
- data/previews/primer/alpha/underline_nav_preview/default.html.erb +8 -0
- data/previews/primer/alpha/underline_nav_preview.rb +41 -0
- data/previews/primer/alpha/underline_panels_preview.rb +23 -0
- data/previews/primer/beta/auto_complete_item_preview/default.html.erb +9 -0
- data/previews/primer/beta/auto_complete_item_preview/with_description.html.erb +11 -0
- data/previews/primer/beta/auto_complete_item_preview.rb +40 -0
- data/previews/primer/beta/auto_complete_preview/with_submit_button.html.erb +20 -0
- data/previews/primer/beta/auto_complete_preview.rb +245 -0
- data/previews/primer/beta/avatar_preview.rb +17 -0
- data/previews/primer/beta/avatar_stack_preview.rb +44 -0
- data/previews/primer/beta/base_button_preview.rb +17 -0
- data/previews/primer/beta/blankslate_preview.rb +94 -0
- data/previews/primer/beta/border_box_preview.rb +32 -0
- data/previews/primer/beta/breadcrumbs_preview.rb +19 -0
- data/previews/primer/beta/button_group_preview.rb +20 -0
- data/previews/primer/beta/button_preview/all_schemes.html.erb +26 -0
- data/previews/primer/beta/button_preview/leading_visual.html.erb +10 -0
- data/previews/primer/beta/button_preview/trailing_action.html.erb +10 -0
- data/previews/primer/beta/button_preview/trailing_visual.html.erb +11 -0
- data/previews/primer/beta/button_preview/with_tooltip.html.erb +10 -0
- data/previews/primer/beta/button_preview.rb +256 -0
- data/previews/primer/beta/close_button_preview.rb +15 -0
- data/previews/primer/beta/counter_preview.rb +24 -0
- data/previews/primer/beta/details_preview.rb +45 -0
- data/previews/primer/beta/flash_preview.rb +20 -0
- data/previews/primer/beta/heading_preview.rb +16 -0
- data/previews/primer/beta/icon_button_preview.rb +107 -0
- data/previews/primer/beta/text_preview.rb +16 -0
- data/previews/primer/beta/truncate_preview.rb +47 -0
- data/previews/primer/clipboard_copy_preview/element.html.erb +2 -0
- data/previews/primer/clipboard_copy_preview.rb +29 -0
- data/previews/primer/dropdown_preview.rb +39 -0
- data/previews/primer/forms/forms_preview/after_content_form.html.erb +3 -0
- data/previews/primer/forms/forms_preview/array_check_box_group_form.html.erb +3 -0
- data/previews/primer/forms/forms_preview/caption_template_form.html.erb +3 -0
- data/previews/primer/forms/forms_preview/check_box_group_form.html.erb +3 -0
- data/previews/primer/forms/forms_preview/composed_form.html.erb +4 -0
- data/previews/primer/forms/forms_preview/horizontal_form.html.erb +3 -0
- data/previews/primer/forms/forms_preview/invalid_form.html.erb +3 -0
- data/previews/primer/forms/forms_preview/multi_input_form.html.erb +3 -0
- data/previews/primer/forms/forms_preview/multi_text_field_form.html.erb +3 -0
- data/previews/primer/forms/forms_preview/radio_button_group_form.html.erb +3 -0
- data/previews/primer/forms/forms_preview/radio_button_with_nested_form.html.erb +3 -0
- data/previews/primer/forms/forms_preview/select_list_form.html.erb +3 -0
- data/previews/primer/forms/forms_preview/single_text_field_form.html.erb +3 -0
- data/previews/primer/forms/forms_preview/submit_button_form.html.erb +3 -0
- data/previews/primer/forms/forms_preview/text_field_and_checkbox_form.html.erb +3 -0
- data/previews/primer/forms/forms_preview.rb +37 -0
- data/previews/primer/hellip_button_preview.rb +14 -0
- data/previews/primer/image_crop_preview.rb +22 -0
- data/previews/primer/label_component_preview.rb +15 -0
- data/previews/primer/layout_component_preview.rb +18 -0
- data/previews/primer/link_component_preview.rb +29 -0
- data/previews/primer/local_time_component_preview.rb +41 -0
- data/previews/primer/markdown_preview.rb +280 -0
- data/previews/primer/menu_component_preview/default.html.erb +17 -0
- data/previews/primer/menu_component_preview.rb +9 -0
- data/previews/primer/octicon_component_preview.rb +14 -0
- data/previews/primer/popover_component_preview.rb +20 -0
- data/previews/primer/progress_bar_component_preview.rb +17 -0
- data/previews/primer/spinner_component_preview.rb +13 -0
- data/previews/primer/state_component_preview.rb +16 -0
- data/previews/primer/subhead_component_preview.rb +23 -0
- data/previews/primer/time_ago_component_preview.rb +16 -0
- data/previews/primer/timeline_item_component_preview.rb +17 -0
- data/static/arguments.json +267 -3
- data/static/audited_at.json +7 -0
- data/static/constants.json +76 -0
- data/static/statuses.json +8 -1
- metadata +106 -5
- data/app/components/primer/experimental/action_bar.d.ts +0 -14
- data/app/components/primer/experimental/action_bar.js +0 -141
@@ -0,0 +1,620 @@
|
|
1
|
+
:root {
|
2
|
+
--primer-actionListContent-paddingBlock: var(--primer-control-medium-paddingBlock, 6px);
|
3
|
+
}
|
4
|
+
|
5
|
+
/* ActionList */
|
6
|
+
|
7
|
+
/* <ul> */
|
8
|
+
.ActionListWrap {
|
9
|
+
list-style: none;
|
10
|
+
}
|
11
|
+
|
12
|
+
.ActionListWrap--inset {
|
13
|
+
padding: var(--base-size-8, 8px);
|
14
|
+
}
|
15
|
+
|
16
|
+
/* list dividers */
|
17
|
+
|
18
|
+
.ActionListWrap--divided {
|
19
|
+
& .ActionListItem-label::before {
|
20
|
+
position: absolute;
|
21
|
+
top: calc(-1 * var(--primer-actionListContent-paddingBlock));
|
22
|
+
display: block;
|
23
|
+
width: 100%;
|
24
|
+
height: 1px;
|
25
|
+
content: '';
|
26
|
+
background: var(--color-action-list-item-inline-divider);
|
27
|
+
}
|
28
|
+
|
29
|
+
/* if descriptionWrap--inline exists, move pseudo divider to wrapper */
|
30
|
+
& .ActionListItem-descriptionWrap--inline {
|
31
|
+
&::before {
|
32
|
+
position: absolute;
|
33
|
+
top: calc(-1 * var(--primer-actionListContent-paddingBlock));
|
34
|
+
display: block;
|
35
|
+
width: 100%;
|
36
|
+
height: var(--primer-borderWidth-thin, 1px);
|
37
|
+
content: '';
|
38
|
+
background: var(--color-action-list-item-inline-divider);
|
39
|
+
}
|
40
|
+
|
41
|
+
/* unset the default label pseudo */
|
42
|
+
& .ActionListItem-label::before {
|
43
|
+
content: unset;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
/* hide divider if item is active */
|
48
|
+
& .ActionListItem--navActive {
|
49
|
+
& .ActionListItem-label::before,
|
50
|
+
+ .ActionListItem .ActionListItem-label::before {
|
51
|
+
visibility: hidden;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
/* hide if item is first of type with label::before, or is the first item after a sectionDivider */
|
57
|
+
.ActionListItem:first-of-type .ActionListItem-label::before,
|
58
|
+
.ActionList-sectionDivider + .ActionListItem .ActionListItem-label::before {
|
59
|
+
visibility: hidden;
|
60
|
+
}
|
61
|
+
|
62
|
+
/* hide if item is first of type with label::before, or is the first item after a sectionDivider */
|
63
|
+
.ActionListItem:first-of-type .ActionListItem-descriptionWrap--inline::before,
|
64
|
+
.ActionList-sectionDivider + .ActionListItem .ActionListItem-descriptionWrap--inline::before {
|
65
|
+
visibility: hidden;
|
66
|
+
}
|
67
|
+
|
68
|
+
/* ActionList::Item */
|
69
|
+
|
70
|
+
/* divider behavior */
|
71
|
+
|
72
|
+
.ActionListItem {
|
73
|
+
/* hide dividers */
|
74
|
+
@media (hover: hover) {
|
75
|
+
&:hover {
|
76
|
+
& .ActionListItem-label::before,
|
77
|
+
& + .ActionListItem .ActionListItem-label::before {
|
78
|
+
visibility: hidden;
|
79
|
+
}
|
80
|
+
|
81
|
+
& .ActionListItem-descriptionWrap--inline::before,
|
82
|
+
& + .ActionListItem .ActionListItem-descriptionWrap--inline::before {
|
83
|
+
visibility: hidden;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
/* Make sure that the first visible item isn't a divider */
|
89
|
+
&[hidden] + .ActionList-sectionDivider {
|
90
|
+
display: none;
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
/* sub items */
|
95
|
+
|
96
|
+
.ActionListItem {
|
97
|
+
/* target contents of li if sub-item (li wraps item label + nested ul) */
|
98
|
+
/* collapse styles here */
|
99
|
+
&.ActionListItem--hasSubItem {
|
100
|
+
/* first child */
|
101
|
+
& > .ActionListContent {
|
102
|
+
z-index: 1;
|
103
|
+
|
104
|
+
@media (hover: hover) {
|
105
|
+
&:hover {
|
106
|
+
background-color: var(--color-action-list-item-default-hover-bg);
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
&:active {
|
111
|
+
background-color: var(--color-action-list-item-default-active-bg);
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
/* <li> */
|
118
|
+
.ActionListItem {
|
119
|
+
position: relative;
|
120
|
+
list-style: none;
|
121
|
+
background-color: transparent;
|
122
|
+
border-radius: var(--primer-borderRadius-medium, 6px);
|
123
|
+
|
124
|
+
/* state */
|
125
|
+
|
126
|
+
&:hover,
|
127
|
+
&:active {
|
128
|
+
cursor: pointer;
|
129
|
+
}
|
130
|
+
|
131
|
+
/* only hover li without list as children */
|
132
|
+
&:not(.ActionListItem--hasSubItem),
|
133
|
+
/* target contents of first child li if sub-item (li wraps item label + nested ul) */
|
134
|
+
&.ActionListItem--hasSubItem > .ActionListContent {
|
135
|
+
@media (hover: hover) {
|
136
|
+
&:hover {
|
137
|
+
cursor: pointer;
|
138
|
+
background-color: var(--color-action-list-item-default-hover-bg);
|
139
|
+
|
140
|
+
&:not(.ActionListItem--navActive):not(:focus-visible) {
|
141
|
+
/* Support for "Windows high contrast mode" */
|
142
|
+
outline: solid var(--primer-borderWidth-thin, 1px) transparent;
|
143
|
+
outline-offset: calc(-1 * var(--primer-borderWidth-thin, 1px));
|
144
|
+
box-shadow: var(--primer-borderInset-thin, 1px) var(--color-action-list-item-default-active-border);
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
&:active {
|
150
|
+
background: var(--color-action-list-item-default-active-bg);
|
151
|
+
|
152
|
+
&:not(.ActionListItem--navActive) {
|
153
|
+
/* Support for "Windows high contrast mode" https:sarahmhigley.com/writing/whcm-quick-tips/ */
|
154
|
+
outline: solid var(--primer-borderWidth-thin, 1px) transparent;
|
155
|
+
outline-offset: calc(-1 * var(--primer-borderWidth-thin, 1px));
|
156
|
+
box-shadow: var(--primer-borderInset-thin, 1px) var(--color-action-list-item-default-active-border);
|
157
|
+
}
|
158
|
+
|
159
|
+
@media screen and (prefers-reduced-motion: no-preference) {
|
160
|
+
animation: ActionListItem-active-bg 4s forwards cubic-bezier(0.33, 1, 0.68, 1);
|
161
|
+
}
|
162
|
+
|
163
|
+
@keyframes ActionListItem-active-bg {
|
164
|
+
50% {
|
165
|
+
box-shadow: inset 0 2px 12px 6px rgba(var(--color-canvas-default), 0.4);
|
166
|
+
transform: scale(1);
|
167
|
+
}
|
168
|
+
|
169
|
+
100% {
|
170
|
+
transform: scale(0.97);
|
171
|
+
}
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
&:active {
|
176
|
+
& .ActionListItem-label::before,
|
177
|
+
& + .ActionListItem .ActionListItem-label::before {
|
178
|
+
visibility: hidden;
|
179
|
+
}
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
/* Autocomplete [aria-selected] items */
|
184
|
+
|
185
|
+
&[aria-selected='true'] {
|
186
|
+
font-weight: var(--base-text-weight-normal, 400);
|
187
|
+
background: var(--color-action-list-item-default-selected-bg);
|
188
|
+
|
189
|
+
@media (hover: hover) {
|
190
|
+
&:hover {
|
191
|
+
background-color: var(--color-action-list-item-default-hover-bg);
|
192
|
+
}
|
193
|
+
}
|
194
|
+
|
195
|
+
&::before,
|
196
|
+
& + .ActionListItem::before {
|
197
|
+
visibility: hidden;
|
198
|
+
}
|
199
|
+
|
200
|
+
/* blue accent line
|
201
|
+
&::after {
|
202
|
+
@include activeIndicatorLine(-$spacer-1);
|
203
|
+
@mixin activeIndicatorLine
|
204
|
+
} */
|
205
|
+
}
|
206
|
+
|
207
|
+
/* active state [aria-current] */
|
208
|
+
|
209
|
+
&.ActionListItem--navActive {
|
210
|
+
&:not(.ActionListItem--subItem) {
|
211
|
+
.ActionListItem-label {
|
212
|
+
font-weight: var(--base-text-weight-semibold, 600);
|
213
|
+
}
|
214
|
+
}
|
215
|
+
|
216
|
+
&:not(.ActionListItem--danger) {
|
217
|
+
background: var(--color-action-list-item-default-selected-bg);
|
218
|
+
|
219
|
+
@media (hover: hover) {
|
220
|
+
&:hover {
|
221
|
+
background-color: var(--color-action-list-item-default-hover-bg);
|
222
|
+
}
|
223
|
+
}
|
224
|
+
|
225
|
+
&::before,
|
226
|
+
& + .ActionListItem::before {
|
227
|
+
visibility: hidden;
|
228
|
+
}
|
229
|
+
|
230
|
+
/* blue accent line */
|
231
|
+
&::after {
|
232
|
+
@mixin activeIndicatorLine;
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
/* disabled */
|
238
|
+
|
239
|
+
&[aria-disabled='true'] {
|
240
|
+
& .ActionListContent {
|
241
|
+
& .ActionListItem-label,
|
242
|
+
& .ActionListItem-description {
|
243
|
+
color: var(--color-primer-fg-disabled);
|
244
|
+
}
|
245
|
+
|
246
|
+
& .ActionListItem-visual {
|
247
|
+
fill: var(--color-primer-fg-disabled);
|
248
|
+
}
|
249
|
+
}
|
250
|
+
|
251
|
+
@media (hover: hover) {
|
252
|
+
&:hover {
|
253
|
+
cursor: not-allowed;
|
254
|
+
background-color: transparent;
|
255
|
+
}
|
256
|
+
}
|
257
|
+
}
|
258
|
+
|
259
|
+
/* variants */
|
260
|
+
|
261
|
+
/* danger */
|
262
|
+
&.ActionListItem--danger {
|
263
|
+
& .ActionListItem-label {
|
264
|
+
color: var(--color-danger-fg);
|
265
|
+
}
|
266
|
+
|
267
|
+
& .ActionListItem-visual {
|
268
|
+
color: var(--color-danger-fg);
|
269
|
+
}
|
270
|
+
|
271
|
+
@media (hover: hover) {
|
272
|
+
&:hover {
|
273
|
+
background: var(--color-action-list-item-danger-hover-bg);
|
274
|
+
|
275
|
+
& .ActionListItem-label {
|
276
|
+
color: var(--color-action-list-item-danger-hover-text);
|
277
|
+
}
|
278
|
+
}
|
279
|
+
}
|
280
|
+
|
281
|
+
& .ActionListContent {
|
282
|
+
&:active {
|
283
|
+
background: var(--color-action-list-item-danger-active-bg);
|
284
|
+
}
|
285
|
+
}
|
286
|
+
}
|
287
|
+
}
|
288
|
+
|
289
|
+
/* button or a href */
|
290
|
+
.ActionListContent {
|
291
|
+
position: relative;
|
292
|
+
display: grid;
|
293
|
+
width: 100%;
|
294
|
+
padding-block: var(--primer-actionListContent-paddingBlock);
|
295
|
+
padding-inline: var(--primer-control-medium-paddingInline-condensed, 8px);
|
296
|
+
color: var(--color-fg-default);
|
297
|
+
text-align: left;
|
298
|
+
user-select: none;
|
299
|
+
background-color: transparent;
|
300
|
+
border: none;
|
301
|
+
border-radius: var(--primer-borderRadius-medium, 6px);
|
302
|
+
transition: background 33.333ms linear;
|
303
|
+
touch-action: manipulation;
|
304
|
+
-webkit-tap-highlight-color: transparent;
|
305
|
+
grid-template-rows: min-content;
|
306
|
+
grid-template-areas: 'leadingAction leadingVisual label trailingVisual trailingAction';
|
307
|
+
grid-template-columns: min-content min-content minmax(0, auto) min-content min-content;
|
308
|
+
align-items: start;
|
309
|
+
|
310
|
+
/* column-gap persists with empty grid-areas, margin applies only when children exist */
|
311
|
+
& > :not(:last-child) {
|
312
|
+
margin-right: var(--primer-control-medium-gap, 8px);
|
313
|
+
}
|
314
|
+
|
315
|
+
/* state */
|
316
|
+
|
317
|
+
&:hover {
|
318
|
+
text-decoration: none;
|
319
|
+
}
|
320
|
+
|
321
|
+
/* disabled */
|
322
|
+
&[aria-disabled='true'] {
|
323
|
+
& .ActionListItem-label,
|
324
|
+
& .ActionListItem-description {
|
325
|
+
color: var(--color-primer-fg-disabled);
|
326
|
+
}
|
327
|
+
|
328
|
+
& .ActionListItem-visual {
|
329
|
+
fill: var(--color-primer-fg-disabled);
|
330
|
+
}
|
331
|
+
|
332
|
+
@media (hover: hover) {
|
333
|
+
&:hover {
|
334
|
+
cursor: not-allowed;
|
335
|
+
background-color: transparent;
|
336
|
+
}
|
337
|
+
}
|
338
|
+
}
|
339
|
+
|
340
|
+
/* collapsible item [aria-expanded] */
|
341
|
+
|
342
|
+
/* nesting (single level)
|
343
|
+
target items inside expanded subgroups */
|
344
|
+
&[aria-expanded] {
|
345
|
+
& + .ActionList--subGroup {
|
346
|
+
@media screen and (prefers-reduced-motion: no-preference) {
|
347
|
+
transition: opacity 160ms cubic-bezier(0.25, 1, 0.5, 1), transform 160ms cubic-bezier(0.25, 1, 0.5, 1);
|
348
|
+
}
|
349
|
+
|
350
|
+
& .ActionListContent {
|
351
|
+
padding-left: var(--base-size-24, 24px);
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
/* has 16px leading visual */
|
356
|
+
&.ActionListContent--visual16 + .ActionList--subGroup {
|
357
|
+
& .ActionListContent {
|
358
|
+
padding-left: var(--base-size-32, 32px);
|
359
|
+
}
|
360
|
+
}
|
361
|
+
|
362
|
+
/* has 20px leading visual */
|
363
|
+
&.ActionListContent--visual20 + .ActionList--subGroup {
|
364
|
+
& .ActionListContent {
|
365
|
+
padding-left: var(--base-size-36, 36px);
|
366
|
+
}
|
367
|
+
}
|
368
|
+
|
369
|
+
/* has 24px leading visual */
|
370
|
+
&.ActionListContent--visual24 + .ActionList--subGroup {
|
371
|
+
& .ActionListContent {
|
372
|
+
padding-left: var(--base-size-40, 40px);
|
373
|
+
}
|
374
|
+
}
|
375
|
+
}
|
376
|
+
|
377
|
+
&[aria-expanded='true'] {
|
378
|
+
& .ActionListItem-collapseIcon {
|
379
|
+
transition: transform 120ms linear;
|
380
|
+
transform: scaleY(-1);
|
381
|
+
}
|
382
|
+
|
383
|
+
& + .ActionList--subGroup {
|
384
|
+
height: auto;
|
385
|
+
overflow: visible;
|
386
|
+
visibility: visible;
|
387
|
+
opacity: 1;
|
388
|
+
transform: translateY(0);
|
389
|
+
}
|
390
|
+
|
391
|
+
&.ActionListContent--hasActiveSubItem {
|
392
|
+
& > .ActionListItem-label {
|
393
|
+
font-weight: var(--base-text-weight-semibold, 600);
|
394
|
+
}
|
395
|
+
}
|
396
|
+
}
|
397
|
+
|
398
|
+
&[aria-expanded='false'] {
|
399
|
+
& .ActionListItem-collapseIcon {
|
400
|
+
transition: transform 120ms linear;
|
401
|
+
transform: scaleY(1);
|
402
|
+
}
|
403
|
+
|
404
|
+
& + .ActionList--subGroup {
|
405
|
+
height: 0;
|
406
|
+
overflow: hidden;
|
407
|
+
visibility: hidden;
|
408
|
+
opacity: 0;
|
409
|
+
transform: translateY(calc(-1 * var(--base-size-16, 16px)));
|
410
|
+
}
|
411
|
+
|
412
|
+
/* show active indicator on parent collapse if child is active */
|
413
|
+
&.ActionListContent--hasActiveSubItem {
|
414
|
+
background: var(--color-action-list-item-default-selected-bg);
|
415
|
+
|
416
|
+
& .ActionListItem-label {
|
417
|
+
font-weight: var(--base-text-weight-semibold, 600);
|
418
|
+
}
|
419
|
+
|
420
|
+
&::before,
|
421
|
+
+ .ActionListItem::before {
|
422
|
+
visibility: hidden;
|
423
|
+
}
|
424
|
+
|
425
|
+
/* blue accent line */
|
426
|
+
&::after {
|
427
|
+
@mixin activeIndicatorLine;
|
428
|
+
}
|
429
|
+
}
|
430
|
+
}
|
431
|
+
|
432
|
+
/* sizes */
|
433
|
+
|
434
|
+
&.ActionListContent--sizeLarge {
|
435
|
+
--primer-actionListContent-paddingBlock: var(--primer-control-large-paddingBlock, calc((2.5rem - 1.25rem) / 2));
|
436
|
+
}
|
437
|
+
|
438
|
+
&.ActionListContent--sizeXLarge {
|
439
|
+
--primer-actionListContent-paddingBlock: var(--primer-control-xlarge-paddingBlock, calc((3rem - 1.25rem) / 2));
|
440
|
+
}
|
441
|
+
|
442
|
+
/* On pointer:coarse (mobile), all list items are large */
|
443
|
+
@media (pointer: coarse) {
|
444
|
+
--primer-actionListContent-paddingBlock: var(--primer-control-large-paddingBlock, calc((2.5rem - 1.25rem) / 2));
|
445
|
+
}
|
446
|
+
|
447
|
+
&.ActionListContent--blockDescription {
|
448
|
+
/* if leading/trailing visual, align with first line of content */
|
449
|
+
& .ActionListItem-visual {
|
450
|
+
place-self: start;
|
451
|
+
}
|
452
|
+
}
|
453
|
+
}
|
454
|
+
|
455
|
+
/* place children on grid */
|
456
|
+
|
457
|
+
.ActionListItem-action--leading {
|
458
|
+
grid-area: leadingAction;
|
459
|
+
}
|
460
|
+
|
461
|
+
.ActionListItem-visual--leading {
|
462
|
+
grid-area: leadingVisual;
|
463
|
+
}
|
464
|
+
|
465
|
+
.ActionListItem-label {
|
466
|
+
grid-area: label;
|
467
|
+
}
|
468
|
+
|
469
|
+
.ActionListItem-visual--trailing {
|
470
|
+
grid-area: trailingVisual;
|
471
|
+
}
|
472
|
+
|
473
|
+
.ActionListItem-action--trailing {
|
474
|
+
grid-area: trailingAction;
|
475
|
+
}
|
476
|
+
|
477
|
+
/* wrapper span
|
478
|
+
default block */
|
479
|
+
.ActionListItem-descriptionWrap {
|
480
|
+
grid-area: label;
|
481
|
+
display: flex;
|
482
|
+
flex-direction: column;
|
483
|
+
gap: var(--base-size-4, 4px);
|
484
|
+
|
485
|
+
& .ActionListItem-label {
|
486
|
+
font-weight: var(--base-text-weight-semibold, 600);
|
487
|
+
}
|
488
|
+
}
|
489
|
+
|
490
|
+
/* inline */
|
491
|
+
.ActionListItem-descriptionWrap--inline {
|
492
|
+
position: relative;
|
493
|
+
flex-direction: row;
|
494
|
+
align-items: baseline;
|
495
|
+
gap: var(--base-size-8, 8px);
|
496
|
+
}
|
497
|
+
|
498
|
+
/* description */
|
499
|
+
.ActionListItem-description {
|
500
|
+
font-size: var(--primer-text-body-size-small, 12px);
|
501
|
+
font-weight: var(--base-text-weight-normal, 400);
|
502
|
+
line-height: var(--primer-text-body-lineHeight-small, calc(20 / 12));
|
503
|
+
color: var(--color-fg-muted);
|
504
|
+
}
|
505
|
+
|
506
|
+
/* helper for grid alignment with multi-line content
|
507
|
+
span wrapping svg or text */
|
508
|
+
.ActionListItem-visual,
|
509
|
+
.ActionListItem-action {
|
510
|
+
display: flex;
|
511
|
+
min-height: var(--primer-control-medium-lineBoxHeight, 20px);
|
512
|
+
color: var(--color-fg-muted);
|
513
|
+
pointer-events: none;
|
514
|
+
fill: var(--color-fg-muted);
|
515
|
+
align-items: center;
|
516
|
+
}
|
517
|
+
|
518
|
+
/* text */
|
519
|
+
.ActionListItem-label {
|
520
|
+
position: relative;
|
521
|
+
font-size: var(--primer-text-body-size-medium, 14px);
|
522
|
+
font-weight: var(--base-text-weight-normal, 400);
|
523
|
+
line-height: var(--primer-text-body-lineHeight-medium, calc(20 / 14));
|
524
|
+
color: var(--color-fg-default);
|
525
|
+
}
|
526
|
+
|
527
|
+
.ActionListItem-label--truncate {
|
528
|
+
overflow: hidden;
|
529
|
+
text-overflow: ellipsis;
|
530
|
+
white-space: nowrap;
|
531
|
+
}
|
532
|
+
|
533
|
+
/* nested lists (only supports 1 level currently)
|
534
|
+
target ActionListItem--subItem for padding-left to maintain :active :after state */
|
535
|
+
|
536
|
+
.ActionListItem--subItem > .ActionListContent > .ActionListItem-label {
|
537
|
+
font-size: var(--primer-text-body-size-small, 12px);
|
538
|
+
}
|
539
|
+
|
540
|
+
/* trailing action icon button */
|
541
|
+
|
542
|
+
.ActionListItem--withActions {
|
543
|
+
display: flex;
|
544
|
+
flex-wrap: nowrap;
|
545
|
+
align-items: center;
|
546
|
+
}
|
547
|
+
|
548
|
+
.ActionListItem-trailingAction {
|
549
|
+
border-top-left-radius: 0;
|
550
|
+
border-bottom-left-radius: 0;
|
551
|
+
}
|
552
|
+
|
553
|
+
/* show trailing action button on hover */
|
554
|
+
|
555
|
+
.ActionListItem--trailingActionHover {
|
556
|
+
& .ActionListItem-trailingAction {
|
557
|
+
visibility: hidden;
|
558
|
+
}
|
559
|
+
|
560
|
+
&:hover,
|
561
|
+
&:focus-within {
|
562
|
+
& .ActionListItem-trailingAction {
|
563
|
+
visibility: visible;
|
564
|
+
}
|
565
|
+
}
|
566
|
+
}
|
567
|
+
|
568
|
+
/* ActionList::Divider */
|
569
|
+
|
570
|
+
.ActionList-sectionDivider {
|
571
|
+
/* with children */
|
572
|
+
&:not(:empty) {
|
573
|
+
display: flex;
|
574
|
+
padding: ($spacer-1 * 1.5) $spacer-2;
|
575
|
+
padding-inline: var(--primer-actionListContent-paddingBlock);
|
576
|
+
padding-block: var(--base-size-8, 8px);
|
577
|
+
font-size: var(--primer-text-body-size-small, 12px);
|
578
|
+
font-weight: var(--base-text-weight-semibold, 600);
|
579
|
+
color: var(--color-fg-muted);
|
580
|
+
flex-direction: column;
|
581
|
+
}
|
582
|
+
|
583
|
+
/* no children */
|
584
|
+
&:empty {
|
585
|
+
display: block;
|
586
|
+
height: var(--primer-borderWidth-thin, 1px);
|
587
|
+
padding: 0;
|
588
|
+
margin-block-start: calc(var(--base-size-8, 8px) - var(--primer-borderWidth-thin, 1px));
|
589
|
+
margin-block-end: var(--base-size-8, 8px);
|
590
|
+
margin-inline: calc(-1 * var(--base-size-8, 8px));
|
591
|
+
list-style: none;
|
592
|
+
background: var(--color-action-list-item-inline-divider);
|
593
|
+
border: 0;
|
594
|
+
}
|
595
|
+
|
596
|
+
.ActionList-sectionDivider-title {
|
597
|
+
font-size: var(--primer-text-body-size-small, 12px);
|
598
|
+
font-weight: var(--base-text-weight-semibold, 600);
|
599
|
+
color: var(--color-fg-muted);
|
600
|
+
}
|
601
|
+
}
|
602
|
+
|
603
|
+
.ActionList-sectionDivider--filled {
|
604
|
+
margin-block-start: calc(var(--base-size-8, 8px) - var(--primer-borderWidth-thin, 1px));
|
605
|
+
margin-block-end: var(--base-size-8, 8px);
|
606
|
+
margin-inline: calc(-1 * var(--base-size-8, 8px));
|
607
|
+
background: var(--color-canvas-subtle);
|
608
|
+
border-top: solid var(--primer-borderWidth-thin, 1px) var(--color-action-list-item-inline-divider);
|
609
|
+
border-bottom: solid var(--primer-borderWidth-thin, 1px) var(--color-action-list-item-inline-divider);
|
610
|
+
|
611
|
+
/* if no children, treat as divider */
|
612
|
+
&:empty {
|
613
|
+
height: var(--base-size-8, 8px);
|
614
|
+
box-sizing: border-box;
|
615
|
+
}
|
616
|
+
|
617
|
+
&:first-child {
|
618
|
+
margin-block-start: 0;
|
619
|
+
}
|
620
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Alpha
|
5
|
+
class ActionList
|
6
|
+
# Section heading rendered above the section contents.
|
7
|
+
class Divider < Primer::Component
|
8
|
+
DEFAULT_SCHEME = :subtle
|
9
|
+
SCHEME_MAPPINGS = {
|
10
|
+
DEFAULT_SCHEME => nil,
|
11
|
+
:filled => "ActionList-sectionDivider--filled"
|
12
|
+
}.freeze
|
13
|
+
SCHEME_OPTIONS = SCHEME_MAPPINGS.keys.freeze
|
14
|
+
|
15
|
+
# @param scheme [Symbol] Display a background color if scheme is `filled`.
|
16
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
17
|
+
def initialize(scheme: DEFAULT_SCHEME, **system_arguments)
|
18
|
+
@system_arguments = system_arguments
|
19
|
+
@system_arguments[:tag] = :li
|
20
|
+
@system_arguments[:role] = :separator
|
21
|
+
@system_arguments[:'aria-hidden'] = true
|
22
|
+
@scheme = fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)
|
23
|
+
@system_arguments[:classes] = class_names(
|
24
|
+
"ActionList-sectionDivider",
|
25
|
+
SCHEME_MAPPINGS[@scheme]
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def call
|
30
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { "" }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= render(Primer::BaseComponent.new(**@system_arguments)) do %>
|
2
|
+
<%= render(Primer::BaseComponent.new(tag: @tag, classes: "ActionList-sectionDivider-title", id: @list_id)) do %>
|
3
|
+
<%= @title %>
|
4
|
+
<% end %>
|
5
|
+
<%= render Primer::ConditionalWrapper.new(condition: @subtitle.present?, tag: :span, classes: "ActionListItem-description") do %>
|
6
|
+
<%= @subtitle %>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Alpha
|
5
|
+
class ActionList
|
6
|
+
# Heading used to describe each sub list within an action list.
|
7
|
+
class Heading < Primer::Component
|
8
|
+
DEFAULT_SCHEME = :subtle
|
9
|
+
SCHEME_MAPPINGS = {
|
10
|
+
DEFAULT_SCHEME => nil,
|
11
|
+
:filled => "ActionList-sectionDivider--filled"
|
12
|
+
}.freeze
|
13
|
+
SCHEME_OPTIONS = SCHEME_MAPPINGS.keys.freeze
|
14
|
+
|
15
|
+
# @param list_id [String] The unique identifier of the sub list the heading belongs to. Used internally.
|
16
|
+
# @param title [String] Sub list title.
|
17
|
+
# @param subtitle [String] Optional sub list description.
|
18
|
+
# @param scheme [Symbol] Display a background color if scheme is `filled`.
|
19
|
+
# @param tag [Symbol] Semantic tag for the heading.
|
20
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
21
|
+
def initialize(list_id:, title:, tag: :h3, scheme: DEFAULT_SCHEME, subtitle: nil, **system_arguments)
|
22
|
+
@tag = tag
|
23
|
+
@system_arguments = system_arguments
|
24
|
+
@list_id = list_id
|
25
|
+
@title = title
|
26
|
+
@subtitle = subtitle
|
27
|
+
@scheme = fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)
|
28
|
+
@system_arguments[:tag] = :li
|
29
|
+
@system_arguments[:classes] = class_names(
|
30
|
+
"ActionList-sectionDivider",
|
31
|
+
SCHEME_MAPPINGS[@scheme],
|
32
|
+
@system_arguments[:classes]
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|