@primer/css 20.0.0-rc.49a40ab2 → 20.0.0-rc.58040b8c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/CHANGELOG.md +163 -2
  2. package/CONTRIBUTING.md +6 -4
  3. package/DEVELOP.md +26 -21
  4. package/README.md +2 -2
  5. package/actionlist/action-list-item-divider.scss +8 -2
  6. package/actionlist/action-list-item.scss +205 -124
  7. package/actionlist/action-list-tree.scss +118 -0
  8. package/actionlist/action-list.scss +29 -0
  9. package/actionlist/index.scss +1 -0
  10. package/alerts/flash.scss +6 -2
  11. package/autocomplete/autocomplete.scss +55 -2
  12. package/avatars/avatar-stack.scss +1 -0
  13. package/base/base.scss +1 -0
  14. package/base/index.scss +0 -1
  15. package/base/kbd.scss +0 -1
  16. package/base/normalize.scss +1 -1
  17. package/base/typography-base.scss +3 -2
  18. package/blankslate/blankslate.scss +20 -1
  19. package/blankslate/index.scss +0 -1
  20. package/box/box.scss +0 -3
  21. package/branch-name/branch-name.scss +1 -0
  22. package/breadcrumb/breadcrumb.scss +1 -1
  23. package/buttons/button-group.scss +3 -2
  24. package/buttons/button.scss +10 -9
  25. package/buttons/misc.scss +5 -6
  26. package/color-modes/index.scss +2 -0
  27. package/color-modes/native.scss +12 -0
  28. package/color-modes/themes/dark.scss +0 -1
  29. package/color-modes/themes/dark_colorblind.scss +0 -1
  30. package/color-modes/themes/dark_dimmed.scss +0 -1
  31. package/color-modes/themes/dark_high_contrast.scss +0 -1
  32. package/color-modes/themes/dark_tritanopia.scss +6 -0
  33. package/color-modes/themes/light.scss +0 -1
  34. package/color-modes/themes/light_colorblind.scss +0 -1
  35. package/color-modes/themes/light_high_contrast.scss +0 -1
  36. package/color-modes/themes/light_tritanopia.scss +6 -0
  37. package/dist/actionlist.css +1 -1
  38. package/dist/actionlist.css.map +1 -1
  39. package/dist/alerts.css +1 -1
  40. package/dist/alerts.css.map +1 -1
  41. package/dist/autocomplete.css +1 -1
  42. package/dist/autocomplete.css.map +1 -1
  43. package/dist/avatars.css +1 -1
  44. package/dist/avatars.css.map +1 -1
  45. package/dist/base.css +1 -1
  46. package/dist/base.css.map +1 -1
  47. package/dist/blankslate.css +1 -1
  48. package/dist/blankslate.css.map +1 -1
  49. package/dist/box.css.map +1 -1
  50. package/dist/branch-name.css +1 -1
  51. package/dist/branch-name.css.map +1 -1
  52. package/dist/breadcrumb.css.map +1 -1
  53. package/dist/buttons.css +1 -1
  54. package/dist/buttons.css.map +1 -1
  55. package/dist/color-modes.css +1 -1
  56. package/dist/color-modes.css.map +1 -1
  57. package/dist/core.css +1 -1
  58. package/dist/core.css.map +1 -1
  59. package/dist/dropdown.css.map +1 -1
  60. package/dist/forms.css +1 -1
  61. package/dist/forms.css.map +1 -1
  62. package/dist/header.css.map +1 -1
  63. package/dist/labels.css +1 -1
  64. package/dist/labels.css.map +1 -1
  65. package/dist/layout.css +1 -1
  66. package/dist/layout.css.map +1 -1
  67. package/dist/links.css +1 -1
  68. package/dist/links.css.map +1 -1
  69. package/dist/loaders.css.map +1 -1
  70. package/dist/markdown.css +1 -1
  71. package/dist/markdown.css.map +1 -1
  72. package/dist/marketing-buttons.css +1 -1
  73. package/dist/marketing-buttons.css.map +1 -1
  74. package/dist/marketing-links.css.map +1 -1
  75. package/dist/marketing-type.css.map +1 -1
  76. package/dist/marketing-utilities.css.map +1 -1
  77. package/dist/marketing.css +1 -1
  78. package/dist/marketing.css.map +1 -1
  79. package/dist/meta.json +75 -75
  80. package/dist/navigation.css +1 -1
  81. package/dist/navigation.css.map +1 -1
  82. package/dist/pagination.css +1 -1
  83. package/dist/pagination.css.map +1 -1
  84. package/dist/popover.css +1 -1
  85. package/dist/popover.css.map +1 -1
  86. package/dist/primer.css +4 -4
  87. package/dist/primer.css.map +1 -1
  88. package/dist/product.css +1 -1
  89. package/dist/product.css.map +1 -1
  90. package/dist/progress.css.map +1 -1
  91. package/dist/select-menu.css.map +1 -1
  92. package/dist/stats/actionlist.json +1 -1
  93. package/dist/stats/alerts.json +1 -1
  94. package/dist/stats/autocomplete.json +1 -1
  95. package/dist/stats/avatars.json +1 -1
  96. package/dist/stats/base.json +1 -1
  97. package/dist/stats/blankslate.json +1 -1
  98. package/dist/stats/branch-name.json +1 -1
  99. package/dist/stats/buttons.json +1 -1
  100. package/dist/stats/color-modes.json +1 -1
  101. package/dist/stats/core.json +1 -1
  102. package/dist/stats/forms.json +1 -1
  103. package/dist/stats/labels.json +1 -1
  104. package/dist/stats/layout.json +1 -1
  105. package/dist/stats/links.json +1 -1
  106. package/dist/stats/markdown.json +1 -1
  107. package/dist/stats/marketing-buttons.json +1 -1
  108. package/dist/stats/marketing.json +1 -1
  109. package/dist/stats/navigation.json +1 -1
  110. package/dist/stats/pagination.json +1 -1
  111. package/dist/stats/popover.json +1 -1
  112. package/dist/stats/primer.json +1 -1
  113. package/dist/stats/product.json +1 -1
  114. package/dist/stats/subhead.json +1 -1
  115. package/dist/stats/tooltips.json +1 -1
  116. package/dist/stats/utilities.json +1 -1
  117. package/dist/subhead.css +1 -1
  118. package/dist/subhead.css.map +1 -1
  119. package/dist/table-object.css.map +1 -1
  120. package/dist/timeline.css.map +1 -1
  121. package/dist/toasts.css.map +1 -1
  122. package/dist/tooltips.css +1 -1
  123. package/dist/tooltips.css.map +1 -1
  124. package/dist/truncate.css.map +1 -1
  125. package/dist/utilities.css +1 -1
  126. package/dist/utilities.css.map +1 -1
  127. package/dist/variables.json +7 -7
  128. package/forms/form-control.scss +3 -0
  129. package/forms/form-group.scss +9 -0
  130. package/forms/form-validation.scss +1 -1
  131. package/forms/input-group.scss +10 -0
  132. package/labels/counters.scss +1 -1
  133. package/labels/index.scss +0 -1
  134. package/labels/labels.scss +12 -1
  135. package/labels/mixins.scss +7 -2
  136. package/labels/states.scss +2 -2
  137. package/layout/grid-offset.scss +1 -0
  138. package/layout/grid.scss +1 -0
  139. package/layout/index.scss +1 -1
  140. package/layout/layout.scss +8 -11
  141. package/layout/mixins.scss +30 -4
  142. package/layout/page-layout.scss +384 -0
  143. package/links/link.scss +1 -1
  144. package/markdown/code.scss +5 -0
  145. package/markdown/footnotes.scss +38 -26
  146. package/markdown/headings.scss +17 -0
  147. package/markdown/images.scss +3 -3
  148. package/markdown/markdown-body.scss +0 -8
  149. package/marketing/type/typography.scss +3 -0
  150. package/marketing/utilities/layout.scss +1 -0
  151. package/navigation/filter-list.scss +2 -2
  152. package/navigation/menu.scss +2 -2
  153. package/navigation/sidenav.scss +2 -2
  154. package/navigation/subnav.scss +2 -2
  155. package/navigation/tabnav.scss +2 -2
  156. package/navigation/underline-nav.scss +76 -31
  157. package/package.json +31 -24
  158. package/pagination/pagination.scss +41 -4
  159. package/popover/popover.scss +1 -2
  160. package/select-menu/select-menu.scss +3 -3
  161. package/stylelint.config.cjs +2 -11
  162. package/subhead/subhead.scss +3 -0
  163. package/support/mixins/color-modes.scss +3 -0
  164. package/support/mixins/misc.scss +25 -0
  165. package/support/mixins/typography.scss +3 -2
  166. package/support/variables/layout.scss +2 -3
  167. package/table-object/table-object.scss +3 -0
  168. package/timeline/timeline-item.scss +0 -1
  169. package/tooltips/tooltips.scss +0 -7
  170. package/utilities/colors.scss +16 -0
  171. package/utilities/layout.scss +1 -1
  172. package/utilities/margin.scss +4 -1
  173. package/utilities/padding.scss +3 -1
  174. package/utilities/visibility-display.scss +52 -3
  175. package/table-object/README.md +0 -25
