@pine-ds/core 3.25.0 → 3.25.1

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.
@@ -1434,6 +1434,8 @@ const PdsCombobox = class {
1434
1434
  this.hideLabel = false;
1435
1435
  /**
1436
1436
  * Determines the combobox mode: 'filter' (filter options as you type) or 'select-only' (show all options).
1437
+ * In filter mode, reopening the menu while the input still shows the label of the selected option temporarily lists
1438
+ * all options until you type (so you can switch to a different choice without clearing the field first).
1437
1439
  * @default 'filter'
1438
1440
  */
1439
1441
  this.mode = 'filter';
@@ -1536,8 +1538,15 @@ const PdsCombobox = class {
1536
1538
  this.optionEls = [];
1537
1539
  this.allItems = [];
1538
1540
  this.isUpdatingFromSelection = false;
1541
+ /**
1542
+ * In filter mode, after choosing an option the input still shows the label and would
1543
+ * otherwise filter the list to matching substrings only. While this flag is true,
1544
+ * the list shows every option until the user types (then normal filtering applies).
1545
+ */
1546
+ this.expandFilterListWhileOpen = false;
1539
1547
  this.handleInput = (e) => {
1540
1548
  const target = e.target;
1549
+ this.clearExpandFilterList();
1541
1550
  this.displayText = target.value;
1542
1551
  this.isOpen = true;
1543
1552
  this.filterOptions();
@@ -1553,19 +1562,26 @@ const PdsCombobox = class {
1553
1562
  // Open dropdown when input is clicked (but not when tabbed into)
1554
1563
  if (!this.isOpen) {
1555
1564
  this.isOpen = true;
1565
+ this.prepareExpandFilterListOnOpen();
1556
1566
  this.filterOptions();
1557
1567
  // Trigger initial fetch if async and no options loaded yet
1558
1568
  if (this.asyncUrl && this.internalOptions.length === 0) {
1559
1569
  this.debouncedFetchAsyncOptions(this.displayText, 1);
1560
1570
  }
1561
1571
  this.setInitialHighlightedIndex();
1562
- setTimeout(() => this.openDropdownPositioning(), 0);
1572
+ setTimeout(() => {
1573
+ this.openDropdownPositioning();
1574
+ if (this.trigger === 'input' && this.expandFilterListWhileOpen && this.inputEl) {
1575
+ this.inputEl.select();
1576
+ }
1577
+ }, 0);
1563
1578
  }
1564
1579
  };
1565
1580
  this.handleKeyDown = (e) => {
1566
1581
  if (!this.isOpen && (e.key === 'ArrowDown' || e.key === 'ArrowUp' || (e.altKey && e.key === 'ArrowDown'))) {
1567
1582
  e.preventDefault();
1568
1583
  this.isOpen = true;
1584
+ this.prepareExpandFilterListOnOpen();
1569
1585
  this.filterOptions();
1570
1586
  // Set highlighted index immediately for testing
1571
1587
  this.setInitialHighlightedIndex();
@@ -1658,6 +1674,7 @@ const PdsCombobox = class {
1658
1674
  e.preventDefault();
1659
1675
  this.isOpen = false;
1660
1676
  this.highlightedIndex = -1;
1677
+ this.clearExpandFilterList();
1661
1678
  this.isArrowKeyNavigationMode = false; // Reset arrow-key navigation mode
1662
1679
  this.restoreFocusToTrigger();
1663
1680
  break;
@@ -1665,6 +1682,7 @@ const PdsCombobox = class {
1665
1682
  // Allow normal tab behavior to close dropdown and move focus
1666
1683
  this.isOpen = false;
1667
1684
  this.highlightedIndex = -1;
1685
+ this.clearExpandFilterList();
1668
1686
  this.isArrowKeyNavigationMode = false; // Reset arrow-key navigation mode
1669
1687
  break;
1670
1688
  }
@@ -1696,6 +1714,7 @@ const PdsCombobox = class {
1696
1714
  this.onButtonTriggerClick = () => {
1697
1715
  this.isOpen = !this.isOpen;
1698
1716
  if (this.isOpen) {
1717
+ this.prepareExpandFilterListOnOpen();
1699
1718
  this.filterOptions();
1700
1719
  // Trigger initial fetch if async and no options loaded yet
1701
1720
  if (this.asyncUrl && this.internalOptions.length === 0) {
@@ -1709,6 +1728,7 @@ const PdsCombobox = class {
1709
1728
  }
1710
1729
  else {
1711
1730
  // Reset navigation mode when closing
1731
+ this.clearExpandFilterList();
1712
1732
  this.isArrowKeyNavigationMode = false;
1713
1733
  }
1714
1734
  };
@@ -1718,6 +1738,7 @@ const PdsCombobox = class {
1718
1738
  e.preventDefault();
1719
1739
  e.stopPropagation(); // Prevent the event from bubbling and triggering click
1720
1740
  this.isOpen = true;
1741
+ this.prepareExpandFilterListOnOpen();
1721
1742
  this.filterOptions();
1722
1743
  // Set highlighted index immediately
1723
1744
  this.setInitialHighlightedIndex();
@@ -1732,6 +1753,7 @@ const PdsCombobox = class {
1732
1753
  if (this.isOpen) {
1733
1754
  this.isOpen = false;
1734
1755
  this.highlightedIndex = -1;
1756
+ this.clearExpandFilterList();
1735
1757
  this.updateAriaActiveDescendant(); // Clear aria-activedescendant
1736
1758
  this.restoreFocusToTrigger();
1737
1759
  }
@@ -1759,6 +1781,7 @@ const PdsCombobox = class {
1759
1781
  if (!isRelatedTargetInCombobox && !isRelatedTargetInListbox) {
1760
1782
  this.isOpen = false;
1761
1783
  this.highlightedIndex = -1;
1784
+ this.clearExpandFilterList();
1762
1785
  this.isArrowKeyNavigationMode = false; // Reset arrow-key navigation mode
1763
1786
  this.updateAriaActiveDescendant(); // Clear aria-activedescendant
1764
1787
  // If there's a selected option but the display text doesn't match, restore the selected option's display text
@@ -2156,7 +2179,7 @@ const PdsCombobox = class {
2156
2179
  if (this.allItems.length === 0 && this.optionEls.length > 0) {
2157
2180
  this.allItems = [...this.optionEls];
2158
2181
  }
2159
- if (this.mode === 'select-only') {
2182
+ if (this.mode === 'select-only' || this.expandFilterListWhileOpen) {
2160
2183
  this.filteredItems = [...this.allItems];
2161
2184
  }
2162
2185
  else {
@@ -2197,6 +2220,23 @@ const PdsCombobox = class {
2197
2220
  }
2198
2221
  this.highlightedIndex = -1;
2199
2222
  }
2223
+ clearExpandFilterList() {
2224
+ this.expandFilterListWhileOpen = false;
2225
+ }
2226
+ /**
2227
+ * When reopening the dropdown in filter mode with the input still showing the
2228
+ * committed selection label, show the full option list until the user edits the query.
2229
+ */
2230
+ prepareExpandFilterListOnOpen() {
2231
+ if (this.mode === 'filter' &&
2232
+ this.selectedOption &&
2233
+ this.displayText === this.getOptionLabel(this.selectedOption)) {
2234
+ this.expandFilterListWhileOpen = true;
2235
+ }
2236
+ else {
2237
+ this.expandFilterListWhileOpen = false;
2238
+ }
2239
+ }
2200
2240
  openDropdownPositioning() {
2201
2241
  if (this.triggerEl && this.listboxEl) {
2202
2242
  // Apply width and max-height BEFORE positioning calculations
@@ -2472,6 +2512,7 @@ const PdsCombobox = class {
2472
2512
  // The @Watch('selectedOption') will handle displayText, value, and form internals
2473
2513
  this.setSelectedOption(option);
2474
2514
  this.isOpen = false;
2515
+ this.clearExpandFilterList();
2475
2516
  this.pdsComboboxChange.emit({ value: option.value });
2476
2517
  }
2477
2518
  renderDropdown() {
@@ -2630,10 +2671,10 @@ const PdsCombobox = class {
2630
2671
  ]
2631
2672
  .filter(Boolean)
2632
2673
  .join(' ');
2633
- return (index.h(index.Host, { key: '6a8f372c89a896d2d7e67661e84053c4c95b93c9' }, index.h("div", { key: '7b4747885bfa9aaa6e698bf13b6cdf9d4e77b3b1', class: "pds-combobox", tabIndex: -1, onFocusout: this.onComboboxFocusOut, part: "combobox" }, this.label && !this.hideLabel && (index.h("label", { key: '46acd60080458de682516becc6144b38675a3f2d', htmlFor: this.componentId, class: "pds-combobox__label" }, this.label)), this.trigger === 'input' ? (index.h("div", { class: "pds-combobox__input-wrapper", style: { width: this.triggerWidth } }, index.h("input", { ref: el => {
2674
+ return (index.h(index.Host, { key: '28c9653028e7fd67ccd8361a84108fbe11b1303f' }, index.h("div", { key: 'd9a3d6c4d3ca1c6135501e702be8beeffcafdf0d', class: "pds-combobox", tabIndex: -1, onFocusout: this.onComboboxFocusOut, part: "combobox" }, this.label && !this.hideLabel && (index.h("label", { key: '8832180ca4ee60506d464115aff2503d3aeb6c52', htmlFor: this.componentId, class: "pds-combobox__label" }, this.label)), this.trigger === 'input' ? (index.h("div", { class: "pds-combobox__input-wrapper", style: { width: this.triggerWidth } }, index.h("input", { ref: el => {
2634
2675
  this.inputEl = el;
2635
2676
  this.triggerEl = el;
2636
- }, class: "pds-combobox__input", type: "text", role: "combobox", "aria-autocomplete": "list", "aria-controls": "pds-combobox-listbox", "aria-activedescendant": this.isOpen && this.highlightedIndex >= 0 ? `pds-combobox-option-${this.highlightedIndex}` : undefined, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-label": this.hideLabel ? this.label : undefined, id: this.componentId, value: this.displayText, placeholder: this.placeholder, disabled: this.disabled, onInput: this.handleInput, onClick: this.handleInputClick, onKeyDown: this.handleKeyDown, autocomplete: "off", part: "input" }), index.h("pds-icon", { icon: "enlarge", "aria-hidden": "true", class: "pds-combobox__input-icon" }))) : this.trigger === 'chip' ? (index.h("div", { class: this.getChipTriggerClass(), style: { width: this.triggerWidth }, role: "combobox", "aria-haspopup": "listbox", "aria-controls": "pds-combobox-listbox", "aria-activedescendant": this.isOpen && this.highlightedIndex >= 0 ? `pds-combobox-option-${this.highlightedIndex}` : undefined, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-label": this.hideLabel ? this.label : undefined, id: this.componentId, tabIndex: this.disabled ? -1 : 0, onClick: this.onButtonTriggerClick, "data-layout": this.customTriggerContent, onKeyDown: this.onButtonTriggerKeyDown, onKeyUp: this.onButtonTriggerKeyUp, ref: el => (this.triggerEl = el), part: "chip-trigger" }, this.renderChipTriggerContent())) : (index.h("div", { class: triggerClass, style: { width: this.triggerWidth }, role: "combobox", "aria-haspopup": "listbox", "aria-controls": "pds-combobox-listbox", "aria-activedescendant": this.isOpen && this.highlightedIndex >= 0 ? `pds-combobox-option-${this.highlightedIndex}` : undefined, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-label": this.hideLabel ? this.label : undefined, id: this.componentId, tabIndex: this.disabled ? -1 : 0, onClick: this.onButtonTriggerClick, "data-layout": this.customTriggerContent, onKeyDown: this.onButtonTriggerKeyDown, onKeyUp: this.onButtonTriggerKeyUp, ref: el => (this.triggerEl = el), part: "button-trigger" }, this.renderButtonTriggerContent())), index.h("div", { key: '4e4bd7cb7139416f3f59b1c9736a1fad85c09c24', style: { display: 'none' } }, index.h("slot", { key: '79e4c181d161a56acba68e1f7ca932369e938e10', onSlotchange: () => this.updateOptions() })), this.renderDropdown())));
2677
+ }, class: "pds-combobox__input", type: "text", role: "combobox", "aria-autocomplete": "list", "aria-controls": "pds-combobox-listbox", "aria-activedescendant": this.isOpen && this.highlightedIndex >= 0 ? `pds-combobox-option-${this.highlightedIndex}` : undefined, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-label": this.hideLabel ? this.label : undefined, id: this.componentId, value: this.displayText, placeholder: this.placeholder, disabled: this.disabled, onInput: this.handleInput, onClick: this.handleInputClick, onKeyDown: this.handleKeyDown, autocomplete: "off", part: "input" }), index.h("pds-icon", { icon: "enlarge", "aria-hidden": "true", class: "pds-combobox__input-icon" }))) : this.trigger === 'chip' ? (index.h("div", { class: this.getChipTriggerClass(), style: { width: this.triggerWidth }, role: "combobox", "aria-haspopup": "listbox", "aria-controls": "pds-combobox-listbox", "aria-activedescendant": this.isOpen && this.highlightedIndex >= 0 ? `pds-combobox-option-${this.highlightedIndex}` : undefined, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-label": this.hideLabel ? this.label : undefined, id: this.componentId, tabIndex: this.disabled ? -1 : 0, onClick: this.onButtonTriggerClick, "data-layout": this.customTriggerContent, onKeyDown: this.onButtonTriggerKeyDown, onKeyUp: this.onButtonTriggerKeyUp, ref: el => (this.triggerEl = el), part: "chip-trigger" }, this.renderChipTriggerContent())) : (index.h("div", { class: triggerClass, style: { width: this.triggerWidth }, role: "combobox", "aria-haspopup": "listbox", "aria-controls": "pds-combobox-listbox", "aria-activedescendant": this.isOpen && this.highlightedIndex >= 0 ? `pds-combobox-option-${this.highlightedIndex}` : undefined, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-label": this.hideLabel ? this.label : undefined, id: this.componentId, tabIndex: this.disabled ? -1 : 0, onClick: this.onButtonTriggerClick, "data-layout": this.customTriggerContent, onKeyDown: this.onButtonTriggerKeyDown, onKeyUp: this.onButtonTriggerKeyUp, ref: el => (this.triggerEl = el), part: "button-trigger" }, this.renderButtonTriggerContent())), index.h("div", { key: '3f2ac580f226fc9a0bf72539804d0b514a93f5b8', style: { display: 'none' } }, index.h("slot", { key: '075205fb4fed8d0e4aec43531593444c1ab8e1cd', onSlotchange: () => this.updateOptions() })), this.renderDropdown())));
2637
2678
  }
2638
2679
  static get formAssociated() { return true; }
2639
2680
  get el() { return index.getElement(this); }