@primer/css 0.0.0-202198224040 → 0.0.0-20220107003222

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