@@ -1,3 +1,5 @@
1
+ // stylelint-disable max-nesting-depth, selector-max-specificity, selector-max-compound-selectors
2
+
1
3
  @mixin focusOutline {
2
4
  position: relative;
3
5
  z-index: 1;
@@ -26,48 +28,72 @@
26
28
  &:hover,
27
29
  &:active {
28
30
  cursor: pointer;
29
-
30
- // a href
31
- .ActionList-content {
32
- text-decoration: none;
33
- }
34
31
  }
35
32
 
36
33
  // only hover li without list as children
37
- &:not(.ActionList-item--hasSubItem) {
38
- &:hover {
39
- cursor: pointer;
40
- background-color: var(--color-action-list-item-default-hover-bg);
34
+ &:not(.ActionList-item--hasSubItem),
35
+ // target contents of first child li if sub-item (li wraps item label + nested ul)
36
+ &.ActionList-item--hasSubItem > .ActionList-content {
37
+ @media (hover: hover) {
38
+ &:hover {
39
+ cursor: pointer;
40
+ background-color: var(--color-action-list-item-default-hover-bg);
41
+
42
+ &:not(.ActionList-item--navActive) {
43
+ // Support for "Windows high contrast mode"
44
+ outline: $border-style $border-width transparent;
45
+ outline-offset: -$border-width;
46
+ // stylelint-disable-next-line primer/box-shadow
47
+ box-shadow: inset 0 0 0 2px var(--color-action-list-item-default-active-border);
48
+ }
49
+ }
41
50
  }
42
51
 
43
52
  &:active {
44
53
  background: var(--color-action-list-item-default-active-bg);
45
54
 
55
+ &:not(.ActionList-item--navActive) {
56
+ // Support for "Windows high contrast mode" https://sarahmhigley.com/writing/whcm-quick-tips/
57
+ outline: $border-style $border-width transparent;
58
+ outline-offset: -$border-width;
59
+ // stylelint-disable-next-line primer/box-shadow
60
+ box-shadow: inset 0 0 0 2px var(--color-action-list-item-default-active-border);
61
+ }
62
+
46
63
  @media screen and (prefers-reduced-motion: no-preference) {
47
64
  animation: ActionList-item-active-bg 4s forwards cubic-bezier(0.33, 1, 0.68, 1);
48
65
  }
49
66
 
50
- // stylelint-disable primer/box-shadow
51
67
  @keyframes ActionList-item-active-bg {
52
- // stylelint-disable-next-line max-nesting-depth
53
68
  50% {
54
- box-shadow: inset 0 0 0 rgba(#000, 0.04);
69
+ // stylelint-disable-next-line primer/box-shadow
70
+ box-shadow: inset 0 2px 12px 6px rgba(var(--color-canvas-default), 0.4);
55
71
  transform: scale(1);
56
72
  }
57
73
 
58
- // stylelint-disable-next-line max-nesting-depth
59
74
  100% {
60
- box-shadow: inset 0 3px 9px rgba(#000, 0.04);
61
75
  transform: scale(0.97);
62
76
  }
63
77
  }
64
- // stylelint-enable primer/box-shadow
65
78
  }
66
79
 
67
- &:hover,
80
+ // hide dividers
81
+
82
+ @media (hover: hover) {
83
+ &:hover {
84
+ .ActionList-item-label::before,
85
+ + .ActionList-item .ActionList-item-label::before {
86
+ visibility: hidden;
87
+ }
88
+
89
+ .ActionList-item-descriptionWrap--inline::before,
90
+ + .ActionList-item .ActionList-item-descriptionWrap--inline::before {
91
+ visibility: hidden;
92
+ }
93
+ }
94
+ }
95
+ // stylelint-disable-next-line no-duplicate-selectors
68
96
  &:active {
69
- // hide dividers
70
- // stylelint-disable-next-line selector-max-specificity
71
97
  .ActionList-item-label::before,
72
98
  + .ActionList-item .ActionList-item-label::before {
73
99
  visibility: hidden;
@@ -80,8 +106,16 @@
80
106
  &.ActionList-item--hasSubItem {
81
107
  // first child
82
108
  > .ActionList-content {
83
- &:hover {
84
- background-color: var(--color-action-list-item-default-hover-bg);
109
+ z-index: 1;
110
+
111
+ @media (hover: hover) {
112
+ &:hover {
113
+ background-color: var(--color-action-list-item-default-hover-bg);
114
+ }
115
+ }
116
+
117
+ &:active {
118
+ background-color: var(--color-action-list-item-default-active-bg);
85
119
  }
86
120
  }
87
121
  }
@@ -98,58 +132,12 @@
98
132
  &:not(.ActionList-item--danger) {
99
133
  background: var(--color-action-list-item-default-selected-bg);
100
134
 
101
- // stylelint-disable-next-line selector-max-specificity
102
- &::before,
103
- + .ActionList-item::before {
104
- visibility: hidden;
105
- }
106
-
107
- // blue accent line
108
- &::after {
109
- @include activeIndicatorLine;
110
- }
111
- }
112
- }
113
-
114
- // collapsible item [aria-expanded]
115
-
116
- &[aria-expanded='true'] {
117
- .ActionList-item-collapseIcon {
118
- transition: transform 120ms linear;
119
- transform: scaleY(-1);
120
- }
121
-
122
- .ActionList--subGroup {
123
- display: block;
124
- }
125
-
126
- &.ActionList-item--hasActiveSubItem {
127
- // stylelint-disable-next-line selector-max-specificity
128
- > .ActionList-content > .ActionList-item-label {
129
- font-weight: $font-weight-bold;
130
- }
131
- }
132
- }
133
-
134
- &[aria-expanded='false'] {
135
- .ActionList-item-collapseIcon {
136
- transition: transform 120ms linear;
137
- transform: scaleY(1);
138
- }
139
-
140
- .ActionList--subGroup {
141
- display: none;
142
- }
143
-
144
- // show active indicator on parent collapse if child is active
145
- &.ActionList-item--hasActiveSubItem {
146
- background: var(--color-action-list-item-default-selected-bg);
147
-
148
- .ActionList-item-label {
149
- font-weight: $font-weight-bold;
135
+ @media (hover: hover) {
136
+ &:hover {
137
+ background-color: var(--color-action-list-item-default-hover-bg);
138
+ }
150
139
  }
151
140
 
152
- // stylelint-disable-next-line selector-max-specificity
153
141
  &::before,
154
142
  + .ActionList-item::before {
155
143
  visibility: hidden;
@@ -204,7 +192,7 @@
204
192
  visibility: hidden;
205
193
  opacity: 0;
206
194
  transition:
207
- visibility 0 linear $actionList-item-checkmark-transition-timing,
195
+ visibility 0 linear $actionList-item-checkmark-transition-timing,
208
196
  opacity $actionList-item-checkmark-transition-timing;
209
197
  }
210
198
 
@@ -266,37 +254,19 @@
266
254
  color: var(--color-danger-fg);
267
255
  }
268
256
 
269
- @media (hover: hover) and (pointer: fine) {
257
+ @media (hover: hover) {
270
258
  &:hover {
271
259
  background: var(--color-action-list-item-danger-hover-bg);
272
260
 
273
- // stylelint-disable-next-line max-nesting-depth
274
261
  .ActionList-item-label {
275
262
  color: var(--color-action-list-item-danger-hover-text);
276
263
  }
277
264
  }
278
265
  }
279
266
 
280
- &:active {
281
- background: var(--color-action-list-item-danger-active-bg);
282
- }
283
- }
284
-
285
- // disabled
286
- &[aria-disabled='true'] {
287
- .ActionList-item-label,
288
- .ActionList-item-description {
289
- color: var(--color-primer-fg-disabled);
290
- }
291
-
292
- .ActionList-item-visual {
293
- fill: var(--color-primer-fg-disabled);
294
- }
295
-
296
- @media (hover: hover) and (pointer: fine) {
297
- &:hover {
298
- cursor: not-allowed;
299
- background-color: transparent;
267
+ .ActionList-content {
268
+ &:active {
269
+ background: var(--color-action-list-item-danger-active-bg);
300
270
  }
301
271
  }
302
272
  }
@@ -308,31 +278,157 @@
308
278
  }
309
279
  }
310
280
 
311
- // span or a href
281
+ // button or a href
312
282
  .ActionList-content {
313
283
  position: relative;
314
284
  display: grid;
285
+ width: 100%;
315
286
  // stylelint-disable-next-line primer/spacing
316
287
  padding: $actionList-item-padding-vertical $actionList-item-padding-horizontal;
288
+ font-size: $body-font-size;
317
289
  font-weight: $font-weight-normal;
318
290
  color: var(--color-fg-default);
291
+ text-align: left;
319
292
  user-select: none;
293
+ background-color: transparent;
294
+ // stylelint-disable-next-line declaration-property-value-disallowed-list
295
+ border: none;
320
296
  border-radius: $border-radius;
321
297
  transition: $actionList-item-bg-transition;
298
+ touch-action: manipulation;
299
+ touch-action: manipulation;
300
+ -webkit-tap-highlight-color: transparent;
322
301
  grid-template-rows: min-content;
323
302
  grid-template-areas: 'leadingAction leadingVisual label trailingVisual trailingAction';
324
- grid-template-columns: min-content min-content minmax(min-content, auto) min-content min-content;
325
- align-items: center;
303
+ grid-template-columns: min-content min-content minmax(0, auto) min-content min-content;
304
+ align-items: start;
326
305
 
327
306
  // column-gap persists with empty grid-areas, margin applies only when children exist
328
307
  > :not(:last-child) {
329
308
  margin-right: $spacer-2;
330
309
  }
331
310
 
311
+ // state
312
+
313
+ &:hover {
314
+ text-decoration: none;
315
+ }
316
+
332
317
  &:focus-visible {
333
318
  @include focusOutline;
334
319
  }
335
320
 
321
+ // disabled
322
+ &[aria-disabled='true'] {
323
+ .ActionList-item-label,
324
+ .ActionList-item-description {
325
+ color: var(--color-primer-fg-disabled);
326
+ }
327
+
328
+ .ActionList-item-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
+ .ActionList-content {
351
+ padding-left: $spacer-4;
352
+ }
353
+ }
354
+
355
+ // has 16px leading visual
356
+ &.ActionList-content--visual16 + .ActionList--subGroup {
357
+ .ActionList-content {
358
+ padding-left: $spacer-5;
359
+ }
360
+ }
361
+
362
+ // has 20px leading visual
363
+ &.ActionList-content--visual20 + .ActionList--subGroup {
364
+ .ActionList-content {
365
+ padding-left: $spacer-2 * 4.5; // 36px
366
+ }
367
+ }
368
+
369
+ // has 24px leading visual
370
+ &.ActionList-content--visual24 + .ActionList--subGroup {
371
+ .ActionList-content {
372
+ padding-left: $spacer-6;
373
+ }
374
+ }
375
+ }
376
+
377
+ &[aria-expanded='true'] {
378
+ .ActionList-item-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
+ &.ActionList-content--hasActiveSubItem {
392
+ > .ActionList-item-label {
393
+ font-weight: $font-weight-bold;
394
+ }
395
+ }
396
+ }
397
+
398
+ &[aria-expanded='false'] {
399
+ .ActionList-item-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(-$spacer-3);
410
+ }
411
+
412
+ // show active indicator on parent collapse if child is active
413
+ &.ActionList-content--hasActiveSubItem {
414
+ background: var(--color-action-list-item-default-selected-bg);
415
+
416
+ .ActionList-item-label {
417
+ font-weight: $font-weight-bold;
418
+ }
419
+
420
+ &::before,
421
+ + .ActionList-item::before {
422
+ visibility: hidden;
423
+ }
424
+
425
+ // blue accent line
426
+ &::after {
427
+ @include activeIndicatorLine;
428
+ }
429
+ }
430
+ }
431
+
336
432
  // sizes
337
433
 
338
434
  &.ActionList-content--sizeMedium {
@@ -347,6 +443,10 @@
347
443
  padding: $actionList-item-padding-vertical-lg $actionList-item-padding-horizontal;
348
444
  }
349
445
 
446
+ &.ActionList-content--fontSmall {
447
+ font-size: $font-size-small;
448
+ }
449
+
350
450
  // On pointer:coarse (mobile), all list items are large
351
451
  @media (pointer: coarse) {
352
452
  // stylelint-disable-next-line primer/spacing
@@ -401,6 +501,7 @@
401
501
 
402
502
  // inline
403
503
  .ActionList-item-descriptionWrap--inline {
504
+ position: relative;
404
505
  flex-direction: row;
405
506
  align-items: baseline;
406
507
 
@@ -425,6 +526,7 @@
425
526
  display: flex;
426
527
  min-height: $actionList-item-height-sm;
427
528
  color: var(--color-fg-muted); // if visual is text
529
+ pointer-events: none;
428
530
  fill: var(--color-fg-muted);
429
531
  align-items: center;
430
532
  }
@@ -440,37 +542,16 @@
440
542
  color: var(--color-fg-default);
441
543
  }
442
544
 
545
+ .ActionList-item-label--truncate {
546
+ overflow: hidden;
547
+ text-overflow: ellipsis;
548
+ white-space: nowrap;
549
+ }
550
+
443
551
  // nested lists (only supports 1 level currently)
444
552
  // target ActionList-item--subItem for padding-left to maintain :active :after state
445
553
 
554
+ // TODO: remove with PVC implementation
446
555
  .ActionList-item--subItem > .ActionList-content {
447
556
  font-size: $font-size-small;
448
557
  }
449
-
450
- // no leading visual
451
- .ActionList--subGroup {
452
- .ActionList-item--subItem {
453
- padding-left: $spacer-3;
454
- }
455
- }
456
-
457
- // has 16px leading visual
458
- .ActionList-content--visual16 + .ActionList--subGroup {
459
- .ActionList-item--subItem {
460
- padding-left: $spacer-4;
461
- }
462
- }
463
-
464
- // has 20px leading visual
465
- .ActionList-content--visual20 + .ActionList--subGroup {
466
- .ActionList-item--subItem {
467
- padding-left: $spacer-3 * 1.75;
468
- }
469
- }
470
-
471
- // has 24px leading visual
472
- .ActionList-content--visual24 + .ActionList--subGroup {
473
- .ActionList-item--subItem {
474
- padding-left: $spacer-5;
475
- }
476
- }
@@ -0,0 +1,118 @@
1
+ // stylelint-disable max-nesting-depth, selector-max-compound-selectors, selector-max-specificity, selector-max-type, primer/spacing
2
+ // tree-view variant
3
+ // renders ActionList with default styling for tree-view
4
+ // collapse/expand icons presents as leadingActions, rotate 90deg
5
+ // connecting vertical lines between collapse groups
6
+ // consistent font-size between nested groups
7
+
8
+ @mixin treeConnectingLine($left) {
9
+ position: absolute;
10
+ left: $left;
11
+ width: 1px;
12
+ height: 100%;
13
+ content: '';
14
+ background: var(--color-action-list-item-inline-divider);
15
+ }
16
+
17
+ .ActionList--tree {
18
+ --ActionList-tree-depth: 1;
19
+ // TODO: remove with PVC implementation
20
+ .ActionList-item--subItem > .ActionList-content {
21
+ font-size: $body-font-size;
22
+ }
23
+
24
+ .ActionList-item {
25
+ // class for single tree items not within a group
26
+ &.ActionList-item--singleton {
27
+ .ActionList-content {
28
+ padding-left: $spacer-5;
29
+ }
30
+ }
31
+
32
+ // normal font-weight for any active item
33
+ &.ActionList-item--navActive {
34
+ &:not(.ActionList-item--subItem) {
35
+ .ActionList-item-label {
36
+ font-weight: $font-weight-normal;
37
+ }
38
+ }
39
+ }
40
+ }
41
+
42
+ .ActionList-content {
43
+ // nesting (infinite levels)
44
+ // target items inside expanded subgroup
45
+ &[aria-expanded] {
46
+ + .ActionList--subGroup {
47
+ position: relative;
48
+
49
+ // --ActionList-tree-depth is defined as an inline style referencing the aria-level of each item ie: aria-level="2"
50
+ .ActionList-content {
51
+ padding-left: calc(#{$spacer-2} * var(--ActionList-tree-depth));
52
+ }
53
+ }
54
+ }
55
+
56
+ // tree-view specific collapse icon positioning/animation
57
+ &[aria-expanded='true'] {
58
+ .ActionList-item-collapseIcon {
59
+ transition: transform 120ms linear;
60
+ transform: rotate(0deg);
61
+ }
62
+
63
+ // normal weight for parent folder containing active child
64
+ &.ActionList-content--hasActiveSubItem {
65
+ > .ActionList-item-label {
66
+ font-weight: $font-weight-normal;
67
+ }
68
+ }
69
+ }
70
+
71
+ &[aria-expanded='false'] {
72
+ .ActionList-item-collapseIcon {
73
+ transition: transform 120ms linear;
74
+ transform: rotate(-90deg);
75
+ }
76
+
77
+ &.ActionList-content--hasActiveSubItem {
78
+ > .ActionList-item-label {
79
+ font-weight: $font-weight-normal;
80
+ }
81
+ }
82
+ }
83
+ }
84
+
85
+ // expand/collapse group
86
+ .ActionList-item--hasSubItem {
87
+ .ActionList-item--subItem:not(.ActionList-item--hasSubItem) {
88
+ .ActionList-content {
89
+ // increase child padding by targeting content first child span (add to ActionList-content padding, not replace)
90
+ // creates a slight indent of child items
91
+ > span:first-child {
92
+ padding-left: $spacer-4;
93
+ }
94
+ }
95
+ }
96
+ }
97
+
98
+ // first subitem
99
+ > [aria-level='1'].ActionList-item--hasSubItem {
100
+ > .ActionList--subGroup {
101
+ &::before {
102
+ @include treeConnectingLine($left: $spacer-3);
103
+ }
104
+ }
105
+ }
106
+
107
+ // all other subitems
108
+ // center connecting line with parent (line is 1px (8px - 1px)
109
+ .ActionList-item--hasSubItem:not([aria-level='1']) {
110
+ > .ActionList--subGroup {
111
+ &::before {
112
+ @include treeConnectingLine(
113
+ $left: calc(#{$spacer-2} * (var(--ActionList-tree-depth)) + #{$spacer-2 - $border-width})
114
+ );
115
+ }
116
+ }
117
+ }
118
+ }
@@ -8,6 +8,11 @@
8
8
  padding: 0;
9
9
  }
10
10
 
11
+ // nested list within main ActionList
12
+ .ActionList--subGroup {
13
+ padding: 0;
14
+ }
15
+
11
16
  // dividers
12
17
 
13
18
  .ActionList--divided {
@@ -21,6 +26,24 @@
21
26
  background: var(--color-action-list-item-inline-divider);
22
27
  }
23
28
 
29
+ // if descriptionWrap--inline exists, move pseudo divider to wrapper
30
+ .ActionList-item-descriptionWrap--inline {
31
+ &::before {
32
+ position: absolute;
33
+ top: -$actionList-item-padding-vertical;
34
+ display: block;
35
+ width: 100%;
36
+ height: $border-width;
37
+ content: '';
38
+ background: var(--color-action-list-item-inline-divider);
39
+ }
40
+
41
+ // unset the default label pseudo
42
+ .ActionList-item-label::before {
43
+ content: unset;
44
+ }
45
+ }
46
+
24
47
  // hide divider if item is active
25
48
  .ActionList-item--navActive {
26
49
  // stylelint-disable-next-line selector-max-specificity, selector-max-compound-selectors
@@ -36,3 +59,9 @@
36
59
  .ActionList-sectionDivider + .ActionList-item .ActionList-item-label::before {
37
60
  visibility: hidden;
38
61
  }
62
+
63
+ // hide if item is first of type with label::before, or is the first item after a sectionDivider
64
+ .ActionList-item:first-of-type .ActionList-item-descriptionWrap--inline::before,
65
+ .ActionList-sectionDivider + .ActionList-item .ActionList-item-descriptionWrap--inline::before {
66
+ visibility: hidden;
67
+ }
@@ -1,5 +1,6 @@
1
1
  @import '../support/index.scss';
2
2
  @import './action-list-variables.scss';
3
3
  @import './action-list.scss';
4
+ @import './action-list-tree.scss';
4
5
  @import './action-list-item.scss';
5
6
  @import './action-list-item-divider.scss';
package/alerts/flash.scss CHANGED
@@ -63,8 +63,12 @@
63
63
  color: var(--color-fg-muted);
64
64
  }
65
65
 
66
- &.btn-primary .octicon {
67
- color: inherit;
66
+ &.btn-primary {
67
+ background-clip: border-box;
68
+
69
+ .octicon {
70
+ color: inherit;
71
+ }
68
72
  }
69
73
  }
70
74