@primer/css 0.0.0-202198211147 → 0.0.0-20220106235309

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 (211) hide show
  1. package/CHANGELOG.md +131 -6
  2. package/DEVELOP.md +15 -0
  3. package/actionlist/action-list-item-divider.scss +42 -0
  4. package/actionlist/action-list-item.scss +421 -194
  5. package/actionlist/action-list-tree.scss +92 -0
  6. package/actionlist/action-list-variables.scss +8 -0
  7. package/actionlist/action-list.scss +20 -38
  8. package/actionlist/index.scss +3 -1
  9. package/alerts/flash.scss +9 -0
  10. package/alerts/index.scss +2 -2
  11. package/autocomplete/autocomplete.scss +1 -1
  12. package/autocomplete/index.scss +3 -3
  13. package/autocomplete/suggester.scss +9 -1
  14. package/avatars/avatar-stack.scss +2 -1
  15. package/avatars/circle-badge.scss +1 -1
  16. package/avatars/index.scss +5 -5
  17. package/base/base.scss +1 -0
  18. package/base/index.scss +6 -7
  19. package/base/normalize.scss +1 -1
  20. package/blankslate/index.scss +2 -3
  21. package/box/box-overlay.scss +40 -0
  22. package/box/index.scss +3 -2
  23. package/branch-name/index.scss +2 -2
  24. package/breadcrumb/breadcrumb.scss +1 -1
  25. package/breadcrumb/index.scss +2 -2
  26. package/buttons/button-group.scss +3 -2
  27. package/buttons/button.scss +14 -14
  28. package/buttons/index.scss +4 -4
  29. package/buttons/misc.scss +14 -10
  30. package/color-modes/index.scss +8 -7
  31. package/color-modes/native.scss +1 -0
  32. package/color-modes/themes/dark.scss +2 -3
  33. package/color-modes/themes/dark_colorblind.scss +6 -0
  34. package/color-modes/themes/dark_dimmed.scss +2 -3
  35. package/color-modes/themes/dark_high_contrast.scss +2 -3
  36. package/color-modes/themes/light.scss +2 -3
  37. package/color-modes/themes/light_colorblind.scss +6 -0
  38. package/color-modes/themes/light_high_contrast.scss +6 -0
  39. package/deprecations.json +9 -7
  40. package/dist/actionlist.css +1 -1
  41. package/dist/actionlist.css.map +1 -1
  42. package/dist/alerts.css +1 -1
  43. package/dist/alerts.css.map +1 -1
  44. package/dist/autocomplete.css +1 -1
  45. package/dist/autocomplete.css.map +1 -1
  46. package/dist/avatars.css +1 -1
  47. package/dist/avatars.css.map +1 -1
  48. package/dist/base.css +1 -1
  49. package/dist/base.css.map +1 -1
  50. package/dist/blankslate.css.map +1 -1
  51. package/dist/box.css +1 -1
  52. package/dist/box.css.map +1 -1
  53. package/dist/branch-name.css.map +1 -1
  54. package/dist/breadcrumb.css.map +1 -1
  55. package/dist/buttons.css +1 -1
  56. package/dist/buttons.css.map +1 -1
  57. package/dist/color-modes.css +1 -1
  58. package/dist/color-modes.css.map +1 -1
  59. package/dist/core.css +1 -1
  60. package/dist/core.css.map +1 -1
  61. package/dist/deprecations.json +9 -7
  62. package/dist/dropdown.css.map +1 -1
  63. package/dist/forms.css +1 -1
  64. package/dist/forms.css.map +1 -1
  65. package/dist/header.css.map +1 -1
  66. package/dist/labels.css +1 -1
  67. package/dist/labels.css.map +1 -1
  68. package/dist/layout.css +1 -1
  69. package/dist/layout.css.map +1 -1
  70. package/dist/links.css.map +1 -1
  71. package/dist/loaders.css.map +1 -1
  72. package/dist/markdown.css.map +1 -1
  73. package/dist/marketing-buttons.css +1 -1
  74. package/dist/marketing-buttons.css.map +1 -1
  75. package/dist/marketing-links.css +2 -0
  76. package/dist/marketing-links.css.map +1 -0
  77. package/dist/marketing-links.js +1 -0
  78. package/dist/marketing-type.css.map +1 -1
  79. package/dist/marketing-utilities.css +1 -1
  80. package/dist/marketing-utilities.css.map +1 -1
  81. package/dist/marketing.css +1 -1
  82. package/dist/marketing.css.map +1 -1
  83. package/dist/meta.json +113 -193
  84. package/dist/navigation.css.map +1 -1
  85. package/dist/pagination.css +1 -1
  86. package/dist/pagination.css.map +1 -1
  87. package/dist/popover.css +1 -1
  88. package/dist/popover.css.map +1 -1
  89. package/dist/primer.css +4 -4
  90. package/dist/primer.css.map +1 -1
  91. package/dist/product.css +1 -1
  92. package/dist/product.css.map +1 -1
  93. package/dist/progress.css.map +1 -1
  94. package/dist/select-menu.css +1 -1
  95. package/dist/select-menu.css.map +1 -1
  96. package/dist/stats/actionlist.json +1 -1
  97. package/dist/stats/alerts.json +1 -1
  98. package/dist/stats/autocomplete.json +1 -1
  99. package/dist/stats/avatars.json +1 -1
  100. package/dist/stats/base.json +1 -1
  101. package/dist/stats/box.json +1 -1
  102. package/dist/stats/buttons.json +1 -1
  103. package/dist/stats/color-modes.json +1 -1
  104. package/dist/stats/core.json +1 -1
  105. package/dist/stats/forms.json +1 -1
  106. package/dist/stats/labels.json +1 -1
  107. package/dist/stats/layout.json +1 -1
  108. package/dist/stats/marketing-buttons.json +1 -1
  109. package/dist/stats/marketing-links.json +1 -0
  110. package/dist/stats/marketing-utilities.json +1 -1
  111. package/dist/stats/marketing.json +1 -1
  112. package/dist/stats/pagination.json +1 -1
  113. package/dist/stats/popover.json +1 -1
  114. package/dist/stats/primer.json +1 -1
  115. package/dist/stats/product.json +1 -1
  116. package/dist/stats/select-menu.json +1 -1
  117. package/dist/stats/subhead.json +1 -1
  118. package/dist/stats/toasts.json +1 -1
  119. package/dist/stats/utilities.json +1 -1
  120. package/dist/subhead.css +1 -1
  121. package/dist/subhead.css.map +1 -1
  122. package/dist/timeline.css.map +1 -1
  123. package/dist/toasts.css +1 -1
  124. package/dist/toasts.css.map +1 -1
  125. package/dist/tooltips.css.map +1 -1
  126. package/dist/truncate.css.map +1 -1
  127. package/dist/utilities.css +1 -1
  128. package/dist/utilities.css.map +1 -1
  129. package/dist/variables.json +62 -62
  130. package/dropdown/dropdown.scss +4 -4
  131. package/dropdown/index.scss +2 -2
  132. package/forms/form-control.scss +22 -8
  133. package/forms/form-group.scss +2 -2
  134. package/forms/form-select.scss +2 -2
  135. package/forms/form-validation.scss +9 -9
  136. package/forms/index.scss +7 -7
  137. package/forms/radio-group.scss +19 -0
  138. package/header/index.scss +2 -2
  139. package/index.scss +4 -4
  140. package/labels/counters.scss +1 -1
  141. package/labels/index.scss +7 -8
  142. package/labels/labels.scss +23 -4
  143. package/layout/grid.scss +1 -1
  144. package/layout/index.scss +7 -7
  145. package/layout/layout.scss +7 -11
  146. package/layout/mixins.scss +30 -4
  147. package/layout/page-layout.scss +380 -0
  148. package/links/index.scss +2 -2
  149. package/links/link.scss +1 -1
  150. package/loaders/index.scss +2 -2
  151. package/loaders/loaders.scss +1 -1
  152. package/markdown/footnotes.scss +1 -1
  153. package/markdown/images.scss +2 -2
  154. package/markdown/index.scss +9 -9
  155. package/markdown/lists.scss +3 -3
  156. package/markdown/markdown-body.scss +4 -4
  157. package/marketing/buttons/button.scss +102 -52
  158. package/marketing/buttons/index.scss +2 -2
  159. package/marketing/index.scss +5 -4
  160. package/marketing/links/index.scss +3 -0
  161. package/marketing/links/link.scss +50 -0
  162. package/marketing/support/index.scss +2 -3
  163. package/marketing/support/variables.scss +4 -5
  164. package/marketing/type/index.scss +2 -2
  165. package/marketing/type/typography.scss +26 -23
  166. package/marketing/utilities/animations.scss +42 -0
  167. package/marketing/utilities/index.scss +5 -5
  168. package/marketing/utilities/layout.scss +1 -1
  169. package/navigation/filter-list.scss +2 -2
  170. package/navigation/index.scss +7 -7
  171. package/navigation/menu.scss +3 -3
  172. package/navigation/sidenav.scss +5 -5
  173. package/navigation/subnav.scss +2 -2
  174. package/navigation/tabnav.scss +2 -2
  175. package/navigation/underline-nav.scss +2 -2
  176. package/package.json +17 -18
  177. package/pagination/index.scss +2 -2
  178. package/pagination/pagination.scss +5 -5
  179. package/popover/index.scss +2 -2
  180. package/popover/popover.scss +43 -5
  181. package/postcss.config.cjs +1 -1
  182. package/product/index.scss +17 -17
  183. package/progress/index.scss +2 -2
  184. package/select-menu/index.scss +2 -2
  185. package/select-menu/select-menu.scss +6 -6
  186. package/stylelint.config.cjs +2 -11
  187. package/subhead/index.scss +2 -2
  188. package/subhead/subhead.scss +6 -0
  189. package/support/index.scss +7 -7
  190. package/support/mixins/color-modes.scss +3 -0
  191. package/support/mixins/layout.scss +5 -5
  192. package/support/mixins/misc.scss +1 -1
  193. package/support/mixins/typography.scss +3 -2
  194. package/support/variables/layout.scss +8 -19
  195. package/support/variables/typography.scss +1 -1
  196. package/table-object/index.scss +1 -1
  197. package/timeline/index.scss +2 -2
  198. package/timeline/timeline-item.scss +1 -1
  199. package/toasts/index.scss +2 -2
  200. package/toasts/toasts.scss +0 -4
  201. package/tooltips/index.scss +2 -2
  202. package/tooltips/tooltips.scss +1 -1
  203. package/truncate/index.scss +2 -2
  204. package/utilities/colors.scss +32 -30
  205. package/utilities/details.scss +1 -1
  206. package/utilities/index.scss +12 -12
  207. package/utilities/visibility-display.scss +3 -3
  208. package/actionlist/action-list-divider.scss +0 -72
  209. package/color-modes/themes/dark_protanopia.scss +0 -7
  210. package/color-modes/themes/light_protanopia.scss +0 -7
  211. package/marketing/support/mixins.scss +0 -66
