@sky.ui/core 0.0.24 → 0.0.26

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/custom-elements.json +1116 -1116
  4. package/dist/helper/controllers/animation-controller.js.map +1 -1
  5. package/dist/helper/controllers/popover-controller.js +1 -1
  6. package/dist/helper/controllers/popover-controller.js.map +1 -1
  7. package/dist/helper/iconify-offline.js.map +1 -1
  8. package/dist/helper/internals/form-control-base.js +1 -1
  9. package/dist/helper/internals/form-control-base.js.map +1 -1
  10. package/dist/helper/utils/color-resolver.js.map +1 -1
  11. package/dist/helper/utils/size-resolver.js.map +1 -1
  12. package/dist/sky-alert/sky-alert.js +45 -45
  13. package/dist/sky-alert/sky-alert.js.map +1 -1
  14. package/dist/sky-appbar/sky-appbar.js +30 -30
  15. package/dist/sky-appbar/sky-appbar.js.map +1 -1
  16. package/dist/sky-avatar/sky-avatar.js +25 -25
  17. package/dist/sky-avatar/sky-avatar.js.map +1 -1
  18. package/dist/sky-badge/sky-badge.d.ts +1 -1
  19. package/dist/sky-badge/sky-badge.js +27 -27
  20. package/dist/sky-badge/sky-badge.js.map +1 -1
  21. package/dist/sky-button/sky-button.js +25 -25
  22. package/dist/sky-button/sky-button.js.map +1 -1
  23. package/dist/sky-card/sky-card.js +22 -22
  24. package/dist/sky-card/sky-card.js.map +1 -1
  25. package/dist/sky-checkbox/sky-checkbox.d.ts +2 -2
  26. package/dist/sky-checkbox/sky-checkbox.js +43 -43
  27. package/dist/sky-checkbox/sky-checkbox.js.map +1 -1
  28. package/dist/sky-chip/sky-chip.js +35 -35
  29. package/dist/sky-chip/sky-chip.js.map +1 -1
  30. package/dist/sky-col/sky-col.js +7 -7
  31. package/dist/sky-col/sky-col.js.map +1 -1
  32. package/dist/sky-combobox/sky-combobox.d.ts +2 -2
  33. package/dist/sky-combobox/sky-combobox.js +244 -244
  34. package/dist/sky-combobox/sky-combobox.js.map +1 -1
  35. package/dist/sky-dialog/sky-dialog.js +43 -43
  36. package/dist/sky-dialog/sky-dialog.js.map +1 -1
  37. package/dist/sky-divider/sky-divider.js +16 -16
  38. package/dist/sky-divider/sky-divider.js.map +1 -1
  39. package/dist/sky-flexbox/sky-flexbox.js +9 -9
  40. package/dist/sky-flexbox/sky-flexbox.js.map +1 -1
  41. package/dist/sky-flexcol/sky-flexcol.js +2 -2
  42. package/dist/sky-flexcol/sky-flexcol.js.map +1 -1
  43. package/dist/sky-form/sky-form.js +12 -12
  44. package/dist/sky-form/sky-form.js.map +1 -1
  45. package/dist/sky-grid/sky-grid.js +6 -6
  46. package/dist/sky-grid/sky-grid.js.map +1 -1
  47. package/dist/sky-icon/sky-icon.js +13 -13
  48. package/dist/sky-icon/sky-icon.js.map +1 -1
  49. package/dist/sky-image/sky-image.js +21 -21
  50. package/dist/sky-image/sky-image.js.map +1 -1
  51. package/dist/sky-image/srcset-utils.js.map +1 -1
  52. package/dist/sky-input/sky-input.d.ts +2 -2
  53. package/dist/sky-input/sky-input.js +225 -225
  54. package/dist/sky-input/sky-input.js.map +1 -1
  55. package/dist/sky-list/sky-list.js +6 -6
  56. package/dist/sky-list/sky-list.js.map +1 -1
  57. package/dist/sky-listitem/sky-listitem.js +31 -31
  58. package/dist/sky-listitem/sky-listitem.js.map +1 -1
  59. package/dist/sky-radio/sky-radio.d.ts +2 -2
  60. package/dist/sky-radio/sky-radio.js +27 -27
  61. package/dist/sky-radio/sky-radio.js.map +1 -1
  62. package/dist/sky-row/sky-row.js +2 -2
  63. package/dist/sky-row/sky-row.js.map +1 -1
  64. package/dist/sky-sheet/sky-sheet.js +2 -2
  65. package/dist/sky-sheet/sky-sheet.js.map +1 -1
  66. package/dist/sky-simple-table/sky-simple-table.js +34 -34
  67. package/dist/sky-simple-table/sky-simple-table.js.map +1 -1
  68. package/dist/sky-theme-provider/sky-theme-provider.js +2 -2
  69. package/dist/sky-theme-provider/sky-theme-provider.js.map +1 -1
  70. package/package.json +2 -17
  71. package/plugins/rollup-plugin.d.ts +5 -8
  72. package/plugins/vite-plugin.d.ts +5 -8
  73. package/plugins/webpack-plugin.d.ts +3 -7
