@primer/view-components 0.50.0 → 0.50.1-rc.2a07ad50

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.
@@ -165,6 +165,6 @@ __decorate([
165
165
  target
166
166
  ], ActionBarElement.prototype, "moreMenu", void 0);
167
167
  ActionBarElement = __decorate([
168
- controller
168
+ controller('action-bar')
169
169
  ], ActionBarElement);
170
170
  window.ActionBarElement = ActionBarElement;
@@ -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 };
@@ -485,7 +485,7 @@ __decorate([
485
485
  target
486
486
  ], ActionMenuElement.prototype, "overlay", void 0);
487
487
  ActionMenuElement = __decorate([
488
- controller
488
+ controller('action-menu')
489
489
  ], ActionMenuElement);
490
490
  export { ActionMenuElement };
491
491
  if (!window.customElements.get('action-menu')) {
@@ -39,7 +39,7 @@ __decorate([
39
39
  targets
40
40
  ], SegmentedControlElement.prototype, "items", void 0);
41
41
  SegmentedControlElement = __decorate([
42
- controller
42
+ controller('segmented-control')
43
43
  ], SegmentedControlElement);
44
44
  if (!window.customElements.get('segmented-control')) {
45
45
  window.SegmentedControlElement = SegmentedControlElement;
@@ -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')) {
@@ -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;
@@ -354,7 +354,7 @@ __decorate([
354
354
  target
355
355
  ], TreeViewElement.prototype, "formInputPrototype", void 0);
356
356
  TreeViewElement = __decorate([
357
- controller
357
+ controller('tree-view')
358
358
  ], TreeViewElement);
359
359
  export { TreeViewElement };
360
360
  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 {
@@ -134,6 +134,10 @@ let TreeViewSubTreeNodeElement = class TreeViewSubTreeNodeElement extends HTMLEl
134
134
  // sub-tree and no node in the entire tree can be focused
135
135
  const previousNode = this.subTree.querySelector("[tabindex='0']");
136
136
  previousNode?.setAttribute('tabindex', '-1');
137
+ // Also check if the subtree element itself is an include-fragment with role="treeitem" and has focus
138
+ if (__classPrivateFieldGet(this, _TreeViewSubTreeNodeElement_instances, "m", _TreeViewSubTreeNodeElement_isIncludeFragment).call(this) && this.subTree.getAttribute('tabindex') === '0') {
139
+ this.subTree.setAttribute('tabindex', '-1');
140
+ }
137
141
  this.node.setAttribute('tabindex', '0');
138
142
  this.treeView.dispatchEvent(new CustomEvent('treeViewNodeCollapsed', {
139
143
  bubbles: true,
@@ -237,6 +241,10 @@ _TreeViewSubTreeNodeElement_handleIncludeFragmentEvent = function _TreeViewSubTr
237
241
  // request succeeded but element has not yet been replaced
238
242
  case 'include-fragment-replace':
239
243
  __classPrivateFieldSet(this, _TreeViewSubTreeNodeElement_activeElementIsLoader, document.activeElement === this.loadingIndicator.closest('[role=treeitem]'), "f");
244
+ // Also check if the include-fragment itself has focus (when it has role="treeitem")
245
+ if (!__classPrivateFieldGet(this, _TreeViewSubTreeNodeElement_activeElementIsLoader, "f") && document.activeElement === this.subTree && __classPrivateFieldGet(this, _TreeViewSubTreeNodeElement_instances, "m", _TreeViewSubTreeNodeElement_isIncludeFragment).call(this)) {
246
+ __classPrivateFieldSet(this, _TreeViewSubTreeNodeElement_activeElementIsLoader, true, "f");
247
+ }
240
248
  this.loadingState = 'success';
241
249
  break;
242
250
  case 'include-fragment-replaced':
@@ -332,6 +340,13 @@ _TreeViewSubTreeNodeElement_update = function _TreeViewSubTreeNodeElement_update
332
340
  if (this.expanded) {
333
341
  if (this.subTree)
334
342
  this.subTree.hidden = false;
343
+ if (__classPrivateFieldGet(this, _TreeViewSubTreeNodeElement_instances, "m", _TreeViewSubTreeNodeElement_isIncludeFragment).call(this)) {
344
+ this.subTree.setAttribute('role', 'treeitem');
345
+ // Ensure the include-fragment can participate in roving tab index
346
+ if (!this.subTree.hasAttribute('tabindex')) {
347
+ this.subTree.setAttribute('tabindex', '-1');
348
+ }
349
+ }
335
350
  this.node.setAttribute('aria-expanded', 'true');
336
351
  this.treeView?.expandAncestorsForNode(this);
337
352
  if (this.iconPair) {
@@ -345,6 +360,11 @@ _TreeViewSubTreeNodeElement_update = function _TreeViewSubTreeNodeElement_update
345
360
  else {
346
361
  if (this.subTree)
347
362
  this.subTree.hidden = true;
363
+ if (__classPrivateFieldGet(this, _TreeViewSubTreeNodeElement_instances, "m", _TreeViewSubTreeNodeElement_isIncludeFragment).call(this)) {
364
+ this.subTree.removeAttribute('role');
365
+ // Remove tabindex when role is removed
366
+ this.subTree.removeAttribute('tabindex');
367
+ }
348
368
  this.node.setAttribute('aria-expanded', 'false');
349
369
  if (this.iconPair) {
350
370
  this.iconPair.showCollapsed();
@@ -375,6 +395,9 @@ _TreeViewSubTreeNodeElement_update = function _TreeViewSubTreeNodeElement_update
375
395
  this.loadingFailureMessage.hidden = true;
376
396
  }
377
397
  };
398
+ _TreeViewSubTreeNodeElement_isIncludeFragment = function _TreeViewSubTreeNodeElement_isIncludeFragment() {
399
+ return this.subTree?.getAttribute('data-target')?.includes('tree-view-sub-tree-node.includeFragment') ?? false;
400
+ };
378
401
  _TreeViewSubTreeNodeElement_checkboxElement_get = function _TreeViewSubTreeNodeElement_checkboxElement_get() {
379
402
  return this.querySelector('.TreeViewItemCheckbox');
380
403
  };
@@ -409,7 +432,7 @@ __decorate([
409
432
  target
410
433
  ], TreeViewSubTreeNodeElement.prototype, "retryButton", void 0);
411
434
  TreeViewSubTreeNodeElement = __decorate([
412
- controller
435
+ controller('tree-view-sub-tree-node')
413
436
  ], TreeViewSubTreeNodeElement);
414
437
  export { TreeViewSubTreeNodeElement };
415
438
  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;
@@ -60,6 +60,6 @@ __decorate([
60
60
  target
61
61
  ], DetailsToggleElement.prototype, "summaryTarget", void 0);
62
62
  DetailsToggleElement = __decorate([
63
- controller
63
+ controller('details-toggle')
64
64
  ], DetailsToggleElement);
65
65
  window.DetailsToggleElement = DetailsToggleElement;
@@ -187,6 +187,6 @@ __decorate([
187
187
  target
188
188
  ], NavListElement.prototype, "topLevelList", void 0);
189
189
  NavListElement = __decorate([
190
- controller
190
+ controller('nav-list')
191
191
  ], NavListElement);
192
192
  export { NavListElement };
@@ -105,7 +105,7 @@ __decorate([
105
105
  targets
106
106
  ], NavListGroupElement.prototype, "focusMarkers", void 0);
107
107
  NavListGroupElement = __decorate([
108
- controller
108
+ controller('nav-list-group')
109
109
  ], NavListGroupElement);
110
110
  export { NavListGroupElement };
111
111
  window.NavListGroupElement = NavListGroupElement;
@@ -46,7 +46,7 @@ __decorate([
46
46
  attr
47
47
  ], ScrollableRegionElement.prototype, "labelledBy", void 0);
48
48
  ScrollableRegionElement = __decorate([
49
- controller
49
+ controller('scrollable-region')
50
50
  ], ScrollableRegionElement);
51
51
  export { ScrollableRegionElement };
52
52
  window.ScrollableRegionElement = ScrollableRegionElement;
@@ -35,7 +35,7 @@ __decorate([
35
35
  targets
36
36
  ], PrimerMultiInputElement.prototype, "fields", void 0);
37
37
  PrimerMultiInputElement = __decorate([
38
- controller
38
+ controller('primer-multi-input')
39
39
  ], PrimerMultiInputElement);
40
40
  export { PrimerMultiInputElement };
41
41
  if (!window.customElements.get('primer-multi-input')) {
@@ -44,7 +44,7 @@ __decorate([
44
44
  target
45
45
  ], PrimerTextAreaElement.prototype, "characterLimitSrElement", void 0);
46
46
  PrimerTextAreaElement = __decorate([
47
- controller
47
+ controller('primer-text-area')
48
48
  ], PrimerTextAreaElement);
49
49
  export { PrimerTextAreaElement };
50
50
  if (!window.customElements.get('primer-text-area')) {
@@ -128,6 +128,6 @@ __decorate([
128
128
  target
129
129
  ], PrimerTextFieldElement.prototype, "characterLimitSrElement", void 0);
130
130
  PrimerTextFieldElement = __decorate([
131
- controller
131
+ controller('primer-text-field')
132
132
  ], PrimerTextFieldElement);
133
133
  export { PrimerTextFieldElement };
@@ -29,6 +29,6 @@ __decorate([
29
29
  target
30
30
  ], ToggleSwitchInputElement.prototype, "validationMessageElement", void 0);
31
31
  ToggleSwitchInputElement = __decorate([
32
- controller
32
+ controller('toggle-switch-input')
33
33
  ], ToggleSwitchInputElement);
34
34
  export { ToggleSwitchInputElement };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/view-components",
3
- "version": "0.50.0",
3
+ "version": "0.50.1-rc.2a07ad50",
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",
@@ -45,7 +45,7 @@
45
45
  "dependencies": {
46
46
  "@github/auto-check-element": "^6.0.0",
47
47
  "@github/auto-complete-element": "^3.8.0",
48
- "@github/catalyst": "^1.6.0",
48
+ "@github/catalyst": "^1.8.0",
49
49
  "@github/clipboard-copy-element": "^1.3.0",
50
50
  "@github/details-menu-element": "^1.0.12",
51
51
  "@github/image-crop-element": "^5.0.0",
@@ -78,14 +78,14 @@
78
78
  "eslint": "^9.10.0",
79
79
  "eslint-plugin-github": "^6.0.0",
80
80
  "glob": "^11.0.2",
81
- "markdownlint-cli2": "^0.19.1",
81
+ "markdownlint-cli2": "^0.20.0",
82
82
  "mocha": "^11.0.1",
83
83
  "playwright": "^1.57.0",
84
84
  "postcss": "^8.4.16",
85
85
  "postcss-cli": "^11.0.0",
86
86
  "postcss-import": "^16.0.0",
87
87
  "postcss-mixins": "^12.1.2",
88
- "postcss-preset-env": "^10.0.2",
88
+ "postcss-preset-env": "^11.1.2",
89
89
  "prettier": "^3.3.2",
90
90
  "rollup": "^2.79.1",
91
91
  "rollup-plugin-terser": "^7.0.2",
@@ -4629,7 +4629,7 @@
4629
4629
  {
4630
4630
  "fully_qualified_name": "Primer::Alpha::Layout",
4631
4631
  "description": "`Layout` provides foundational patterns for responsive pages.\n`Layout` can be used for simple two-column pages, or it can be nested to provide flexible 3-column experiences.\n On smaller screens, `Layout` uses vertically stacked rows to display content.\n\n`Layout` flows as both column, when there's enough horizontal space to render both `Main` and `Sidebar`side-by-side (on a desktop of tablet device, per instance);\nor it flows as a row, when `Main` and `Sidebar` are stacked vertically (e.g. on a mobile device).\n`Layout` should always work in any screen size.",
4632
- "accessibility_docs": "Keyboard navigation follows the markup order. Decide carefully how the focus order should be be by deciding whether\n`main` or `sidebar` comes first in code. The code order wont affect the visual position.",
4632
+ "accessibility_docs": "Keyboard navigation follows the markup order. Decide carefully how the focus order should be be by deciding whether\n`main` or `sidebar` comes first in code. The code order won't affect the visual position.\n\nWhen using `row_placement: :none` on the sidebar, the sidebar content will be hidden at narrow viewports.\nThis may cause WCAG 1.4.10 Reflow failures if the sidebar contains essential content. Only use `:none`\nwhen the sidebar content is non-essential or available elsewhere on the page.",
4633
4633
  "is_form_component": false,
4634
4634
  "is_published": true,
4635
4635
  "requires_js": false,
@@ -4704,7 +4704,7 @@
4704
4704
  "name": "row_placement",
4705
4705
  "type": "Symbol",
4706
4706
  "default": "N/A",
4707
- "description": "Sidebar placement when `Layout` is in row mode. One of `:end`, `:none`, or `:start`."
4707
+ "description": "Sidebar placement when `Layout` is in row mode. One of `:end`, `:none`, or `:start`. **Note:** Using `:none` hides the sidebar at narrow viewports, which may cause WCAG 1.4.10 Reflow issues if the sidebar contains essential content."
4708
4708
  },
4709
4709
  {
4710
4710
  "name": "system_arguments",