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