@primer/view-components 0.18.2-rc.ed9bb1a8 → 0.18.2

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.
@@ -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].style.setProperty('visibility', 'visible');
144
- __classPrivateFieldGet(this, _ActionBarElement_instances, "a", _ActionBarElement_menuItems_get)[index].hidden = true;
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].style.setProperty('visibility', 'hidden');
148
- __classPrivateFieldGet(this, _ActionBarElement_instances, "a", _ActionBarElement_menuItems_get)[index].hidden = false;
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);
@@ -376,6 +379,7 @@ _ActionMenuElement_activateItem = function _ActionMenuElement_activateItem(event
376
379
  return;
377
380
  // otherwise, event will not result in activation by default, so we stop it and
378
381
  // simulate a click
382
+ /* eslint-disable-next-line no-restricted-syntax */
379
383
  event.stopPropagation();
380
384
  const elem = item;
381
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
  };
@@ -47,6 +47,7 @@ function dialogInvokerButtonHandler(event) {
47
47
  if (fixed) {
48
48
  // We need to re-open the dialog as modal, and also ensure no close event listeners
49
49
  // are trying to act on the close
50
+ /* eslint-disable-next-line no-restricted-syntax */
50
51
  dialog.addEventListener('close', e => e.stopImmediatePropagation(), { once: true });
51
52
  dialog.close();
52
53
  dialog.showModal();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/view-components",
3
- "version": "0.18.2-rc.ed9bb1a8",
3
+ "version": "0.18.2",
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",
@@ -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": null,
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,