@@ -1,286 +1,513 @@
1
- // waiting on https://github.com/primer/primitives/pull/256 for these primitives
2
- $actionList-item-hover-bg: #f0f3f5;
3
- $actionList-item-active-bg: #e8ebed;
4
- $actionList-item-selected-bg: #f0f3f5;
5
- $actionList-item-focus-bg: #e0e4e7;
6
- $actionList-item-divider: #e9e9ed;
7
-
8
- $actionList-item-danger-hover-bg: #fff0f2;
9
- $actionList-item-danger-active-bg: #ffebed;
10
- $actionList-item-danger-focus-bg: #ffdbe0;
11
-
12
- // expanded from src/support/variables/layout.scss
13
- // adds 12px to the scale as of https://github.com/github/design-systems/issues/992
14
- //
15
- // https://github.com/github/design-systems/issues/1272
16
-
17
- $s-20: 20px;
18
- $s-28: 28px;
19
-
20
- // CSS Easing
21
-
22
- $ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
23
- $ease-out-cubic: cubic-bezier(0.33, 1, 0.68, 1);
24
- $ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
25
- // $actionList-item-padding-vertical: (($spacer-5 - $s-20) / 2); hmmmmm
26
- $actionList-item-padding-vertical: 6px;
27
- $actionList-item-padding-horizontal: $spacer-2;
28
- $actionList-item-bg-transition: background 33.333ms linear; // 2 frames on a 60hz monitor
29
-
30
- // li
31
- .actionList-item {
1
+ @mixin focusOutline {
32
2
  position: relative;
33
- // hide divider of item and next item on hover & active
34
- &:hover {
35
- .actionList-item-label:before,
36
- + .actionList-item .actionList-item-label:before {
37
- visibility: hidden;
38
- }
39
- }
3
+ z-index: 1;
4
+ outline: none;
5
+ box-shadow: 0 0 0 2px var(--color-accent-fg); // this color breaks convention
6
+ }
40
7
 
41
- &:active {
42
- .actionList-item-label:before,
43
- + .actionList-item .actionList-item-label:before {
44
- visibility: hidden;
45
- }
46
- }
8
+ @mixin activeIndicatorLine {
9
+ position: absolute;
10
+ top: calc(50% - 12px);
11
+ left: -$actionList-item-padding-horizontal;
12
+ width: $spacer-1;
13
+ height: $spacer-4;
14
+ content: '';
15
+ background: var(--color-accent-fg);
16
+ border-radius: $border-radius;
17
+ }
47
18
 
48
- // span or a href
49
- .actionList-item-content {
50
- display: grid;
51
- padding: $actionList-item-padding-vertical $actionList-item-padding-horizontal;
52
- grid-template-rows: minmax(20px, max-content); // 20px + 12px padding [32]
53
- grid-template-columns: minmax(min-content, 100%); // default one column
54
- column-gap: $spacer-2;
55
- align-items: center;
56
- position: relative;
57
- border-radius: $border-radius-2;
58
- font-weight: $font-weight-normal;
59
- color: var(--color-fg-default);
60
- user-select: none;
61
- transition: $actionList-item-bg-transition;
62
- // vini: https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-tap-highlight-color
63
- // -webkit-tap-highlight-color: transparent;
19
+ // <li>
20
+ .ActionList-item {
21
+ position: relative;
22
+ list-style: none;
23
+ background-color: transparent;
24
+ border-radius: $border-radius;
64
25
 
65
- &:hover {
66
- text-decoration: none;
67
- }
26
+ &:hover,
27
+ &:active {
28
+ cursor: pointer;
68
29
 
69
- &:focus-visible {
70
- outline: none;
71
- box-shadow: 0 0 0 2px var(--color-accent-fg); // this color breaks convention
72
- position: relative;
73
- z-index: 1;
30
+ // a href
31
+ .ActionList-content {
32
+ text-decoration: none;
74
33
  }
34
+ }
75
35
 
76
- // desktop
77
- @media (hover: hover) and (pointer: fine) {
78
- &:hover {
79
- background: $actionList-item-hover-bg;
80
- cursor: pointer;
81
- }
36
+ // 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);
82
41
  }
83
42
 
84
43
  &:active {
85
- background: $actionList-item-active-bg;
44
+ background: var(--color-action-list-item-default-active-bg);
86
45
 
87
46
  @media screen and (prefers-reduced-motion: no-preference) {
88
- animation: actionList-item-active-bg 4s forwards $ease-out-cubic;
47
+ animation: ActionList-item-active-bg 4s forwards cubic-bezier(0.33, 1, 0.68, 1);
89
48
  }
90
49
 
91
- @keyframes actionList-item-active-bg {
92
- 0% {
93
- }
50
+ // stylelint-disable primer/box-shadow
51
+ @keyframes ActionList-item-active-bg {
52
+ // stylelint-disable-next-line max-nesting-depth
94
53
  50% {
95
- transform: scale(1);
96
54
  box-shadow: inset 0 0 0 rgba(#000, 0.04);
55
+ transform: scale(1);
97
56
  }
57
+
58
+ // stylelint-disable-next-line max-nesting-depth
98
59
  100% {
99
- transform: scale(0.97);
100
60
  box-shadow: inset 0 3px 9px rgba(#000, 0.04);
61
+ transform: scale(0.97);
101
62
  }
102
63
  }
64
+ // stylelint-enable primer/box-shadow
103
65
  }
104
66
 
105
- // sizes
67
+ &:hover,
68
+ &:active {
69
+ // hide dividers
70
+ // stylelint-disable-next-line selector-max-specificity
71
+ .ActionList-item-label::before,
72
+ + .ActionList-item .ActionList-item-label::before {
73
+ visibility: hidden;
74
+ }
75
+ }
76
+ }
106
77
 
107
- &.actionList-item-content--sizeMedium {
108
- grid-template-rows: minmax(28px, max-content); // 28px + 12px padding [40]
78
+ // target contents of li if sub-item (li wraps item label + nested ul)
79
+ // collapse styles here
80
+ &.ActionList-item--hasSubItem {
81
+ // first child
82
+ > .ActionList-content {
83
+ &:hover {
84
+ background-color: var(--color-action-list-item-default-hover-bg);
85
+ }
109
86
  }
87
+ }
110
88
 
111
- &.actionList-item-content--sizeLarge {
112
- grid-template-rows: minmax(36px, max-content); // 36px + 12px padding [48]
89
+ // active state [aria-current]
90
+
91
+ &.ActionList-item--navActive {
92
+ &:not(.ActionList-item--subItem) {
93
+ .ActionList-item-label {
94
+ font-weight: $font-weight-bold;
95
+ }
113
96
  }
114
97
 
115
- // On pointer:coarse (mobile), all list items are large
116
- @media (pointer: coarse) {
117
- grid-template-rows: minmax(36px, max-content);
98
+ &:not(.ActionList-item--danger) {
99
+ background: var(--color-action-list-item-default-selected-bg);
100
+
101
+ &:hover {
102
+ background-color: var(--color-action-list-item-default-hover-bg);
103
+ }
104
+
105
+ // stylelint-disable-next-line selector-max-specificity
106
+ &::before,
107
+ + .ActionList-item::before {
108
+ visibility: hidden;
109
+ }
110
+
111
+ // blue accent line
112
+ &::after {
113
+ @include activeIndicatorLine;
114
+ }
118
115
  }
116
+ }
119
117
 
120
- // variants
118
+ // collapsible item [aria-expanded]
121
119
 
122
- &.actionList-item-content--danger {
123
- .actionList-item-label {
124
- color: var(--color-danger-fg);
120
+ // nesting (single level)
121
+ // target items inside expanded subgroups
122
+ &[aria-expanded] {
123
+ .ActionList--subGroup {
124
+ transition: opacity 160ms cubic-bezier(0.25, 1, 0.5, 1), transform 160ms cubic-bezier(0.25, 1, 0.5, 1);
125
+
126
+ @media (prefers-reduced-motion) {
127
+ transition: none;
125
128
  }
126
129
 
127
- @media (hover: hover) and (pointer: fine) {
128
- &:hover {
129
- background: var(--color-danger-subtle);
130
- }
130
+ .ActionList-content {
131
+ padding-left: $spacer-4;
131
132
  }
133
+ }
132
134
 
133
- &:active {
134
- background: var(--color-danger-subtle);
135
+ // has 16px leading visual
136
+ .ActionList-content--visual16 + .ActionList--subGroup {
137
+ // stylelint-disable-next-line selector-max-compound-selectors, selector-max-specificity
138
+ .ActionList-content {
139
+ padding-left: $spacer-5;
135
140
  }
136
141
  }
137
142
 
138
- // children grid definitions
143
+ // has 20px leading visual
144
+ .ActionList-content--visual20 + .ActionList--subGroup {
145
+ // stylelint-disable-next-line selector-max-compound-selectors, selector-max-specificity
146
+ .ActionList-content {
147
+ padding-left: $spacer-2 * 4.5; // 36px
148
+ }
149
+ }
139
150
 
140
- &.actionList-item-content--blockDescription {
141
- // if leading/trailing visual, align with first line of content
142
- .actionList-item-visual {
143
- place-self: start;
151
+ // has 24px leading visual
152
+ .ActionList-content--visual24 + .ActionList--subGroup {
153
+ // stylelint-disable-next-line selector-max-compound-selectors, selector-max-specificity
154
+ .ActionList-content {
155
+ padding-left: $spacer-6;
144
156
  }
145
157
  }
158
+ }
146
159
 
147
- // leading visual
148
- &.actionList-item-content--leadingVisual {
149
- grid-template-columns: min-content minmax(min-content, auto);
160
+ &[aria-expanded='true'] {
161
+ .ActionList-item-collapseIcon {
162
+ transition: transform 120ms linear;
163
+ transform: scaleY(-1);
164
+ }
165
+
166
+ .ActionList--subGroup {
167
+ visibility: visible;
168
+ overflow: auto;
169
+ height: auto;
170
+ opacity: 1;
171
+ transform: translateY(0);
172
+ }
173
+
174
+ &.ActionList-item--hasActiveSubItem {
175
+ // stylelint-disable-next-line selector-max-specificity
176
+ > .ActionList-content > .ActionList-item-label {
177
+ font-weight: $font-weight-bold;
178
+ }
150
179
  }
180
+ }
151
181
 
152
- // trailing visual
153
- &.actionList-item-content--trailingVisual {
154
- grid-template-columns: minmax(min-content, auto) min-content;
182
+ &[aria-expanded='false'] {
183
+ .ActionList-item-collapseIcon {
184
+ transition: transform 120ms linear;
185
+ transform: scaleY(1);
155
186
  }
156
187
 
157
- // leading + trailing visuals
158
- &.actionList-item-content--leadingVisual.actionList-item-content--trailingVisual {
159
- grid-template-columns: min-content minmax(min-content, auto) min-content;
188
+ .ActionList--subGroup {
189
+ display: block;
190
+ visibility: hidden;
191
+ overflow: hidden;
192
+ height: 0;
193
+ opacity: 0;
194
+ transform: translateY(-$spacer-3);
160
195
  }
161
196
 
162
- // checkmark
163
- &.actionList-item-content--singleSelect,
164
- &.actionList-item-content--multiSelect {
165
- grid-template-columns: min-content minmax(min-content, auto);
197
+ // show active indicator on parent collapse if child is active
198
+ &.ActionList-item--hasActiveSubItem {
199
+ background: var(--color-action-list-item-default-selected-bg);
166
200
 
167
- // checkmark + leading visual
168
- &.actionList-item-content--leadingVisual {
169
- grid-template-columns: min-content min-content minmax(min-content, auto);
201
+ .ActionList-item-label {
202
+ font-weight: $font-weight-bold;
170
203
  }
171
204
 
172
- // checkmark + trailing visual
173
- &.actionList-item-content--trailingVisual {
174
- grid-template-columns: min-content minmax(min-content, auto) min-content;
205
+ // stylelint-disable-next-line selector-max-specificity
206
+ &::before,
207
+ + .ActionList-item::before {
208
+ visibility: hidden;
175
209
  }
176
210
 
177
- // checkmark + leading * trailing visuals
178
- &.actionList-item-content--leadingVisual.actionList-item-content--trailingVisual {
179
- grid-template-columns: min-content min-content minmax(min-content, auto) min-content;
211
+ // blue accent line
212
+ &::after {
213
+ @include activeIndicatorLine;
180
214
  }
181
215
  }
216
+ }
182
217
 
183
- // helper for grid alignment with multi-line content
184
- // span wrapping svg or text
185
- .actionList-item-visual {
186
- min-height: 20px;
187
- display: flex;
188
- align-items: center;
189
- fill: var(--color-fg-muted);
190
- color: var(--color-fg-muted); // if visual is text
191
- }
218
+ // checkbox item [aria-checked]
219
+ // listbox [aria-selected]
192
220
 
193
- // text
194
- .actionList-item-label {
195
- font-weight: $font-weight-normal;
196
- color: var(--color-fg-default);
197
- position: relative; // for pseudo dividers
221
+ &[aria-checked='true'],
222
+ &[aria-selected='true'] {
223
+ // multiselect checkmark
224
+ .ActionList-item-multiSelectCheckmark {
225
+ visibility: visible;
226
+ opacity: 1;
227
+ transition: visibility 0 linear 0, opacity $actionList-item-checkmark-transition-timing;
198
228
  }
199
229
 
200
- // wrapper span
201
- .actionList-item-label--blockDescription,
202
- .actionList-item-label--inlineDescription {
203
- display: flex;
230
+ // singleselect checkmark
231
+ .ActionList-item-singleSelectCheckmark {
232
+ visibility: visible;
204
233
 
205
- .actionList-item-label {
206
- font-weight: $font-weight-bold;
234
+ @media screen and (prefers-reduced-motion: no-preference) {
235
+ animation: checkmarkIn 200ms cubic-bezier(0.11, 0, 0.5, 0) forwards;
207
236
  }
208
237
  }
209
238
 
210
- // block
211
- .actionList-item-label--blockDescription {
212
- flex-direction: column;
239
+ // checkbox
240
+ .ActionList-item-multiSelectIcon {
241
+ .ActionList-item-multiSelectIconRect {
242
+ fill: var(--color-accent-fg);
243
+ stroke: var(--color-accent-fg);
244
+ stroke-width: $border-width;
245
+ }
213
246
 
214
- .actionList-item-description {
215
- margin-top: $spacer-1;
247
+ .ActionList-item-multiSelectCheckmark {
248
+ fill: var(--color-fg-on-emphasis);
216
249
  }
217
250
  }
251
+ }
218
252
 
219
- // inline
220
- .actionList-item-label--inlineDescription {
221
- flex-direction: row;
222
- align-items: baseline;
253
+ &[aria-checked='false'],
254
+ &[aria-selected='false'] {
255
+ // multiselect checkmark
256
+ .ActionList-item-multiSelectCheckmark {
257
+ visibility: hidden;
258
+ opacity: 0;
259
+ transition:
260
+ visibility 0 linear $actionList-item-checkmark-transition-timing,
261
+ opacity $actionList-item-checkmark-transition-timing;
262
+ }
263
+
264
+ // singleselect checkmark
265
+ .ActionList-item-singleSelectCheckmark {
266
+ visibility: hidden;
267
+ transition: visibility 0s linear 200ms;
268
+ clip-path: inset(16px 0 0 0);
269
+
270
+ @media screen and (prefers-reduced-motion: no-preference) {
271
+ animation: checkmarkOut 200ms cubic-bezier(0.11, 0, 0.5, 0) forwards;
272
+ }
273
+ }
223
274
 
224
- .actionList-item-description {
225
- margin-left: $actionList-item-padding-horizontal;
275
+ // checkbox
276
+ .ActionList-item-multiSelectIcon {
277
+ .ActionList-item-multiSelectIconRect {
278
+ fill: var(--color-canvas-default);
279
+ stroke: var(--color-border-default);
280
+ stroke-width: $border-width;
226
281
  }
227
282
  }
228
283
 
229
- // description
230
- .actionList-item-description {
231
- font-size: $font-size-small;
232
- line-height: $lh-default;
233
- color: var(--color-fg-muted);
284
+ .ActionList-item-multiSelectIconRect {
285
+ fill: var(--color-canvas-default);
286
+ border: $border-width $border-style var(--color-border-default);
234
287
  }
235
288
  }
236
289
 
237
- // single select
290
+ @keyframes checkmarkIn {
291
+ from {
292
+ clip-path: inset(16px 0 0 0);
293
+ }
238
294
 
239
- // maintain space on grid while check is hidden
240
- .actionList-item-content--singleSelect {
241
- .actionList-item-check {
242
- visibility: hidden;
295
+ to {
296
+ clip-path: inset(0 0 0 0);
243
297
  }
244
298
  }
245
299
 
246
- &[aria-checked='true'] {
247
- .actionList-item-content--singleSelect {
248
- .actionList-item-check {
249
- visibility: visible;
250
- }
300
+ @keyframes checkmarkOut {
301
+ from {
302
+ clip-path: inset(0 0 0 0);
303
+ }
304
+
305
+ to {
306
+ clip-path: inset(16px 0 0 0);
251
307
  }
252
308
  }
253
309
 
254
- // navigational
310
+ // variants
255
311
 
256
- // we could also use [aria-current] selector, and/or just conditionally add this class
257
- &.actionList-item--active {
258
- &:before,
259
- + .actionList-item:before {
260
- visibility: hidden;
312
+ // danger
313
+ &.ActionList-item--danger {
314
+ .ActionList-item-label {
315
+ color: var(--color-danger-fg);
261
316
  }
262
317
 
263
- // not: safegaurd that danger items aren't nav active
264
- // blue accent line
265
- > :not(.actionList-item-content--danger):after {
266
- content: '';
267
- width: $spacer-1;
268
- height: $spacer-4;
269
- border-radius: $border-radius-1;
270
- position: absolute;
271
- left: -$actionList-item-padding-horizontal;
272
- top: calc(50% - (24px / 2));
273
- background: var(--color-accent-fg);
318
+ .ActionList-item-visual {
319
+ color: var(--color-danger-fg);
274
320
  }
275
321
 
276
- .actionList-item-content:not(.actionList-item-content--danger) {
277
- background: $actionList-item-selected-bg;
322
+ @media (hover: hover) and (pointer: fine) {
323
+ &:hover {
324
+ background: var(--color-action-list-item-danger-hover-bg);
278
325
 
279
- @media (hover: hover) and (pointer: fine) {
280
- &:hover {
281
- background: $actionList-item-active-bg;
326
+ // stylelint-disable-next-line max-nesting-depth
327
+ .ActionList-item-label {
328
+ color: var(--color-action-list-item-danger-hover-text);
282
329
  }
283
330
  }
284
331
  }
332
+
333
+ &:active {
334
+ background: var(--color-action-list-item-danger-active-bg);
335
+ }
285
336
  }
337
+
338
+ // disabled
339
+ &[aria-disabled='true'] {
340
+ .ActionList-item-label,
341
+ .ActionList-item-description {
342
+ color: var(--color-primer-fg-disabled);
343
+ }
344
+
345
+ .ActionList-item-visual {
346
+ fill: var(--color-primer-fg-disabled);
347
+ }
348
+
349
+ @media (hover: hover) and (pointer: fine) {
350
+ &:hover {
351
+ cursor: not-allowed;
352
+ background-color: transparent;
353
+ }
354
+ }
355
+ }
356
+
357
+ // if nested list exists, remove default padding
358
+ .ActionList {
359
+ // stylelint-disable-next-line primer/spacing
360
+ padding: unset;
361
+ }
362
+ }
363
+
364
+ // span or a href
365
+ .ActionList-content {
366
+ position: relative;
367
+ display: grid;
368
+ // stylelint-disable-next-line primer/spacing
369
+ padding: $actionList-item-padding-vertical $actionList-item-padding-horizontal;
370
+ font-size: $body-font-size;
371
+ font-weight: $font-weight-normal;
372
+ color: var(--color-fg-default);
373
+ user-select: none;
374
+ border-radius: $border-radius;
375
+ transition: $actionList-item-bg-transition;
376
+ grid-template-rows: min-content;
377
+ grid-template-areas: 'leadingAction leadingVisual label trailingVisual trailingAction';
378
+ grid-template-columns: min-content min-content minmax(0, auto) min-content min-content;
379
+ align-items: start;
380
+
381
+ // column-gap persists with empty grid-areas, margin applies only when children exist
382
+ > :not(:last-child) {
383
+ margin-right: $spacer-2;
384
+ }
385
+
386
+ &:focus-visible {
387
+ @include focusOutline;
388
+ }
389
+
390
+ // sizes
391
+
392
+ &.ActionList-content--sizeMedium {
393
+ // 44px total height
394
+ // stylelint-disable-next-line primer/spacing
395
+ padding: $actionList-item-padding-vertical-md $actionList-item-padding-horizontal;
396
+ }
397
+
398
+ &.ActionList-content--sizeLarge {
399
+ // 48px total height
400
+ // stylelint-disable-next-line primer/spacing
401
+ padding: $actionList-item-padding-vertical-lg $actionList-item-padding-horizontal;
402
+ }
403
+
404
+ &.ActionList-content--fontSmall {
405
+ font-size: $font-size-small;
406
+ }
407
+
408
+ // On pointer:coarse (mobile), all list items are large
409
+ @media (pointer: coarse) {
410
+ // stylelint-disable-next-line primer/spacing
411
+ padding: $actionList-item-padding-vertical-lg $actionList-item-padding-horizontal;
412
+ }
413
+
414
+ &.ActionList-content--blockDescription {
415
+ // if leading/trailing visual, align with first line of content
416
+ .ActionList-item-visual {
417
+ place-self: start;
418
+ }
419
+ }
420
+ }
421
+
422
+ // place children on grid
423
+
424
+ .ActionList-item-action--leading {
425
+ grid-area: leadingAction;
426
+ }
427
+
428
+ .ActionList-item-visual--leading {
429
+ grid-area: leadingVisual;
430
+ }
431
+
432
+ .ActionList-item-label {
433
+ grid-area: label;
434
+ }
435
+
436
+ .ActionList-item-visual--trailing {
437
+ grid-area: trailingVisual;
438
+ }
439
+
440
+ .ActionList-item-action--trailing {
441
+ grid-area: trailingAction;
442
+ }
443
+
444
+ // wrapper span
445
+ // default block
446
+ .ActionList-item-descriptionWrap {
447
+ grid-area: label;
448
+ display: flex;
449
+ flex-direction: column;
450
+
451
+ .ActionList-item-description {
452
+ margin-top: $spacer-1;
453
+ }
454
+
455
+ .ActionList-item-label {
456
+ font-weight: $font-weight-bold;
457
+ }
458
+ }
459
+
460
+ // inline
461
+ .ActionList-item-descriptionWrap--inline {
462
+ flex-direction: row;
463
+ align-items: baseline;
464
+
465
+ .ActionList-item-description {
466
+ // stylelint-disable-next-line primer/spacing
467
+ margin-left: $actionList-item-padding-horizontal;
468
+ }
469
+ }
470
+
471
+ // description
472
+ .ActionList-item-description {
473
+ font-size: $font-size-small;
474
+ font-weight: $font-weight-normal;
475
+ line-height: $lh-default;
476
+ color: var(--color-fg-muted);
477
+ }
478
+
479
+ // helper for grid alignment with multi-line content
480
+ // span wrapping svg or text
481
+ .ActionList-item-visual,
482
+ .ActionList-item-action {
483
+ display: flex;
484
+ min-height: $actionList-item-height-sm;
485
+ color: var(--color-fg-muted); // if visual is text
486
+ fill: var(--color-fg-muted);
487
+ align-items: center;
488
+ }
489
+
490
+ // text
491
+ // stylelint-disable-next-line no-duplicate-selectors
492
+ .ActionList-item-label {
493
+ position: relative; // for pseudo dividers
494
+ font-weight: $font-weight-normal;
495
+ // we need a strict value here for grid alignment
496
+ // stylelint-disable-next-line primer/typography
497
+ line-height: $actionList-item-label-line-height;
498
+ color: var(--color-fg-default);
499
+ }
500
+
501
+ .ActionList-item-label--truncate {
502
+ overflow: hidden;
503
+ text-overflow: ellipsis;
504
+ white-space: nowrap;
505
+ }
506
+
507
+ // nested lists (only supports 1 level currently)
508
+ // target ActionList-item--subItem for padding-left to maintain :active :after state
509
+
510
+ // TODO: remove with PVC implementation
511
+ .ActionList-item--subItem > .ActionList-content {
512
+ font-size: $font-size-small;
286
513
  }