openproject-primer_view_components 0.11.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +110 -0
  3. data/app/assets/javascripts/app/components/primer/alpha/tool_tip.d.ts +1 -0
  4. data/app/assets/javascripts/app/components/primer/primer.d.ts +1 -1
  5. data/app/assets/javascripts/primer_view_components.js +1 -1
  6. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  7. data/app/assets/styles/primer_view_components.css +1 -1
  8. data/app/assets/styles/primer_view_components.css.map +1 -1
  9. data/app/components/primer/alpha/action_bar/item.rb +7 -4
  10. data/app/components/primer/alpha/action_bar.rb +2 -2
  11. data/app/components/primer/alpha/action_bar_element.js +9 -4
  12. data/app/components/primer/alpha/action_bar_element.ts +9 -2
  13. data/app/components/primer/alpha/action_list/form_wrapper.html.erb +4 -2
  14. data/app/components/primer/alpha/action_list/form_wrapper.rb +20 -9
  15. data/app/components/primer/alpha/action_menu/action_menu_element.js +162 -86
  16. data/app/components/primer/alpha/action_menu/action_menu_element.ts +197 -82
  17. data/app/components/primer/alpha/action_menu/list.rb +0 -2
  18. data/app/components/primer/alpha/action_menu.rb +120 -3
  19. data/app/components/primer/alpha/check_box_group.rb +2 -0
  20. data/app/components/primer/alpha/dialog/header.rb +12 -0
  21. data/app/components/primer/alpha/dialog.rb +1 -1
  22. data/app/components/primer/alpha/modal_dialog.js +10 -13
  23. data/app/components/primer/alpha/modal_dialog.ts +10 -13
  24. data/app/components/primer/alpha/nav_list/divider.rb +2 -5
  25. data/app/components/primer/alpha/nav_list/group.rb +2 -98
  26. data/app/components/primer/alpha/nav_list/heading.rb +2 -27
  27. data/app/components/primer/alpha/nav_list/item.rb +2 -147
  28. data/app/components/primer/alpha/nav_list.rb +2 -205
  29. data/app/components/primer/alpha/overlay.css +1 -1
  30. data/app/components/primer/alpha/overlay.css.map +1 -1
  31. data/app/components/primer/alpha/overlay.pcss +1 -7
  32. data/app/components/primer/alpha/overlay.rb +6 -4
  33. data/app/components/primer/alpha/radio_button_group.rb +2 -0
  34. data/app/components/primer/alpha/segmented_control/item.html.erb +1 -8
  35. data/app/components/primer/alpha/segmented_control/item.rb +38 -4
  36. data/app/components/primer/alpha/segmented_control.css +1 -1
  37. data/app/components/primer/alpha/segmented_control.css.json +14 -13
  38. data/app/components/primer/alpha/segmented_control.css.map +1 -1
  39. data/app/components/primer/alpha/segmented_control.pcss +75 -66
  40. data/app/components/primer/alpha/segmented_control.rb +10 -0
  41. data/app/components/primer/alpha/text_field.css +1 -1
  42. data/app/components/primer/alpha/text_field.css.json +4 -1
  43. data/app/components/primer/alpha/text_field.css.map +1 -1
  44. data/app/components/primer/alpha/text_field.pcss +18 -3
  45. data/app/components/primer/alpha/tool_tip.d.ts +1 -0
  46. data/app/components/primer/alpha/tool_tip.js +26 -93
  47. data/app/components/primer/alpha/tool_tip.ts +25 -91
  48. data/app/components/primer/alpha/tooltip.rb +3 -1
  49. data/app/components/primer/beta/base_button.rb +4 -0
  50. data/app/components/primer/beta/button.css +1 -1
  51. data/app/components/primer/beta/button.css.json +2 -0
  52. data/app/components/primer/beta/button.css.map +1 -1
  53. data/app/components/primer/beta/button.pcss +17 -5
  54. data/app/components/primer/beta/icon_button.html.erb +1 -1
  55. data/app/components/primer/beta/icon_button.rb +8 -1
  56. data/app/components/primer/beta/link.css +1 -1
  57. data/app/components/primer/beta/link.css.json +1 -0
  58. data/app/components/primer/beta/link.css.map +1 -1
  59. data/app/components/primer/beta/link.pcss +5 -0
  60. data/app/components/primer/beta/link.rb +2 -2
  61. data/app/components/primer/beta/nav_list/divider.rb +14 -0
  62. data/app/components/primer/beta/nav_list/group.rb +107 -0
  63. data/app/components/primer/beta/nav_list/heading.rb +36 -0
  64. data/app/components/primer/beta/nav_list/item.rb +156 -0
  65. data/app/components/primer/beta/nav_list.rb +212 -0
  66. data/app/components/primer/focus_group.js +30 -4
  67. data/app/components/primer/focus_group.ts +29 -2
  68. data/app/components/primer/open_project/flex_layout.html.erb +23 -0
  69. data/app/components/primer/open_project/flex_layout.rb +52 -0
  70. data/app/components/primer/open_project/grid_layout/area.rb +38 -0
  71. data/app/components/primer/open_project/grid_layout.html.erb +11 -0
  72. data/app/components/primer/open_project/grid_layout.rb +34 -0
  73. data/app/components/primer/open_project/page_header.css +1 -1
  74. data/app/components/primer/open_project/page_header.css.map +1 -1
  75. data/app/components/primer/open_project/page_header.pcss +4 -0
  76. data/app/components/primer/primer.d.ts +1 -1
  77. data/app/components/primer/primer.js +1 -1
  78. data/app/components/primer/primer.ts +1 -1
  79. data/app/helpers/primer/form_helper.rb +10 -0
  80. data/lib/primer/accessibility.rb +3 -1
  81. data/lib/primer/deprecations.yml +20 -0
  82. data/lib/primer/forms/check_box_group.html.erb +3 -0
  83. data/lib/primer/forms/dsl/check_box_group_input.rb +1 -5
  84. data/lib/primer/forms/dsl/check_box_input.rb +5 -0
  85. data/lib/primer/forms/dsl/radio_button_input.rb +5 -0
  86. data/lib/primer/forms/form_control.html.erb +1 -4
  87. data/lib/primer/forms/radio_button_group.html.erb +3 -0
  88. data/lib/primer/forms/utils.rb +2 -0
  89. data/lib/primer/forms/validation_message.html.erb +4 -0
  90. data/lib/primer/forms/validation_message.rb +14 -0
  91. data/lib/primer/forms.rb +16 -0
  92. data/lib/primer/static/generate_info_arch.rb +86 -5
  93. data/lib/primer/view_components/version.rb +1 -1
  94. data/lib/primer/yard/component_manifest.rb +4 -0
  95. data/previews/primer/alpha/action_menu_preview/single_select_form_items.html.erb +31 -0
  96. data/previews/primer/alpha/action_menu_preview/with_actions.html.erb +6 -5
  97. data/previews/primer/alpha/action_menu_preview.rb +10 -1
  98. data/previews/primer/alpha/check_box_group_preview.rb +13 -0
  99. data/previews/primer/alpha/check_box_preview.rb +1 -0
  100. data/previews/primer/alpha/dialog_preview/autofocus_element.html.erb +8 -0
  101. data/previews/primer/alpha/dialog_preview/with_header.html.erb +5 -0
  102. data/previews/primer/alpha/dialog_preview.rb +22 -0
  103. data/previews/primer/alpha/overlay_preview.rb +1 -1
  104. data/previews/primer/alpha/radio_button_group_preview.rb +13 -0
  105. data/previews/primer/alpha/radio_button_preview.rb +2 -1
  106. data/previews/primer/alpha/segmented_control_preview.rb +35 -0
  107. data/previews/primer/alpha/text_field_preview/input_group_leading_action_menu.html.erb +21 -0
  108. data/previews/primer/alpha/text_field_preview/input_group_leading_button.html.erb +18 -0
  109. data/previews/primer/alpha/text_field_preview/input_group_trailing_button.html.erb +18 -0
  110. data/previews/primer/alpha/text_field_preview.rb +21 -0
  111. data/previews/primer/alpha/tooltip_preview/tooltip_with_dialog_moving_focus_to_input.html.erb +23 -0
  112. data/previews/primer/alpha/tooltip_preview.rb +6 -1
  113. data/previews/primer/beta/button_group_preview.rb +6 -6
  114. data/previews/primer/beta/button_preview.rb +21 -3
  115. data/previews/primer/beta/icon_button_preview.rb +3 -0
  116. data/previews/primer/{alpha → beta}/nav_list_preview/trailing_action.html.erb +1 -1
  117. data/previews/primer/{alpha → beta}/nav_list_preview.rb +5 -5
  118. data/previews/primer/open_project/flex_layout_preview.rb +73 -0
  119. data/previews/primer/open_project/grid_layout_preview.rb +37 -0
  120. data/static/arguments.json +278 -7
  121. data/static/audited_at.json +8 -0
  122. data/static/classes.json +15 -0
  123. data/static/constants.json +47 -1
  124. data/static/info_arch.json +1338 -632
  125. data/static/previews.json +271 -167
  126. data/static/statuses.json +13 -5
  127. metadata +33 -319
  128. /data/app/assets/javascripts/app/components/primer/{alpha → beta}/nav_list.d.ts +0 -0
  129. /data/app/components/primer/{alpha → beta}/nav_list/group.html.erb +0 -0
  130. /data/app/components/primer/{alpha → beta}/nav_list/item.html.erb +0 -0
  131. /data/app/components/primer/{alpha → beta}/nav_list.d.ts +0 -0
  132. /data/app/components/primer/{alpha → beta}/nav_list.html.erb +0 -0
  133. /data/app/components/primer/{alpha → beta}/nav_list.js +0 -0
  134. /data/app/components/primer/{alpha → beta}/nav_list.ts +0 -0
@@ -9,7 +9,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
10
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
11
  };
