@sky.ui/core 0.0.23 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/custom-elements.json +1299 -1299
  2. package/dist/helper/controllers/animation-controller.js.map +1 -1
  3. package/dist/helper/controllers/index.js +2 -0
  4. package/dist/helper/controllers/index.js.map +1 -0
  5. package/dist/helper/controllers/popover-controller.js +1 -1
  6. package/dist/helper/controllers/popover-controller.js.map +1 -1
  7. package/dist/helper/form-control-base.js +2 -0
  8. package/dist/helper/form-control-base.js.map +1 -0
  9. package/dist/helper/iconify-offline.js.map +1 -1
  10. package/dist/helper/index.js +2 -0
  11. package/dist/helper/index.js.map +1 -0
  12. package/dist/helper/internals/form-control-base.js +1 -1
  13. package/dist/helper/internals/form-control-base.js.map +1 -1
  14. package/dist/helper/internals/index.js +2 -0
  15. package/dist/helper/internals/index.js.map +1 -0
  16. package/dist/helper/utils/color-resolver.js.map +1 -1
  17. package/dist/helper/utils/index.js +2 -0
  18. package/dist/helper/utils/index.js.map +1 -0
  19. package/dist/helper/utils/size-resolver.js.map +1 -1
  20. package/dist/sky-alert/index.js.map +1 -0
  21. package/dist/sky-alert/sky-alert.js +45 -45
  22. package/dist/sky-alert/sky-alert.js.map +1 -1
  23. package/dist/sky-appbar/index.js.map +1 -0
  24. package/dist/sky-appbar/sky-appbar.js +30 -30
  25. package/dist/sky-appbar/sky-appbar.js.map +1 -1
  26. package/dist/sky-avatar/index.js.map +1 -0
  27. package/dist/sky-avatar/sky-avatar.js +25 -25
  28. package/dist/sky-avatar/sky-avatar.js.map +1 -1
  29. package/dist/sky-badge/index.js.map +1 -0
  30. package/dist/sky-badge/sky-badge.d.ts +1 -1
  31. package/dist/sky-badge/sky-badge.js +27 -27
  32. package/dist/sky-badge/sky-badge.js.map +1 -1
  33. package/dist/sky-button/index.js.map +1 -0
  34. package/dist/sky-button/sky-button.js +25 -25
  35. package/dist/sky-button/sky-button.js.map +1 -1
  36. package/dist/sky-card/index.js.map +1 -0
  37. package/dist/sky-card/sky-card.js +22 -22
  38. package/dist/sky-card/sky-card.js.map +1 -1
  39. package/dist/sky-checkbox/index.js.map +1 -0
  40. package/dist/sky-checkbox/sky-checkbox.d.ts +2 -2
  41. package/dist/sky-checkbox/sky-checkbox.js +43 -43
  42. package/dist/sky-checkbox/sky-checkbox.js.map +1 -1
  43. package/dist/sky-chip/index.js.map +1 -0
  44. package/dist/sky-chip/sky-chip.js +35 -35
  45. package/dist/sky-chip/sky-chip.js.map +1 -1
  46. package/dist/sky-col/index.js.map +1 -0
  47. package/dist/sky-col/sky-col.js +7 -7
  48. package/dist/sky-col/sky-col.js.map +1 -1
  49. package/dist/sky-combobox/index.js.map +1 -0
  50. package/dist/sky-combobox/sky-combobox.d.ts +2 -2
  51. package/dist/sky-combobox/sky-combobox.js +244 -244
  52. package/dist/sky-combobox/sky-combobox.js.map +1 -1
  53. package/dist/sky-dialog/index.js.map +1 -0
  54. package/dist/sky-dialog/sky-dialog.js +43 -43
  55. package/dist/sky-dialog/sky-dialog.js.map +1 -1
  56. package/dist/sky-divider/index.js.map +1 -0
  57. package/dist/sky-divider/sky-divider.js +16 -16
  58. package/dist/sky-divider/sky-divider.js.map +1 -1
  59. package/dist/sky-flexbox/index.js.map +1 -0
  60. package/dist/sky-flexbox/sky-flexbox.js +9 -9
  61. package/dist/sky-flexbox/sky-flexbox.js.map +1 -1
  62. package/dist/sky-flexcol/index.js.map +1 -0
  63. package/dist/sky-flexcol/sky-flexcol.js +2 -2
  64. package/dist/sky-flexcol/sky-flexcol.js.map +1 -1
  65. package/dist/sky-form/index.js.map +1 -0
  66. package/dist/sky-form/sky-form.js +12 -12
  67. package/dist/sky-form/sky-form.js.map +1 -1
  68. package/dist/sky-grid/index.js.map +1 -0
  69. package/dist/sky-grid/sky-grid.js +6 -6
  70. package/dist/sky-grid/sky-grid.js.map +1 -1
  71. package/dist/sky-icon/index.js.map +1 -0
  72. package/dist/sky-icon/sky-icon.js +13 -13
  73. package/dist/sky-icon/sky-icon.js.map +1 -1
  74. package/dist/sky-image/index.js.map +1 -0
  75. package/dist/sky-image/sky-image.js +21 -21
  76. package/dist/sky-image/sky-image.js.map +1 -1
  77. package/dist/sky-image/srcset-utils.js.map +1 -1
  78. package/dist/sky-input/index.js.map +1 -0
  79. package/dist/sky-input/sky-input.d.ts +2 -2
  80. package/dist/sky-input/sky-input.js +225 -225
  81. package/dist/sky-input/sky-input.js.map +1 -1
  82. package/dist/sky-list/index.js.map +1 -0
  83. package/dist/sky-list/sky-list.js +6 -6
  84. package/dist/sky-list/sky-list.js.map +1 -1
  85. package/dist/sky-listitem/index.js.map +1 -0
  86. package/dist/sky-listitem/sky-listitem.js +31 -31
  87. package/dist/sky-listitem/sky-listitem.js.map +1 -1
  88. package/dist/sky-radio/index.js.map +1 -0
  89. package/dist/sky-radio/sky-radio.d.ts +2 -2
  90. package/dist/sky-radio/sky-radio.js +27 -27
  91. package/dist/sky-radio/sky-radio.js.map +1 -1
  92. package/dist/sky-row/index.js.map +1 -0
  93. package/dist/sky-row/sky-row.js +2 -2
  94. package/dist/sky-row/sky-row.js.map +1 -1
  95. package/dist/sky-sheet/index.js.map +1 -0
  96. package/dist/sky-sheet/sky-sheet.js +2 -2
  97. package/dist/sky-sheet/sky-sheet.js.map +1 -1
  98. package/dist/sky-simple-table/index.js.map +1 -0
  99. package/dist/sky-simple-table/sky-simple-table.js +34 -34
  100. package/dist/sky-simple-table/sky-simple-table.js.map +1 -1
  101. package/dist/sky-theme-provider/index.js.map +1 -0
  102. package/dist/sky-theme-provider/sky-theme-provider.js +2 -2
  103. package/dist/sky-theme-provider/sky-theme-provider.js.map +1 -1
  104. package/package.json +2 -2
  105. package/plugins/rollup-plugin.d.ts +5 -8
  106. package/plugins/vite-plugin.d.ts +5 -8
  107. package/plugins/webpack-plugin.d.ts +3 -7
