@primer/view-components 0.49.0-rc.caee4ac3 → 0.49.0-rc.d8a5a699
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.
|
@@ -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_showReason, _ToolTipElement_update, _ToolTipElement_updateControl, _ToolTipElement_updateControlReference, _ToolTipElement_updateDirection, _ToolTipElement_updatePosition;
|
|
12
|
+
var _ToolTipElement_instances, _ToolTipElement_abortController, _ToolTipElement_align, _ToolTipElement_side, _ToolTipElement_allowUpdatePosition, _ToolTipElement_showReason, _ToolTipElement_isControlsPopoverOpen, _ToolTipElement_update, _ToolTipElement_updateControl, _ToolTipElement_updateControlReference, _ToolTipElement_updateDirection, _ToolTipElement_updatePosition;
|
|
13
13
|
import '@oddbird/popover-polyfill';
|
|
14
14
|
import { getAnchoredPosition } from '@primer/behaviors';
|
|
15
15
|
const isPopoverOpen = (() => {
|
|
@@ -78,6 +78,7 @@ class ToolTipElement extends HTMLElement {
|
|
|
78
78
|
_ToolTipElement_side.set(this, 'outside-bottom');
|
|
79
79
|
_ToolTipElement_allowUpdatePosition.set(this, false);
|
|
80
80
|
_ToolTipElement_showReason.set(this, 'mouse');
|
|
81
|
+
_ToolTipElement_isControlsPopoverOpen.set(this, false);
|
|
81
82
|
}
|
|
82
83
|
styles() {
|
|
83
84
|
return `
|
|
@@ -244,18 +245,24 @@ class ToolTipElement extends HTMLElement {
|
|
|
244
245
|
if (!this.control)
|
|
245
246
|
return;
|
|
246
247
|
const showing = isPopoverOpen(this);
|
|
248
|
+
// Track when the control's popover (e.g an ActionMenu) is opened/closed
|
|
249
|
+
if (event.type === 'beforetoggle' && event.currentTarget !== this) {
|
|
250
|
+
__classPrivateFieldSet(this, _ToolTipElement_isControlsPopoverOpen, event.newState === 'open', "f");
|
|
251
|
+
}
|
|
247
252
|
// Ensures that tooltip stays open when hovering between tooltip and element
|
|
248
253
|
// WCAG Success Criterion 1.4.13 Hoverable
|
|
249
|
-
const shouldShow = event.type === 'mouseenter' ||
|
|
254
|
+
const shouldShow = (event.type === 'mouseenter' ||
|
|
250
255
|
// Only show tooltip on focus if running in headless browser (for tests) or if focus ring
|
|
251
256
|
// is visible (i.e. if user is using keyboard navigation)
|
|
252
|
-
(event.type === 'focus' && (navigator.webdriver || this.control.matches(':focus-visible')))
|
|
257
|
+
(event.type === 'focus' && (navigator.webdriver || this.control.matches(':focus-visible')))) &&
|
|
258
|
+
// Don't show tooltip if the control's popover is open (e.g. an ActionMenu)
|
|
259
|
+
!__classPrivateFieldGet(this, _ToolTipElement_isControlsPopoverOpen, "f");
|
|
253
260
|
const isMouseLeaveFromButton = event.type === 'mouseleave' &&
|
|
254
261
|
event.relatedTarget !== this.control &&
|
|
255
262
|
event.relatedTarget !== this;
|
|
256
263
|
const isEscapeKeydown = event.type === 'keydown' && event.key === 'Escape';
|
|
257
264
|
const isMouseDownOnButton = event.type === 'mousedown' && event.currentTarget === this.control;
|
|
258
|
-
const isOpeningOtherPopover = event.type === 'beforetoggle' && event.currentTarget !== this;
|
|
265
|
+
const isOpeningOtherPopover = event.type === 'beforetoggle' && event.currentTarget !== this && event.newState === 'open';
|
|
259
266
|
const shouldHide = isMouseLeaveFromButton || isEscapeKeydown || isMouseDownOnButton || isOpeningOtherPopover;
|
|
260
267
|
if (showing && isEscapeKeydown) {
|
|
261
268
|
/* eslint-disable-next-line no-restricted-syntax */
|
|
@@ -288,7 +295,7 @@ class ToolTipElement extends HTMLElement {
|
|
|
288
295
|
}
|
|
289
296
|
}
|
|
290
297
|
}
|
|
291
|
-
_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) {
|
|
298
|
+
_ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new WeakMap(), _ToolTipElement_side = new WeakMap(), _ToolTipElement_allowUpdatePosition = new WeakMap(), _ToolTipElement_showReason = new WeakMap(), _ToolTipElement_isControlsPopoverOpen = new WeakMap(), _ToolTipElement_instances = new WeakSet(), _ToolTipElement_update = function _ToolTipElement_update(isOpen) {
|
|
292
299
|
if (isOpen) {
|
|
293
300
|
openTooltips.add(this);
|
|
294
301
|
this.classList.remove(TOOLTIP_SR_ONLY_CLASS);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/view-components",
|
|
3
|
-
"version": "0.49.0-rc.
|
|
3
|
+
"version": "0.49.0-rc.d8a5a699",
|
|
4
4
|
"description": "ViewComponents for the Primer Design System",
|
|
5
5
|
"main": "app/assets/javascripts/primer_view_components.js",
|
|
6
6
|
"module": "app/components/primer/primer.js",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@changesets/changelog-github": "^0.5.0",
|
|
65
65
|
"@changesets/cli": "^2.24.1",
|
|
66
|
-
"@github/axe-github": "^0.
|
|
66
|
+
"@github/axe-github": "^0.8.1",
|
|
67
67
|
"@github/browserslist-config": "^1.0.0",
|
|
68
68
|
"@github/markdownlint-github": "^0.8.0",
|
|
69
69
|
"@github/prettier-config": "0.0.6",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"stylelint-actions-formatters": "^16.3.1",
|
|
93
93
|
"tslib": "^2.4.0",
|
|
94
94
|
"typescript": "^5.2.2",
|
|
95
|
-
"vite": "^
|
|
95
|
+
"vite": "^7.3.0",
|
|
96
96
|
"vite-plugin-ruby": "^5.1.0"
|
|
97
97
|
},
|
|
98
98
|
"prettier": "@github/prettier-config",
|