@sky.ui/core 0.0.38 → 0.0.39
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 +2283 -2196
- package/dist/helper/index.js +1 -1
- package/dist/helper/utils/color-resolver.d.ts +9 -1
- package/dist/helper/utils/color-resolver.js +1 -1
- package/dist/helper/utils/color-resolver.js.map +1 -1
- package/dist/helper/utils/contrast-color.d.ts +128 -0
- package/dist/helper/utils/contrast-color.js +2 -0
- package/dist/helper/utils/contrast-color.js.map +1 -0
- package/dist/helper/utils/index.d.ts +1 -0
- package/dist/helper/utils/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/sky-alert/sky-alert.js +13 -11
- package/dist/sky-alert/sky-alert.js.map +1 -1
- package/dist/sky-appbar/sky-appbar.js +6 -5
- package/dist/sky-appbar/sky-appbar.js.map +1 -1
- package/dist/sky-badge/sky-badge.js +13 -9
- package/dist/sky-badge/sky-badge.js.map +1 -1
- package/dist/sky-button/sky-button.js +14 -11
- package/dist/sky-button/sky-button.js.map +1 -1
- package/dist/sky-card/sky-card.js.map +1 -1
- package/dist/sky-checkbox/sky-checkbox.js +13 -11
- package/dist/sky-checkbox/sky-checkbox.js.map +1 -1
- package/dist/sky-chip/sky-chip.js +14 -11
- package/dist/sky-chip/sky-chip.js.map +1 -1
- package/dist/sky-combobox/sky-combobox.d.ts +16 -3
- package/dist/sky-combobox/sky-combobox.js +680 -257
- package/dist/sky-combobox/sky-combobox.js.map +1 -1
- package/dist/sky-dialog/sky-dialog.js.map +1 -1
- package/dist/sky-input/sky-input.d.ts +3 -2
- package/dist/sky-input/sky-input.js +452 -180
- package/dist/sky-input/sky-input.js.map +1 -1
- package/dist/sky-radio/sky-radio.d.ts +2 -0
- package/dist/sky-radio/sky-radio.js +28 -13
- package/dist/sky-radio/sky-radio.js.map +1 -1
- package/dist/sky-sheet/sky-sheet.js.map +1 -1
- package/dist/sky-theme-provider/sky-theme-provider.js +1 -1
- package/dist/sky-theme-provider/sky-theme-provider.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
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`
|
|
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
2
|
<div
|
|
3
3
|
class="hidden-chips-dropdown"
|
|
4
4
|
part="hidden-chips-dropdown"
|
|
@@ -12,7 +12,7 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
12
12
|
z-index: ${this.zIndex};
|
|
13
13
|
"
|
|
14
14
|
>
|
|
15
|
-
${
|
|
15
|
+
${u(this.selectedItems.slice(this.visibleChips),t=>String(this.getOptionValue(t)),t=>s`
|
|
16
16
|
<div class="hidden-chip-inner" part="hidden-chip-inner">
|
|
17
17
|
<span part="hidden-chip-label">
|
|
18
18
|
${this.truncateText(String(this.getOptionLabel(t)),this.chipSize)}
|
|
@@ -26,19 +26,13 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
26
26
|
</div>
|
|
27
27
|
`)}
|
|
28
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(){
|
|
30
|
-
|
|
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`
|
|
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
|
+
${u(t,t=>String(this.getOptionValue(t)),t=>s`
|
|
37
31
|
<span class="chip" ?compact=${this.compact} part="chip">
|
|
38
32
|
<span class="chip-label" part="chip-label"
|
|
39
33
|
>${this.truncateText(String(this.getOptionLabel(t)),this.chipSize)}</span
|
|
40
34
|
>
|
|
41
|
-
${c(this.multiSelect,()=>
|
|
35
|
+
${c(this.multiSelect,()=>s`
|
|
42
36
|
<sky-icon
|
|
43
37
|
class="remove-chip"
|
|
44
38
|
part="remove-chip-icon"
|
|
@@ -49,7 +43,7 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
49
43
|
`)}
|
|
50
44
|
</span>
|
|
51
45
|
`)}
|
|
52
|
-
${c(e>0,()=>
|
|
46
|
+
${c(e>0,()=>s`
|
|
53
47
|
<span
|
|
54
48
|
class="chip overflow-chip"
|
|
55
49
|
part="overflow-chip"
|
|
@@ -60,7 +54,26 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
60
54
|
+ ${e}
|
|
61
55
|
</span>
|
|
62
56
|
`)}
|
|
63
|
-
`}
|
|
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
|
+
<span
|
|
59
|
+
class="value-summary"
|
|
60
|
+
part="value-summary single-select-chip"
|
|
61
|
+
title=${t}
|
|
62
|
+
>${t}</span
|
|
63
|
+
>
|
|
64
|
+
`}const t=this.resolveMultiDisplay();if("text"===t){const t=this.selectedItems.map(t=>String(this.getOptionLabel(t))).join(", ");return s`
|
|
65
|
+
<span class="value-summary" part="value-summary" title=${t}
|
|
66
|
+
>${t}</span
|
|
67
|
+
>
|
|
68
|
+
`}if("count"===t){const t=this.selectedItems.length,e=String(this.getOptionLabel(this.selectedItems[0])),i=1===t?e:`${e} +${t-1}`,o=this.selectedItems.map(t=>String(this.getOptionLabel(t))).join(", ");return s`
|
|
69
|
+
<span class="value-summary" part="value-summary" title=${o}
|
|
70
|
+
>${i}</span
|
|
71
|
+
>
|
|
72
|
+
`}return s`
|
|
73
|
+
<div class="chip-container" part="chip-container" ?compact=${this.compact}>
|
|
74
|
+
${this.renderChips()}
|
|
75
|
+
</div>
|
|
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`
|
|
64
77
|
<div
|
|
65
78
|
class="dropdown"
|
|
66
79
|
part="dropdown"
|
|
@@ -73,7 +86,7 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
73
86
|
min-width: var(--sky-dd-width, 100%);
|
|
74
87
|
"
|
|
75
88
|
>
|
|
76
|
-
${c(this.searchable||this.addOption,()=>
|
|
89
|
+
${c(this.searchable||this.addOption,()=>s`
|
|
77
90
|
<div
|
|
78
91
|
class="search-container"
|
|
79
92
|
data-row-index="0"
|
|
@@ -96,7 +109,7 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
96
109
|
class="input"
|
|
97
110
|
/>
|
|
98
111
|
|
|
99
|
-
${c(this.addOption,()=>
|
|
112
|
+
${c(this.addOption,()=>s`
|
|
100
113
|
<sky-icon
|
|
101
114
|
class="new-option-btn"
|
|
102
115
|
icon="ion:add"
|
|
@@ -110,8 +123,7 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
110
123
|
`)}
|
|
111
124
|
|
|
112
125
|
<div class="dropdown-scroller">
|
|
113
|
-
${c(this.
|
|
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`
|
|
126
|
+
${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`
|
|
115
127
|
<div
|
|
116
128
|
class=${e}
|
|
117
129
|
data-row-index=${t}
|
|
@@ -126,125 +138,196 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
126
138
|
Select All
|
|
127
139
|
</div>
|
|
128
140
|
`})}
|
|
129
|
-
${c(this.filteredOptions.length>0,()=>
|
|
141
|
+
${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}`,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)),h=this.headerRows+o,d=h===this.activeIndex,u=y({"dropdown-item":!0,active:d,selected:l});return s`
|
|
130
142
|
<div
|
|
131
143
|
class=${u}
|
|
132
|
-
data-row-index=${
|
|
144
|
+
data-row-index=${h}
|
|
133
145
|
style="justify-content: ${this.justify};"
|
|
134
146
|
part="option"
|
|
135
147
|
@click=${()=>this.selectOption(t)}
|
|
148
|
+
@pointerenter=${()=>{this.activeIndex=h}}
|
|
136
149
|
?compact=${this.compact}
|
|
137
150
|
>
|
|
138
|
-
${c(this.multiSelect,()=>
|
|
151
|
+
${c(this.multiSelect,()=>s` <sky-checkbox
|
|
139
152
|
.checked=${l}
|
|
140
153
|
readonly
|
|
141
154
|
></sky-checkbox>`)}
|
|
142
|
-
${c(
|
|
155
|
+
${c(n,()=>s`
|
|
143
156
|
<div style="display: flex; gap: 8px;width:100%">
|
|
144
157
|
<slot name=${r}>
|
|
145
158
|
<span
|
|
146
159
|
class="highlighted-text"
|
|
147
160
|
part="highlighted-text"
|
|
148
|
-
>${
|
|
161
|
+
>${p(e)}</span
|
|
149
162
|
>
|
|
150
163
|
</slot>
|
|
151
164
|
</div>
|
|
152
|
-
`,()=>
|
|
165
|
+
`,()=>s`<span
|
|
153
166
|
class="highlighted-text"
|
|
154
167
|
part="highlighted-text"
|
|
155
|
-
>${
|
|
168
|
+
>${p(e)}</span
|
|
156
169
|
>`)}
|
|
157
170
|
</div>
|
|
158
|
-
`}),()=>
|
|
171
|
+
`}),()=>s`<div
|
|
159
172
|
class="dropdown-item"
|
|
160
173
|
part="no-options"
|
|
161
174
|
data-row-index=${this.headerRows}
|
|
162
175
|
>
|
|
163
176
|
No options found
|
|
164
177
|
</div>`)}
|
|
165
|
-
`)}
|
|
166
178
|
</div>
|
|
167
179
|
</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
|
|
180
|
+
`}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`
|
|
169
181
|
<div class="progress-message">
|
|
170
182
|
<ul id=${e} class="error-list" part="error-list">
|
|
171
|
-
${
|
|
183
|
+
${u(t,t=>t,t=>s`<li class="error" part="error-item">${t}</li>`)}
|
|
172
184
|
</ul>
|
|
173
185
|
</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=
|
|
175
|
-
<div
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
186
|
+
`}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,n="inside"===this.variant,a=this.label?r?s`<legend class="label" part="label">${this.label}</legend>`:s`<div class="label" part="label">${this.label}</div>`:null,l=s`
|
|
187
|
+
<div
|
|
188
|
+
class=${t}
|
|
189
|
+
part="icon-slot"
|
|
190
|
+
?filled=${this.hasLeftIcon}
|
|
191
|
+
@click=${t=>this.handleIconClick("left",t)}
|
|
192
|
+
>
|
|
193
|
+
<slot name="icon-left" @slotchange=${this.onIconSlotChange}></slot>
|
|
194
|
+
</div>
|
|
195
|
+
`,h=c(this.selectedItems.length>0,()=>this.renderSelectedValue(),()=>s`<label
|
|
196
|
+
class=${i}
|
|
197
|
+
part="placeholder-label"
|
|
198
|
+
?compact=${this.compact}
|
|
199
|
+
>
|
|
200
|
+
<span style="color:${this.prefixColor}">${this.prefix}</span
|
|
201
|
+
>${this.placeholder}<span style="color:${this.suffixColor}"
|
|
202
|
+
>${this.suffix}</span
|
|
203
|
+
>
|
|
204
|
+
</label>`),d=s`
|
|
205
|
+
<div class="field-trailing" part="field-trailing">
|
|
206
|
+
${c(this.clearable&&!this.enforceMinOneSelection&&(this.value||this.selectedItems.length),()=>s`<sky-icon
|
|
207
|
+
class="clear-button"
|
|
208
|
+
part="clear-button"
|
|
209
|
+
?compact=${this.compact}
|
|
210
|
+
@click=${t=>{t.stopPropagation(),this.handleClear()}}
|
|
211
|
+
?loading=${this.loading}
|
|
212
|
+
icon="ion:close"
|
|
213
|
+
></sky-icon>`)}
|
|
214
|
+
${c(this.loading,()=>s`<div class="loading-indicator right"></div>`,()=>this.hasRightIcon?s`<div
|
|
215
|
+
part="icon-slot"
|
|
216
|
+
class=${e}
|
|
217
|
+
?filled=${!0}
|
|
218
|
+
@click=${t=>this.handleIconClick("right",t)}
|
|
219
|
+
>
|
|
220
|
+
<slot
|
|
221
|
+
name="icon-right"
|
|
222
|
+
@slotchange=${this.onIconSlotChange}
|
|
223
|
+
></slot>
|
|
224
|
+
</div>`:s`<slot
|
|
225
|
+
name="icon-right"
|
|
226
|
+
style="display:none"
|
|
227
|
+
@slotchange=${this.onIconSlotChange}
|
|
228
|
+
></slot>`)}
|
|
229
|
+
<sky-icon
|
|
230
|
+
class="dropdown-button"
|
|
231
|
+
part="dropdown-button"
|
|
182
232
|
?compact=${this.compact}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
?invalid=${this.invalid}
|
|
186
|
-
@click=${t=>{this.disabled||this.readonly||this.toggleDropdown(t)}}
|
|
187
|
-
@keydown=${this.handleKeydown}
|
|
233
|
+
@click=${t=>{t.stopPropagation(),this.disabled||this.readonly||this.toggleDropdown(t)}}
|
|
234
|
+
icon=${this.open?"ion:ios-arrow-up":"ion:chevron-down"}
|
|
188
235
|
>
|
|
189
|
-
|
|
236
|
+
</sky-icon>
|
|
237
|
+
</div>
|
|
238
|
+
`,p=s`
|
|
239
|
+
${l}
|
|
240
|
+
<div class="field-main" part="field-main">${h}</div>
|
|
241
|
+
${this.readonly?o:d}
|
|
242
|
+
`,u=s`
|
|
243
|
+
${l}
|
|
244
|
+
<div class="input-inside-main">
|
|
245
|
+
${a}
|
|
246
|
+
<div class="input-inside-row">
|
|
247
|
+
<div class="field-main" part="field-main">${h}</div>
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
${this.readonly?o:d}
|
|
251
|
+
`,v=n?u:p,m=t=>{this.disabled||this.readonly||this.toggleDropdown(t)},g=this.handleKeydown,f=r?s`
|
|
252
|
+
<fieldset
|
|
253
|
+
class="input-wrapper"
|
|
254
|
+
tabindex="0"
|
|
255
|
+
part="input-wrapper"
|
|
256
|
+
?disabled=${this.disabled}
|
|
257
|
+
?compact=${this.compact}
|
|
258
|
+
?loading=${this.loading}
|
|
259
|
+
?open=${this.open}
|
|
260
|
+
?invalid=${this.invalid}
|
|
261
|
+
@click=${m}
|
|
262
|
+
@keydown=${g}
|
|
263
|
+
>
|
|
264
|
+
${a}
|
|
265
|
+
<div class="input-fieldset-body">${v}</div>
|
|
266
|
+
</fieldset>
|
|
267
|
+
`:s`
|
|
190
268
|
<div
|
|
191
|
-
class
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
269
|
+
class="input-wrapper"
|
|
270
|
+
tabindex="0"
|
|
271
|
+
part="input-wrapper"
|
|
272
|
+
?disabled=${this.disabled}
|
|
273
|
+
?compact=${this.compact}
|
|
274
|
+
?loading=${this.loading}
|
|
275
|
+
?open=${this.open}
|
|
276
|
+
?invalid=${this.invalid}
|
|
277
|
+
@click=${m}
|
|
278
|
+
@keydown=${g}
|
|
195
279
|
>
|
|
196
|
-
|
|
280
|
+
${v}
|
|
197
281
|
</div>
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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>
|
|
282
|
+
`;return s`
|
|
283
|
+
<div class="combo-box-container" part="combo-box-container">
|
|
284
|
+
${r||n?o:a}
|
|
285
|
+
${f}
|
|
239
286
|
${this.renderHiddenChipsDropdown()} ${this.renderDropdown()}
|
|
240
287
|
${this.renderValidationErrors()}
|
|
241
288
|
<slot style="display:none" @slotchange=${this.refreshOptionSlots}></slot>
|
|
242
289
|
</div>
|
|
243
|
-
`}};
|
|
290
|
+
`}};S.dependencies={"sky-icon":b,"sky-checkbox":k},S._SEARCH_DEBOUNCE_MS=150,S._SEARCH_DEBOUNCE_OPTIONS_THRESHOLD=30,S._CLOSE_RESET_MS=250,S.styles=e`
|
|
244
291
|
:host {
|
|
245
292
|
display: block;
|
|
246
293
|
font-family: var(--sky-font);
|
|
247
294
|
width: 100%;
|
|
295
|
+
--sky-input-height: 36px;
|
|
296
|
+
--sky-input-height-compact: 28px;
|
|
297
|
+
--sky-input-border-width: 1px;
|
|
298
|
+
--sky-input-pad-x: var(--sky-space-3, 12px);
|
|
299
|
+
--sky-input-pad-x-sm: var(--sky-space-1, 4px);
|
|
300
|
+
--sky-input-pad-x-xs: 0px;
|
|
301
|
+
--sky-input-pad-y: var(--sky-space-1, 4px);
|
|
302
|
+
--sky-input-pad-y-sm: 0px;
|
|
303
|
+
--sky-input-gap: var(--sky-space-1, 4px);
|
|
304
|
+
--sky-input-icon-width: 2rem;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
:host([compact]) {
|
|
308
|
+
--sky-input-pad-x: var(--sky-space-2, 8px);
|
|
309
|
+
--sky-input-pad-x-sm: var(--sky-space-1, 4px);
|
|
310
|
+
--sky-input-icon-width: 1.75rem;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
:host([compact]) .combo-box-container > .label {
|
|
314
|
+
font-size: var(--sky-font-size-xs);
|
|
315
|
+
margin-bottom: var(--sky-space-1, 4px);
|
|
316
|
+
line-height: 1.2;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
:host([compact]) .placeholder-label,
|
|
320
|
+
:host([compact]) .chip[single-select] {
|
|
321
|
+
font-size: var(--sky-font-size-sm);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
:host([compact]) .icon-slot {
|
|
325
|
+
font-size: var(--sky-font-size-lg);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
:host([compact]) .clear-button,
|
|
329
|
+
:host([compact]) .dropdown-button {
|
|
330
|
+
font-size: var(--sky-font-size-md);
|
|
248
331
|
}
|
|
249
332
|
|
|
250
333
|
:host([disabled]) {
|
|
@@ -256,30 +339,268 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
256
339
|
cursor: default;
|
|
257
340
|
}
|
|
258
341
|
|
|
259
|
-
:host([variant="highlight"])
|
|
260
|
-
|
|
261
|
-
color: var(--sky-dropdown-color);
|
|
262
|
-
}
|
|
342
|
+
:host([variant="highlight"]) .label {
|
|
343
|
+
color: var(--sky-dropdown-color);
|
|
263
344
|
}
|
|
264
345
|
|
|
265
|
-
|
|
346
|
+
/* Fieldset / legend */
|
|
347
|
+
:host([variant="fieldset"]) {
|
|
348
|
+
overflow: visible;
|
|
349
|
+
padding-block-start: 0;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
:host([variant="fieldset"]) .combo-box-container {
|
|
353
|
+
overflow: visible;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
:host([variant="fieldset"]) fieldset.input-wrapper {
|
|
357
|
+
display: block;
|
|
358
|
+
height: auto;
|
|
359
|
+
margin: 0;
|
|
360
|
+
min-inline-size: 0;
|
|
361
|
+
min-width: 0;
|
|
362
|
+
padding: 0;
|
|
363
|
+
overflow: visible;
|
|
364
|
+
background: var(--sky-glass-solid);
|
|
365
|
+
box-shadow: none;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
:host([variant="fieldset"]) fieldset.input-wrapper[compact] {
|
|
369
|
+
height: auto;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
:host([variant="fieldset"]) .input-fieldset-body {
|
|
373
|
+
display: flex;
|
|
374
|
+
width: 100%;
|
|
375
|
+
align-items: center;
|
|
376
|
+
box-sizing: border-box;
|
|
377
|
+
height: calc(
|
|
378
|
+
var(--sky-input-height) - 2 * var(--sky-input-border-width)
|
|
379
|
+
);
|
|
380
|
+
min-height: calc(
|
|
381
|
+
var(--sky-input-height) - 2 * var(--sky-input-border-width)
|
|
382
|
+
);
|
|
383
|
+
background: transparent;
|
|
384
|
+
border-radius: inherit;
|
|
385
|
+
flex-wrap: nowrap;
|
|
386
|
+
min-width: 0;
|
|
387
|
+
overflow: hidden;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
:host([variant="fieldset"]) fieldset.input-wrapper[compact] .input-fieldset-body {
|
|
391
|
+
height: calc(
|
|
392
|
+
var(--sky-input-height-compact) - 2 * var(--sky-input-border-width)
|
|
393
|
+
);
|
|
394
|
+
min-height: calc(
|
|
395
|
+
var(--sky-input-height-compact) - 2 * var(--sky-input-border-width)
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/* Multi chips stay single-line; do not grow taller than sky-input */
|
|
400
|
+
:host([variant="fieldset"]) .input-fieldset-body:has(.chip:not([single-select])) {
|
|
401
|
+
height: calc(
|
|
402
|
+
var(--sky-input-height) - 2 * var(--sky-input-border-width)
|
|
403
|
+
);
|
|
404
|
+
min-height: calc(
|
|
405
|
+
var(--sky-input-height) - 2 * var(--sky-input-border-width)
|
|
406
|
+
);
|
|
407
|
+
padding-block: 0;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
:host([variant="fieldset"][compact])
|
|
411
|
+
.input-fieldset-body:has(.chip:not([single-select])) {
|
|
412
|
+
height: calc(
|
|
413
|
+
var(--sky-input-height-compact) - 2 * var(--sky-input-border-width)
|
|
414
|
+
);
|
|
415
|
+
min-height: calc(
|
|
416
|
+
var(--sky-input-height-compact) - 2 * var(--sky-input-border-width)
|
|
417
|
+
);
|
|
418
|
+
padding-block: 0;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
:host([variant="fieldset"]) legend.label {
|
|
422
|
+
float: unset;
|
|
423
|
+
width: auto;
|
|
424
|
+
max-width: calc(100% - 2 * var(--sky-input-pad-x));
|
|
425
|
+
margin-inline-start: var(--sky-input-pad-x);
|
|
426
|
+
margin-bottom: 0;
|
|
427
|
+
padding-inline: var(--sky-input-pad-x-sm);
|
|
428
|
+
padding-block: 2px;
|
|
429
|
+
border: none;
|
|
430
|
+
background: transparent;
|
|
431
|
+
background-color: transparent;
|
|
432
|
+
color: var(--sky-text-secondary);
|
|
433
|
+
font-size: var(--sky-font-size-xs);
|
|
434
|
+
line-height: 1.4;
|
|
435
|
+
overflow: visible;
|
|
436
|
+
text-overflow: ellipsis;
|
|
437
|
+
white-space: nowrap;
|
|
438
|
+
pointer-events: none;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
:host([variant="fieldset"]) .combo-box-container:focus-within legend.label,
|
|
442
|
+
:host([variant="fieldset"]) .input-wrapper[open] legend.label {
|
|
266
443
|
color: var(--sky-dropdown-color);
|
|
267
|
-
font-size: var(--sky-font-size-
|
|
268
|
-
transition: all 0.3s ease;
|
|
444
|
+
font-size: var(--sky-font-size-xs);
|
|
269
445
|
}
|
|
446
|
+
|
|
447
|
+
:host([variant="fieldset"]) .input-wrapper::after {
|
|
448
|
+
content: none;
|
|
449
|
+
display: none;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
:host([variant="fieldset"]) .input-wrapper[open],
|
|
453
|
+
:host([variant="fieldset"]) .input-wrapper:focus-visible {
|
|
454
|
+
border-color: var(--sky-dropdown-color);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
:host([variant="fieldset"][validationActive]:invalid) .input-wrapper {
|
|
458
|
+
border-color: var(--sky-danger-primary);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
:host([variant="fieldset"][validationActive]:invalid) legend.label {
|
|
462
|
+
color: var(--sky-danger-primary);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
:host([variant="fieldset"][compact]) legend.label,
|
|
466
|
+
:host([variant="fieldset"][compact]) .combo-box-container:focus-within legend.label,
|
|
467
|
+
:host([variant="fieldset"][compact]) .input-wrapper[open] legend.label {
|
|
468
|
+
font-size: var(--sky-font-size-xs);
|
|
469
|
+
line-height: 1.4;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/* Inside: label in the wrapper above value row — keep tokens in sync with sky-input */
|
|
473
|
+
:host([variant="inside"]) {
|
|
474
|
+
--sky-input-height-inside: 44px;
|
|
475
|
+
--sky-input-height-inside-compact: 40px;
|
|
476
|
+
--sky-input-inside-label-block: 0.15rem;
|
|
477
|
+
--sky-input-inside-value-min: 1.375rem;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
:host([variant="inside"]) .input-wrapper {
|
|
481
|
+
height: auto;
|
|
482
|
+
min-height: var(--sky-input-height-inside);
|
|
483
|
+
align-items: center;
|
|
484
|
+
padding-block: var(--sky-input-pad-y-sm, 0px);
|
|
485
|
+
overflow: hidden;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
:host([variant="inside"]) .input-wrapper[compact] {
|
|
489
|
+
height: auto;
|
|
490
|
+
min-height: var(--sky-input-height-inside-compact);
|
|
491
|
+
padding-block: var(--sky-input-pad-y-sm, 0px);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
:host([variant="inside"]) .input-inside-main {
|
|
495
|
+
flex: 1 1 0%;
|
|
496
|
+
min-width: 0;
|
|
497
|
+
display: flex;
|
|
498
|
+
flex-direction: column;
|
|
499
|
+
justify-content: center;
|
|
500
|
+
gap: 0.15rem;
|
|
501
|
+
padding-block: var(--sky-input-inside-label-block);
|
|
502
|
+
padding-inline: 0;
|
|
503
|
+
overflow: hidden;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
:host([variant="inside"]) .input-inside-main > .label {
|
|
507
|
+
margin: 0;
|
|
508
|
+
padding-inline: var(--sky-input-pad-x);
|
|
509
|
+
font-size: var(--sky-font-size-xs);
|
|
510
|
+
line-height: 1.3;
|
|
511
|
+
min-height: calc(var(--sky-font-size-xs) * 1.3);
|
|
512
|
+
color: var(--sky-text-secondary);
|
|
513
|
+
pointer-events: none;
|
|
514
|
+
overflow: hidden;
|
|
515
|
+
text-overflow: ellipsis;
|
|
516
|
+
white-space: nowrap;
|
|
517
|
+
flex: 0 0 auto;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
:host([variant="inside"][compact]) .input-inside-main > .label {
|
|
521
|
+
font-size: 0.6875rem;
|
|
522
|
+
line-height: 1.3;
|
|
523
|
+
min-height: calc(0.6875rem * 1.3);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
:host([variant="inside"]) .combo-box-container:focus-within .input-inside-main > .label,
|
|
527
|
+
:host([variant="inside"]) .input-wrapper[open] .input-inside-main > .label {
|
|
528
|
+
color: var(--sky-dropdown-color);
|
|
529
|
+
font-size: var(--sky-font-size-xs);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
:host([variant="inside"][compact]) .combo-box-container:focus-within .input-inside-main > .label,
|
|
533
|
+
:host([variant="inside"][compact]) .input-wrapper[open] .input-inside-main > .label {
|
|
534
|
+
font-size: 0.6875rem;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
:host([variant="inside"][validationActive]:invalid) .input-inside-main > .label {
|
|
538
|
+
color: var(--sky-danger-primary);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
:host([variant="inside"]) .input-inside-row {
|
|
542
|
+
display: flex;
|
|
543
|
+
align-items: center;
|
|
544
|
+
min-width: 0;
|
|
545
|
+
width: 100%;
|
|
546
|
+
min-height: var(--sky-input-inside-value-min);
|
|
547
|
+
gap: 0;
|
|
548
|
+
overflow: hidden;
|
|
549
|
+
flex: 0 0 auto;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/* Match sky-input: label + value share pad-x; zero start when left icon present */
|
|
553
|
+
:host([variant="inside"]) .input-inside-main > .label,
|
|
554
|
+
:host([variant="inside"]) .chip-container,
|
|
555
|
+
:host([variant="inside"]) .value-summary,
|
|
556
|
+
:host([variant="inside"]) .placeholder-label {
|
|
557
|
+
padding-inline-start: var(--sky-input-pad-x);
|
|
558
|
+
padding-inline-end: var(--sky-input-pad-x);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
:host([variant="inside"]) .input-wrapper:has(.icon-slot[filled].left) .input-inside-main > .label,
|
|
562
|
+
:host([variant="inside"]) .input-wrapper:has(.icon-slot[filled].left) .chip-container,
|
|
563
|
+
:host([variant="inside"]) .input-wrapper:has(.icon-slot[filled].left) .value-summary,
|
|
564
|
+
:host([variant="inside"]) .input-wrapper:has(.icon-slot[filled].left) .placeholder-label {
|
|
565
|
+
padding-inline-start: 0;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/* Left icon / trailing chrome centered to label+value column (like sky-input) */
|
|
569
|
+
:host([variant="inside"]) .icon-slot,
|
|
570
|
+
:host([variant="inside"]) .icon-slot[filled] {
|
|
571
|
+
align-self: center;
|
|
572
|
+
height: auto;
|
|
573
|
+
max-height: none;
|
|
574
|
+
align-items: center;
|
|
575
|
+
justify-content: center;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
:host([variant="inside"]) .field-trailing {
|
|
579
|
+
align-self: center;
|
|
580
|
+
padding-inline-start: 0;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/* Outside labels — keep accent while dropdown is open (focus may leave into popover) */
|
|
584
|
+
.combo-box-container:focus-within > .label,
|
|
585
|
+
.combo-box-container:has(.input-wrapper[open]) > .label {
|
|
586
|
+
color: var(--sky-dropdown-color);
|
|
587
|
+
transition: color 0.3s ease;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
:host([compact]) .combo-box-container:focus-within > .label,
|
|
591
|
+
:host([compact]) .combo-box-container:has(.input-wrapper[open]) > .label {
|
|
592
|
+
font-size: var(--sky-font-size-xs);
|
|
593
|
+
}
|
|
594
|
+
|
|
270
595
|
.label {
|
|
271
596
|
font-size: var(--sky-font-size-sm);
|
|
272
|
-
margin-bottom:
|
|
597
|
+
margin-bottom: var(--sky-space-1, 4px);
|
|
273
598
|
text-align: start;
|
|
274
599
|
white-space: nowrap;
|
|
275
600
|
overflow: hidden;
|
|
276
601
|
text-overflow: ellipsis;
|
|
277
602
|
font-family: var(--sky-font);
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
.combo-box-container:focus-within[compact] .label {
|
|
281
|
-
font-size: var(--sky-font-size-xs);
|
|
282
|
-
color: var(--sky-dropdown-color);
|
|
603
|
+
line-height: 1.35;
|
|
283
604
|
}
|
|
284
605
|
|
|
285
606
|
.combo-box-container {
|
|
@@ -366,16 +687,19 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
366
687
|
-webkit-backdrop-filter: none;
|
|
367
688
|
box-sizing: border-box;
|
|
368
689
|
border-radius: var(--sky-radius-secondary);
|
|
369
|
-
height:
|
|
690
|
+
height: var(--sky-input-height);
|
|
691
|
+
min-height: var(--sky-input-height);
|
|
370
692
|
width: 100%;
|
|
371
693
|
flex-wrap: nowrap;
|
|
372
694
|
position: relative;
|
|
695
|
+
overflow: hidden;
|
|
373
696
|
border: var(--sky-border-primary);
|
|
374
697
|
box-shadow: var(--sky-box-shadow-primary);
|
|
375
|
-
transition:
|
|
698
|
+
transition:
|
|
699
|
+
border-color var(--sky-transition-normal, 200ms ease),
|
|
700
|
+
box-shadow var(--sky-transition-normal, 200ms ease);
|
|
376
701
|
flex: 1 1 auto;
|
|
377
702
|
min-width: 0;
|
|
378
|
-
|
|
379
703
|
}
|
|
380
704
|
|
|
381
705
|
.input-wrapper:focus-visible {
|
|
@@ -409,7 +733,8 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
409
733
|
opacity: 1;
|
|
410
734
|
border-bottom-color: var(--sky-danger-primary);
|
|
411
735
|
}
|
|
412
|
-
|
|
736
|
+
|
|
737
|
+
:host([validationActive]:invalid) .label {
|
|
413
738
|
color: var(--sky-danger-primary);
|
|
414
739
|
}
|
|
415
740
|
|
|
@@ -420,14 +745,43 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
420
745
|
.placeholder-label.active[compact] {
|
|
421
746
|
top: 10px;
|
|
422
747
|
background-color: var(--sky-dropdown-color);
|
|
423
|
-
color: white;
|
|
748
|
+
color: var(--sky-on-color-fallback-light, var(--sky-text-white));
|
|
424
749
|
font-size: var(--sky-font-size-xs);
|
|
425
750
|
padding: 0 5px;
|
|
426
751
|
border-radius: 4px;
|
|
427
752
|
}
|
|
428
753
|
|
|
429
754
|
.input-wrapper[compact] {
|
|
430
|
-
height:
|
|
755
|
+
height: var(--sky-input-height-compact);
|
|
756
|
+
min-height: var(--sky-input-height-compact);
|
|
757
|
+
border-radius: var(--sky-radius-primary);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
/* Multi chips stay single-line; do not grow taller than sky-input.
|
|
761
|
+
Exempt inside variant — it needs two rows (label + value). */
|
|
762
|
+
.input-wrapper:has(.chip:not([single-select])) {
|
|
763
|
+
height: var(--sky-input-height);
|
|
764
|
+
min-height: var(--sky-input-height);
|
|
765
|
+
padding-block: 0;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
.input-wrapper[compact]:has(.chip:not([single-select])) {
|
|
769
|
+
height: var(--sky-input-height-compact);
|
|
770
|
+
min-height: var(--sky-input-height-compact);
|
|
771
|
+
padding-block: 0;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
:host([variant="inside"]) .input-wrapper,
|
|
775
|
+
:host([variant="inside"]) .input-wrapper:has(.chip),
|
|
776
|
+
:host([variant="inside"]) .input-wrapper[compact]:has(.chip) {
|
|
777
|
+
height: auto;
|
|
778
|
+
min-height: var(--sky-input-height-inside);
|
|
779
|
+
padding-block: var(--sky-input-pad-y-sm, 0px);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
:host([variant="inside"][compact]) .input-wrapper,
|
|
783
|
+
:host([variant="inside"][compact]) .input-wrapper:has(.chip) {
|
|
784
|
+
min-height: var(--sky-input-height-inside-compact);
|
|
431
785
|
}
|
|
432
786
|
|
|
433
787
|
:host([compact]) .placeholder-label {
|
|
@@ -435,23 +789,71 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
435
789
|
}
|
|
436
790
|
|
|
437
791
|
sky-icon {
|
|
438
|
-
display: inline-
|
|
792
|
+
display: inline-flex;
|
|
793
|
+
align-items: center;
|
|
794
|
+
justify-content: center;
|
|
439
795
|
width: 1em;
|
|
440
796
|
height: 1em;
|
|
797
|
+
flex-shrink: 0;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
/* Value column: takes remaining width; never paints under trailing actions */
|
|
801
|
+
.field-main {
|
|
802
|
+
flex: 1 1 0%;
|
|
803
|
+
min-width: 0;
|
|
804
|
+
max-width: 100%;
|
|
805
|
+
overflow: hidden;
|
|
806
|
+
display: flex;
|
|
807
|
+
align-items: center;
|
|
808
|
+
align-self: stretch;
|
|
809
|
+
position: relative;
|
|
810
|
+
z-index: 0;
|
|
441
811
|
}
|
|
442
812
|
|
|
443
813
|
.chip-container {
|
|
444
|
-
margin-left: 5px;
|
|
445
814
|
display: flex;
|
|
446
|
-
gap:
|
|
447
|
-
flex: 1 1
|
|
815
|
+
gap: var(--sky-input-gap);
|
|
816
|
+
flex: 1 1 0%;
|
|
817
|
+
width: 100%;
|
|
448
818
|
min-width: 0;
|
|
819
|
+
max-width: 100%;
|
|
449
820
|
flex-wrap: nowrap;
|
|
821
|
+
align-items: center;
|
|
822
|
+
overflow: hidden;
|
|
823
|
+
box-sizing: border-box;
|
|
824
|
+
margin: 0;
|
|
825
|
+
padding-inline: var(--sky-input-pad-x) var(--sky-input-pad-x-sm);
|
|
450
826
|
}
|
|
451
827
|
|
|
452
|
-
:
|
|
453
|
-
|
|
454
|
-
|
|
828
|
+
.input-wrapper:has(.icon-slot[filled].left) .chip-container {
|
|
829
|
+
padding-inline-start: var(--sky-input-pad-x-sm);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
.value-summary {
|
|
833
|
+
display: block;
|
|
834
|
+
flex: 1 1 0%;
|
|
835
|
+
width: 100%;
|
|
836
|
+
min-width: 0;
|
|
837
|
+
max-width: 100%;
|
|
838
|
+
box-sizing: border-box;
|
|
839
|
+
margin: 0;
|
|
840
|
+
padding-inline: var(--sky-input-pad-x) var(--sky-input-pad-x-sm);
|
|
841
|
+
overflow: hidden;
|
|
842
|
+
text-overflow: ellipsis;
|
|
843
|
+
white-space: nowrap;
|
|
844
|
+
font-size: var(--sky-font-size-md);
|
|
845
|
+
color: var(--sky-text-primary);
|
|
846
|
+
font-family: var(--sky-font);
|
|
847
|
+
line-height: 1.25;
|
|
848
|
+
text-align: start;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
.input-wrapper:has(.icon-slot[filled].left) .value-summary {
|
|
852
|
+
padding-inline-start: var(--sky-input-pad-x-sm);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
:host([compact]) .value-summary {
|
|
856
|
+
font-size: var(--sky-font-size-sm);
|
|
455
857
|
}
|
|
456
858
|
|
|
457
859
|
.chip-container::-webkit-scrollbar {
|
|
@@ -465,15 +867,22 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
465
867
|
.chip {
|
|
466
868
|
background-color: var(--sky-glass-primary);
|
|
467
869
|
border-radius: var(--sky-radius-primary);
|
|
468
|
-
padding:
|
|
870
|
+
padding: 0 6px;
|
|
871
|
+
height: 1.25rem;
|
|
872
|
+
max-height: calc(var(--sky-input-height) - 10px);
|
|
469
873
|
font-size: var(--sky-font-size-sm);
|
|
470
|
-
|
|
874
|
+
line-height: 1;
|
|
875
|
+
display: inline-flex;
|
|
471
876
|
align-items: center;
|
|
472
|
-
gap:
|
|
473
|
-
flex
|
|
877
|
+
gap: 4px;
|
|
878
|
+
flex: 0 1 auto;
|
|
879
|
+
max-width: 100%;
|
|
474
880
|
min-width: 0;
|
|
475
881
|
border: var(--sky-border-primary);
|
|
476
882
|
font-family: var(--sky-font);
|
|
883
|
+
text-align: start;
|
|
884
|
+
box-sizing: border-box;
|
|
885
|
+
white-space: nowrap;
|
|
477
886
|
}
|
|
478
887
|
|
|
479
888
|
.chip .chip-label {
|
|
@@ -482,33 +891,20 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
482
891
|
overflow: hidden;
|
|
483
892
|
text-overflow: ellipsis;
|
|
484
893
|
white-space: nowrap;
|
|
894
|
+
line-height: 1;
|
|
485
895
|
}
|
|
486
896
|
|
|
487
|
-
.chip
|
|
488
|
-
|
|
489
|
-
box-shadow: none;
|
|
490
|
-
border: none;
|
|
491
|
-
font-size: var(--sky-font-size-md);
|
|
492
|
-
padding: 4px;
|
|
493
|
-
gap: 0;
|
|
494
|
-
overflow: hidden;
|
|
495
|
-
text-overflow: ellipsis;
|
|
897
|
+
.chip.overflow-chip {
|
|
898
|
+
flex: 0 0 auto;
|
|
496
899
|
white-space: nowrap;
|
|
497
|
-
|
|
498
|
-
width:100%;
|
|
900
|
+
max-width: none;
|
|
499
901
|
}
|
|
500
902
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
:host([icon-left]) .chip[single-select] {
|
|
507
|
-
padding:4px 0;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
.chip[single-select] .remove-chip {
|
|
511
|
-
display: none;
|
|
903
|
+
:host([compact]) .chip {
|
|
904
|
+
height: 1.125rem;
|
|
905
|
+
max-height: calc(var(--sky-input-height-compact) - 8px);
|
|
906
|
+
padding: 0 4px;
|
|
907
|
+
font-size: var(--sky-font-size-xs);
|
|
512
908
|
}
|
|
513
909
|
|
|
514
910
|
.chip .remove-chip[compact] {
|
|
@@ -589,11 +985,9 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
589
985
|
var(--sky-box-shadow-inset),
|
|
590
986
|
var(--sky-box-shadow-tertiary);
|
|
591
987
|
box-sizing: border-box;
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
988
|
+
pointer-events: auto;
|
|
989
|
+
margin: 0;
|
|
595
990
|
border: var(--sky-border-tertiary);
|
|
596
|
-
|
|
597
991
|
}
|
|
598
992
|
|
|
599
993
|
.dropdown-scroller {
|
|
@@ -628,17 +1022,6 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
628
1022
|
background-color: transparent;
|
|
629
1023
|
}
|
|
630
1024
|
|
|
631
|
-
.dropdown-item.active {
|
|
632
|
-
background-color: var(--sky-hover-primary);
|
|
633
|
-
}
|
|
634
|
-
.dropdown-item.selected {
|
|
635
|
-
color: var(--sky-dropdown-color, var(--sky-active-primary));
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
.dropdown-item.active.selected {
|
|
639
|
-
background-color: var(--sky-active-g0);
|
|
640
|
-
}
|
|
641
|
-
|
|
642
1025
|
.dropdown-item {
|
|
643
1026
|
display: flex;
|
|
644
1027
|
align-items: center;
|
|
@@ -649,12 +1032,34 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
649
1032
|
text-align: left;
|
|
650
1033
|
font-size: var(--sky-font-size-sm);
|
|
651
1034
|
color: var(--sky-text-primary);
|
|
652
|
-
transition:
|
|
1035
|
+
transition:
|
|
1036
|
+
background-color 0.15s ease,
|
|
1037
|
+
color 0.15s ease;
|
|
653
1038
|
box-sizing: border-box;
|
|
654
1039
|
margin: 2px 0;
|
|
655
1040
|
font-family: var(--sky-font);
|
|
656
1041
|
}
|
|
657
1042
|
|
|
1043
|
+
.dropdown-item:hover {
|
|
1044
|
+
background-color: var(--sky-hover-primary);
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
.dropdown-item.active {
|
|
1048
|
+
background-color: var(--sky-hover-primary);
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
.dropdown-item.selected {
|
|
1052
|
+
color: var(--sky-dropdown-color, var(--sky-active-primary));
|
|
1053
|
+
background-color: var(--sky-active-g0, var(--sky-hover-primary));
|
|
1054
|
+
font-weight: var(--sky-font-weight-medium, 500);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
.dropdown-item.active.selected,
|
|
1058
|
+
.dropdown-item.selected:hover {
|
|
1059
|
+
background-color: var(--sky-active-g0, var(--sky-hover-primary));
|
|
1060
|
+
color: var(--sky-dropdown-color, var(--sky-active-primary));
|
|
1061
|
+
}
|
|
1062
|
+
|
|
658
1063
|
:host([compact]) .dropdown-item {
|
|
659
1064
|
font-size: var(--sky-font-size-sm);
|
|
660
1065
|
padding: 5px 8px;
|
|
@@ -666,47 +1071,44 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
666
1071
|
justify-content: center;
|
|
667
1072
|
font-size: var(--sky-font-size-xl);
|
|
668
1073
|
align-items: center;
|
|
669
|
-
|
|
670
|
-
|
|
1074
|
+
align-self: center;
|
|
1075
|
+
color: var(--sky-text-primary);
|
|
1076
|
+
height: 100%;
|
|
671
1077
|
max-height: 100%;
|
|
672
1078
|
box-sizing: border-box;
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
transition:
|
|
680
|
-
|
|
681
|
-
color 0.3s ease;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
.hidden-chips-dropdown {
|
|
685
|
-
position: fixed; /* important: popover top layer */
|
|
686
|
-
background: var(--sky-glass-tertiary);
|
|
687
|
-
background-image: var(--sky-glass-surface);
|
|
688
|
-
backdrop-filter: var(--sky-blur-tertiary) var(--sky-brightness-tertiary)
|
|
689
|
-
var(--sky-saturation-tertiary);
|
|
690
|
-
-webkit-backdrop-filter: var(--sky-blur-tertiary)
|
|
691
|
-
var(--sky-brightness-tertiary) var(--sky-saturation-tertiary);
|
|
692
|
-
box-shadow:
|
|
693
|
-
var(--sky-box-shadow-inset),
|
|
694
|
-
var(--sky-box-shadow-tertiary);
|
|
695
|
-
border-radius: var(--sky-radius-secondary);
|
|
696
|
-
border: var(--sky-border-tertiary);
|
|
697
|
-
width: max-content;
|
|
698
|
-
|
|
699
|
-
opacity: 0;
|
|
700
|
-
transform: scale(0.98);
|
|
701
|
-
transition: opacity 0.15s ease, transform 0.15s ease;
|
|
702
|
-
margin: 0;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
.hidden-chips-dropdown:popover-open {
|
|
706
|
-
opacity: 1;
|
|
707
|
-
transform: scale(1);
|
|
708
|
-
}
|
|
1079
|
+
flex: 0 0 var(--sky-input-icon-width);
|
|
1080
|
+
width: var(--sky-input-icon-width);
|
|
1081
|
+
min-width: var(--sky-input-icon-width);
|
|
1082
|
+
padding: 0;
|
|
1083
|
+
background: none;
|
|
1084
|
+
border: none;
|
|
1085
|
+
transition: color var(--sky-transition-normal, 200ms ease);
|
|
1086
|
+
}
|
|
709
1087
|
|
|
1088
|
+
.hidden-chips-dropdown {
|
|
1089
|
+
position: fixed; /* important: popover top layer */
|
|
1090
|
+
background: var(--sky-glass-tertiary);
|
|
1091
|
+
background-image: var(--sky-glass-surface);
|
|
1092
|
+
backdrop-filter: var(--sky-blur-tertiary) var(--sky-brightness-tertiary)
|
|
1093
|
+
var(--sky-saturation-tertiary);
|
|
1094
|
+
-webkit-backdrop-filter: var(--sky-blur-tertiary)
|
|
1095
|
+
var(--sky-brightness-tertiary) var(--sky-saturation-tertiary);
|
|
1096
|
+
box-shadow:
|
|
1097
|
+
var(--sky-box-shadow-inset),
|
|
1098
|
+
var(--sky-box-shadow-tertiary);
|
|
1099
|
+
border-radius: var(--sky-radius-secondary);
|
|
1100
|
+
border: var(--sky-border-tertiary);
|
|
1101
|
+
width: max-content;
|
|
1102
|
+
opacity: 0;
|
|
1103
|
+
transform: scale(0.98);
|
|
1104
|
+
transition: opacity 0.15s ease, transform 0.15s ease;
|
|
1105
|
+
margin: 0;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
.hidden-chips-dropdown:popover-open {
|
|
1109
|
+
opacity: 1;
|
|
1110
|
+
transform: scale(1);
|
|
1111
|
+
}
|
|
710
1112
|
|
|
711
1113
|
.hidden-chip-inner {
|
|
712
1114
|
padding: 4px 8px;
|
|
@@ -726,112 +1128,131 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
726
1128
|
|
|
727
1129
|
.icon-slot[filled] {
|
|
728
1130
|
display: flex;
|
|
1131
|
+
flex-shrink: 0;
|
|
729
1132
|
cursor: pointer;
|
|
730
1133
|
}
|
|
731
|
-
.icon-slot.left {
|
|
732
|
-
border-right: var(--sky-border-primary);
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
:dir(rtl) .icon-slot.left {
|
|
736
|
-
border-left: var(--sky-border-primary);
|
|
737
|
-
border-right: unset;
|
|
738
|
-
}
|
|
739
1134
|
|
|
740
|
-
.icon-slot
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
:dir(rtl) .icon-slot.right {
|
|
745
|
-
border-right: var(--sky-border-primary);
|
|
746
|
-
border-left: unset;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
.input-wrapper[open] .icon-slot {
|
|
750
|
-
transform: translate(-5px, -5px);
|
|
751
|
-
border: var(--sky-border-primary) !important;
|
|
1135
|
+
.icon-slot[filled]:hover,
|
|
1136
|
+
.icon-slot[filled]:active,
|
|
1137
|
+
.icon-slot.focused,
|
|
1138
|
+
.input-wrapper[open] .icon-slot[filled] {
|
|
752
1139
|
color: var(--sky-dropdown-color);
|
|
753
|
-
background-color: var(--sky-glass-solid);
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
:dir(rtl) .input-wrapper[open] .icon-slot {
|
|
757
|
-
transform: translate(5px, -5px);
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
.input-wrapper[open] .icon-slot.right {
|
|
761
|
-
transform: translate(5px, -5px);
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
:dir(rtl) .input-wrapper[open] .icon-slot.right {
|
|
765
|
-
transform: translate(-5px, -5px);
|
|
766
1140
|
}
|
|
767
1141
|
|
|
768
1142
|
.placeholder-label {
|
|
769
1143
|
white-space: nowrap;
|
|
770
|
-
|
|
1144
|
+
box-sizing: border-box;
|
|
1145
|
+
padding-inline: var(--sky-input-pad-x);
|
|
771
1146
|
flex: 1 1 0%;
|
|
1147
|
+
width: 100%;
|
|
1148
|
+
min-width: 0;
|
|
772
1149
|
text-align: start;
|
|
773
1150
|
font-size: var(--sky-font-size-md);
|
|
1151
|
+
line-height: 1.25;
|
|
774
1152
|
color: var(--sky-text-tertiary);
|
|
775
|
-
transition:
|
|
1153
|
+
transition: color var(--sky-transition-normal, 200ms ease);
|
|
776
1154
|
pointer-events: none;
|
|
777
1155
|
overflow: hidden;
|
|
778
1156
|
text-overflow: ellipsis;
|
|
779
1157
|
font-family: var(--sky-font);
|
|
1158
|
+
display: flex;
|
|
1159
|
+
align-items: center;
|
|
1160
|
+
align-self: stretch;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
.input-wrapper:has(.icon-slot[filled].left) .placeholder-label {
|
|
1164
|
+
padding-inline-start: var(--sky-input-pad-x-sm);
|
|
780
1165
|
}
|
|
781
1166
|
|
|
782
1167
|
.placeholder-label.active {
|
|
783
1168
|
display: none;
|
|
784
1169
|
}
|
|
785
1170
|
|
|
786
|
-
.
|
|
787
|
-
|
|
1171
|
+
.field-trailing {
|
|
1172
|
+
display: flex;
|
|
1173
|
+
flex: 0 0 auto;
|
|
1174
|
+
flex-shrink: 0;
|
|
1175
|
+
align-items: center;
|
|
1176
|
+
justify-content: flex-end;
|
|
1177
|
+
align-self: stretch;
|
|
1178
|
+
gap: var(--sky-input-pad-x-sm);
|
|
1179
|
+
padding-inline-end: var(--sky-input-pad-x-sm);
|
|
1180
|
+
padding-inline-start: var(--sky-input-pad-x-sm);
|
|
1181
|
+
box-sizing: border-box;
|
|
1182
|
+
position: relative;
|
|
1183
|
+
z-index: 1;
|
|
1184
|
+
/* Opaque rail so value text never shows through behind clear */
|
|
1185
|
+
background: var(--sky-glass-solid);
|
|
1186
|
+
isolation: isolate;
|
|
788
1187
|
}
|
|
789
1188
|
|
|
790
|
-
.clear-button {
|
|
791
|
-
|
|
792
|
-
|
|
1189
|
+
sky-icon.clear-button {
|
|
1190
|
+
box-sizing: border-box;
|
|
1191
|
+
flex: 0 0 auto;
|
|
1192
|
+
width: 1.125rem;
|
|
1193
|
+
height: 1.125rem;
|
|
1194
|
+
min-width: 1.125rem;
|
|
1195
|
+
min-height: 1.125rem;
|
|
1196
|
+
margin: 0;
|
|
1197
|
+
padding: 0;
|
|
793
1198
|
border: none;
|
|
794
|
-
font-size:
|
|
1199
|
+
font-size: 0.75rem;
|
|
1200
|
+
line-height: 1;
|
|
795
1201
|
color: var(--sky-dropdown-color);
|
|
796
1202
|
background-color: var(--sky-hover-primary);
|
|
797
1203
|
border-radius: var(--sky-radius-full);
|
|
798
1204
|
backdrop-filter: none;
|
|
799
1205
|
-webkit-backdrop-filter: none;
|
|
800
1206
|
cursor: pointer;
|
|
801
|
-
transition: color
|
|
1207
|
+
transition: color var(--sky-transition-normal, 200ms ease);
|
|
802
1208
|
}
|
|
803
1209
|
|
|
804
|
-
.clear-button[compact] {
|
|
805
|
-
|
|
1210
|
+
sky-icon.clear-button[compact] {
|
|
1211
|
+
width: 1rem;
|
|
1212
|
+
height: 1rem;
|
|
1213
|
+
min-width: 1rem;
|
|
1214
|
+
min-height: 1rem;
|
|
1215
|
+
font-size: 0.6875rem;
|
|
806
1216
|
}
|
|
807
1217
|
|
|
808
|
-
.clear-button:hover {
|
|
1218
|
+
sky-icon.clear-button:hover {
|
|
809
1219
|
color: var(--sky-danger-primary);
|
|
810
1220
|
}
|
|
811
1221
|
|
|
812
|
-
.dropdown-button {
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
1222
|
+
sky-icon.dropdown-button {
|
|
1223
|
+
box-sizing: border-box;
|
|
1224
|
+
flex: 0 0 auto;
|
|
1225
|
+
width: var(--sky-input-icon-width);
|
|
1226
|
+
height: auto;
|
|
1227
|
+
min-width: calc(var(--sky-input-icon-width) - 0.25rem);
|
|
1228
|
+
margin: 0;
|
|
1229
|
+
padding: 0;
|
|
819
1230
|
border: none;
|
|
820
1231
|
font-size: var(--sky-font-size-sm);
|
|
1232
|
+
color: var(--sky-text-primary);
|
|
1233
|
+
display: inline-flex;
|
|
1234
|
+
align-items: center;
|
|
1235
|
+
justify-content: center;
|
|
821
1236
|
cursor: pointer;
|
|
822
|
-
transition: color
|
|
1237
|
+
transition: color var(--sky-transition-normal, 200ms ease);
|
|
1238
|
+
background: none;
|
|
823
1239
|
}
|
|
824
1240
|
|
|
825
|
-
.dropdown-button
|
|
1241
|
+
sky-icon.dropdown-button:hover,
|
|
1242
|
+
.input-wrapper[open] sky-icon.dropdown-button {
|
|
1243
|
+
color: var(--sky-dropdown-color);
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
sky-icon.dropdown-button[compact] {
|
|
826
1247
|
font-size: var(--sky-font-size-md);
|
|
827
1248
|
}
|
|
828
1249
|
|
|
829
1250
|
.loading-indicator {
|
|
830
1251
|
flex-shrink: 0;
|
|
831
|
-
margin-inline-end: var(--sky-
|
|
1252
|
+
margin-inline-end: var(--sky-input-pad-x-sm);
|
|
832
1253
|
width: 16px;
|
|
833
1254
|
height: 16px;
|
|
834
|
-
border: 2px solid var(--sky-text-
|
|
1255
|
+
border: 2px solid var(--sky-border-light, var(--sky-text-tertiary));
|
|
835
1256
|
border-top: 2px solid var(--sky-dropdown-color, var(--sky-active-primary));
|
|
836
1257
|
border-radius: var(--sky-radius-full);
|
|
837
1258
|
animation: spin 1s linear infinite;
|
|
@@ -872,13 +1293,13 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
872
1293
|
white-space: nowrap;
|
|
873
1294
|
text-overflow: ellipsis;
|
|
874
1295
|
font-size: var(--sky-font-size-sm);
|
|
875
|
-
margin-
|
|
1296
|
+
margin-inline-start: var(--sky-input-pad-x-sm);
|
|
876
1297
|
font-family: var(--sky-font);
|
|
877
1298
|
}
|
|
878
1299
|
|
|
879
1300
|
:dir(rtl) .progress-message {
|
|
880
|
-
margin-
|
|
881
|
-
margin-
|
|
1301
|
+
margin-inline-start: unset;
|
|
1302
|
+
margin-inline-end: var(--sky-input-pad-x-sm);
|
|
882
1303
|
}
|
|
883
1304
|
|
|
884
1305
|
.error-list {
|
|
@@ -934,7 +1355,7 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
934
1355
|
content: "";
|
|
935
1356
|
width: 8px;
|
|
936
1357
|
height: 4px;
|
|
937
|
-
border: 2px solid var(--sky-text-white);
|
|
1358
|
+
border: 2px solid var(--sky-on-color-fallback-light, var(--sky-text-white));
|
|
938
1359
|
border-top: none;
|
|
939
1360
|
border-right: none;
|
|
940
1361
|
position: absolute;
|
|
@@ -955,7 +1376,7 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
955
1376
|
.sky-checkbox.indeterminate::after {
|
|
956
1377
|
width: 8px;
|
|
957
1378
|
height: 2px;
|
|
958
|
-
background-color: var(--sky-text-white);
|
|
1379
|
+
background-color: var(--sky-on-color-fallback-light, var(--sky-text-white));
|
|
959
1380
|
border: none;
|
|
960
1381
|
top: 50%;
|
|
961
1382
|
left: 50%;
|
|
@@ -972,5 +1393,7 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
972
1393
|
opacity: 0.6;
|
|
973
1394
|
cursor: not-allowed;
|
|
974
1395
|
}
|
|
975
|
-
|
|
1396
|
+
|
|
1397
|
+
${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"}]))}
|
|
1398
|
+
`,S.shadowRootOptions={...i.shadowRootOptions,delegatesFocus:!0},I([r()],S.prototype,"value",2),I([r({type:String})],S.prototype,"placeholder",2),I([r({type:String})],S.prototype,"searchPlaceholder",2),I([r({type:String})],S.prototype,"label",2),I([r({type:Array})],S.prototype,"options",1),I([r({type:Number})],S.prototype,"chipSize",2),I([r({type:String})],S.prototype,"color",2),I([r({type:Boolean,reflect:!0})],S.prototype,"clearable",2),I([r({type:Boolean,reflect:!0})],S.prototype,"loading",2),I([r({type:Boolean,reflect:!0})],S.prototype,"compact",2),I([r({type:Boolean,reflect:!0})],S.prototype,"disabled",2),I([r({type:Boolean,reflect:!0})],S.prototype,"searchable",2),I([r({type:Boolean,reflect:!0})],S.prototype,"multiSelect",2),I([r({type:Number,reflect:!0})],S.prototype,"visibleChips",2),I([r({type:Boolean,reflect:!0})],S.prototype,"selectAll",2),I([r({type:Array})],S.prototype,"validations",1),I([r({type:Boolean})],S.prototype,"showErrors",2),I([r({type:String})],S.prototype,"errorDisplayMode",2),I([r({type:Boolean,reflect:!0})],S.prototype,"required",2),I([r({type:Boolean,reflect:!0})],S.prototype,"emitFullObject",2),I([r({type:String})],S.prototype,"emittedKey",2),I([r({type:String})],S.prototype,"displayKey",2),I([r({type:Boolean})],S.prototype,"addOption",2),I([r({type:Boolean})],S.prototype,"validationArrayFormat",2),I([r({type:String})],S.prototype,"prefix",2),I([r({type:String})],S.prototype,"suffix",2),I([r({type:String})],S.prototype,"prefixColor",2),I([r({type:String})],S.prototype,"suffixColor",2),I([r({type:String})],S.prototype,"justify",2),I([r({type:Number})],S.prototype,"zIndex",2),I([r({type:String})],S.prototype,"height",2),I([r({type:String})],S.prototype,"requiredMessage",2),I([r({type:Boolean,reflect:!0})],S.prototype,"readonly",2),I([r({type:Boolean})],S.prototype,"enforceMinOneSelection",2),I([r({type:Boolean})],S.prototype,"openAbove",2),I([r({type:Boolean,reflect:!0})],S.prototype,"validationActive",2),I([r({type:Boolean,reflect:!0})],S.prototype,"invalid",2),I([r({type:String,reflect:!0})],S.prototype,"variant",2),I([r({type:String,reflect:!0,attribute:"multi-display"})],S.prototype,"multiDisplay",2),I([r({type:String,attribute:!1})],S.prototype,"searchQuery",2),I([n()],S.prototype,"filteredOptions",2),I([n()],S.prototype,"focused",2),I([n()],S.prototype,"open",2),I([n()],S.prototype,"selectedItems",2),I([n()],S.prototype,"hiddenChipsOpen",2),I([n()],S.prototype,"activeIndex",2),I([n()],S.prototype,"validationErrors",2),I([n()],S.prototype,"validationStatus",2),I([n()],S.prototype,"hasLeftIcon",2),I([n()],S.prototype,"hasRightIcon",2),I([n()],S.prototype,"optionSlotSet",2),I([a(".input-wrapper")],S.prototype,"inputWrapperEl",2),I([a(".dropdown")],S.prototype,"dropdownEl",2),I([a(".hidden-chips-dropdown")],S.prototype,"hiddenDropdownEl",2),I([a(".search-container .input")],S.prototype,"searchInputEl",2),I([a(".overflow-chip")],S.prototype,"overflowChipEl",2),I([a(".combo-box-container")],S.prototype,"comboContainerEl",2),I([l("[data-row-index]")],S.prototype,"rowEls",2),I([h({slot:"icon-left"})],S.prototype,"iconLeftEls",2),I([h({slot:"icon-right"})],S.prototype,"iconRightEls",2),S=I([d("sky-combobox")],S);export{S as SkyCombobox};
|
|
976
1399
|
//# sourceMappingURL=sky-combobox.js.map
|