@openproject/primer-view-components 0.22.1 → 0.22.2-rc.e4bf80fc
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/primer_view_components.js +1 -1
- package/app/assets/javascripts/primer_view_components.js.map +1 -1
- package/app/components/primer/alpha/action_bar_element.js +12 -4
- package/app/components/primer/alpha/action_menu/action_menu_element.js +4 -1
- package/app/components/primer/alpha/modal_dialog.js +3 -0
- package/app/components/primer/alpha/toggle_switch.js +2 -2
- package/app/components/primer/alpha/tool_tip.js +1 -0
- package/app/components/primer/beta/nav_list.js +2 -0
- package/app/components/primer/dialog_helper.js +36 -15
- package/package.json +3 -3
- package/static/info_arch.json +2 -2
- package/static/previews.json +1 -1
|
@@ -140,12 +140,20 @@ _ActionBarElement_firstItem_get = function _ActionBarElement_firstItem_get() {
|
|
|
140
140
|
return foundItem;
|
|
141
141
|
};
|
|
142
142
|
_ActionBarElement_showItem = function _ActionBarElement_showItem(index) {
|
|
143
|
-
this.items[index]
|
|
144
|
-
__classPrivateFieldGet(this, _ActionBarElement_instances, "a", _ActionBarElement_menuItems_get)[index]
|
|
143
|
+
const item = this.items[index];
|
|
144
|
+
const menuItem = __classPrivateFieldGet(this, _ActionBarElement_instances, "a", _ActionBarElement_menuItems_get)[index];
|
|
145
|
+
if (!item || !menuItem)
|
|
146
|
+
return;
|
|
147
|
+
item.style.setProperty('visibility', 'visible');
|
|
148
|
+
menuItem.hidden = true;
|
|
145
149
|
};
|
|
146
150
|
_ActionBarElement_hideItem = function _ActionBarElement_hideItem(index) {
|
|
147
|
-
this.items[index]
|
|
148
|
-
__classPrivateFieldGet(this, _ActionBarElement_instances, "a", _ActionBarElement_menuItems_get)[index]
|
|
151
|
+
const item = this.items[index];
|
|
152
|
+
const menuItem = __classPrivateFieldGet(this, _ActionBarElement_instances, "a", _ActionBarElement_menuItems_get)[index];
|
|
153
|
+
if (!item || !menuItem)
|
|
154
|
+
return;
|
|
155
|
+
item.style.setProperty('visibility', 'hidden');
|
|
156
|
+
menuItem.hidden = false;
|
|
149
157
|
};
|
|
150
158
|
_ActionBarElement_menuItems_get = function _ActionBarElement_menuItems_get() {
|
|
151
159
|
return this.moreMenu.querySelectorAll('[role="menu"] > li');
|
|
@@ -265,7 +265,9 @@ _ActionMenuElement_potentiallyDisallowActivation = function _ActionMenuElement_p
|
|
|
265
265
|
return false;
|
|
266
266
|
if (item.getAttribute('aria-disabled')) {
|
|
267
267
|
event.preventDefault();
|
|
268
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
268
269
|
event.stopPropagation();
|
|
270
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
269
271
|
event.stopImmediatePropagation();
|
|
270
272
|
return true;
|
|
271
273
|
}
|
|
@@ -294,6 +296,7 @@ _ActionMenuElement_isActivation = function _ActionMenuElement_isActivation(event
|
|
|
294
296
|
};
|
|
295
297
|
_ActionMenuElement_handleInvokerActivated = function _ActionMenuElement_handleInvokerActivated(event) {
|
|
296
298
|
event.preventDefault();
|
|
299
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
297
300
|
event.stopPropagation();
|
|
298
301
|
if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isOpen).call(this)) {
|
|
299
302
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_hide).call(this);
|
|
@@ -320,7 +323,6 @@ _ActionMenuElement_handleDialogItemActivated = function _ActionMenuElement_handl
|
|
|
320
323
|
}
|
|
321
324
|
};
|
|
322
325
|
// a modal <dialog> element will close all popovers
|
|
323
|
-
setTimeout(() => __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_show).call(this), 0);
|
|
324
326
|
dialog.addEventListener('close', handleDialogClose, { signal });
|
|
325
327
|
dialog.addEventListener('cancel', handleDialogClose, { signal });
|
|
326
328
|
};
|
|
@@ -377,6 +379,7 @@ _ActionMenuElement_activateItem = function _ActionMenuElement_activateItem(event
|
|
|
377
379
|
return;
|
|
378
380
|
// otherwise, event will not result in activation by default, so we stop it and
|
|
379
381
|
// simulate a click
|
|
382
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
380
383
|
event.stopPropagation();
|
|
381
384
|
const elem = item;
|
|
382
385
|
elem.click();
|
|
@@ -26,6 +26,7 @@ function clickHandler(event) {
|
|
|
26
26
|
// If the user is clicking a valid dialog trigger
|
|
27
27
|
let dialogId = button === null || button === void 0 ? void 0 : button.getAttribute('data-show-dialog-id');
|
|
28
28
|
if (dialogId) {
|
|
29
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
29
30
|
event.stopPropagation();
|
|
30
31
|
const dialog = document.getElementById(dialogId);
|
|
31
32
|
if (dialog instanceof ModalDialogElement) {
|
|
@@ -169,11 +170,13 @@ _ModalDialogElement_focusAbortController = new WeakMap(), _ModalDialogElement_in
|
|
|
169
170
|
case 'Escape':
|
|
170
171
|
this.close();
|
|
171
172
|
event.preventDefault();
|
|
173
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
172
174
|
event.stopPropagation();
|
|
173
175
|
break;
|
|
174
176
|
case 'Enter': {
|
|
175
177
|
const target = event.target;
|
|
176
178
|
if (target.getAttribute('data-close-dialog-id') === this.id) {
|
|
179
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
177
180
|
event.stopPropagation();
|
|
178
181
|
}
|
|
179
182
|
break;
|
|
@@ -134,9 +134,9 @@ let ToggleSwitchElement = class ToggleSwitchElement extends HTMLElement {
|
|
|
134
134
|
credentials: 'same-origin',
|
|
135
135
|
method: 'POST',
|
|
136
136
|
headers: {
|
|
137
|
-
'Requested-With': 'XMLHttpRequest'
|
|
137
|
+
'Requested-With': 'XMLHttpRequest',
|
|
138
138
|
},
|
|
139
|
-
body
|
|
139
|
+
body,
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
catch (error) {
|
|
@@ -310,6 +310,7 @@ class ToolTipElement extends HTMLElement {
|
|
|
310
310
|
const isOpeningOtherPopover = event.type === 'beforetoggle' && event.currentTarget !== this;
|
|
311
311
|
const shouldHide = isMouseLeaveFromButton || isEscapeKeydown || isMouseDownOnButton || isOpeningOtherPopover;
|
|
312
312
|
if (showing && isEscapeKeydown) {
|
|
313
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
313
314
|
event.stopImmediatePropagation();
|
|
314
315
|
event.preventDefault();
|
|
315
316
|
}
|
|
@@ -77,6 +77,7 @@ let NavListElement = class NavListElement extends HTMLElement {
|
|
|
77
77
|
else {
|
|
78
78
|
this.expandItem(button);
|
|
79
79
|
}
|
|
80
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
80
81
|
e.stopPropagation();
|
|
81
82
|
}
|
|
82
83
|
// collapse item
|
|
@@ -97,6 +98,7 @@ let NavListElement = class NavListElement extends HTMLElement {
|
|
|
97
98
|
if (this.itemIsExpanded(button) && e.key === 'Escape') {
|
|
98
99
|
this.collapseItem(button);
|
|
99
100
|
}
|
|
101
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
100
102
|
e.stopPropagation();
|
|
101
103
|
}
|
|
102
104
|
};
|
|
@@ -11,6 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _DialogHelperElement_abortController;
|
|
13
13
|
function dialogInvokerButtonHandler(event) {
|
|
14
|
+
var _a;
|
|
14
15
|
const target = event.target;
|
|
15
16
|
const button = target === null || target === void 0 ? void 0 : target.closest('button');
|
|
16
17
|
if (!button || button.hasAttribute('disabled') || button.getAttribute('aria-disabled') === 'true')
|
|
@@ -25,6 +26,41 @@ function dialogInvokerButtonHandler(event) {
|
|
|
25
26
|
// If the behaviour is allowed through the dialog will be shown but then
|
|
26
27
|
// quickly hidden- as if it were never shown. This prevents that.
|
|
27
28
|
event.preventDefault();
|
|
29
|
+
// In some older browsers, such as Chrome 122, when a top layer element (such as a dialog)
|
|
30
|
+
// opens from within a popover, the "hide all popovers" internal algorithm runs, hiding
|
|
31
|
+
// any popover that is currently open, regardless of whether or not another top layer element,
|
|
32
|
+
// such as a <dialog> is nested inside.
|
|
33
|
+
// See https://github.com/whatwg/html/issues/9998.
|
|
34
|
+
// This is fixed by https://github.com/whatwg/html/pull/10116, but while we still support browsers
|
|
35
|
+
// that present this bug, we must undo the work they did to hide ancestral popovers of the dialog:
|
|
36
|
+
let node = button;
|
|
37
|
+
let fixed = false;
|
|
38
|
+
while (node) {
|
|
39
|
+
node = (_a = node.parentElement) === null || _a === void 0 ? void 0 : _a.closest('[popover]:not(:popover-open)');
|
|
40
|
+
if (node && node.popover === 'auto') {
|
|
41
|
+
node.classList.add('dialog-inside-popover-fix');
|
|
42
|
+
node.popover = 'manual';
|
|
43
|
+
node.showPopover();
|
|
44
|
+
fixed = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (fixed) {
|
|
48
|
+
// We need to re-open the dialog as modal, and also ensure no close event listeners
|
|
49
|
+
// are trying to act on the close
|
|
50
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
51
|
+
dialog.addEventListener('close', e => e.stopImmediatePropagation(), { once: true });
|
|
52
|
+
dialog.close();
|
|
53
|
+
dialog.showModal();
|
|
54
|
+
dialog.addEventListener('close', () => {
|
|
55
|
+
for (const el of dialog.ownerDocument.querySelectorAll('.dialog-inside-popover-fix')) {
|
|
56
|
+
if (el.contains(dialog)) {
|
|
57
|
+
el.classList.remove('dialog-inside-popover-fix');
|
|
58
|
+
el.popover = 'auto';
|
|
59
|
+
el.showPopover();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, { once: true });
|
|
63
|
+
}
|
|
28
64
|
}
|
|
29
65
|
}
|
|
30
66
|
dialogId = button.getAttribute('data-close-dialog-id') || button.getAttribute('data-submit-dialog-id');
|
|
@@ -52,21 +88,6 @@ export class DialogHelperElement extends HTMLElement {
|
|
|
52
88
|
for (const record of records) {
|
|
53
89
|
if (record.target === this.dialog) {
|
|
54
90
|
this.ownerDocument.body.classList.toggle('has-modal', this.dialog.hasAttribute('open'));
|
|
55
|
-
// In some older browsers, such as Chrome 122, when a top layer element (such as a dialog)
|
|
56
|
-
// opens from within a popover, the "hide all popovers" internal algorithm runs, hiding
|
|
57
|
-
// any popover that is currently open, regardless of whether or not another top layer element,
|
|
58
|
-
// such as a <dialog> is nested inside.
|
|
59
|
-
// See https://github.com/whatwg/html/issues/9998.
|
|
60
|
-
// This is fixed by https://github.com/whatwg/html/pull/10116, but while we still support browsers that present this bug,
|
|
61
|
-
// we must undo the work they did to hide ancestral popovers of the dialog:
|
|
62
|
-
if (this.dialog.hasAttribute('open')) {
|
|
63
|
-
let node = this.dialog;
|
|
64
|
-
while (node) {
|
|
65
|
-
node = node.closest('[popover]:not(:popover-open)');
|
|
66
|
-
if (node)
|
|
67
|
-
node.showPopover();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
91
|
}
|
|
71
92
|
}
|
|
72
93
|
}).observe(this, { subtree: true, attributeFilter: ['open'] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openproject/primer-view-components",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.2-rc.e4bf80fc",
|
|
4
4
|
"description": "ViewComponents of the Primer Design System for OpenProject",
|
|
5
5
|
"main": "app/assets/javascripts/primer_view_components.js",
|
|
6
6
|
"module": "app/components/primer/primer.js",
|
|
@@ -80,12 +80,12 @@
|
|
|
80
80
|
"mocha": "^10.0.0",
|
|
81
81
|
"playwright": "^1.35.1",
|
|
82
82
|
"postcss": "^8.4.16",
|
|
83
|
-
"postcss-cli": "^
|
|
83
|
+
"postcss-cli": "^11.0.0",
|
|
84
84
|
"postcss-custom-properties-fallback": "^1.0.2",
|
|
85
85
|
"postcss-import": "^16.0.0",
|
|
86
86
|
"postcss-mixins": "^9.0.3",
|
|
87
87
|
"postcss-preset-env": "^9.3.0",
|
|
88
|
-
"prettier": "3.2.
|
|
88
|
+
"prettier": "3.2.5",
|
|
89
89
|
"rollup": "^2.79.1",
|
|
90
90
|
"rollup-plugin-terser": "^7.0.2",
|
|
91
91
|
"stylelint": "^16.1.0",
|
package/static/info_arch.json
CHANGED
|
@@ -2232,7 +2232,7 @@
|
|
|
2232
2232
|
{
|
|
2233
2233
|
"fully_qualified_name": "Primer::Alpha::Banner",
|
|
2234
2234
|
"description": "Use `Banner` to highlight important information.",
|
|
2235
|
-
"accessibility_docs":
|
|
2235
|
+
"accessibility_docs": "Depending on the scenario, some Banners may need to receive focus when they appear. This helps to maximize discoverability of the message, especially in critical scenarios. Visit the [Banner's Accessibility section](https://primer.style/components/banner#accessibility) or defer to the accessibility team to determine if your scenario requires focusing the banner.\n\nTo properly focus a banner, add a `tabindex=\"-1\"` to the Banner container, and focus that container (one way is using the [`focus()` API](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus)).\n\nFor more information about the focus management technique, visit the [Accessible Banner Prototype docs](https://github.com/github/accessibility/blob/main/docs/coaching-recommendations/toast-flash-banner/accessible-banner-prototype.md#consideration). This guidance is subject to change.",
|
|
2236
2236
|
"is_form_component": false,
|
|
2237
2237
|
"is_published": true,
|
|
2238
2238
|
"requires_js": true,
|
|
@@ -3379,7 +3379,7 @@
|
|
|
3379
3379
|
{
|
|
3380
3380
|
"preview_path": "primer/alpha/dialog/dialog_inside_overlay",
|
|
3381
3381
|
"name": "dialog_inside_overlay",
|
|
3382
|
-
"snapshot": "
|
|
3382
|
+
"snapshot": "interactive",
|
|
3383
3383
|
"skip_rules": {
|
|
3384
3384
|
"wont_fix": [
|
|
3385
3385
|
"region"
|
package/static/previews.json
CHANGED