@primer/view-components 0.1.9 → 0.1.10-rc.00b86ce6

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.
@@ -9,17 +9,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
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
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _ActionMenuElement_instances, _ActionMenuElement_abortController, _ActionMenuElement_originalLabel, _ActionMenuElement_inputName, _ActionMenuElement_setDynamicLabel, _ActionMenuElement_updateInput, _ActionMenuElement_isEnterKeydown, _ActionMenuElement_firstItem_get;
12
+ var _ActionMenuElement_instances, _ActionMenuElement_abortController, _ActionMenuElement_originalLabel, _ActionMenuElement_inputName, _ActionMenuElement_setDynamicLabel, _ActionMenuElement_updateInput, _ActionMenuElement_isActivationKeydown, _ActionMenuElement_firstItem_get;
13
13
  import '@github/include-fragment-element';
14
- const popoverSelector = (() => {
15
- try {
16
- document.querySelector(':open');
17
- return ':open';
18
- }
19
- catch (_a) {
20
- return '.\\:open';
21
- }
22
- })();
23
14
  const menuItemSelectors = ['[role="menuitem"]', '[role="menuitemcheckbox"]', '[role="menuitemradio"]'];
24
15
  export class ActionMenuElement extends HTMLElement {
25
16
  constructor() {
@@ -101,7 +92,7 @@ export class ActionMenuElement extends HTMLElement {
101
92
  }
102
93
  handleEvent(event) {
103
94
  var _a, _b, _c, _d;
104
- if (event.target === this.invokerElement && __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isEnterKeydown).call(this, event)) {
95
+ if (event.target === this.invokerElement && __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isActivationKeydown).call(this, event)) {
105
96
  if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "a", _ActionMenuElement_firstItem_get)) {
106
97
  event.preventDefault();
107
98
  (_a = this.popoverElement) === null || _a === void 0 ? void 0 : _a.showPopover();
@@ -109,12 +100,12 @@ export class ActionMenuElement extends HTMLElement {
109
100
  return;
110
101
  }
111
102
  }
112
- if (!((_b = this.popoverElement) === null || _b === void 0 ? void 0 : _b.matches(popoverSelector)))
103
+ if (!((_b = this.popoverElement) === null || _b === void 0 ? void 0 : _b.matches(':popover-open')))
113
104
  return;
114
105
  if (event.type === 'focusout' && !this.contains(event.relatedTarget)) {
115
106
  (_c = this.popoverElement) === null || _c === void 0 ? void 0 : _c.hidePopover();
116
107
  }
117
- else if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isEnterKeydown).call(this, event) || (event instanceof MouseEvent && event.type === 'click')) {
108
+ else if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isActivationKeydown).call(this, event) || (event instanceof MouseEvent && event.type === 'click')) {
118
109
  const item = (_d = event.target.closest(menuItemSelectors.join(','))) === null || _d === void 0 ? void 0 : _d.closest('li');
119
110
  if (!item)
120
111
  return;
@@ -203,11 +194,11 @@ _ActionMenuElement_abortController = new WeakMap(), _ActionMenuElement_originalL
203
194
  input.remove();
204
195
  }
205
196
  }
206
- }, _ActionMenuElement_isEnterKeydown = function _ActionMenuElement_isEnterKeydown(event) {
197
+ }, _ActionMenuElement_isActivationKeydown = function _ActionMenuElement_isActivationKeydown(event) {
207
198
  return (event instanceof KeyboardEvent &&
208
199
  event.type === 'keydown' &&
209
200
  !(event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) &&
210
- event.key === 'Enter');
201
+ (event.key === 'Enter' || event.key === ' '));
211
202
  }, _ActionMenuElement_firstItem_get = function _ActionMenuElement_firstItem_get() {
212
203
  return this.querySelector(menuItemSelectors.join(','));
213
204
  };
