@sky.ui/core 0.0.40 → 0.0.42
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.
- package/dist/custom-elements.json +2011 -1275
- package/dist/helper/controllers/animation-controller.d.ts +4 -4
- package/dist/helper/controllers/animation-controller.js.map +1 -1
- package/dist/helper/controllers/index.d.ts +1 -0
- package/dist/helper/controllers/index.js +1 -1
- package/dist/helper/controllers/popover-controller.d.ts +12 -12
- package/dist/helper/controllers/popover-controller.js.map +1 -1
- package/dist/helper/controllers/preset-controller.d.ts +55 -0
- package/dist/helper/controllers/preset-controller.js +2 -0
- package/dist/helper/controllers/preset-controller.js.map +1 -0
- package/dist/helper/iconify-offline.js.map +1 -1
- package/dist/helper/index.js +1 -1
- package/dist/helper/internals/form-control-base.d.ts +6 -6
- package/dist/helper/internals/form-control-base.js.map +1 -1
- package/dist/helper/styles/focus-ring.d.ts +10 -0
- package/dist/helper/styles/focus-ring.js +10 -0
- package/dist/helper/styles/focus-ring.js.map +1 -0
- package/dist/helper/utils/color-resolver.d.ts +0 -14
- package/dist/helper/utils/color-resolver.js +1 -1
- package/dist/helper/utils/color-resolver.js.map +1 -1
- package/dist/helper/utils/component-presets.d.ts +132 -0
- package/dist/helper/utils/component-presets.js +2 -0
- package/dist/helper/utils/component-presets.js.map +1 -0
- package/dist/helper/utils/contrast-color.d.ts +6 -6
- package/dist/helper/utils/contrast-color.js.map +1 -1
- package/dist/helper/utils/index.d.ts +1 -0
- package/dist/helper/utils/index.js +1 -1
- package/dist/helper/utils/size-resolver.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/sky-alert/sky-alert.d.ts +15 -7
- package/dist/sky-alert/sky-alert.js +10 -20
- package/dist/sky-alert/sky-alert.js.map +1 -1
- package/dist/sky-appbar/sky-appbar.d.ts +9 -3
- package/dist/sky-appbar/sky-appbar.js +27 -19
- package/dist/sky-appbar/sky-appbar.js.map +1 -1
- package/dist/sky-avatar/sky-avatar.d.ts +6 -2
- package/dist/sky-avatar/sky-avatar.js +17 -14
- package/dist/sky-avatar/sky-avatar.js.map +1 -1
- package/dist/sky-badge/sky-badge.d.ts +9 -5
- package/dist/sky-badge/sky-badge.js +12 -16
- package/dist/sky-badge/sky-badge.js.map +1 -1
- package/dist/sky-button/sky-button.d.ts +27 -7
- package/dist/sky-button/sky-button.js +24 -32
- package/dist/sky-button/sky-button.js.map +1 -1
- package/dist/sky-card/sky-card.d.ts +13 -5
- package/dist/sky-card/sky-card.js +24 -24
- package/dist/sky-card/sky-card.js.map +1 -1
- package/dist/sky-checkbox/sky-checkbox.d.ts +6 -3
- package/dist/sky-checkbox/sky-checkbox.js +43 -44
- package/dist/sky-checkbox/sky-checkbox.js.map +1 -1
- package/dist/sky-chip/sky-chip.d.ts +7 -3
- package/dist/sky-chip/sky-chip.js +35 -43
- package/dist/sky-chip/sky-chip.js.map +1 -1
- package/dist/sky-col/sky-col.d.ts +7 -3
- package/dist/sky-col/sky-col.js +6 -11
- package/dist/sky-col/sky-col.js.map +1 -1
- package/dist/sky-combobox/sky-combobox.d.ts +15 -8
- package/dist/sky-combobox/sky-combobox.js +193 -257
- package/dist/sky-combobox/sky-combobox.js.map +1 -1
- package/dist/sky-dialog/sky-dialog.d.ts +7 -3
- package/dist/sky-dialog/sky-dialog.js +22 -20
- package/dist/sky-dialog/sky-dialog.js.map +1 -1
- package/dist/sky-divider/sky-divider.d.ts +6 -2
- package/dist/sky-divider/sky-divider.js +5 -5
- package/dist/sky-divider/sky-divider.js.map +1 -1
- package/dist/sky-flexbox/sky-flexbox.d.ts +10 -6
- package/dist/sky-flexbox/sky-flexbox.js +6 -6
- package/dist/sky-flexbox/sky-flexbox.js.map +1 -1
- package/dist/sky-flexcol/sky-flexcol.d.ts +6 -2
- package/dist/sky-flexcol/sky-flexcol.js +2 -2
- package/dist/sky-flexcol/sky-flexcol.js.map +1 -1
- package/dist/sky-form/sky-form.d.ts +15 -11
- package/dist/sky-form/sky-form.js +14 -14
- package/dist/sky-form/sky-form.js.map +1 -1
- package/dist/sky-grid/sky-grid.d.ts +5 -1
- package/dist/sky-grid/sky-grid.js +3 -3
- package/dist/sky-grid/sky-grid.js.map +1 -1
- package/dist/sky-icon/sky-icon.d.ts +3 -0
- package/dist/sky-icon/sky-icon.js +4 -4
- package/dist/sky-icon/sky-icon.js.map +1 -1
- package/dist/sky-image/sky-image.d.ts +8 -4
- package/dist/sky-image/sky-image.js +5 -5
- package/dist/sky-image/sky-image.js.map +1 -1
- package/dist/sky-image/srcset-utils.js.map +1 -1
- package/dist/sky-input/sky-input.d.ts +9 -5
- package/dist/sky-input/sky-input.js +155 -170
- package/dist/sky-input/sky-input.js.map +1 -1
- package/dist/sky-list/sky-list.d.ts +7 -3
- package/dist/sky-list/sky-list.js +6 -4
- package/dist/sky-list/sky-list.js.map +1 -1
- package/dist/sky-listitem/sky-listitem.d.ts +5 -1
- package/dist/sky-listitem/sky-listitem.js +10 -7
- package/dist/sky-listitem/sky-listitem.js.map +1 -1
- package/dist/sky-radio/sky-radio.d.ts +9 -4
- package/dist/sky-radio/sky-radio.js +7 -9
- package/dist/sky-radio/sky-radio.js.map +1 -1
- package/dist/sky-row/sky-row.d.ts +4 -1
- package/dist/sky-row/sky-row.js +2 -2
- package/dist/sky-row/sky-row.js.map +1 -1
- package/dist/sky-sheet/sky-sheet.d.ts +11 -6
- package/dist/sky-sheet/sky-sheet.js +23 -23
- package/dist/sky-sheet/sky-sheet.js.map +1 -1
- package/dist/sky-simple-table/sky-simple-table.d.ts +7 -3
- package/dist/sky-simple-table/sky-simple-table.js +4 -7
- package/dist/sky-simple-table/sky-simple-table.js.map +1 -1
- package/dist/sky-theme-provider/sky-theme-provider.d.ts +26 -26
- package/dist/sky-theme-provider/sky-theme-provider.js +2 -2
- package/dist/sky-theme-provider/sky-theme-provider.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";import{property as r,state as n,query as a,queryAll as l,queryAssignedElements as h,customElement as d}from"lit/decorators.js";import{unsafeHTML as p}from"lit/directives/unsafe-html.js";import{when as c}from"lit/directives/when.js";import{repeat as u}from"lit/directives/repeat.js";import{classMap as y}from"lit/directives/class-map.js";import{resolveColor as v}from"../helper/utils/color-resolver.js";import{cssOnFillEnhance as m}from"../helper/utils/contrast-color.js";import{PopoverController as g}from"../helper/controllers/popover-controller.js";import{FormControlBase as f}from"../helper/internals/form-control-base.js";import{SkyIcon as b}from"../sky-icon/sky-icon.js";import{SkyCheckbox as k}from"../sky-checkbox/sky-checkbox.js";var w=Object.defineProperty,x=Object.getOwnPropertyDescriptor,I=(t,e,i,s)=>{for(var o,r=s>1?void 0:s?x(e,i):e,n=t.length-1;n>=0;n--)(o=t[n])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&w(e,i,r),r};let S=class extends f{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.multiDisplay="chips",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._closeResetId=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.focused=!0,null!=this._closeResetId&&(clearTimeout(this._closeResetId),this._closeResetId=null),this.validationActive=!0,this.filterOptions(),requestAnimationFrame(()=>this.focusOnOpen())):(this.activeIndex=-1,null!=this._closeResetId&&clearTimeout(this._closeResetId),this._closeResetId=setTimeout(()=>{this._closeResetId=null,this.open||(this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions())},S._CLOSE_RESET_MS),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("")}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.open||(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>S._SEARCH_DEBOUNCE_OPTIONS_THRESHOLD,s=()=>{this.filterOptions(),this.emitSearchQueryChanged()};i?(null!=this._searchDebounceId&&clearTimeout(this._searchDebounceId),this._searchDebounceId=setTimeout(()=>{this._searchDebounceId=null,s()},S._SEARCH_DEBOUNCE_MS)):s()}disconnectedCallback(){super.disconnectedCallback(),null!=this._searchDebounceId&&(clearTimeout(this._searchDebounceId),this._searchDebounceId=null),null!=this._closeResetId&&(clearTimeout(this._closeResetId),this._closeResetId=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.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 s`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";import{property as r,state as a,query as n,queryAll as l,queryAssignedElements as h,customElement as d}from"lit/decorators.js";import{unsafeHTML as p}from"lit/directives/unsafe-html.js";import{when as c}from"lit/directives/when.js";import{repeat as u}from"lit/directives/repeat.js";import{classMap as y}from"lit/directives/class-map.js";import{resolveColor as v}from"../helper/utils/color-resolver.js";import{cssOnFillEnhance as m}from"../helper/utils/contrast-color.js";import{PopoverController as g}from"../helper/controllers/popover-controller.js";import{FormControlBase as f}from"../helper/internals/form-control-base.js";import{SkyIcon as b}from"../sky-icon/sky-icon.js";import{SkyCheckbox as k}from"../sky-checkbox/sky-checkbox.js";import{SkyInput as w}from"../sky-input/sky-input.js";import{PresetController as x}from"../helper/controllers/preset-controller.js";var S=Object.defineProperty,I=Object.getOwnPropertyDescriptor,O=(t,e,i,s)=>{for(var o,r=s>1?void 0:s?I(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&&S(e,i,r),r};let A=class extends f{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.multiDisplay="chips",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._closeResetId=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.focused=!0,null!=this._closeResetId&&(clearTimeout(this._closeResetId),this._closeResetId=null),this.validationActive=!0,this.filterOptions(),requestAnimationFrame(()=>this.focusOnOpen())):(this.activeIndex=-1,null!=this._closeResetId&&clearTimeout(this._closeResetId),this._closeResetId=setTimeout(()=>{this._closeResetId=null,this.open||(this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions())},A._CLOSE_RESET_MS),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.preset="",this._presets=new x(this),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.open||(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}))}handleSearchValueChanged(t){t.stopPropagation(),this.disabled||this.readonly||this.applySearchQuery(String(t.detail?.value??""))}handleSearchValueCleared(t){t.stopPropagation(),this.disabled||this.readonly||this.applySearchQuery("")}applySearchQuery(t){this.searchQuery=t;const e=Array.isArray(this.options)?this.options.length:0,i=this.searchable&&e>A._SEARCH_DEBOUNCE_OPTIONS_THRESHOLD,s=()=>{this.filterOptions(),this.emitSearchQueryChanged()};i?(null!=this._searchDebounceId&&clearTimeout(this._searchDebounceId),this._searchDebounceId=setTimeout(()=>{this._searchDebounceId=null,s()},A._SEARCH_DEBOUNCE_MS)):s()}disconnectedCallback(){super.disconnectedCallback(),null!=this._searchDebounceId&&(clearTimeout(this._searchDebounceId),this._searchDebounceId=null),null!=this._closeResetId&&(clearTimeout(this._closeResetId),this._closeResetId=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.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 s`
|
|
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
9
|
left: var(--sky-hc-left, 0px);
|
|
10
10
|
top: var(--sky-hc-top, 0px);
|
|
11
11
|
width: var(--sky-hc-width, max-content);
|
|
12
12
|
z-index: ${this.zIndex};
|
|
13
13
|
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
>
|
|
15
|
+
${u(this.selectedItems.slice(this.visibleChips),t=>String(this.getOptionValue(t)),t=>s`
|
|
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(){const t=Array.isArray(this.selectedItems)?this.selectedItems.slice(0,this.visibleChips):[],e=this.selectedItems.length-this.visibleChips;return s`
|
|
30
30
|
${u(t,t=>String(this.getOptionValue(t)),t=>s`
|
|
31
31
|
<span class="chip" ?compact=${this.compact} part="chip">
|
|
32
32
|
<span class="chip-label" part="chip-label"
|
|
33
33
|
>${this.truncateText(String(this.getOptionLabel(t)),this.chipSize)}</span
|
|
34
34
|
>
|
|
35
35
|
${c(this.multiSelect,()=>s`
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
<sky-icon
|
|
37
|
+
class="remove-chip"
|
|
38
|
+
part="remove-chip-icon"
|
|
39
|
+
?compact=${this.compact}
|
|
40
|
+
@click=${e=>{e.stopPropagation(),this.removeChip(t)}}
|
|
41
|
+
icon="ion:close"
|
|
42
|
+
></sky-icon>
|
|
43
|
+
`)}
|
|
44
44
|
</span>
|
|
45
45
|
`)}
|
|
46
46
|
${c(e>0,()=>s`
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
<span
|
|
48
|
+
class="chip overflow-chip"
|
|
49
|
+
part="overflow-chip"
|
|
50
|
+
style="cursor:pointer"
|
|
51
|
+
?compact=${this.compact}
|
|
52
|
+
@click=${this.toggleHiddenChips}
|
|
53
|
+
>
|
|
54
|
+
+ ${e}
|
|
55
|
+
</span>
|
|
56
|
+
`)}
|
|
57
57
|
`}resolveMultiDisplay(){const t=this.multiDisplay;return"text"===t||"count"===t||"chips"===t?t:"chips"}renderSelectedValue(){if(!this.selectedItems.length)return null;if(!this.multiSelect){const t=String(this.getOptionLabel(this.selectedItems[0]));return s`
|
|
58
58
|
<span
|
|
59
59
|
class="value-summary"
|
|
@@ -70,63 +70,61 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
70
70
|
>${i}</span
|
|
71
71
|
>
|
|
72
72
|
`}return s`
|
|
73
|
-
<div
|
|
74
|
-
class="chip-container"
|
|
75
|
-
part="chip-container"
|
|
76
|
-
?compact=${this.compact}
|
|
77
|
-
>
|
|
73
|
+
<div class="chip-container" part="chip-container" ?compact=${this.compact}>
|
|
78
74
|
${this.renderChips()}
|
|
79
75
|
</div>
|
|
80
76
|
`}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)}}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)}focusOnOpen(){const t=this.searchInputEl;if(t&&document.activeElement!==t&&requestAnimationFrame(()=>t.focus()),this.filteredOptions.length>0){let t=0;if(this.selectedItems.length>0){const e=this.getOptionValue(this.selectedItems[0]),i=this.filteredOptions.findIndex(t=>this.getOptionValue(t.original)===e);i>=0&&(t=i)}return this.activeIndex=this.headerRows+t,void this.scrollActiveItemIntoView()}this.activeIndex=this.searchable||this.addOption?0:-1}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 s`
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
77
|
+
<div
|
|
78
|
+
class="dropdown"
|
|
79
|
+
part="dropdown"
|
|
80
|
+
popover="manual"
|
|
81
|
+
@toggle=${this.dropdownPopover.onToggle}
|
|
82
|
+
@click=${t=>t.stopPropagation()}
|
|
83
|
+
style="
|
|
88
84
|
left: var(--sky-dd-left, 0px);
|
|
89
85
|
top: var(--sky-dd-top, 0px);
|
|
90
86
|
min-width: var(--sky-dd-width, 100%);
|
|
91
87
|
"
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
>
|
|
89
|
+
${c(this.searchable||this.addOption,()=>s`
|
|
94
90
|
<div
|
|
95
91
|
class="search-container"
|
|
96
92
|
data-row-index="0"
|
|
97
93
|
part="search-container"
|
|
98
94
|
>
|
|
99
|
-
<sky-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
<sky-input
|
|
96
|
+
class="dropdown-search-input"
|
|
97
|
+
compact
|
|
98
|
+
clearable
|
|
103
99
|
part="search-input"
|
|
104
100
|
tabindex="0"
|
|
105
101
|
?readonly=${this.readonly||!this.searchable&&!this.addOption}
|
|
106
|
-
|
|
102
|
+
?disabled=${this.disabled}
|
|
103
|
+
placeholder=${this.searchPlaceholder}
|
|
104
|
+
.value=${this.searchQuery}
|
|
105
|
+
@value-changed=${this.searchable||this.addOption?this.handleSearchValueChanged:null}
|
|
106
|
+
@value-cleared=${this.searchable||this.addOption?this.handleSearchValueCleared:null}
|
|
107
107
|
@keydown=${this.onSearchKeydown}
|
|
108
108
|
@focus=${this.searchable||this.addOption?this.handleFocus:null}
|
|
109
109
|
@blur=${this.searchable||this.addOption?this.handleBlur:null}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
class="input"
|
|
114
|
-
/>
|
|
110
|
+
>
|
|
111
|
+
<sky-icon slot="icon-left" icon="ion:search"></sky-icon>
|
|
112
|
+
</sky-input>
|
|
115
113
|
|
|
116
114
|
${c(this.addOption,()=>s`
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
115
|
+
<sky-icon
|
|
116
|
+
class="new-option-btn"
|
|
117
|
+
icon="ion:add"
|
|
118
|
+
part="add-option-icon"
|
|
119
|
+
title="Add as new option"
|
|
120
|
+
aria-label="Add as new option"
|
|
121
|
+
@click=${this.handleAddaddOption}
|
|
122
|
+
></sky-icon>
|
|
123
|
+
`)}
|
|
126
124
|
</div>
|
|
127
125
|
`)}
|
|
128
126
|
|
|
129
|
-
|
|
127
|
+
<div class="dropdown-scroller">
|
|
130
128
|
${c(this.multiSelect&&this.selectAll&&this.filteredOptions.length,()=>{const t=this.searchable||this.addOption?1:0,e=y({"dropdown-item":!0,active:this.activeIndex===t,selected:this.isAllFilteredSelected()});return s`
|
|
131
129
|
<div
|
|
132
130
|
class=${e}
|
|
@@ -142,21 +140,21 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
142
140
|
Select All
|
|
143
141
|
</div>
|
|
144
142
|
`})}
|
|
145
|
-
${c(this.filteredOptions.length>0,()=>u(this.filteredOptions,({original:t,_idx:e})=>`${e}-${String(this.getOptionValue(t))}`,({original:t,highlighted:e,_idx:i},o)=>{const r=`option-${i}`,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
143
|
+
${c(this.filteredOptions.length>0,()=>u(this.filteredOptions,({original:t,_idx:e})=>`${e}-${String(this.getOptionValue(t))}`,({original:t,highlighted:e,_idx:i},o)=>{const r=`option-${i}`,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)),h=this.headerRows+o,d=h===this.activeIndex,u=y({"dropdown-item":!0,active:d,selected:l});return s`
|
|
144
|
+
<div
|
|
145
|
+
class=${u}
|
|
146
|
+
data-row-index=${h}
|
|
147
|
+
style="justify-content: ${this.justify};"
|
|
148
|
+
part="option"
|
|
149
|
+
@click=${()=>this.selectOption(t)}
|
|
150
|
+
@pointerenter=${()=>{this.activeIndex=h}}
|
|
151
|
+
?compact=${this.compact}
|
|
152
|
+
>
|
|
153
|
+
${c(this.multiSelect,()=>s` <sky-checkbox
|
|
154
|
+
.checked=${l}
|
|
155
|
+
readonly
|
|
156
|
+
></sky-checkbox>`)}
|
|
157
|
+
${c(a,()=>s`
|
|
160
158
|
<div style="display: flex; gap: 8px;width:100%">
|
|
161
159
|
<slot name=${r}>
|
|
162
160
|
<span
|
|
@@ -167,27 +165,27 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
167
165
|
</slot>
|
|
168
166
|
</div>
|
|
169
167
|
`,()=>s`<span
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
168
|
+
class="highlighted-text"
|
|
169
|
+
part="highlighted-text"
|
|
170
|
+
>${p(e)}</span
|
|
171
|
+
>`)}
|
|
172
|
+
</div>
|
|
173
|
+
`}),()=>s`<div
|
|
176
174
|
class="dropdown-item"
|
|
177
175
|
part="no-options"
|
|
178
176
|
data-row-index=${this.headerRows}
|
|
179
177
|
>
|
|
180
178
|
No options found
|
|
181
179
|
</div>`)}
|
|
182
|
-
</div>
|
|
183
180
|
</div>
|
|
184
|
-
|
|
181
|
+
</div>
|
|
182
|
+
`}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 s`
|
|
185
183
|
<div class="progress-message">
|
|
186
184
|
<ul id=${e} class="error-list" part="error-list">
|
|
187
185
|
${u(t,t=>t,t=>s`<li class="error" part="error-item">${t}</li>`)}
|
|
188
186
|
</ul>
|
|
189
187
|
</div>
|
|
190
|
-
`}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=y({"icon-slot":!0,left:!0,focused:this.focused}),e=y({"icon-slot":!0,right:!0,focused:this.focused}),i=y({"placeholder-label":!0,active:this.selectedItems.length>0}),r="fieldset"===this.variant,
|
|
188
|
+
`}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=y({"icon-slot":!0,left:!0,focused:this.focused}),e=y({"icon-slot":!0,right:!0,focused:this.focused}),i=y({"placeholder-label":!0,active:this.selectedItems.length>0}),r="fieldset"===this.variant,a="inside"===this.variant,n=this.label?r?s`<legend class="label" part="label">${this.label}</legend>`:s`<div class="label" part="label">${this.label}</div>`:null,l=s`
|
|
191
189
|
<div
|
|
192
190
|
class=${t}
|
|
193
191
|
part="icon-slot"
|
|
@@ -197,24 +195,24 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
197
195
|
<slot name="icon-left" @slotchange=${this.onIconSlotChange}></slot>
|
|
198
196
|
</div>
|
|
199
197
|
`,h=c(this.selectedItems.length>0,()=>this.renderSelectedValue(),()=>s`<label
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
198
|
+
class=${i}
|
|
199
|
+
part="placeholder-label"
|
|
200
|
+
?compact=${this.compact}
|
|
201
|
+
>
|
|
202
|
+
<span style="color:${this.prefixColor}">${this.prefix}</span
|
|
203
|
+
>${this.placeholder}<span style="color:${this.suffixColor}"
|
|
204
|
+
>${this.suffix}</span
|
|
203
205
|
>
|
|
204
|
-
|
|
205
|
-
>${this.placeholder}<span style="color:${this.suffixColor}"
|
|
206
|
-
>${this.suffix}</span
|
|
207
|
-
>
|
|
208
|
-
</label>`),d=s`
|
|
206
|
+
</label>`),d=s`
|
|
209
207
|
<div class="field-trailing" part="field-trailing">
|
|
210
208
|
${c(this.clearable&&!this.enforceMinOneSelection&&(this.value||this.selectedItems.length),()=>s`<sky-icon
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
209
|
+
class="clear-button"
|
|
210
|
+
part="clear-button"
|
|
211
|
+
?compact=${this.compact}
|
|
212
|
+
@click=${t=>{t.stopPropagation(),this.handleClear()}}
|
|
213
|
+
?loading=${this.loading}
|
|
214
|
+
icon="ion:close"
|
|
215
|
+
></sky-icon>`)}
|
|
218
216
|
${c(this.loading,()=>s`<div class="loading-indicator right"></div>`,()=>this.hasRightIcon?s`<div
|
|
219
217
|
part="icon-slot"
|
|
220
218
|
class=${e}
|
|
@@ -246,13 +244,13 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
246
244
|
`,u=s`
|
|
247
245
|
${l}
|
|
248
246
|
<div class="input-inside-main">
|
|
249
|
-
${
|
|
247
|
+
${n}
|
|
250
248
|
<div class="input-inside-row">
|
|
251
249
|
<div class="field-main" part="field-main">${h}</div>
|
|
252
250
|
</div>
|
|
253
251
|
</div>
|
|
254
252
|
${this.readonly?o:d}
|
|
255
|
-
`,v=
|
|
253
|
+
`,v=a?u:p,m=t=>{this.disabled||this.readonly||this.toggleDropdown(t)},g=this.handleKeydown,f=r?s`
|
|
256
254
|
<fieldset
|
|
257
255
|
class="input-wrapper"
|
|
258
256
|
tabindex="0"
|
|
@@ -265,7 +263,7 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
265
263
|
@click=${m}
|
|
266
264
|
@keydown=${g}
|
|
267
265
|
>
|
|
268
|
-
${
|
|
266
|
+
${n}
|
|
269
267
|
<div class="input-fieldset-body">${v}</div>
|
|
270
268
|
</fieldset>
|
|
271
269
|
`:s`
|
|
@@ -285,15 +283,13 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
285
283
|
</div>
|
|
286
284
|
`;return s`
|
|
287
285
|
<div class="combo-box-container" part="combo-box-container">
|
|
288
|
-
${r||
|
|
286
|
+
${r||a?o:n}
|
|
287
|
+
${f}
|
|
289
288
|
${this.renderHiddenChipsDropdown()} ${this.renderDropdown()}
|
|
290
289
|
${this.renderValidationErrors()}
|
|
291
|
-
<slot
|
|
292
|
-
style="display:none"
|
|
293
|
-
@slotchange=${this.refreshOptionSlots}
|
|
294
|
-
></slot>
|
|
290
|
+
<slot style="display:none" @slotchange=${this.refreshOptionSlots}></slot>
|
|
295
291
|
</div>
|
|
296
|
-
`}};
|
|
292
|
+
`}};A.dependencies={"sky-icon":b,"sky-checkbox":k,"sky-input":w},A._SEARCH_DEBOUNCE_MS=150,A._SEARCH_DEBOUNCE_OPTIONS_THRESHOLD=30,A._CLOSE_RESET_MS=250,A.styles=e`
|
|
297
293
|
:host {
|
|
298
294
|
display: block;
|
|
299
295
|
font-family: var(--sky-font);
|
|
@@ -345,21 +341,21 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
345
341
|
cursor: default;
|
|
346
342
|
}
|
|
347
343
|
|
|
348
|
-
:host([variant=
|
|
344
|
+
:host([variant="highlight"]) .label {
|
|
349
345
|
color: var(--sky-dropdown-color);
|
|
350
346
|
}
|
|
351
347
|
|
|
352
348
|
/* Fieldset / legend */
|
|
353
|
-
:host([variant=
|
|
349
|
+
:host([variant="fieldset"]) {
|
|
354
350
|
overflow: visible;
|
|
355
351
|
padding-block-start: 0;
|
|
356
352
|
}
|
|
357
353
|
|
|
358
|
-
:host([variant=
|
|
354
|
+
:host([variant="fieldset"]) .combo-box-container {
|
|
359
355
|
overflow: visible;
|
|
360
356
|
}
|
|
361
357
|
|
|
362
|
-
:host([variant=
|
|
358
|
+
:host([variant="fieldset"]) fieldset.input-wrapper {
|
|
363
359
|
display: block;
|
|
364
360
|
height: auto;
|
|
365
361
|
margin: 0;
|
|
@@ -371,16 +367,18 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
371
367
|
box-shadow: none;
|
|
372
368
|
}
|
|
373
369
|
|
|
374
|
-
:host([variant=
|
|
370
|
+
:host([variant="fieldset"]) fieldset.input-wrapper[compact] {
|
|
375
371
|
height: auto;
|
|
376
372
|
}
|
|
377
373
|
|
|
378
|
-
:host([variant=
|
|
374
|
+
:host([variant="fieldset"]) .input-fieldset-body {
|
|
379
375
|
display: flex;
|
|
380
376
|
width: 100%;
|
|
381
377
|
align-items: center;
|
|
382
378
|
box-sizing: border-box;
|
|
383
|
-
height: calc(
|
|
379
|
+
height: calc(
|
|
380
|
+
var(--sky-input-height) - 2 * var(--sky-input-border-width)
|
|
381
|
+
);
|
|
384
382
|
min-height: calc(
|
|
385
383
|
var(--sky-input-height) - 2 * var(--sky-input-border-width)
|
|
386
384
|
);
|
|
@@ -391,9 +389,7 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
391
389
|
overflow: hidden;
|
|
392
390
|
}
|
|
393
391
|
|
|
394
|
-
:host([variant=
|
|
395
|
-
fieldset.input-wrapper[compact]
|
|
396
|
-
.input-fieldset-body {
|
|
392
|
+
:host([variant="fieldset"]) fieldset.input-wrapper[compact] .input-fieldset-body {
|
|
397
393
|
height: calc(
|
|
398
394
|
var(--sky-input-height-compact) - 2 * var(--sky-input-border-width)
|
|
399
395
|
);
|
|
@@ -403,16 +399,17 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
403
399
|
}
|
|
404
400
|
|
|
405
401
|
/* Multi chips stay single-line; do not grow taller than sky-input */
|
|
406
|
-
:host([variant=
|
|
407
|
-
|
|
408
|
-
|
|
402
|
+
:host([variant="fieldset"]) .input-fieldset-body:has(.chip:not([single-select])) {
|
|
403
|
+
height: calc(
|
|
404
|
+
var(--sky-input-height) - 2 * var(--sky-input-border-width)
|
|
405
|
+
);
|
|
409
406
|
min-height: calc(
|
|
410
407
|
var(--sky-input-height) - 2 * var(--sky-input-border-width)
|
|
411
408
|
);
|
|
412
409
|
padding-block: 0;
|
|
413
410
|
}
|
|
414
411
|
|
|
415
|
-
:host([variant=
|
|
412
|
+
:host([variant="fieldset"][compact])
|
|
416
413
|
.input-fieldset-body:has(.chip:not([single-select])) {
|
|
417
414
|
height: calc(
|
|
418
415
|
var(--sky-input-height-compact) - 2 * var(--sky-input-border-width)
|
|
@@ -423,7 +420,7 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
423
420
|
padding-block: 0;
|
|
424
421
|
}
|
|
425
422
|
|
|
426
|
-
:host([variant=
|
|
423
|
+
:host([variant="fieldset"]) legend.label {
|
|
427
424
|
float: unset;
|
|
428
425
|
width: auto;
|
|
429
426
|
max-width: calc(100% - 2 * var(--sky-input-pad-x));
|
|
@@ -443,48 +440,46 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
443
440
|
pointer-events: none;
|
|
444
441
|
}
|
|
445
442
|
|
|
446
|
-
:host([variant=
|
|
447
|
-
:host([variant=
|
|
443
|
+
:host([variant="fieldset"]) .combo-box-container:focus-within legend.label,
|
|
444
|
+
:host([variant="fieldset"]) .input-wrapper[open] legend.label {
|
|
448
445
|
color: var(--sky-dropdown-color);
|
|
449
446
|
font-size: var(--sky-font-size-xs);
|
|
450
447
|
}
|
|
451
448
|
|
|
452
|
-
:host([variant=
|
|
449
|
+
:host([variant="fieldset"]) .input-wrapper::after {
|
|
453
450
|
content: none;
|
|
454
451
|
display: none;
|
|
455
452
|
}
|
|
456
453
|
|
|
457
|
-
:host([variant=
|
|
458
|
-
:host([variant=
|
|
454
|
+
:host([variant="fieldset"]) .input-wrapper[open],
|
|
455
|
+
:host([variant="fieldset"]) .input-wrapper:focus-visible {
|
|
459
456
|
border-color: var(--sky-dropdown-color);
|
|
460
457
|
}
|
|
461
458
|
|
|
462
|
-
:host([variant=
|
|
459
|
+
:host([variant="fieldset"][validationActive]:invalid) .input-wrapper {
|
|
463
460
|
border-color: var(--sky-danger-primary);
|
|
464
461
|
}
|
|
465
462
|
|
|
466
|
-
:host([variant=
|
|
463
|
+
:host([variant="fieldset"][validationActive]:invalid) legend.label {
|
|
467
464
|
color: var(--sky-danger-primary);
|
|
468
465
|
}
|
|
469
466
|
|
|
470
|
-
:host([variant=
|
|
471
|
-
:host([variant=
|
|
472
|
-
|
|
473
|
-
legend.label,
|
|
474
|
-
:host([variant='fieldset'][compact]) .input-wrapper[open] legend.label {
|
|
467
|
+
:host([variant="fieldset"][compact]) legend.label,
|
|
468
|
+
:host([variant="fieldset"][compact]) .combo-box-container:focus-within legend.label,
|
|
469
|
+
:host([variant="fieldset"][compact]) .input-wrapper[open] legend.label {
|
|
475
470
|
font-size: var(--sky-font-size-xs);
|
|
476
471
|
line-height: 1.4;
|
|
477
472
|
}
|
|
478
473
|
|
|
479
474
|
/* Inside: label in the wrapper above value row — keep tokens in sync with sky-input */
|
|
480
|
-
:host([variant=
|
|
475
|
+
:host([variant="inside"]) {
|
|
481
476
|
--sky-input-height-inside: 44px;
|
|
482
477
|
--sky-input-height-inside-compact: 40px;
|
|
483
478
|
--sky-input-inside-label-block: 0.15rem;
|
|
484
479
|
--sky-input-inside-value-min: 1.375rem;
|
|
485
480
|
}
|
|
486
481
|
|
|
487
|
-
:host([variant=
|
|
482
|
+
:host([variant="inside"]) .input-wrapper {
|
|
488
483
|
height: auto;
|
|
489
484
|
min-height: var(--sky-input-height-inside);
|
|
490
485
|
align-items: center;
|
|
@@ -492,13 +487,13 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
492
487
|
overflow: hidden;
|
|
493
488
|
}
|
|
494
489
|
|
|
495
|
-
:host([variant=
|
|
490
|
+
:host([variant="inside"]) .input-wrapper[compact] {
|
|
496
491
|
height: auto;
|
|
497
492
|
min-height: var(--sky-input-height-inside-compact);
|
|
498
493
|
padding-block: var(--sky-input-pad-y-sm, 0px);
|
|
499
494
|
}
|
|
500
495
|
|
|
501
|
-
:host([variant=
|
|
496
|
+
:host([variant="inside"]) .input-inside-main {
|
|
502
497
|
flex: 1 1 0%;
|
|
503
498
|
min-width: 0;
|
|
504
499
|
display: flex;
|
|
@@ -510,7 +505,7 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
510
505
|
overflow: hidden;
|
|
511
506
|
}
|
|
512
507
|
|
|
513
|
-
:host([variant=
|
|
508
|
+
:host([variant="inside"]) .input-inside-main > .label {
|
|
514
509
|
margin: 0;
|
|
515
510
|
padding-inline: var(--sky-input-pad-x);
|
|
516
511
|
font-size: var(--sky-font-size-xs);
|
|
@@ -524,39 +519,28 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
524
519
|
flex: 0 0 auto;
|
|
525
520
|
}
|
|
526
521
|
|
|
527
|
-
:host([variant=
|
|
522
|
+
:host([variant="inside"][compact]) .input-inside-main > .label {
|
|
528
523
|
font-size: 0.6875rem;
|
|
529
524
|
line-height: 1.3;
|
|
530
525
|
min-height: calc(0.6875rem * 1.3);
|
|
531
526
|
}
|
|
532
527
|
|
|
533
|
-
:host([variant=
|
|
534
|
-
|
|
535
|
-
.input-inside-main
|
|
536
|
-
> .label,
|
|
537
|
-
:host([variant='inside']) .input-wrapper[open] .input-inside-main > .label {
|
|
528
|
+
:host([variant="inside"]) .combo-box-container:focus-within .input-inside-main > .label,
|
|
529
|
+
:host([variant="inside"]) .input-wrapper[open] .input-inside-main > .label {
|
|
538
530
|
color: var(--sky-dropdown-color);
|
|
539
531
|
font-size: var(--sky-font-size-xs);
|
|
540
532
|
}
|
|
541
533
|
|
|
542
|
-
:host([variant=
|
|
543
|
-
|
|
544
|
-
.input-inside-main
|
|
545
|
-
> .label,
|
|
546
|
-
:host([variant='inside'][compact])
|
|
547
|
-
.input-wrapper[open]
|
|
548
|
-
.input-inside-main
|
|
549
|
-
> .label {
|
|
534
|
+
:host([variant="inside"][compact]) .combo-box-container:focus-within .input-inside-main > .label,
|
|
535
|
+
:host([variant="inside"][compact]) .input-wrapper[open] .input-inside-main > .label {
|
|
550
536
|
font-size: 0.6875rem;
|
|
551
537
|
}
|
|
552
538
|
|
|
553
|
-
:host([variant=
|
|
554
|
-
.input-inside-main
|
|
555
|
-
> .label {
|
|
539
|
+
:host([variant="inside"][validationActive]:invalid) .input-inside-main > .label {
|
|
556
540
|
color: var(--sky-danger-primary);
|
|
557
541
|
}
|
|
558
542
|
|
|
559
|
-
:host([variant=
|
|
543
|
+
:host([variant="inside"]) .input-inside-row {
|
|
560
544
|
display: flex;
|
|
561
545
|
align-items: center;
|
|
562
546
|
min-width: 0;
|
|
@@ -568,33 +552,24 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
568
552
|
}
|
|
569
553
|
|
|
570
554
|
/* Match sky-input: label + value share pad-x; zero start when left icon present */
|
|
571
|
-
:host([variant=
|
|
572
|
-
:host([variant=
|
|
573
|
-
:host([variant=
|
|
574
|
-
:host([variant=
|
|
555
|
+
:host([variant="inside"]) .input-inside-main > .label,
|
|
556
|
+
:host([variant="inside"]) .chip-container,
|
|
557
|
+
:host([variant="inside"]) .value-summary,
|
|
558
|
+
:host([variant="inside"]) .placeholder-label {
|
|
575
559
|
padding-inline-start: var(--sky-input-pad-x);
|
|
576
560
|
padding-inline-end: var(--sky-input-pad-x);
|
|
577
561
|
}
|
|
578
562
|
|
|
579
|
-
:host([variant=
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
:host([variant='inside'])
|
|
584
|
-
.input-wrapper:has(.icon-slot[filled].left)
|
|
585
|
-
.chip-container,
|
|
586
|
-
:host([variant='inside'])
|
|
587
|
-
.input-wrapper:has(.icon-slot[filled].left)
|
|
588
|
-
.value-summary,
|
|
589
|
-
:host([variant='inside'])
|
|
590
|
-
.input-wrapper:has(.icon-slot[filled].left)
|
|
591
|
-
.placeholder-label {
|
|
563
|
+
:host([variant="inside"]) .input-wrapper:has(.icon-slot[filled].left) .input-inside-main > .label,
|
|
564
|
+
:host([variant="inside"]) .input-wrapper:has(.icon-slot[filled].left) .chip-container,
|
|
565
|
+
:host([variant="inside"]) .input-wrapper:has(.icon-slot[filled].left) .value-summary,
|
|
566
|
+
:host([variant="inside"]) .input-wrapper:has(.icon-slot[filled].left) .placeholder-label {
|
|
592
567
|
padding-inline-start: 0;
|
|
593
568
|
}
|
|
594
569
|
|
|
595
570
|
/* Left icon / trailing chrome centered to label+value column (like sky-input) */
|
|
596
|
-
:host([variant=
|
|
597
|
-
:host([variant=
|
|
571
|
+
:host([variant="inside"]) .icon-slot,
|
|
572
|
+
:host([variant="inside"]) .icon-slot[filled] {
|
|
598
573
|
align-self: center;
|
|
599
574
|
height: auto;
|
|
600
575
|
max-height: none;
|
|
@@ -602,7 +577,7 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
602
577
|
justify-content: center;
|
|
603
578
|
}
|
|
604
579
|
|
|
605
|
-
:host([variant=
|
|
580
|
+
:host([variant="inside"]) .field-trailing {
|
|
606
581
|
align-self: center;
|
|
607
582
|
padding-inline-start: 0;
|
|
608
583
|
}
|
|
@@ -666,21 +641,15 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
666
641
|
display: flex;
|
|
667
642
|
align-items: center;
|
|
668
643
|
padding: 8px 10px;
|
|
669
|
-
gap:
|
|
644
|
+
gap: var(--sky-input-gap, 4px);
|
|
670
645
|
border-bottom: 1px solid var(--sky-border-light);
|
|
671
|
-
justify-content: space-between;
|
|
672
646
|
margin-bottom: 5px;
|
|
673
647
|
}
|
|
674
648
|
|
|
675
|
-
.search-container
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
transition: color 0.15s ease;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
.search-container:has(.input:focus) sky-icon {
|
|
683
|
-
color: var(--sky-active-primary);
|
|
649
|
+
.search-container .dropdown-search-input {
|
|
650
|
+
flex: 1 1 auto;
|
|
651
|
+
min-width: 0;
|
|
652
|
+
width: 100%;
|
|
684
653
|
}
|
|
685
654
|
|
|
686
655
|
.new-option-btn {
|
|
@@ -735,7 +704,7 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
735
704
|
}
|
|
736
705
|
|
|
737
706
|
.input-wrapper::after {
|
|
738
|
-
content:
|
|
707
|
+
content: "";
|
|
739
708
|
position: absolute;
|
|
740
709
|
top: -1px;
|
|
741
710
|
left: -1px;
|
|
@@ -798,16 +767,16 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
798
767
|
padding-block: 0;
|
|
799
768
|
}
|
|
800
769
|
|
|
801
|
-
:host([variant=
|
|
802
|
-
:host([variant=
|
|
803
|
-
:host([variant=
|
|
770
|
+
:host([variant="inside"]) .input-wrapper,
|
|
771
|
+
:host([variant="inside"]) .input-wrapper:has(.chip),
|
|
772
|
+
:host([variant="inside"]) .input-wrapper[compact]:has(.chip) {
|
|
804
773
|
height: auto;
|
|
805
774
|
min-height: var(--sky-input-height-inside);
|
|
806
775
|
padding-block: var(--sky-input-pad-y-sm, 0px);
|
|
807
776
|
}
|
|
808
777
|
|
|
809
|
-
:host([variant=
|
|
810
|
-
:host([variant=
|
|
778
|
+
:host([variant="inside"][compact]) .input-wrapper,
|
|
779
|
+
:host([variant="inside"][compact]) .input-wrapper:has(.chip) {
|
|
811
780
|
min-height: var(--sky-input-height-inside-compact);
|
|
812
781
|
}
|
|
813
782
|
|
|
@@ -944,9 +913,7 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
944
913
|
border-radius: var(--sky-radius-full);
|
|
945
914
|
border: none;
|
|
946
915
|
cursor: pointer;
|
|
947
|
-
transition:
|
|
948
|
-
color 0.2s ease,
|
|
949
|
-
background-color 0.2s ease;
|
|
916
|
+
transition: color 0.2s ease, background-color 0.2s ease;
|
|
950
917
|
}
|
|
951
918
|
.remove-chip-inner:hover {
|
|
952
919
|
color: var(--sky-danger-primary);
|
|
@@ -965,36 +932,7 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
965
932
|
border-radius: var(--sky-radius-full);
|
|
966
933
|
cursor: pointer;
|
|
967
934
|
border: none;
|
|
968
|
-
transition:
|
|
969
|
-
color 0.2s ease,
|
|
970
|
-
background-color 0.2s ease;
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
.input {
|
|
974
|
-
border: none;
|
|
975
|
-
font-family: var(--sky-font);
|
|
976
|
-
outline: none;
|
|
977
|
-
font-size: var(--sky-font-size-md);
|
|
978
|
-
background: transparent;
|
|
979
|
-
box-sizing: border-box;
|
|
980
|
-
color: var(--sky-text-secondary);
|
|
981
|
-
width: 100%;
|
|
982
|
-
transition: all 0.2 ease-in-out;
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
.search-container:has(.input:focus:focus) {
|
|
986
|
-
border-bottom-color: var(--sky-active-primary);
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
.input:-webkit-autofill {
|
|
990
|
-
-webkit-text-fill-color: var(--sky-text-secondary, inherit) !important;
|
|
991
|
-
transition: background-color 9999s ease-in-out 0s !important;
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
.input[disabled] {
|
|
995
|
-
opacity: 70%;
|
|
996
|
-
color: var(--sky-text-primary);
|
|
997
|
-
cursor: disabled;
|
|
935
|
+
transition: color 0.2s ease, background-color 0.2s ease;
|
|
998
936
|
}
|
|
999
937
|
|
|
1000
938
|
.input-wrapper[disabled] {
|
|
@@ -1012,7 +950,9 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
1012
950
|
-webkit-backdrop-filter: var(--sky-blur-tertiary)
|
|
1013
951
|
var(--sky-brightness-tertiary) var(--sky-saturation-tertiary);
|
|
1014
952
|
border-radius: var(--sky-radius-secondary);
|
|
1015
|
-
box-shadow:
|
|
953
|
+
box-shadow:
|
|
954
|
+
var(--sky-box-shadow-inset),
|
|
955
|
+
var(--sky-box-shadow-tertiary);
|
|
1016
956
|
box-sizing: border-box;
|
|
1017
957
|
pointer-events: auto;
|
|
1018
958
|
margin: 0;
|
|
@@ -1122,15 +1062,15 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
1122
1062
|
var(--sky-saturation-tertiary);
|
|
1123
1063
|
-webkit-backdrop-filter: var(--sky-blur-tertiary)
|
|
1124
1064
|
var(--sky-brightness-tertiary) var(--sky-saturation-tertiary);
|
|
1125
|
-
box-shadow:
|
|
1065
|
+
box-shadow:
|
|
1066
|
+
var(--sky-box-shadow-inset),
|
|
1067
|
+
var(--sky-box-shadow-tertiary);
|
|
1126
1068
|
border-radius: var(--sky-radius-secondary);
|
|
1127
1069
|
border: var(--sky-border-tertiary);
|
|
1128
1070
|
width: max-content;
|
|
1129
1071
|
opacity: 0;
|
|
1130
1072
|
transform: scale(0.98);
|
|
1131
|
-
transition:
|
|
1132
|
-
opacity 0.15s ease,
|
|
1133
|
-
transform 0.15s ease;
|
|
1073
|
+
transition: opacity 0.15s ease, transform 0.15s ease;
|
|
1134
1074
|
margin: 0;
|
|
1135
1075
|
}
|
|
1136
1076
|
|
|
@@ -1381,11 +1321,10 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
1381
1321
|
}
|
|
1382
1322
|
|
|
1383
1323
|
.sky-checkbox::after {
|
|
1384
|
-
content:
|
|
1324
|
+
content: "";
|
|
1385
1325
|
width: 8px;
|
|
1386
1326
|
height: 4px;
|
|
1387
|
-
border: 2px solid
|
|
1388
|
-
var(--sky-on-color-fallback-light, var(--sky-text-white));
|
|
1327
|
+
border: 2px solid var(--sky-on-color-fallback-light, var(--sky-text-white));
|
|
1389
1328
|
border-top: none;
|
|
1390
1329
|
border-right: none;
|
|
1391
1330
|
position: absolute;
|
|
@@ -1406,10 +1345,7 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
1406
1345
|
.sky-checkbox.indeterminate::after {
|
|
1407
1346
|
width: 8px;
|
|
1408
1347
|
height: 2px;
|
|
1409
|
-
background-color: var(
|
|
1410
|
-
--sky-on-color-fallback-light,
|
|
1411
|
-
var(--sky-text-white)
|
|
1412
|
-
);
|
|
1348
|
+
background-color: var(--sky-on-color-fallback-light, var(--sky-text-white));
|
|
1413
1349
|
border: none;
|
|
1414
1350
|
top: 50%;
|
|
1415
1351
|
left: 50%;
|
|
@@ -1428,5 +1364,5 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
|
|
|
1428
1364
|
}
|
|
1429
1365
|
|
|
1430
1366
|
${t(m([{selector:".placeholder-label.active[compact]",fillVar:"--sky-dropdown-color"},{selector:".sky-checkbox:checked::after",fillVar:"--sky-active-primary",property:"border-color"},{selector:".sky-checkbox.indeterminate::after",fillVar:"--sky-active-primary",property:"background-color"}]))}
|
|
1431
|
-
`,
|
|
1367
|
+
`,A.shadowRootOptions={...i.shadowRootOptions,delegatesFocus:!0},O([r()],A.prototype,"value",2),O([r({type:String})],A.prototype,"placeholder",2),O([r({type:String})],A.prototype,"searchPlaceholder",2),O([r({type:String})],A.prototype,"label",2),O([r({type:Array})],A.prototype,"options",1),O([r({type:Number})],A.prototype,"chipSize",2),O([r({type:String})],A.prototype,"color",2),O([r({type:Boolean,reflect:!0})],A.prototype,"clearable",2),O([r({type:Boolean,reflect:!0})],A.prototype,"loading",2),O([r({type:Boolean,reflect:!0})],A.prototype,"compact",2),O([r({type:Boolean,reflect:!0})],A.prototype,"disabled",2),O([r({type:Boolean,reflect:!0})],A.prototype,"searchable",2),O([r({type:Boolean,reflect:!0})],A.prototype,"multiSelect",2),O([r({type:Number,reflect:!0})],A.prototype,"visibleChips",2),O([r({type:Boolean,reflect:!0})],A.prototype,"selectAll",2),O([r({type:Array})],A.prototype,"validations",1),O([r({type:Boolean})],A.prototype,"showErrors",2),O([r({type:String})],A.prototype,"errorDisplayMode",2),O([r({type:Boolean,reflect:!0})],A.prototype,"required",2),O([r({type:Boolean,reflect:!0})],A.prototype,"emitFullObject",2),O([r({type:String})],A.prototype,"emittedKey",2),O([r({type:String})],A.prototype,"displayKey",2),O([r({type:Boolean})],A.prototype,"addOption",2),O([r({type:Boolean})],A.prototype,"validationArrayFormat",2),O([r({type:String})],A.prototype,"prefix",2),O([r({type:String})],A.prototype,"suffix",2),O([r({type:String})],A.prototype,"prefixColor",2),O([r({type:String})],A.prototype,"suffixColor",2),O([r({type:String})],A.prototype,"justify",2),O([r({type:Number})],A.prototype,"zIndex",2),O([r({type:String})],A.prototype,"height",2),O([r({type:String})],A.prototype,"requiredMessage",2),O([r({type:Boolean,reflect:!0})],A.prototype,"readonly",2),O([r({type:Boolean})],A.prototype,"enforceMinOneSelection",2),O([r({type:Boolean})],A.prototype,"openAbove",2),O([r({type:Boolean,reflect:!0})],A.prototype,"validationActive",2),O([r({type:Boolean,reflect:!0})],A.prototype,"invalid",2),O([r({type:String,reflect:!0})],A.prototype,"variant",2),O([r({type:String,reflect:!0,attribute:"multi-display"})],A.prototype,"multiDisplay",2),O([r({type:String,attribute:!1})],A.prototype,"searchQuery",2),O([a()],A.prototype,"filteredOptions",2),O([a()],A.prototype,"focused",2),O([a()],A.prototype,"open",2),O([a()],A.prototype,"selectedItems",2),O([a()],A.prototype,"hiddenChipsOpen",2),O([a()],A.prototype,"activeIndex",2),O([a()],A.prototype,"validationErrors",2),O([a()],A.prototype,"validationStatus",2),O([a()],A.prototype,"hasLeftIcon",2),O([a()],A.prototype,"hasRightIcon",2),O([a()],A.prototype,"optionSlotSet",2),O([n(".input-wrapper")],A.prototype,"inputWrapperEl",2),O([n(".dropdown")],A.prototype,"dropdownEl",2),O([n(".hidden-chips-dropdown")],A.prototype,"hiddenDropdownEl",2),O([n(".search-container sky-input")],A.prototype,"searchInputEl",2),O([n(".overflow-chip")],A.prototype,"overflowChipEl",2),O([n(".combo-box-container")],A.prototype,"comboContainerEl",2),O([l("[data-row-index]")],A.prototype,"rowEls",2),O([h({slot:"icon-left"})],A.prototype,"iconLeftEls",2),O([h({slot:"icon-right"})],A.prototype,"iconRightEls",2),O([r({type:String,reflect:!0})],A.prototype,"preset",2),A=O([d("sky-combobox")],A);export{A as SkyCombobox};
|
|
1432
1368
|
//# sourceMappingURL=sky-combobox.js.map
|