@@ -1,4 +1,227 @@
1
- import{__decorate as t,__metadata as e}from"tslib";import{css as i,LitElement as s,html as o,nothing as r}from"lit";import{ifDefined as a}from"lit/directives/if-defined.js";import{styleMap as n}from"lit/directives/style-map.js";import{property as l,state as p,query as d,customElement as c}from"lit/decorators.js";import{resolveColor as h}from"../helper/utils/color-resolver.js";import{live as u}from"lit/directives/live.js";import{FormControlBase as y}from"../helper/internals/form-control-base.js";import{SkyIcon as v}from"../sky-icon/sky-icon.js";let f=class extends y{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()}}static{this.dependencies={"sky-icon":v}}get validations(){return this._validations}set validations(t){const e=this._validations;this._validations=Array.isArray(t)?t:[],this.requestUpdate("validations",e)}static{this.styles=i`
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`
2
+ <div class="progress-message">
3
+ <ul id=${r} class="error-list" part="error-list">
4
+ ${s.map(t=>i`<li class="error" part="error">${t}</li>`)}
5
+ </ul>
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:h(e)}}renderInputAffix(t){const e="prefix"===t?this.prefix:this.suffix;if(!String(e??"").length)return s;const r="prefix"===t?this.prefixColor:this.suffixColor,a=this.affixColorStyle(r);return i`<span
8
+ class="input-affix ${t}"
9
+ part="input-${t}"
10
+ style=${a?o(a):s}
11
+ >${e}</span
12
+ >`}render(){const t="file"===this.type,e="textarea"===this.type,o="number"===this.type,a="password"===this.type,n=!t&&!e,l=!!this.querySelector('[slot="icon-left"]'),p=!!this.querySelector('[slot="icon-right"]');let h=null;"date"===this.type?h=i`<sky-icon icon="ion:calendar"></sky-icon>`:"time"===this.type?h=i`<sky-icon icon="ion:time"></sky-icon>`:"week"===this.type||"month"===this.type?h=i`<sky-icon icon="ion:calendar"></sky-icon>`:"datetime-local"===this.type&&(h=i`<sky-icon icon="ion:time"></sky-icon>`);const c=this.filePreview&&(l||p),u="left"===this.autofillIconSlot&&h,y="right"===this.autofillIconSlot&&h,f=()=>i`
13
+ <img
14
+ src=${r("string"==typeof this.filePreview?this.filePreview:void 0)}
15
+ alt="Preview"
16
+ style="width:100%;height:100%;object-fit:cover;border-radius:12px;"
17
+ />
18
+ `,v=()=>i`
19
+ <label
20
+ class="custom-file-label"
21
+ part="custom-file-label"
22
+ for="fileInput"
23
+ ?disabled=${this.disabled}
24
+ >
25
+ ${this.renderInputAffix("prefix")}
26
+ <span
27
+ class="custom-file-label__text"
28
+ part="custom-file-label-text"
29
+ ?data-filled=${Boolean(this.selectedFileName)}
30
+ >
31
+ ${this.selectedFileName||this.placeholder||"Choose file"}
32
+ </span>
33
+ ${this.renderInputAffix("suffix")}
34
+ </label>
35
+
36
+ <input
37
+ id="fileInput"
38
+ type="file"
39
+ @change=${this.handleFileChange}
40
+ ?disabled=${this.disabled}
41
+ accept=${this.accept||""}
42
+ ?multiple=${this.multiple}
43
+ .required=${this.required}
44
+ @keydown=${this.handleKeydown}
45
+ .dir=${this.dir}
46
+ name=${r(this.name||void 0)}
47
+ .autocomplete=${this.nativeAutocomplete()}
48
+ .autocapitalize=${this.autocapitalize}
49
+ spellcheck=${this.spellcheck}
50
+ ?autofocus=${this.autofocus}
51
+ inputmode=${r(this.inputmode||void 0)}
52
+ enterkeyhint=${r(this.enterkeyhint)}
53
+ list=${r(this.list||void 0)}
54
+ capture=${r(this.capture?"environment":void 0)}
55
+ .aria-invalid=${String(this.isInvalid)}
56
+ .aria-required=${String(this.required)}
57
+ aria-label=${r(this.ariaLabel||void 0)}
58
+ aria-labelledby=${r(this.ariaLabelledby||void 0)}
59
+ aria-describedby=${r(this.describedById)}
60
+ />
61
+ `,m=()=>i`
62
+ <textarea
63
+ .value=${d(this.value)}
64
+ @input=${this.handleInput}
65
+ @focus=${this.handleFocus}
66
+ @blur=${this.handleBlur}
67
+ ?compact=${this.compact}
68
+ ?disabled=${this.disabled}
69
+ .required=${this.required}
70
+ .rows=${this.rows}
71
+ placeholder=${this.placeholder}
72
+ resizable=${this.resizable||"none"}
73
+ style="width:100%;border:none;outline:none;padding:10px;"
74
+ .autocapitalize=${this.autocapitalize}
75
+ ?spellcheck=${this.spellcheck}
76
+ name=${r(this.name||void 0)}
77
+ .autocomplete=${this.nativeAutocomplete()}
78
+ inputmode=${r(this.inputmode||void 0)}
79
+ enterkeyhint=${r(this.enterkeyhint)}
80
+ minlength=${r(this.minlength??void 0)}
81
+ maxlength=${r(this.maxlength??void 0)}
82
+ ?autofocus=${this.autofocus}
83
+ .aria-invalid=${String(this.isInvalid)}
84
+ .aria-required=${String(this.required)}
85
+ aria-label=${r(this.ariaLabel||void 0)}
86
+ aria-labelledby=${r(this.ariaLabelledby||void 0)}
87
+ aria-describedby=${r(this.describedById)}
88
+ role=${r(this.nativeInputRole())}
89
+ ></textarea>
90
+ `,b=()=>i`
91
+ <input
92
+ .type=${this.nativeTextInputType(a)}
93
+ .value=${d(this.value)}
94
+ @input=${this.handleInput}
95
+ @focus=${this.handleFocus}
96
+ @blur=${this.handleBlur}
97
+ @pointerdown=${this.handleAutofillGuardPointerDown}
98
+ ?compact=${this.compact}
99
+ ?disabled=${this.disabled}
100
+ .required=${this.required}
101
+ .readOnly=${this.readonly||this.autofillGuardActive}
102
+ style="appearance:none;pointer-events:auto;"
103
+ placeholder=${this.placeholder}
104
+ name=${r(this.name||void 0)}
105
+ .autocomplete=${this.nativeAutocomplete()}
106
+ .autocapitalize=${this.autocapitalize}
107
+ spellcheck=${this.spellcheck}
108
+ inputmode=${r(this.nativeInputMode())}
109
+ enterkeyhint=${r(this.nativeEnterKeyHint())}
110
+ data-form-type=${this.isFilterSearchInput()?"other":s}
111
+ ?data-1p-ignore=${this.isFilterSearchInput()}
112
+ ?data-lpignore=${this.isFilterSearchInput()}
113
+ list=${r(this.list||void 0)}
114
+ pattern=${r(this.pattern||void 0)}
115
+ minlength=${r(this.minlength??void 0)}
116
+ maxlength=${r(this.maxlength??void 0)}
117
+ size=${r(this.size??void 0)}
118
+ step=${r(null!==this.step?Number(this.step):void 0)}
119
+ min=${r(this.min??void 0)}
120
+ max=${r(this.max??void 0)}
121
+ ?autofocus=${this.autofocus}
122
+ .aria-invalid=${String(this.isInvalid)}
123
+ .aria-required=${String(this.required)}
124
+ aria-label=${r(this.ariaLabel||void 0)}
125
+ aria-labelledby=${r(this.ariaLabelledby||void 0)}
126
+ aria-describedby=${r(this.describedById)}
127
+ role=${r(this.nativeInputRole())}
128
+ />
129
+ `;return i`
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`
156
+ <div class="number-btn">
157
+ <button
158
+ class="decrement-btn"
159
+ type="button"
160
+ tabindex="-1"
161
+ @mousedown=${this.keepInputFocused}
162
+ @pointerdown=${this.keepInputFocused}
163
+ @click=${t=>{t.stopPropagation(),this.decrementValue()}}
164
+ aria-label="Decrease value"
165
+ >
166
+ <sky-icon icon="ion:minus"></sky-icon>
167
+ </button>
168
+ <button
169
+ class="increment-btn"
170
+ type="button"
171
+ tabindex="-1"
172
+ @mousedown=${this.keepInputFocused}
173
+ @pointerdown=${this.keepInputFocused}
174
+ @click=${t=>{t.stopPropagation(),this.incrementValue()}}
175
+ aria-label="Increase value"
176
+ >
177
+ <sky-icon icon="ion:add"></sky-icon>
178
+ </button>
179
+ </div>
180
+ `:null)()} ${(()=>a&&this.showPasswordToggle?i`
181
+ <sky-icon
182
+ class="toggle-password"
183
+ part="toggle-password"
184
+ ?compact=${this.compact}
185
+ icon=${this.showPassword?this.passwordVisibleIcon:this.passwordHiddenIcon}
186
+ @click=${this.togglePasswordVisibility}
187
+ ></sky-icon>
188
+ `:null)()}
189
+ ${(()=>this.clearable&&(this.value||this.selectedFileName||this.selectedFileCount>0)?i`
190
+ <sky-icon
191
+ class="clear-button"
192
+ part="clear-button"
193
+ ?compact=${this.compact}
194
+ @click=${this.handleClear}
195
+ ?loading=${this.loading}
196
+ icon="ion:close"
197
+ ></sky-icon>
198
+ `:null)()} ${(()=>this.loading?i`<div
199
+ class="loading-indicator"
200
+ part="loading-indicator"
201
+ ?compact=${this.compact}
202
+ ></div>`:i`
203
+ <div
204
+ class="icon-slot right ${this.focused?"focused":""}"
205
+ part="icon-slot icon-slot-right"
206
+ ?filled=${Boolean(c&&p)||Boolean(y)||p}
207
+ @click=${()=>{(t||y)&&this.triggerNativeDropdown()}}
208
+ >
209
+ ${c&&p?f():y?h:i`<slot name="icon-right"></slot>`}
210
+ </div>
211
+ `)()}
212
+ </div>
213
+
214
+ ${(()=>t&&this.totalFileSize?i`
215
+ <div class="file-info" part="file-info">
216
+ <span>
217
+ ${this.selectedFileCount}
218
+ file${1!==this.selectedFileCount?"s selected":" selected"} </span
219
+ >,
220
+ <span>${this.formatFileSize(this.totalFileSize)}</span>
221
+ </div>
222
+ `:null)()} ${this.renderValidationErrors()}
223
+ </div>
224
+ `}};m.dependencies={"sky-icon":u},m.styles=t`
2
225
  :host {
3
226
  display: block;
4
227
  font-family: var(--sky-font);
@@ -595,228 +818,5 @@ import{__decorate as t,__metadata as e}from"tslib";import{css as i,LitElement as
595
818
  transition: none;
596
819
  }
597
820
  }
598
- `}static{this.shadowRootOptions={...s.shadowRootOptions,delegatesFocus:!0}}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 i=[];if("single"===this.errorDisplayMode?t?i=[t]:e.length&&(i=[e[0]]):i=t?[t,...e]:e,!i.length)return null;const s=`${this.id||"sky-input"}-errors`;return o`
599
- <div class="progress-message">
600
- <ul id=${s} class="error-list" part="error-list">
601
- ${i.map(t=>o`<li class="error" part="error">${t}</li>`)}
602
- </ul>
603
- </div>
604
- `}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:h(e)}}renderInputAffix(t){const e="prefix"===t?this.prefix:this.suffix;if(!String(e??"").length)return r;const i="prefix"===t?this.prefixColor:this.suffixColor,s=this.affixColorStyle(i);return o`<span
605
- class="input-affix ${t}"
606
- part="input-${t}"
607
- style=${s?n(s):r}
608
- >${e}</span
609
- >`}render(){const t="file"===this.type,e="textarea"===this.type,i="number"===this.type,s="password"===this.type,n=!t&&!e,l=!!this.querySelector('[slot="icon-left"]'),p=!!this.querySelector('[slot="icon-right"]');let d=null;"date"===this.type?d=o`<sky-icon icon="ion:calendar"></sky-icon>`:"time"===this.type?d=o`<sky-icon icon="ion:time"></sky-icon>`:"week"===this.type||"month"===this.type?d=o`<sky-icon icon="ion:calendar"></sky-icon>`:"datetime-local"===this.type&&(d=o`<sky-icon icon="ion:time"></sky-icon>`);const c=this.filePreview&&(l||p),h="left"===this.autofillIconSlot&&d,y="right"===this.autofillIconSlot&&d,v=()=>o`
610
- <img
611
- src=${a("string"==typeof this.filePreview?this.filePreview:void 0)}
612
- alt="Preview"
613
- style="width:100%;height:100%;object-fit:cover;border-radius:12px;"
614
- />
615
- `,f=()=>o`
616
- <label
617
- class="custom-file-label"
618
- part="custom-file-label"
619
- for="fileInput"
620
- ?disabled=${this.disabled}
621
- >
622
- ${this.renderInputAffix("prefix")}
623
- <span
624
- class="custom-file-label__text"
625
- part="custom-file-label-text"
626
- ?data-filled=${Boolean(this.selectedFileName)}
627
- >
628
- ${this.selectedFileName||this.placeholder||"Choose file"}
629
- </span>
630
- ${this.renderInputAffix("suffix")}
631
- </label>
632
-
633
- <input
634
- id="fileInput"
635
- type="file"
636
- @change=${this.handleFileChange}
637
- ?disabled=${this.disabled}
638
- accept=${this.accept||""}
639
- ?multiple=${this.multiple}
640
- .required=${this.required}
641
- @keydown=${this.handleKeydown}
642
- .dir=${this.dir}
643
- name=${a(this.name||void 0)}
644
- .autocomplete=${this.nativeAutocomplete()}
645
- .autocapitalize=${this.autocapitalize}
646
- spellcheck=${this.spellcheck}
647
- ?autofocus=${this.autofocus}
648
- inputmode=${a(this.inputmode||void 0)}
649
- enterkeyhint=${a(this.enterkeyhint)}
650
- list=${a(this.list||void 0)}
651
- capture=${a(this.capture?"environment":void 0)}
652
- .aria-invalid=${String(this.isInvalid)}
653
- .aria-required=${String(this.required)}
654
- aria-label=${a(this.ariaLabel||void 0)}
655
- aria-labelledby=${a(this.ariaLabelledby||void 0)}
656
- aria-describedby=${a(this.describedById)}
657
- />
658
- `,b=()=>o`
659
- <textarea
660
- .value=${u(this.value)}
661
- @input=${this.handleInput}
662
- @focus=${this.handleFocus}
663
- @blur=${this.handleBlur}
664
- ?compact=${this.compact}
665
- ?disabled=${this.disabled}
666
- .required=${this.required}
667
- .rows=${this.rows}
668
- placeholder=${this.placeholder}
669
- resizable=${this.resizable||"none"}
670
- style="width:100%;border:none;outline:none;padding:10px;"
671
- .autocapitalize=${this.autocapitalize}
672
- ?spellcheck=${this.spellcheck}
673
- name=${a(this.name||void 0)}
674
- .autocomplete=${this.nativeAutocomplete()}
675
- inputmode=${a(this.inputmode||void 0)}
676
- enterkeyhint=${a(this.enterkeyhint)}
677
- minlength=${a(this.minlength??void 0)}
678
- maxlength=${a(this.maxlength??void 0)}
679
- ?autofocus=${this.autofocus}
680
- .aria-invalid=${String(this.isInvalid)}
681
- .aria-required=${String(this.required)}
682
- aria-label=${a(this.ariaLabel||void 0)}
683
- aria-labelledby=${a(this.ariaLabelledby||void 0)}
684
- aria-describedby=${a(this.describedById)}
685
- role=${a(this.nativeInputRole())}
686
- ></textarea>
687
- `,g=()=>o`
688
- <input
689
- .type=${this.nativeTextInputType(s)}
690
- .value=${u(this.value)}
691
- @input=${this.handleInput}
692
- @focus=${this.handleFocus}
693
- @blur=${this.handleBlur}
694
- @pointerdown=${this.handleAutofillGuardPointerDown}
695
- ?compact=${this.compact}
696
- ?disabled=${this.disabled}
697
- .required=${this.required}
698
- .readOnly=${this.readonly||this.autofillGuardActive}
699
- style="appearance:none;pointer-events:auto;"
700
- placeholder=${this.placeholder}
701
- name=${a(this.name||void 0)}
702
- .autocomplete=${this.nativeAutocomplete()}
703
- .autocapitalize=${this.autocapitalize}
704
- spellcheck=${this.spellcheck}
705
- inputmode=${a(this.nativeInputMode())}
706
- enterkeyhint=${a(this.nativeEnterKeyHint())}
707
- data-form-type=${this.isFilterSearchInput()?"other":r}
708
- ?data-1p-ignore=${this.isFilterSearchInput()}
709
- ?data-lpignore=${this.isFilterSearchInput()}
710
- list=${a(this.list||void 0)}
711
- pattern=${a(this.pattern||void 0)}
712
- minlength=${a(this.minlength??void 0)}
713
- maxlength=${a(this.maxlength??void 0)}
714
- size=${a(this.size??void 0)}
715
- step=${a(null!==this.step?Number(this.step):void 0)}
716
- min=${a(this.min??void 0)}
717
- max=${a(this.max??void 0)}
718
- ?autofocus=${this.autofocus}
719
- .aria-invalid=${String(this.isInvalid)}
720
- .aria-required=${String(this.required)}
721
- aria-label=${a(this.ariaLabel||void 0)}
722
- aria-labelledby=${a(this.ariaLabelledby||void 0)}
723
- aria-describedby=${a(this.describedById)}
724
- role=${a(this.nativeInputRole())}
725
- />
726
- `;return o`
727
- <div
728
- class="input-container"
729
- @click=${this.handleWrapperClick}
730
- part="input-container"
731
- >
732
- ${this.label?o`<div class="label" part="label">${this.label}</div>`:null}
733
- <div
734
- class="input-wrapper"
735
- part="input-wrapper"
736
- ?compact=${this.compact}
737
- ?loading=${this.loading}
738
- >
739
- ${(()=>o`
740
- <div
741
- class="icon-slot left ${this.focused?"focused":""}"
742
- part="icon-slot icon-slot-left"
743
- ?filled=${Boolean(c&&l)||Boolean(h)||l}
744
- @click=${()=>{(t||h)&&this.triggerNativeDropdown()}}
745
- >
746
- ${c&&l?v():h?d:o`<slot name="icon-left"></slot>`}
747
- </div>
748
- `)()}
749
- ${n?this.renderInputAffix("prefix"):r}
750
- ${t?f():e?b():g()}
751
- ${n?this.renderInputAffix("suffix"):r}
752
- ${(()=>i&&this.showNumberButtons?o`
753
- <div class="number-btn">
754
- <button
755
- class="decrement-btn"
756
- type="button"
757
- tabindex="-1"
758
- @mousedown=${this.keepInputFocused}
759
- @pointerdown=${this.keepInputFocused}
760
- @click=${t=>{t.stopPropagation(),this.decrementValue()}}
761
- aria-label="Decrease value"
762
- >
763
- <sky-icon icon="ion:minus"></sky-icon>
764
- </button>
765
- <button
766
- class="increment-btn"
767
- type="button"
768
- tabindex="-1"
769
- @mousedown=${this.keepInputFocused}
770
- @pointerdown=${this.keepInputFocused}
771
- @click=${t=>{t.stopPropagation(),this.incrementValue()}}
772
- aria-label="Increase value"
773
- >
774
- <sky-icon icon="ion:add"></sky-icon>
775
- </button>
776
- </div>
777
- `:null)()} ${(()=>s&&this.showPasswordToggle?o`
778
- <sky-icon
779
- class="toggle-password"
780
- part="toggle-password"
781
- ?compact=${this.compact}
782
- icon=${this.showPassword?this.passwordVisibleIcon:this.passwordHiddenIcon}
783
- @click=${this.togglePasswordVisibility}
784
- ></sky-icon>
785
- `:null)()}
786
- ${(()=>this.clearable&&(this.value||this.selectedFileName||this.selectedFileCount>0)?o`
787
- <sky-icon
788
- class="clear-button"
789
- part="clear-button"
790
- ?compact=${this.compact}
791
- @click=${this.handleClear}
792
- ?loading=${this.loading}
793
- icon="ion:close"
794
- ></sky-icon>
795
- `:null)()} ${(()=>this.loading?o`<div
796
- class="loading-indicator"
797
- part="loading-indicator"
798
- ?compact=${this.compact}
799
- ></div>`:o`
800
- <div
801
- class="icon-slot right ${this.focused?"focused":""}"
802
- part="icon-slot icon-slot-right"
803
- ?filled=${Boolean(c&&p)||Boolean(y)||p}
804
- @click=${()=>{(t||y)&&this.triggerNativeDropdown()}}
805
- >
806
- ${c&&p?v():y?d:o`<slot name="icon-right"></slot>`}
807
- </div>
808
- `)()}
809
- </div>
810
-
811
- ${(()=>t&&this.totalFileSize?o`
812
- <div class="file-info" part="file-info">
813
- <span>
814
- ${this.selectedFileCount}
815
- file${1!==this.selectedFileCount?"s selected":" selected"} </span
816
- >,
817
- <span>${this.formatFileSize(this.totalFileSize)}</span>
818
- </div>
819
- `:null)()} ${this.renderValidationErrors()}
820
- </div>
821
- `}};t([l({type:String}),e("design:type",Object)],f.prototype,"value",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"placeholder",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"label",void 0),t([l({type:String}),e("design:type",String)],f.prototype,"type",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"suffix",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"prefix",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"prefixColor",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"suffixColor",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"color",void 0),t([l({type:Array}),e("design:type",Object),e("design:paramtypes",[Object])],f.prototype,"validations",null),t([l({type:Boolean,reflect:!0}),e("design:type",Object)],f.prototype,"compact",void 0),t([l({type:Boolean,reflect:!0}),e("design:type",Object)],f.prototype,"loading",void 0),t([l({type:Boolean}),e("design:type",Object)],f.prototype,"showErrors",void 0),t([l({type:Boolean,reflect:!0}),e("design:type",Object)],f.prototype,"clearable",void 0),t([l({type:String}),e("design:type",String)],f.prototype,"errorDisplayMode",void 0),t([l({type:Boolean,reflect:!0}),e("design:type",Object)],f.prototype,"required",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"step",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"min",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"max",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"autocapitalize",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"autocomplete",void 0),t([l({type:Boolean}),e("design:type",Object)],f.prototype,"spellcheck",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"dir",void 0),t([l({type:Number}),e("design:type",Object)],f.prototype,"rows",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"resizable",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"accept",void 0),t([l({type:Boolean}),e("design:type",Object)],f.prototype,"multiple",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"inputmode",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"enterkeyhint",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"pattern",void 0),t([l({type:Number}),e("design:type",Object)],f.prototype,"minlength",void 0),t([l({type:Number}),e("design:type",Object)],f.prototype,"maxlength",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"list",void 0),t([l({type:Number}),e("design:type",Object)],f.prototype,"size",void 0),t([l({type:Number}),e("design:type",Object)],f.prototype,"cols",void 0),t([l({type:Boolean}),e("design:type",Object)],f.prototype,"autofocus",void 0),t([l({type:Boolean}),e("design:type",Object)],f.prototype,"capture",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"inputRole",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"ariaLabel",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"ariaLabelledby",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"ariaDescribedby",void 0),t([l({type:Boolean}),e("design:type",Object)],f.prototype,"showNumberButtons",void 0),t([l({type:Boolean}),e("design:type",Object)],f.prototype,"showPasswordToggle",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"passwordVisibleIcon",void 0),t([l({type:String}),e("design:type",Object)],f.prototype,"passwordHiddenIcon",void 0),t([l({type:Boolean,reflect:!0}),e("design:type",Object)],f.prototype,"validationActive",void 0),t([l({type:Boolean,reflect:!0}),e("design:type",Object)],f.prototype,"invalid",void 0),t([l({type:String,reflect:!0}),e("design:type",Object)],f.prototype,"variant",void 0),t([p(),e("design:type",Object)],f.prototype,"selectedFileName",void 0),t([p(),e("design:type",Array)],f.prototype,"selectedFiles",void 0),t([p(),e("design:type",Object)],f.prototype,"focused",void 0),t([p(),e("design:type",Array)],f.prototype,"validationStatus",void 0),t([p(),e("design:type",Array)],f.prototype,"validationErrors",void 0),t([p(),e("design:type",Object)],f.prototype,"typingStarted",void 0),t([p(),e("design:type",Object)],f.prototype,"autofillIconSlot",void 0),t([p(),e("design:type",Object)],f.prototype,"autofillGuardActive",void 0),t([p(),e("design:type",Object)],f.prototype,"showPassword",void 0),t([p(),e("design:type",Object)],f.prototype,"totalFileSize",void 0),t([p(),e("design:type",Object)],f.prototype,"selectedFileCount",void 0),t([p(),e("design:type",Object)],f.prototype,"filePreview",void 0),t([d(".input-wrapper"),e("design:type",HTMLElement)],f.prototype,"inputWrapperEl",void 0),t([d("input, textarea"),e("design:type",Object)],f.prototype,"nativeInputEl",void 0),f=t([c("sky-input")],f);export{f as SkyInput};
821
+ `,m.shadowRootOptions={...e.shadowRootOptions,delegatesFocus:!0},v([a({type:String})],m.prototype,"value",2),v([a({type:String})],m.prototype,"placeholder",2),v([a({type:String})],m.prototype,"label",2),v([a({type:String})],m.prototype,"type",2),v([a({type:String})],m.prototype,"suffix",2),v([a({type:String})],m.prototype,"prefix",2),v([a({type:String})],m.prototype,"prefixColor",2),v([a({type:String})],m.prototype,"suffixColor",2),v([a({type:String})],m.prototype,"color",2),v([a({type:Array})],m.prototype,"validations",1),v([a({type:Boolean,reflect:!0})],m.prototype,"compact",2),v([a({type:Boolean,reflect:!0})],m.prototype,"loading",2),v([a({type:Boolean})],m.prototype,"showErrors",2),v([a({type:Boolean,reflect:!0})],m.prototype,"clearable",2),v([a({type:String})],m.prototype,"errorDisplayMode",2),v([a({type:Boolean,reflect:!0})],m.prototype,"required",2),v([a({type:String})],m.prototype,"step",2),v([a({type:String})],m.prototype,"min",2),v([a({type:String})],m.prototype,"max",2),v([a({type:String})],m.prototype,"autocapitalize",2),v([a({type:String})],m.prototype,"autocomplete",2),v([a({type:Boolean})],m.prototype,"spellcheck",2),v([a({type:String})],m.prototype,"dir",2),v([a({type:Number})],m.prototype,"rows",2),v([a({type:String})],m.prototype,"resizable",2),v([a({type:String})],m.prototype,"accept",2),v([a({type:Boolean})],m.prototype,"multiple",2),v([a({type:String})],m.prototype,"inputmode",2),v([a({type:String})],m.prototype,"enterkeyhint",2),v([a({type:String})],m.prototype,"pattern",2),v([a({type:Number})],m.prototype,"minlength",2),v([a({type:Number})],m.prototype,"maxlength",2),v([a({type:String})],m.prototype,"list",2),v([a({type:Number})],m.prototype,"size",2),v([a({type:Number})],m.prototype,"cols",2),v([a({type:Boolean})],m.prototype,"autofocus",2),v([a({type:Boolean})],m.prototype,"capture",2),v([a({type:String})],m.prototype,"inputRole",2),v([a({type:String})],m.prototype,"ariaLabel",2),v([a({type:String})],m.prototype,"ariaLabelledby",2),v([a({type:String})],m.prototype,"ariaDescribedby",2),v([a({type:Boolean})],m.prototype,"showNumberButtons",2),v([a({type:Boolean})],m.prototype,"showPasswordToggle",2),v([a({type:String})],m.prototype,"passwordVisibleIcon",2),v([a({type:String})],m.prototype,"passwordHiddenIcon",2),v([a({type:Boolean,reflect:!0})],m.prototype,"validationActive",2),v([a({type:Boolean,reflect:!0})],m.prototype,"invalid",2),v([a({type:String,reflect:!0})],m.prototype,"variant",2),v([n()],m.prototype,"selectedFileName",2),v([n()],m.prototype,"selectedFiles",2),v([n()],m.prototype,"focused",2),v([n()],m.prototype,"validationStatus",2),v([n()],m.prototype,"validationErrors",2),v([n()],m.prototype,"typingStarted",2),v([n()],m.prototype,"autofillIconSlot",2),v([n()],m.prototype,"autofillGuardActive",2),v([n()],m.prototype,"showPassword",2),v([n()],m.prototype,"totalFileSize",2),v([n()],m.prototype,"selectedFileCount",2),v([n()],m.prototype,"filePreview",2),v([l(".input-wrapper")],m.prototype,"inputWrapperEl",2),v([l("input, textarea")],m.prototype,"nativeInputEl",2),m=v([p("sky-input")],m);export{m as SkyInput};
822
822
  //# sourceMappingURL=sky-input.js.map