@@ -21,7 +21,7 @@ const overlayStack = [];
21
21
  function clickHandler(event) {
22
22
  const target = event.target;
23
23
  const button = target === null || target === void 0 ? void 0 : target.closest('button');
24
- if (!button)
24
+ if (!button || button.hasAttribute('disabled') || button.getAttribute('aria-disabled') === 'true')
25
25
  return;
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');
@@ -0,0 +1 @@
1
+ .ButtonGroup{display:inline-flex}.ButtonGroup button{border-radius:0;margin-inline-end:-1px;position:relative}.ButtonGroup button:active,.ButtonGroup button:focus,.ButtonGroup button:hover{z-index:1}.ButtonGroup>.Button-withTooltip:first-child button,.ButtonGroup>:first-child{border-bottom-left-radius:var(--borderRadius-medium,6px);border-top-left-radius:var(--borderRadius-medium,6px)}.ButtonGroup>.Button-withTooltip:last-child button,.ButtonGroup>:last-child{border-bottom-right-radius:var(--borderRadius-medium,6px);border-top-right-radius:var(--borderRadius-medium,6px)}
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "beta/button_group",
3
+ "selectors": [
4
+ ".ButtonGroup",
5
+ ".ButtonGroup button",
6
+ ".ButtonGroup button:active",
7
+ ".ButtonGroup button:focus",
8
+ ".ButtonGroup button:hover",
9
+ ".ButtonGroup>.Button-withTooltip:first-child button",
10
+ ".ButtonGroup>:first-child",
11
+ ".ButtonGroup>.Button-withTooltip:last-child button",
12
+ ".ButtonGroup>:last-child"
13
+ ]
14
+ }
@@ -12,15 +12,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
12
12
  var _FocusGroupElement_instances, _FocusGroupElement_abortController, _FocusGroupElement_items_get;
13
13
  import '@oddbird/popover-polyfill';
14
14
  const menuItemSelector = '[role="menuitem"],[role="menuitemcheckbox"],[role="menuitemradio"]';
15
- const popoverSelector = (() => {
16
- try {
17
- document.querySelector(':popover-open');
18
- return ':popover-open';
19
- }
20
- catch (_a) {
21
- return '.\\:popover-open';
22
- }
23
- })();
24
15
  const getMnemonicFor = (item) => { var _a; return (_a = item.textContent) === null || _a === void 0 ? void 0 : _a.trim()[0].toLowerCase(); };
25
16
  const printable = /^\S$/;
26
17
  export default class FocusGroupElement extends HTMLElement {
@@ -128,7 +119,7 @@ export default class FocusGroupElement extends HTMLElement {
128
119
  {
129
120
  let el = focusEl;
130
121
  do {
131
- el = el.closest(`[popover]:not(${popoverSelector})`);
122
+ el = el.closest(`[popover]:not(:popover-open)`);
132
123
  if ((el === null || el === void 0 ? void 0 : el.popover) === 'auto') {
133
124
  el.showPopover();
134
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/view-components",
3
- "version": "0.1.9",
3
+ "version": "0.1.10-rc.00b86ce6",
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",
@@ -54,12 +54,13 @@
54
54
  "@github/mini-throttle": "^2.1.0",
55
55
  "@github/relative-time-element": "^4.0.0",
56
56
  "@github/tab-container-element": "^3.1.2",
57
- "@oddbird/popover-polyfill": "^0.1.1",
57
+ "@oddbird/popover-polyfill": "^0.2.1",
58
58
  "@primer/behaviors": "^1.3.4"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@changesets/changelog-github": "^0.4.6",
62
62
  "@changesets/cli": "^2.24.1",
63
+ "@github/axe-github": "^0.5.0",
63
64
  "@github/browserslist-config": "^1.0.0",
64
65
  "@github/markdownlint-github": "^0.2.2",
65
66
  "@github/prettier-config": "0.0.4",
@@ -70,7 +71,7 @@
70
71
  "@rollup/plugin-typescript": "^8.3.3",
71
72
  "@typescript-eslint/eslint-plugin": "^5.31.0",
72
73
  "@typescript-eslint/parser": "^5.31.0",
73
- "axe-core": "^4.6.2",
74
+ "axe-core": "^4.7.1",
74
75
  "chokidar-cli": "^3.0.0",
75
76
  "cssnano": "^5.1.13",
76
77
  "eslint": "^8.23.1",
@@ -3153,16 +3153,16 @@
3153
3153
  "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/beta/button_group/default/",
3154
3154
  "parameters": [
3155
3155
  {
3156
- "name": "variant",
3156
+ "name": "scheme",
3157
3157
  "type": "Symbol",
3158
- "default": "`nil`",
3159
- "description": "DEPRECATED. One of `:medium` or `:small`."
3158
+ "default": "`:default`",
3159
+ "description": "DEPRECATED. One of `:danger`, `:default`, `:invisible`, `:link`, `:primary`, or `:secondary`."
3160
3160
  },
3161
3161
  {
3162
3162
  "name": "size",
3163
3163
  "type": "Symbol",
3164
3164
  "default": "`:medium`",
3165
- "description": "One of `:medium` or `:small`."
3165
+ "description": "One of `:large`, `:medium`, or `:small`."
3166
3166
  },
3167
3167
  {
3168
3168
  "name": "system_arguments",