@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.
@@ -1440,6 +1440,8 @@ const PdsCombobox$1 = /*@__PURE__*/ proxyCustomElement(class PdsCombobox extends
1440
1440
  this.hideLabel = false;
1441
1441
  /**
1442
1442
  * Determines the combobox mode: 'filter' (filter options as you type) or 'select-only' (show all options).
1443
+ * In filter mode, reopening the menu while the input still shows the label of the selected option temporarily lists
1444
+ * all options until you type (so you can switch to a different choice without clearing the field first).
1443
1445
  * @default 'filter'
1444
1446
  */
1445
1447
  this.mode = 'filter';
@@ -1542,8 +1544,15 @@ const PdsCombobox$1 = /*@__PURE__*/ proxyCustomElement(class PdsCombobox extends
1542
1544
  this.optionEls = [];
1543
1545
  this.allItems = [];
1544
1546
  this.isUpdatingFromSelection = false;
1547
+ /**
1548
+ * In filter mode, after choosing an option the input still shows the label and would
1549
+ * otherwise filter the list to matching substrings only. While this flag is true,
1550
+ * the list shows every option until the user types (then normal filtering applies).
1551
+ */
1552
+ this.expandFilterListWhileOpen = false;
1545
1553
  this.handleInput = (e) => {
1546
1554
  const target = e.target;
1555
+ this.clearExpandFilterList();
1547
1556
  this.displayText = target.value;
1548
1557
  this.isOpen = true;
1549
1558
  this.filterOptions();
@@ -1559,19 +1568,26 @@ const PdsCombobox$1 = /*@__PURE__*/ proxyCustomElement(class PdsCombobox extends
1559
1568
  // Open dropdown when input is clicked (but not when tabbed into)
1560
1569
  if (!this.isOpen) {
1561
1570
  this.isOpen = true;
1571
+ this.prepareExpandFilterListOnOpen();
1562
1572
  this.filterOptions();
1563
1573
  // Trigger initial fetch if async and no options loaded yet
1564
1574
  if (this.asyncUrl && this.internalOptions.length === 0) {
1565
1575
  this.debouncedFetchAsyncOptions(this.displayText, 1);
1566
1576
  }
1567
1577
  this.setInitialHighlightedIndex();
1568
- setTimeout(() => this.openDropdownPositioning(), 0);
1578
+ setTimeout(() => {
1579
+ this.openDropdownPositioning();
1580
+ if (this.trigger === 'input' && this.expandFilterListWhileOpen && this.inputEl) {
1581
+ this.inputEl.select();
1582
+ }
1583
+ }, 0);
1569
1584
  }
1570
1585
  };
1571
1586
  this.handleKeyDown = (e) => {
1572
1587
  if (!this.isOpen && (e.key === 'ArrowDown' || e.key === 'ArrowUp' || (e.altKey && e.key === 'ArrowDown'))) {
1573
1588
  e.preventDefault();
1574
1589
  this.isOpen = true;
1590
+ this.prepareExpandFilterListOnOpen();
1575
1591
  this.filterOptions();
1576
1592
  // Set highlighted index immediately for testing
1577
1593
  this.setInitialHighlightedIndex();
@@ -1664,6 +1680,7 @@ const PdsCombobox$1 = /*@__PURE__*/ proxyCustomElement(class PdsCombobox extends
1664
1680
  e.preventDefault();
1665
1681
  this.isOpen = false;
1666
1682
  this.highlightedIndex = -1;
1683
+ this.clearExpandFilterList();
1667
1684
  this.isArrowKeyNavigationMode = false; // Reset arrow-key navigation mode
1668
1685
  this.restoreFocusToTrigger();
1669
1686
  break;
@@ -1671,6 +1688,7 @@ const PdsCombobox$1 = /*@__PURE__*/ proxyCustomElement(class PdsCombobox extends
1671
1688
  // Allow normal tab behavior to close dropdown and move focus
1672
1689
  this.isOpen = false;
1673
1690
  this.highlightedIndex = -1;
1691
+ this.clearExpandFilterList();
1674
1692
  this.isArrowKeyNavigationMode = false; // Reset arrow-key navigation mode
1675
1693
  break;
1676
1694
  }
@@ -1702,6 +1720,7 @@ const PdsCombobox$1 = /*@__PURE__*/ proxyCustomElement(class PdsCombobox extends
1702
1720
  this.onButtonTriggerClick = () => {
1703
1721
  this.isOpen = !this.isOpen;
1704
1722
  if (this.isOpen) {
1723
+ this.prepareExpandFilterListOnOpen();
1705
1724
  this.filterOptions();
1706
1725
  // Trigger initial fetch if async and no options loaded yet
1707
1726
  if (this.asyncUrl && this.internalOptions.length === 0) {
@@ -1715,6 +1734,7 @@ const PdsCombobox$1 = /*@__PURE__*/ proxyCustomElement(class PdsCombobox extends
1715
1734
  }
1716
1735
  else {
1717
1736
  // Reset navigation mode when closing
1737
+ this.clearExpandFilterList();
1718
1738
  this.isArrowKeyNavigationMode = false;
1719
1739
  }
1720
1740
  };
@@ -1724,6 +1744,7 @@ const PdsCombobox$1 = /*@__PURE__*/ proxyCustomElement(class PdsCombobox extends
1724
1744
  e.preventDefault();
1725
1745
  e.stopPropagation(); // Prevent the event from bubbling and triggering click
1726
1746
  this.isOpen = true;
1747
+ this.prepareExpandFilterListOnOpen();
1727
1748
  this.filterOptions();
1728
1749
  // Set highlighted index immediately
1729
1750
  this.setInitialHighlightedIndex();
@@ -1738,6 +1759,7 @@ const PdsCombobox$1 = /*@__PURE__*/ proxyCustomElement(class PdsCombobox extends
1738
1759
  if (this.isOpen) {
1739
1760
  this.isOpen = false;
1740
1761
  this.highlightedIndex = -1;
1762
+ this.clearExpandFilterList();
1741
1763
  this.updateAriaActiveDescendant(); // Clear aria-activedescendant
1742
1764
  this.restoreFocusToTrigger();
1743
1765
  }
@@ -1765,6 +1787,7 @@ const PdsCombobox$1 = /*@__PURE__*/ proxyCustomElement(class PdsCombobox extends
1765
1787
  if (!isRelatedTargetInCombobox && !isRelatedTargetInListbox) {
1766
1788
  this.isOpen = false;
1767
1789
  this.highlightedIndex = -1;
1790
+ this.clearExpandFilterList();
1768
1791
  this.isArrowKeyNavigationMode = false; // Reset arrow-key navigation mode
1769
1792
  this.updateAriaActiveDescendant(); // Clear aria-activedescendant
1770
1793
  // If there's a selected option but the display text doesn't match, restore the selected option's display text
@@ -2162,7 +2185,7 @@ const PdsCombobox$1 = /*@__PURE__*/ proxyCustomElement(class PdsCombobox extends
2162
2185
  if (this.allItems.length === 0 && this.optionEls.length > 0) {
2163
2186
  this.allItems = [...this.optionEls];
2164
2187
  }
2165
- if (this.mode === 'select-only') {
2188
+ if (this.mode === 'select-only' || this.expandFilterListWhileOpen) {
2166
2189
  this.filteredItems = [...this.allItems];
2167
2190
  }
2168
2191
  else {
@@ -2203,6 +2226,23 @@ const PdsCombobox$1 = /*@__PURE__*/ proxyCustomElement(class PdsCombobox extends
2203
2226
  }
2204
2227
  this.highlightedIndex = -1;
2205
2228
  }
2229
+ clearExpandFilterList() {
2230
+ this.expandFilterListWhileOpen = false;
2231
+ }
2232
+ /**
2233
+ * When reopening the dropdown in filter mode with the input still showing the
2234
+ * committed selection label, show the full option list until the user edits the query.
2235
+ */
2236
+ prepareExpandFilterListOnOpen() {
2237
+ if (this.mode === 'filter' &&
2238
+ this.selectedOption &&
2239
+ this.displayText === this.getOptionLabel(this.selectedOption)) {
2240
+ this.expandFilterListWhileOpen = true;
2241
+ }
2242
+ else {
2243
+ this.expandFilterListWhileOpen = false;
2244
+ }
2245
+ }
2206
2246
  openDropdownPositioning() {
2207
2247
  if (this.triggerEl && this.listboxEl) {
2208
2248
  // Apply width and max-height BEFORE positioning calculations
@@ -2478,6 +2518,7 @@ const PdsCombobox$1 = /*@__PURE__*/ proxyCustomElement(class PdsCombobox extends
2478
2518
  // The @Watch('selectedOption') will handle displayText, value, and form internals
2479
2519
  this.setSelectedOption(option);
2480
2520
  this.isOpen = false;
2521
+ this.clearExpandFilterList();
2481
2522
  this.pdsComboboxChange.emit({ value: option.value });
2482
2523
  }
2483
2524
  renderDropdown() {
@@ -2636,10 +2677,10 @@ const PdsCombobox$1 = /*@__PURE__*/ proxyCustomElement(class PdsCombobox extends
2636
2677
  ]
2637
2678
  .filter(Boolean)
2638
2679
  .join(' ');
2639
- 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 => {
2680
+ 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 => {
2640
2681
  this.inputEl = el;
2641
2682
  this.triggerEl = el;
2642
- }, 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())));
2683
+ }, 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())));
2643
2684
  }
2644
2685
  static get formAssociated() { return true; }
2645
2686
  get el() { return this; }