@primer/view-components 0.12.0-rc.770f9c4c → 0.12.0-rc.97d42775
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.
- package/app/assets/javascripts/app/components/primer/alpha/tool_tip.d.ts +1 -0
- package/app/assets/javascripts/primer_view_components.js +1 -1
- package/app/assets/javascripts/primer_view_components.js.map +1 -1
- package/app/components/primer/alpha/tool_tip.d.ts +1 -0
- package/app/components/primer/alpha/tool_tip.js +17 -2
- package/package.json +2 -2
- package/static/arguments.json +6 -0
- package/static/info_arch.json +32 -0
- package/static/previews.json +26 -0
@@ -3,6 +3,7 @@ type Direction = 'n' | 's' | 'e' | 'w' | 'ne' | 'se' | 'nw' | 'sw';
|
|
3
3
|
declare class ToolTipElement extends HTMLElement {
|
4
4
|
#private;
|
5
5
|
styles(): string;
|
6
|
+
get showReason(): "focus" | "mouse";
|
6
7
|
get htmlFor(): string;
|
7
8
|
set htmlFor(value: string);
|
8
9
|
get type(): 'description' | 'label';
|
@@ -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 = (() => {
|
@@ -60,6 +60,15 @@ function closeOpenTooltips(except) {
|
|
60
60
|
function focusOutListener() {
|
61
61
|
closeOpenTooltips();
|
62
62
|
}
|
63
|
+
function focusInListener(event) {
|
64
|
+
setTimeout(() => {
|
65
|
+
for (const tooltip of openTooltips) {
|
66
|
+
if (isPopoverOpen(tooltip) && tooltip.showReason === 'focus' && tooltip.control !== event.target) {
|
67
|
+
tooltip.hidePopover();
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}, 0);
|
71
|
+
}
|
63
72
|
const tooltips = new Set();
|
64
73
|
const openTooltips = new Set();
|
65
74
|
class ToolTipElement extends HTMLElement {
|
@@ -70,6 +79,7 @@ class ToolTipElement extends HTMLElement {
|
|
70
79
|
_ToolTipElement_align.set(this, 'center');
|
71
80
|
_ToolTipElement_side.set(this, 'outside-bottom');
|
72
81
|
_ToolTipElement_allowUpdatePosition.set(this, false);
|
82
|
+
_ToolTipElement_showReason.set(this, 'mouse');
|
73
83
|
}
|
74
84
|
styles() {
|
75
85
|
return `
|
@@ -203,6 +213,9 @@ class ToolTipElement extends HTMLElement {
|
|
203
213
|
}
|
204
214
|
`;
|
205
215
|
}
|
216
|
+
get showReason() {
|
217
|
+
return __classPrivateFieldGet(this, _ToolTipElement_showReason, "f");
|
218
|
+
}
|
206
219
|
get htmlFor() {
|
207
220
|
return this.getAttribute('for') || '';
|
208
221
|
}
|
@@ -269,6 +282,7 @@ class ToolTipElement extends HTMLElement {
|
|
269
282
|
signal
|
270
283
|
});
|
271
284
|
this.ownerDocument.addEventListener('focusout', focusOutListener);
|
285
|
+
this.ownerDocument.addEventListener('focusin', focusInListener);
|
272
286
|
this.ownerDocument.addEventListener('keydown', this, { signal });
|
273
287
|
}
|
274
288
|
disconnectedCallback() {
|
@@ -293,6 +307,7 @@ class ToolTipElement extends HTMLElement {
|
|
293
307
|
const shouldHide = isMouseLeaveFromButton || isEscapeKeydown || isMouseDownOnButton || isOpeningOtherPopover;
|
294
308
|
await Promise.resolve();
|
295
309
|
if (!showing && shouldShow && !isPopoverOpen(this)) {
|
310
|
+
__classPrivateFieldSet(this, _ToolTipElement_showReason, event.type === 'mouseenter' ? 'mouse' : 'focus', "f");
|
296
311
|
this.showPopover();
|
297
312
|
}
|
298
313
|
else if (showing && shouldHide && isPopoverOpen(this)) {
|
@@ -313,7 +328,7 @@ class ToolTipElement extends HTMLElement {
|
|
313
328
|
}
|
314
329
|
}
|
315
330
|
}
|
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) {
|
331
|
+
_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
332
|
if (isOpen) {
|
318
333
|
openTooltips.add(this);
|
319
334
|
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.12.0-rc.
|
3
|
+
"version": "0.12.0-rc.97d42775",
|
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",
|
@@ -56,6 +56,7 @@
|
|
56
56
|
},
|
57
57
|
"devDependencies": {
|
58
58
|
"@changesets/changelog-github": "^0.4.6",
|
59
|
+
"@changesets/cli": "^2.24.1",
|
59
60
|
"@github/axe-github": "^0.5.0",
|
60
61
|
"@github/browserslist-config": "^1.0.0",
|
61
62
|
"@github/markdownlint-github": "^0.2.2",
|
@@ -85,7 +86,6 @@
|
|
85
86
|
"postcss-mixins": "^9.0.3",
|
86
87
|
"postcss-preset-env": "^7.8.0",
|
87
88
|
"prettier": "2.7.1",
|
88
|
-
"primer-changesets-cli": "2.2.0",
|
89
89
|
"rollup": "^2.77.1",
|
90
90
|
"rollup-plugin-terser": "^7.0.2",
|
91
91
|
"stylelint": "^14.13.0",
|
package/static/arguments.json
CHANGED
@@ -3128,6 +3128,12 @@
|
|
3128
3128
|
"default": "`false`",
|
3129
3129
|
"description": "Whether or not the button is disabled. If true, this option forces `tag:` to `:button`."
|
3130
3130
|
},
|
3131
|
+
{
|
3132
|
+
"name": "inactive",
|
3133
|
+
"type": "Boolean",
|
3134
|
+
"default": "`false`",
|
3135
|
+
"description": "Whether the button looks visually disabled, but can still accept all the same interactions as an enabled button."
|
3136
|
+
},
|
3131
3137
|
{
|
3132
3138
|
"name": "system_arguments",
|
3133
3139
|
"type": "Hash",
|
package/static/info_arch.json
CHANGED
@@ -8413,6 +8413,19 @@
|
|
8413
8413
|
"color-contrast"
|
8414
8414
|
]
|
8415
8415
|
}
|
8416
|
+
},
|
8417
|
+
{
|
8418
|
+
"preview_path": "primer/alpha/tooltip/tooltip_with_dialog_moving_focus_to_input",
|
8419
|
+
"name": "tooltip_with_dialog_moving_focus_to_input",
|
8420
|
+
"snapshot": "false",
|
8421
|
+
"skip_rules": {
|
8422
|
+
"wont_fix": [
|
8423
|
+
"region"
|
8424
|
+
],
|
8425
|
+
"will_fix": [
|
8426
|
+
"color-contrast"
|
8427
|
+
]
|
8428
|
+
}
|
8416
8429
|
}
|
8417
8430
|
],
|
8418
8431
|
"subcomponents": [
|
@@ -9606,6 +9619,12 @@
|
|
9606
9619
|
"default": "`false`",
|
9607
9620
|
"description": "Whether or not the button is disabled. If true, this option forces `tag:` to `:button`."
|
9608
9621
|
},
|
9622
|
+
{
|
9623
|
+
"name": "inactive",
|
9624
|
+
"type": "Boolean",
|
9625
|
+
"default": "`false`",
|
9626
|
+
"description": "Whether the button looks visually disabled, but can still accept all the same interactions as an enabled button."
|
9627
|
+
},
|
9609
9628
|
{
|
9610
9629
|
"name": "system_arguments",
|
9611
9630
|
"type": "Hash",
|
@@ -10671,6 +10690,19 @@
|
|
10671
10690
|
"color-contrast"
|
10672
10691
|
]
|
10673
10692
|
}
|
10693
|
+
},
|
10694
|
+
{
|
10695
|
+
"preview_path": "primer/beta/button/inactive",
|
10696
|
+
"name": "inactive",
|
10697
|
+
"snapshot": "true",
|
10698
|
+
"skip_rules": {
|
10699
|
+
"wont_fix": [
|
10700
|
+
"region"
|
10701
|
+
],
|
10702
|
+
"will_fix": [
|
10703
|
+
"color-contrast"
|
10704
|
+
]
|
10705
|
+
}
|
10674
10706
|
}
|
10675
10707
|
],
|
10676
10708
|
"subcomponents": [
|
package/static/previews.json
CHANGED
@@ -2097,6 +2097,19 @@
|
|
2097
2097
|
"color-contrast"
|
2098
2098
|
]
|
2099
2099
|
}
|
2100
|
+
},
|
2101
|
+
{
|
2102
|
+
"preview_path": "primer/beta/button/inactive",
|
2103
|
+
"name": "inactive",
|
2104
|
+
"snapshot": "true",
|
2105
|
+
"skip_rules": {
|
2106
|
+
"wont_fix": [
|
2107
|
+
"region"
|
2108
|
+
],
|
2109
|
+
"will_fix": [
|
2110
|
+
"color-contrast"
|
2111
|
+
]
|
2112
|
+
}
|
2100
2113
|
}
|
2101
2114
|
]
|
2102
2115
|
},
|
@@ -6391,6 +6404,19 @@
|
|
6391
6404
|
"color-contrast"
|
6392
6405
|
]
|
6393
6406
|
}
|
6407
|
+
},
|
6408
|
+
{
|
6409
|
+
"preview_path": "primer/alpha/tooltip/tooltip_with_dialog_moving_focus_to_input",
|
6410
|
+
"name": "tooltip_with_dialog_moving_focus_to_input",
|
6411
|
+
"snapshot": "false",
|
6412
|
+
"skip_rules": {
|
6413
|
+
"wont_fix": [
|
6414
|
+
"region"
|
6415
|
+
],
|
6416
|
+
"will_fix": [
|
6417
|
+
"color-contrast"
|
6418
|
+
]
|
6419
|
+
}
|
6394
6420
|
}
|
6395
6421
|
]
|
6396
6422
|
},
|