@sky.ui/core 0.0.38 → 0.0.40
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 +2399 -2312
- package/dist/helper/controllers/animation-controller.d.ts +4 -4
- package/dist/helper/controllers/animation-controller.js.map +1 -1
- package/dist/helper/controllers/popover-controller.d.ts +11 -11
- package/dist/helper/controllers/popover-controller.js.map +1 -1
- package/dist/helper/iconify-offline.js.map +1 -1
- package/dist/helper/index.js +1 -1
- package/dist/helper/internals/form-control-base.d.ts +4 -4
- package/dist/helper/internals/form-control-base.js.map +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/helper/utils/size-resolver.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/sky-alert/sky-alert.d.ts +5 -5
- package/dist/sky-alert/sky-alert.js +28 -16
- package/dist/sky-alert/sky-alert.js.map +1 -1
- package/dist/sky-appbar/sky-appbar.d.ts +2 -2
- package/dist/sky-appbar/sky-appbar.js +20 -27
- package/dist/sky-appbar/sky-appbar.js.map +1 -1
- package/dist/sky-avatar/sky-avatar.d.ts +3 -3
- package/dist/sky-avatar/sky-avatar.js +8 -11
- package/dist/sky-avatar/sky-avatar.js.map +1 -1
- package/dist/sky-badge/sky-badge.d.ts +5 -5
- package/dist/sky-badge/sky-badge.js +22 -14
- package/dist/sky-badge/sky-badge.js.map +1 -1
- package/dist/sky-button/sky-button.d.ts +5 -5
- package/dist/sky-button/sky-button.js +38 -26
- package/dist/sky-button/sky-button.js.map +1 -1
- package/dist/sky-card/sky-card.d.ts +5 -5
- package/dist/sky-card/sky-card.js +20 -20
- package/dist/sky-card/sky-card.js.map +1 -1
- package/dist/sky-checkbox/sky-checkbox.d.ts +2 -2
- package/dist/sky-checkbox/sky-checkbox.js +78 -68
- package/dist/sky-checkbox/sky-checkbox.js.map +1 -1
- package/dist/sky-chip/sky-chip.d.ts +3 -3
- package/dist/sky-chip/sky-chip.js +48 -36
- package/dist/sky-chip/sky-chip.js.map +1 -1
- package/dist/sky-col/sky-col.d.ts +4 -4
- package/dist/sky-col/sky-col.js +8 -3
- package/dist/sky-col/sky-col.js.map +1 -1
- package/dist/sky-combobox/sky-combobox.d.ts +22 -9
- package/dist/sky-combobox/sky-combobox.js +792 -336
- package/dist/sky-combobox/sky-combobox.js.map +1 -1
- package/dist/sky-dialog/sky-dialog.d.ts +4 -4
- package/dist/sky-dialog/sky-dialog.js +17 -19
- package/dist/sky-dialog/sky-dialog.js.map +1 -1
- package/dist/sky-divider/sky-divider.d.ts +3 -3
- package/dist/sky-divider/sky-divider.js.map +1 -1
- package/dist/sky-flexbox/sky-flexbox.d.ts +7 -7
- package/dist/sky-flexbox/sky-flexbox.js +2 -2
- package/dist/sky-flexbox/sky-flexbox.js.map +1 -1
- package/dist/sky-flexcol/sky-flexcol.d.ts +3 -3
- package/dist/sky-flexcol/sky-flexcol.js.map +1 -1
- package/dist/sky-form/sky-form.d.ts +12 -12
- package/dist/sky-form/sky-form.js +12 -12
- package/dist/sky-form/sky-form.js.map +1 -1
- package/dist/sky-grid/sky-grid.d.ts +2 -2
- package/dist/sky-grid/sky-grid.js.map +1 -1
- package/dist/sky-icon/sky-icon.d.ts +1 -1
- package/dist/sky-icon/sky-icon.js +1 -1
- package/dist/sky-icon/sky-icon.js.map +1 -1
- package/dist/sky-image/sky-image.d.ts +5 -5
- package/dist/sky-image/sky-image.js.map +1 -1
- package/dist/sky-image/srcset-utils.js.map +1 -1
- package/dist/sky-input/sky-input.d.ts +8 -7
- package/dist/sky-input/sky-input.js +489 -202
- package/dist/sky-input/sky-input.js.map +1 -1
- package/dist/sky-list/sky-list.d.ts +4 -4
- package/dist/sky-list/sky-list.js +1 -3
- package/dist/sky-list/sky-list.js.map +1 -1
- package/dist/sky-listitem/sky-listitem.d.ts +2 -2
- package/dist/sky-listitem/sky-listitem.js +4 -7
- package/dist/sky-listitem/sky-listitem.js.map +1 -1
- package/dist/sky-radio/sky-radio.d.ts +5 -3
- package/dist/sky-radio/sky-radio.js +33 -15
- package/dist/sky-radio/sky-radio.js.map +1 -1
- package/dist/sky-row/sky-row.d.ts +2 -2
- package/dist/sky-row/sky-row.js.map +1 -1
- package/dist/sky-sheet/sky-sheet.d.ts +6 -6
- package/dist/sky-sheet/sky-sheet.js +21 -21
- package/dist/sky-sheet/sky-sheet.js.map +1 -1
- package/dist/sky-simple-table/sky-simple-table.d.ts +4 -4
- package/dist/sky-simple-table/sky-simple-table.js +4 -1
- package/dist/sky-simple-table/sky-simple-table.js.map +1 -1
- package/dist/sky-theme-provider/sky-theme-provider.d.ts +27 -27
- 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 +2 -2
|
@@ -1,21 +1,43 @@
|
|
|
1
|
-
import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefined as r}from"lit/directives/if-defined.js";import{styleMap as o}from"lit/directives/style-map.js";import{property as a,state as n,query as l,customElement as p}from"lit/decorators.js";import{resolveColor as h}from"../helper/utils/color-resolver.js";import{live as d}from"lit/directives/live.js";import{FormControlBase as c}from"../helper/internals/form-control-base.js";import{SkyIcon as u}from"../sky-icon/sky-icon.js";var y=Object.defineProperty,f=Object.getOwnPropertyDescriptor,v=(t,e,i,s)=>{for(var r,o=s>1?void 0:s?f(e,i):e,a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s?r(e,i,o):r(o))||o);return s&&o&&y(e,i,o),o};let m=class extends c{constructor(){super(...arguments),this.value="",this.placeholder="",this.label="",this.type="text",this.suffix="",this.prefix="",this.prefixColor="",this.suffixColor="",this.color="primary",this._validations=[],this.compact=!1,this.loading=!1,this.showErrors=!1,this.clearable=!1,this.errorDisplayMode="single",this.required=!1,this.step=null,this.min=null,this.max=null,this.autocapitalize="off",this.autocomplete="off",this.spellcheck=!1,this.dir="ltr",this.rows=6,this.resizable="none",this.accept="",this.multiple=!1,this.inputmode=null,this.enterkeyhint=null,this.pattern=null,this.minlength=null,this.maxlength=null,this.list=null,this.size=null,this.cols=null,this.autofocus=!1,this.capture=!1,this.inputRole=null,this.ariaLabel=null,this.ariaLabelledby=null,this.ariaDescribedby=null,this.showNumberButtons=!1,this.showPasswordToggle=!0,this.passwordVisibleIcon="material-symbols:visibility-off",this.passwordHiddenIcon="material-symbols:visibility",this.validationActive=!1,this.invalid=!1,this.variant="default",this.selectedFileName="",this.selectedFiles=[],this.focused=!1,this.validationStatus=[],this.validationErrors=[],this.typingStarted=!1,this.autofillIconSlot="left",this.autofillGuardActive=!1,this.showPassword=!1,this.totalFileSize=0,this.selectedFileCount=0,this.filePreview=null,this._leftIconSlot=null,this._rightIconSlot=null,this._iconClickWired=new WeakSet,this._onLeftIconSlotChange=()=>this._wireIconSlot("left",this._leftIconSlot),this._onRightIconSlotChange=()=>this._wireIconSlot("right",this._rightIconSlot),this.keepInputFocused=t=>{t.preventDefault(),t.stopPropagation(),this.refocusInput()}}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.autofillGuardActive="search"===this.type,this.hasAttribute("tabindex")||(this.tabIndex=this.disabled?-1:0),this.hasUpdated&&this._setupIconSlots()}disconnectedCallback(){this._leftIconSlot?.removeEventListener("slotchange",this._onLeftIconSlotChange),this._rightIconSlot?.removeEventListener("slotchange",this._onRightIconSlotChange),this._leftIconSlot=null,this._rightIconSlot=null,super.disconnectedCallback()}_setupIconSlots(){this._leftIconSlot||(this._leftIconSlot=this.shadowRoot?.querySelector('slot[name="icon-left"]')??null,this._leftIconSlot?.addEventListener("slotchange",this._onLeftIconSlotChange)),this._rightIconSlot||(this._rightIconSlot=this.shadowRoot?.querySelector('slot[name="icon-right"]')??null,this._rightIconSlot?.addEventListener("slotchange",this._onRightIconSlotChange)),this._wireIconSlot("left",this._leftIconSlot),this._wireIconSlot("right",this._rightIconSlot)}_wireIconSlot(t,e){if(e)for(const i of e.assignedElements({flatten:!0}))i instanceof HTMLElement&&(this._iconClickWired.has(i)||(this._iconClickWired.add(i),i.addEventListener("click",()=>this.handleIconClick(t))))}firstUpdated(t){super.firstUpdated(t),this.captureDefaultValue(this.value),this.syncFormValue(),this.syncValidity(),this._setupIconSlots()}willUpdate(t){t.has("validations")&&Array.isArray(this.validations)&&(this.validationStatus=this.validations.map(()=>!1)),t.has("value")&&"file"===this.type&&(null==this.value||""===String(this.value).trim()?(this.selectedFileName="",this.selectedFiles=[],this.totalFileSize=0,this.selectedFileCount=0,this.filePreview=null):this.selectedFileName||(this.selectedFileName=this.value)),t.has("type")&&"search"===this.type&&(this.autofillGuardActive=!0)}updated(t){if(super.updated(t),t.has("color")&&this.color&&this.style.setProperty("--sky-input-color",h(this.color)),t.has("rows")){const t=this.inputWrapperEl;t&&t.style.setProperty("--rows",String(this.rows))}(t.has("value")||t.has("selectedFiles")||t.has("selectedFileName")||t.has("type")||t.has("multiple")||t.has("name")||t.has("disabled"))&&this.syncFormValue(),(t.has("value")||t.has("selectedFiles")||t.has("selectedFileName")||t.has("validationErrors")||t.has("required")||t.has("disabled")||t.has("readonly"))&&this.syncValidity()}getFormValue(){if(!this.name)return null;if("file"===this.type){if(!this.selectedFiles||0===this.selectedFiles.length)return null;if(this.multiple){const t=new FormData;for(const e of this.selectedFiles)t.append(this.name,e);return t}return this.selectedFiles[0]}return this.value??""}setValueFromFormState(t){"string"!=typeof t?(this.value="",this.selectedFileName="",this.selectedFiles=[],this.totalFileSize=0,this.selectedFileCount=0,this.filePreview=null):this.value=t}getValidityAnchor(){return this}isEmpty(){return"file"===this.type?!this.selectedFiles||0===this.selectedFiles.length:!this.value||""===this.value.toString().trim()}getCustomErrorMessage(){return this.validationErrors?.length?"all"===this.errorDisplayMode?this.validationErrors.join("\n"):this.validationErrors[0]:""}getNativeControl(){return"textarea"===this.type?this.shadowRoot?.querySelector("textarea"):this.shadowRoot?.querySelector("input")}onNativeValueMutated(t){"file"!==this.type&&(this.value=t?.value??""),this.validateInput()}reset(){this.value="",this.selectedFileName="",this.filePreview=null,this.selectedFiles=[],this.selectedFileCount=0,this.validationErrors=[],this.typingStarted=!1,this.validationActive=!1,this.selectedFileCount=0,this.totalFileSize=0}get nativeRequiredMessage(){return this.validationActive?this.disabled?"":this.required&&this.isEmpty()?this.requiredMessage||"This field is required.":"":""}getEmittedValue(){if("number"!==this.type)return this.value;if(""===this.value||null==this.value)return"";const t=Number(this.value);return Number.isFinite(t)?t:this.value}handleClear(){this.disabled||this.readonly||(this.reset(),this.validationActive=!0,this.validateInput(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.getEmittedValue()},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-cleared",{detail:{value:this.getEmittedValue()},bubbles:!0,composed:!0})))}handleFileChange(t){if(this.disabled||this.readonly)return;const e=t.target.files;if(e&&e.length){const i=Array.from(e);this.selectedFiles=i,this.selectedFileName=i.map(t=>t.name).join(", "),this.value=this.selectedFileName,this.syncFormValue(),this.syncValidity();const s=i.reduce((t,e)=>t+e.size,0);if(this.totalFileSize=s,this.selectedFileCount=i.length,i[0].type.startsWith("image/")){const t=new FileReader;t.onload=t=>{t.target&&(this.filePreview=t.target.result)},t.readAsDataURL(i[0])}else this.filePreview=null;this.reemitNativeEvent("change",t),this.reemitNativeEvent("input",t),this.dispatchEvent(new CustomEvent("file-selected",{detail:{files:i,fileName:this.selectedFileName,totalSize:s,fileCount:this.selectedFileCount},bubbles:!0,composed:!0})),this.validateInput()}else this.value="",this.filePreview=null,this.totalFileSize=0,this.selectedFileCount=0,this.selectedFiles=[],this.validateInput()}handleKeydown(t){this.disabled||this.readonly||"Enter"===t.key&&"file"===this.type&&(t.preventDefault(),t.stopPropagation(),this.triggerNativeDropdown())}get preview(){return this.filePreview}handleInput(t){t.stopPropagation(),this.disabled||this.readonly?t.preventDefault():(this.value=t.target.value,this.syncFormValue(),this.syncValidity(),this.typingStarted||(this.typingStarted=!0),this.validateInput(),this.reemitNativeEvent("input",t),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.getEmittedValue()},bubbles:!0,composed:!0})))}handleFocus(t){t.stopPropagation(),this.releaseAutofillGuard(),this.focused=!0,this.reemitNativeEvent("focus",t)}releaseAutofillGuard(){this.autofillGuardActive&&(this.autofillGuardActive=!1)}handleAutofillGuardPointerDown(t){this.releaseAutofillGuard(),t.stopPropagation()}onFormReset(){this.setValueFromFormState(this.defaultValue),this.validationActive=!1,this.invalid=!1,this.typingStarted=!1,this.validationErrors=[],this.validationStatus=[],"file"===this.type&&(this.selectedFiles=[],this.selectedFileName="",this.totalFileSize=0,this.selectedFileCount=0,this.filePreview=null),"search"===this.type&&(this.autofillGuardActive=!0)}handleBlur(t){t.stopPropagation(),this.validationActive=!0,this.focused=!1,this.reemitNativeEvent("blur",t)}validateForForm(){const t="file"===this.type?this.selectedFiles??[]:this.value??"";for(const e of this.validations??[]){const i=e(t);if(!0!==i)return"string"==typeof i?i:"Invalid value."}return""}validateInput(){this.validationErrors=[],this.validationStatus=[];const t="file"===this.type,e=t?!this.selectedFiles||0===this.selectedFiles.length:!this.value||""===this.value.toString().trim();if(this.required&&e&&this.syncValidity(),Array.isArray(this.validations)&&this.validations.length){const e=t?this.selectedFiles??[]:this.value??"";this.validationStatus=this.validations.map((t,i)=>{try{if("function"!=typeof t)throw new Error(`Validation at index ${i} must be a function.`);const s=t(e);return!0===s||(this.validationErrors.push("string"==typeof s?s:`Validation ${i} failed.`),!1)}catch(t){const e="object"==typeof t&&null!==t&&"message"in t?String(t.message):"string"==typeof t?t:"Unknown error";return this.validationErrors.push(`Error in validation ${i}: ${e}`),!1}})}this.dispatchEvent(new CustomEvent("validation-error",{detail:{errors:this.validationErrors},bubbles:!0,composed:!0})),this.syncValidity();const i=0===this.validationErrors.length;return this.invalid=!i,i}getErrorMessages(){switch(this.errorDisplayMode){case"single":return this.validationErrors.slice(0,1);case"all":return this.validationErrors;default:return[]}}handleIconClick(t,e=null){this.dispatchEvent(new CustomEvent(`${t}-icon-click`,{detail:{position:t,eventType:e?e.type:null,eventData:e},bubbles:!0,composed:!0}))}formatFileSize(t){if(0===t)return"0 Bytes";const e=Math.floor(Math.log(t)/Math.log(1024));return`${parseFloat((t/Math.pow(1024,e)).toFixed(2))} ${["Bytes","KB","MB","GB","TB"][e]}`}incrementValue(){if(this.disabled||this.readonly)return;const t=parseFloat(this.value)||0,e=parseFloat(this.step??"")||1;t+e<=(this.max?parseFloat(this.max):1/0)&&(this.value=(t+e).toString(),this.validateInput(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.getEmittedValue()}}))),this.refocusInput()}decrementValue(){if(this.disabled||this.readonly)return;const t=parseFloat(this.value)||0,e=parseFloat(this.step??"")||1;t-e>=(this.min?parseFloat(this.min):-1/0)&&(this.value=(t-e).toString(),this.validateInput(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.getEmittedValue()}}))),this.refocusInput()}renderValidationErrors(){if(!this.showErrors||!this.validationActive)return null;const t=this.nativeRequiredMessage,e=this.getErrorMessages();let s=[];if("single"===this.errorDisplayMode?t?s=[t]:e.length&&(s=[e[0]]):s=t?[t,...e]:e,!s.length)return null;const r=`${this.id||"sky-input"}-errors`;return i`
|
|
1
|
+
import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefined as a}from"lit/directives/if-defined.js";import{styleMap as r}from"lit/directives/style-map.js";import{property as n,state as o,query as l,customElement as p}from"lit/decorators.js";import{resolveColor as d}from"../helper/utils/color-resolver.js";import{live as h}from"lit/directives/live.js";import{FormControlBase as c}from"../helper/internals/form-control-base.js";import{SkyIcon as u}from"../sky-icon/sky-icon.js";var y=Object.defineProperty,v=Object.getOwnPropertyDescriptor,f=(t,e,i,s)=>{for(var a,r=s>1?void 0:s?v(e,i):e,n=t.length-1;n>=0;n--)(a=t[n])&&(r=(s?a(e,i,r):a(r))||r);return s&&r&&y(e,i,r),r};let m=class extends c{constructor(){super(...arguments),this.value="",this.placeholder="",this.label="",this.type="text",this.suffix="",this.prefix="",this.prefixColor="",this.suffixColor="",this.color="primary",this._validations=[],this.compact=!1,this.loading=!1,this.showErrors=!1,this.clearable=!1,this.errorDisplayMode="single",this.required=!1,this.step=null,this.min=null,this.max=null,this.autocapitalize="off",this.autocomplete="off",this.spellcheck=!1,this.dir="ltr",this.rows=6,this.resizable="none",this.accept="",this.multiple=!1,this.inputmode=null,this.enterkeyhint=null,this.pattern=null,this.minlength=null,this.maxlength=null,this.list=null,this.size=null,this.cols=null,this.autofocus=!1,this.capture=!1,this.inputRole=null,this.ariaLabel=null,this.ariaLabelledby=null,this.ariaDescribedby=null,this.showNumberButtons=!1,this.showPasswordToggle=!0,this.passwordVisibleIcon="material-symbols:visibility-off",this.passwordHiddenIcon="material-symbols:visibility",this.validationActive=!1,this.invalid=!1,this.variant="default",this.selectedFileName="",this.selectedFiles=[],this.focused=!1,this.validationStatus=[],this.validationErrors=[],this.typingStarted=!1,this.autofillIconSlot="left",this.autofillGuardActive=!1,this.showPassword=!1,this.totalFileSize=0,this.selectedFileCount=0,this.filePreview=null,this._leftIconSlot=null,this._rightIconSlot=null,this._iconClickWired=new WeakSet,this._onLeftIconSlotChange=()=>this._wireIconSlot("left",this._leftIconSlot),this._onRightIconSlotChange=()=>this._wireIconSlot("right",this._rightIconSlot),this.keepInputFocused=t=>{t.preventDefault(),t.stopPropagation(),this.refocusInput()}}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.autofillGuardActive="search"===this.type,this.hasAttribute("tabindex")||(this.tabIndex=this.disabled?-1:0),this.hasUpdated&&this._setupIconSlots()}disconnectedCallback(){this._leftIconSlot?.removeEventListener("slotchange",this._onLeftIconSlotChange),this._rightIconSlot?.removeEventListener("slotchange",this._onRightIconSlotChange),this._leftIconSlot=null,this._rightIconSlot=null,super.disconnectedCallback()}_setupIconSlots(){this._leftIconSlot||(this._leftIconSlot=this.shadowRoot?.querySelector('slot[name="icon-left"]')??null,this._leftIconSlot?.addEventListener("slotchange",this._onLeftIconSlotChange)),this._rightIconSlot||(this._rightIconSlot=this.shadowRoot?.querySelector('slot[name="icon-right"]')??null,this._rightIconSlot?.addEventListener("slotchange",this._onRightIconSlotChange)),this._wireIconSlot("left",this._leftIconSlot),this._wireIconSlot("right",this._rightIconSlot)}_wireIconSlot(t,e){if(e)for(const i of e.assignedElements({flatten:!0}))i instanceof HTMLElement&&(this._iconClickWired.has(i)||(this._iconClickWired.add(i),i.addEventListener("click",()=>this.handleIconClick(t))))}firstUpdated(t){super.firstUpdated(t),this.captureDefaultValue(this.value),this.syncFormValue(),this.syncValidity(),this._setupIconSlots()}willUpdate(t){t.has("validations")&&Array.isArray(this.validations)&&(this.validationStatus=this.validations.map(()=>!1)),t.has("value")&&"file"===this.type&&(null==this.value||""===String(this.value).trim()?(this.selectedFileName="",this.selectedFiles=[],this.totalFileSize=0,this.selectedFileCount=0,this.filePreview=null):this.selectedFileName||(this.selectedFileName=this.value)),t.has("type")&&"search"===this.type&&(this.autofillGuardActive=!0)}updated(t){if(super.updated(t),t.has("color")&&this.color&&this.style.setProperty("--sky-input-color",d(this.color)),t.has("rows")){const t=this.inputWrapperEl;t&&t.style.setProperty("--rows",String(this.rows))}(t.has("value")||t.has("selectedFiles")||t.has("selectedFileName")||t.has("type")||t.has("multiple")||t.has("name")||t.has("disabled"))&&this.syncFormValue(),(t.has("value")||t.has("selectedFiles")||t.has("selectedFileName")||t.has("validationErrors")||t.has("required")||t.has("disabled")||t.has("readonly"))&&this.syncValidity()}getFormValue(){if(!this.name)return null;if("file"===this.type){if(!this.selectedFiles||0===this.selectedFiles.length)return null;if(this.multiple){const t=new FormData;for(const e of this.selectedFiles)t.append(this.name,e);return t}return this.selectedFiles[0]}return this.value??""}setValueFromFormState(t){"string"!=typeof t?(this.value="",this.selectedFileName="",this.selectedFiles=[],this.totalFileSize=0,this.selectedFileCount=0,this.filePreview=null):this.value=t}getValidityAnchor(){return this}isEmpty(){return"file"===this.type?!this.selectedFiles||0===this.selectedFiles.length:!this.value||""===this.value.toString().trim()}getCustomErrorMessage(){return this.validationErrors?.length?"all"===this.errorDisplayMode?this.validationErrors.join("\n"):this.validationErrors[0]:""}getNativeControl(){return"textarea"===this.type?this.shadowRoot?.querySelector("textarea"):this.shadowRoot?.querySelector("input")}onNativeValueMutated(t){"file"!==this.type&&(this.value=t?.value??""),this.validateInput()}reset(){this.value="",this.selectedFileName="",this.filePreview=null,this.selectedFiles=[],this.selectedFileCount=0,this.validationErrors=[],this.typingStarted=!1,this.validationActive=!1,this.selectedFileCount=0,this.totalFileSize=0}get nativeRequiredMessage(){return this.validationActive?this.disabled?"":this.required&&this.isEmpty()?this.requiredMessage||"This field is required.":"":""}getEmittedValue(){if("number"!==this.type)return this.value;if(""===this.value||null==this.value)return"";const t=Number(this.value);return Number.isFinite(t)?t:this.value}handleClear(){this.disabled||this.readonly||(this.reset(),this.validationActive=!0,this.validateInput(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.getEmittedValue()},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-cleared",{detail:{value:this.getEmittedValue()},bubbles:!0,composed:!0})))}handleFileChange(t){if(this.disabled||this.readonly)return;const e=t.target.files;if(e&&e.length){const i=Array.from(e);this.selectedFiles=i,this.selectedFileName=i.map(t=>t.name).join(", "),this.value=this.selectedFileName,this.syncFormValue(),this.syncValidity();const s=i.reduce((t,e)=>t+e.size,0);if(this.totalFileSize=s,this.selectedFileCount=i.length,i[0].type.startsWith("image/")){const t=new FileReader;t.onload=t=>{t.target&&(this.filePreview=t.target.result)},t.readAsDataURL(i[0])}else this.filePreview=null;this.reemitNativeEvent("change",t),this.reemitNativeEvent("input",t),this.dispatchEvent(new CustomEvent("file-selected",{detail:{files:i,fileName:this.selectedFileName,totalSize:s,fileCount:this.selectedFileCount},bubbles:!0,composed:!0})),this.validateInput()}else this.value="",this.filePreview=null,this.totalFileSize=0,this.selectedFileCount=0,this.selectedFiles=[],this.validateInput()}handleKeydown(t){this.disabled||this.readonly||"Enter"===t.key&&"file"===this.type&&(t.preventDefault(),t.stopPropagation(),this.triggerNativeDropdown())}get preview(){return this.filePreview}handleInput(t){t.stopPropagation(),this.disabled||this.readonly?t.preventDefault():(this.value=t.target.value,this.syncFormValue(),this.syncValidity(),this.typingStarted||(this.typingStarted=!0),this.validateInput(),this.reemitNativeEvent("input",t),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.getEmittedValue()},bubbles:!0,composed:!0})))}handleFocus(t){t.stopPropagation(),this.releaseAutofillGuard(),this.focused=!0,this.reemitNativeEvent("focus",t)}releaseAutofillGuard(){this.autofillGuardActive&&(this.autofillGuardActive=!1)}handleAutofillGuardPointerDown(t){this.releaseAutofillGuard(),t.stopPropagation()}onFormReset(){this.setValueFromFormState(this.defaultValue),this.validationActive=!1,this.invalid=!1,this.typingStarted=!1,this.validationErrors=[],this.validationStatus=[],"file"===this.type&&(this.selectedFiles=[],this.selectedFileName="",this.totalFileSize=0,this.selectedFileCount=0,this.filePreview=null),"search"===this.type&&(this.autofillGuardActive=!0)}handleBlur(t){t.stopPropagation(),this.validationActive=!0,this.focused=!1,this.reemitNativeEvent("blur",t)}validateForForm(){const t="file"===this.type?this.selectedFiles??[]:this.value??"";for(const e of this.validations??[]){const i=e(t);if(!0!==i)return"string"==typeof i?i:"Invalid value."}return""}validateInput(){this.validationErrors=[],this.validationStatus=[];const t="file"===this.type,e=t?!this.selectedFiles||0===this.selectedFiles.length:!this.value||""===this.value.toString().trim();if(this.required&&e&&this.syncValidity(),Array.isArray(this.validations)&&this.validations.length){const e=t?this.selectedFiles??[]:this.value??"";this.validationStatus=this.validations.map((t,i)=>{try{if("function"!=typeof t)throw new Error(`Validation at index ${i} must be a function.`);const s=t(e);return!0===s||(this.validationErrors.push("string"==typeof s?s:`Validation ${i} failed.`),!1)}catch(t){const e="object"==typeof t&&null!==t&&"message"in t?String(t.message):"string"==typeof t?t:"Unknown error";return this.validationErrors.push(`Error in validation ${i}: ${e}`),!1}})}this.dispatchEvent(new CustomEvent("validation-error",{detail:{errors:this.validationErrors},bubbles:!0,composed:!0})),this.syncValidity();const i=0===this.validationErrors.length;return this.invalid=!i,i}getErrorMessages(){switch(this.errorDisplayMode){case"single":return this.validationErrors.slice(0,1);case"all":return this.validationErrors;default:return[]}}handleIconClick(t,e=null){this.dispatchEvent(new CustomEvent(`${t}-icon-click`,{detail:{position:t,eventType:e?e.type:null,eventData:e},bubbles:!0,composed:!0}))}formatFileSize(t){if(0===t)return"0 Bytes";const e=Math.floor(Math.log(t)/Math.log(1024));return`${parseFloat((t/Math.pow(1024,e)).toFixed(2))} ${["Bytes","KB","MB","GB","TB"][e]}`}incrementValue(){if(this.disabled||this.readonly)return;const t=parseFloat(this.value)||0,e=parseFloat(this.step??"")||1;t+e<=(this.max?parseFloat(this.max):1/0)&&(this.value=(t+e).toString(),this.validateInput(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.getEmittedValue()}}))),this.refocusInput()}decrementValue(){if(this.disabled||this.readonly)return;const t=parseFloat(this.value)||0,e=parseFloat(this.step??"")||1;t-e>=(this.min?parseFloat(this.min):-1/0)&&(this.value=(t-e).toString(),this.validateInput(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.getEmittedValue()}}))),this.refocusInput()}renderValidationErrors(){if(!this.showErrors||!this.validationActive)return null;const t=this.nativeRequiredMessage,e=this.getErrorMessages();let s=[];if("single"===this.errorDisplayMode?t?s=[t]:e.length&&(s=[e[0]]):s=t?[t,...e]:e,!s.length)return null;const a=`${this.id||"sky-input"}-errors`;return i`
|
|
2
2
|
<div class="progress-message">
|
|
3
|
-
<ul id=${
|
|
3
|
+
<ul id=${a} class="error-list" part="error-list">
|
|
4
4
|
${s.map(t=>i`<li class="error" part="error">${t}</li>`)}
|
|
5
5
|
</ul>
|
|
6
6
|
</div>
|
|
7
|
-
`}togglePasswordVisibility(){this.showPassword=!this.showPassword}focusInput(){const t=this.nativeInputEl;t&&"function"==typeof t.focus&&t.focus()}handleWrapperClick(t){if(t.stopPropagation(),this.disabled)return;const e=this.nativeInputEl;e&&"function"==typeof e.focus&&e.focus()}get isInvalid(){return this.matches(":invalid")||this.validationActive&&this.validationErrors.length>0}get describedById(){return this.ariaDescribedby??(this.showErrors?`${this.id||"sky-input"}-errors`:void 0)}refocusInput(){const t=this.shadowRoot?.querySelector("input");t?.focus({preventScroll:!0})}triggerNativeDropdown(){if(this.disabled||this.readonly)return;const t=this.shadowRoot?.querySelector('input[type="date"], input[type="time"], input[type="week"], input[type="month"], input[type="datetime-local"], input[type="file"]');t&&("file"===this.type?t.click():this.showPicker())}isFilterSearchInput(){return"search"===this.type}nativeAutocomplete(){return this.isFilterSearchInput()?"off":this.autocomplete}nativeTextInputType(t){return t&&this.showPassword||this.isFilterSearchInput()?"text":this.type}nativeInputMode(){return this.inputmode?this.inputmode:this.isFilterSearchInput()?"search":void 0}nativeEnterKeyHint(){return this.enterkeyhint?this.enterkeyhint:this.isFilterSearchInput()?"search":void 0}nativeInputRole(){return this.inputRole?this.inputRole:"search"===this.type?"searchbox":void 0}affixColorStyle(t){const e=String(t??"").trim();if(e)return{color:
|
|
7
|
+
`}togglePasswordVisibility(){this.showPassword=!this.showPassword}focusInput(){const t=this.nativeInputEl;t&&"function"==typeof t.focus&&t.focus()}handleWrapperClick(t){if(t.stopPropagation(),this.disabled)return;const e=this.nativeInputEl;e&&"function"==typeof e.focus&&e.focus()}get isInvalid(){return this.matches(":invalid")||this.validationActive&&this.validationErrors.length>0}get describedById(){return this.ariaDescribedby??(this.showErrors?`${this.id||"sky-input"}-errors`:void 0)}refocusInput(){const t=this.shadowRoot?.querySelector("input");t?.focus({preventScroll:!0})}triggerNativeDropdown(){if(this.disabled||this.readonly)return;const t=this.shadowRoot?.querySelector('input[type="date"], input[type="time"], input[type="week"], input[type="month"], input[type="datetime-local"], input[type="file"]');t&&("file"===this.type?t.click():this.showPicker())}isFilterSearchInput(){return"search"===this.type}nativeAutocomplete(){return this.isFilterSearchInput()?"off":this.autocomplete}nativeTextInputType(t){return t&&this.showPassword||this.isFilterSearchInput()?"text":this.type}nativeInputMode(){return this.inputmode?this.inputmode:this.isFilterSearchInput()?"search":void 0}nativeEnterKeyHint(){return this.enterkeyhint?this.enterkeyhint:this.isFilterSearchInput()?"search":void 0}nativeInputRole(){return this.inputRole?this.inputRole:"search"===this.type?"searchbox":void 0}affixColorStyle(t){const e=String(t??"").trim();if(e)return{color:d(e)}}renderInputAffix(t){const e="prefix"===t?this.prefix:this.suffix;if(!String(e??"").length)return s;const a="prefix"===t?this.prefixColor:this.suffixColor,n=this.affixColorStyle(a);return i`<span
|
|
8
8
|
class="input-affix ${t}"
|
|
9
9
|
part="input-${t}"
|
|
10
|
-
style=${
|
|
10
|
+
style=${n?r(n):s}
|
|
11
11
|
>${e}</span
|
|
12
|
-
>`}render(){const t="file"===this.type,e="textarea"===this.type,
|
|
12
|
+
>`}render(){const t="file"===this.type,e="textarea"===this.type,r="number"===this.type,n="password"===this.type,o=!t&&!e,l=!!this.querySelector('[slot="icon-left"]'),p=!!this.querySelector('[slot="icon-right"]');let d=null;"date"===this.type?d=i`<sky-icon icon="ion:calendar"></sky-icon>`:"time"===this.type?d=i`<sky-icon icon="ion:time"></sky-icon>`:"week"===this.type||"month"===this.type?d=i`<sky-icon icon="ion:calendar"></sky-icon>`:"datetime-local"===this.type&&(d=i`<sky-icon icon="ion:time"></sky-icon>`);const c=this.filePreview&&(l||p),u="left"===this.autofillIconSlot&&d,y="right"===this.autofillIconSlot&&d,v=()=>i`
|
|
13
13
|
<img
|
|
14
|
-
src=${
|
|
14
|
+
src=${a("string"==typeof this.filePreview?this.filePreview:void 0)}
|
|
15
15
|
alt="Preview"
|
|
16
16
|
style="width:100%;height:100%;object-fit:cover;border-radius:12px;"
|
|
17
17
|
/>
|
|
18
|
-
`,
|
|
18
|
+
`,f=()=>i`
|
|
19
|
+
<div
|
|
20
|
+
class="icon-slot left ${this.focused?"focused":""}"
|
|
21
|
+
part="icon-slot icon-slot-left"
|
|
22
|
+
?filled=${Boolean(c&&l)||Boolean(u)||l}
|
|
23
|
+
@click=${()=>{(t||u)&&this.triggerNativeDropdown()}}
|
|
24
|
+
>
|
|
25
|
+
${c&&l?v():u?d:i`<slot name="icon-left"></slot>`}
|
|
26
|
+
</div>
|
|
27
|
+
`,m=()=>this.loading?i`<div
|
|
28
|
+
class="loading-indicator"
|
|
29
|
+
part="loading-indicator"
|
|
30
|
+
?compact=${this.compact}
|
|
31
|
+
></div>`:i`
|
|
32
|
+
<div
|
|
33
|
+
class="icon-slot right ${this.focused?"focused":""}"
|
|
34
|
+
part="icon-slot icon-slot-right"
|
|
35
|
+
?filled=${Boolean(c&&p)||Boolean(y)||p}
|
|
36
|
+
@click=${()=>{(t||y)&&this.triggerNativeDropdown()}}
|
|
37
|
+
>
|
|
38
|
+
${c&&p?v():y?d:i`<slot name="icon-right"></slot>`}
|
|
39
|
+
</div>
|
|
40
|
+
`,g=()=>i`
|
|
19
41
|
<label
|
|
20
42
|
class="custom-file-label"
|
|
21
43
|
part="custom-file-label"
|
|
@@ -43,24 +65,24 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
43
65
|
.required=${this.required}
|
|
44
66
|
@keydown=${this.handleKeydown}
|
|
45
67
|
.dir=${this.dir}
|
|
46
|
-
name=${
|
|
68
|
+
name=${a(this.name||void 0)}
|
|
47
69
|
.autocomplete=${this.nativeAutocomplete()}
|
|
48
70
|
.autocapitalize=${this.autocapitalize}
|
|
49
71
|
spellcheck=${this.spellcheck}
|
|
50
72
|
?autofocus=${this.autofocus}
|
|
51
|
-
inputmode=${
|
|
52
|
-
enterkeyhint=${
|
|
53
|
-
list=${
|
|
54
|
-
capture=${
|
|
73
|
+
inputmode=${a(this.inputmode||void 0)}
|
|
74
|
+
enterkeyhint=${a(this.enterkeyhint)}
|
|
75
|
+
list=${a(this.list||void 0)}
|
|
76
|
+
capture=${a(this.capture?"environment":void 0)}
|
|
55
77
|
.aria-invalid=${String(this.isInvalid)}
|
|
56
78
|
.aria-required=${String(this.required)}
|
|
57
|
-
aria-label=${
|
|
58
|
-
aria-labelledby=${
|
|
59
|
-
aria-describedby=${
|
|
79
|
+
aria-label=${a(this.ariaLabel||void 0)}
|
|
80
|
+
aria-labelledby=${a(this.ariaLabelledby||void 0)}
|
|
81
|
+
aria-describedby=${a(this.describedById)}
|
|
60
82
|
/>
|
|
61
|
-
`,
|
|
83
|
+
`,b=()=>i`
|
|
62
84
|
<textarea
|
|
63
|
-
.value=${
|
|
85
|
+
.value=${h(this.value)}
|
|
64
86
|
@input=${this.handleInput}
|
|
65
87
|
@focus=${this.handleFocus}
|
|
66
88
|
@blur=${this.handleBlur}
|
|
@@ -70,27 +92,27 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
70
92
|
.rows=${this.rows}
|
|
71
93
|
placeholder=${this.placeholder}
|
|
72
94
|
resizable=${this.resizable||"none"}
|
|
73
|
-
style="width:100%;border:none;outline:none;
|
|
95
|
+
style="width:100%;border:none;outline:none;"
|
|
74
96
|
.autocapitalize=${this.autocapitalize}
|
|
75
97
|
?spellcheck=${this.spellcheck}
|
|
76
|
-
name=${
|
|
98
|
+
name=${a(this.name||void 0)}
|
|
77
99
|
.autocomplete=${this.nativeAutocomplete()}
|
|
78
|
-
inputmode=${
|
|
79
|
-
enterkeyhint=${
|
|
80
|
-
minlength=${
|
|
81
|
-
maxlength=${
|
|
100
|
+
inputmode=${a(this.inputmode||void 0)}
|
|
101
|
+
enterkeyhint=${a(this.enterkeyhint)}
|
|
102
|
+
minlength=${a(this.minlength??void 0)}
|
|
103
|
+
maxlength=${a(this.maxlength??void 0)}
|
|
82
104
|
?autofocus=${this.autofocus}
|
|
83
105
|
.aria-invalid=${String(this.isInvalid)}
|
|
84
106
|
.aria-required=${String(this.required)}
|
|
85
|
-
aria-label=${
|
|
86
|
-
aria-labelledby=${
|
|
87
|
-
aria-describedby=${
|
|
88
|
-
role=${
|
|
107
|
+
aria-label=${a(this.ariaLabel||void 0)}
|
|
108
|
+
aria-labelledby=${a(this.ariaLabelledby||void 0)}
|
|
109
|
+
aria-describedby=${a(this.describedById)}
|
|
110
|
+
role=${a(this.nativeInputRole())}
|
|
89
111
|
></textarea>
|
|
90
|
-
`,
|
|
112
|
+
`,k=()=>i`
|
|
91
113
|
<input
|
|
92
|
-
.type=${this.nativeTextInputType(
|
|
93
|
-
.value=${
|
|
114
|
+
.type=${this.nativeTextInputType(n)}
|
|
115
|
+
.value=${h(this.value)}
|
|
94
116
|
@input=${this.handleInput}
|
|
95
117
|
@focus=${this.handleFocus}
|
|
96
118
|
@blur=${this.handleBlur}
|
|
@@ -101,58 +123,32 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
101
123
|
.readOnly=${this.readonly||this.autofillGuardActive}
|
|
102
124
|
style="appearance:none;pointer-events:auto;"
|
|
103
125
|
placeholder=${this.placeholder}
|
|
104
|
-
name=${
|
|
126
|
+
name=${a(this.name||void 0)}
|
|
105
127
|
.autocomplete=${this.nativeAutocomplete()}
|
|
106
128
|
.autocapitalize=${this.autocapitalize}
|
|
107
129
|
spellcheck=${this.spellcheck}
|
|
108
|
-
inputmode=${
|
|
109
|
-
enterkeyhint=${
|
|
130
|
+
inputmode=${a(this.nativeInputMode())}
|
|
131
|
+
enterkeyhint=${a(this.nativeEnterKeyHint())}
|
|
110
132
|
data-form-type=${this.isFilterSearchInput()?"other":s}
|
|
111
133
|
?data-1p-ignore=${this.isFilterSearchInput()}
|
|
112
134
|
?data-lpignore=${this.isFilterSearchInput()}
|
|
113
|
-
list=${
|
|
114
|
-
pattern=${
|
|
115
|
-
minlength=${
|
|
116
|
-
maxlength=${
|
|
117
|
-
size=${
|
|
118
|
-
step=${
|
|
119
|
-
min=${
|
|
120
|
-
max=${
|
|
135
|
+
list=${a(this.list||void 0)}
|
|
136
|
+
pattern=${a(this.pattern||void 0)}
|
|
137
|
+
minlength=${a(this.minlength??void 0)}
|
|
138
|
+
maxlength=${a(this.maxlength??void 0)}
|
|
139
|
+
size=${a(this.size??void 0)}
|
|
140
|
+
step=${a(null!==this.step?Number(this.step):void 0)}
|
|
141
|
+
min=${a(this.min??void 0)}
|
|
142
|
+
max=${a(this.max??void 0)}
|
|
121
143
|
?autofocus=${this.autofocus}
|
|
122
144
|
.aria-invalid=${String(this.isInvalid)}
|
|
123
145
|
.aria-required=${String(this.required)}
|
|
124
|
-
aria-label=${
|
|
125
|
-
aria-labelledby=${
|
|
126
|
-
aria-describedby=${
|
|
127
|
-
role=${
|
|
146
|
+
aria-label=${a(this.ariaLabel||void 0)}
|
|
147
|
+
aria-labelledby=${a(this.ariaLabelledby||void 0)}
|
|
148
|
+
aria-describedby=${a(this.describedById)}
|
|
149
|
+
role=${a(this.nativeInputRole())}
|
|
128
150
|
/>
|
|
129
|
-
|
|
130
|
-
<div
|
|
131
|
-
class="input-container"
|
|
132
|
-
@click=${this.handleWrapperClick}
|
|
133
|
-
part="input-container"
|
|
134
|
-
>
|
|
135
|
-
${this.label?i`<div class="label" part="label">${this.label}</div>`:null}
|
|
136
|
-
<div
|
|
137
|
-
class="input-wrapper"
|
|
138
|
-
part="input-wrapper"
|
|
139
|
-
?compact=${this.compact}
|
|
140
|
-
?loading=${this.loading}
|
|
141
|
-
>
|
|
142
|
-
${(()=>i`
|
|
143
|
-
<div
|
|
144
|
-
class="icon-slot left ${this.focused?"focused":""}"
|
|
145
|
-
part="icon-slot icon-slot-left"
|
|
146
|
-
?filled=${Boolean(c&&l)||Boolean(u)||l}
|
|
147
|
-
@click=${()=>{(t||u)&&this.triggerNativeDropdown()}}
|
|
148
|
-
>
|
|
149
|
-
${c&&l?f():u?h:i`<slot name="icon-left"></slot>`}
|
|
150
|
-
</div>
|
|
151
|
-
`)()}
|
|
152
|
-
${n?this.renderInputAffix("prefix"):s}
|
|
153
|
-
${t?v():e?m():b()}
|
|
154
|
-
${n?this.renderInputAffix("suffix"):s}
|
|
155
|
-
${(()=>o&&this.showNumberButtons?i`
|
|
151
|
+
`,x=()=>r&&this.showNumberButtons?i`
|
|
156
152
|
<div class="number-btn">
|
|
157
153
|
<button
|
|
158
154
|
class="decrement-btn"
|
|
@@ -177,7 +173,7 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
177
173
|
<sky-icon icon="ion:add"></sky-icon>
|
|
178
174
|
</button>
|
|
179
175
|
</div>
|
|
180
|
-
`:null
|
|
176
|
+
`:null,w=()=>n&&this.showPasswordToggle?i`
|
|
181
177
|
<sky-icon
|
|
182
178
|
class="toggle-password"
|
|
183
179
|
part="toggle-password"
|
|
@@ -185,8 +181,7 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
185
181
|
icon=${this.showPassword?this.passwordVisibleIcon:this.passwordHiddenIcon}
|
|
186
182
|
@click=${this.togglePasswordVisibility}
|
|
187
183
|
></sky-icon>
|
|
188
|
-
`:null)()
|
|
189
|
-
${(()=>this.clearable&&(this.value||this.selectedFileName||this.selectedFileCount>0)?i`
|
|
184
|
+
`:null,$=()=>this.clearable&&(this.value||this.selectedFileName||this.selectedFileCount>0)?i`
|
|
190
185
|
<sky-icon
|
|
191
186
|
class="clear-button"
|
|
192
187
|
part="clear-button"
|
|
@@ -195,22 +190,54 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
195
190
|
?loading=${this.loading}
|
|
196
191
|
icon="ion:close"
|
|
197
192
|
></sky-icon>
|
|
198
|
-
`:null)()
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
193
|
+
`:null,S=()=>t?g():e?b():k(),F="fieldset"===this.variant,I="inside"===this.variant,z=this.label?F?i`<legend class="label" part="label">${this.label}</legend>`:i`<div class="label" part="label">${this.label}</div>`:null,E=i`
|
|
194
|
+
${o?this.renderInputAffix("prefix"):s}
|
|
195
|
+
${S()}
|
|
196
|
+
${o?this.renderInputAffix("suffix"):s}
|
|
197
|
+
${x()} ${w()} ${$()}
|
|
198
|
+
`,C=i`
|
|
199
|
+
${f()}
|
|
200
|
+
${o?this.renderInputAffix("prefix"):s}
|
|
201
|
+
${S()}
|
|
202
|
+
${o?this.renderInputAffix("suffix"):s}
|
|
203
|
+
${x()} ${w()} ${$()} ${m()}
|
|
204
|
+
`,A=i`
|
|
205
|
+
${f()}
|
|
206
|
+
<div class="input-inside-main">
|
|
207
|
+
${z}
|
|
208
|
+
<div class="input-inside-row">${E}</div>
|
|
209
|
+
</div>
|
|
210
|
+
${m()}
|
|
211
|
+
`;return i`
|
|
212
|
+
<div
|
|
213
|
+
class="input-container"
|
|
214
|
+
@click=${this.handleWrapperClick}
|
|
215
|
+
part="input-container"
|
|
216
|
+
>
|
|
217
|
+
${F||I?s:z}
|
|
218
|
+
${F?i`<fieldset
|
|
219
|
+
class="input-wrapper"
|
|
220
|
+
part="input-wrapper"
|
|
221
|
+
?compact=${this.compact}
|
|
222
|
+
?loading=${this.loading}
|
|
223
|
+
>
|
|
224
|
+
${z}
|
|
225
|
+
<div class="input-fieldset-body">
|
|
226
|
+
${f()}
|
|
227
|
+
${o?this.renderInputAffix("prefix"):s}
|
|
228
|
+
${S()}
|
|
229
|
+
${o?this.renderInputAffix("suffix"):s}
|
|
230
|
+
${x()} ${w()} ${$()}
|
|
231
|
+
${m()}
|
|
232
|
+
</div>
|
|
233
|
+
</fieldset>`:i`<div
|
|
234
|
+
class="input-wrapper"
|
|
235
|
+
part="input-wrapper"
|
|
236
|
+
?compact=${this.compact}
|
|
237
|
+
?loading=${this.loading}
|
|
238
|
+
>
|
|
239
|
+
${I?A:C}
|
|
240
|
+
</div>`}
|
|
214
241
|
${(()=>t&&this.totalFileSize?i`
|
|
215
242
|
<div class="file-info" part="file-info">
|
|
216
243
|
<span>
|
|
@@ -226,6 +253,51 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
226
253
|
display: block;
|
|
227
254
|
font-family: var(--sky-font);
|
|
228
255
|
width: 100%;
|
|
256
|
+
/* Control size */
|
|
257
|
+
--sky-input-height: 36px;
|
|
258
|
+
--sky-input-height-compact: 28px;
|
|
259
|
+
--sky-input-border-width: 1px;
|
|
260
|
+
/* Spacing scale — tight internal joins, softer outer edge */
|
|
261
|
+
--sky-input-pad-x: var(--sky-space-3, 12px);
|
|
262
|
+
--sky-input-pad-x-sm: var(--sky-space-1, 4px);
|
|
263
|
+
--sky-input-pad-x-xs: 0px;
|
|
264
|
+
--sky-input-pad-y: var(--sky-space-1, 4px);
|
|
265
|
+
--sky-input-pad-y-sm: 0px;
|
|
266
|
+
--sky-input-gap: var(--sky-space-1, 4px);
|
|
267
|
+
--sky-input-icon-width: 2rem;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
:host([compact]) {
|
|
271
|
+
--sky-input-pad-x: var(--sky-space-2, 8px);
|
|
272
|
+
--sky-input-pad-x-sm: var(--sky-space-1, 4px);
|
|
273
|
+
--sky-input-icon-width: 1.75rem;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/* Compact typography + denser chrome for every variant */
|
|
277
|
+
:host([compact]) .input-container > .label {
|
|
278
|
+
font-size: var(--sky-font-size-xs);
|
|
279
|
+
margin-bottom: var(--sky-space-1, 4px);
|
|
280
|
+
line-height: 1.2;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
:host([compact]) input,
|
|
284
|
+
:host([compact]) textarea,
|
|
285
|
+
:host([compact]) .input-affix,
|
|
286
|
+
:host([compact]) .custom-file-label__text {
|
|
287
|
+
font-size: var(--sky-font-size-sm);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
:host([compact]) .icon-slot {
|
|
291
|
+
font-size: var(--sky-font-size-lg);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
:host([compact]) .toggle-password,
|
|
295
|
+
:host([compact]) .clear-button {
|
|
296
|
+
font-size: var(--sky-font-size-md);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
:host([compact]) .custom-file-label {
|
|
300
|
+
border-radius: var(--sky-radius-primary);
|
|
229
301
|
}
|
|
230
302
|
|
|
231
303
|
:host([disabled]) .input-container {
|
|
@@ -235,12 +307,252 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
235
307
|
pointer-events: none;
|
|
236
308
|
}
|
|
237
309
|
|
|
238
|
-
:host([variant=
|
|
239
|
-
.label{
|
|
310
|
+
:host([variant='highlight']) {
|
|
311
|
+
.label {
|
|
240
312
|
color: var(--sky-input-color);
|
|
241
313
|
}
|
|
242
314
|
}
|
|
243
315
|
|
|
316
|
+
/* Fieldset / legend: native fieldset+legend; wrapper keeps solid fill */
|
|
317
|
+
:host([variant='fieldset']) {
|
|
318
|
+
overflow: visible;
|
|
319
|
+
padding-block-start: 0;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
:host([variant='fieldset']) .input-container {
|
|
323
|
+
overflow: visible;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
:host([variant='fieldset']) fieldset.input-wrapper {
|
|
327
|
+
display: block;
|
|
328
|
+
height: auto;
|
|
329
|
+
margin: 0;
|
|
330
|
+
min-inline-size: 0;
|
|
331
|
+
min-width: 0;
|
|
332
|
+
padding: 0;
|
|
333
|
+
overflow: visible;
|
|
334
|
+
background: var(--sky-glass-solid);
|
|
335
|
+
box-shadow: none;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
:host([variant='fieldset']) fieldset.input-wrapper[compact] {
|
|
339
|
+
height: auto;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
:host([variant='fieldset']) .input-fieldset-body {
|
|
343
|
+
display: flex;
|
|
344
|
+
width: 100%;
|
|
345
|
+
align-items: center;
|
|
346
|
+
box-sizing: border-box;
|
|
347
|
+
/* Match default control outer height once fieldset border is included */
|
|
348
|
+
height: calc(var(--sky-input-height) - 2 * var(--sky-input-border-width));
|
|
349
|
+
min-height: calc(
|
|
350
|
+
var(--sky-input-height) - 2 * var(--sky-input-border-width)
|
|
351
|
+
);
|
|
352
|
+
background: transparent;
|
|
353
|
+
border-radius: inherit;
|
|
354
|
+
min-width: 0;
|
|
355
|
+
overflow: hidden;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
:host([variant='fieldset'])
|
|
359
|
+
fieldset.input-wrapper[compact]
|
|
360
|
+
.input-fieldset-body {
|
|
361
|
+
height: calc(
|
|
362
|
+
var(--sky-input-height-compact) - 2 * var(--sky-input-border-width)
|
|
363
|
+
);
|
|
364
|
+
min-height: calc(
|
|
365
|
+
var(--sky-input-height-compact) - 2 * var(--sky-input-border-width)
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
:host([variant='fieldset']) fieldset.input-wrapper:has(textarea) {
|
|
370
|
+
height: auto;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
:host([variant='fieldset'])
|
|
374
|
+
fieldset.input-wrapper:has(textarea)
|
|
375
|
+
.input-fieldset-body {
|
|
376
|
+
height: calc((var(--rows)) * 23px);
|
|
377
|
+
min-height: calc((var(--rows)) * 23px);
|
|
378
|
+
align-items: flex-start;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
:host([variant='fieldset']) legend.label {
|
|
382
|
+
float: unset;
|
|
383
|
+
width: auto;
|
|
384
|
+
max-width: calc(100% - 2 * var(--sky-input-pad-x));
|
|
385
|
+
margin-inline-start: var(--sky-input-pad-x);
|
|
386
|
+
margin-bottom: 0;
|
|
387
|
+
padding-inline: var(--sky-input-pad-x-sm);
|
|
388
|
+
padding-block: 2px;
|
|
389
|
+
border: none;
|
|
390
|
+
background: transparent;
|
|
391
|
+
background-color: transparent;
|
|
392
|
+
color: var(--sky-text-secondary);
|
|
393
|
+
font-size: var(--sky-font-size-xs);
|
|
394
|
+
/* Keep room for glyphs; overflow:hidden from .label clips fieldset legends */
|
|
395
|
+
line-height: 1.4;
|
|
396
|
+
overflow: visible;
|
|
397
|
+
text-overflow: ellipsis;
|
|
398
|
+
white-space: nowrap;
|
|
399
|
+
pointer-events: none;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
:host([variant='fieldset']) .input-container:focus-within legend.label {
|
|
403
|
+
color: var(--sky-input-color);
|
|
404
|
+
font-size: var(--sky-font-size-xs);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/* Focus via real border — ::after would paint over the legend gap */
|
|
408
|
+
:host([variant='fieldset']) .input-wrapper::after {
|
|
409
|
+
content: none;
|
|
410
|
+
display: none;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
:host([variant='fieldset']) .input-wrapper:has(input:focus),
|
|
414
|
+
:host([variant='fieldset']) .input-wrapper:has(input:focus-visible),
|
|
415
|
+
:host([variant='fieldset']) .input-wrapper:has(textarea:focus),
|
|
416
|
+
:host([variant='fieldset']) .input-wrapper:has(textarea:focus-visible) {
|
|
417
|
+
border-color: var(--sky-input-color);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
:host([variant='fieldset'][validationActive]:invalid) .input-wrapper {
|
|
421
|
+
border-color: var(--sky-danger-primary);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
:host([variant='fieldset'][validationActive]:invalid) legend.label {
|
|
425
|
+
color: var(--sky-danger-primary);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
:host([variant='fieldset'][compact]) legend.label,
|
|
429
|
+
:host([variant='fieldset'][compact])
|
|
430
|
+
.input-container:focus-within
|
|
431
|
+
legend.label {
|
|
432
|
+
font-size: var(--sky-font-size-xs);
|
|
433
|
+
line-height: 1.4;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/* Inside: label lives in the wrapper above the value row */
|
|
437
|
+
:host([variant='inside']) {
|
|
438
|
+
--sky-input-height-inside: 44px;
|
|
439
|
+
/* Two lines (label + value) need a bit more than single-line compact */
|
|
440
|
+
--sky-input-height-inside-compact: 40px;
|
|
441
|
+
--sky-input-inside-label-block: 0.15rem;
|
|
442
|
+
--sky-input-inside-value-min: 1.375rem;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
:host([variant='inside']) .input-wrapper {
|
|
446
|
+
height: auto;
|
|
447
|
+
min-height: var(--sky-input-height-inside);
|
|
448
|
+
align-items: center;
|
|
449
|
+
padding-block: var(--sky-input-pad-y-sm, 0px);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
:host([variant='inside']) .input-wrapper[compact] {
|
|
453
|
+
height: auto;
|
|
454
|
+
min-height: var(--sky-input-height-inside-compact);
|
|
455
|
+
padding-block: var(--sky-input-pad-y-sm, 0px);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
:host([variant='inside']) .input-inside-main {
|
|
459
|
+
flex: 1 1 auto;
|
|
460
|
+
min-width: 0;
|
|
461
|
+
display: flex;
|
|
462
|
+
flex-direction: column;
|
|
463
|
+
justify-content: center;
|
|
464
|
+
gap: 0.15rem;
|
|
465
|
+
padding-block: var(--sky-input-inside-label-block);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
:host([variant='inside']) .input-inside-main > .label {
|
|
469
|
+
margin: 0;
|
|
470
|
+
padding-inline: var(--sky-input-pad-x);
|
|
471
|
+
font-size: var(--sky-font-size-xs);
|
|
472
|
+
line-height: 1.3;
|
|
473
|
+
min-height: calc(var(--sky-font-size-xs) * 1.3);
|
|
474
|
+
color: var(--sky-text-secondary);
|
|
475
|
+
pointer-events: none;
|
|
476
|
+
overflow: visible;
|
|
477
|
+
text-overflow: unset;
|
|
478
|
+
flex-shrink: 0;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
:host([variant='inside'][compact]) .input-inside-main > .label {
|
|
482
|
+
font-size: 0.6875rem; /* ~11px — denser than xs for two-line compact */
|
|
483
|
+
line-height: 1.3;
|
|
484
|
+
min-height: calc(0.6875rem * 1.3);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
:host([variant='inside'][compact]) .input-inside-row input,
|
|
488
|
+
:host([variant='inside'][compact]) .input-inside-row textarea {
|
|
489
|
+
font-size: var(--sky-font-size-sm);
|
|
490
|
+
line-height: 1.15;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
:host([variant='inside'])
|
|
494
|
+
.input-container:focus-within
|
|
495
|
+
.input-inside-main
|
|
496
|
+
> .label {
|
|
497
|
+
color: var(--sky-input-color);
|
|
498
|
+
font-size: var(--sky-font-size-xs);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
:host([variant='inside'][compact])
|
|
502
|
+
.input-container:focus-within
|
|
503
|
+
.input-inside-main
|
|
504
|
+
> .label {
|
|
505
|
+
font-size: 0.6875rem;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
:host([variant='inside'][validationActive]:invalid)
|
|
509
|
+
.input-inside-main
|
|
510
|
+
> .label {
|
|
511
|
+
color: var(--sky-danger-primary);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
:host([variant='inside']) .input-inside-row {
|
|
515
|
+
display: flex;
|
|
516
|
+
align-items: center;
|
|
517
|
+
min-width: 0;
|
|
518
|
+
width: 100%;
|
|
519
|
+
min-height: var(--sky-input-inside-value-min);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
:host([variant='inside'])
|
|
523
|
+
.input-wrapper:has(.icon-slot[filled].left)
|
|
524
|
+
.input-inside-main
|
|
525
|
+
> .label,
|
|
526
|
+
:host([variant='inside'])
|
|
527
|
+
.input-wrapper:has(.input-affix.prefix)
|
|
528
|
+
.input-inside-main
|
|
529
|
+
> .label {
|
|
530
|
+
padding-inline-start: 0;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
:host([variant='inside']) .input-inside-row input,
|
|
534
|
+
:host([variant='inside']) .input-inside-row textarea {
|
|
535
|
+
padding-block: 0;
|
|
536
|
+
height: auto;
|
|
537
|
+
min-height: 0;
|
|
538
|
+
line-height: 1.2;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
:host([variant='inside']) .input-wrapper:has(textarea) {
|
|
542
|
+
height: auto;
|
|
543
|
+
min-height: var(--sky-input-height-inside);
|
|
544
|
+
align-items: flex-start;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
:host([variant='inside']) .icon-slot,
|
|
548
|
+
:host([variant='inside']) .icon-slot[filled] {
|
|
549
|
+
align-self: center;
|
|
550
|
+
height: auto;
|
|
551
|
+
max-height: none;
|
|
552
|
+
align-items: center;
|
|
553
|
+
justify-content: center;
|
|
554
|
+
}
|
|
555
|
+
|
|
244
556
|
.input-container {
|
|
245
557
|
position: relative;
|
|
246
558
|
display: flex;
|
|
@@ -255,11 +567,16 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
255
567
|
height: 1em;
|
|
256
568
|
}
|
|
257
569
|
|
|
258
|
-
|
|
570
|
+
/* Outside labels only — never bump fieldset/inside fonts (clips legends) */
|
|
571
|
+
.input-container:focus-within > .label {
|
|
259
572
|
color: var(--sky-input-color);
|
|
260
|
-
|
|
261
|
-
|
|
573
|
+
transition: color var(--sky-transition-normal, 200ms ease);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
:host([compact]) .input-container:focus-within > .label {
|
|
577
|
+
font-size: var(--sky-font-size-xs);
|
|
262
578
|
}
|
|
579
|
+
|
|
263
580
|
.label {
|
|
264
581
|
font-size: var(--sky-font-size-sm);
|
|
265
582
|
margin-bottom: var(--sky-space-1, 4px);
|
|
@@ -268,11 +585,7 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
268
585
|
overflow: hidden;
|
|
269
586
|
text-overflow: ellipsis;
|
|
270
587
|
font-family: var(--sky-font);
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
.input-container:focus-within[compact] .label {
|
|
274
|
-
font-size: var(--sky-font-size-xs);
|
|
275
|
-
color: var(--sky-input-color);
|
|
588
|
+
line-height: 1.35;
|
|
276
589
|
}
|
|
277
590
|
|
|
278
591
|
.input-wrapper {
|
|
@@ -281,7 +594,8 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
281
594
|
width: 100%;
|
|
282
595
|
align-items: center;
|
|
283
596
|
box-sizing: border-box;
|
|
284
|
-
height:
|
|
597
|
+
height: var(--sky-input-height);
|
|
598
|
+
min-height: var(--sky-input-height);
|
|
285
599
|
pointer-events: auto;
|
|
286
600
|
background: var(--sky-glass-solid);
|
|
287
601
|
backdrop-filter: none;
|
|
@@ -295,7 +609,7 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
295
609
|
}
|
|
296
610
|
|
|
297
611
|
.input-wrapper::after {
|
|
298
|
-
content:
|
|
612
|
+
content: '';
|
|
299
613
|
position: absolute;
|
|
300
614
|
top: -1px;
|
|
301
615
|
left: -1px;
|
|
@@ -336,15 +650,17 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
336
650
|
}
|
|
337
651
|
|
|
338
652
|
.input-wrapper[compact] {
|
|
339
|
-
height:
|
|
653
|
+
height: var(--sky-input-height-compact);
|
|
654
|
+
min-height: var(--sky-input-height-compact);
|
|
340
655
|
border: var(--sky-border-primary);
|
|
656
|
+
border-radius: var(--sky-radius-primary);
|
|
341
657
|
}
|
|
342
658
|
|
|
343
|
-
input[type=
|
|
344
|
-
input[type=
|
|
345
|
-
input[type=
|
|
346
|
-
input[type=
|
|
347
|
-
input[type=
|
|
659
|
+
input[type='date'],
|
|
660
|
+
input[type='time'],
|
|
661
|
+
input[type='week'],
|
|
662
|
+
input[type='month'],
|
|
663
|
+
input[type='datetime-local'] {
|
|
348
664
|
-webkit-appearance: none;
|
|
349
665
|
-moz-appearance: none;
|
|
350
666
|
appearance: none;
|
|
@@ -353,11 +669,11 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
353
669
|
font-family: inherit;
|
|
354
670
|
}
|
|
355
671
|
|
|
356
|
-
input[type=
|
|
357
|
-
input[type=
|
|
358
|
-
input[type=
|
|
359
|
-
input[type=
|
|
360
|
-
input[type=
|
|
672
|
+
input[type='date']::-webkit-calendar-picker-indicator,
|
|
673
|
+
input[type='time']::-webkit-calendar-picker-indicator,
|
|
674
|
+
input[type='week']::-webkit-calendar-picker-indicator,
|
|
675
|
+
input[type='month']::-webkit-calendar-picker-indicator,
|
|
676
|
+
input[type='datetime-local']::-webkit-calendar-picker-indicator {
|
|
361
677
|
display: none;
|
|
362
678
|
}
|
|
363
679
|
|
|
@@ -372,8 +688,9 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
372
688
|
input {
|
|
373
689
|
font-family: var(--sky-font);
|
|
374
690
|
font-size: var(--sky-font-size-md);
|
|
691
|
+
line-height: 1.2;
|
|
375
692
|
text-align: left;
|
|
376
|
-
transition:
|
|
693
|
+
transition: color var(--sky-transition-normal, 200ms ease);
|
|
377
694
|
}
|
|
378
695
|
|
|
379
696
|
input:-webkit-autofill {
|
|
@@ -385,25 +702,25 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
385
702
|
text-align: right;
|
|
386
703
|
}
|
|
387
704
|
|
|
388
|
-
input[type=
|
|
705
|
+
input[type='number'] {
|
|
389
706
|
appearance: textfield;
|
|
390
707
|
-moz-appearance: textfield;
|
|
391
708
|
}
|
|
392
709
|
|
|
393
|
-
input[type=
|
|
394
|
-
input[type=
|
|
710
|
+
input[type='number']::-webkit-inner-spin-button,
|
|
711
|
+
input[type='number']::-webkit-outer-spin-button {
|
|
395
712
|
-webkit-appearance: none;
|
|
396
713
|
margin: 0;
|
|
397
714
|
}
|
|
398
715
|
.number-btn {
|
|
399
716
|
display: flex;
|
|
400
717
|
flex-shrink: 0;
|
|
401
|
-
margin-inline-end: var(--sky-
|
|
402
|
-
gap: var(--sky-
|
|
718
|
+
margin-inline-end: var(--sky-input-pad-x-sm);
|
|
719
|
+
gap: var(--sky-input-gap);
|
|
403
720
|
}
|
|
404
721
|
|
|
405
722
|
:dir(rtl).number-btn {
|
|
406
|
-
margin-inline-end: var(--sky-
|
|
723
|
+
margin-inline-end: var(--sky-input-pad-x-sm);
|
|
407
724
|
}
|
|
408
725
|
|
|
409
726
|
.file-info {
|
|
@@ -427,7 +744,7 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
427
744
|
display: flex;
|
|
428
745
|
align-items: center;
|
|
429
746
|
justify-content: center;
|
|
430
|
-
padding: var(--sky-
|
|
747
|
+
padding: var(--sky-input-pad-x-xs) var(--sky-input-pad-x-sm);
|
|
431
748
|
font-size: var(--sky-font-size-sm);
|
|
432
749
|
cursor: pointer;
|
|
433
750
|
transition: color var(--sky-transition-normal, 200ms ease);
|
|
@@ -444,7 +761,7 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
444
761
|
display: flex;
|
|
445
762
|
align-items: center;
|
|
446
763
|
justify-content: center;
|
|
447
|
-
margin-inline-end: var(--sky-
|
|
764
|
+
margin-inline-end: var(--sky-input-pad-x-sm);
|
|
448
765
|
font-size: var(--sky-font-size-lg);
|
|
449
766
|
color: var(--sky-text-tertiary);
|
|
450
767
|
cursor: pointer;
|
|
@@ -463,7 +780,7 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
463
780
|
box-sizing: border-box;
|
|
464
781
|
color: var(--sky-text-primary);
|
|
465
782
|
padding-block: 0;
|
|
466
|
-
padding-inline: var(--sky-
|
|
783
|
+
padding-inline: var(--sky-input-pad-x);
|
|
467
784
|
}
|
|
468
785
|
|
|
469
786
|
input::placeholder {
|
|
@@ -482,13 +799,13 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
482
799
|
}
|
|
483
800
|
|
|
484
801
|
.input-affix.prefix {
|
|
485
|
-
padding-inline-start: var(--sky-
|
|
486
|
-
padding-inline-end: var(--sky-
|
|
802
|
+
padding-inline-start: var(--sky-input-pad-x);
|
|
803
|
+
padding-inline-end: var(--sky-input-pad-x-sm);
|
|
487
804
|
}
|
|
488
805
|
|
|
489
806
|
.input-affix.suffix {
|
|
490
|
-
padding-inline-start: var(--sky-
|
|
491
|
-
padding-inline-end: var(--sky-
|
|
807
|
+
padding-inline-start: var(--sky-input-pad-x-sm);
|
|
808
|
+
padding-inline-end: var(--sky-input-pad-x);
|
|
492
809
|
}
|
|
493
810
|
|
|
494
811
|
.input-wrapper[compact] .input-affix {
|
|
@@ -497,12 +814,28 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
497
814
|
|
|
498
815
|
.input-wrapper:has(.input-affix.prefix) input,
|
|
499
816
|
.input-wrapper:has(.input-affix.prefix) textarea {
|
|
500
|
-
padding-inline-start:
|
|
817
|
+
padding-inline-start: 0;
|
|
501
818
|
}
|
|
502
819
|
|
|
503
820
|
.input-wrapper:has(.icon-slot[filled].left) input,
|
|
504
821
|
.input-wrapper:has(.icon-slot[filled].left) textarea {
|
|
505
|
-
padding-inline-start:
|
|
822
|
+
padding-inline-start: 0;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
.input-wrapper:has(.icon-slot[filled].right) input,
|
|
826
|
+
.input-wrapper:has(.icon-slot[filled].right) textarea,
|
|
827
|
+
.input-wrapper:has(.clear-button) input,
|
|
828
|
+
.input-wrapper:has(.clear-button) textarea,
|
|
829
|
+
.input-wrapper:has(.toggle-password) input,
|
|
830
|
+
.input-wrapper:has(.toggle-password) textarea,
|
|
831
|
+
.input-wrapper:has(.number-btn) input,
|
|
832
|
+
.input-wrapper:has(.loading-indicator) input {
|
|
833
|
+
padding-inline-end: 0;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
.input-wrapper:has(.input-affix.suffix) input,
|
|
837
|
+
.input-wrapper:has(.input-affix.suffix) textarea {
|
|
838
|
+
padding-inline-end: 0;
|
|
506
839
|
}
|
|
507
840
|
|
|
508
841
|
.custom-file-label__text {
|
|
@@ -511,11 +844,11 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
511
844
|
overflow: hidden;
|
|
512
845
|
text-overflow: ellipsis;
|
|
513
846
|
color: var(--sky-text-tertiary);
|
|
514
|
-
padding-inline-end: var(--sky-
|
|
847
|
+
padding-inline-end: var(--sky-input-pad-x);
|
|
515
848
|
}
|
|
516
849
|
|
|
517
850
|
.custom-file-label:not(:has(.input-affix.prefix)) .custom-file-label__text {
|
|
518
|
-
padding-inline-start: var(--sky-
|
|
851
|
+
padding-inline-start: var(--sky-input-pad-x);
|
|
519
852
|
}
|
|
520
853
|
|
|
521
854
|
.custom-file-label__text[data-filled] {
|
|
@@ -528,22 +861,20 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
528
861
|
font-size: var(--sky-font-size-xl);
|
|
529
862
|
align-items: center;
|
|
530
863
|
color: var(--sky-text-primary);
|
|
531
|
-
border-radius: var(--sky-radius-secondary);
|
|
532
864
|
height: inherit;
|
|
533
865
|
max-height: 100%;
|
|
534
866
|
box-sizing: border-box;
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
867
|
+
flex: 0 0 var(--sky-input-icon-width);
|
|
868
|
+
width: var(--sky-input-icon-width);
|
|
869
|
+
min-width: var(--sky-input-icon-width);
|
|
870
|
+
padding: 0;
|
|
871
|
+
background: none;
|
|
872
|
+
border: none;
|
|
873
|
+
transition: color var(--sky-transition-normal, 200ms ease);
|
|
542
874
|
}
|
|
543
875
|
|
|
544
876
|
.input-wrapper:has(textarea) .icon-slot {
|
|
545
|
-
max-height:
|
|
546
|
-
border-bottom: var(--sky-border-primary);
|
|
877
|
+
max-height: var(--sky-input-height);
|
|
547
878
|
}
|
|
548
879
|
|
|
549
880
|
.icon-slot[filled] {
|
|
@@ -551,55 +882,11 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
551
882
|
flex-shrink: 0;
|
|
552
883
|
cursor: pointer;
|
|
553
884
|
}
|
|
554
|
-
.icon-slot[filled]:hover {
|
|
555
|
-
transform: translate(-5px, -5px);
|
|
556
|
-
color: var(--sky-input-color);
|
|
557
|
-
}
|
|
558
|
-
.icon-slot.right[filled]:hover {
|
|
559
|
-
transform: translate(5px, -5px);
|
|
560
|
-
color: var(--sky-input-color);
|
|
561
|
-
}
|
|
562
885
|
|
|
886
|
+
.icon-slot[filled]:hover,
|
|
887
|
+
.icon-slot[filled]:active,
|
|
563
888
|
.icon-slot.focused {
|
|
564
|
-
transform: translate(-5px, -5px);
|
|
565
889
|
color: var(--sky-input-color);
|
|
566
|
-
border: var(--sky-border-primary) !important;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
:dir(rtl) .icon-slot[filled]:hover {
|
|
570
|
-
transform: translate(5px, -5px);
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
:dir(rtl) .icon-slot.right[filled]:hover {
|
|
574
|
-
transform: translate(-5px, -5px);
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
:dir(rtl) .icon-slot.focused {
|
|
578
|
-
transform: translate(5px, -5px);
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
.icon-slot.right {
|
|
582
|
-
border-left: var(--sky-border-primary);
|
|
583
|
-
}
|
|
584
|
-
.icon-slot.left {
|
|
585
|
-
border-right: var(--sky-border-primary);
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
:dir(rtl) .icon-slot.right {
|
|
589
|
-
border-left: unset;
|
|
590
|
-
border-right: var(--sky-border-primary);
|
|
591
|
-
}
|
|
592
|
-
:dir(rtl) .icon-slot.left {
|
|
593
|
-
border-right: unset;
|
|
594
|
-
border-left: var(--sky-border-primary);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
.icon-slot.right.focused {
|
|
598
|
-
transform: translate(5px, -5px);
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
:dir(rtl) .icon-slot.right.focused {
|
|
602
|
-
transform: translate(-5px, -5px);
|
|
603
890
|
}
|
|
604
891
|
|
|
605
892
|
.progress-message {
|
|
@@ -609,13 +896,13 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
609
896
|
white-space: nowrap;
|
|
610
897
|
text-overflow: ellipsis;
|
|
611
898
|
font-size: var(--sky-font-size-sm);
|
|
612
|
-
margin-
|
|
899
|
+
margin-inline-start: var(--sky-input-pad-x-sm);
|
|
613
900
|
font-family: var(--sky-font);
|
|
614
901
|
}
|
|
615
902
|
|
|
616
903
|
:dir(rtl) .progress-message {
|
|
617
|
-
margin-
|
|
618
|
-
margin-
|
|
904
|
+
margin-inline-start: unset;
|
|
905
|
+
margin-inline-end: var(--sky-input-pad-x-sm);
|
|
619
906
|
}
|
|
620
907
|
|
|
621
908
|
.error-list {
|
|
@@ -645,7 +932,7 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
645
932
|
|
|
646
933
|
.loading-indicator {
|
|
647
934
|
flex-shrink: 0;
|
|
648
|
-
margin-inline-end: var(--sky-
|
|
935
|
+
margin-inline-end: var(--sky-input-pad-x-sm);
|
|
649
936
|
width: 16px;
|
|
650
937
|
height: 16px;
|
|
651
938
|
border: 2px solid var(--sky-hover-primary);
|
|
@@ -674,7 +961,7 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
674
961
|
|
|
675
962
|
.clear-button {
|
|
676
963
|
flex-shrink: 0;
|
|
677
|
-
margin-inline-end: var(--sky-
|
|
964
|
+
margin-inline-end: var(--sky-input-pad-x-sm);
|
|
678
965
|
border: none;
|
|
679
966
|
font-size: var(--sky-font-size-xl);
|
|
680
967
|
color: var(--sky-input-color);
|
|
@@ -695,7 +982,7 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
695
982
|
pointer-events: none;
|
|
696
983
|
}
|
|
697
984
|
|
|
698
|
-
input[type=
|
|
985
|
+
input[type='file'] {
|
|
699
986
|
position: absolute;
|
|
700
987
|
width: 100%;
|
|
701
988
|
height: 100%;
|
|
@@ -709,7 +996,7 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
709
996
|
flex: 1;
|
|
710
997
|
display: flex;
|
|
711
998
|
align-items: center;
|
|
712
|
-
gap: var(--sky-
|
|
999
|
+
gap: var(--sky-input-gap);
|
|
713
1000
|
text-align: left;
|
|
714
1001
|
padding: 0;
|
|
715
1002
|
color: var(--sky-input-color);
|
|
@@ -725,11 +1012,11 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
725
1012
|
}
|
|
726
1013
|
|
|
727
1014
|
.custom-file-label:hover .custom-file-label__text {
|
|
728
|
-
padding-inline-start: var(--sky-
|
|
1015
|
+
padding-inline-start: var(--sky-input-pad-x-sm);
|
|
729
1016
|
}
|
|
730
1017
|
|
|
731
1018
|
.custom-file-label:empty::after {
|
|
732
|
-
content:
|
|
1019
|
+
content: 'Choose file';
|
|
733
1020
|
color: var(--sky-input-color);
|
|
734
1021
|
}
|
|
735
1022
|
|
|
@@ -745,17 +1032,17 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
745
1032
|
background: transparent;
|
|
746
1033
|
box-sizing: border-box;
|
|
747
1034
|
color: var(--sky-text-primary);
|
|
748
|
-
padding: var(--sky-
|
|
1035
|
+
padding: var(--sky-input-pad-y) var(--sky-input-pad-x);
|
|
749
1036
|
resize: none;
|
|
750
1037
|
overflow: auto;
|
|
751
1038
|
font-family: var(--sky-font);
|
|
752
1039
|
}
|
|
753
1040
|
|
|
754
|
-
textarea[resizable=
|
|
1041
|
+
textarea[resizable='vertical'] {
|
|
755
1042
|
resize: vertical;
|
|
756
1043
|
}
|
|
757
1044
|
|
|
758
|
-
textarea[resizable=
|
|
1045
|
+
textarea[resizable='both'] {
|
|
759
1046
|
resize: both;
|
|
760
1047
|
}
|
|
761
1048
|
|
|
@@ -806,7 +1093,7 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
806
1093
|
animation: none;
|
|
807
1094
|
}
|
|
808
1095
|
|
|
809
|
-
.input-container:focus-within .label,
|
|
1096
|
+
.input-container:focus-within > .label,
|
|
810
1097
|
.input-wrapper,
|
|
811
1098
|
.icon-slot,
|
|
812
1099
|
.increment-btn,
|
|
@@ -818,5 +1105,5 @@ import{css as t,LitElement as e,html as i,nothing as s}from"lit";import{ifDefine
|
|
|
818
1105
|
transition: none;
|
|
819
1106
|
}
|
|
820
1107
|
}
|
|
821
|
-
`,m.shadowRootOptions={...e.shadowRootOptions,delegatesFocus:!0},
|
|
1108
|
+
`,m.shadowRootOptions={...e.shadowRootOptions,delegatesFocus:!0},f([n({type:String})],m.prototype,"value",2),f([n({type:String})],m.prototype,"placeholder",2),f([n({type:String})],m.prototype,"label",2),f([n({type:String})],m.prototype,"type",2),f([n({type:String})],m.prototype,"suffix",2),f([n({type:String})],m.prototype,"prefix",2),f([n({type:String})],m.prototype,"prefixColor",2),f([n({type:String})],m.prototype,"suffixColor",2),f([n({type:String})],m.prototype,"color",2),f([n({type:Array})],m.prototype,"validations",1),f([n({type:Boolean,reflect:!0})],m.prototype,"compact",2),f([n({type:Boolean,reflect:!0})],m.prototype,"loading",2),f([n({type:Boolean})],m.prototype,"showErrors",2),f([n({type:Boolean,reflect:!0})],m.prototype,"clearable",2),f([n({type:String})],m.prototype,"errorDisplayMode",2),f([n({type:Boolean,reflect:!0})],m.prototype,"required",2),f([n({type:String})],m.prototype,"step",2),f([n({type:String})],m.prototype,"min",2),f([n({type:String})],m.prototype,"max",2),f([n({type:String})],m.prototype,"autocapitalize",2),f([n({type:String})],m.prototype,"autocomplete",2),f([n({type:Boolean})],m.prototype,"spellcheck",2),f([n({type:String})],m.prototype,"dir",2),f([n({type:Number})],m.prototype,"rows",2),f([n({type:String})],m.prototype,"resizable",2),f([n({type:String})],m.prototype,"accept",2),f([n({type:Boolean})],m.prototype,"multiple",2),f([n({type:String})],m.prototype,"inputmode",2),f([n({type:String})],m.prototype,"enterkeyhint",2),f([n({type:String})],m.prototype,"pattern",2),f([n({type:Number})],m.prototype,"minlength",2),f([n({type:Number})],m.prototype,"maxlength",2),f([n({type:String})],m.prototype,"list",2),f([n({type:Number})],m.prototype,"size",2),f([n({type:Number})],m.prototype,"cols",2),f([n({type:Boolean})],m.prototype,"autofocus",2),f([n({type:Boolean})],m.prototype,"capture",2),f([n({type:String})],m.prototype,"inputRole",2),f([n({type:String})],m.prototype,"ariaLabel",2),f([n({type:String})],m.prototype,"ariaLabelledby",2),f([n({type:String})],m.prototype,"ariaDescribedby",2),f([n({type:Boolean})],m.prototype,"showNumberButtons",2),f([n({type:Boolean})],m.prototype,"showPasswordToggle",2),f([n({type:String})],m.prototype,"passwordVisibleIcon",2),f([n({type:String})],m.prototype,"passwordHiddenIcon",2),f([n({type:Boolean,reflect:!0})],m.prototype,"validationActive",2),f([n({type:Boolean,reflect:!0})],m.prototype,"invalid",2),f([n({type:String,reflect:!0})],m.prototype,"variant",2),f([o()],m.prototype,"selectedFileName",2),f([o()],m.prototype,"selectedFiles",2),f([o()],m.prototype,"focused",2),f([o()],m.prototype,"validationStatus",2),f([o()],m.prototype,"validationErrors",2),f([o()],m.prototype,"typingStarted",2),f([o()],m.prototype,"autofillIconSlot",2),f([o()],m.prototype,"autofillGuardActive",2),f([o()],m.prototype,"showPassword",2),f([o()],m.prototype,"totalFileSize",2),f([o()],m.prototype,"selectedFileCount",2),f([o()],m.prototype,"filePreview",2),f([l(".input-wrapper")],m.prototype,"inputWrapperEl",2),f([l("input, textarea")],m.prototype,"nativeInputEl",2),m=f([p("sky-input")],m);export{m as SkyInput};
|
|
822
1109
|
//# sourceMappingURL=sky-input.js.map
|