@descope/web-components-ui 1.0.78 → 1.0.80
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/index.esm.js +954 -607
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/387.js +1 -0
- package/dist/umd/878.js +1 -1
- package/dist/umd/988.js +1 -0
- package/dist/umd/descope-button-index-js.js +1 -1
- package/dist/umd/descope-checkbox-index-js.js +1 -1
- package/dist/umd/descope-combo-box-index-js.js +1 -1
- package/dist/umd/descope-container-index-js.js +1 -1
- package/dist/umd/descope-date-picker-index-js.js +1 -1
- package/dist/umd/descope-divider-index-js.js +1 -1
- package/dist/umd/descope-email-field-index-js.js +1 -1
- package/dist/umd/descope-image-index-js.js +1 -1
- package/dist/umd/descope-link-index-js.js +1 -1
- package/dist/umd/descope-loader-linear-index-js.js +1 -1
- package/dist/umd/descope-loader-radial-index-js.js +1 -1
- package/dist/umd/descope-logo-index-js.js +1 -1
- package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js +1 -0
- package/dist/umd/descope-new-password-index-js.js +1 -0
- package/dist/umd/descope-number-field-index-js.js +1 -1
- package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +1 -1
- package/dist/umd/descope-passcode-index-js.js +1 -1
- package/dist/umd/descope-password-field-index-js.js +1 -1
- package/dist/umd/descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
- package/dist/umd/descope-phone-field-index-js.js +1 -1
- package/dist/umd/descope-switch-toggle-index-js.js +1 -1
- package/dist/umd/descope-text-area-index-js.js +1 -1
- package/dist/umd/descope-text-field-index-js.js +1 -1
- package/dist/umd/descope-text-index-js.js +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +1 -1
- package/src/baseClasses/createBaseInputClass.js +1 -2
- package/src/components/descope-new-password/NewPassword.js +129 -0
- package/src/components/descope-new-password/descope-new-password-internal/NewPasswordInternal.js +189 -0
- package/src/components/descope-new-password/descope-new-password-internal/componentName.js +3 -0
- package/src/components/descope-new-password/descope-new-password-internal/index.js +4 -0
- package/src/components/descope-new-password/index.js +6 -0
- package/src/components/descope-passcode/descope-passcode-internal/PasscodeInternal.js +2 -2
- package/src/components/descope-password-field/PasswordField.js +35 -36
- package/src/components/descope-phone-field/PhoneField.js +3 -2
- package/src/components/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +1 -1
- package/src/index.js +1 -0
- package/src/mixins/createProxy.js +1 -23
- package/src/mixins/index.js +0 -1
- package/src/mixins/inputEventsDispatchingMixin.js +48 -31
- package/src/mixins/inputValidationMixin.js +6 -2
- package/src/mixins/proxyInputMixin.js +6 -36
- package/src/theme/components/index.js +3 -1
- package/src/theme/components/newPassword.js +48 -0
- package/src/theme/components/passwordField.js +55 -3
- package/dist/umd/933.js +0 -1
- package/src/mixins/focusMixin.js +0 -23
@@ -64,21 +64,6 @@ export const proxyInputMixin = (superclass) =>
|
|
64
64
|
return this.inputElement.validity
|
65
65
|
}
|
66
66
|
|
67
|
-
reportValidityOnInternalInput() {
|
68
|
-
setTimeout(() => {
|
69
|
-
this.inputElement.focus();
|
70
|
-
this.inputElement.reportValidity()
|
71
|
-
})
|
72
|
-
}
|
73
|
-
|
74
|
-
// we want reportValidity to behave like form submission
|
75
|
-
reportValidity() {
|
76
|
-
if (!this.checkValidity()) {
|
77
|
-
this.setAttribute('invalid', 'true');
|
78
|
-
this.reportValidityOnInternalInput();
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
67
|
handleInternalInputErrorMessage() {
|
83
68
|
if (!this.inputElement.checkValidity()) {
|
84
69
|
this.inputElement.setCustomValidity(this.validationMessage)
|
@@ -120,30 +105,15 @@ export const proxyInputMixin = (superclass) =>
|
|
120
105
|
}
|
121
106
|
})
|
122
107
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
if (e.relatedTarget?.form && e.relatedTarget?.form === this.form && e.relatedTarget?.nodeName === 'BUTTON') {
|
128
|
-
if (!this.checkValidity()) {
|
129
|
-
this.setAttribute('invalid', 'true');
|
130
|
-
}
|
131
|
-
|
132
|
-
if (this.hasAttribute('invalid')) {
|
133
|
-
this.reportValidityOnInternalInput()
|
134
|
-
}
|
108
|
+
|
109
|
+
this.addEventListener('invalid', () => {
|
110
|
+
if (!this.checkValidity()) {
|
111
|
+
this.setAttribute('invalid', 'true');
|
135
112
|
}
|
113
|
+
this.#handleErrorMessage()
|
136
114
|
})
|
137
115
|
|
138
|
-
this.
|
139
|
-
|
140
|
-
this.handleInternalInputErrorMessage()
|
141
|
-
|
142
|
-
// this is needed in order to make sure the form input validation is working
|
143
|
-
// we do not want it to happen when the component is nested
|
144
|
-
if (!this.hasAttribute('tabindex') && this.getRootNode() === document) {
|
145
|
-
this.setAttribute('tabindex', 0);
|
146
|
-
}
|
116
|
+
this.handleInternalInputErrorMessage();
|
147
117
|
|
148
118
|
// sync properties
|
149
119
|
propertyObserver(this, this.inputElement, 'value');
|
@@ -16,6 +16,7 @@ import { loaderRadial, loaderLinear } from './loader';
|
|
16
16
|
import comboBox from './comboBox';
|
17
17
|
import image from './image';
|
18
18
|
import phoneField from './phoneField';
|
19
|
+
import newPassword from './newPassword';
|
19
20
|
|
20
21
|
export default {
|
21
22
|
button,
|
@@ -36,5 +37,6 @@ export default {
|
|
36
37
|
loaderLinear,
|
37
38
|
comboBox,
|
38
39
|
image,
|
39
|
-
phoneField
|
40
|
+
phoneField,
|
41
|
+
newPassword,
|
40
42
|
};
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import globals from '../globals';
|
2
|
+
import { getThemeRefs } from '../../helpers/themeHelpers';
|
3
|
+
import NewPassword from '../../components/descope-new-password/NewPassword';
|
4
|
+
|
5
|
+
const globalRefs = getThemeRefs(globals);
|
6
|
+
|
7
|
+
const vars = NewPassword.cssVarList;
|
8
|
+
|
9
|
+
const newPassword = {
|
10
|
+
_required: {
|
11
|
+
[vars.requiredContent]: "'*'",
|
12
|
+
},
|
13
|
+
|
14
|
+
[vars.inputLabelTextColor]: globalRefs.colors.surface.contrast,
|
15
|
+
[vars.inputTextColor]: globalRefs.colors.surface.contrast,
|
16
|
+
[vars.placeholderTextColor]: globalRefs.colors.surface.main,
|
17
|
+
[vars.inputsGap]: '1em',
|
18
|
+
|
19
|
+
size: {
|
20
|
+
xs: {
|
21
|
+
[vars.fieldsMargin]: '0',
|
22
|
+
},
|
23
|
+
sm: {
|
24
|
+
[vars.fieldsMargin]: '0',
|
25
|
+
},
|
26
|
+
md: {
|
27
|
+
[vars.fieldsMargin]: '0.5em',
|
28
|
+
},
|
29
|
+
lg: {
|
30
|
+
[vars.fieldsMargin]: '1em',
|
31
|
+
},
|
32
|
+
xl: {
|
33
|
+
[vars.fieldsMargin]: '2em',
|
34
|
+
},
|
35
|
+
},
|
36
|
+
|
37
|
+
_fullWidth: {
|
38
|
+
[vars.componentWidth]: '100%'
|
39
|
+
},
|
40
|
+
|
41
|
+
_invalid: {
|
42
|
+
[vars.inputLabelTextColor]: globalRefs.colors.error.main,
|
43
|
+
[vars.inputTextColor]: globalRefs.colors.error.main,
|
44
|
+
[vars.placeholderTextColor]: globalRefs.colors.error.light,
|
45
|
+
}
|
46
|
+
};
|
47
|
+
|
48
|
+
export default newPassword;
|
@@ -1,11 +1,63 @@
|
|
1
1
|
import PasswordField from '../../components/descope-password-field/PasswordField';
|
2
|
-
import
|
2
|
+
import globals from '../globals';
|
3
|
+
import { getThemeRefs } from '../../helpers/themeHelpers';
|
4
|
+
|
5
|
+
const globalRefs = getThemeRefs(globals);
|
3
6
|
|
4
7
|
const vars = PasswordField.cssVarList;
|
5
8
|
|
6
9
|
const passwordField = {
|
7
|
-
|
8
|
-
[vars.
|
10
|
+
[vars.wrapperBorderStyle]: 'solid',
|
11
|
+
[vars.wrapperBorderWidth]: '1px',
|
12
|
+
[vars.wrapperBorderColor]: 'transparent',
|
13
|
+
[vars.wrapperBorderRadius]: globalRefs.radius.sm,
|
14
|
+
|
15
|
+
[vars.labelTextColor]: globalRefs.colors.surface.contrast,
|
16
|
+
[vars.inputTextColor]: globalRefs.colors.surface.contrast,
|
17
|
+
[vars.placeholderTextColor]: globalRefs.colors.surface.main,
|
18
|
+
|
19
|
+
[vars.pointerCursor]: 'pointer',
|
20
|
+
|
21
|
+
[vars.padding]: `0`,
|
22
|
+
|
23
|
+
size: {
|
24
|
+
xs: {
|
25
|
+
[vars.height]: '14px',
|
26
|
+
[vars.fontSize]: '8px',
|
27
|
+
},
|
28
|
+
sm: {
|
29
|
+
[vars.height]: '20px',
|
30
|
+
[vars.fontSize]: '10px',
|
31
|
+
},
|
32
|
+
md: {
|
33
|
+
[vars.height]: '30px',
|
34
|
+
[vars.fontSize]: '14px',
|
35
|
+
},
|
36
|
+
lg: {
|
37
|
+
[vars.height]: '40px',
|
38
|
+
[vars.fontSize]: '20px',
|
39
|
+
},
|
40
|
+
xl: {
|
41
|
+
[vars.height]: '50px',
|
42
|
+
[vars.fontSize]: '25px',
|
43
|
+
}
|
44
|
+
},
|
45
|
+
|
46
|
+
_bordered: {
|
47
|
+
[vars.padding]: `0 0.5em`,
|
48
|
+
[vars.wrapperBorderColor]: globalRefs.colors.surface.main
|
49
|
+
},
|
50
|
+
|
51
|
+
_fullWidth: {
|
52
|
+
[vars.width]: '100%'
|
53
|
+
},
|
54
|
+
|
55
|
+
_invalid: {
|
56
|
+
[vars.labelTextColor]: globalRefs.colors.error.main,
|
57
|
+
[vars.inputTextColor]: globalRefs.colors.error.main,
|
58
|
+
[vars.placeholderTextColor]: globalRefs.colors.error.light,
|
59
|
+
[vars.wrapperBorderColor]: globalRefs.colors.error.main
|
60
|
+
},
|
9
61
|
};
|
10
62
|
|
11
63
|
export default passwordField;
|
package/dist/umd/933.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[933],{693:(t,e,s)=>{s.d(e,{s:()=>o});var i=s(2061),n=s(357);const r=t=>class extends t{init(){super.init?.(),this.baseElement.addEventListener("mouseover",(t=>{this.setAttribute("hover","true"),t.target.addEventListener("mouseleave",(()=>this.removeAttribute("hover")),{once:!0})}))}};var a=s(8084);const o=({componentName:t,baseSelector:e=""})=>{class s extends HTMLElement{static get componentName(){return t}#t;#e=!0;get baseSelector(){return e}get baseElement(){return this.#t??=this.baseSelector?this.rootElement.querySelector(this.baseSelector):this,this.#t||console.warn("missing base element for component",this.localName),this.#t}get rootElement(){return this.shadowRoot||this}connectedCallback(){super.connectedCallback?.(),this.rootElement.isConnected&&this.#e&&(this.#e=!1,this.init?.())}}return(0,i.qC)(n.A,r,a.Q)(s)}},5279:(t,e,s)=>{s.d(e,{gh:()=>i,k4:()=>n,qM:()=>a,qg:()=>r});const i="descope",n=3,r="host",a="@"},4567:(t,e,s)=>{s.d(e,{Db:()=>d,FX:()=>r,P$:()=>a,Tk:()=>c,iY:()=>h,oP:()=>u,tg:()=>l});var i=s(2061),n=s(5279);const r=(t,e,{excludeAttrs:s=[],includeAttrs:i=[]})=>{const n=Array.from(t.attributes).filter((t=>!s.includes(t.name)&&(!i.length||i.includes(t.name)))).map((t=>t.name));e(n),new MutationObserver((t=>{for(const n of t)"attributes"!==n.type||s.includes(n.attributeName)||i.length&&!i.includes(n.attributeName)||e([n.attributeName])})).observe(t,{attributes:!0})},a=(t,e)=>{e({addedNodes:Array.from(t.children),removedNodes:[]}),new MutationObserver((t=>{for(const s of t)"childList"===s.type&&e(s)})).observe(t,{childList:!0})},o=(t,e,s={})=>i=>{i.forEach((i=>{const n=s[i]||i,r=t.getAttribute(i);null!==r?e.getAttribute(n)!==r&&e.setAttribute(n,r):e.removeAttribute(n)}))},l=(t,e,s)=>{r(t,o(t,e),s),r(e,o(e,t),s)},h=t=>(0,i.E3)(n.gh,t),c=(...t)=>`--${(0,i.E3)(...t)}`,u=(t,e,s={})=>{r(t,o(t,e,s.mapAttrs),s)},d=(t,e,s=[])=>{if(!s.length)return;const i=s.reduce(((t,s)=>Object.assign(t,{[s]:{get:()=>e[s],set(t){e[s]=t}}})),{});Object.defineProperties(t,i)}},2061:(t,e,s)=>{s.d(e,{E3:()=>n,GL:()=>i,mf:()=>a,qC:()=>r});const i=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),n=(...t)=>i(t.filter((t=>!!t)).join("-")),r=(...t)=>e=>t.reduceRight(((t,e)=>e(t)),e),a=t=>"function"==typeof t},7878:(t,e,s)=>{function i(t,e={}){const s=new Event(t,e);this[`on${t}`]?.(s),this.dispatchEvent(s)}s.d(e,{C:()=>i})},357:(t,e,s)=>{s.d(e,{A:()=>i});const i=t=>class extends t{#s(){const e=this.localName;if(!t.componentName)throw Error('component name is not defined on super class, make sure you have a static get for "componentName"');if(e!==t.componentName)throw Error(`component name mismatch, expected "${t.componentName}", current "${e}"`)}init(){super.init?.(),this.#s()}}},1933:(t,e,s)=>{s.d(e,{li:()=>C,Ae:()=>A.A,DM:()=>p,yk:()=>c,e4:()=>u,pY:()=>S,mE:()=>x,wX:()=>b,QT:()=>T.Q,Iw:()=>M,dj:()=>f,P4:()=>L});var i=s(5279),n=s(2061),r=s(4567),a=s(5561);const o=(t,...e)=>`var(${t}${e.length?` , ${o(...e)}`:""})`;class l{constructor(){this.styleMap=new Map}add(t,e,s){this.styleMap.has(t)||this.styleMap.set(t,[]),this.styleMap.set(t,[...this.styleMap.get(t),{property:e,value:s}])}toString(){return Array.from(this.styleMap.entries()).reduce(((t,[e,s])=>t+`${e} { \n${s.map((({property:t,value:e})=>`${t}: ${e}`)).join(";\n")} \n}\n\n`),"")}}const h=(t,e)=>Object.keys(e).reduce(((e,s)=>Object.assign(e,{[s]:(0,r.Tk)(t,s)})),{}),c=({mappings:t={}})=>e=>class extends e{static get cssVarList(){return{...e.cssVarList,...h(e.componentName,{...t})}}#i;#n;#r;#a;#o;#l;#h;#c;constructor({getRootElement:e,componentNameSuffix:s="",themeSection:r=i.qg,baseSelector:a}={}){super(),this.#a=s,this.#o=r,this.#l=e?.(this)||this.shadowRoot,this.#h=a??this.baseSelector,this.#c=Object.keys(t).map((t=>(0,n.E3)("st",s,t)))}get componentTheme(){return a.componentsThemeManager.currentTheme?.[e.componentName]||""}#u(){this.#n.innerHTML=this.componentTheme[this.#o]}#d(){this.#n=document.createElement("style"),this.#n.id="style-mixin-theme",this.#l.prepend(this.#n),this.#r=a.componentsThemeManager.onCurrentThemeChange(this.#u.bind(this)),this.#u()}#m(){this.#i=document.createElement("style"),this.#i.id="style-mixin-overrides";const t=(s=e.componentName,n=i.k4,Array(n).fill(`.${s}`).join(""));var s,n;this.#i.innerText=`:host(${t}) {}`,this.#l.append(this.#i)}#p(t,s){const i=this.#i?.sheet?.cssRules[0].style;if(!i)return;const n=(0,r.Tk)(e.componentName,t.replace(new RegExp("^st-"),""));s?i?.setProperty(n,s):i?.removeProperty(n)}#g(t=[]){for(const e of t)this.#c.includes(e)&&this.#p(e,this.getAttribute(e));this.#i.innerHTML=this.#i?.sheet?.cssRules[0].cssText}#b(){const s=document.createElement("style");s.id="style-mixin-mappings",s.innerHTML=((t,e,s)=>{const i=new l;return Object.keys(s).forEach((a=>{const l=((t,e)=>{const s={selector:"",property:(0,n.GL)(t)};return e&&Object.keys(e).length?Array.isArray(e)?e.map((t=>Object.assign({},s,t))):[Object.assign({},s,e)]:[s]})(a,s[a]),h=(0,r.Tk)(t,a);l.forEach((({selector:t,property:s})=>{i.add(((t="",e="")=>(0,n.mf)(e)?e(t):`${t}${/^[A-Za-z]/.test(e)?` ${e}`:e}`)(e,t),(0,n.mf)(s)?s():s,o(h))}))})),i.toString()})((0,n.E3)(e.componentName,this.#a),this.#h,t),this.#l.prepend(s)}#E(t){(this.#l.classList||this.#l.host.classList).add(t)}init(){super.init?.(),this.shadowRoot.isConnected&&(this.#E(e.componentName),this.#b(),this.#d(),this.#m(),(0,r.FX)(this,this.#g.bind(this),{}))}disconnectedCallback(){super.disconnectedCallback?.(),this.#r?.()}},u=t=>class extends t{#y=null;static get observedAttributes(){return[...t.observedAttributes||[],"draggable"]}constructor(){super(),this.#y=document.createElement("style"),this.#y.innerText="* { cursor: inherit!important }"}#v(t){t?this.shadowRoot.appendChild(this.#y):this.#y.remove()}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),"draggable"===t&&this.#v("true"===s)}};var d=s(693),m=s(7878);const p=({componentName:t,wrappedEleName:e,slots:s=[],style:i,excludeAttrsSync:a=[],includeAttrsSync:o=[],includeForwardProps:l=[]})=>{class h extends((0,d.s)({componentName:t,baseSelector:e})){#f=m.C.bind(this,"blur");#A=m.C.bind(this,"focus");constructor(){super().attachShadow({mode:"open"}).innerHTML=`\n\t\t\t<style id="create-proxy">${(0,n.mf)(i)?i():i}</style>\n\t\t\t<${e}>\n\t\t\t<slot></slot>\n\t\t\t${s.map((t=>`<slot name="${t}" slot="${t}"></slot>`)).join("")}\n\t\t\t</${e}>\n\t\t`}focus=()=>this.baseElement.focus();init(){super.init?.(),this.baseElement.addEventListener("blur",(t=>{this.#f()})),this.baseElement.addEventListener("focus",(t=>{this.#A()})),this.addEventListener("focus",(t=>{t.isTrusted&&this.focus()})),(0,r.Db)(this,this.baseElement,l),this.baseElement.onkeydown=t=>{t.shiftKey&&9===t.keyCode&&this.getRootNode()===document&&(this.removeAttribute("tabindex"),setTimeout((()=>this.setAttribute("tabindex","0")),0))},(0,r.tg)(this.baseElement,this,{excludeAttrs:a,includeAttrs:o})}}return h},g=["required","pattern"],b=t=>class extends t{static get observedAttributes(){return[...t.observedAttributes||[],...g]}static get formAssociated(){return!0}#S;constructor(){super(),this.#S=this.attachInternals()}get defaultErrorMsgValueMissing(){return"Please fill out this field."}get defaultErrorMsgPatternMismatch(){return"Please match the requested format."}get defaultErrorMsgTooShort(){return`Minimum length is ${this.getAttribute("minlength")}.`}get defaultErrorMsgTooLong(){return`Maximum length is ${this.getAttribute("maxlength")}. `}getErrorMessage(t){switch(!0){case t.valueMissing:return this.getAttribute("data-errormessage-value-missing")||this.defaultErrorMsgValueMissing;case t.patternMismatch||t.typeMismatch:return this.getAttribute("data-errormessage-pattern-mismatch")||this.defaultErrorMsgPatternMismatch;case t.tooShort:return this.getAttribute("data-errormessage-pattern-mismatch-too-short")||this.defaultErrorMsgTooShort;case t.tooLong:return this.getAttribute("data-errormessage-pattern-mismatch-too-long")||this.defaultErrorMsgTooLong;case t.customError:return this.validationMessage;default:return""}}#M(){const t=this.getValidity();this.#S.setValidity(t,this.getErrorMessage(t))}get validationMessage(){return this.#S.validationMessage}getValidity(){console.warn("getValidity","is not implemented")}checkValidity(){return this.#S.validity.valid}reportValidity(){return this.#S.reportValidity()}get validity(){return this.#S.validity}setCustomValidity(t){t?this.#S.setValidity({customError:!0},t):(this.#S.setValidity({}),this.#M())}get isRequired(){return this.hasAttribute("required")&&"false"!==this.getAttribute("required")}get pattern(){return this.getAttribute("pattern")}get form(){return this.#S.form}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),g.includes(t)&&this.#M()}init(){super.init?.(),this.addEventListener("change",this.#M),this.addEventListener("invalid",(t=>t.stopPropagation())),this.addEventListener("input",this.#M),setTimeout((()=>this.#M()))}},E=["invalid","required"],y=(t,e,s)=>{Object.defineProperty(t,s,{set:function(t){return e[s]=t},get:function(){return e[s]},configurable:!0})},v=t=>{if(!t)return;let e=t;for(let t=0;t<10;t++)if(e=e.assignedElements()[0],"slot"!==e.localName)return e},f=t=>class extends(b(t)){static get observedAttributes(){return[...t.observedAttributes||[],...E]}#C;#T=m.C.bind(this,"change");constructor(){super(),this.#C=super.inputElement}get inputElement(){const t=this.baseElement.shadowRoot.querySelector('slot[name="input"]'),e=this.baseElement.shadowRoot.querySelector('slot[name="textarea"]');if(this.#C??=v(t)||v(e),!this.#C)throw Error("no input was found");return this.#C}set inputElement(t){this.#C=t}getValidity(){return this.inputElement.validity}reportValidityOnInternalInput(){setTimeout((()=>{this.inputElement.focus(),this.inputElement.reportValidity()}))}reportValidity(){this.checkValidity()||(this.setAttribute("invalid","true"),this.reportValidityOnInternalInput())}handleInternalInputErrorMessage(){this.inputElement.checkValidity()||this.inputElement.setCustomValidity(this.validationMessage)}#L(){this.handleInternalInputErrorMessage(),this.setAttribute("error-message",this.validationMessage)}init(){super.init?.(),this.inputElement.addEventListener("input",(t=>{this.inputElement.checkValidity()||(this.inputElement.setCustomValidity(""),this.setCustomValidity(""),this.baseElement.__onInput(t),this.#L())})),this.baseElement.addEventListener("change",(()=>{this.#T()})),this.addEventListener("blur",(()=>{this.checkValidity()||(this.setAttribute("invalid","true"),this.#L())})),this.addEventListener("focus",(t=>{t.relatedTarget?.form&&t.relatedTarget?.form===this.form&&"BUTTON"===t.relatedTarget?.nodeName&&(this.checkValidity()||this.setAttribute("invalid","true"),this.hasAttribute("invalid")&&this.reportValidityOnInternalInput())})),this.addEventListener("invalid",this.#L),this.handleInternalInputErrorMessage(),this.hasAttribute("tabindex")||this.getRootNode()!==document||this.setAttribute("tabindex",0),y(this,this.inputElement,"value"),y(this,this.inputElement,"selectionStart"),this.setSelectionRange=this.inputElement.setSelectionRange?.bind(this.inputElement)}};var A=s(357);const S=t=>class extends t{init(){super.init?.(),this.addEventListener("blur",(t=>{t.isTrusted&&t.stopImmediatePropagation()})),this.addEventListener("focus",(t=>{t.isTrusted&&t.stopImmediatePropagation()})),this.addEventListener("focusout",(t=>{t.isTrusted&&t.stopImmediatePropagation()})),this.addEventListener("focusin",(t=>{t.isTrusted&&t.stopImmediatePropagation()}))}},M=({name:t,selector:e,mappings:s={},forward:{attributes:a=[],include:o=!0}={}})=>l=>{const u=t||(t=>t.replace(/[^\w\s]/gi,""))(e),d=c({mappings:s})(l);return class extends d{static get cssVarList(){return{...d.cssVarList,[u]:h((0,n.E3)(l.componentName,"_"+u),s)}}#x;constructor(){const t=t=>{const s=t.shadowRoot.querySelector(t.baseSelector),i=e?s.shadowRoot.querySelector(e):s;return i.shadowRoot||i};var s;super({getRootElement:t,componentNameSuffix:"_"+u,themeSection:i.qM+u,baseSelector:":host"}),this.#x=(s=t(this)).host||s}#V(){this.#x.onmouseenter=t=>{t.target.setAttribute("hover","true")},this.#x.onmouseleave=t=>{t.target.removeAttribute("hover")}}init(){super.init?.(),(0,r.oP)(this,this.#x,{[o?"includeAttrs":"excludeAttrs"]:a}),this.#V()}}},C=t=>class extends t{#T=m.C.bind(this,"change");init(){super.init?.(),this.prevValue=this.value,this.addEventListener("change",(t=>{t.stopPropagation()})),this.addEventListener("blur",(()=>{this.value!==this.prevValue&&(this.#T(),this.prevValue=this.value)}))}};var T=s(8084);const L=t=>class extends t{get isReadOnly(){return this.hasAttribute("readonly")&&"false"!==this.getAttribute("readonly")}init(){["focus","blur"].forEach((t=>{this.addEventListener(t,(t=>{this.isReadOnly&&(t.stopImmediatePropagation(),t.preventDefault())}),!0)})),super.init?.()}},x=t=>class extends t{handleFocusEventsDispatching(t=[]){let e;t.forEach((t=>{t?.addEventListener("blur",(t=>{t.stopImmediatePropagation(),e=setTimeout((()=>{e=null,m.C.call(this,"blur"),m.C.call(this,"focusout",{bubbles:!0})}))})),t?.addEventListener("focus",(t=>{t.stopImmediatePropagation(),clearTimeout(e),e||(m.C.call(this,"focus"),m.C.call(this,"focusin",{bubbles:!0}))}))}))}handleInputEventDispatching(t){let e=this.value;t.forEach((t=>{t.addEventListener("input",(t=>{e===this.value?t.stopImmediatePropagation():e=this.value}))}))}}},8084:(t,e,s)=>{s.d(e,{Q:()=>n});var i=s(4567);const n=t=>class extends t{init(){super.init?.(),(0,i.FX)(this,(t=>t.forEach((t=>{const e=this.getAttribute(t);""===e?this.setAttribute(t,"true"):"false"===e&&this.removeAttribute(t)}))),{})}}}}]);
|
package/src/mixins/focusMixin.js
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
export const focusMixin = (superclass) => class FocusMixinClass extends superclass {
|
2
|
-
// we want to block all native events,
|
3
|
-
// so the input can control when to dispatch it based on its internal behavior
|
4
|
-
init() {
|
5
|
-
super.init?.();
|
6
|
-
|
7
|
-
this.addEventListener('blur', (e) => {
|
8
|
-
e.isTrusted && e.stopImmediatePropagation()
|
9
|
-
})
|
10
|
-
|
11
|
-
this.addEventListener('focus', (e) => {
|
12
|
-
e.isTrusted && e.stopImmediatePropagation();
|
13
|
-
})
|
14
|
-
|
15
|
-
this.addEventListener('focusout', (e) => {
|
16
|
-
e.isTrusted && e.stopImmediatePropagation();
|
17
|
-
})
|
18
|
-
|
19
|
-
this.addEventListener('focusin', (e) => {
|
20
|
-
e.isTrusted && e.stopImmediatePropagation();
|
21
|
-
})
|
22
|
-
}
|
23
|
-
}
|