@@ -1,4 +1,246 @@
1
- import{__decorate as t,__metadata as e}from"tslib";import{css as i,LitElement as s,html as o}from"lit";import{property as r,state as n,query as a,queryAll as l,queryAssignedElements as d,customElement as h}from"lit/decorators.js";import{unsafeHTML as c}from"lit/directives/unsafe-html.js";import{when as p}from"lit/directives/when.js";import{repeat as y}from"lit/directives/repeat.js";import{classMap as u}from"lit/directives/class-map.js";import{resolveColor as v}from"../helper/utils/color-resolver.js";import{PopoverController as g}from"../helper/controllers/popover-controller.js";import{FormControlBase as m}from"../helper/internals/form-control-base.js";import{SkyIcon as f}from"../sky-icon/sky-icon.js";import{SkyCheckbox as b}from"../sky-checkbox/sky-checkbox.js";var k;let x=class extends m{static{k=this}static{this.dependencies={"sky-icon":f,"sky-checkbox":b}}get options(){return this._options}set options(t){const e=this._options;this._options=Array.isArray(t)?t:[],this.requestUpdate("options",e)}get validations(){return this._validations}set validations(t){const e=this._validations;this._validations=Array.isArray(t)?t:[],this.requestUpdate("validations",e)}static{this._SEARCH_DEBOUNCE_MS=150}static{this._SEARCH_DEBOUNCE_OPTIONS_THRESHOLD=30}static{this.styles=i`
1
+ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state as o,query as r,queryAll as a,queryAssignedElements as n,customElement as l}from"lit/decorators.js";import{unsafeHTML as h}from"lit/directives/unsafe-html.js";import{when as c}from"lit/directives/when.js";import{repeat as d}from"lit/directives/repeat.js";import{classMap as p}from"lit/directives/class-map.js";import{resolveColor as y}from"../helper/utils/color-resolver.js";import{PopoverController as u}from"../helper/controllers/popover-controller.js";import{FormControlBase as v}from"../helper/internals/form-control-base.js";import{SkyIcon as m}from"../sky-icon/sky-icon.js";import{SkyCheckbox as g}from"../sky-checkbox/sky-checkbox.js";var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,k=(t,e,i,s)=>{for(var o,r=s>1?void 0:s?b(e,i):e,a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&f(e,i,r),r};let x=class extends v{constructor(){super(),this.value="",this.placeholder="Select An Option",this.searchPlaceholder="Search...",this.label="",this._options=[],this.chipSize=20,this.color="primary",this.clearable=!1,this.loading=!1,this.compact=!1,this.disabled=!1,this.searchable=!1,this.multiSelect=!1,this.visibleChips=2,this.selectAll=!1,this._validations=[],this.showErrors=!1,this.errorDisplayMode="single",this.required=!1,this.emitFullObject=!1,this.emittedKey="value",this.displayKey="",this.addOption=!1,this.validationArrayFormat=!1,this.prefix="",this.suffix="",this.prefixColor="",this.suffixColor="",this.justify="flex-start",this.zIndex=11,this.height="200px",this.requiredMessage="Selection is required.",this.readonly=!1,this.enforceMinOneSelection=!1,this.openAbove=!1,this.validationActive=!1,this.invalid=!1,this.variant="default",this.searchQuery="",this.filteredOptions=[],this.focused=!1,this.open=!1,this.selectedItems=[],this.hiddenChipsOpen=!1,this.activeIndex=-1,this.validationErrors=[],this.validationStatus=[],this.hasLeftIcon=!1,this.hasRightIcon=!1,this.optionSlotSet=new Set,this._searchDebounceId=null,this.dropdownPopover=new u(this,{getAnchor:()=>this.inputWrapperEl,getPopover:()=>this.dropdownEl,cssVarLeft:"--sky-dd-left",cssVarTop:"--sky-dd-top",cssVarWidth:"--sky-dd-width",getPlacement:()=>"bottom",getAlign:()=>"start",getGap:()=>6,getPadding:()=>8,getMatchAnchorWidth:()=>!0,getMaxWidthToViewport:()=>!0,getMaxWidthMode:()=>"cap",getFlip:()=>!0,getFlipOrder:()=>[],getAnimateReposition:()=>!0,getRepositionMs:()=>160,getCloseOnEscape:()=>!0,getCloseOnOutside:()=>!0,getRestoreFocusOnClose:()=>!0,onOpenChange:(t,e)=>{this.open=t,t?(this.validationActive=!0,this.filterOptions(),requestAnimationFrame(()=>this.focusOnOpen())):(this.activeIndex=-1,this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions(),this.hiddenChipsOpen=!1,this.hiddenPopover.closePopover("api"))}}),this.hiddenPopover=new u(this,{getAnchor:()=>this.overflowChipEl,getPopover:()=>this.hiddenDropdownEl,cssVarLeft:"--sky-hc-left",cssVarTop:"--sky-hc-top",cssVarWidth:"--sky-hc-width",getPlacement:()=>"bottom",getAlign:()=>"center",getGap:()=>4,getPadding:()=>8,getMatchAnchorWidth:()=>!1,getMaxWidthToViewport:()=>!0,getMaxWidthMode:()=>"cap",getFlip:()=>!0,getFlipOrder:()=>[],getAnimateReposition:()=>!0,getRepositionMs:()=>120,getCloseOnEscape:()=>!0,getCloseOnOutside:()=>!0,getRestoreFocusOnClose:()=>!1,onOpenChange:t=>{this.hiddenChipsOpen=t,t&&this.open&&this.dropdownPopover.closePopover("api")}}),this.refreshOptionSlots=()=>{const t=new Set;this.querySelectorAll('[slot^="option-"]').forEach(e=>{const i=e.slot;i&&t.add(i)}),this.optionSlotSet=t},this.onSearchKeydown=t=>{const{key:e,shiftKey:i}=t;if("Enter"===e)return t.preventDefault(),t.stopPropagation(),void this.commitDropdownEnter();if("ArrowDown"===e||"ArrowUp"===e||"Tab"===e){t.preventDefault(),t.stopPropagation();const i=this.searchable||this.addOption,s=this.multiSelect&&this.selectAll?i?1:0:this.headerRows,o=this.headerRows+Math.max(0,this.filteredOptions.length)-1,r="ArrowUp"===e||"Tab"===e&&t.shiftKey?-1:1;this.activeIndex<s?this.activeIndex=s:this.activeIndex=this.activeIndex+r<s?o:this.activeIndex+r>o?s:this.activeIndex+r,this.scrollActiveItemIntoView()}return"Escape"===e?(t.preventDefault(),t.stopPropagation(),void this.dropdownPopover.closePopover("escape")):void 0},this.handleAddaddOption=t=>{if(t.stopPropagation(),this.disabled||this.readonly)return;if(!this.canAddaddOption())return;const e=this.searchQuery.trim();this.dispatchEvent(new CustomEvent("add-new-option",{detail:{value:e},bubbles:!0,composed:!0})),this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions()},this.onIconSlotChange=()=>{this.hasLeftIcon=(this.iconLeftEls?.length??0)>0,this.hasRightIcon=(this.iconRightEls?.length??0)>0},this.captureDefaultValue("")}get options(){return this._options}set options(t){const e=this._options;this._options=Array.isArray(t)?t:[],this.requestUpdate("options",e)}get validations(){return this._validations}set validations(t){const e=this._validations;this._validations=Array.isArray(t)?t:[],this.requestUpdate("validations",e)}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||(this.tabIndex=this.disabled?-1:0),this.refreshOptionSlots()}firstUpdated(){this.dropdownPopover.refreshTargets(),this.hiddenPopover.refreshTargets()}getFormValue(){if(this.disabled||!this.name)return null;if(this.multiSelect){const t=new FormData;return this.selectedItems.forEach(e=>{const i=this.emitFullObject?JSON.stringify(e):String(this.getOptionValue(e));t.append(this.name,i)}),0===this.selectedItems.length&&this.required&&t.append(this.name,""),t}{if(0===this.selectedItems.length)return"";const t=this.selectedItems[0];return this.emitFullObject?JSON.stringify(t):String(this.getOptionValue(t))}}setValueFromFormState(t){if(null===t||""===t)return this.value=this.multiSelect?[]:"",void(this.selectedItems=[]);if(this.multiSelect){let e=[];if(t instanceof FormData)e=t.getAll(this.name);else if(Array.isArray(t))e=t;else if("string"==typeof t)try{const i=JSON.parse(t);e=Array.isArray(i)?i:[t]}catch{e=[t]}this.setValueFromArray(e)}else{let e="";"string"==typeof t?e=t:t instanceof FormData?e=t.get(this.name)?.toString()||"":Array.isArray(t)&&t.length>0&&(e=t[0].toString()),this.value=e,this.syncSelectedItemsWithValue()}}syncFormValue(){if(!this.name||this.disabled)return void this.internals.setFormValue(null);const t=this.getFormValue();if(null!==t)if(this.multiSelect&&Array.isArray(t)){const e=new FormData;t.forEach(t=>{null!=t&&""!==t&&e.append(this.name,String(t))}),this.internals.setFormValue(e)}else this.internals.setFormValue(t);else this.internals.setFormValue(null)}setValueFromArray(t){const e=Array.isArray(this.options)?this.options:[];this.selectedItems=e.filter(e=>{const i=this.getOptionValue(e),s=this.emitFullObject?JSON.stringify(e):String(i);return t.some(t=>{const e=String(t);if(!this.emitFullObject)return e===s;try{const t=JSON.parse(e);return JSON.stringify(t)===s}catch{return e===s}})}),this.value=this.selectedItems.map(t=>this.emitFullObject?t:this.getOptionValue(t))}getValidityAnchor(){return this}isEmpty(){return this.multiSelect?0===this.selectedItems.length:0===this.selectedItems.length||!this.value}getNativeControl(){return this.inputWrapperEl||null}getCustomErrorMessage(){return this.validationErrors?.[0]||""}onFormReset(){super.onFormReset(),this.searchQuery="",this.emitSearchQueryChanged(),this.open=!1,this.invalid=!1,this.validationErrors=[],this.validationActive=!1}onFormDisabled(t){this.disabled=t}onFormStateRestore(t){this.setValueFromFormState(t)}toggleSelectAll(){if(this.disabled||this.readonly)return;const t=t=>String(this.getOptionValue(t));if(this.isAllFilteredSelected()){const e=new Set(this.filteredOptions.map(t=>String(this.getOptionValue(t.original)))),i=this.selectedItems.filter(i=>!e.has(t(i)));if(this.enforceMinOneSelection&&0===i.length)return;this.selectedItems=i}else{const e=new Set(this.selectedItems.map(e=>t(e))),i=this.filteredOptions.map(t=>t.original).filter(i=>!e.has(t(i)));this.selectedItems=[...this.selectedItems,...i]}const e=this.selectedItems.map(t=>this.emitFullObject?t:this.getOptionValue(t));this.value=e,this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:e,selectedItems:[...this.selectedItems],emittedValues:e,isFilteredSelection:!!this.searchQuery.trim()},bubbles:!0,composed:!0})),this.syncFormValue(),this.syncValidity(),this.requestUpdate()}isAllFilteredSelected(){if(0===this.filteredOptions.length)return!1;return this.filteredOptions.map(t=>this.getOptionValue(t.original)).every(t=>this.selectedItems.some(e=>this.getOptionValue(e)===t))}truncateText(t,e){return t.length>e?t.slice(0,e)+"...":t}validateInput(){if(!this.validationActive)return;this.validationErrors=[];const t=this.validationArrayFormat?this.selectedItems:this.value;if(this.required&&this.isEmpty())this.validationErrors.push(this.requiredMessage||"Selection is required.");else if(Array.isArray(this.validations)&&this.validations.length)for(const e of this.validations){const i=e(t);!0!==i&&this.validationErrors.push(String(i||"Invalid value."))}this.invalid=this.validationErrors.length>0,this.dispatchEvent(new CustomEvent(this.invalid?"validation-error":"validation-success",{detail:this.invalid?{errors:this.validationErrors}:{value:this.selectedItems},bubbles:!0,composed:!0})),this.syncValidity(),this.requestUpdate()}validateForForm(){if(this.disabled)return"";const t=this.validationArrayFormat?this.selectedItems:this.value;if(Array.isArray(this.validations)&&this.validations.length)for(const e of this.validations){const i=e(t);if(!0!==i)return String(i||"Invalid value.")}return this.enforceMinOneSelection&&this.isEmpty()?this.requiredMessage||"At least one selection is required.":this.required&&this.isEmpty()?this.requiredMessage||"Selection is required.":""}focus(t){super.focus(t),this.searchInputEl?this.searchInputEl.focus(t):this.inputWrapperEl&&this.inputWrapperEl.focus(t)}blur(){this.open&&this.dropdownPopover.closePopover("light-dismiss"),super.blur()}handleFocus(){this.focused=!0,this.validationActive||(this.validationActive=!0)}reset(){this.value=this.multiSelect?[]:"",this.selectedItems=[],this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions(),this.validationErrors=[],this.validationActive=!1,this.open=!1,this.invalid=!1,this.syncFormValue(),this.syncValidity(),this.requestUpdate()}openDropdown(){this.disabled||this.readonly||this.dropdownPopover.openPopover()}closeDropdown(){this.dropdownPopover.closePopover("api")}clearSelection(){this.handleClear()}handleBlur(){this.focused=!1,this.validationActive&&this.validateInput()}updated(t){t.has("color")&&this.style.setProperty("--sky-dropdown-color",y(this.color)),t.has("height")&&this.style.setProperty("--sky-scroll-height",this.height)}willUpdate(t){t.has("value")&&(this.syncSelectedItemsWithValue(),this.syncFormValue(),this.syncValidity()),t.has("options")&&(Array.isArray(this.options)||(this.options=[]),this.syncSelectedItemsWithValue(),this.filterOptions(),this.syncFormValue(),this.syncValidity()),t.has("searchable")&&this.filterOptions(),t.has("searchQuery")&&this.filterOptions(),t.has("validationErrors")&&this.requestUpdate()}syncSelectedItemsWithValue(){const t=Array.isArray(this.options)?this.options:[],e=this.multiSelect&&Array.isArray(this.value)&&0===this.value.length;if(null==this.value||""===this.value||e)return this.selectedItems=[],void(this.value=this.multiSelect?[]:"");if(this.multiSelect&&"string"==typeof this.value)try{const t=JSON.parse(this.value);Array.isArray(t)&&(this.value=t)}catch(t){}const i=t=>{const e=this.getOptionValue(t);return"object"==typeof e?JSON.stringify(e):String(e)};if(this.multiSelect){const e=Array.isArray(this.value)?this.value:[this.value],s=new Set(e.map(t=>this.emitFullObject&&"object"==typeof t?JSON.stringify(t):String(t)));this.selectedItems=t.filter(t=>{const e=this.emitFullObject?JSON.stringify(t):i(t);return s.has(e)}),this.value=this.selectedItems.map(t=>this.emitFullObject?t:this.getOptionValue(t))}else{const e=this.emitFullObject&&"object"==typeof this.value?JSON.stringify(this.value):String(this.value),s=t.find(t=>(this.emitFullObject?JSON.stringify(t):i(t))===e);this.selectedItems=s?[s]:[],this.value=s?this.emitFullObject?s:this.getOptionValue(s):""}}filterOptions(){const t=Array.isArray(this.options)?this.options:[],e=(t,e)=>{const i=this.getOptionLabel(t);return{original:t,_idx:e,label:i,highlighted:i}};if(!this.searchable||!this.searchQuery.trim())return void(this.filteredOptions=t.map(e));const i=this.searchQuery.toLowerCase();this.filteredOptions=t.map(e).filter(t=>String(t.label).toLowerCase().includes(i)).map(t=>{const e=new RegExp(`(${i})`,"gi");return{...t,highlighted:String(t.label).replace(e,t=>`<span class="highlight">${t}</span>`)}})}emitSearchQueryChanged(){this.dispatchEvent(new CustomEvent("search-query-changed",{detail:{searchQuery:this.searchQuery},bubbles:!0,composed:!0}))}handleInput(t){if(this.disabled||this.readonly)return;this.searchQuery=t.target.value;const e=Array.isArray(this.options)?this.options.length:0,i=this.searchable&&e>x._SEARCH_DEBOUNCE_OPTIONS_THRESHOLD,s=()=>{this.filterOptions(),this.emitSearchQueryChanged()};i?(null!=this._searchDebounceId&&clearTimeout(this._searchDebounceId),this._searchDebounceId=setTimeout(()=>{this._searchDebounceId=null,s()},x._SEARCH_DEBOUNCE_MS)):s()}disconnectedCallback(){super.disconnectedCallback(),null!=this._searchDebounceId&&(clearTimeout(this._searchDebounceId),this._searchDebounceId=null)}handleClear(){if(this.disabled||this.readonly)return;const t=this.multiSelect?this.selectedItems.length>0:!!this.value;this.enforceMinOneSelection&&t||(this.value=this.multiSelect?[]:"",this.selectedItems=[],this.searchQuery="",this.emitSearchQueryChanged(),this.open=!1,this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value,selectedItems:[],isFilteredSelection:!1},bubbles:!0,composed:!0})),this.syncFormValue(),this.syncValidity())}selectOption(t){if(this.disabled||this.readonly)return;const e=t=>this.emitFullObject?t:this.getOptionValue(t),i=t=>{const e=this.getOptionValue(t);return"object"==typeof e?JSON.stringify(e):String(e)},s=""!==this.searchQuery.trim();if(!this.multiSelect){const o=this.selectedItems.length&&i(this.selectedItems[0])===i(t);return o&&this.enforceMinOneSelection?void(this.open=!1):(o?(this.selectedItems=[],this.value=""):(this.selectedItems=[t],this.value=e(t)),this.validateInput(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value,selectedItems:this.selectedItems,emittedValues:this.selectedItems.map(e),isFilteredSelection:s},bubbles:!0,composed:!0})),this.searchQuery="",this.emitSearchQueryChanged(),this.dropdownPopover.closePopover("api"),this.syncFormValue(),this.syncValidity(),void this.requestUpdate())}const o=this.selectedItems.findIndex(e=>i(e)===i(t));let r;r=o>-1?[...this.selectedItems.slice(0,o),...this.selectedItems.slice(o+1)]:[...this.selectedItems,t],this.enforceMinOneSelection&&0===r.length||(this.selectedItems=r,this.value=r.map(e),this.validateInput(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value,selectedItems:this.selectedItems,emittedValues:this.value,isFilteredSelection:s},bubbles:!0,composed:!0})),this.syncFormValue(),this.syncValidity(),this.open=!0,this.requestUpdate())}toggleHiddenChips(t){t.stopPropagation(),t.preventDefault(),this.disabled||this.readonly||(this.open&&this.dropdownPopover.closePopover("api"),this.hiddenPopover.toggle())}renderHiddenChipsDropdown(){return i`
2
+ <div
3
+ class="hidden-chips-dropdown"
4
+ part="hidden-chips-dropdown"
5
+ popover="manual"
6
+ @toggle=${this.hiddenPopover.onToggle}
7
+ @click=${t=>t.stopPropagation()}
8
+ style="
9
+ left: var(--sky-hc-left, 0px);
10
+ top: var(--sky-hc-top, 0px);
11
+ width: var(--sky-hc-width, max-content);
12
+ z-index: ${this.zIndex};
13
+ "
14
+ >
15
+ ${d(this.selectedItems.slice(this.visibleChips),t=>String(this.getOptionValue(t)),t=>i`
16
+ <div class="hidden-chip-inner" part="hidden-chip-inner">
17
+ <span part="hidden-chip-label">
18
+ ${this.truncateText(String(this.getOptionLabel(t)),this.chipSize)}
19
+ </span>
20
+ <sky-icon
21
+ part="remove-chip-icon"
22
+ class="remove-chip-inner"
23
+ icon="ion:close"
24
+ @click=${e=>{e.stopPropagation(),this.removeChip(t)}}
25
+ ></sky-icon>
26
+ </div>
27
+ `)}
28
+ </div>
29
+ `}removeChip(t){if(this.disabled||this.readonly)return;const e=t=>String(this.getOptionValue(t)),i=this.selectedItems.filter(i=>e(i)!==e(t));if(!this.enforceMinOneSelection||0!==i.length){if(this.selectedItems=i,this.selectedItems.length<=this.visibleChips&&this.hiddenPopover.closePopover("api"),this.multiSelect){const t=this.selectedItems.map(t=>this.emitFullObject?t:this.getOptionValue(t));this.value=t,this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:t,selectedItems:[...this.selectedItems],emittedValues:t,isFilteredSelection:!1},bubbles:!0,composed:!0}))}else this.value="",this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value,selectedItems:[],isFilteredSelection:!1},bubbles:!0,composed:!0}));this.syncFormValue(),this.syncValidity(),this.validateInput(),this.requestUpdate()}}renderChips(){if(!this.multiSelect&&this.selectedItems.length)return i`
30
+ <span class="chip" single-select part="single-select-chip">
31
+ <span class="chip-label" part="chip-label"
32
+ >${this.getOptionLabel(this.selectedItems[0])}</span
33
+ >
34
+ </span>
35
+ `;const t=Array.isArray(this.selectedItems)?this.selectedItems.slice(0,this.visibleChips):[],e=this.selectedItems.length-this.visibleChips;return i`
36
+ ${d(t,t=>String(this.getOptionValue(t)),t=>i`
37
+ <span class="chip" ?compact=${this.compact} part="chip">
38
+ <span class="chip-label" part="chip-label"
39
+ >${this.truncateText(String(this.getOptionLabel(t)),this.chipSize)}</span
40
+ >
41
+ ${c(this.multiSelect,()=>i`
42
+ <sky-icon
43
+ class="remove-chip"
44
+ part="remove-chip-icon"
45
+ ?compact=${this.compact}
46
+ @click=${e=>{e.stopPropagation(),this.removeChip(t)}}
47
+ icon="ion:close"
48
+ ></sky-icon>
49
+ `)}
50
+ </span>
51
+ `)}
52
+ ${c(e>0,()=>i`
53
+ <span
54
+ class="chip overflow-chip"
55
+ part="overflow-chip"
56
+ style="cursor:pointer"
57
+ ?compact=${this.compact}
58
+ @click=${this.toggleHiddenChips}
59
+ >
60
+ + ${e}
61
+ </span>
62
+ `)}
63
+ `}handleKeydown(t){if(t.target?.closest(".search-container"))return;const{key:e,shiftKey:i}=t;if(!this.open&&("ArrowDown"===e||"ArrowUp"===e||"Enter"===e))return this.dropdownPopover.openPopover(),void t.preventDefault();if(!this.open)return;const s=this.searchable||this.addOption,o=this.multiSelect&&this.selectAll?s?1:0:this.headerRows,r=this.headerRows+Math.max(0,this.filteredOptions.length)-1;if(this.activeIndex<o&&(this.activeIndex=o),"ArrowDown"===e){const e=this.activeIndex<o?o:this.activeIndex;return this.activeIndex=e>=r?o:e+1,this.scrollActiveItemIntoView(),void t.preventDefault()}if("ArrowUp"===e){const e=this.activeIndex<o?o:this.activeIndex;return this.activeIndex=e<=o?r:e-1,this.scrollActiveItemIntoView(),void t.preventDefault()}if("Tab"===e){if(i){const t=this.activeIndex<o?o:this.activeIndex;this.activeIndex=t<=o?r:t-1}else{const t=this.activeIndex<o?o:this.activeIndex;this.activeIndex=t>=r?o:t+1}return this.scrollActiveItemIntoView(),void t.preventDefault()}return"Enter"===e?(t.preventDefault(),t.stopPropagation(),void this.commitDropdownEnter()):this.readonly?void("Escape"===e&&(this.open=!1,t.preventDefault())):"Home"===e?(this.activeIndex=o,this.scrollActiveItemIntoView(),void t.preventDefault()):"End"===e?(this.activeIndex=Math.max(o,r),this.scrollActiveItemIntoView(),void t.preventDefault()):void 0}get headerRows(){let t=0;return(this.searchable||this.addOption)&&(t+=1),this.multiSelect&&this.selectAll&&(t+=1),t}getOptionByActiveIndex(){if(!this.open)return null;const t=this.activeIndex;if(t<0)return null;if((this.searchable||this.addOption)&&0===t)return{kind:"search"};const e=this.searchable||this.addOption?1:0;if(this.multiSelect&&this.selectAll&&t===e)return{kind:"select-all"};const i=t-this.headerRows;return i>=0&&i<this.filteredOptions.length?{kind:"option",optionIndex:i}:null}commitDropdownEnter(){const t=this.getOptionByActiveIndex();if(t)if("search"!==t.kind)if("select-all"!==t.kind){if("option"===t.kind&&"number"==typeof t.optionIndex){const e=this.filteredOptions[t.optionIndex].original;this.selectOption(e),this.searchQuery="",this.emitSearchQueryChanged()}}else this.toggleSelectAll();else this.addOption&&this.canAddaddOption()?(this.dispatchEvent(new CustomEvent("add-new-option",{detail:{value:this.searchQuery.trim()},bubbles:!0,composed:!0})),this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions()):this.filteredOptions.length>0&&(this.selectOption(this.filteredOptions[0].original),this.searchQuery="",this.emitSearchQueryChanged())}focusOnOpen(){const t=this.searchInputEl;if(t)return document.activeElement!==t&&requestAnimationFrame(()=>t.focus()),this.activeIndex=0,void this.scrollActiveItemIntoView();let e=0;if(this.selectedItems.length>0){const t=this.getOptionValue(this.selectedItems[0]),i=this.filteredOptions.findIndex(e=>this.getOptionValue(e.original)===t);i>=0&&(e=i)}this.activeIndex=this.headerRows+e,this.scrollActiveItemIntoView()}canAddaddOption(){if(!this.addOption)return!1;const t=this.searchQuery.trim();if(!t)return!1;return!(Array.isArray(this.options)?this.options:[]).some(e=>{const i=String(this.getOptionLabel(e)||"").toLowerCase(),s=(this.getOptionValue(e)??"").toString().toLowerCase();return i===t.toLowerCase()||s===t.toLowerCase()})}scrollActiveItemIntoView(){const t=Array.from(this.rowEls).find(t=>Number(t.dataset.rowIndex)===this.activeIndex);t?.scrollIntoView({block:"nearest",behavior:"smooth"})}toggleDropdown(t){t.stopPropagation(),this.disabled||this.readonly||(this.hiddenChipsOpen&&this.hiddenPopover.closePopover("api"),this.validationActive=!0,this.dropdownPopover.toggle())}renderDropdown(){return i`
64
+ <div
65
+ class="dropdown"
66
+ part="dropdown"
67
+ popover="manual"
68
+ @toggle=${this.dropdownPopover.onToggle}
69
+ @click=${t=>t.stopPropagation()}
70
+ style="
71
+ left: var(--sky-dd-left, 0px);
72
+ top: var(--sky-dd-top, 0px);
73
+ min-width: var(--sky-dd-width, 100%);
74
+ "
75
+ >
76
+ ${c(this.searchable||this.addOption,()=>i`
77
+ <div
78
+ class="search-container"
79
+ data-row-index="0"
80
+ part="search-container"
81
+ >
82
+ <sky-icon icon="ion:search"></sky-icon>
83
+
84
+ <input
85
+ .value=${this.searchQuery}
86
+ part="search-input"
87
+ tabindex="0"
88
+ ?readonly=${this.readonly||!this.searchable&&!this.addOption}
89
+ @input=${this.searchable||this.addOption?this.handleInput:null}
90
+ @keydown=${this.onSearchKeydown}
91
+ @focus=${this.searchable||this.addOption?this.handleFocus:null}
92
+ @blur=${this.searchable||this.addOption?this.handleBlur:null}
93
+ ?compact=${this.compact}
94
+ ?disabled=${this.disabled}
95
+ placeholder=${this.searchPlaceholder}
96
+ class="input"
97
+ />
98
+
99
+ ${c(this.addOption,()=>i`
100
+ <sky-icon
101
+ class="new-option-btn"
102
+ icon="ion:add"
103
+ part="add-option-icon"
104
+ title="Add as new option"
105
+ aria-label="Add as new option"
106
+ @click=${this.handleAddaddOption}
107
+ ></sky-icon>
108
+ `)}
109
+ </div>
110
+ `)}
111
+
112
+ <div class="dropdown-scroller">
113
+ ${c(this.open,()=>i`
114
+ ${c(this.multiSelect&&this.selectAll&&this.filteredOptions.length,()=>{const t=this.searchable||this.addOption?1:0,e=p({"dropdown-item":!0,active:this.activeIndex===t,selected:this.isAllFilteredSelected()});return i`
115
+ <div
116
+ class=${e}
117
+ data-row-index=${t}
118
+ style="justify-content: ${this.justify};"
119
+ part="select-all"
120
+ @click=${this.toggleSelectAll}
121
+ >
122
+ <sky-checkbox
123
+ .checked=${this.isAllFilteredSelected()}
124
+ readonly
125
+ ></sky-checkbox>
126
+ Select All
127
+ </div>
128
+ `})}
129
+ ${c(this.filteredOptions.length>0,()=>d(this.filteredOptions,({original:t,_idx:e})=>`${e}-${String(this.getOptionValue(t))}`,({original:t,highlighted:e,_idx:s},o)=>{const r=`option-${s}`,a=this.optionSlotSet.has(r),n=t=>String(this.getOptionValue(t.original??t)),l=Array.isArray(this.selectedItems)&&this.selectedItems.some(e=>n(e)===n(t)),d=this.headerRows+o,y=d===this.activeIndex,u=p({"dropdown-item":!0,active:y,selected:l});return i`
130
+ <div
131
+ class=${u}
132
+ data-row-index=${d}
133
+ style="justify-content: ${this.justify};"
134
+ part="option"
135
+ @click=${()=>this.selectOption(t)}
136
+ ?compact=${this.compact}
137
+ >
138
+ ${c(this.multiSelect,()=>i` <sky-checkbox
139
+ .checked=${l}
140
+ readonly
141
+ ></sky-checkbox>`)}
142
+ ${c(a,()=>i`
143
+ <div style="display: flex; gap: 8px;width:100%">
144
+ <slot name=${r}>
145
+ <span
146
+ class="highlighted-text"
147
+ part="highlighted-text"
148
+ >${h(e)}</span
149
+ >
150
+ </slot>
151
+ </div>
152
+ `,()=>i`<span
153
+ class="highlighted-text"
154
+ part="highlighted-text"
155
+ >${h(e)}</span
156
+ >`)}
157
+ </div>
158
+ `}),()=>i`<div
159
+ class="dropdown-item"
160
+ part="no-options"
161
+ data-row-index=${this.headerRows}
162
+ >
163
+ No options found
164
+ </div>`)}
165
+ `)}
166
+ </div>
167
+ </div>
168
+ `}getOptionValue(t){return this.emitFullObject?t:"object"==typeof t&&null!==t?this.emittedKey in t?t[this.emittedKey]:"value"in t?t.value:t:t}getOptionLabel(t){if(!t)return"";if(!Array.isArray(this.options)||this.options,this.displayKey&&"object"==typeof t&&t[this.displayKey])return String(t[this.displayKey]);if("object"==typeof t){const e=Object.values(t).filter(t=>"string"==typeof t);return e.length>0?e[0]:JSON.stringify(t)}return String(t)}renderValidationErrors(){if(!this.showErrors||!this.validationActive)return null;const t=this.getErrorMessages();if(!t.length)return null;const e=`${this.id||"sky-combobox"}-errors`;return i`
169
+ <div class="progress-message">
170
+ <ul id=${e} class="error-list" part="error-list">
171
+ ${d(t,t=>t,t=>i`<li class="error" part="error-item">${t}</li>`)}
172
+ </ul>
173
+ </div>
174
+ `}getErrorMessages(){const t=Array.isArray(this.validationErrors)?this.validationErrors:[];switch(this.errorDisplayMode){case"single":return t.slice(0,1);case"all":return t;default:return[]}}handleIconClick(t,e){this.dispatchEvent(new CustomEvent("icon-click",{detail:{position:t,event:e},bubbles:!0,composed:!0}))}render(){const t=p({"icon-slot":!0,left:!0,focused:this.focused}),e=p({"icon-slot":!0,right:!0,focused:this.focused}),s=p({"placeholder-label":!0,active:this.selectedItems.length>0});return i`
175
+ <div class="combo-box-container" part="combo-box-container">
176
+ ${c(this.label,()=>i`<div class="label" part="label">${this.label}</div>`)}
177
+ <div
178
+ class="input-wrapper"
179
+ tabindex="0"
180
+ part="input-wrapper"
181
+ ?disabled=${this.disabled}
182
+ ?compact=${this.compact}
183
+ ?loading=${this.loading}
184
+ ?open=${this.open}
185
+ ?invalid=${this.invalid}
186
+ @click=${t=>{this.disabled||this.readonly||this.toggleDropdown(t)}}
187
+ @keydown=${this.handleKeydown}
188
+ >
189
+ <!-- Left Icon or Loading Indicator -->
190
+ <div
191
+ class=${t}
192
+ part="icon-slot"
193
+ ?filled=${this.hasLeftIcon}
194
+ @click=${t=>this.handleIconClick("left",t)}
195
+ >
196
+ <slot name="icon-left" @slotchange=${this.onIconSlotChange}></slot>
197
+ </div>
198
+ ${c(this.selectedItems.length>0,()=>i`
199
+ <div
200
+ class="chip-container"
201
+ part="chip-container"
202
+ ?compact=${this.compact}
203
+ >
204
+ ${this.renderChips()}
205
+ </div>
206
+ `,()=>i`<label
207
+ class=${s}
208
+ part="placeholder-label"
209
+ ?compact=${this.compact}
210
+ >
211
+ <span style="color:${this.prefixColor}">${this.prefix}</span
212
+ >${this.placeholder}<span style="color:${this.suffixColor}"
213
+ >${this.suffix}</span
214
+ >
215
+ </label>`)}
216
+ ${c(this.clearable&&!this.enforceMinOneSelection&&(this.value||this.selectedItems.length),()=>i`<sky-icon
217
+ class="clear-button"
218
+ part="clear-button"
219
+ @click=${this.handleClear}
220
+ ?loading=${this.loading}
221
+ icon="ion:close"
222
+ ></sky-icon>`)}
223
+ ${c(this.loading,()=>i`<div class="loading-indicator right"></div>`,()=>i`<div
224
+ part="icon-slot"
225
+ class=${e}
226
+ ?filled=${this.hasRightIcon}
227
+ @click=${t=>this.handleIconClick("right",t)}
228
+ >
229
+ <slot name="icon-right" @slotchange=${this.onIconSlotChange}></slot>
230
+ </div>`)}
231
+ <sky-icon
232
+ class="dropdown-button"
233
+ part="dropdown-button"
234
+ @click=${t=>{this.disabled||this.readonly||this.toggleDropdown(t)}}
235
+ icon=${this.open?"ion:ios-arrow-up":"ion:chevron-down"}
236
+ >
237
+ </sky-icon>
238
+ </div>
239
+ ${this.renderHiddenChipsDropdown()} ${this.renderDropdown()}
240
+ ${this.renderValidationErrors()}
241
+ <slot style="display:none" @slotchange=${this.refreshOptionSlots}></slot>
242
+ </div>
243
+ `}};x.dependencies={"sky-icon":m,"sky-checkbox":g},x._SEARCH_DEBOUNCE_MS=150,x._SEARCH_DEBOUNCE_OPTIONS_THRESHOLD=30,x.styles=t`
2
244
  :host {
3
245
  display: block;
4
246
  font-family: var(--sky-font);
@@ -730,247 +972,5 @@ import{__decorate as t,__metadata as e}from"tslib";import{css as i,LitElement as
730
972
  opacity: 0.6;
731
973
  cursor: not-allowed;
732
974
  }
733
- `}constructor(){super(),this.value="",this.placeholder="Select An Option",this.searchPlaceholder="Search...",this.label="",this._options=[],this.chipSize=20,this.color="primary",this.clearable=!1,this.loading=!1,this.compact=!1,this.disabled=!1,this.searchable=!1,this.multiSelect=!1,this.visibleChips=2,this.selectAll=!1,this._validations=[],this.showErrors=!1,this.errorDisplayMode="single",this.required=!1,this.emitFullObject=!1,this.emittedKey="value",this.displayKey="",this.addOption=!1,this.validationArrayFormat=!1,this.prefix="",this.suffix="",this.prefixColor="",this.suffixColor="",this.justify="flex-start",this.zIndex=11,this.height="200px",this.requiredMessage="Selection is required.",this.readonly=!1,this.enforceMinOneSelection=!1,this.openAbove=!1,this.validationActive=!1,this.invalid=!1,this.variant="default",this.searchQuery="",this.filteredOptions=[],this.focused=!1,this.open=!1,this.selectedItems=[],this.hiddenChipsOpen=!1,this.activeIndex=-1,this.validationErrors=[],this.validationStatus=[],this.hasLeftIcon=!1,this.hasRightIcon=!1,this.optionSlotSet=new Set,this._searchDebounceId=null,this.dropdownPopover=new g(this,{getAnchor:()=>this.inputWrapperEl,getPopover:()=>this.dropdownEl,cssVarLeft:"--sky-dd-left",cssVarTop:"--sky-dd-top",cssVarWidth:"--sky-dd-width",getPlacement:()=>"bottom",getAlign:()=>"start",getGap:()=>6,getPadding:()=>8,getMatchAnchorWidth:()=>!0,getMaxWidthToViewport:()=>!0,getMaxWidthMode:()=>"cap",getFlip:()=>!0,getFlipOrder:()=>[],getAnimateReposition:()=>!0,getRepositionMs:()=>160,getCloseOnEscape:()=>!0,getCloseOnOutside:()=>!0,getRestoreFocusOnClose:()=>!0,onOpenChange:(t,e)=>{this.open=t,t?(this.validationActive=!0,this.filterOptions(),requestAnimationFrame(()=>this.focusOnOpen())):(this.activeIndex=-1,this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions(),this.hiddenChipsOpen=!1,this.hiddenPopover.closePopover("api"))}}),this.hiddenPopover=new g(this,{getAnchor:()=>this.overflowChipEl,getPopover:()=>this.hiddenDropdownEl,cssVarLeft:"--sky-hc-left",cssVarTop:"--sky-hc-top",cssVarWidth:"--sky-hc-width",getPlacement:()=>"bottom",getAlign:()=>"center",getGap:()=>4,getPadding:()=>8,getMatchAnchorWidth:()=>!1,getMaxWidthToViewport:()=>!0,getMaxWidthMode:()=>"cap",getFlip:()=>!0,getFlipOrder:()=>[],getAnimateReposition:()=>!0,getRepositionMs:()=>120,getCloseOnEscape:()=>!0,getCloseOnOutside:()=>!0,getRestoreFocusOnClose:()=>!1,onOpenChange:t=>{this.hiddenChipsOpen=t,t&&this.open&&this.dropdownPopover.closePopover("api")}}),this.refreshOptionSlots=()=>{const t=new Set;this.querySelectorAll('[slot^="option-"]').forEach(e=>{const i=e.slot;i&&t.add(i)}),this.optionSlotSet=t},this.onSearchKeydown=t=>{const{key:e,shiftKey:i}=t;if("Enter"===e)return t.preventDefault(),t.stopPropagation(),void this.commitDropdownEnter();if("ArrowDown"===e||"ArrowUp"===e||"Tab"===e){t.preventDefault(),t.stopPropagation();const i=this.searchable||this.addOption,s=this.multiSelect&&this.selectAll?i?1:0:this.headerRows,o=this.headerRows+Math.max(0,this.filteredOptions.length)-1,r="ArrowUp"===e||"Tab"===e&&t.shiftKey?-1:1;this.activeIndex<s?this.activeIndex=s:this.activeIndex=this.activeIndex+r<s?o:this.activeIndex+r>o?s:this.activeIndex+r,this.scrollActiveItemIntoView()}return"Escape"===e?(t.preventDefault(),t.stopPropagation(),void this.dropdownPopover.closePopover("escape")):void 0},this.handleAddaddOption=t=>{if(t.stopPropagation(),this.disabled||this.readonly)return;if(!this.canAddaddOption())return;const e=this.searchQuery.trim();this.dispatchEvent(new CustomEvent("add-new-option",{detail:{value:e},bubbles:!0,composed:!0})),this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions()},this.onIconSlotChange=()=>{this.hasLeftIcon=(this.iconLeftEls?.length??0)>0,this.hasRightIcon=(this.iconRightEls?.length??0)>0},this.captureDefaultValue("")}static{this.shadowRootOptions={...s.shadowRootOptions,delegatesFocus:!0}}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||(this.tabIndex=this.disabled?-1:0),this.refreshOptionSlots()}firstUpdated(){this.dropdownPopover.refreshTargets(),this.hiddenPopover.refreshTargets()}getFormValue(){if(this.disabled||!this.name)return null;if(this.multiSelect){const t=new FormData;return this.selectedItems.forEach(e=>{const i=this.emitFullObject?JSON.stringify(e):String(this.getOptionValue(e));t.append(this.name,i)}),0===this.selectedItems.length&&this.required&&t.append(this.name,""),t}{if(0===this.selectedItems.length)return"";const t=this.selectedItems[0];return this.emitFullObject?JSON.stringify(t):String(this.getOptionValue(t))}}setValueFromFormState(t){if(null===t||""===t)return this.value=this.multiSelect?[]:"",void(this.selectedItems=[]);if(this.multiSelect){let e=[];if(t instanceof FormData)e=t.getAll(this.name);else if(Array.isArray(t))e=t;else if("string"==typeof t)try{const i=JSON.parse(t);e=Array.isArray(i)?i:[t]}catch{e=[t]}this.setValueFromArray(e)}else{let e="";"string"==typeof t?e=t:t instanceof FormData?e=t.get(this.name)?.toString()||"":Array.isArray(t)&&t.length>0&&(e=t[0].toString()),this.value=e,this.syncSelectedItemsWithValue()}}syncFormValue(){if(!this.name||this.disabled)return void this.internals.setFormValue(null);const t=this.getFormValue();if(null!==t)if(this.multiSelect&&Array.isArray(t)){const e=new FormData;t.forEach(t=>{null!=t&&""!==t&&e.append(this.name,String(t))}),this.internals.setFormValue(e)}else this.internals.setFormValue(t);else this.internals.setFormValue(null)}setValueFromArray(t){const e=Array.isArray(this.options)?this.options:[];this.selectedItems=e.filter(e=>{const i=this.getOptionValue(e),s=this.emitFullObject?JSON.stringify(e):String(i);return t.some(t=>{const e=String(t);if(!this.emitFullObject)return e===s;try{const t=JSON.parse(e);return JSON.stringify(t)===s}catch{return e===s}})}),this.value=this.selectedItems.map(t=>this.emitFullObject?t:this.getOptionValue(t))}getValidityAnchor(){return this}isEmpty(){return this.multiSelect?0===this.selectedItems.length:0===this.selectedItems.length||!this.value}getNativeControl(){return this.inputWrapperEl||null}getCustomErrorMessage(){return this.validationErrors?.[0]||""}onFormReset(){super.onFormReset(),this.searchQuery="",this.emitSearchQueryChanged(),this.open=!1,this.invalid=!1,this.validationErrors=[],this.validationActive=!1}onFormDisabled(t){this.disabled=t}onFormStateRestore(t){this.setValueFromFormState(t)}toggleSelectAll(){if(this.disabled||this.readonly)return;const t=t=>String(this.getOptionValue(t));if(this.isAllFilteredSelected()){const e=new Set(this.filteredOptions.map(t=>String(this.getOptionValue(t.original)))),i=this.selectedItems.filter(i=>!e.has(t(i)));if(this.enforceMinOneSelection&&0===i.length)return;this.selectedItems=i}else{const e=new Set(this.selectedItems.map(e=>t(e))),i=this.filteredOptions.map(t=>t.original).filter(i=>!e.has(t(i)));this.selectedItems=[...this.selectedItems,...i]}const e=this.selectedItems.map(t=>this.emitFullObject?t:this.getOptionValue(t));this.value=e,this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:e,selectedItems:[...this.selectedItems],emittedValues:e,isFilteredSelection:!!this.searchQuery.trim()},bubbles:!0,composed:!0})),this.syncFormValue(),this.syncValidity(),this.requestUpdate()}isAllFilteredSelected(){if(0===this.filteredOptions.length)return!1;return this.filteredOptions.map(t=>this.getOptionValue(t.original)).every(t=>this.selectedItems.some(e=>this.getOptionValue(e)===t))}truncateText(t,e){return t.length>e?t.slice(0,e)+"...":t}validateInput(){if(!this.validationActive)return;this.validationErrors=[];const t=this.validationArrayFormat?this.selectedItems:this.value;if(this.required&&this.isEmpty())this.validationErrors.push(this.requiredMessage||"Selection is required.");else if(Array.isArray(this.validations)&&this.validations.length)for(const e of this.validations){const i=e(t);!0!==i&&this.validationErrors.push(String(i||"Invalid value."))}this.invalid=this.validationErrors.length>0,this.dispatchEvent(new CustomEvent(this.invalid?"validation-error":"validation-success",{detail:this.invalid?{errors:this.validationErrors}:{value:this.selectedItems},bubbles:!0,composed:!0})),this.syncValidity(),this.requestUpdate()}validateForForm(){if(this.disabled)return"";const t=this.validationArrayFormat?this.selectedItems:this.value;if(Array.isArray(this.validations)&&this.validations.length)for(const e of this.validations){const i=e(t);if(!0!==i)return String(i||"Invalid value.")}return this.enforceMinOneSelection&&this.isEmpty()?this.requiredMessage||"At least one selection is required.":this.required&&this.isEmpty()?this.requiredMessage||"Selection is required.":""}focus(t){super.focus(t),this.searchInputEl?this.searchInputEl.focus(t):this.inputWrapperEl&&this.inputWrapperEl.focus(t)}blur(){this.open&&this.dropdownPopover.closePopover("light-dismiss"),super.blur()}handleFocus(){this.focused=!0,this.validationActive||(this.validationActive=!0)}reset(){this.value=this.multiSelect?[]:"",this.selectedItems=[],this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions(),this.validationErrors=[],this.validationActive=!1,this.open=!1,this.invalid=!1,this.syncFormValue(),this.syncValidity(),this.requestUpdate()}openDropdown(){this.disabled||this.readonly||this.dropdownPopover.openPopover()}closeDropdown(){this.dropdownPopover.closePopover("api")}clearSelection(){this.handleClear()}handleBlur(){this.focused=!1,this.validationActive&&this.validateInput()}updated(t){t.has("color")&&this.style.setProperty("--sky-dropdown-color",v(this.color)),t.has("height")&&this.style.setProperty("--sky-scroll-height",this.height)}willUpdate(t){t.has("value")&&(this.syncSelectedItemsWithValue(),this.syncFormValue(),this.syncValidity()),t.has("options")&&(Array.isArray(this.options)||(this.options=[]),this.syncSelectedItemsWithValue(),this.filterOptions(),this.syncFormValue(),this.syncValidity()),t.has("searchable")&&this.filterOptions(),t.has("searchQuery")&&this.filterOptions(),t.has("validationErrors")&&this.requestUpdate()}syncSelectedItemsWithValue(){const t=Array.isArray(this.options)?this.options:[],e=this.multiSelect&&Array.isArray(this.value)&&0===this.value.length;if(null==this.value||""===this.value||e)return this.selectedItems=[],void(this.value=this.multiSelect?[]:"");if(this.multiSelect&&"string"==typeof this.value)try{const t=JSON.parse(this.value);Array.isArray(t)&&(this.value=t)}catch(t){}const i=t=>{const e=this.getOptionValue(t);return"object"==typeof e?JSON.stringify(e):String(e)};if(this.multiSelect){const e=Array.isArray(this.value)?this.value:[this.value],s=new Set(e.map(t=>this.emitFullObject&&"object"==typeof t?JSON.stringify(t):String(t)));this.selectedItems=t.filter(t=>{const e=this.emitFullObject?JSON.stringify(t):i(t);return s.has(e)}),this.value=this.selectedItems.map(t=>this.emitFullObject?t:this.getOptionValue(t))}else{const e=this.emitFullObject&&"object"==typeof this.value?JSON.stringify(this.value):String(this.value),s=t.find(t=>(this.emitFullObject?JSON.stringify(t):i(t))===e);this.selectedItems=s?[s]:[],this.value=s?this.emitFullObject?s:this.getOptionValue(s):""}}filterOptions(){const t=Array.isArray(this.options)?this.options:[],e=(t,e)=>{const i=this.getOptionLabel(t);return{original:t,_idx:e,label:i,highlighted:i}};if(!this.searchable||!this.searchQuery.trim())return void(this.filteredOptions=t.map(e));const i=this.searchQuery.toLowerCase();this.filteredOptions=t.map(e).filter(t=>String(t.label).toLowerCase().includes(i)).map(t=>{const e=new RegExp(`(${i})`,"gi");return{...t,highlighted:String(t.label).replace(e,t=>`<span class="highlight">${t}</span>`)}})}emitSearchQueryChanged(){this.dispatchEvent(new CustomEvent("search-query-changed",{detail:{searchQuery:this.searchQuery},bubbles:!0,composed:!0}))}handleInput(t){if(this.disabled||this.readonly)return;this.searchQuery=t.target.value;const e=Array.isArray(this.options)?this.options.length:0,i=this.searchable&&e>k._SEARCH_DEBOUNCE_OPTIONS_THRESHOLD,s=()=>{this.filterOptions(),this.emitSearchQueryChanged()};i?(null!=this._searchDebounceId&&clearTimeout(this._searchDebounceId),this._searchDebounceId=setTimeout(()=>{this._searchDebounceId=null,s()},k._SEARCH_DEBOUNCE_MS)):s()}disconnectedCallback(){super.disconnectedCallback(),null!=this._searchDebounceId&&(clearTimeout(this._searchDebounceId),this._searchDebounceId=null)}handleClear(){if(this.disabled||this.readonly)return;const t=this.multiSelect?this.selectedItems.length>0:!!this.value;this.enforceMinOneSelection&&t||(this.value=this.multiSelect?[]:"",this.selectedItems=[],this.searchQuery="",this.emitSearchQueryChanged(),this.open=!1,this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value,selectedItems:[],isFilteredSelection:!1},bubbles:!0,composed:!0})),this.syncFormValue(),this.syncValidity())}selectOption(t){if(this.disabled||this.readonly)return;const e=t=>this.emitFullObject?t:this.getOptionValue(t),i=t=>{const e=this.getOptionValue(t);return"object"==typeof e?JSON.stringify(e):String(e)},s=""!==this.searchQuery.trim();if(!this.multiSelect){const o=this.selectedItems.length&&i(this.selectedItems[0])===i(t);return o&&this.enforceMinOneSelection?void(this.open=!1):(o?(this.selectedItems=[],this.value=""):(this.selectedItems=[t],this.value=e(t)),this.validateInput(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value,selectedItems:this.selectedItems,emittedValues:this.selectedItems.map(e),isFilteredSelection:s},bubbles:!0,composed:!0})),this.searchQuery="",this.emitSearchQueryChanged(),this.dropdownPopover.closePopover("api"),this.syncFormValue(),this.syncValidity(),void this.requestUpdate())}const o=this.selectedItems.findIndex(e=>i(e)===i(t));let r;r=o>-1?[...this.selectedItems.slice(0,o),...this.selectedItems.slice(o+1)]:[...this.selectedItems,t],this.enforceMinOneSelection&&0===r.length||(this.selectedItems=r,this.value=r.map(e),this.validateInput(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value,selectedItems:this.selectedItems,emittedValues:this.value,isFilteredSelection:s},bubbles:!0,composed:!0})),this.syncFormValue(),this.syncValidity(),this.open=!0,this.requestUpdate())}toggleHiddenChips(t){t.stopPropagation(),t.preventDefault(),this.disabled||this.readonly||(this.open&&this.dropdownPopover.closePopover("api"),this.hiddenPopover.toggle())}renderHiddenChipsDropdown(){return o`
734
- <div
735
- class="hidden-chips-dropdown"
736
- part="hidden-chips-dropdown"
737
- popover="manual"
738
- @toggle=${this.hiddenPopover.onToggle}
739
- @click=${t=>t.stopPropagation()}
740
- style="
741
- left: var(--sky-hc-left, 0px);
742
- top: var(--sky-hc-top, 0px);
743
- width: var(--sky-hc-width, max-content);
744
- z-index: ${this.zIndex};
745
- "
746
- >
747
- ${y(this.selectedItems.slice(this.visibleChips),t=>String(this.getOptionValue(t)),t=>o`
748
- <div class="hidden-chip-inner" part="hidden-chip-inner">
749
- <span part="hidden-chip-label">
750
- ${this.truncateText(String(this.getOptionLabel(t)),this.chipSize)}
751
- </span>
752
- <sky-icon
753
- part="remove-chip-icon"
754
- class="remove-chip-inner"
755
- icon="ion:close"
756
- @click=${e=>{e.stopPropagation(),this.removeChip(t)}}
757
- ></sky-icon>
758
- </div>
759
- `)}
760
- </div>
761
- `}removeChip(t){if(this.disabled||this.readonly)return;const e=t=>String(this.getOptionValue(t)),i=this.selectedItems.filter(i=>e(i)!==e(t));if(!this.enforceMinOneSelection||0!==i.length){if(this.selectedItems=i,this.selectedItems.length<=this.visibleChips&&this.hiddenPopover.closePopover("api"),this.multiSelect){const t=this.selectedItems.map(t=>this.emitFullObject?t:this.getOptionValue(t));this.value=t,this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:t,selectedItems:[...this.selectedItems],emittedValues:t,isFilteredSelection:!1},bubbles:!0,composed:!0}))}else this.value="",this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value,selectedItems:[],isFilteredSelection:!1},bubbles:!0,composed:!0}));this.syncFormValue(),this.syncValidity(),this.validateInput(),this.requestUpdate()}}renderChips(){if(!this.multiSelect&&this.selectedItems.length)return o`
762
- <span class="chip" single-select part="single-select-chip">
763
- <span class="chip-label" part="chip-label"
764
- >${this.getOptionLabel(this.selectedItems[0])}</span
765
- >
766
- </span>
767
- `;const t=Array.isArray(this.selectedItems)?this.selectedItems.slice(0,this.visibleChips):[],e=this.selectedItems.length-this.visibleChips;return o`
768
- ${y(t,t=>String(this.getOptionValue(t)),t=>o`
769
- <span class="chip" ?compact=${this.compact} part="chip">
770
- <span class="chip-label" part="chip-label"
771
- >${this.truncateText(String(this.getOptionLabel(t)),this.chipSize)}</span
772
- >
773
- ${p(this.multiSelect,()=>o`
774
- <sky-icon
775
- class="remove-chip"
776
- part="remove-chip-icon"
777
- ?compact=${this.compact}
778
- @click=${e=>{e.stopPropagation(),this.removeChip(t)}}
779
- icon="ion:close"
780
- ></sky-icon>
781
- `)}
782
- </span>
783
- `)}
784
- ${p(e>0,()=>o`
785
- <span
786
- class="chip overflow-chip"
787
- part="overflow-chip"
788
- style="cursor:pointer"
789
- ?compact=${this.compact}
790
- @click=${this.toggleHiddenChips}
791
- >
792
- + ${e}
793
- </span>
794
- `)}
795
- `}handleKeydown(t){if(t.target?.closest(".search-container"))return;const{key:e,shiftKey:i}=t;if(!this.open&&("ArrowDown"===e||"ArrowUp"===e||"Enter"===e))return this.dropdownPopover.openPopover(),void t.preventDefault();if(!this.open)return;const s=this.searchable||this.addOption,o=this.multiSelect&&this.selectAll?s?1:0:this.headerRows,r=this.headerRows+Math.max(0,this.filteredOptions.length)-1;if(this.activeIndex<o&&(this.activeIndex=o),"ArrowDown"===e){const e=this.activeIndex<o?o:this.activeIndex;return this.activeIndex=e>=r?o:e+1,this.scrollActiveItemIntoView(),void t.preventDefault()}if("ArrowUp"===e){const e=this.activeIndex<o?o:this.activeIndex;return this.activeIndex=e<=o?r:e-1,this.scrollActiveItemIntoView(),void t.preventDefault()}if("Tab"===e){if(i){const t=this.activeIndex<o?o:this.activeIndex;this.activeIndex=t<=o?r:t-1}else{const t=this.activeIndex<o?o:this.activeIndex;this.activeIndex=t>=r?o:t+1}return this.scrollActiveItemIntoView(),void t.preventDefault()}return"Enter"===e?(t.preventDefault(),t.stopPropagation(),void this.commitDropdownEnter()):this.readonly?void("Escape"===e&&(this.open=!1,t.preventDefault())):"Home"===e?(this.activeIndex=o,this.scrollActiveItemIntoView(),void t.preventDefault()):"End"===e?(this.activeIndex=Math.max(o,r),this.scrollActiveItemIntoView(),void t.preventDefault()):void 0}get headerRows(){let t=0;return(this.searchable||this.addOption)&&(t+=1),this.multiSelect&&this.selectAll&&(t+=1),t}getOptionByActiveIndex(){if(!this.open)return null;const t=this.activeIndex;if(t<0)return null;if((this.searchable||this.addOption)&&0===t)return{kind:"search"};const e=this.searchable||this.addOption?1:0;if(this.multiSelect&&this.selectAll&&t===e)return{kind:"select-all"};const i=t-this.headerRows;return i>=0&&i<this.filteredOptions.length?{kind:"option",optionIndex:i}:null}commitDropdownEnter(){const t=this.getOptionByActiveIndex();if(t)if("search"!==t.kind)if("select-all"!==t.kind){if("option"===t.kind&&"number"==typeof t.optionIndex){const e=this.filteredOptions[t.optionIndex].original;this.selectOption(e),this.searchQuery="",this.emitSearchQueryChanged()}}else this.toggleSelectAll();else this.addOption&&this.canAddaddOption()?(this.dispatchEvent(new CustomEvent("add-new-option",{detail:{value:this.searchQuery.trim()},bubbles:!0,composed:!0})),this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions()):this.filteredOptions.length>0&&(this.selectOption(this.filteredOptions[0].original),this.searchQuery="",this.emitSearchQueryChanged())}focusOnOpen(){const t=this.searchInputEl;if(t)return document.activeElement!==t&&requestAnimationFrame(()=>t.focus()),this.activeIndex=0,void this.scrollActiveItemIntoView();let e=0;if(this.selectedItems.length>0){const t=this.getOptionValue(this.selectedItems[0]),i=this.filteredOptions.findIndex(e=>this.getOptionValue(e.original)===t);i>=0&&(e=i)}this.activeIndex=this.headerRows+e,this.scrollActiveItemIntoView()}canAddaddOption(){if(!this.addOption)return!1;const t=this.searchQuery.trim();if(!t)return!1;return!(Array.isArray(this.options)?this.options:[]).some(e=>{const i=String(this.getOptionLabel(e)||"").toLowerCase(),s=(this.getOptionValue(e)??"").toString().toLowerCase();return i===t.toLowerCase()||s===t.toLowerCase()})}scrollActiveItemIntoView(){const t=Array.from(this.rowEls).find(t=>Number(t.dataset.rowIndex)===this.activeIndex);t?.scrollIntoView({block:"nearest",behavior:"smooth"})}toggleDropdown(t){t.stopPropagation(),this.disabled||this.readonly||(this.hiddenChipsOpen&&this.hiddenPopover.closePopover("api"),this.validationActive=!0,this.dropdownPopover.toggle())}renderDropdown(){return o`
796
- <div
797
- class="dropdown"
798
- part="dropdown"
799
- popover="manual"
800
- @toggle=${this.dropdownPopover.onToggle}
801
- @click=${t=>t.stopPropagation()}
802
- style="
803
- left: var(--sky-dd-left, 0px);
804
- top: var(--sky-dd-top, 0px);
805
- min-width: var(--sky-dd-width, 100%);
806
- "
807
- >
808
- ${p(this.searchable||this.addOption,()=>o`
809
- <div
810
- class="search-container"
811
- data-row-index="0"
812
- part="search-container"
813
- >
814
- <sky-icon icon="ion:search"></sky-icon>
815
-
816
- <input
817
- .value=${this.searchQuery}
818
- part="search-input"
819
- tabindex="0"
820
- ?readonly=${this.readonly||!this.searchable&&!this.addOption}
821
- @input=${this.searchable||this.addOption?this.handleInput:null}
822
- @keydown=${this.onSearchKeydown}
823
- @focus=${this.searchable||this.addOption?this.handleFocus:null}
824
- @blur=${this.searchable||this.addOption?this.handleBlur:null}
825
- ?compact=${this.compact}
826
- ?disabled=${this.disabled}
827
- placeholder=${this.searchPlaceholder}
828
- class="input"
829
- />
830
-
831
- ${p(this.addOption,()=>o`
832
- <sky-icon
833
- class="new-option-btn"
834
- icon="ion:add"
835
- part="add-option-icon"
836
- title="Add as new option"
837
- aria-label="Add as new option"
838
- @click=${this.handleAddaddOption}
839
- ></sky-icon>
840
- `)}
841
- </div>
842
- `)}
843
-
844
- <div class="dropdown-scroller">
845
- ${p(this.open,()=>o`
846
- ${p(this.multiSelect&&this.selectAll&&this.filteredOptions.length,()=>{const t=this.searchable||this.addOption?1:0,e=u({"dropdown-item":!0,active:this.activeIndex===t,selected:this.isAllFilteredSelected()});return o`
847
- <div
848
- class=${e}
849
- data-row-index=${t}
850
- style="justify-content: ${this.justify};"
851
- part="select-all"
852
- @click=${this.toggleSelectAll}
853
- >
854
- <sky-checkbox
855
- .checked=${this.isAllFilteredSelected()}
856
- readonly
857
- ></sky-checkbox>
858
- Select All
859
- </div>
860
- `})}
861
- ${p(this.filteredOptions.length>0,()=>y(this.filteredOptions,({original:t,_idx:e})=>`${e}-${String(this.getOptionValue(t))}`,({original:t,highlighted:e,_idx:i},s)=>{const r=`option-${i}`,n=this.optionSlotSet.has(r),a=t=>String(this.getOptionValue(t.original??t)),l=Array.isArray(this.selectedItems)&&this.selectedItems.some(e=>a(e)===a(t)),d=this.headerRows+s,h=d===this.activeIndex,y=u({"dropdown-item":!0,active:h,selected:l});return o`
862
- <div
863
- class=${y}
864
- data-row-index=${d}
865
- style="justify-content: ${this.justify};"
866
- part="option"
867
- @click=${()=>this.selectOption(t)}
868
- ?compact=${this.compact}
869
- >
870
- ${p(this.multiSelect,()=>o` <sky-checkbox
871
- .checked=${l}
872
- readonly
873
- ></sky-checkbox>`)}
874
- ${p(n,()=>o`
875
- <div style="display: flex; gap: 8px;width:100%">
876
- <slot name=${r}>
877
- <span
878
- class="highlighted-text"
879
- part="highlighted-text"
880
- >${c(e)}</span
881
- >
882
- </slot>
883
- </div>
884
- `,()=>o`<span
885
- class="highlighted-text"
886
- part="highlighted-text"
887
- >${c(e)}</span
888
- >`)}
889
- </div>
890
- `}),()=>o`<div
891
- class="dropdown-item"
892
- part="no-options"
893
- data-row-index=${this.headerRows}
894
- >
895
- No options found
896
- </div>`)}
897
- `)}
898
- </div>
899
- </div>
900
- `}getOptionValue(t){return this.emitFullObject?t:"object"==typeof t&&null!==t?this.emittedKey in t?t[this.emittedKey]:"value"in t?t.value:t:t}getOptionLabel(t){if(!t)return"";if(!Array.isArray(this.options)||this.options,this.displayKey&&"object"==typeof t&&t[this.displayKey])return String(t[this.displayKey]);if("object"==typeof t){const e=Object.values(t).filter(t=>"string"==typeof t);return e.length>0?e[0]:JSON.stringify(t)}return String(t)}renderValidationErrors(){if(!this.showErrors||!this.validationActive)return null;const t=this.getErrorMessages();if(!t.length)return null;const e=`${this.id||"sky-combobox"}-errors`;return o`
901
- <div class="progress-message">
902
- <ul id=${e} class="error-list" part="error-list">
903
- ${y(t,t=>t,t=>o`<li class="error" part="error-item">${t}</li>`)}
904
- </ul>
905
- </div>
906
- `}getErrorMessages(){const t=Array.isArray(this.validationErrors)?this.validationErrors:[];switch(this.errorDisplayMode){case"single":return t.slice(0,1);case"all":return t;default:return[]}}handleIconClick(t,e){this.dispatchEvent(new CustomEvent("icon-click",{detail:{position:t,event:e},bubbles:!0,composed:!0}))}render(){const t=u({"icon-slot":!0,left:!0,focused:this.focused}),e=u({"icon-slot":!0,right:!0,focused:this.focused}),i=u({"placeholder-label":!0,active:this.selectedItems.length>0});return o`
907
- <div class="combo-box-container" part="combo-box-container">
908
- ${p(this.label,()=>o`<div class="label" part="label">${this.label}</div>`)}
909
- <div
910
- class="input-wrapper"
911
- tabindex="0"
912
- part="input-wrapper"
913
- ?disabled=${this.disabled}
914
- ?compact=${this.compact}
915
- ?loading=${this.loading}
916
- ?open=${this.open}
917
- ?invalid=${this.invalid}
918
- @click=${t=>{this.disabled||this.readonly||this.toggleDropdown(t)}}
919
- @keydown=${this.handleKeydown}
920
- >
921
- <!-- Left Icon or Loading Indicator -->
922
- <div
923
- class=${t}
924
- part="icon-slot"
925
- ?filled=${this.hasLeftIcon}
926
- @click=${t=>this.handleIconClick("left",t)}
927
- >
928
- <slot name="icon-left" @slotchange=${this.onIconSlotChange}></slot>
929
- </div>
930
- ${p(this.selectedItems.length>0,()=>o`
931
- <div
932
- class="chip-container"
933
- part="chip-container"
934
- ?compact=${this.compact}
935
- >
936
- ${this.renderChips()}
937
- </div>
938
- `,()=>o`<label
939
- class=${i}
940
- part="placeholder-label"
941
- ?compact=${this.compact}
942
- >
943
- <span style="color:${this.prefixColor}">${this.prefix}</span
944
- >${this.placeholder}<span style="color:${this.suffixColor}"
945
- >${this.suffix}</span
946
- >
947
- </label>`)}
948
- ${p(this.clearable&&!this.enforceMinOneSelection&&(this.value||this.selectedItems.length),()=>o`<sky-icon
949
- class="clear-button"
950
- part="clear-button"
951
- @click=${this.handleClear}
952
- ?loading=${this.loading}
953
- icon="ion:close"
954
- ></sky-icon>`)}
955
- ${p(this.loading,()=>o`<div class="loading-indicator right"></div>`,()=>o`<div
956
- part="icon-slot"
957
- class=${e}
958
- ?filled=${this.hasRightIcon}
959
- @click=${t=>this.handleIconClick("right",t)}
960
- >
961
- <slot name="icon-right" @slotchange=${this.onIconSlotChange}></slot>
962
- </div>`)}
963
- <sky-icon
964
- class="dropdown-button"
965
- part="dropdown-button"
966
- @click=${t=>{this.disabled||this.readonly||this.toggleDropdown(t)}}
967
- icon=${this.open?"ion:ios-arrow-up":"ion:chevron-down"}
968
- >
969
- </sky-icon>
970
- </div>
971
- ${this.renderHiddenChipsDropdown()} ${this.renderDropdown()}
972
- ${this.renderValidationErrors()}
973
- <slot style="display:none" @slotchange=${this.refreshOptionSlots}></slot>
974
- </div>
975
- `}};t([r(),e("design:type",Object)],x.prototype,"value",void 0),t([r({type:String}),e("design:type",String)],x.prototype,"placeholder",void 0),t([r({type:String}),e("design:type",String)],x.prototype,"searchPlaceholder",void 0),t([r({type:String}),e("design:type",String)],x.prototype,"label",void 0),t([r({type:Array}),e("design:type",Object),e("design:paramtypes",[Object])],x.prototype,"options",null),t([r({type:Number}),e("design:type",Number)],x.prototype,"chipSize",void 0),t([r({type:String}),e("design:type",String)],x.prototype,"color",void 0),t([r({type:Boolean,reflect:!0}),e("design:type",Boolean)],x.prototype,"clearable",void 0),t([r({type:Boolean,reflect:!0}),e("design:type",Boolean)],x.prototype,"loading",void 0),t([r({type:Boolean,reflect:!0}),e("design:type",Boolean)],x.prototype,"compact",void 0),t([r({type:Boolean,reflect:!0}),e("design:type",Boolean)],x.prototype,"disabled",void 0),t([r({type:Boolean,reflect:!0}),e("design:type",Boolean)],x.prototype,"searchable",void 0),t([r({type:Boolean,reflect:!0}),e("design:type",Boolean)],x.prototype,"multiSelect",void 0),t([r({type:Number,reflect:!0}),e("design:type",Number)],x.prototype,"visibleChips",void 0),t([r({type:Boolean,reflect:!0}),e("design:type",Boolean)],x.prototype,"selectAll",void 0),t([r({type:Array}),e("design:type",Object),e("design:paramtypes",[Object])],x.prototype,"validations",null),t([r({type:Boolean}),e("design:type",Boolean)],x.prototype,"showErrors",void 0),t([r({type:String}),e("design:type",String)],x.prototype,"errorDisplayMode",void 0),t([r({type:Boolean,reflect:!0}),e("design:type",Boolean)],x.prototype,"required",void 0),t([r({type:Boolean,reflect:!0}),e("design:type",Boolean)],x.prototype,"emitFullObject",void 0),t([r({type:String}),e("design:type",String)],x.prototype,"emittedKey",void 0),t([r({type:String}),e("design:type",String)],x.prototype,"displayKey",void 0),t([r({type:Boolean}),e("design:type",Boolean)],x.prototype,"addOption",void 0),t([r({type:Boolean}),e("design:type",Boolean)],x.prototype,"validationArrayFormat",void 0),t([r({type:String}),e("design:type",String)],x.prototype,"prefix",void 0),t([r({type:String}),e("design:type",String)],x.prototype,"suffix",void 0),t([r({type:String}),e("design:type",String)],x.prototype,"prefixColor",void 0),t([r({type:String}),e("design:type",String)],x.prototype,"suffixColor",void 0),t([r({type:String}),e("design:type",String)],x.prototype,"justify",void 0),t([r({type:Number}),e("design:type",Number)],x.prototype,"zIndex",void 0),t([r({type:String}),e("design:type",String)],x.prototype,"height",void 0),t([r({type:String}),e("design:type",String)],x.prototype,"requiredMessage",void 0),t([r({type:Boolean,reflect:!0}),e("design:type",Boolean)],x.prototype,"readonly",void 0),t([r({type:Boolean}),e("design:type",Boolean)],x.prototype,"enforceMinOneSelection",void 0),t([r({type:Boolean}),e("design:type",Boolean)],x.prototype,"openAbove",void 0),t([r({type:Boolean,reflect:!0}),e("design:type",Boolean)],x.prototype,"validationActive",void 0),t([r({type:Boolean,reflect:!0}),e("design:type",Object)],x.prototype,"invalid",void 0),t([r({type:String,reflect:!0}),e("design:type",String)],x.prototype,"variant",void 0),t([r({type:String,attribute:!1}),e("design:type",Object)],x.prototype,"searchQuery",void 0),t([n(),e("design:type",Array)],x.prototype,"filteredOptions",void 0),t([n(),e("design:type",Boolean)],x.prototype,"focused",void 0),t([n(),e("design:type",Boolean)],x.prototype,"open",void 0),t([n(),e("design:type",Array)],x.prototype,"selectedItems",void 0),t([n(),e("design:type",Boolean)],x.prototype,"hiddenChipsOpen",void 0),t([n(),e("design:type",Number)],x.prototype,"activeIndex",void 0),t([n(),e("design:type",Array)],x.prototype,"validationErrors",void 0),t([n(),e("design:type",Array)],x.prototype,"validationStatus",void 0),t([n(),e("design:type",Object)],x.prototype,"hasLeftIcon",void 0),t([n(),e("design:type",Object)],x.prototype,"hasRightIcon",void 0),t([n(),e("design:type",Object)],x.prototype,"optionSlotSet",void 0),t([a(".input-wrapper"),e("design:type",HTMLElement)],x.prototype,"inputWrapperEl",void 0),t([a(".dropdown"),e("design:type",HTMLElement)],x.prototype,"dropdownEl",void 0),t([a(".hidden-chips-dropdown"),e("design:type",HTMLElement)],x.prototype,"hiddenDropdownEl",void 0),t([a(".search-container .input"),e("design:type",HTMLInputElement)],x.prototype,"searchInputEl",void 0),t([a(".overflow-chip"),e("design:type",HTMLElement)],x.prototype,"overflowChipEl",void 0),t([a(".combo-box-container"),e("design:type",HTMLElement)],x.prototype,"comboContainerEl",void 0),t([l("[data-row-index]"),e("design:type",Object)],x.prototype,"rowEls",void 0),t([d({slot:"icon-left"}),e("design:type",Array)],x.prototype,"iconLeftEls",void 0),t([d({slot:"icon-right"}),e("design:type",Array)],x.prototype,"iconRightEls",void 0),x=k=t([h("sky-combobox"),e("design:paramtypes",[])],x);export{x as SkyCombobox};
975
+ `,x.shadowRootOptions={...e.shadowRootOptions,delegatesFocus:!0},k([s()],x.prototype,"value",2),k([s({type:String})],x.prototype,"placeholder",2),k([s({type:String})],x.prototype,"searchPlaceholder",2),k([s({type:String})],x.prototype,"label",2),k([s({type:Array})],x.prototype,"options",1),k([s({type:Number})],x.prototype,"chipSize",2),k([s({type:String})],x.prototype,"color",2),k([s({type:Boolean,reflect:!0})],x.prototype,"clearable",2),k([s({type:Boolean,reflect:!0})],x.prototype,"loading",2),k([s({type:Boolean,reflect:!0})],x.prototype,"compact",2),k([s({type:Boolean,reflect:!0})],x.prototype,"disabled",2),k([s({type:Boolean,reflect:!0})],x.prototype,"searchable",2),k([s({type:Boolean,reflect:!0})],x.prototype,"multiSelect",2),k([s({type:Number,reflect:!0})],x.prototype,"visibleChips",2),k([s({type:Boolean,reflect:!0})],x.prototype,"selectAll",2),k([s({type:Array})],x.prototype,"validations",1),k([s({type:Boolean})],x.prototype,"showErrors",2),k([s({type:String})],x.prototype,"errorDisplayMode",2),k([s({type:Boolean,reflect:!0})],x.prototype,"required",2),k([s({type:Boolean,reflect:!0})],x.prototype,"emitFullObject",2),k([s({type:String})],x.prototype,"emittedKey",2),k([s({type:String})],x.prototype,"displayKey",2),k([s({type:Boolean})],x.prototype,"addOption",2),k([s({type:Boolean})],x.prototype,"validationArrayFormat",2),k([s({type:String})],x.prototype,"prefix",2),k([s({type:String})],x.prototype,"suffix",2),k([s({type:String})],x.prototype,"prefixColor",2),k([s({type:String})],x.prototype,"suffixColor",2),k([s({type:String})],x.prototype,"justify",2),k([s({type:Number})],x.prototype,"zIndex",2),k([s({type:String})],x.prototype,"height",2),k([s({type:String})],x.prototype,"requiredMessage",2),k([s({type:Boolean,reflect:!0})],x.prototype,"readonly",2),k([s({type:Boolean})],x.prototype,"enforceMinOneSelection",2),k([s({type:Boolean})],x.prototype,"openAbove",2),k([s({type:Boolean,reflect:!0})],x.prototype,"validationActive",2),k([s({type:Boolean,reflect:!0})],x.prototype,"invalid",2),k([s({type:String,reflect:!0})],x.prototype,"variant",2),k([s({type:String,attribute:!1})],x.prototype,"searchQuery",2),k([o()],x.prototype,"filteredOptions",2),k([o()],x.prototype,"focused",2),k([o()],x.prototype,"open",2),k([o()],x.prototype,"selectedItems",2),k([o()],x.prototype,"hiddenChipsOpen",2),k([o()],x.prototype,"activeIndex",2),k([o()],x.prototype,"validationErrors",2),k([o()],x.prototype,"validationStatus",2),k([o()],x.prototype,"hasLeftIcon",2),k([o()],x.prototype,"hasRightIcon",2),k([o()],x.prototype,"optionSlotSet",2),k([r(".input-wrapper")],x.prototype,"inputWrapperEl",2),k([r(".dropdown")],x.prototype,"dropdownEl",2),k([r(".hidden-chips-dropdown")],x.prototype,"hiddenDropdownEl",2),k([r(".search-container .input")],x.prototype,"searchInputEl",2),k([r(".overflow-chip")],x.prototype,"overflowChipEl",2),k([r(".combo-box-container")],x.prototype,"comboContainerEl",2),k([a("[data-row-index]")],x.prototype,"rowEls",2),k([n({slot:"icon-left"})],x.prototype,"iconLeftEls",2),k([n({slot:"icon-right"})],x.prototype,"iconRightEls",2),x=k([l("sky-combobox")],x);export{x as SkyCombobox};
976
976
  //# sourceMappingURL=sky-combobox.js.map