@openproject/primer-view-components 0.86.2 → 0.87.0-rc.482ee0ea9

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.
@@ -469,6 +469,7 @@ _ActionMenuElement_handleItemActivated = function _ActionMenuElement_handleItemA
469
469
  else {
470
470
  // multi-select mode allows unchecking a checked item
471
471
  item.setAttribute('aria-checked', `${checked}`);
472
+ __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_setDynamicLabel).call(this);
472
473
  }
473
474
  __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_updateInput).call(this);
474
475
  this.dispatchEvent(new CustomEvent('itemActivated', {
@@ -498,21 +499,29 @@ _ActionMenuElement_isOpen = function _ActionMenuElement_isOpen() {
498
499
  return this.popoverElement?.matches(':popover-open');
499
500
  };
500
501
  _ActionMenuElement_setDynamicLabel = function _ActionMenuElement_setDynamicLabel() {
501
- if (this.selectVariant !== 'single')
502
- return;
503
502
  if (!this.dynamicLabel)
504
503
  return;
505
504
  const invokerLabel = this.invokerLabel;
506
505
  if (!invokerLabel)
507
506
  return;
508
507
  __classPrivateFieldSet(this, _ActionMenuElement_originalLabel, __classPrivateFieldGet(this, _ActionMenuElement_originalLabel, "f") || (invokerLabel.textContent || ''), "f");
509
- const itemLabel = this.querySelector('[aria-checked=true] .ActionListItem-label');
508
+ let itemLabel;
509
+ if (this.selectVariant === 'single') {
510
+ itemLabel = this.querySelector('[aria-checked=true] .ActionListItem-label')?.textContent?.trim();
511
+ }
512
+ else if (this.selectVariant === 'multiple') {
513
+ itemLabel = Array.from(this.querySelectorAll(`[aria-checked=true] .ActionListItem-label`))
514
+ .map(label => (label.textContent || '').trim())
515
+ .filter(Boolean)
516
+ .join(', ');
517
+ }
518
+ itemLabel || (itemLabel = __classPrivateFieldGet(this, _ActionMenuElement_originalLabel, "f"));
510
519
  if (itemLabel && this.dynamicLabel) {
511
520
  const prefixSpan = document.createElement('span');
512
521
  prefixSpan.classList.add('color-fg-muted');
513
522
  const contentSpan = document.createElement('span');
514
- prefixSpan.textContent = this.dynamicLabelPrefix;
515
- contentSpan.textContent = itemLabel.textContent || '';
523
+ prefixSpan.textContent = this.dynamicLabelPrefix ? `${this.dynamicLabelPrefix} ` : '';
524
+ contentSpan.textContent = itemLabel;
516
525
  invokerLabel.replaceChildren(prefixSpan, contentSpan);
517
526
  }
518
527
  else {
@@ -866,6 +866,7 @@ _SelectPanelElement_handleItemActivated = function _SelectPanelElement_handleIte
866
866
  else {
867
867
  __classPrivateFieldGet(this, _SelectPanelElement_instances, "m", _SelectPanelElement_removeSelectedItem).call(this, item);
868
868
  }
869
+ __classPrivateFieldGet(this, _SelectPanelElement_instances, "m", _SelectPanelElement_setDynamicLabel).call(this);
869
870
  }
870
871
  __classPrivateFieldGet(this, _SelectPanelElement_instances, "m", _SelectPanelElement_updateInput).call(this);
871
872
  __classPrivateFieldGet(this, _SelectPanelElement_instances, "m", _SelectPanelElement_updateTabIndices).call(this);
@@ -885,7 +886,16 @@ _SelectPanelElement_setDynamicLabel = function _SelectPanelElement_setDynamicLab
885
886
  if (!invokerLabel)
886
887
  return;
887
888
  __classPrivateFieldSet(this, _SelectPanelElement_originalLabel, __classPrivateFieldGet(this, _SelectPanelElement_originalLabel, "f") || (invokerLabel.textContent || ''), "f");
888
- const itemLabel = this.querySelector(`[${this.ariaSelectionType}=true] .ActionListItem-label`)?.textContent || __classPrivateFieldGet(this, _SelectPanelElement_originalLabel, "f");
889
+ let itemLabel;
890
+ if (this.selectVariant === 'single') {
891
+ itemLabel = this.querySelector(`[${this.ariaSelectionType}=true] .ActionListItem-label`)?.textContent;
892
+ }
893
+ else if (this.selectVariant === 'multiple') {
894
+ itemLabel = Array.from(this.querySelectorAll(`[${this.ariaSelectionType}=true] .ActionListItem-label`))
895
+ .map(label => label.textContent?.trim() ?? '')
896
+ .join(', ');
897
+ }
898
+ itemLabel || (itemLabel = __classPrivateFieldGet(this, _SelectPanelElement_originalLabel, "f"));
889
899
  if (itemLabel) {
890
900
  const prefixSpan = document.createElement('span');
891
901
  prefixSpan.classList.add('color-fg-muted');
@@ -24,9 +24,10 @@ let SubHeaderElement = class SubHeaderElement extends HTMLElement {
24
24
  }
25
25
  expandFilterInput() {
26
26
  for (const item of this.shownItemsOnExpandedFilter) {
27
- item.classList.remove('d-none');
27
+ item.classList.remove('d-none', 'd-sm-none');
28
28
  }
29
29
  for (const item of this.filterExpandButton) {
30
+ item.classList.remove('d-inline-flex', 'd-sm-inline-flex');
30
31
  item.classList.add('d-none');
31
32
  }
32
33
  this.classList.add('SubHeader--expandedSearch');
@@ -37,7 +38,7 @@ let SubHeaderElement = class SubHeaderElement extends HTMLElement {
37
38
  item.classList.remove('d-none');
38
39
  }
39
40
  for (const item of this.shownItemsOnExpandedFilter) {
40
- item.classList.add('d-none');
41
+ item.classList.add('d-none', 'd-sm-none');
41
42
  }
42
43
  this.classList.remove('SubHeader--expandedSearch');
43
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openproject/primer-view-components",
3
- "version": "0.86.2",
3
+ "version": "0.87.0-rc.482ee0ea9",
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",
@@ -6600,10 +6600,10 @@
6600
6600
  ]
6601
6601
  },
6602
6602
  {
6603
- "component": "OpenProject::SubHeader::QuickFilter",
6603
+ "component": "OpenProject::SubHeader::QuickActionComponent",
6604
6604
  "status": "open_project",
6605
6605
  "a11y_reviewed": false,
6606
- "short_name": "OpenProjectSubHeaderQuickFilter",
6606
+ "short_name": "OpenProjectSubHeaderQuickActionComponent",
6607
6607
  "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/sub_header/quick_filter.rb",
6608
6608
  "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/sub_header/quick_filter/default/",
6609
6609
  "parameters": []
@@ -173,7 +173,7 @@
173
173
  "Primer::OpenProject::SubHeader::Button": "",
174
174
  "Primer::OpenProject::SubHeader::ButtonGroup": "",
175
175
  "Primer::OpenProject::SubHeader::Menu": "",
176
- "Primer::OpenProject::SubHeader::QuickFilter": "",
176
+ "Primer::OpenProject::SubHeader::QuickActionComponent": "",
177
177
  "Primer::OpenProject::SubHeader::SegmentedControl": "2023-02-01",
178
178
  "Primer::OpenProject::ZenModeButton": "",
179
179
  "Primer::Tooltip": "",
@@ -1996,7 +1996,7 @@
1996
1996
  "none"
1997
1997
  ],
1998
1998
  "Menu": "Primer::OpenProject::SubHeader::Menu",
1999
- "QuickFilter": "Primer::OpenProject::SubHeader::QuickFilter",
1999
+ "QuickActionComponent": "Primer::OpenProject::SubHeader::QuickActionComponent",
2000
2000
  "SHOWN_FILTER_TARGET_SELECTOR": "sub-header.shownItemsOnExpandedFilter",
2001
2001
  "SegmentedControl": "Primer::OpenProject::SubHeader::SegmentedControl"
2002
2002
  },
@@ -2009,8 +2009,8 @@
2009
2009
  "Primer::OpenProject::SubHeader::Menu": {
2010
2010
  "GeneratedSlotMethods": "Primer::OpenProject::SubHeader::Menu::GeneratedSlotMethods"
2011
2011
  },
2012
- "Primer::OpenProject::SubHeader::QuickFilter": {
2013
- "GeneratedSlotMethods": "Primer::OpenProject::SubHeader::QuickFilter::GeneratedSlotMethods"
2012
+ "Primer::OpenProject::SubHeader::QuickActionComponent": {
2013
+ "GeneratedSlotMethods": "Primer::OpenProject::SubHeader::QuickActionComponent::GeneratedSlotMethods"
2014
2014
  },
2015
2015
  "Primer::OpenProject::SubHeader::SegmentedControl": {
2016
2016
  "GeneratedSlotMethods": "Primer::OpenProject::SubHeader::SegmentedControl::GeneratedSlotMethods"
@@ -22108,16 +22108,16 @@
22108
22108
  "subcomponents": []
22109
22109
  },
22110
22110
  {
22111
- "fully_qualified_name": "Primer::OpenProject::SubHeader::QuickFilter",
22111
+ "fully_qualified_name": "Primer::OpenProject::SubHeader::QuickActionComponent",
22112
22112
  "description": "Thin wrapper for quick filter slots that defers BaseComponent construction to render time,\nallowing system arguments (e.g. display) to be mutated in before_render.\nDo not use standalone",
22113
22113
  "accessibility_docs": null,
22114
22114
  "is_form_component": false,
22115
22115
  "is_published": true,
22116
22116
  "requires_js": false,
22117
- "component": "OpenProject::SubHeader::QuickFilter",
22117
+ "component": "OpenProject::SubHeader::QuickActionComponent",
22118
22118
  "status": "open_project",
22119
22119
  "a11y_reviewed": false,
22120
- "short_name": "OpenProjectSubHeaderQuickFilter",
22120
+ "short_name": "OpenProjectSubHeaderQuickActionComponent",
22121
22121
  "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/sub_header/quick_filter.rb",
22122
22122
  "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/sub_header/quick_filter/default/",
22123
22123
  "parameters": [],
@@ -173,7 +173,7 @@
173
173
  "Primer::OpenProject::SubHeader::Button": "open_project",
174
174
  "Primer::OpenProject::SubHeader::ButtonGroup": "open_project",
175
175
  "Primer::OpenProject::SubHeader::Menu": "open_project",
176
- "Primer::OpenProject::SubHeader::QuickFilter": "open_project",
176
+ "Primer::OpenProject::SubHeader::QuickActionComponent": "open_project",
177
177
  "Primer::OpenProject::SubHeader::SegmentedControl": "open_project",
178
178
  "Primer::OpenProject::ZenModeButton": "open_project",
179
179
  "Primer::Tooltip": "deprecated",