@descope/web-components-ui 1.0.157 → 1.0.159
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/README.md +0 -36
- package/dist/cjs/index.cjs.js +267 -93
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +293 -118
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/1000.js +1 -0
- package/dist/umd/2481.js +1 -1
- package/dist/umd/3585.js +1 -1
- package/dist/umd/3878.js +1 -1
- package/dist/umd/boolean-fields-descope-checkbox-index-js.js +1 -1
- package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js +1 -1
- package/dist/umd/descope-button-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-new-password-descope-new-password-internal-index-js.js +1 -1
- package/dist/umd/descope-number-field-index-js.js +1 -1
- package/dist/umd/descope-passcode-index-js.js +1 -1
- package/dist/umd/descope-phone-field-index-js.js +1 -1
- package/dist/umd/descope-recaptcha-index-js.js +1 -0
- 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/descope-upload-file-index-js.js +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +1 -1
- package/src/baseClasses/createBaseClass.js +3 -1
- package/src/components/descope-recaptcha/RecaptchaClass.js +161 -0
- package/src/components/descope-recaptcha/index.js +5 -0
- package/src/index.cjs.js +1 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/mixins/componentsContextMixin.js +16 -0
- package/dist/umd/9241.js +0 -1
@@ -0,0 +1,161 @@
|
|
1
|
+
import { draggableMixin } from '../../mixins';
|
2
|
+
import { createBaseClass } from '../../baseClasses/createBaseClass';
|
3
|
+
import { compose } from '../../helpers';
|
4
|
+
import { getComponentName } from '../../helpers/componentHelpers';
|
5
|
+
|
6
|
+
export const componentName = getComponentName('recaptcha');
|
7
|
+
|
8
|
+
const observedAttributes = ['disabled', 'site-key', 'action', 'enterprise'];
|
9
|
+
|
10
|
+
const BaseClass = createBaseClass({
|
11
|
+
componentName,
|
12
|
+
baseSelector: ':host > div',
|
13
|
+
});
|
14
|
+
class RawRecaptcha extends BaseClass {
|
15
|
+
static get observedAttributes() {
|
16
|
+
return observedAttributes.concat(BaseClass.observedAttributes || []);
|
17
|
+
}
|
18
|
+
|
19
|
+
attributeChangedCallback(attrName, oldValue, newValue) {
|
20
|
+
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
21
|
+
if (attrName === 'disabled') {
|
22
|
+
this.#toggleRecaptcha(newValue === 'true');
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
renderRecaptcha(disabled) {
|
27
|
+
if (disabled) {
|
28
|
+
this.recaptchaEle.style.display = 'none';
|
29
|
+
this.mockRecaptchaEle.style.display = '';
|
30
|
+
} else {
|
31
|
+
this.recaptchaEle.style.display = '';
|
32
|
+
this.mockRecaptchaEle.style.display = 'none';
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
constructor() {
|
37
|
+
super();
|
38
|
+
|
39
|
+
this.attachShadow({ mode: 'open' }).innerHTML = `
|
40
|
+
<style>
|
41
|
+
:host #recaptcha {
|
42
|
+
width: 100%;
|
43
|
+
height: 100%
|
44
|
+
}
|
45
|
+
:host img {
|
46
|
+
width: 256px;
|
47
|
+
}
|
48
|
+
:host {
|
49
|
+
display: inline-flex;
|
50
|
+
}
|
51
|
+
</style>
|
52
|
+
<div>
|
53
|
+
<span id="recaptcha"></span>
|
54
|
+
<img src="https://imgs.descope.com/connectors/templates/recaptcha/recaptcha-big.png" alt="recaptcha"/>
|
55
|
+
</div>
|
56
|
+
`;
|
57
|
+
|
58
|
+
this.recaptchaEle = this.baseElement.querySelector('#recaptcha');
|
59
|
+
this.mockRecaptchaEle = this.baseElement.querySelector('img');
|
60
|
+
}
|
61
|
+
|
62
|
+
get enterprise() {
|
63
|
+
return this.getAttribute('enterprise') === 'true';
|
64
|
+
}
|
65
|
+
|
66
|
+
get siteKey() {
|
67
|
+
return this.getAttribute('site-key');
|
68
|
+
}
|
69
|
+
|
70
|
+
get action() {
|
71
|
+
return this.getAttribute('action') || 'load';
|
72
|
+
}
|
73
|
+
|
74
|
+
get disabled() {
|
75
|
+
return this.getAttribute('disabled') === 'true';
|
76
|
+
}
|
77
|
+
|
78
|
+
get scriptURL() {
|
79
|
+
const url = new URL('https://www.google.com/recaptcha/');
|
80
|
+
url.pathname += `${this.enterprise ? 'enterprise' : 'api'}.js`;
|
81
|
+
url.searchParams.append('onload', 'onRecaptchaLoadCallback');
|
82
|
+
url.searchParams.append('render', 'explicit');
|
83
|
+
return url.toString();
|
84
|
+
}
|
85
|
+
|
86
|
+
#toggleRecaptcha(disabled) {
|
87
|
+
this.renderRecaptcha(disabled);
|
88
|
+
if (!disabled) {
|
89
|
+
this.#loadRecaptchaScript();
|
90
|
+
this.#createOnLoadScript();
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
#loadRecaptchaScript() {
|
95
|
+
if (!document.getElementById('recaptcha-script')) {
|
96
|
+
const script = document.createElement('script');
|
97
|
+
script.src = this.scriptURL;
|
98
|
+
script.async = true;
|
99
|
+
script.id = 'recaptcha-script';
|
100
|
+
script.defer = true;
|
101
|
+
document.body.appendChild(script);
|
102
|
+
} else {
|
103
|
+
window.onRecaptchaLoadCallback();
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
#createOnLoadScript() {
|
108
|
+
if (window.onRecaptchaLoadCallback) {
|
109
|
+
return;
|
110
|
+
}
|
111
|
+
|
112
|
+
window.onRecaptchaLoadCallback = () => {
|
113
|
+
const currentNode = this.recaptchaEle;
|
114
|
+
// if there are child nodes, it means that the recaptcha was already rendered
|
115
|
+
if (currentNode.hasChildNodes()) {
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
const grecaptchaInstance = this.enterprise
|
119
|
+
? window.grecaptcha?.enterprise
|
120
|
+
: window.grecaptcha;
|
121
|
+
|
122
|
+
if (!grecaptchaInstance) {
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
|
126
|
+
setTimeout(() => {
|
127
|
+
const view = grecaptchaInstance.render(currentNode, {
|
128
|
+
sitekey: this.siteKey,
|
129
|
+
badge: 'inline',
|
130
|
+
size: 'invisible',
|
131
|
+
});
|
132
|
+
grecaptchaInstance.ready(() => {
|
133
|
+
// clone the node and append it to the body so that it can be used by the grepcaptcha script
|
134
|
+
const cloneNode = currentNode.querySelector('#g-recaptcha-response')?.cloneNode();
|
135
|
+
if (cloneNode) {
|
136
|
+
cloneNode.style.display = 'none';
|
137
|
+
document.body.appendChild(cloneNode);
|
138
|
+
}
|
139
|
+
if (this.siteKey) {
|
140
|
+
grecaptchaInstance?.execute(view, { action: this.action }).then((token) => {
|
141
|
+
this.updateComponentsContext({
|
142
|
+
risktoken: token,
|
143
|
+
riskaction: this.action,
|
144
|
+
});
|
145
|
+
});
|
146
|
+
}
|
147
|
+
});
|
148
|
+
}, 0);
|
149
|
+
};
|
150
|
+
}
|
151
|
+
|
152
|
+
connectedCallback() {
|
153
|
+
super.connectedCallback?.();
|
154
|
+
|
155
|
+
this.#toggleRecaptcha(this.disabled);
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
export const RecaptchaClass = compose(
|
160
|
+
draggableMixin
|
161
|
+
)(RawRecaptcha);
|
package/src/index.cjs.js
CHANGED
@@ -24,3 +24,4 @@ export { TextFieldClass } from './components/descope-text-field/TextFieldClass';
|
|
24
24
|
export { ImageClass } from './components/descope-image/ImageClass';
|
25
25
|
export { PhoneFieldClass } from './components/descope-phone-field/PhoneFieldClass';
|
26
26
|
export { NewPasswordClass } from './components/descope-new-password/NewPasswordClass';
|
27
|
+
export { RecaptchaClass } from './components/descope-recaptcha/RecaptchaClass';
|
package/src/index.d.ts
CHANGED
@@ -29,6 +29,7 @@ export { TextFieldClass } from './components/descope-text-field';
|
|
29
29
|
export { ImageClass } from './components/descope-image';
|
30
30
|
export { PhoneFieldClass } from './components/descope-phone-field';
|
31
31
|
export { NewPasswordClass } from './components/descope-new-password';
|
32
|
+
export { RecaptchaClass } from './components/descope-recaptcha';
|
32
33
|
export { UploadFileClass } from './components/descope-upload-file';
|
33
34
|
|
34
35
|
export type Theme = {
|
package/src/index.js
CHANGED
@@ -19,6 +19,7 @@ export * from './components/descope-text-field';
|
|
19
19
|
export * from './components/descope-image';
|
20
20
|
export * from './components/descope-phone-field';
|
21
21
|
export * from './components/descope-new-password';
|
22
|
+
export * from './components/descope-recaptcha';
|
22
23
|
export * from './components/descope-upload-file';
|
23
24
|
|
24
25
|
export {
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { createDispatchEvent } from '../helpers/mixinsHelpers';
|
2
|
+
|
3
|
+
export const componentsContextMixin = (superclass) =>
|
4
|
+
class ComponentsContextMixinClass extends superclass {
|
5
|
+
#dispatchComponentsContext = createDispatchEvent.bind(this, 'components-context');
|
6
|
+
|
7
|
+
updateComponentsContext(componentsContext) {
|
8
|
+
this.dispatchEvent(
|
9
|
+
new CustomEvent('components-context', {
|
10
|
+
bubbles: true,
|
11
|
+
composed: true,
|
12
|
+
detail: componentsContext,
|
13
|
+
})
|
14
|
+
);
|
15
|
+
}
|
16
|
+
};
|
package/dist/umd/9241.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[9241],{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}get name(){return this.getAttribute("name")}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:()=>u,iY:()=>h,oP:()=>c,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=>{t.forEach((t=>{"attributes"!==t.type||s.includes(t.attributeName)||i.length&&!i.includes(t.attributeName)||e([t.attributeName])}))})).observe(t,{attributes:!0})},a=(t,e)=>{e({addedNodes:Array.from(t.children),removedNodes:[]}),new MutationObserver((t=>{t.forEach((t=>{"childList"===t.type&&e(t)}))})).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),u=(...t)=>`--${(0,i.E3)(...t)}`,c=(t,e,s={})=>{r(t,o(t,e,s.mapAttrs),s)},d=(t,e,s=[])=>{if(!s.length)return;const i=s.reduce(((e,s)=>Object.assign(e,{[s]:{get:()=>t[s],set(e){t[s]=e}}})),{});Object.defineProperties(e,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},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()}}},9241:(t,e,s)=>{s.d(e,{li:()=>M,Ae:()=>A.A,DM:()=>p,yk:()=>u,e4:()=>c,mE:()=>L,wX:()=>b,QT:()=>C.Q,Iw:()=>S,dj:()=>f});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)})),{}),u=({mappings:t={},componentNameOverride:e=""})=>s=>{const u=e||s.componentName;return class extends s{static get cssVarList(){return{...s.cssVarList,...h(u,{...t})}}#i;#n;#r;#a;#o;#l;#h;#u;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.#u=Object.keys(t).map((t=>(0,n.E3)("st",s,t))),this.#c(),this.#d(),this.#m()}get#p(){return a.componentsThemeManager.currentTheme?.[u]||""}#g(){this.#n.innerHTML=this.#p[this.#o]}#d(){this.#n=document.createElement("style"),this.#n.id=`style-mixin-theme__${u}`,this.#l.prepend(this.#n),this.#r=a.componentsThemeManager.onCurrentThemeChange(this.#g.bind(this)),this.#g()}#m(){if(this.#u.length){this.#i=document.createElement("style"),this.#i.id=`style-mixin-overrides__${u}`;const s=(t=u,e=i.k4,Array(e).fill(`.${t}`).join(""));this.#i.innerText=`:host(${s}) {}`,this.#l.append(this.#i)}var t,e}#b(t,e){const s=this.#i?.sheet?.cssRules[0].style;if(!s)return;const i=(0,r.Tk)(u,t.replace(new RegExp("^st-"),""));e?s?.setProperty(i,e):(s?.removeProperty(i),this.removeAttribute(t))}#E(t=[]){let e=!1;t.forEach((t=>{this.#u.includes(t)&&(this.#b(t,this.getAttribute(t)),e=!0)})),e&&(this.#i.innerHTML=this.#i?.sheet?.cssRules[0].cssText)}#c(){if(Object.keys(t).length){const e=document.createElement("style");e.id=`style-mixin-mappings__${u}`,e.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=>({...s,...t}))):[{...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)(u,this.#a),this.#h,t),this.#l.prepend(e)}}#v(t){(this.#l.classList||this.#l.host.classList).add(t)}init(){super.init?.(),this.shadowRoot.isConnected&&(this.#v(u),(0,r.FX)(this,this.#E.bind(this),{}))}disconnectedCallback(){super.disconnectedCallback?.(),this.#r?.()}}},c=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 }"}#f(t){t?this.shadowRoot.appendChild(this.#y):this.#y.remove()}get isDraggable(){return this.hasAttribute("draggable")&&"false"!==this.getAttribute("draggable")}init(){this.addEventListener("mousedown",(t=>{if(this.isDraggable){const e=this.baseElement.getAttribute("tabindex");this.baseElement.setAttribute("tabindex","-1");const s=()=>{e?this.baseElement.setAttribute("tabindex",e):this.baseElement.removeAttribute("tabindex"),t.target.removeEventListener("mouseup",s),t.target.removeEventListener("dragend",s)};t.target.addEventListener("mouseup",s,{once:!0}),t.target.addEventListener("dragend",s,{once:!0})}})),super.init?.()}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),"draggable"===t&&this.#f("true"===s)}};var d=s(693);function m(t,e={}){const s=new Event(t,e);this[`on${t}`]?.(s),this.dispatchEvent(s)}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})){#A=m.bind(this,"blur");#S=m.bind(this,"focus");constructor(){super().attachShadow({mode:"open",delegatesFocus:!0}).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`}init(){super.init?.(),this.baseElement.addEventListener("blur",(t=>{this.#A()})),this.baseElement.addEventListener("focus",(t=>{this.#S()})),(0,r.Db)(this.baseElement,this,l),(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}#M;constructor(){super(),this.#M=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){const{valueMissing:e,patternMismatch:s,typeMismatch:i,stepMismatch:n,tooShort:r,tooLong:a,rangeOverflow:o,rangeUnderflow:l,badInput:h,customError:u}=t;switch(!0){case e:return this.getAttribute("data-errormessage-value-missing")||this.defaultErrorMsgValueMissing;case s||i||n||o||l||h:return this.getAttribute("data-errormessage-pattern-mismatch")||this.defaultErrorMsgPatternMismatch;case r:return this.getAttribute("data-errormessage-pattern-mismatch-too-short")||this.defaultErrorMsgTooShort;case a:return this.getAttribute("data-errormessage-pattern-mismatch-too-long")||this.defaultErrorMsgTooLong;case u:return this.validationMessage;default:return""}}#C(){const t=this.isReadOnly?{}:this.getValidity();this.#M.setValidity(t,this.getErrorMessage(t),this.validationTarget)}get validationMessage(){return this.#M.validationMessage}getValidity(){console.warn("getValidity","is not implemented")}checkValidity(){return this.#M.validity.valid}reportValidity(){return this.#M.reportValidity()}get validity(){return this.#M.validity}get validationTarget(){return this.inputElement}setCustomValidity(t){t?this.#M.setValidity({customError:!0},t,this.validationTarget):(this.#M.setValidity({}),this.#C())}get isRequired(){return this.hasAttribute("required")&&"false"!==this.getAttribute("required")}get isReadOnly(){return this.hasAttribute("readonly")&&"false"!==this.getAttribute("readonly")}get pattern(){return this.getAttribute("pattern")}get form(){return this.#M.form}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),g.includes(t)&&this.#C()}init(){super.init?.(),this.addEventListener("change",this.#C),this.addEventListener("invalid",(t=>t.stopPropagation())),this.addEventListener("input",this.#C),setTimeout((()=>this.#C()))}},E=["invalid","required"],v=(t,e,s)=>{Object.defineProperty(t,s,{set(t){e[s]=t},get:()=>e[s],configurable:!0})},y=t=>{if(!t)return;let e=t;for(let t=0;t<10;t++)if([e]=e.assignedElements(),"slot"!==e.localName)return e},f=(0,n.qC)((t=>class extends(b(t)){static get observedAttributes(){return[...t.observedAttributes||[],...E]}#L;#T=m.bind(this,"change");constructor(){super(),this.#L=super.inputElement}warnIfInputElementIsMissing(){clearTimeout(this.inputElementTimerId),this.inputElementTimerId=setTimeout((()=>{!this.#L&&console.warn(this.localName,"no input was found")}),0)}get inputElement(){this.warnIfInputElementIsMissing();const t=this.baseElement.shadowRoot?.querySelector('slot[name="input"]'),e=this.baseElement.shadowRoot?.querySelector('slot[name="textarea"]');return this.#L??=y(t)||y(e),this.#L}set inputElement(t){this.#L=t}getValidity(){return this.inputElement?.validity||{}}handleInternalInputErrorMessage(){this.inputElement.checkValidity()||this.inputElement.setCustomValidity(this.validationMessage)}#w(){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.#w())})),this.baseElement.addEventListener("change",(()=>{this.#T()})),this.#L.addEventListener("blur",(()=>{this.checkValidity()||(this.setAttribute("invalid","true"),this.#w())})),this.addEventListener("invalid",(()=>{this.checkValidity()||this.setAttribute("invalid","true"),this.#w()})),this.handleInternalInputErrorMessage(),v(this,this.inputElement,"value"),v(this,this.inputElement,"selectionStart"),this.setSelectionRange=this.inputElement.setSelectionRange?.bind(this.inputElement),(0,r.oP)(this,this.inputElement,{includeAttrs:["inputmode"]})}}),u({componentNameOverride:(0,r.iY)("input-wrapper")}));var A=s(357);const S=({name:t,selector:e,mappings:s={},forward:{attributes:a=[],include:o=!0}={}})=>l=>{const c=t||(t=>t.replace(/[^\w\s]/gi,""))(e),d=u({mappings:s})(l);return class extends d{static get cssVarList(){return{...d.cssVarList,[c]:h((0,n.E3)(l.componentName,"_"+c),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:"_"+c,themeSection:i.qM+c,baseSelector:":host"}),this.#x=(s=t(this)).host||s}#k(){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.#k()}}},M=t=>class extends t{#T=m.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 C=s(8084);const L=t=>class extends t{init(){this.#N(),super.init?.()}#N(){["blur","focus","focusin","focusout"].forEach((t=>{this.addEventListener(t,(t=>{t.isTrusted&&t.target===this&&t.stopImmediatePropagation()}))}))}handleFocusEventsDispatching(t){let e;t?.forEach((t=>{t?.addEventListener("focusout",(t=>{t.stopImmediatePropagation(),e=setTimeout((()=>{e=null,m.call(this,"blur"),m.call(this,"focusout",{bubbles:!0})}))}));const s=t=>{t.stopImmediatePropagation(),clearTimeout(e),e||(m.call(this,"focus"),m.call(this,"focusin",{bubbles:!0}))};t?.addEventListener("focusin",s),t?.addEventListener("focus",s)}))}handleInputEventDispatching(){let t=this.value;this.addEventListener("input",(e=>{t===this.value?e.stopImmediatePropagation():t=this.value}))}}},8084:(t,e,s)=>{s.d(e,{Q:()=>r});var i=s(4567);const n=["readonly","focused","invalid","has-label","required","disabled","checked","has-helper","has-value","step-buttons-visible","hover","has-error-message","focus-ring","opened","active","password-visible"],r=t=>class extends t{init(){super.init?.(),(0,i.FX)(this,(t=>t.forEach((t=>{const e=this.getAttribute(t);(t=>n.includes(t))(t)?""===e?this.setAttribute(t,"true"):"false"===e&&this.removeAttribute(t):e||console.warn(`attribute "${t}" has no value, should it be added to the boolean attributes list?`)}))),{})}}}}]);
|