@primer/view-components 0.44.0-rc.dd789cab → 0.44.0-rc.f46ac63e
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/components/primer/alpha/action_menu/action_menu_element.d.ts +5 -0
- package/app/assets/javascripts/components/primer/alpha/action_menu/action_menu_focus_zone_stack.d.ts +17 -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 +1 -1
- package/app/assets/styles/primer_view_components.css.map +1 -1
- package/app/components/primer/alpha/action_menu/action_menu_element.d.ts +5 -0
- package/app/components/primer/alpha/action_menu/action_menu_element.js +113 -16
- package/app/components/primer/alpha/action_menu/action_menu_focus_zone_stack.d.ts +17 -0
- package/app/components/primer/alpha/action_menu/action_menu_focus_zone_stack.js +62 -0
- package/app/components/primer/beta/progress_bar.css +1 -1
- package/package.json +2 -2
@@ -11,6 +11,10 @@ export declare class ActionMenuElement extends HTMLElement {
|
|
11
11
|
#private;
|
12
12
|
includeFragment: IncludeFragmentElement;
|
13
13
|
overlay: AnchoredPositionElement;
|
14
|
+
list: HTMLElement;
|
15
|
+
static validItemRoles: string[];
|
16
|
+
static validSelectors: string[];
|
17
|
+
static menuItemSelectors: string[];
|
14
18
|
get selectVariant(): SelectVariant;
|
15
19
|
set selectVariant(variant: SelectVariant);
|
16
20
|
get dynamicLabelPrefix(): string;
|
@@ -18,6 +22,7 @@ export declare class ActionMenuElement extends HTMLElement {
|
|
18
22
|
get dynamicLabel(): boolean;
|
19
23
|
set dynamicLabel(value: boolean);
|
20
24
|
get popoverElement(): HTMLElement | null;
|
25
|
+
get childPopoverElements(): HTMLElement[];
|
21
26
|
get invokerElement(): HTMLButtonElement | null;
|
22
27
|
get invokerLabel(): HTMLElement | null;
|
23
28
|
get selectedItems(): SelectedItem[];
|
@@ -15,13 +15,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
15
15
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
16
16
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
17
17
|
};
|
18
|
-
var _ActionMenuElement_instances, _ActionMenuElement_abortController, _ActionMenuElement_originalLabel, _ActionMenuElement_inputName, _ActionMenuElement_invokerBeingClicked, _ActionMenuElement_intersectionObserver, _ActionMenuElement_softDisableItems, _ActionMenuElement_potentiallyDisallowActivation, _ActionMenuElement_isAnchorActivationViaSpace, _ActionMenuElement_isActivation, _ActionMenuElement_handleInvokerActivated, _ActionMenuElement_handleDialogItemActivated, _ActionMenuElement_handleItemActivated, _ActionMenuElement_handleIncludeFragmentReplaced, _ActionMenuElement_handleFocusOut, _ActionMenuElement_show, _ActionMenuElement_hide, _ActionMenuElement_isOpen, _ActionMenuElement_setDynamicLabel, _ActionMenuElement_updateInput, _ActionMenuElement_firstItem_get;
|
18
|
+
var _ActionMenuElement_instances, _a, _ActionMenuElement_abortController, _ActionMenuElement_originalLabel, _ActionMenuElement_inputName, _ActionMenuElement_invokerBeingClicked, _ActionMenuElement_intersectionObserver, _ActionMenuElement_focusZoneStack, _ActionMenuElement_updateLevels, _ActionMenuElement_softDisableItems, _ActionMenuElement_potentiallyDisallowActivation, _ActionMenuElement_isAnchorActivationViaSpace, _ActionMenuElement_isClipboardActivationViaKeyboard, _ActionMenuElement_isActivation, _ActionMenuElement_handleItemKeyboardEvent, _ActionMenuElement_handleToggleEvent, _ActionMenuElement_handleInvokerActivated, _ActionMenuElement_handleDialogItemActivated, _ActionMenuElement_handleItemActivated, _ActionMenuElement_handleIncludeFragmentReplaced, _ActionMenuElement_handleFocusOut, _ActionMenuElement_show, _ActionMenuElement_hide, _ActionMenuElement_isOpen, _ActionMenuElement_setDynamicLabel, _ActionMenuElement_updateInput, _ActionMenuElement_firstItem_get, _ActionMenuElement_subMenuForItem, _ActionMenuElement_itemForSubMenu;
|
19
|
+
var ActionMenuElement_1;
|
19
20
|
import { controller, target } from '@github/catalyst';
|
20
21
|
import '@oddbird/popover-polyfill';
|
21
22
|
import { observeMutationsUntilConditionMet } from '../../utils';
|
22
|
-
|
23
|
-
|
24
|
-
let ActionMenuElement = class ActionMenuElement extends HTMLElement {
|
23
|
+
import { ActionMenuFocusZoneStack } from './action_menu_focus_zone_stack';
|
24
|
+
import { ClipboardCopyElement } from '@github/clipboard-copy-element';
|
25
|
+
let ActionMenuElement = ActionMenuElement_1 = _a = class ActionMenuElement extends HTMLElement {
|
25
26
|
constructor() {
|
26
27
|
super(...arguments);
|
27
28
|
_ActionMenuElement_instances.add(this);
|
@@ -30,6 +31,7 @@ let ActionMenuElement = class ActionMenuElement extends HTMLElement {
|
|
30
31
|
_ActionMenuElement_inputName.set(this, '');
|
31
32
|
_ActionMenuElement_invokerBeingClicked.set(this, false);
|
32
33
|
_ActionMenuElement_intersectionObserver.set(this, void 0);
|
34
|
+
_ActionMenuElement_focusZoneStack.set(this, void 0);
|
33
35
|
}
|
34
36
|
get selectVariant() {
|
35
37
|
return this.getAttribute('data-select-variant');
|
@@ -60,6 +62,10 @@ let ActionMenuElement = class ActionMenuElement extends HTMLElement {
|
|
60
62
|
get popoverElement() {
|
61
63
|
return this.invokerElement?.popoverTargetElement || null;
|
62
64
|
}
|
65
|
+
// i.e. sub-menus
|
66
|
+
get childPopoverElements() {
|
67
|
+
return Array.from(this.overlay.querySelectorAll('anchored-position'));
|
68
|
+
}
|
63
69
|
get invokerElement() {
|
64
70
|
const id = this.querySelector('[role=menu]')?.id;
|
65
71
|
if (!id)
|
@@ -96,7 +102,7 @@ let ActionMenuElement = class ActionMenuElement extends HTMLElement {
|
|
96
102
|
this.addEventListener('mouseover', this, { signal });
|
97
103
|
this.addEventListener('focusout', this, { signal });
|
98
104
|
this.addEventListener('mousedown', this, { signal });
|
99
|
-
this.
|
105
|
+
this.addEventListener('toggle', this, { signal, capture: true });
|
100
106
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_setDynamicLabel).call(this);
|
101
107
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_updateInput).call(this);
|
102
108
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_softDisableItems).call(this);
|
@@ -134,6 +140,10 @@ let ActionMenuElement = class ActionMenuElement extends HTMLElement {
|
|
134
140
|
if (!this.includeFragment) {
|
135
141
|
this.setAttribute('data-ready', 'true');
|
136
142
|
}
|
143
|
+
const levelObserver = new MutationObserver(() => __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_updateLevels).call(this));
|
144
|
+
levelObserver.observe(this, { childList: true, subtree: true });
|
145
|
+
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_updateLevels).call(this);
|
146
|
+
__classPrivateFieldSet(this, _ActionMenuElement_focusZoneStack, new ActionMenuFocusZoneStack(), "f");
|
137
147
|
}
|
138
148
|
disconnectedCallback() {
|
139
149
|
__classPrivateFieldGet(this, _ActionMenuElement_abortController, "f").abort();
|
@@ -141,10 +151,9 @@ let ActionMenuElement = class ActionMenuElement extends HTMLElement {
|
|
141
151
|
handleEvent(event) {
|
142
152
|
const targetIsInvoker = this.invokerElement?.contains(event.target);
|
143
153
|
const eventIsActivation = __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isActivation).call(this, event);
|
144
|
-
if (event.type === 'toggle' && event
|
145
|
-
|
146
|
-
|
147
|
-
});
|
154
|
+
if (event.type === 'toggle' && event instanceof ToggleEvent) {
|
155
|
+
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_handleToggleEvent).call(this, event);
|
156
|
+
return;
|
148
157
|
}
|
149
158
|
if (targetIsInvoker && event.type === 'mousedown') {
|
150
159
|
__classPrivateFieldSet(this, _ActionMenuElement_invokerBeingClicked, true, "f");
|
@@ -172,7 +181,7 @@ let ActionMenuElement = class ActionMenuElement extends HTMLElement {
|
|
172
181
|
});
|
173
182
|
return;
|
174
183
|
}
|
175
|
-
const item = event.target.closest(menuItemSelectors.join(','));
|
184
|
+
const item = event.target.closest(ActionMenuElement_1.menuItemSelectors.join(','));
|
176
185
|
const targetIsItem = item !== null;
|
177
186
|
if (targetIsItem && eventIsActivation) {
|
178
187
|
if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_potentiallyDisallowActivation).call(this, event))
|
@@ -191,15 +200,26 @@ let ActionMenuElement = class ActionMenuElement extends HTMLElement {
|
|
191
200
|
event.preventDefault();
|
192
201
|
item.click();
|
193
202
|
}
|
203
|
+
const subMenu = __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_subMenuForItem).call(this, item);
|
204
|
+
if (subMenu) {
|
205
|
+
// Prevent submitting a form when clicking on sub-menu items
|
206
|
+
event.preventDefault();
|
207
|
+
subMenu.showPopover();
|
208
|
+
return;
|
209
|
+
}
|
194
210
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_handleItemActivated).call(this, item);
|
195
211
|
return;
|
196
212
|
}
|
197
213
|
if (event.type === 'include-fragment-replaced') {
|
198
214
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_handleIncludeFragmentReplaced).call(this);
|
215
|
+
return;
|
216
|
+
}
|
217
|
+
if (targetIsItem && event instanceof KeyboardEvent) {
|
218
|
+
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_handleItemKeyboardEvent).call(this, event, item);
|
199
219
|
}
|
200
220
|
}
|
201
221
|
get items() {
|
202
|
-
return Array.from(this.querySelectorAll(menuItemSelectors.join(',')));
|
222
|
+
return Array.from(this.querySelectorAll(ActionMenuElement_1.menuItemSelectors.join(',')));
|
203
223
|
}
|
204
224
|
getItemById(itemId) {
|
205
225
|
return this.querySelector(`li[data-item-id="${itemId}"`);
|
@@ -274,10 +294,18 @@ _ActionMenuElement_originalLabel = new WeakMap();
|
|
274
294
|
_ActionMenuElement_inputName = new WeakMap();
|
275
295
|
_ActionMenuElement_invokerBeingClicked = new WeakMap();
|
276
296
|
_ActionMenuElement_intersectionObserver = new WeakMap();
|
297
|
+
_ActionMenuElement_focusZoneStack = new WeakMap();
|
277
298
|
_ActionMenuElement_instances = new WeakSet();
|
299
|
+
_ActionMenuElement_updateLevels = function _ActionMenuElement_updateLevels() {
|
300
|
+
let idx = 1;
|
301
|
+
for (const menu of this.querySelectorAll('[role=menu]')) {
|
302
|
+
menu.setAttribute('data-level', idx.toString());
|
303
|
+
idx++;
|
304
|
+
}
|
305
|
+
};
|
278
306
|
_ActionMenuElement_softDisableItems = function _ActionMenuElement_softDisableItems() {
|
279
307
|
const { signal } = __classPrivateFieldGet(this, _ActionMenuElement_abortController, "f");
|
280
|
-
for (const item of this.querySelectorAll(validSelectors.join(','))) {
|
308
|
+
for (const item of this.querySelectorAll(ActionMenuElement_1.validSelectors.join(','))) {
|
281
309
|
item.addEventListener('click', __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_potentiallyDisallowActivation).bind(this), { signal });
|
282
310
|
item.addEventListener('keydown', __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_potentiallyDisallowActivation).bind(this), { signal });
|
283
311
|
}
|
@@ -285,7 +313,7 @@ _ActionMenuElement_softDisableItems = function _ActionMenuElement_softDisableIte
|
|
285
313
|
_ActionMenuElement_potentiallyDisallowActivation = function _ActionMenuElement_potentiallyDisallowActivation(event) {
|
286
314
|
if (!__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isActivation).call(this, event))
|
287
315
|
return false;
|
288
|
-
const item = event.target.closest(menuItemSelectors.join(','));
|
316
|
+
const item = event.target.closest(ActionMenuElement_1.menuItemSelectors.join(','));
|
289
317
|
if (!item)
|
290
318
|
return false;
|
291
319
|
if (item.getAttribute('aria-disabled')) {
|
@@ -305,11 +333,57 @@ _ActionMenuElement_isAnchorActivationViaSpace = function _ActionMenuElement_isAn
|
|
305
333
|
!(event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) &&
|
306
334
|
event.key === ' ');
|
307
335
|
};
|
336
|
+
_ActionMenuElement_isClipboardActivationViaKeyboard = function _ActionMenuElement_isClipboardActivationViaKeyboard(event) {
|
337
|
+
return (event.target instanceof ClipboardCopyElement &&
|
338
|
+
event instanceof KeyboardEvent &&
|
339
|
+
event.type === 'keydown' &&
|
340
|
+
!(event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) &&
|
341
|
+
(event.key === ' ' || event.key === 'Enter'));
|
342
|
+
};
|
308
343
|
_ActionMenuElement_isActivation = function _ActionMenuElement_isActivation(event) {
|
309
344
|
// Some browsers fire MouseEvents (Firefox) and others fire PointerEvents (Chrome). Activating an item via
|
310
345
|
// enter or space counterintuitively fires one of these rather than a KeyboardEvent. Since PointerEvent
|
311
346
|
// inherits from MouseEvent, it is enough to check for MouseEvent here.
|
312
|
-
return (event instanceof MouseEvent && event.type === 'click') ||
|
347
|
+
return ((event instanceof MouseEvent && event.type === 'click') ||
|
348
|
+
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isAnchorActivationViaSpace).call(this, event) ||
|
349
|
+
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isClipboardActivationViaKeyboard).call(this, event));
|
350
|
+
};
|
351
|
+
_ActionMenuElement_handleItemKeyboardEvent = function _ActionMenuElement_handleItemKeyboardEvent(event, item) {
|
352
|
+
switch (event.key) {
|
353
|
+
case 'ArrowRight': {
|
354
|
+
const subMenu = __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_subMenuForItem).call(this, item);
|
355
|
+
subMenu?.showPopover();
|
356
|
+
break;
|
357
|
+
}
|
358
|
+
case 'ArrowLeft':
|
359
|
+
if (item.closest('role[menu]') !== this.list) {
|
360
|
+
const overlay = item.closest('anchored-position');
|
361
|
+
overlay?.hidePopover();
|
362
|
+
}
|
363
|
+
break;
|
364
|
+
}
|
365
|
+
};
|
366
|
+
_ActionMenuElement_handleToggleEvent = function _ActionMenuElement_handleToggleEvent(event) {
|
367
|
+
const subMenu = event.target;
|
368
|
+
if (event.newState === 'open') {
|
369
|
+
// allow tabbing away from primary menu, but trap focus in sub-menus
|
370
|
+
const isPrimaryMenu = subMenu === this.overlay;
|
371
|
+
__classPrivateFieldGet(this, _ActionMenuElement_focusZoneStack, "f").push(subMenu, { trapFocus: !isPrimaryMenu });
|
372
|
+
window.requestAnimationFrame(() => {
|
373
|
+
const firstItem = subMenu.querySelector(ActionMenuElement_1.menuItemSelectors.join(','));
|
374
|
+
firstItem?.focus();
|
375
|
+
});
|
376
|
+
}
|
377
|
+
else {
|
378
|
+
// Note that this will also cause focus to return to the invoker button, which is
|
379
|
+
// desirable
|
380
|
+
__classPrivateFieldGet(this, _ActionMenuElement_focusZoneStack, "f").pop(subMenu);
|
381
|
+
const item = __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_itemForSubMenu).call(this, subMenu);
|
382
|
+
const openPopover = document.querySelector(':popover-open');
|
383
|
+
if (item && !openPopover) {
|
384
|
+
item.focus();
|
385
|
+
}
|
386
|
+
}
|
313
387
|
};
|
314
388
|
_ActionMenuElement_handleInvokerActivated = function _ActionMenuElement_handleInvokerActivated(event) {
|
315
389
|
event.preventDefault();
|
@@ -412,6 +486,9 @@ _ActionMenuElement_show = function _ActionMenuElement_show() {
|
|
412
486
|
};
|
413
487
|
_ActionMenuElement_hide = function _ActionMenuElement_hide() {
|
414
488
|
this.popoverElement?.hidePopover();
|
489
|
+
for (const child of this.childPopoverElements) {
|
490
|
+
child.hidePopover();
|
491
|
+
}
|
415
492
|
};
|
416
493
|
_ActionMenuElement_isOpen = function _ActionMenuElement_isOpen() {
|
417
494
|
return this.popoverElement?.matches(':popover-open');
|
@@ -476,15 +553,35 @@ _ActionMenuElement_updateInput = function _ActionMenuElement_updateInput() {
|
|
476
553
|
}
|
477
554
|
};
|
478
555
|
_ActionMenuElement_firstItem_get = function _ActionMenuElement_firstItem_get() {
|
479
|
-
return this.querySelector(menuItemSelectors.join(','));
|
556
|
+
return this.querySelector(ActionMenuElement_1.menuItemSelectors.join(','));
|
557
|
+
};
|
558
|
+
_ActionMenuElement_subMenuForItem = function _ActionMenuElement_subMenuForItem(item) {
|
559
|
+
const popoverId = item.getAttribute('popovertarget');
|
560
|
+
if (popoverId) {
|
561
|
+
return this.querySelector(`[id="${popoverId}"]`);
|
562
|
+
}
|
563
|
+
return null;
|
480
564
|
};
|
565
|
+
_ActionMenuElement_itemForSubMenu = function _ActionMenuElement_itemForSubMenu(subMenu) {
|
566
|
+
const anchorId = subMenu.getAttribute('anchor');
|
567
|
+
if (anchorId) {
|
568
|
+
return this.querySelector(`[id="${anchorId}"]`);
|
569
|
+
}
|
570
|
+
return null;
|
571
|
+
};
|
572
|
+
ActionMenuElement.validItemRoles = ['menuitem', 'menuitemcheckbox', 'menuitemradio'];
|
573
|
+
ActionMenuElement.validSelectors = ActionMenuElement_1.validItemRoles.map(role => `[role="${role}"]`);
|
574
|
+
ActionMenuElement.menuItemSelectors = ActionMenuElement_1.validSelectors.map(selector => `:not([hidden]) > ${selector}`);
|
481
575
|
__decorate([
|
482
576
|
target
|
483
577
|
], ActionMenuElement.prototype, "includeFragment", void 0);
|
484
578
|
__decorate([
|
485
579
|
target
|
486
580
|
], ActionMenuElement.prototype, "overlay", void 0);
|
487
|
-
|
581
|
+
__decorate([
|
582
|
+
target
|
583
|
+
], ActionMenuElement.prototype, "list", void 0);
|
584
|
+
ActionMenuElement = ActionMenuElement_1 = __decorate([
|
488
585
|
controller
|
489
586
|
], ActionMenuElement);
|
490
587
|
export { ActionMenuElement };
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import AnchoredPositionElement from '../../anchored_position';
|
2
|
+
type StackEntry = {
|
3
|
+
element: AnchoredPositionElement;
|
4
|
+
abortController?: AbortController;
|
5
|
+
};
|
6
|
+
export declare class ActionMenuFocusZoneStack {
|
7
|
+
#private;
|
8
|
+
constructor();
|
9
|
+
get current(): StackEntry | undefined;
|
10
|
+
push(next: AnchoredPositionElement, options?: {
|
11
|
+
trapFocus: boolean;
|
12
|
+
}): void;
|
13
|
+
pop(target?: AnchoredPositionElement): void;
|
14
|
+
elementIsMenuItem(element: HTMLElement): boolean;
|
15
|
+
get isEmpty(): boolean;
|
16
|
+
}
|
17
|
+
export {};
|
@@ -0,0 +1,62 @@
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
4
|
+
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");
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
6
|
+
};
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
|
+
};
|
12
|
+
var _ActionMenuFocusZoneStack_instances, _ActionMenuFocusZoneStack_stack, _ActionMenuFocusZoneStack_setupFocusZone, _ActionMenuFocusZoneStack_validItemRoles_get;
|
13
|
+
import { FocusKeys, focusTrap, focusZone } from '@primer/behaviors';
|
14
|
+
import { ActionMenuElement } from './action_menu_element';
|
15
|
+
export class ActionMenuFocusZoneStack {
|
16
|
+
constructor() {
|
17
|
+
_ActionMenuFocusZoneStack_instances.add(this);
|
18
|
+
_ActionMenuFocusZoneStack_stack.set(this, void 0);
|
19
|
+
__classPrivateFieldSet(this, _ActionMenuFocusZoneStack_stack, [], "f");
|
20
|
+
}
|
21
|
+
get current() {
|
22
|
+
return __classPrivateFieldGet(this, _ActionMenuFocusZoneStack_stack, "f")[__classPrivateFieldGet(this, _ActionMenuFocusZoneStack_stack, "f").length - 1];
|
23
|
+
}
|
24
|
+
push(next, options = { trapFocus: true }) {
|
25
|
+
const { trapFocus } = options;
|
26
|
+
__classPrivateFieldGet(this, _ActionMenuFocusZoneStack_stack, "f").push({ element: next, abortController: __classPrivateFieldGet(this, _ActionMenuFocusZoneStack_instances, "m", _ActionMenuFocusZoneStack_setupFocusZone).call(this, next, trapFocus) });
|
27
|
+
}
|
28
|
+
pop(target) {
|
29
|
+
if (target) {
|
30
|
+
while (__classPrivateFieldGet(this, _ActionMenuFocusZoneStack_stack, "f").length > 0 && this.current?.element !== target) {
|
31
|
+
const entry = __classPrivateFieldGet(this, _ActionMenuFocusZoneStack_stack, "f").pop();
|
32
|
+
entry?.abortController?.abort();
|
33
|
+
}
|
34
|
+
}
|
35
|
+
const entry = __classPrivateFieldGet(this, _ActionMenuFocusZoneStack_stack, "f").pop();
|
36
|
+
entry?.abortController?.abort();
|
37
|
+
}
|
38
|
+
elementIsMenuItem(element) {
|
39
|
+
return __classPrivateFieldGet(this, _ActionMenuFocusZoneStack_instances, "a", _ActionMenuFocusZoneStack_validItemRoles_get).includes(element.getAttribute('role') || '');
|
40
|
+
}
|
41
|
+
get isEmpty() {
|
42
|
+
return __classPrivateFieldGet(this, _ActionMenuFocusZoneStack_stack, "f").length === 0;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
_ActionMenuFocusZoneStack_stack = new WeakMap(), _ActionMenuFocusZoneStack_instances = new WeakSet(), _ActionMenuFocusZoneStack_setupFocusZone = function _ActionMenuFocusZoneStack_setupFocusZone(containerEl, trapFocus) {
|
46
|
+
const focusZoneAbortController = focusZone(containerEl, {
|
47
|
+
bindKeys: FocusKeys.ArrowVertical | FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd | FocusKeys.Backspace,
|
48
|
+
focusOutBehavior: 'wrap',
|
49
|
+
focusableElementFilter: (element) => {
|
50
|
+
return this.elementIsMenuItem(element) && element.closest('anchored-position') === containerEl;
|
51
|
+
},
|
52
|
+
});
|
53
|
+
if (trapFocus) {
|
54
|
+
const { signal: focusZoneSignal } = focusZoneAbortController;
|
55
|
+
return focusTrap(containerEl, undefined, focusZoneSignal);
|
56
|
+
}
|
57
|
+
else {
|
58
|
+
return focusZoneAbortController;
|
59
|
+
}
|
60
|
+
}, _ActionMenuFocusZoneStack_validItemRoles_get = function _ActionMenuFocusZoneStack_validItemRoles_get() {
|
61
|
+
return ActionMenuElement.validItemRoles;
|
62
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
.Progress{background-color:var(--
|
1
|
+
.Progress{background-color:var(--progressBar-track-bgColor);border-radius:var(--borderRadius-medium);display:flex;height:8px;outline:solid 1px var(--progressBar-track-borderColor);outline-offset:-1px;overflow:hidden}.Progress--large{height:10px}.Progress--small{height:5px}.Progress-item{outline:2px solid #0000}.Progress-item+.Progress-item{margin-left:var(--base-size-2)}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@primer/view-components",
|
3
|
-
"version": "0.44.0-rc.
|
3
|
+
"version": "0.44.0-rc.f46ac63e",
|
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",
|
@@ -68,7 +68,7 @@
|
|
68
68
|
"@github/markdownlint-github": "^0.8.0",
|
69
69
|
"@github/prettier-config": "0.0.6",
|
70
70
|
"@playwright/test": "^1.49.1",
|
71
|
-
"@primer/css": "22.0.
|
71
|
+
"@primer/css": "22.0.2",
|
72
72
|
"@primer/stylelint-config": "^13.1.1",
|
73
73
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
74
74
|
"@rollup/plugin-typescript": "^8.3.3",
|