12
- var _ToolTipElement_instances, _ToolTipElement_abortController, _ToolTipElement_align, _ToolTipElement_side, _ToolTipElement_allowUpdatePosition, _ToolTipElement_update, _ToolTipElement_updateControlReference, _ToolTipElement_updateDirection, _ToolTipElement_updatePosition;
12
+ var _ToolTipElement_instances, _ToolTipElement_abortController, _ToolTipElement_align, _ToolTipElement_side, _ToolTipElement_allowUpdatePosition, _ToolTipElement_showReason, _ToolTipElement_update, _ToolTipElement_updateControlReference, _ToolTipElement_updateDirection, _ToolTipElement_updatePosition;
13
13
  import '@oddbird/popover-polyfill';
14
14
  import { getAnchoredPosition } from '@primer/behaviors';
15
15
  const isPopoverOpen = (() => {
@@ -32,9 +32,8 @@ const isPopoverOpen = (() => {
32
32
  }
33
33
  return (el) => (selector ? el.matches(selector) : setSelector(el));
34
34
  })();
35
- const TOOLTIP_ARROW_EDGE_OFFSET = 6;
36
35
  const TOOLTIP_SR_ONLY_CLASS = 'sr-only';
37
- const TOOLTIP_OFFSET = 10;
36
+ const TOOLTIP_OFFSET = 4;
38
37
  const DIRECTION_CLASSES = [
39
38
  'tooltip-n',
40
39
  'tooltip-s',
@@ -60,6 +59,15 @@ function closeOpenTooltips(except) {
60
59
  function focusOutListener() {
61
60
  closeOpenTooltips();
62
61
  }
62
+ function focusInListener(event) {
63
+ setTimeout(() => {
64
+ for (const tooltip of openTooltips) {
65
+ if (isPopoverOpen(tooltip) && tooltip.showReason === 'focus' && tooltip.control !== event.target) {
66
+ tooltip.hidePopover();
67
+ }
68
+ }
69
+ }, 0);
70
+ }
63
71
  const tooltips = new Set();
64
72
  const openTooltips = new Set();
65
73
  class ToolTipElement extends HTMLElement {
@@ -70,14 +78,14 @@ class ToolTipElement extends HTMLElement {
70
78
  _ToolTipElement_align.set(this, 'center');
71
79
  _ToolTipElement_side.set(this, 'outside-bottom');
72
80
  _ToolTipElement_allowUpdatePosition.set(this, false);
81
+ _ToolTipElement_showReason.set(this, 'mouse');
73
82
  }
74
83
  styles() {
75
84
  return `
76
85
  :host {
77
- padding: .5em .75em !important;
78
- font: normal normal 11px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
79
- -webkit-font-smoothing: subpixel-antialiased;
80
- color: var(--color-fg-on-emphasis) !important;
86
+ padding: var(--overlay-paddingBlock-condensed) var(--overlay-padding-condensed) !important;
87
+ font: var(--text-body-shorthand-small);
88
+ color: var(--fgColor-onEmphasis, var(--color-fg-on-emphasis)) !important;
81
89
  text-align: center;
82
90
  text-decoration: none;
83
91
  text-shadow: none;
@@ -85,25 +93,17 @@ class ToolTipElement extends HTMLElement {
85
93
  letter-spacing: normal;
86
94
  word-wrap: break-word;
87
95
  white-space: pre;
88
- background: var(--color-neutral-emphasis-plus) !important;
89
- border-radius: 6px;
96
+ background: var(--bgColor-emphasis, var(--color-neutral-emphasis-plus)) !important;
97
+ border-radius: var(--borderRadius-medium);
90
98
  border: 0 !important;
91
99
  opacity: 0;
92
- max-width: 250px;
100
+ max-width: var(--overlay-width-small);
93
101
  word-wrap: break-word;
94
102
  white-space: normal;
95
103
  width: max-content !important;
96
104
  inset: var(--tool-tip-position-top, 0) auto auto var(--tool-tip-position-left, 0) !important;
97
105
  overflow: visible !important;
98
- }
99
-
100
- :host:before{
101
- position: absolute;
102
- z-index: 1000001;
103
- color: var(--color-neutral-emphasis-plus);
104
- content: "";
105
- border: 6px solid transparent;
106
- opacity: 0
106
+ text-wrap: balance;
107
107
  }
108
108
 
109
109
  @keyframes tooltip-appear {
@@ -115,94 +115,25 @@ class ToolTipElement extends HTMLElement {
115
115
  }
116
116
  }
117
117
 
118
- :host:after{
119
- position: absolute;
120
- display: block;
121
- right: 0;
122
- left: 0;
123
- height: 12px;
124
- content: ""
125
- }
126
-
127
118
  :host(:popover-open),
128
119
  :host(:popover-open):before {
129
120
  animation-name: tooltip-appear;
130
121
  animation-duration: .1s;
131
122
  animation-fill-mode: forwards;
132
123
  animation-timing-function: ease-in;
133
- animation-delay: .4s
134
124
  }
135
125
 
136
- :host(.\\:popover-open),
137
- :host(.\\:popover-open):before {
126
+ :host(.\\:popover-open) {
138
127
  animation-name: tooltip-appear;
139
128
  animation-duration: .1s;
140
129
  animation-fill-mode: forwards;
141
130
  animation-timing-function: ease-in;
142
- animation-delay: .4s
143
- }
144
-
145
- :host(.tooltip-s):before,
146
- :host(.tooltip-n):before {
147
- right: 50%;
148
- margin-right: -${TOOLTIP_ARROW_EDGE_OFFSET}px;
149
- }
150
-
151
- :host(.tooltip-s):before,
152
- :host(.tooltip-se):before,
153
- :host(.tooltip-sw):before {
154
- bottom: 100%;
155
- border-bottom-color: var(--color-neutral-emphasis-plus)
156
- }
157
-
158
- :host(.tooltip-s):after,
159
- :host(.tooltip-se):after,
160
- :host(.tooltip-sw):after {
161
- bottom: 100%
162
- }
163
-
164
- :host(.tooltip-n):before,
165
- :host(.tooltip-ne):before,
166
- :host(.tooltip-nw):before {
167
- top: 100%;
168
- border-top-color: var(--color-neutral-emphasis-plus)
169
- }
170
-
171
- :host(.tooltip-n):after,
172
- :host(.tooltip-ne):after,
173
- :host(.tooltip-nw):after {
174
- top: 100%
175
- }
176
-
177
- :host(.tooltip-se):before,
178
- :host(.tooltip-ne):before {
179
- left: 0;
180
- margin-left: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
181
- }
182
-
183
- :host(.tooltip-sw):before,
184
- :host(.tooltip-nw):before {
185
- right: 0;
186
- margin-right: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
187
- }
188
-
189
- :host(.tooltip-w):before {
190
- top: 50%;
191
- bottom: 50%;
192
- left: 100%;
193
- margin-top: -6px;
194
- border-left-color: var(--color-neutral-emphasis-plus)
195
- }
196
-
197
- :host(.tooltip-e):before {
198
- top: 50%;
199
- right: 100%;
200
- bottom: 50%;
201
- margin-top: -6px;
202
- border-right-color: var(--color-neutral-emphasis-plus)
203
131
  }
204
132
  `;
205
133
  }
134
+ get showReason() {
135
+ return __classPrivateFieldGet(this, _ToolTipElement_showReason, "f");
136
+ }
206
137
  get htmlFor() {
207
138
  return this.getAttribute('for') || '';
208
139
  }
@@ -269,6 +200,7 @@ class ToolTipElement extends HTMLElement {
269
200
  signal
270
201
  });
271
202
  this.ownerDocument.addEventListener('focusout', focusOutListener);
203
+ this.ownerDocument.addEventListener('focusin', focusInListener);
272
204
  this.ownerDocument.addEventListener('keydown', this, { signal });
273
205
  }
274
206
  disconnectedCallback() {
@@ -293,6 +225,7 @@ class ToolTipElement extends HTMLElement {
293
225
  const shouldHide = isMouseLeaveFromButton || isEscapeKeydown || isMouseDownOnButton || isOpeningOtherPopover;
294
226
  await Promise.resolve();
295
227
  if (!showing && shouldShow && !isPopoverOpen(this)) {
228
+ __classPrivateFieldSet(this, _ToolTipElement_showReason, event.type === 'mouseenter' ? 'mouse' : 'focus', "f");
296
229
  this.showPopover();
297
230
  }
298
231
  else if (showing && shouldHide && isPopoverOpen(this)) {
@@ -313,7 +246,7 @@ class ToolTipElement extends HTMLElement {
313
246
  }
314
247
  }
315
248
  }
316
- _ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new WeakMap(), _ToolTipElement_side = new WeakMap(), _ToolTipElement_allowUpdatePosition = new WeakMap(), _ToolTipElement_instances = new WeakSet(), _ToolTipElement_update = function _ToolTipElement_update(isOpen) {
249
+ _ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new WeakMap(), _ToolTipElement_side = new WeakMap(), _ToolTipElement_allowUpdatePosition = new WeakMap(), _ToolTipElement_showReason = new WeakMap(), _ToolTipElement_instances = new WeakSet(), _ToolTipElement_update = function _ToolTipElement_update(isOpen) {
317
250
  if (isOpen) {
318
251
  openTooltips.add(this);
319
252
  this.classList.remove(TOOLTIP_SR_ONLY_CLASS);
@@ -21,9 +21,8 @@ const isPopoverOpen = (() => {
21
21
  return (el: Element) => (selector ? el.matches(selector) : setSelector(el))
22
22
  })()
23
23
 
24
- const TOOLTIP_ARROW_EDGE_OFFSET = 6
25
24
  const TOOLTIP_SR_ONLY_CLASS = 'sr-only'
26
- const TOOLTIP_OFFSET = 10
25
+ const TOOLTIP_OFFSET = 4
27
26
 
28
27
  type Direction = 'n' | 's' | 'e' | 'w' | 'ne' | 'se' | 'nw' | 'sw'
29
28
 
@@ -53,16 +52,25 @@ function focusOutListener() {
53
52
  closeOpenTooltips()
54
53
  }
55
54
 
55
+ function focusInListener(event: Event) {
56
+ setTimeout(() => {
57
+ for (const tooltip of openTooltips) {
58
+ if (isPopoverOpen(tooltip) && tooltip.showReason === 'focus' && tooltip.control !== event.target) {
59
+ tooltip.hidePopover()
60
+ }
61
+ }
62
+ }, 0)
63
+ }
64
+
56
65
  const tooltips = new Set<ToolTipElement>()
57
66
  const openTooltips = new Set<ToolTipElement>()
58
67
  class ToolTipElement extends HTMLElement {
59
68
  styles() {
60
69
  return `
61
70
  :host {
62
- padding: .5em .75em !important;
63
- font: normal normal 11px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
64
- -webkit-font-smoothing: subpixel-antialiased;
65
- color: var(--color-fg-on-emphasis) !important;
71
+ padding: var(--overlay-paddingBlock-condensed) var(--overlay-padding-condensed) !important;
72
+ font: var(--text-body-shorthand-small);
73
+ color: var(--fgColor-onEmphasis, var(--color-fg-on-emphasis)) !important;
66
74
  text-align: center;
67
75
  text-decoration: none;
68
76
  text-shadow: none;
@@ -70,25 +78,17 @@ class ToolTipElement extends HTMLElement {
70
78
  letter-spacing: normal;
71
79
  word-wrap: break-word;
72
80
  white-space: pre;
73
- background: var(--color-neutral-emphasis-plus) !important;
74
- border-radius: 6px;
81
+ background: var(--bgColor-emphasis, var(--color-neutral-emphasis-plus)) !important;
82
+ border-radius: var(--borderRadius-medium);
75
83
  border: 0 !important;
76
84
  opacity: 0;
77
- max-width: 250px;
85
+ max-width: var(--overlay-width-small);
78
86
  word-wrap: break-word;
79
87
  white-space: normal;
80
88
  width: max-content !important;
81
89
  inset: var(--tool-tip-position-top, 0) auto auto var(--tool-tip-position-left, 0) !important;
82
90
  overflow: visible !important;
83
- }
84
-
85
- :host:before{
86
- position: absolute;
87
- z-index: 1000001;
88
- color: var(--color-neutral-emphasis-plus);
89
- content: "";
90
- border: 6px solid transparent;
91
- opacity: 0
91
+ text-wrap: balance;
92
92
  }
93
93
 
94
94
  @keyframes tooltip-appear {
@@ -100,91 +100,19 @@ class ToolTipElement extends HTMLElement {
100
100
  }
101
101
  }
102
102
 
103
- :host:after{
104
- position: absolute;
105
- display: block;
106
- right: 0;
107
- left: 0;
108
- height: 12px;
109
- content: ""
110
- }
111
-
112
103
  :host(:popover-open),
113
104
  :host(:popover-open):before {
114
105
  animation-name: tooltip-appear;
115
106
  animation-duration: .1s;
116
107
  animation-fill-mode: forwards;
117
108
  animation-timing-function: ease-in;
118
- animation-delay: .4s
119
109
  }
120
110
 
121
- :host(.\\:popover-open),
122
- :host(.\\:popover-open):before {
111
+ :host(.\\:popover-open) {
123
112
  animation-name: tooltip-appear;
124
113
  animation-duration: .1s;
125
114
  animation-fill-mode: forwards;
126
115
  animation-timing-function: ease-in;
127
- animation-delay: .4s
128
- }
129
-
130
- :host(.tooltip-s):before,
131
- :host(.tooltip-n):before {
132
- right: 50%;
133
- margin-right: -${TOOLTIP_ARROW_EDGE_OFFSET}px;
134
- }
135
-
136
- :host(.tooltip-s):before,
137
- :host(.tooltip-se):before,
138
- :host(.tooltip-sw):before {
139
- bottom: 100%;
140
- border-bottom-color: var(--color-neutral-emphasis-plus)
141
- }
142
-
143
- :host(.tooltip-s):after,
144
- :host(.tooltip-se):after,
145
- :host(.tooltip-sw):after {
146
- bottom: 100%
147
- }
148
-
149
- :host(.tooltip-n):before,
150
- :host(.tooltip-ne):before,
151
- :host(.tooltip-nw):before {
152
- top: 100%;
153
- border-top-color: var(--color-neutral-emphasis-plus)
154
- }
155
-
156
- :host(.tooltip-n):after,
157
- :host(.tooltip-ne):after,
158
- :host(.tooltip-nw):after {
159
- top: 100%
160
- }
161
-
162
- :host(.tooltip-se):before,
163
- :host(.tooltip-ne):before {
164
- left: 0;
165
- margin-left: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
166
- }
167
-
168
- :host(.tooltip-sw):before,
169
- :host(.tooltip-nw):before {
170
- right: 0;
171
- margin-right: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
172
- }
173
-
174
- :host(.tooltip-w):before {
175
- top: 50%;
176
- bottom: 50%;
177
- left: 100%;
178
- margin-top: -6px;
179
- border-left-color: var(--color-neutral-emphasis-plus)
180
- }
181
-
182
- :host(.tooltip-e):before {
183
- top: 50%;
184
- right: 100%;
185
- bottom: 50%;
186
- margin-top: -6px;
187
- border-right-color: var(--color-neutral-emphasis-plus)
188
116
  }
189
117
  `
190
118
  }
@@ -193,6 +121,10 @@ class ToolTipElement extends HTMLElement {
193
121
  #align: AnchorAlignment = 'center'
194
122
  #side: AnchorSide = 'outside-bottom'
195
123
  #allowUpdatePosition = false
124
+ #showReason: 'focus' | 'mouse' = 'mouse'
125
+ get showReason() {
126
+ return this.#showReason
127
+ }
196
128
 
197
129
  get htmlFor(): string {
198
130
  return this.getAttribute('for') || ''
@@ -270,6 +202,7 @@ class ToolTipElement extends HTMLElement {
270
202
  signal
271
203
  })
272
204
  this.ownerDocument.addEventListener('focusout', focusOutListener)
205
+ this.ownerDocument.addEventListener('focusin', focusInListener)
273
206
  this.ownerDocument.addEventListener('keydown', this, {signal})
274
207
  }
275
208
 
@@ -297,6 +230,7 @@ class ToolTipElement extends HTMLElement {
297
230
 
298
231
  await Promise.resolve()
299
232
  if (!showing && shouldShow && !isPopoverOpen(this)) {
233
+ this.#showReason = event.type === 'mouseenter' ? 'mouse' : 'focus'
300
234
  this.showPopover()
301
235
  } else if (showing && shouldHide && isPopoverOpen(this)) {
302
236
  this.hidePopover()
@@ -29,6 +29,8 @@ module Primer
29
29
  TYPE_FALLBACK = :description
30
30
  TYPE_OPTIONS = [:label, :description].freeze
31
31
 
32
+ attr_reader :id
33
+
32
34
  # @param for_id [String] The ID of the element that the tooltip should be attached to.
33
35
  # @param type [Symbol] <%= one_of(Primer::Alpha::Tooltip::TYPE_OPTIONS) %>
34
36
  # @param direction [Symbol] <%= one_of(Primer::Alpha::Tooltip::DIRECTION_OPTIONS) %>
@@ -39,7 +41,7 @@ module Primer
39
41
 
40
42
  @text = text
41
43
  @system_arguments = system_arguments
42
- @system_arguments[:id] ||= self.class.generate_id
44
+ @id = @system_arguments[:id] ||= self.class.generate_id
43
45
  @system_arguments[:tag] = :"tool-tip"
44
46
  @system_arguments[:for] = for_id
45
47
  @system_arguments[:popover] = "manual"
@@ -19,12 +19,14 @@ module Primer
19
19
  # @param type [Symbol] <%= one_of(Primer::Beta::BaseButton::TYPE_OPTIONS) %>
20
20
  # @param block [Boolean] Whether button is full-width with `display: block`.
21
21
  # @param disabled [Boolean] Whether or not the button is disabled. If true, this option forces `tag:` to `:button`.
22
+ # @param inactive [Boolean] Whether the button looks visually disabled, but can still accept all the same interactions as an enabled button.
22
23
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
23
24
  def initialize(
24
25
  tag: DEFAULT_TAG,
25
26
  type: DEFAULT_TYPE,
26
27
  block: false,
27
28
  disabled: false,
29
+ inactive: false,
28
30
  **system_arguments
29
31
  )
30
32
  @system_arguments = system_arguments
@@ -37,6 +39,8 @@ module Primer
37
39
  "btn-block" => block
38
40
  )
39
41
 
42
+ @system_arguments[:"aria-disabled"] = true if inactive
43
+
40
44
  @disabled = disabled
41
45
  return unless @disabled
42
46
 
@@ -1 +1 @@
1
- :root{--duration-fast:80ms;--easing-easeInOut:cubic-bezier(0.65,0,0.35,1)}.Button{align-items:center;background-color:initial;border:var(--borderWidth-thin,max(1px,.0625rem)) solid;border-color:#0000;border-radius:var(--borderRadius-medium,.375rem);color:var(--button-default-fgColor-rest,var(--color-btn-text));cursor:pointer;display:inline-flex;flex-direction:row;font-size:var(--text-body-size-medium,.875rem);font-weight:var(--base-text-weight-medium,500);gap:var(--base-size-4,.25rem);height:var(--control-medium-size,2rem);justify-content:space-between;min-width:max-content;padding:0 var(--control-medium-paddingInline-normal,.75rem);position:relative;text-align:center;transition:var(--duration-fast) var(--easing-easeInOut);transition-property:color,fill,background-color,border-color;-webkit-user-select:none;user-select:none}@media (pointer:coarse){.Button:before{content:"";height:100%;left:50%;min-height:48px;min-width:48px;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:100%}}.Button:hover{transition-duration:var(--duration-fast)}.Button:active{transition:none}.Button:disabled,.Button[aria-disabled=true]{box-shadow:none;cursor:not-allowed}.Button-withTooltip{display:inline-block;position:relative}a.Button:hover,summary.Button:hover{text-decoration:none}.Button-content{align-items:center;display:grid;flex:1 0 auto;grid-template-areas:"leadingVisual text trailingVisual";grid-template-columns:min-content minmax(0,auto) min-content;place-content:center}.Button-content>:not(:last-child){margin-right:var(--control-medium-gap,.5rem)}.Button-content--alignStart{justify-content:start}.Button-visual{display:flex;pointer-events:none}.Button-visual .Counter{background-color:var(--buttonCounter-default-bgColor-rest,var(--color-btn-counter-bg));color:inherit}.Button-label{grid-area:text;line-height:var(--text-body-lineHeight-medium,1.4285);white-space:nowrap}.Button-leadingVisual{grid-area:leadingVisual}.Button-leadingVisual svg{fill:currentcolor}.Button-trailingVisual{grid-area:trailingVisual}.Button-trailingAction{margin-right:calc(var(--base-size-4,.25rem)*-1)}.Button--small{font-size:var(--text-body-size-small,.75rem);gap:var(--control-small-gap,.25rem);height:var(--control-small-size,1.75rem);padding:0 var(--control-small-paddingInline-condensed,.5rem)}.Button--small .Button-label{line-height:var(--text-body-lineHeight-small,1.6666)}.Button--small .Button-content>:not(:last-child){margin-right:var(--control-small-gap,.25rem)}.Button--large{gap:var(--control-large-gap,.5rem);height:var(--control-large-size,2.5rem);padding:0 var(--control-large-paddingInline-spacious,1rem)}.Button--large .Button-label{line-height:var(--text-body-lineHeight-large,1.5)}.Button--large .Button-content>:not(:last-child){margin-right:var(--control-large-gap,.5rem)}.Button--fullWidth{width:100%}.Button--primary{fill:var(--button-primary-iconColor-rest,var(--color-btn-primary-icon));background-color:var(--button-primary-bgColor-rest,var(--color-btn-primary-bg));border-color:var(--button-primary-borderColor-rest,var(--color-btn-primary-border));box-shadow:var(--shadow-resting-small,var(--color-btn-primary-shadow)),var(--shadow-highlight,var(--color-btn-primary-inset-shadow));color:var(--button-primary-fgColor-rest,var(--color-btn-primary-text))}.Button--primary:hover:not(:disabled){background-color:var(--button-primary-bgColor-hover,var(--color-btn-primary-hover-bg));border-color:var(--button-primary-borderColor-hover,var(--color-btn-primary-hover-border))}.Button--primary:focus{box-shadow:inset 0 0 0 3px var(--fgColor-onEmphasis,var(--color-fg-on-emphasis));outline:2px solid var(--focus-outlineColor,var(--color-accent-fg));outline-offset:-2px}.Button--primary:focus:not(:focus-visible){box-shadow:none;outline:1px solid #0000}.Button--primary:focus-visible{box-shadow:inset 0 0 0 3px var(--fgColor-onEmphasis,var(--color-fg-on-emphasis));outline:2px solid var(--focus-outlineColor,var(--color-accent-fg));outline-offset:-2px}.Button--primary:active:not(:disabled),.Button--primary[aria-pressed=true]{background-color:var(--button-primary-bgColor-active,var(--color-btn-primary-selected-bg));box-shadow:var(--button-primary-shadow-selected,var(--color-btn-primary-selected-shadow))}.Button--primary:disabled,.Button--primary[aria-disabled=true]{fill:var(--button-primary-fgColor-disabled,var(--color-btn-primary-disabled-text));background-color:var(--button-primary-bgColor-disabled,var(--color-btn-primary-disabled-bg));border-color:var(--button-primary-borderColor-disabled,var(--color-btn-primary-disabled-border));color:var(--button-primary-fgColor-disabled,var(--color-btn-primary-disabled-text))}.Button--primary .Counter{background-color:var(--buttonCounter-primary-bgColor-rest,var(--color-btn-primary-counter-bg));color:inherit}.Button--secondary{fill:var(--fgColor-muted,var(--color-fg-muted));background-color:var(--button-default-bgColor-rest,var(--color-btn-bg));border-color:var(--button-default-borderColor-rest,var(--color-btn-border));box-shadow:var(--button-default-shadow-resting,var(--color-btn-shadow)),var(--button-default-shadow-inset,var(--color-btn-inset-shadow));color:var(--button-default-fgColor-rest,var(--color-btn-text))}.Button--secondary:hover:not(:disabled){background-color:var(--button-default-bgColor-hover,var(--color-btn-hover-bg));border-color:var(--button-default-borderColor-hover,var(--color-btn-hover-border))}.Button--secondary:active:not(:disabled){background-color:var(--button-default-bgColor-active,var(--color-btn-active-bg));border-color:var(--button-default-borderColor-active,var(--color-btn-active-border))}.Button--secondary[aria-pressed=true]{background-color:var(--button-default-bgColor-selected,var(--color-btn-selected-bg));box-shadow:var(--shadow-inset,var(--color-primer-shadow-inset))}.Button--secondary:disabled,.Button--secondary[aria-disabled=true]{fill:var(--control-fgColor-disabled,var(--color-primer-fg-disabled));background-color:var(--button-default-bgColor-disabled);border-color:var(--button-default-borderColor-disabled);color:var(--control-fgColor-disabled,var(--color-primer-fg-disabled))}.Button--invisible{color:var(--button-default-fgColor-rest,var(--color-btn-text))}.Button--invisible:hover:not(:disabled){background-color:var(--button-invisible-bgColor-hover,var(--color-action-list-item-default-hover-bg))}.Button--invisible:active:not(:disabled),.Button--invisible[aria-pressed=true]{background-color:var(--button-invisible-bgColor-active,var(--color-action-list-item-default-active-bg))}.Button--invisible:disabled,.Button--invisible[aria-disabled=true]{fill:var(--button-invisible-fgColor-disabled,var(--color-primer-fg-disabled));background-color:var(--button-invisible-bgColor-disabled,var(--color-action-list-item-default-selected-bg));border-color:var(--button-invisible-borderColor-disabled);color:var(--button-invisible-fgColor-disabled,var(--color-primer-fg-disabled))}.Button--invisible.Button--invisible-noVisuals .Button-label{color:var(--button-invisible-fgColor-rest,var(--color-btn-outline-text))}.Button--invisible .Button-visual{color:var(--fgColor-muted,var(--color-fg-muted))}.Button--invisible .Button-visual .Counter{color:var(--fgColor-default,var(--color-fg-default))}.Button--link{fill:var(--fgColor-link,var(--color-accent-fg));border:none;color:var(--fgColor-link,var(--color-accent-fg));display:inline-block;font-size:inherit;height:unset;padding:0}.Button--link:hover:not(:disabled){text-decoration:underline}.Button--link:focus,.Button--link:focus-visible{outline-offset:2px}.Button--link:disabled,.Button--link[aria-disabled=true]{fill:var(--control-fgColor-disabled,var(--color-primer-fg-disabled));background-color:initial;border-color:#0000;color:var(--control-fgColor-disabled,var(--color-primer-fg-disabled))}.Button--danger{fill:var(--button-danger-iconColor-rest,var(--color-btn-danger-icon));background-color:var(--button-danger-bgColor-rest,var(--color-btn-bg));border-color:var(--button-danger-borderColor-rest,var(--color-btn-border));box-shadow:var(--button-default-shadow-resting,var(--color-btn-shadow)),var(--button-default-shadow-inset,var(--color-btn-inset-shadow));color:var(--button-danger-fgColor-rest,var(--color-btn-danger-text))}.Button--danger:hover:not(:disabled){fill:var(--button-danger-fgColor-hover,var(--color-btn-danger-hover-text));background-color:var(--button-danger-bgColor-hover,var(--color-btn-danger-hover-bg));border-color:var(--button-danger-borderColor-hover,var(--color-btn-danger-hover-border));box-shadow:var(--shadow-resting-small,var(--color-shadow-small)),var(--shadow-highlight,var(--color-primer-shadow-highlight));color:var(--button-danger-fgColor-hover,var(--color-btn-danger-hover-text))}.Button--danger:hover:not(:disabled) .Counter{background-color:var(--buttonCounter-danger-bgColor-hover,var(--color-btn-danger-hover-counter-bg));color:var(--buttonCounter-danger-fgColor-hover,var(--color-btn-danger-hover-counter-fg))}.Button--danger:active:not(:disabled),.Button--danger[aria-pressed=true]{fill:var(--button-danger-fgColor-active,var(--color-btn-danger-selected-text));background-color:var(--button-danger-bgColor-active,var(--color-btn-danger-selected-bg));border-color:var(--button-danger-borderColor-active,var(--color-btn-danger-selected-border));box-shadow:var(--button-danger-shadow-selected,var(--color-btn-danger-selected-shadow));color:var(--button-danger-fgColor-active,var(--color-btn-danger-selected-text))}.Button--danger:disabled,.Button--danger[aria-disabled=true]{fill:var(--button-danger-fgColor-disabled,var(--color-btn-danger-disabled-text));background-color:var(--button-danger-bgColor-disabled,var(--color-btn-danger-disabled-bg));border-color:var(--button-default-borderColor-disabled);color:var(--button-danger-fgColor-disabled,var(--color-btn-danger-disabled-text))}.Button--danger:disabled .Counter,.Button--danger[aria-disabled=true] .Counter{background-color:var(--buttonCounter-danger-bgColor-disabled,var(--color-btn-danger-disabled-counter-bg));color:var(--buttonCounter-danger-fgColor-disabled,var(--color-btn-danger-disabled-counter-fg))}.Button--danger .Counter{background-color:var(--buttonCounter-danger-bgColor-rest,var(--color-btn-danger-counter-bg));color:var(--buttonCounter-danger-fgColor-rest,var(--color-btn-danger-counter-fg))}.Button--iconOnly{display:inline-grid;padding:unset;place-content:center;width:var(--control-medium-size,2rem)}.Button--iconOnly.Button--small{width:var(--control-small-size,1.75rem)}.Button--iconOnly.Button--large{width:var(--control-large-size,2.5rem)}
1
+ :root{--duration-fast:80ms;--easing-easeInOut:cubic-bezier(0.65,0,0.35,1)}.Button{align-items:center;background-color:initial;border:var(--borderWidth-thin,max(1px,.0625rem)) solid;border-color:#0000;border-radius:var(--borderRadius-medium,.375rem);color:var(--button-default-fgColor-rest,var(--color-btn-text));cursor:pointer;display:inline-flex;flex-direction:row;font-size:var(--text-body-size-medium,.875rem);font-weight:var(--base-text-weight-medium,500);gap:var(--base-size-4,.25rem);height:var(--control-medium-size,2rem);justify-content:space-between;min-width:max-content;padding:0 var(--control-medium-paddingInline-normal,.75rem);position:relative;text-align:center;transition:var(--duration-fast) var(--easing-easeInOut);transition-property:color,fill,background-color,border-color;-webkit-user-select:none;user-select:none}@media (pointer:coarse){.Button:before{content:"";height:100%;left:50%;min-height:48px;min-width:48px;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:100%}}.Button:hover{transition-duration:var(--duration-fast)}.Button:active{transition:none}.Button:disabled{box-shadow:none;cursor:not-allowed}.Button[aria-disabled=true]{box-shadow:none;cursor:default}.Button-withTooltip{display:inline-block;position:relative}a.Button:hover,summary.Button:hover{text-decoration:none}.Button-content{align-items:center;display:grid;flex:1 0 auto;grid-template-areas:"leadingVisual text trailingVisual";grid-template-columns:min-content minmax(0,auto) min-content;place-content:center}.Button-content>:not(:last-child){margin-right:var(--control-medium-gap,.5rem)}.Button-content--alignStart{justify-content:start}.Button-visual{display:flex;pointer-events:none}.Button-visual .Counter{background-color:var(--buttonCounter-default-bgColor-rest,var(--color-btn-counter-bg));color:inherit}.Button-label{grid-area:text;line-height:var(--text-body-lineHeight-medium,1.4285);white-space:nowrap}.Button-leadingVisual{grid-area:leadingVisual}.Button-leadingVisual svg{fill:currentcolor}.Button-trailingVisual{grid-area:trailingVisual}.Button-trailingAction{margin-right:calc(var(--base-size-4,.25rem)*-1)}.Button--small{font-size:var(--text-body-size-small,.75rem);gap:var(--control-small-gap,.25rem);height:var(--control-small-size,1.75rem);padding:0 var(--control-small-paddingInline-condensed,.5rem)}.Button--small .Button-label{line-height:var(--text-body-lineHeight-small,1.6666)}.Button--small .Button-content>:not(:last-child){margin-right:var(--control-small-gap,.25rem)}.Button--large{gap:var(--control-large-gap,.5rem);height:var(--control-large-size,2.5rem);padding:0 var(--control-large-paddingInline-spacious,1rem)}.Button--large .Button-label{line-height:var(--text-body-lineHeight-large,1.5)}.Button--large .Button-content>:not(:last-child){margin-right:var(--control-large-gap,.5rem)}.Button--fullWidth{width:100%}.Button--primary{fill:var(--button-primary-iconColor-rest,var(--color-btn-primary-icon));background-color:var(--button-primary-bgColor-rest,var(--color-btn-primary-bg));border-color:var(--button-primary-borderColor-rest,var(--color-btn-primary-border));box-shadow:var(--shadow-resting-small,var(--color-btn-primary-shadow));color:var(--button-primary-fgColor-rest,var(--color-btn-primary-text))}.Button--primary:hover:not(:disabled){background-color:var(--button-primary-bgColor-hover,var(--color-btn-primary-hover-bg));border-color:var(--button-primary-borderColor-hover,var(--color-btn-primary-hover-border))}.Button--primary:focus{box-shadow:inset 0 0 0 3px var(--fgColor-onEmphasis,var(--color-fg-on-emphasis));outline:2px solid var(--focus-outlineColor,var(--color-accent-fg));outline-offset:-2px}.Button--primary:focus:not(:focus-visible){box-shadow:none;outline:1px solid #0000}.Button--primary:focus-visible{box-shadow:inset 0 0 0 3px var(--fgColor-onEmphasis,var(--color-fg-on-emphasis));outline:2px solid var(--focus-outlineColor,var(--color-accent-fg));outline-offset:-2px}.Button--primary:active:not(:disabled),.Button--primary[aria-pressed=true]{background-color:var(--button-primary-bgColor-active,var(--color-btn-primary-selected-bg));box-shadow:var(--button-primary-shadow-selected,var(--color-btn-primary-selected-shadow))}.Button--primary:disabled,.Button--primary[aria-disabled=true]{fill:var(--button-primary-fgColor-disabled,var(--color-btn-primary-disabled-text));background-color:var(--button-primary-bgColor-disabled,var(--color-btn-primary-disabled-bg));border-color:var(--button-primary-borderColor-disabled,var(--color-btn-primary-disabled-border));color:var(--button-primary-fgColor-disabled,var(--color-btn-primary-disabled-text))}.Button--primary .Counter{background-color:var(--buttonCounter-primary-bgColor-rest,var(--color-btn-primary-counter-bg));color:inherit}.Button--secondary{fill:var(--fgColor-muted,var(--color-fg-muted));background-color:var(--button-default-bgColor-rest,var(--color-btn-bg));border-color:var(--button-default-borderColor-rest,var(--color-btn-border));box-shadow:var(--button-default-shadow-resting,var(--color-btn-shadow)),var(--button-default-shadow-inset,var(--color-btn-inset-shadow));color:var(--button-default-fgColor-rest,var(--color-btn-text))}.Button--secondary:hover:not(:disabled){background-color:var(--button-default-bgColor-hover,var(--color-btn-hover-bg));border-color:var(--button-default-borderColor-hover,var(--color-btn-hover-border))}.Button--secondary:active:not(:disabled){background-color:var(--button-default-bgColor-active,var(--color-btn-active-bg));border-color:var(--button-default-borderColor-active,var(--color-btn-active-border))}.Button--secondary[aria-pressed=true]{background-color:var(--button-default-bgColor-selected,var(--color-btn-selected-bg));box-shadow:var(--shadow-inset,var(--color-primer-shadow-inset))}.Button--secondary:disabled,.Button--secondary[aria-disabled=true]{fill:var(--control-fgColor-disabled,var(--color-primer-fg-disabled));background-color:var(--button-default-bgColor-disabled,var(--color-btn-bg));border-color:var(--button-default-borderColor-disabled,var(--color-btn-border));color:var(--control-fgColor-disabled,var(--color-primer-fg-disabled))}.Button--invisible{color:var(--button-default-fgColor-rest,var(--color-btn-text))}.Button--invisible.Button--iconOnly{color:var(--button-invisible-iconColor-rest,var(--color-fg-muted))}.Button--invisible:hover:not(:disabled){background-color:var(--button-invisible-bgColor-hover,var(--color-action-list-item-default-hover-bg))}.Button--invisible:hover:not(:disabled) .Button-visual{color:var(--button-invisible-iconColor-hover,var(--color-fg-default))}.Button--invisible:active:not(:disabled),.Button--invisible[aria-pressed=true]{background-color:var(--button-invisible-bgColor-active,var(--color-action-list-item-default-active-bg))}.Button--invisible:disabled,.Button--invisible[aria-disabled=true]{fill:var(--button-invisible-fgColor-disabled,var(--color-primer-fg-disabled));background-color:var(--button-invisible-bgColor-disabled,var(--color-action-list-item-default-selected-bg));border-color:var(--button-invisible-borderColor-disabled,var(--color-action-list-item-default-selected-bg));color:var(--button-invisible-fgColor-disabled,var(--color-primer-fg-disabled))}.Button--invisible.Button--invisible-noVisuals .Button-label{color:var(--button-invisible-fgColor-rest,var(--color-btn-outline-text))}.Button--invisible .Button-visual{color:var(--button-invisible-iconColor-rest,var(--color-fg-muted))}.Button--invisible .Button-visual .Counter{color:var(--fgColor-default,var(--color-fg-default))}.Button--link{fill:var(--fgColor-link,var(--color-accent-fg));border:none;color:var(--fgColor-link,var(--color-accent-fg));display:inline-block;font-size:inherit;height:unset;padding:0}.Button--link:hover:not(:disabled){text-decoration:underline}.Button--link:focus,.Button--link:focus-visible{outline-offset:2px}.Button--link:disabled,.Button--link[aria-disabled=true]{fill:var(--control-fgColor-disabled,var(--color-primer-fg-disabled));background-color:initial;border-color:#0000;color:var(--control-fgColor-disabled,var(--color-primer-fg-disabled))}.Button--danger{fill:var(--button-danger-iconColor-rest,var(--color-btn-danger-icon));background-color:var(--button-danger-bgColor-rest,var(--color-btn-bg));border-color:var(--button-danger-borderColor-rest,var(--color-btn-border));box-shadow:var(--button-default-shadow-resting,var(--color-btn-shadow)),var(--button-default-shadow-inset,var(--color-btn-inset-shadow));color:var(--button-danger-fgColor-rest,var(--color-btn-danger-text))}.Button--danger:hover:not(:disabled){fill:var(--button-danger-fgColor-hover,var(--color-btn-danger-hover-text));background-color:var(--button-danger-bgColor-hover,var(--color-btn-danger-hover-bg));border-color:var(--button-danger-borderColor-hover,var(--color-btn-danger-hover-border));box-shadow:var(--shadow-resting-small,var(--color-shadow-small));color:var(--button-danger-fgColor-hover,var(--color-btn-danger-hover-text))}.Button--danger:hover:not(:disabled) .Counter{background-color:var(--buttonCounter-danger-bgColor-hover,var(--color-btn-danger-hover-counter-bg));color:var(--buttonCounter-danger-fgColor-hover,var(--color-btn-danger-hover-counter-fg))}.Button--danger:active:not(:disabled),.Button--danger[aria-pressed=true]{fill:var(--button-danger-fgColor-active,var(--color-btn-danger-selected-text));background-color:var(--button-danger-bgColor-active,var(--color-btn-danger-selected-bg));border-color:var(--button-danger-borderColor-active,var(--color-btn-danger-selected-border));box-shadow:var(--button-danger-shadow-selected,var(--color-btn-danger-selected-shadow));color:var(--button-danger-fgColor-active,var(--color-btn-danger-selected-text))}.Button--danger:disabled,.Button--danger[aria-disabled=true]{fill:var(--button-danger-fgColor-disabled,var(--color-btn-danger-disabled-text));background-color:var(--button-danger-bgColor-disabled,var(--color-btn-danger-disabled-bg));border-color:var(--button-default-borderColor-disabled,var(--color-btn-border));color:var(--button-danger-fgColor-disabled,var(--color-btn-danger-disabled-text))}.Button--danger:disabled .Counter,.Button--danger[aria-disabled=true] .Counter{background-color:var(--buttonCounter-danger-bgColor-disabled,var(--color-btn-danger-disabled-counter-bg));color:var(--buttonCounter-danger-fgColor-disabled,var(--color-btn-danger-disabled-counter-fg))}.Button--danger .Counter{background-color:var(--buttonCounter-danger-bgColor-rest,var(--color-btn-danger-counter-bg));color:var(--buttonCounter-danger-fgColor-rest,var(--color-btn-danger-counter-fg))}.Button--iconOnly{display:inline-grid;padding:unset;place-content:center;width:var(--control-medium-size,2rem)}.Button--iconOnly.Button--small{width:var(--control-small-size,1.75rem)}.Button--iconOnly.Button--large{width:var(--control-large-size,2.5rem)}
@@ -45,7 +45,9 @@
45
45
  ".Button--secondary:disabled",
46
46
  ".Button--secondary[aria-disabled=true]",
47
47
  ".Button--invisible",
48
+ ".Button--invisible.Button--iconOnly",
48
49
  ".Button--invisible:hover:not(:disabled)",
50
+ ".Button--invisible:hover:not(:disabled) .Button-visual",
49
51
  ".Button--invisible:active:not(:disabled)",
50
52
  ".Button--invisible[aria-pressed=true]",
51
53
  ".Button--invisible:disabled",
@@ -1 +1 @@
1
- {"version":3,"sources":["button.pcss","<no source>","../../../../lib/postcss_mixins/focusOutlineOnEmphasis.pcss"],"names":[],"mappings":"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","file":"button.css","sourcesContent":["/* CSS for Button */\n\n/* temporary, pre primitives release */\n:root {\n --duration-fast: 80ms;\n --easing-easeInOut: cubic-bezier(0.65, 0, 0.35, 1);\n}\n\n/* base button */\n.Button {\n position: relative;\n font-size: var(--text-body-size-medium);\n font-weight: var(--base-text-weight-medium);\n cursor: pointer;\n user-select: none;\n background-color: transparent;\n border: var(--borderWidth-thin) solid;\n border-color: transparent;\n border-radius: var(--borderRadius-medium);\n color: var(--button-default-fgColor-rest);\n transition: var(--duration-fast) var(--easing-easeInOut);\n transition-property: color, fill, background-color, border-color;\n text-align: center;\n height: var(--control-medium-size);\n padding: 0 var(--control-medium-paddingInline-normal);\n display: inline-flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: var(--base-size-4);\n min-width: max-content;\n\n /* mobile friendly sizing */\n @media (pointer: coarse) {\n &::before {\n @mixin minTouchTarget 48px, 48px;\n }\n }\n\n /* base states */\n\n &:hover {\n transition-duration: var(--duration-fast);\n }\n\n &:active {\n transition: none;\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n cursor: not-allowed;\n box-shadow: none;\n }\n}\n\n.Button-withTooltip {\n position: relative;\n display: inline-block;\n}\n\na.Button,\nsummary.Button {\n &:hover {\n text-decoration: none;\n }\n}\n\n/* wrap grid content to allow trailingAction to lock-right */\n.Button-content {\n flex: 1 0 auto;\n display: grid;\n grid-template-areas: 'leadingVisual text trailingVisual';\n grid-template-columns: min-content minmax(0, auto) min-content;\n align-items: center;\n place-content: center;\n\n /* padding-bottom: 1px; optical alignment for firefox */\n\n & > :not(:last-child) {\n margin-right: var(--control-medium-gap);\n }\n}\n\n/* center child elements for fullWidth */\n.Button-content--alignStart {\n justify-content: start;\n}\n\n/* button child elements */\n\n/* align svg */\n.Button-visual {\n display: flex;\n pointer-events: none; /* allow click handler to work, avoiding visuals */\n\n & .Counter {\n color: inherit;\n background-color: var(--buttonCounter-default-bgColor-rest);\n }\n}\n\n.Button-label {\n grid-area: text;\n white-space: nowrap;\n line-height: var(--text-body-lineHeight-medium);\n}\n\n.Button-leadingVisual {\n grid-area: leadingVisual;\n}\n\n.Button-leadingVisual svg {\n fill: currentcolor;\n}\n\n.Button-trailingVisual {\n grid-area: trailingVisual;\n}\n\n.Button-trailingAction {\n margin-right: calc(var(--base-size-4) * -1);\n}\n\n/* sizes */\n\n.Button--small {\n font-size: var(--text-body-size-small);\n height: var(--control-small-size);\n padding: 0 var(--control-small-paddingInline-condensed);\n gap: var(--control-small-gap);\n\n & .Button-label {\n line-height: var(--text-body-lineHeight-small);\n }\n\n & .Button-content {\n & > :not(:last-child) {\n margin-right: var(--control-small-gap);\n }\n }\n}\n\n.Button--large {\n height: var(--control-large-size);\n padding: 0 var(--control-large-paddingInline-spacious);\n gap: var(--control-large-gap);\n\n & .Button-label {\n line-height: var(--text-body-lineHeight-large);\n }\n\n & .Button-content {\n & > :not(:last-child) {\n margin-right: var(--control-large-gap);\n }\n }\n}\n\n.Button--fullWidth {\n width: 100%;\n}\n\n/* variants */\n\n/* primary */\n.Button--primary {\n color: var(--button-primary-fgColor-rest);\n fill: var(--button-primary-iconColor-rest);\n background-color: var(--button-primary-bgColor-rest);\n border-color: var(--button-primary-borderColor-rest);\n box-shadow: var(--shadow-resting-small, var(--color-btn-primary-shadow)), var(--shadow-highlight, var(--color-btn-primary-inset-shadow));\n\n &:hover:not(:disabled) {\n background-color: var(--button-primary-bgColor-hover);\n border-color: var(--button-primary-borderColor-hover);\n }\n\n /* fallback :focus state */\n &:focus {\n @mixin focusOutlineOnEmphasis;\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n box-shadow: none;\n }\n }\n\n /* default focus state */\n &:focus-visible {\n @mixin focusOutlineOnEmphasis;\n }\n\n &:active:not(:disabled),\n &[aria-pressed='true'] {\n background-color: var(--button-primary-bgColor-active);\n box-shadow: var(--button-primary-shadow-selected);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--button-primary-fgColor-disabled);\n background-color: var(--button-primary-bgColor-disabled);\n border-color: var(--button-primary-borderColor-disabled);\n fill: var(--button-primary-fgColor-disabled);\n }\n\n & .Counter {\n color: inherit;\n background-color: var(--buttonCounter-primary-bgColor-rest);\n }\n}\n\n/* default (secondary) */\n.Button--secondary {\n color: var(--button-default-fgColor-rest);\n fill: var(--fgColor-muted); /* help this */\n background-color: var(--button-default-bgColor-rest);\n border-color: var(--button-default-borderColor-rest);\n box-shadow: var(--button-default-shadow-resting), var(--button-default-shadow-inset);\n\n &:hover:not(:disabled) {\n background-color: var(--button-default-bgColor-hover);\n border-color: var(--button-default-borderColor-hover);\n }\n\n &:active:not(:disabled) {\n background-color: var(--button-default-bgColor-active);\n border-color: var(--button-default-borderColor-active);\n }\n\n &[aria-pressed='true'] {\n background-color: var(--button-default-bgColor-selected);\n box-shadow: var(--shadow-inset);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--control-fgColor-disabled);\n background-color: var(--button-default-bgColor-disabled);\n border-color: var(--button-default-borderColor-disabled);\n fill: var(--control-fgColor-disabled);\n }\n}\n\n.Button--invisible {\n color: var(--button-default-fgColor-rest);\n\n &:hover:not(:disabled) {\n background-color: var(--button-invisible-bgColor-hover);\n }\n\n &[aria-pressed='true'],\n &:active:not(:disabled) {\n background-color: var(--button-invisible-bgColor-active);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--button-invisible-fgColor-disabled);\n background-color: var(--button-invisible-bgColor-disabled);\n border-color: var(--button-invisible-borderColor-disabled);\n fill: var(--button-invisible-fgColor-disabled);\n }\n\n /* if button has no visuals, use link blue for text */\n &.Button--invisible-noVisuals .Button-label {\n color: var(--button-invisible-fgColor-rest);\n }\n\n & .Button-visual {\n color: var(--fgColor-muted);\n\n & .Counter {\n color: var(--fgColor-default);\n }\n }\n}\n\n.Button--link {\n color: var(--fgColor-link);\n fill: var(--fgColor-link);\n display: inline-block;\n font-size: inherit;\n border: none;\n height: unset;\n padding: 0;\n\n &:hover:not(:disabled) {\n text-decoration: underline;\n }\n\n &:focus-visible,\n &:focus {\n outline-offset: 2px;\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--control-fgColor-disabled);\n background-color: transparent;\n border-color: transparent;\n fill: var(--control-fgColor-disabled);\n }\n}\n\n/* danger */\n.Button--danger {\n color: var(--button-danger-fgColor-rest);\n fill: var(--button-danger-iconColor-rest);\n background-color: var(--button-danger-bgColor-rest);\n border-color: var(--button-danger-borderColor-rest);\n box-shadow: var(--button-default-shadow-resting), var(--button-default-shadow-inset);\n\n &:hover:not(:disabled) {\n color: var(--button-danger-fgColor-hover);\n fill: var(--button-danger-fgColor-hover);\n background-color: var(--button-danger-bgColor-hover);\n border-color: var(--button-danger-borderColor-hover);\n box-shadow: var(--shadow-resting-small), var(--shadow-highlight);\n\n & .Counter {\n color: var(--buttonCounter-danger-fgColor-hover);\n background-color: var(--buttonCounter-danger-bgColor-hover);\n }\n }\n\n &:active:not(:disabled),\n &[aria-pressed='true'] {\n color: var(--button-danger-fgColor-active);\n fill: var(--button-danger-fgColor-active);\n background-color: var(--button-danger-bgColor-active);\n border-color: var(--button-danger-borderColor-active);\n box-shadow: var(--button-danger-shadow-selected);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--button-danger-fgColor-disabled);\n fill: var(--button-danger-fgColor-disabled);\n background-color: var(--button-danger-bgColor-disabled);\n border-color: var(--button-default-borderColor-disabled);\n\n & .Counter {\n color: var(--buttonCounter-danger-fgColor-disabled);\n background-color: var(--buttonCounter-danger-bgColor-disabled);\n }\n }\n\n & .Counter {\n color: var(--buttonCounter-danger-fgColor-rest);\n background-color: var(--buttonCounter-danger-bgColor-rest);\n }\n}\n\n.Button--iconOnly {\n display: inline-grid;\n place-content: center;\n padding: unset;\n width: var(--control-medium-size);\n\n &.Button--small {\n width: var(--control-small-size);\n }\n\n &.Button--large {\n width: var(--control-large-size);\n }\n}\n",null,"/* outline with fg box-shadow for buttons */\n@define-mixin focusOutlineOnEmphasis $outlineOffset: -2px, $outlineColor: var(--focus-outlineColor) {\n outline: 2px solid $outlineColor;\n outline-offset: $outlineOffset;\n box-shadow: inset 0 0 0 3px var(--fgColor-onEmphasis);\n}\n"]}
1
+ {"version":3,"sources":["button.pcss","<no source>","../../../../lib/postcss_mixins/focusOutlineOnEmphasis.pcss"],"names":[],"mappings":"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","file":"button.css","sourcesContent":["/* CSS for Button */\n\n/* temporary, pre primitives release */\n:root {\n --duration-fast: 80ms;\n --easing-easeInOut: cubic-bezier(0.65, 0, 0.35, 1);\n}\n\n/* base button */\n.Button {\n position: relative;\n font-size: var(--text-body-size-medium);\n font-weight: var(--base-text-weight-medium);\n cursor: pointer;\n user-select: none;\n background-color: transparent;\n border: var(--borderWidth-thin) solid;\n border-color: transparent;\n border-radius: var(--borderRadius-medium);\n color: var(--button-default-fgColor-rest);\n transition: var(--duration-fast) var(--easing-easeInOut);\n transition-property: color, fill, background-color, border-color;\n text-align: center;\n height: var(--control-medium-size);\n padding: 0 var(--control-medium-paddingInline-normal);\n display: inline-flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: var(--base-size-4);\n min-width: max-content;\n\n /* mobile friendly sizing */\n @media (pointer: coarse) {\n &::before {\n @mixin minTouchTarget 48px, 48px;\n }\n }\n\n /* base states */\n\n &:hover {\n transition-duration: var(--duration-fast);\n }\n\n &:active {\n transition: none;\n }\n\n &:disabled {\n cursor: not-allowed;\n box-shadow: none;\n }\n\n &[aria-disabled='true'] {\n cursor: default;\n box-shadow: none;\n }\n}\n\n.Button-withTooltip {\n position: relative;\n display: inline-block;\n}\n\na.Button,\nsummary.Button {\n &:hover {\n text-decoration: none;\n }\n}\n\n/* wrap grid content to allow trailingAction to lock-right */\n.Button-content {\n flex: 1 0 auto;\n display: grid;\n grid-template-areas: 'leadingVisual text trailingVisual';\n grid-template-columns: min-content minmax(0, auto) min-content;\n align-items: center;\n place-content: center;\n\n /* padding-bottom: 1px; optical alignment for firefox */\n\n & > :not(:last-child) {\n margin-right: var(--control-medium-gap);\n }\n}\n\n/* center child elements for fullWidth */\n.Button-content--alignStart {\n justify-content: start;\n}\n\n/* button child elements */\n\n/* align svg */\n.Button-visual {\n display: flex;\n pointer-events: none; /* allow click handler to work, avoiding visuals */\n\n & .Counter {\n color: inherit;\n background-color: var(--buttonCounter-default-bgColor-rest);\n }\n}\n\n.Button-label {\n grid-area: text;\n white-space: nowrap;\n line-height: var(--text-body-lineHeight-medium);\n}\n\n.Button-leadingVisual {\n grid-area: leadingVisual;\n}\n\n.Button-leadingVisual svg {\n fill: currentcolor;\n}\n\n.Button-trailingVisual {\n grid-area: trailingVisual;\n}\n\n.Button-trailingAction {\n margin-right: calc(var(--base-size-4) * -1);\n}\n\n/* sizes */\n\n.Button--small {\n font-size: var(--text-body-size-small);\n height: var(--control-small-size);\n padding: 0 var(--control-small-paddingInline-condensed);\n gap: var(--control-small-gap);\n\n & .Button-label {\n line-height: var(--text-body-lineHeight-small);\n }\n\n & .Button-content {\n & > :not(:last-child) {\n margin-right: var(--control-small-gap);\n }\n }\n}\n\n.Button--large {\n height: var(--control-large-size);\n padding: 0 var(--control-large-paddingInline-spacious);\n gap: var(--control-large-gap);\n\n & .Button-label {\n line-height: var(--text-body-lineHeight-large);\n }\n\n & .Button-content {\n & > :not(:last-child) {\n margin-right: var(--control-large-gap);\n }\n }\n}\n\n.Button--fullWidth {\n width: 100%;\n}\n\n/* variants */\n\n/* primary */\n.Button--primary {\n color: var(--button-primary-fgColor-rest);\n fill: var(--button-primary-iconColor-rest);\n background-color: var(--button-primary-bgColor-rest);\n border-color: var(--button-primary-borderColor-rest);\n box-shadow: var(--shadow-resting-small, var(--color-btn-primary-shadow));\n\n &:hover:not(:disabled) {\n background-color: var(--button-primary-bgColor-hover);\n border-color: var(--button-primary-borderColor-hover);\n }\n\n /* fallback :focus state */\n &:focus {\n @mixin focusOutlineOnEmphasis;\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n box-shadow: none;\n }\n }\n\n /* default focus state */\n &:focus-visible {\n @mixin focusOutlineOnEmphasis;\n }\n\n &:active:not(:disabled),\n &[aria-pressed='true'] {\n background-color: var(--button-primary-bgColor-active);\n box-shadow: var(--button-primary-shadow-selected);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--button-primary-fgColor-disabled);\n background-color: var(--button-primary-bgColor-disabled);\n border-color: var(--button-primary-borderColor-disabled);\n fill: var(--button-primary-fgColor-disabled);\n }\n\n & .Counter {\n color: inherit;\n background-color: var(--buttonCounter-primary-bgColor-rest);\n }\n}\n\n/* default (secondary) */\n.Button--secondary {\n color: var(--button-default-fgColor-rest);\n fill: var(--fgColor-muted); /* help this */\n background-color: var(--button-default-bgColor-rest);\n border-color: var(--button-default-borderColor-rest);\n box-shadow: var(--button-default-shadow-resting), var(--button-default-shadow-inset);\n\n &:hover:not(:disabled) {\n background-color: var(--button-default-bgColor-hover);\n border-color: var(--button-default-borderColor-hover);\n }\n\n &:active:not(:disabled) {\n background-color: var(--button-default-bgColor-active);\n border-color: var(--button-default-borderColor-active);\n }\n\n &[aria-pressed='true'] {\n background-color: var(--button-default-bgColor-selected);\n box-shadow: var(--shadow-inset);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--control-fgColor-disabled);\n background-color: var(--button-default-bgColor-disabled);\n border-color: var(--button-default-borderColor-disabled);\n fill: var(--control-fgColor-disabled);\n }\n}\n\n.Button--invisible {\n color: var(--button-default-fgColor-rest);\n\n &.Button--iconOnly {\n color: var(--button-invisible-iconColor-rest, var(--color-fg-muted));\n }\n\n &:hover:not(:disabled) {\n background-color: var(--button-invisible-bgColor-hover);\n\n & .Button-visual {\n color: var(--button-invisible-iconColor-hover, var(--color-fg-default));\n }\n }\n\n &[aria-pressed='true'],\n &:active:not(:disabled) {\n background-color: var(--button-invisible-bgColor-active);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--button-invisible-fgColor-disabled);\n background-color: var(--button-invisible-bgColor-disabled);\n border-color: var(--button-invisible-borderColor-disabled);\n fill: var(--button-invisible-fgColor-disabled);\n }\n\n /* if button has no visuals, use link blue for text */\n &.Button--invisible-noVisuals .Button-label {\n color: var(--button-invisible-fgColor-rest);\n }\n\n & .Button-visual {\n color: var(--button-invisible-iconColor-rest, var(--color-fg-muted));\n\n & .Counter {\n color: var(--fgColor-default);\n }\n }\n}\n\n.Button--link {\n color: var(--fgColor-link);\n fill: var(--fgColor-link);\n display: inline-block;\n font-size: inherit;\n border: none;\n height: unset;\n padding: 0;\n\n &:hover:not(:disabled) {\n text-decoration: underline;\n }\n\n &:focus-visible,\n &:focus {\n outline-offset: 2px;\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--control-fgColor-disabled);\n background-color: transparent;\n border-color: transparent;\n fill: var(--control-fgColor-disabled);\n }\n}\n\n/* danger */\n.Button--danger {\n color: var(--button-danger-fgColor-rest);\n fill: var(--button-danger-iconColor-rest);\n background-color: var(--button-danger-bgColor-rest);\n border-color: var(--button-danger-borderColor-rest);\n box-shadow: var(--button-default-shadow-resting), var(--button-default-shadow-inset);\n\n &:hover:not(:disabled) {\n color: var(--button-danger-fgColor-hover);\n fill: var(--button-danger-fgColor-hover);\n background-color: var(--button-danger-bgColor-hover);\n border-color: var(--button-danger-borderColor-hover);\n box-shadow: var(--shadow-resting-small);\n\n & .Counter {\n color: var(--buttonCounter-danger-fgColor-hover);\n background-color: var(--buttonCounter-danger-bgColor-hover);\n }\n }\n\n &:active:not(:disabled),\n &[aria-pressed='true'] {\n color: var(--button-danger-fgColor-active);\n fill: var(--button-danger-fgColor-active);\n background-color: var(--button-danger-bgColor-active);\n border-color: var(--button-danger-borderColor-active);\n box-shadow: var(--button-danger-shadow-selected);\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n color: var(--button-danger-fgColor-disabled);\n fill: var(--button-danger-fgColor-disabled);\n background-color: var(--button-danger-bgColor-disabled);\n border-color: var(--button-default-borderColor-disabled);\n\n & .Counter {\n color: var(--buttonCounter-danger-fgColor-disabled);\n background-color: var(--buttonCounter-danger-bgColor-disabled);\n }\n }\n\n & .Counter {\n color: var(--buttonCounter-danger-fgColor-rest);\n background-color: var(--buttonCounter-danger-bgColor-rest);\n }\n}\n\n.Button--iconOnly {\n display: inline-grid;\n place-content: center;\n padding: unset;\n width: var(--control-medium-size);\n\n &.Button--small {\n width: var(--control-small-size);\n }\n\n &.Button--large {\n width: var(--control-large-size);\n }\n}\n",null,"/* outline with fg box-shadow for buttons */\n@define-mixin focusOutlineOnEmphasis $outlineOffset: -2px, $outlineColor: var(--focus-outlineColor) {\n outline: 2px solid $outlineColor;\n outline-offset: $outlineOffset;\n box-shadow: inset 0 0 0 3px var(--fgColor-onEmphasis);\n}\n"]}
@@ -47,11 +47,15 @@
47
47
  transition: none;
48
48
  }
49
49
 
50
- &:disabled,
51
- &[aria-disabled='true'] {
50
+ &:disabled {
52
51
  cursor: not-allowed;
53
52
  box-shadow: none;
54
53
  }
54
+
55
+ &[aria-disabled='true'] {
56
+ cursor: default;
57
+ box-shadow: none;
58
+ }
55
59
  }
56
60
 
57
61
  .Button-withTooltip {
@@ -169,7 +173,7 @@ summary.Button {
169
173
  fill: var(--button-primary-iconColor-rest);
170
174
  background-color: var(--button-primary-bgColor-rest);
171
175
  border-color: var(--button-primary-borderColor-rest);
172
- box-shadow: var(--shadow-resting-small, var(--color-btn-primary-shadow)), var(--shadow-highlight, var(--color-btn-primary-inset-shadow));
176
+ box-shadow: var(--shadow-resting-small, var(--color-btn-primary-shadow));
173
177
 
174
178
  &:hover:not(:disabled) {
175
179
  background-color: var(--button-primary-bgColor-hover);
@@ -247,8 +251,16 @@ summary.Button {
247
251
  .Button--invisible {
248
252
  color: var(--button-default-fgColor-rest);
249
253
 
254
+ &.Button--iconOnly {
255
+ color: var(--button-invisible-iconColor-rest, var(--color-fg-muted));
256
+ }
257
+
250
258
  &:hover:not(:disabled) {
251
259
  background-color: var(--button-invisible-bgColor-hover);
260
+
261
+ & .Button-visual {
262
+ color: var(--button-invisible-iconColor-hover, var(--color-fg-default));
263
+ }
252
264
  }
253
265
 
254
266
  &[aria-pressed='true'],
@@ -270,7 +282,7 @@ summary.Button {
270
282
  }
271
283
 
272
284
  & .Button-visual {
273
- color: var(--fgColor-muted);
285
+ color: var(--button-invisible-iconColor-rest, var(--color-fg-muted));
274
286
 
275
287
  & .Counter {
276
288
  color: var(--fgColor-default);
@@ -318,7 +330,7 @@ summary.Button {
318
330
  fill: var(--button-danger-fgColor-hover);
319
331
  background-color: var(--button-danger-bgColor-hover);
320
332
  border-color: var(--button-danger-borderColor-hover);
321
- box-shadow: var(--shadow-resting-small), var(--shadow-highlight);
333
+ box-shadow: var(--shadow-resting-small);
322
334
 
323
335
  & .Counter {
324
336
  color: var(--buttonCounter-danger-fgColor-hover);
@@ -2,5 +2,5 @@
2
2
  <%= render Primer::Beta::BaseButton.new(**@system_arguments) do -%>
3
3
  <%= render Primer::Beta::Octicon.new(icon: @icon, classes: "Button-visual") %>
4
4
  <% end -%>
5
- <%= render Primer::Alpha::Tooltip.new(**@tooltip_arguments) if render_tooltip? %>
5
+ <%= render @tooltip if render_tooltip? %>
6
6
  <% end %>
@@ -59,7 +59,7 @@ module Primer
59
59
  @aria_label = aria("label", @system_arguments)
60
60
  @aria_description = aria("description", @system_arguments)
61
61
 
62
- return unless @show_tooltip
62
+ return unless render_tooltip?
63
63
 
64
64
  @tooltip_arguments = {
65
65
  for_id: @system_arguments[:id],
@@ -79,6 +79,13 @@ module Primer
79
79
  @tooltip_arguments[:text] = @aria_label
80
80
  @tooltip_arguments[:type] = :label
81
81
  end
82
+
83
+ @tooltip = Primer::Alpha::Tooltip.new(**@tooltip_arguments)
84
+ aria_key = @tooltip_arguments[:type] == :label ? :labelledby : :describedby
85
+
86
+ @system_arguments[:aria] = merge_aria(
87
+ @system_arguments, { aria: { aria_key => @tooltip.id } }
88
+ )
82
89
  end
83
90
 
84
91
  private
@@ -1 +1 @@
1
- .Link{color:var(--fgColor-accent,var(--color-accent-fg))}.Link:hover{cursor:pointer}.Link:focus,.Link:hover{text-decoration:underline}.Link:focus,.Link:focus-visible{outline-offset:0}.Link--primary{color:var(--fgColor-default,var(--color-fg-default))!important}.Link--primary:hover{color:var(--fgColor-accent,var(--color-accent-fg))!important}.Link--secondary{color:var(--fgColor-muted,var(--color-fg-muted))!important}.Link--secondary:hover{color:var(--fgColor-accent,var(--color-accent-fg))!important}.Link--muted{color:var(--fgColor-muted,var(--color-fg-muted))!important}.Link--muted:hover{text-decoration:none}.Link--muted:hover,.Link--onHover:hover{color:var(--fgColor-accent,var(--color-accent-fg))!important}.Link--onHover:hover{cursor:pointer;text-decoration:underline}.Link--muted:hover [class*=color-fg],.Link--primary:hover [class*=color-fg],.Link--secondary:hover [class*=color-fg]{color:inherit!important}
1
+ .Link{color:var(--fgColor-accent,var(--color-accent-fg));text-decoration:none}.Link:hover{cursor:pointer}.Link:focus,.Link:hover{text-decoration:underline}.Link:focus,.Link:focus-visible{outline-offset:0}.Link--underline{text-decoration:underline}.Link--primary{color:var(--fgColor-default,var(--color-fg-default))!important}.Link--primary:hover{color:var(--fgColor-accent,var(--color-accent-fg))!important}.Link--secondary{color:var(--fgColor-muted,var(--color-fg-muted))!important}.Link--secondary:hover{color:var(--fgColor-accent,var(--color-accent-fg))!important}.Link--muted{color:var(--fgColor-muted,var(--color-fg-muted))!important}.Link--muted:hover{text-decoration:none}.Link--muted:hover,.Link--onHover:hover{color:var(--fgColor-accent,var(--color-accent-fg))!important}.Link--onHover:hover{cursor:pointer;text-decoration:underline}.Link--muted:hover [class*=color-fg],.Link--primary:hover [class*=color-fg],.Link--secondary:hover [class*=color-fg]{color:inherit!important}