@mixtint/primer-view-components 0.75.2 → 0.84.3
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/README.md +20 -1
- package/app/assets/javascripts/components/primer/alpha/tree_view/tree_view.d.ts +1 -0
- package/app/assets/javascripts/components/primer/open_project/avatar_fallback.d.ts +28 -0
- package/app/assets/javascripts/components/primer/primer.d.ts +2 -0
- package/app/assets/javascripts/lib/primer/forms/character_counter.d.ts +41 -0
- package/app/assets/javascripts/lib/primer/forms/primer_text_area.d.ts +13 -0
- package/app/assets/javascripts/lib/primer/forms/primer_text_field.d.ts +2 -0
- package/app/assets/javascripts/primer_view_components.js +1 -1
- package/app/assets/javascripts/primer_view_components.js.map +1 -1
- package/app/assets/styles/primer_view_components.css +354 -29
- package/app/assets/styles/primer_view_components.css.map +1 -1
- package/app/components/primer/alpha/action_bar_element.js +68 -77
- package/app/components/primer/alpha/action_list.css +1 -1
- package/app/components/primer/alpha/action_list.js +1 -1
- package/app/components/primer/alpha/action_menu/action_menu_element.js +1 -1
- package/app/components/primer/alpha/dialog.css +12 -0
- package/app/components/primer/alpha/dialog.css.json +2 -1
- package/app/components/primer/alpha/segmented_control.js +1 -1
- package/app/components/primer/alpha/select_panel_element.js +4 -2
- package/app/components/primer/alpha/tab_nav.css +8 -1
- package/app/components/primer/alpha/tab_nav.css.json +1 -0
- package/app/components/primer/alpha/toggle_switch.js +1 -1
- package/app/components/primer/alpha/tool_tip.js +13 -6
- package/app/components/primer/alpha/tree_view/tree_view.d.ts +1 -0
- package/app/components/primer/alpha/tree_view/tree_view.js +28 -20
- package/app/components/primer/alpha/tree_view/tree_view_icon_pair_element.js +1 -1
- package/app/components/primer/alpha/tree_view/tree_view_include_fragment_element.js +1 -1
- package/app/components/primer/alpha/tree_view/tree_view_sub_tree_node_element.js +25 -2
- package/app/components/primer/alpha/x_banner.js +1 -1
- package/app/components/primer/beta/avatar_stack.css +21 -41
- package/app/components/primer/beta/avatar_stack.css.json +7 -5
- package/app/components/primer/beta/blankslate.css +7 -0
- package/app/components/primer/beta/blankslate.css.json +1 -0
- package/app/components/primer/beta/details_toggle_element.js +1 -1
- package/app/components/primer/beta/nav_list.js +1 -1
- package/app/components/primer/beta/nav_list_group_element.js +1 -1
- package/app/components/primer/beta/state.css +1 -2
- package/app/components/primer/beta/timeline_item.css +2 -1
- package/app/components/primer/dialog_helper.js +24 -9
- package/app/components/primer/open_project/avatar_fallback.d.ts +28 -0
- package/app/components/primer/open_project/avatar_fallback.js +105 -0
- package/app/components/primer/open_project/avatar_stack.css +29 -0
- package/app/components/primer/open_project/avatar_stack.css.json +10 -0
- package/app/components/primer/open_project/border_box/collapsible_header.css +72 -10
- package/app/components/primer/open_project/border_box/collapsible_header.css.json +9 -2
- package/app/components/primer/open_project/inline_message.css +42 -0
- package/app/components/primer/open_project/inline_message.css.json +13 -0
- package/app/components/primer/open_project/page_header.css +51 -0
- package/app/components/primer/open_project/page_header.css.json +10 -1
- package/app/components/primer/open_project/pagination.css +87 -0
- package/app/components/primer/open_project/pagination.css.json +24 -0
- package/app/components/primer/primer.d.ts +2 -0
- package/app/components/primer/primer.js +2 -0
- package/app/components/primer/scrollable_region.js +1 -1
- package/app/lib/primer/forms/character_counter.d.ts +41 -0
- package/app/lib/primer/forms/character_counter.js +114 -0
- package/app/lib/primer/forms/primer_multi_input.js +1 -1
- package/app/lib/primer/forms/primer_text_area.d.ts +13 -0
- package/app/lib/primer/forms/primer_text_area.js +53 -0
- package/app/lib/primer/forms/primer_text_field.d.ts +2 -0
- package/app/lib/primer/forms/primer_text_field.js +17 -3
- package/app/lib/primer/forms/toggle_switch_input.js +1 -1
- package/package.json +24 -23
- package/static/arguments.json +235 -9
- package/static/audited_at.json +6 -0
- package/static/classes.json +30 -2
- package/static/constants.json +67 -1
- package/static/form_previews.json +15 -0
- package/static/info_arch.json +1035 -257
- package/static/previews.json +476 -14
- package/static/statuses.json +6 -0
|
@@ -15,7 +15,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
15
15
|
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");
|
|
16
16
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
17
17
|
};
|
|
18
|
-
var _ActionBarElement_instances, _ActionBarElement_focusZoneAbortController, _ActionBarElement_firstItem_get, _ActionBarElement_showItem, _ActionBarElement_hideItem, _ActionBarElement_menuItems_get
|
|
18
|
+
var _ActionBarElement_instances, _ActionBarElement_focusZoneAbortController, _ActionBarElement_pendingUpdate, _ActionBarElement_performUpdate, _ActionBarElement_firstItem_get, _ActionBarElement_showItem, _ActionBarElement_hideItem, _ActionBarElement_menuItems_get;
|
|
19
19
|
import { controller, targets, target } from '@github/catalyst';
|
|
20
20
|
import { focusZone, FocusKeys } from '@primer/behaviors';
|
|
21
21
|
const instersectionObserver = new IntersectionObserver(entries => {
|
|
@@ -35,27 +35,21 @@ const resizeObserver = new ResizeObserver(entries => {
|
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
// These are definitely used, but eslint is dumb apparently
|
|
38
|
-
var ItemType;
|
|
39
|
-
(function (ItemType) {
|
|
40
|
-
ItemType[ItemType["Item"] = 0] = "Item";
|
|
41
|
-
ItemType[ItemType["Divider"] = 1] = "Divider";
|
|
42
|
-
})(ItemType || (ItemType = {}));
|
|
43
38
|
let ActionBarElement = class ActionBarElement extends HTMLElement {
|
|
44
39
|
constructor() {
|
|
45
40
|
super(...arguments);
|
|
46
41
|
_ActionBarElement_instances.add(this);
|
|
47
42
|
_ActionBarElement_focusZoneAbortController.set(this, null);
|
|
43
|
+
_ActionBarElement_pendingUpdate.set(this, false);
|
|
48
44
|
}
|
|
49
45
|
connectedCallback() {
|
|
50
46
|
resizeObserver.observe(this);
|
|
51
47
|
instersectionObserver.observe(this);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.update();
|
|
58
|
-
});
|
|
48
|
+
// This overflow visible is needed for browsers that don't support PopoverElement
|
|
49
|
+
// to ensure the menu and tooltips are visible when the action bar is in a collapsed state
|
|
50
|
+
// once popover is fully supported we can remove this.style.overflow = 'visible'
|
|
51
|
+
this.style.overflow = 'visible';
|
|
52
|
+
this.update();
|
|
59
53
|
}
|
|
60
54
|
disconnectedCallback() {
|
|
61
55
|
resizeObserver.unobserve(this);
|
|
@@ -69,75 +63,81 @@ let ActionBarElement = class ActionBarElement extends HTMLElement {
|
|
|
69
63
|
}
|
|
70
64
|
}
|
|
71
65
|
update() {
|
|
72
|
-
|
|
73
|
-
if (!firstItem)
|
|
66
|
+
if (__classPrivateFieldGet(this, _ActionBarElement_pendingUpdate, "f"))
|
|
74
67
|
return;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (type === ItemType.Item) {
|
|
80
|
-
if (itemTop > firstItemTop) {
|
|
81
|
-
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_hideItem).call(this, index);
|
|
82
|
-
if (this.moreMenu.hidden) {
|
|
83
|
-
this.moreMenu.hidden = false;
|
|
84
|
-
}
|
|
85
|
-
if (previousItemType === ItemType.Divider) {
|
|
86
|
-
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_hideItem).call(this, index - 1);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_showItem).call(this, index);
|
|
91
|
-
if (index === this.items.length - 1) {
|
|
92
|
-
this.moreMenu.hidden = true;
|
|
93
|
-
}
|
|
94
|
-
if (previousItemType === ItemType.Divider) {
|
|
95
|
-
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_showItem).call(this, index - 1);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
previousItemType = type;
|
|
100
|
-
return true;
|
|
68
|
+
__classPrivateFieldSet(this, _ActionBarElement_pendingUpdate, true, "f");
|
|
69
|
+
requestAnimationFrame(() => {
|
|
70
|
+
__classPrivateFieldSet(this, _ActionBarElement_pendingUpdate, false, "f");
|
|
71
|
+
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_performUpdate).call(this);
|
|
101
72
|
});
|
|
102
|
-
if (__classPrivateFieldGet(this, _ActionBarElement_focusZoneAbortController, "f")) {
|
|
103
|
-
__classPrivateFieldGet(this, _ActionBarElement_focusZoneAbortController, "f").abort();
|
|
104
|
-
}
|
|
105
|
-
__classPrivateFieldSet(this, _ActionBarElement_focusZoneAbortController, focusZone(this, {
|
|
106
|
-
bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
|
|
107
|
-
focusOutBehavior: 'wrap',
|
|
108
|
-
focusableElementFilter: element => {
|
|
109
|
-
const idx = this.items.indexOf(element.parentElement);
|
|
110
|
-
const elementIsVisibleItem = idx > -1 && this.items[idx].style.visibility === 'visible';
|
|
111
|
-
const elementIsVisibleActionMenuInvoker = element === this.moreMenu.invokerElement && !this.moreMenu.hidden;
|
|
112
|
-
return elementIsVisibleItem || elementIsVisibleActionMenuInvoker;
|
|
113
|
-
},
|
|
114
|
-
}), "f");
|
|
115
73
|
}
|
|
116
74
|
};
|
|
117
75
|
_ActionBarElement_focusZoneAbortController = new WeakMap();
|
|
76
|
+
_ActionBarElement_pendingUpdate = new WeakMap();
|
|
118
77
|
_ActionBarElement_instances = new WeakSet();
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
78
|
+
_ActionBarElement_performUpdate = function _ActionBarElement_performUpdate() {
|
|
79
|
+
const firstItem = __classPrivateFieldGet(this, _ActionBarElement_instances, "a", _ActionBarElement_firstItem_get);
|
|
80
|
+
if (!firstItem)
|
|
81
|
+
return;
|
|
82
|
+
const baseTop = firstItem.getBoundingClientRect().top;
|
|
83
|
+
const cachedMenuItems = __classPrivateFieldGet(this, _ActionBarElement_instances, "a", _ActionBarElement_menuItems_get);
|
|
84
|
+
// Snapshot geometry in one pass before mutating the DOM
|
|
85
|
+
const snapshots = Array.from(this.items, el => ({
|
|
86
|
+
top: el.getBoundingClientRect().top,
|
|
87
|
+
isDivider: el.classList.contains('ActionBar-divider'),
|
|
88
|
+
}));
|
|
89
|
+
// Apply visibility changes after all reads are complete
|
|
90
|
+
let prevWasDivider = false;
|
|
91
|
+
for (let n = 0; n < snapshots.length; n++) {
|
|
92
|
+
const snap = snapshots[n];
|
|
93
|
+
if (snap.isDivider) {
|
|
94
|
+
prevWasDivider = true;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (snap.top > baseTop) {
|
|
98
|
+
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_hideItem).call(this, n, cachedMenuItems);
|
|
99
|
+
if (this.moreMenu.hidden)
|
|
100
|
+
this.moreMenu.hidden = false;
|
|
101
|
+
if (prevWasDivider)
|
|
102
|
+
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_hideItem).call(this, n - 1, cachedMenuItems);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_showItem).call(this, n, cachedMenuItems);
|
|
106
|
+
if (n === this.items.length - 1)
|
|
107
|
+
this.moreMenu.hidden = true;
|
|
108
|
+
if (prevWasDivider)
|
|
109
|
+
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_showItem).call(this, n - 1, cachedMenuItems);
|
|
125
110
|
}
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
111
|
+
prevWasDivider = false;
|
|
112
|
+
}
|
|
113
|
+
if (__classPrivateFieldGet(this, _ActionBarElement_focusZoneAbortController, "f")) {
|
|
114
|
+
__classPrivateFieldGet(this, _ActionBarElement_focusZoneAbortController, "f").abort();
|
|
115
|
+
}
|
|
116
|
+
__classPrivateFieldSet(this, _ActionBarElement_focusZoneAbortController, focusZone(this, {
|
|
117
|
+
bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
|
|
118
|
+
focusOutBehavior: 'wrap',
|
|
119
|
+
focusableElementFilter: element => {
|
|
120
|
+
const idx = this.items.indexOf(element.parentElement);
|
|
121
|
+
const elementIsVisibleItem = idx > -1 && this.items[idx].style.visibility === 'visible';
|
|
122
|
+
const elementIsVisibleActionMenuInvoker = element === this.moreMenu.invokerElement && !this.moreMenu.hidden;
|
|
123
|
+
return elementIsVisibleItem || elementIsVisibleActionMenuInvoker;
|
|
124
|
+
},
|
|
125
|
+
}), "f");
|
|
126
|
+
};
|
|
127
|
+
_ActionBarElement_firstItem_get = function _ActionBarElement_firstItem_get() {
|
|
128
|
+
return this.items.find(el => !el.classList.contains('ActionBar-divider')) ?? null;
|
|
129
129
|
};
|
|
130
|
-
_ActionBarElement_showItem = function _ActionBarElement_showItem(index) {
|
|
130
|
+
_ActionBarElement_showItem = function _ActionBarElement_showItem(index, menuItems) {
|
|
131
131
|
const item = this.items[index];
|
|
132
|
-
const menuItem =
|
|
132
|
+
const menuItem = menuItems[index];
|
|
133
133
|
if (!item || !menuItem)
|
|
134
134
|
return;
|
|
135
135
|
item.style.setProperty('visibility', 'visible');
|
|
136
136
|
menuItem.hidden = true;
|
|
137
137
|
};
|
|
138
|
-
_ActionBarElement_hideItem = function _ActionBarElement_hideItem(index) {
|
|
138
|
+
_ActionBarElement_hideItem = function _ActionBarElement_hideItem(index, menuItems) {
|
|
139
139
|
const item = this.items[index];
|
|
140
|
-
const menuItem =
|
|
140
|
+
const menuItem = menuItems[index];
|
|
141
141
|
if (!item || !menuItem)
|
|
142
142
|
return;
|
|
143
143
|
item.style.setProperty('visibility', 'hidden');
|
|
@@ -146,15 +146,6 @@ _ActionBarElement_hideItem = function _ActionBarElement_hideItem(index) {
|
|
|
146
146
|
_ActionBarElement_menuItems_get = function _ActionBarElement_menuItems_get() {
|
|
147
147
|
return this.moreMenu.querySelectorAll('[role="menu"] > li');
|
|
148
148
|
};
|
|
149
|
-
_ActionBarElement_eachItem = function _ActionBarElement_eachItem(callback) {
|
|
150
|
-
for (let i = 0; i < this.items.length; i++) {
|
|
151
|
-
const item = this.items[i];
|
|
152
|
-
const type = item.classList.contains('ActionBar-divider') ? ItemType.Divider : ItemType.Item;
|
|
153
|
-
if (!callback(item, i, type)) {
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
149
|
__decorate([
|
|
159
150
|
targets
|
|
160
151
|
], ActionBarElement.prototype, "items", void 0);
|
|
@@ -165,6 +156,6 @@ __decorate([
|
|
|
165
156
|
target
|
|
166
157
|
], ActionBarElement.prototype, "moreMenu", void 0);
|
|
167
158
|
ActionBarElement = __decorate([
|
|
168
|
-
controller
|
|
159
|
+
controller('action-bar')
|
|
169
160
|
], ActionBarElement);
|
|
170
161
|
window.ActionBarElement = ActionBarElement;
|
|
@@ -430,7 +430,7 @@ nav-list {
|
|
|
430
430
|
.ActionListItem-visual,
|
|
431
431
|
.ActionListItem-action {
|
|
432
432
|
display: flex;
|
|
433
|
-
min-height: var(--
|
|
433
|
+
min-height: var(--base-size-20);
|
|
434
434
|
color: var(--fgColor-muted);
|
|
435
435
|
pointer-events: none;
|
|
436
436
|
fill: var(--fgColor-muted);
|
|
@@ -65,6 +65,6 @@ let ActionListElement = class ActionListElement extends HTMLElement {
|
|
|
65
65
|
};
|
|
66
66
|
_ActionListElement_truncationObserver = new WeakMap();
|
|
67
67
|
ActionListElement = __decorate([
|
|
68
|
-
controller
|
|
68
|
+
controller('action-list')
|
|
69
69
|
], ActionListElement);
|
|
70
70
|
export { ActionListElement };
|
|
@@ -582,7 +582,7 @@ __decorate([
|
|
|
582
582
|
target
|
|
583
583
|
], ActionMenuElement.prototype, "list", void 0);
|
|
584
584
|
ActionMenuElement = ActionMenuElement_1 = __decorate([
|
|
585
|
-
controller
|
|
585
|
+
controller('action-menu')
|
|
586
586
|
], ActionMenuElement);
|
|
587
587
|
export { ActionMenuElement };
|
|
588
588
|
if (!window.customElements.get('action-menu')) {
|
|
@@ -354,6 +354,18 @@ dialog.Overlay:not([open]) {
|
|
|
354
354
|
border-radius: unset !important;
|
|
355
355
|
flex-grow: 1;
|
|
356
356
|
}
|
|
357
|
+
|
|
358
|
+
.Overlay--fullscreen-whenNarrow {
|
|
359
|
+
position: fixed;
|
|
360
|
+
top: 0;
|
|
361
|
+
left: 0;
|
|
362
|
+
width: 100vw;
|
|
363
|
+
max-width: none !important;
|
|
364
|
+
height: 100vh;
|
|
365
|
+
max-height: none !important;
|
|
366
|
+
margin: 0;
|
|
367
|
+
border-radius: unset !important;
|
|
368
|
+
}
|
|
357
369
|
}
|
|
358
370
|
@keyframes Overlay--motion-slideDown {
|
|
359
371
|
from {
|
|
@@ -50,7 +50,7 @@ __decorate([
|
|
|
50
50
|
targets
|
|
51
51
|
], SegmentedControlElement.prototype, "items", void 0);
|
|
52
52
|
SegmentedControlElement = __decorate([
|
|
53
|
-
controller
|
|
53
|
+
controller('segmented-control')
|
|
54
54
|
], SegmentedControlElement);
|
|
55
55
|
export { SegmentedControlElement };
|
|
56
56
|
if (!window.customElements.get('segmented-control')) {
|
|
@@ -84,7 +84,7 @@ let SelectPanelElement = class SelectPanelElement extends HTMLElement {
|
|
|
84
84
|
return this.getAttribute('data-select-variant');
|
|
85
85
|
}
|
|
86
86
|
get ariaSelectionType() {
|
|
87
|
-
return
|
|
87
|
+
return 'aria-selected';
|
|
88
88
|
}
|
|
89
89
|
set selectVariant(variant) {
|
|
90
90
|
if (variant) {
|
|
@@ -775,6 +775,8 @@ _SelectPanelElement_performFilteringLocally = function _SelectPanelElement_perfo
|
|
|
775
775
|
return __classPrivateFieldGet(this, _SelectPanelElement_instances, "a", _SelectPanelElement_fetchStrategy_get) === FetchStrategy.LOCAL || __classPrivateFieldGet(this, _SelectPanelElement_instances, "a", _SelectPanelElement_fetchStrategy_get) === FetchStrategy.EVENTUALLY_LOCAL;
|
|
776
776
|
};
|
|
777
777
|
_SelectPanelElement_handleInvokerActivated = function _SelectPanelElement_handleInvokerActivated(event) {
|
|
778
|
+
// Let listeners observe the invoker was clicked
|
|
779
|
+
this.invokerElement?.dispatchEvent(new CustomEvent('invokerClicked', { bubbles: true }));
|
|
778
780
|
event.preventDefault();
|
|
779
781
|
// eslint-disable-next-line no-restricted-syntax
|
|
780
782
|
event.stopPropagation();
|
|
@@ -987,7 +989,7 @@ __decorate([
|
|
|
987
989
|
target
|
|
988
990
|
], SelectPanelElement.prototype, "liveRegion", void 0);
|
|
989
991
|
SelectPanelElement = __decorate([
|
|
990
|
-
controller
|
|
992
|
+
controller('select-panel')
|
|
991
993
|
], SelectPanelElement);
|
|
992
994
|
export { SelectPanelElement };
|
|
993
995
|
if (!window.customElements.get('select-panel')) {
|
|
@@ -13,9 +13,16 @@
|
|
|
13
13
|
display: flex;
|
|
14
14
|
/* stylelint-disable-next-line primer/spacing */
|
|
15
15
|
margin-bottom: calc(var(--borderWidth-thin) * -1);
|
|
16
|
-
overflow:
|
|
16
|
+
overflow-x: auto;
|
|
17
|
+
overflow-y: hidden;
|
|
18
|
+
|
|
19
|
+
/* stylelint-disable-next-line selector-max-type */
|
|
17
20
|
}
|
|
18
21
|
|
|
22
|
+
.tabnav-tabs > li {
|
|
23
|
+
flex-shrink: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
.tabnav-tab {
|
|
20
27
|
display: inline-block;
|
|
21
28
|
flex-shrink: 0;
|
|
@@ -171,7 +171,7 @@ __decorate([
|
|
|
171
171
|
attr
|
|
172
172
|
], ToggleSwitchElement.prototype, "turbo", void 0);
|
|
173
173
|
ToggleSwitchElement = __decorate([
|
|
174
|
-
controller
|
|
174
|
+
controller('toggle-switch')
|
|
175
175
|
], ToggleSwitchElement);
|
|
176
176
|
if (!window.customElements.get('toggle-switch')) {
|
|
177
177
|
window.ToggleSwitchElement = ToggleSwitchElement;
|
|
@@ -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 `
|
|
@@ -98,7 +99,7 @@ class ToolTipElement extends HTMLElement {
|
|
|
98
99
|
border-radius: var(--borderRadius-medium);
|
|
99
100
|
border: 0 !important;
|
|
100
101
|
opacity: 0;
|
|
101
|
-
max-width: var(--overlay-width-small);
|
|
102
|
+
max-width: min(var(--overlay-width-small), 100vw);
|
|
102
103
|
word-wrap: break-word;
|
|
103
104
|
white-space: normal;
|
|
104
105
|
width: max-content !important;
|
|
@@ -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);
|
|
@@ -38,6 +38,7 @@ export declare class TreeViewElement extends HTMLElement {
|
|
|
38
38
|
changeSelectStrategy(newStrategy: SelectStrategy): void;
|
|
39
39
|
infoFromNode(node: Element, newCheckedValue?: TreeViewCheckedValue): TreeViewNodeInfo | null;
|
|
40
40
|
selectVariant(node: Element): SelectVariant;
|
|
41
|
+
updateHiddenFormInputs(): void;
|
|
41
42
|
}
|
|
42
43
|
declare global {
|
|
43
44
|
interface Window {
|
|
@@ -56,28 +56,17 @@ let TreeViewElement = class TreeViewElement extends HTMLElement {
|
|
|
56
56
|
});
|
|
57
57
|
if (!somethingChanged)
|
|
58
58
|
return;
|
|
59
|
-
|
|
60
|
-
// eslint-disable-next-line custom-elements/no-dom-traversal-in-connectedcallback
|
|
61
|
-
for (const node of this.querySelectorAll('[role=treeitem][aria-checked=true]')) {
|
|
62
|
-
const newInput = this.formInputPrototype.cloneNode();
|
|
63
|
-
newInput.removeAttribute('data-target');
|
|
64
|
-
newInput.removeAttribute('form');
|
|
65
|
-
const payload = {
|
|
66
|
-
path: this.getNodePath(node),
|
|
67
|
-
};
|
|
68
|
-
const inputValue = this.getFormInputValueForNode(node);
|
|
69
|
-
if (inputValue)
|
|
70
|
-
payload.value = inputValue;
|
|
71
|
-
newInput.value = JSON.stringify(payload);
|
|
72
|
-
newInputs.push(newInput);
|
|
73
|
-
}
|
|
74
|
-
this.formInputContainer.replaceChildren(...newInputs);
|
|
59
|
+
this.updateHiddenFormInputs();
|
|
75
60
|
});
|
|
76
61
|
updateInputsObserver.observe(this, {
|
|
77
62
|
childList: true,
|
|
78
63
|
subtree: true,
|
|
79
64
|
attributeFilter: ['aria-checked'],
|
|
80
65
|
});
|
|
66
|
+
// Correctly initialize the form
|
|
67
|
+
if (this.formInputContainer) {
|
|
68
|
+
this.updateHiddenFormInputs();
|
|
69
|
+
}
|
|
81
70
|
// eslint-disable-next-line github/no-then -- We don't want to wait for this to resolve, just get on with it
|
|
82
71
|
customElements.whenDefined('tree-view-sub-tree-node').then(() => {
|
|
83
72
|
// depends on TreeViewSubTreeNodeElement#eachAncestorSubTreeNode, which may not be defined yet
|
|
@@ -117,9 +106,10 @@ let TreeViewElement = class TreeViewElement extends HTMLElement {
|
|
|
117
106
|
}));
|
|
118
107
|
if (!checkSuccess)
|
|
119
108
|
return;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
109
|
+
if (this.getNodeCheckedValue(node) === 'true') {
|
|
110
|
+
this.setNodeCheckedValue(node, 'false');
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
123
113
|
this.checkOnlyAtPath(path);
|
|
124
114
|
}
|
|
125
115
|
this.dispatchEvent(new CustomEvent('treeViewNodeChecked', {
|
|
@@ -286,6 +276,24 @@ let TreeViewElement = class TreeViewElement extends HTMLElement {
|
|
|
286
276
|
selectVariant(node) {
|
|
287
277
|
return (node.getAttribute('data-select-variant') || 'none');
|
|
288
278
|
}
|
|
279
|
+
updateHiddenFormInputs() {
|
|
280
|
+
const newInputs = [];
|
|
281
|
+
// eslint-disable-next-line custom-elements/no-dom-traversal-in-connectedcallback
|
|
282
|
+
for (const node of this.querySelectorAll('[role=treeitem][aria-checked=true]')) {
|
|
283
|
+
const newInput = this.formInputPrototype.cloneNode();
|
|
284
|
+
newInput.removeAttribute('data-target');
|
|
285
|
+
newInput.removeAttribute('form');
|
|
286
|
+
const payload = {
|
|
287
|
+
path: this.getNodePath(node),
|
|
288
|
+
};
|
|
289
|
+
const inputValue = this.getFormInputValueForNode(node);
|
|
290
|
+
if (inputValue)
|
|
291
|
+
payload.value = inputValue;
|
|
292
|
+
newInput.value = JSON.stringify(payload);
|
|
293
|
+
newInputs.push(newInput);
|
|
294
|
+
}
|
|
295
|
+
this.formInputContainer.replaceChildren(...newInputs);
|
|
296
|
+
}
|
|
289
297
|
};
|
|
290
298
|
_TreeViewElement_abortController = new WeakMap();
|
|
291
299
|
_TreeViewElement_instances = new WeakSet();
|
|
@@ -432,7 +440,7 @@ __decorate([
|
|
|
432
440
|
target
|
|
433
441
|
], TreeViewElement.prototype, "formInputPrototype", void 0);
|
|
434
442
|
TreeViewElement = __decorate([
|
|
435
|
-
controller
|
|
443
|
+
controller('tree-view')
|
|
436
444
|
], TreeViewElement);
|
|
437
445
|
export { TreeViewElement };
|
|
438
446
|
if (!window.customElements.get('tree-view')) {
|
|
@@ -53,7 +53,7 @@ __decorate([
|
|
|
53
53
|
target
|
|
54
54
|
], TreeViewIconPairElement.prototype, "collapsedIcon", void 0);
|
|
55
55
|
TreeViewIconPairElement = __decorate([
|
|
56
|
-
controller
|
|
56
|
+
controller('tree-view-icon-pair')
|
|
57
57
|
], TreeViewIconPairElement);
|
|
58
58
|
export { TreeViewIconPairElement };
|
|
59
59
|
if (!window.customElements.get('tree-view-icon-pair')) {
|
|
@@ -19,7 +19,7 @@ let TreeViewIncludeFragmentElement = class TreeViewIncludeFragmentElement extend
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
TreeViewIncludeFragmentElement = __decorate([
|
|
22
|
-
controller
|
|
22
|
+
controller('tree-view-include-fragment')
|
|
23
23
|
], TreeViewIncludeFragmentElement);
|
|
24
24
|
export { TreeViewIncludeFragmentElement };
|
|
25
25
|
if (!window.customElements.get('tree-view-include-fragment')) {
|
|
@@ -15,7 +15,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
15
15
|
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");
|
|
16
16
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
17
17
|
};
|
|
18
|
-
var _TreeViewSubTreeNodeElement_instances, _TreeViewSubTreeNodeElement_expanded, _TreeViewSubTreeNodeElement_loadingState, _TreeViewSubTreeNodeElement_abortController, _TreeViewSubTreeNodeElement_activeElementIsLoader, _TreeViewSubTreeNodeElement_handleToggleEvent, _TreeViewSubTreeNodeElement_handleIncludeFragmentEvent, _TreeViewSubTreeNodeElement_handleRetryButtonEvent, _TreeViewSubTreeNodeElement_handleKeyboardEvent, _TreeViewSubTreeNodeElement_handleCheckboxEvent, _TreeViewSubTreeNodeElement_update, _TreeViewSubTreeNodeElement_checkboxElement_get;
|
|
18
|
+
var _TreeViewSubTreeNodeElement_instances, _TreeViewSubTreeNodeElement_expanded, _TreeViewSubTreeNodeElement_loadingState, _TreeViewSubTreeNodeElement_abortController, _TreeViewSubTreeNodeElement_activeElementIsLoader, _TreeViewSubTreeNodeElement_handleToggleEvent, _TreeViewSubTreeNodeElement_handleIncludeFragmentEvent, _TreeViewSubTreeNodeElement_handleRetryButtonEvent, _TreeViewSubTreeNodeElement_handleKeyboardEvent, _TreeViewSubTreeNodeElement_handleCheckboxEvent, _TreeViewSubTreeNodeElement_update, _TreeViewSubTreeNodeElement_isIncludeFragment, _TreeViewSubTreeNodeElement_checkboxElement_get;
|
|
19
19
|
import { controller, target } from '@github/catalyst';
|
|
20
20
|
import { observeMutationsUntilConditionMet } from '../../utils';
|
|
21
21
|
let TreeViewSubTreeNodeElement = class TreeViewSubTreeNodeElement extends HTMLElement {
|
|
@@ -140,6 +140,10 @@ let TreeViewSubTreeNodeElement = class TreeViewSubTreeNodeElement extends HTMLEl
|
|
|
140
140
|
// sub-tree and no node in the entire tree can be focused
|
|
141
141
|
const previousNode = this.subTree.querySelector("[tabindex='0']");
|
|
142
142
|
previousNode?.setAttribute('tabindex', '-1');
|
|
143
|
+
// Also check if the subtree element itself is an include-fragment with role="treeitem" and has focus
|
|
144
|
+
if (__classPrivateFieldGet(this, _TreeViewSubTreeNodeElement_instances, "m", _TreeViewSubTreeNodeElement_isIncludeFragment).call(this) && this.subTree.getAttribute('tabindex') === '0') {
|
|
145
|
+
this.subTree.setAttribute('tabindex', '-1');
|
|
146
|
+
}
|
|
143
147
|
this.node.setAttribute('tabindex', '0');
|
|
144
148
|
this.treeView.dispatchEvent(new CustomEvent('treeViewNodeCollapsed', {
|
|
145
149
|
bubbles: true,
|
|
@@ -251,6 +255,10 @@ _TreeViewSubTreeNodeElement_handleIncludeFragmentEvent = function _TreeViewSubTr
|
|
|
251
255
|
// request succeeded but element has not yet been replaced
|
|
252
256
|
case 'include-fragment-replace':
|
|
253
257
|
__classPrivateFieldSet(this, _TreeViewSubTreeNodeElement_activeElementIsLoader, document.activeElement === this.loadingIndicator.closest('[role=treeitem]'), "f");
|
|
258
|
+
// Also check if the include-fragment itself has focus (when it has role="treeitem")
|
|
259
|
+
if (!__classPrivateFieldGet(this, _TreeViewSubTreeNodeElement_activeElementIsLoader, "f") && document.activeElement === this.subTree && __classPrivateFieldGet(this, _TreeViewSubTreeNodeElement_instances, "m", _TreeViewSubTreeNodeElement_isIncludeFragment).call(this)) {
|
|
260
|
+
__classPrivateFieldSet(this, _TreeViewSubTreeNodeElement_activeElementIsLoader, true, "f");
|
|
261
|
+
}
|
|
254
262
|
this.loadingState = 'success';
|
|
255
263
|
break;
|
|
256
264
|
case 'include-fragment-replaced':
|
|
@@ -354,6 +362,13 @@ _TreeViewSubTreeNodeElement_update = function _TreeViewSubTreeNodeElement_update
|
|
|
354
362
|
if (this.expanded) {
|
|
355
363
|
if (this.subTree)
|
|
356
364
|
this.subTree.hidden = false;
|
|
365
|
+
if (__classPrivateFieldGet(this, _TreeViewSubTreeNodeElement_instances, "m", _TreeViewSubTreeNodeElement_isIncludeFragment).call(this)) {
|
|
366
|
+
this.subTree.setAttribute('role', 'treeitem');
|
|
367
|
+
// Ensure the include-fragment can participate in roving tab index
|
|
368
|
+
if (!this.subTree.hasAttribute('tabindex')) {
|
|
369
|
+
this.subTree.setAttribute('tabindex', '-1');
|
|
370
|
+
}
|
|
371
|
+
}
|
|
357
372
|
this.node.setAttribute('aria-expanded', 'true');
|
|
358
373
|
this.treeView?.expandAncestorsForNode(this);
|
|
359
374
|
if (this.iconPair) {
|
|
@@ -367,6 +382,11 @@ _TreeViewSubTreeNodeElement_update = function _TreeViewSubTreeNodeElement_update
|
|
|
367
382
|
else {
|
|
368
383
|
if (this.subTree)
|
|
369
384
|
this.subTree.hidden = true;
|
|
385
|
+
if (__classPrivateFieldGet(this, _TreeViewSubTreeNodeElement_instances, "m", _TreeViewSubTreeNodeElement_isIncludeFragment).call(this)) {
|
|
386
|
+
this.subTree.removeAttribute('role');
|
|
387
|
+
// Remove tabindex when role is removed
|
|
388
|
+
this.subTree.removeAttribute('tabindex');
|
|
389
|
+
}
|
|
370
390
|
this.node.setAttribute('aria-expanded', 'false');
|
|
371
391
|
if (this.iconPair) {
|
|
372
392
|
this.iconPair.showCollapsed();
|
|
@@ -397,6 +417,9 @@ _TreeViewSubTreeNodeElement_update = function _TreeViewSubTreeNodeElement_update
|
|
|
397
417
|
this.loadingFailureMessage.hidden = true;
|
|
398
418
|
}
|
|
399
419
|
};
|
|
420
|
+
_TreeViewSubTreeNodeElement_isIncludeFragment = function _TreeViewSubTreeNodeElement_isIncludeFragment() {
|
|
421
|
+
return this.subTree?.getAttribute('data-target')?.includes('tree-view-sub-tree-node.includeFragment') ?? false;
|
|
422
|
+
};
|
|
400
423
|
_TreeViewSubTreeNodeElement_checkboxElement_get = function _TreeViewSubTreeNodeElement_checkboxElement_get() {
|
|
401
424
|
return this.querySelector('.TreeViewItemCheckbox');
|
|
402
425
|
};
|
|
@@ -431,7 +454,7 @@ __decorate([
|
|
|
431
454
|
target
|
|
432
455
|
], TreeViewSubTreeNodeElement.prototype, "retryButton", void 0);
|
|
433
456
|
TreeViewSubTreeNodeElement = __decorate([
|
|
434
|
-
controller
|
|
457
|
+
controller('tree-view-sub-tree-node')
|
|
435
458
|
], TreeViewSubTreeNodeElement);
|
|
436
459
|
export { TreeViewSubTreeNodeElement };
|
|
437
460
|
if (!window.customElements.get('tree-view-sub-tree-node')) {
|
|
@@ -43,7 +43,7 @@ __decorate([
|
|
|
43
43
|
target
|
|
44
44
|
], XBannerElement.prototype, "titleText", void 0);
|
|
45
45
|
XBannerElement = __decorate([
|
|
46
|
-
controller
|
|
46
|
+
controller('x-banner')
|
|
47
47
|
], XBannerElement);
|
|
48
48
|
if (!window.customElements.get('x-banner')) {
|
|
49
49
|
window.XBannerElement = XBannerElement;
|