@descope/web-components-ui 1.0.71 → 1.0.73

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. package/dist/index.esm.js +233 -186
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/umd/744.js +1 -0
  4. package/dist/umd/descope-button-index-js.js +1 -1
  5. package/dist/umd/descope-checkbox-index-js.js +1 -1
  6. package/dist/umd/descope-combo-box-index-js.js +1 -1
  7. package/dist/umd/descope-container-index-js.js +1 -1
  8. package/dist/umd/descope-date-picker-index-js.js +1 -1
  9. package/dist/umd/descope-divider-index-js.js +1 -1
  10. package/dist/umd/descope-email-field-index-js.js +1 -1
  11. package/dist/umd/descope-image-index-js.js +1 -0
  12. package/dist/umd/descope-link-index-js.js +1 -1
  13. package/dist/umd/descope-loader-linear-index-js.js +1 -1
  14. package/dist/umd/descope-loader-radial-index-js.js +1 -1
  15. package/dist/umd/descope-logo-index-js.js +1 -1
  16. package/dist/umd/descope-number-field-index-js.js +1 -1
  17. package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +1 -1
  18. package/dist/umd/descope-passcode-index-js.js +1 -1
  19. package/dist/umd/descope-password-field-index-js.js +1 -1
  20. package/dist/umd/descope-switch-toggle-index-js.js +1 -1
  21. package/dist/umd/descope-text-area-index-js.js +1 -1
  22. package/dist/umd/descope-text-field-index-js.js +1 -1
  23. package/dist/umd/descope-text-index-js.js +1 -1
  24. package/dist/umd/index.js +1 -1
  25. package/package.json +1 -1
  26. package/src/baseClasses/createBaseClass.js +11 -11
  27. package/src/baseClasses/createBaseInputClass.js +2 -1
  28. package/src/components/descope-combo-box/ComboBox.js +2 -2
  29. package/src/components/descope-image/Image.js +53 -0
  30. package/src/components/descope-image/index.js +5 -0
  31. package/src/components/descope-logo/Logo.js +3 -0
  32. package/src/components/descope-passcode/Passcode.js +2 -6
  33. package/src/components/descope-passcode/descope-passcode-internal/PasscodeInternal.js +13 -12
  34. package/src/helpers/mixinsHelpers.js +1 -1
  35. package/src/index.js +1 -0
  36. package/src/mixins/changeMixin.js +5 -5
  37. package/src/mixins/componentNameValidationMixin.js +2 -2
  38. package/src/mixins/createProxy.js +8 -8
  39. package/src/mixins/createStyleMixin/index.js +2 -2
  40. package/src/mixins/focusMixin.js +6 -8
  41. package/src/mixins/hoverableMixin.js +14 -17
  42. package/src/mixins/index.js +2 -0
  43. package/src/mixins/inputValidationMixin.js +5 -7
  44. package/src/mixins/lifecycleEventsMixin.js +21 -0
  45. package/src/mixins/portalMixin.js +2 -2
  46. package/src/mixins/proxyInputMixin.js +11 -11
  47. package/src/mixins/readOnlyMixin.js +18 -0
  48. package/src/theme/components/container.js +1 -1
  49. package/src/theme/components/image.js +7 -0
  50. package/src/theme/components/index.js +3 -1
  51. package/dist/umd/809.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import { createBaseClass } from '../baseClasses/createBaseClass';
2
2
  import { isFunction } from '../helpers';
3
3
  import { forwardProps, syncAttrs } from '../helpers/componentHelpers';
4
- import { createDispatchEvent, createEventListener } from '../helpers/mixinsHelpers';
4
+ import { createDispatchEvent } from '../helpers/mixinsHelpers';
5
5
 
6
6
  export const createProxy = ({
7
7
  componentName,
@@ -29,18 +29,18 @@ export const createProxy = ({
29
29
 
30
30
  focus = () => this.baseElement.focus()
31
31
 
32
- connectedCallback() {
33
- super.connectedCallback?.();
32
+ init() {
33
+ super.init?.();
34
34
 
35
- createEventListener.call(this, 'blur', (e) => {
35
+ this.baseElement.addEventListener('blur', (e) => {
36
36
  this.#dispatchBlur()
37
- }, { element: this.baseElement })
37
+ })
38
38
 
39
- createEventListener.call(this, 'focus', (e) => {
39
+ this.baseElement.addEventListener('focus', (e) => {
40
40
  this.#dispatchFocus()
41
- }, { element: this.baseElement })
41
+ })
42
42
 
43
- createEventListener.call(this, 'focus', (e) => {
43
+ this.addEventListener('focus', (e) => {
44
44
  // if we got a focus event we want to focus the proxy element
45
45
  if (e.isTrusted) {
46
46
  this.focus();
@@ -113,8 +113,8 @@ export const createStyleMixin =
113
113
  (this.#rootElement.classList || this.#rootElement.host.classList).add(className)
114
114
  }
115
115
 
116
- connectedCallback() {
117
- super.connectedCallback?.();
116
+ init() {
117
+ super.init?.();
118
118
  if (this.shadowRoot.isConnected) {
119
119
 
120
120
  this.#addClassName(superclass.componentName)
@@ -1,24 +1,22 @@
1
- import { createEventListener } from "../helpers/mixinsHelpers"
2
-
3
1
  export const focusMixin = (superclass) => class FocusMixinClass extends superclass {
4
2
  // we want to block all native events,
5
3
  // so the input can control when to dispatch it based on its internal behavior
6
- connectedCallback() {
7
- super.connectedCallback?.();
4
+ init() {
5
+ super.init?.();
8
6
 
9
- createEventListener.call(this, 'blur', (e) => {
7
+ this.addEventListener('blur', (e) => {
10
8
  e.isTrusted && e.stopImmediatePropagation()
11
9
  })
12
10
 
13
- createEventListener.call(this, 'focus', (e) => {
11
+ this.addEventListener('focus', (e) => {
14
12
  e.isTrusted && e.stopImmediatePropagation();
15
13
  })
16
14
 
17
- createEventListener.call(this, 'focusout', (e) => {
15
+ this.addEventListener('focusout', (e) => {
18
16
  e.isTrusted && e.stopImmediatePropagation();
19
17
  })
20
18
 
21
- createEventListener.call(this, 'focusin', (e) => {
19
+ this.addEventListener('focusin', (e) => {
22
20
  e.isTrusted && e.stopImmediatePropagation();
23
21
  })
24
22
  }
@@ -1,18 +1,15 @@
1
- import { createEventListener } from "../helpers/mixinsHelpers";
1
+ export const hoverableMixin = (superclass) =>
2
+ class HoverableMixinClass extends superclass {
3
+ init() {
4
+ super.init?.();
2
5
 
3
- export const hoverableMixin =
4
- (superclass) =>
5
- class HoverableMixinClass extends superclass {
6
- connectedCallback() {
7
- super.connectedCallback?.();
8
-
9
- createEventListener.call(this, 'mouseover', (e) => {
10
- this.setAttribute('hover', 'true');
11
- e.target.addEventListener(
12
- 'mouseleave',
13
- () => this.removeAttribute('hover'),
14
- { once: true }
15
- );
16
- }, { element: this.baseElement })
17
- }
18
- };
6
+ this.baseElement.addEventListener('mouseover', (e) => {
7
+ this.setAttribute('hover', 'true');
8
+ e.target.addEventListener(
9
+ 'mouseleave',
10
+ () => this.removeAttribute('hover'),
11
+ { once: true }
12
+ );
13
+ })
14
+ }
15
+ };
@@ -9,3 +9,5 @@ export { inputValidationMixin } from './inputValidationMixin'
9
9
  export { portalMixin } from './portalMixin'
10
10
  export { changeMixin } from './changeMixin'
11
11
  export { normalizeBooleanAttributesMixin } from './normalizeBooleanAttributesMixin'
12
+ export { readOnlyMixin } from './readOnlyMixin'
13
+ export { lifecycleEventsMixin } from './lifecycleEventsMixin'
@@ -1,5 +1,3 @@
1
- import { createEventListener } from "../helpers/mixinsHelpers";
2
-
3
1
  const observedAttributes = [
4
2
  'required',
5
3
  'pattern',
@@ -106,11 +104,11 @@ export const inputValidationMixin = (superclass) => class InputValidationMixinCl
106
104
  }
107
105
  }
108
106
 
109
- connectedCallback() {
110
- super.connectedCallback?.();
111
- createEventListener.call(this, 'change', this.#setValidity)
112
- createEventListener.call(this, 'invalid', (e) => e.stopPropagation())
113
- createEventListener.call(this, 'input', this.#setValidity)
107
+ init() {
108
+ super.init?.();
109
+ this.addEventListener('change', this.#setValidity)
110
+ this.addEventListener('invalid', (e) => e.stopPropagation())
111
+ this.addEventListener('input', this.#setValidity)
114
112
 
115
113
  this.#setValidity();
116
114
  }
@@ -0,0 +1,21 @@
1
+ import { createDispatchEvent } from "../helpers/mixinsHelpers";
2
+
3
+ export const lifecycleEventsMixin = (superclass) => class LifecycleEventsMixinClass extends superclass {
4
+ #dispatchConnected = createDispatchEvent.bind(this, 'connected')
5
+ #dispatchDisconnected = createDispatchEvent.bind(this, 'disconnected')
6
+
7
+ connectedCallback() {
8
+ if (this.rootElement.isConnected) {
9
+ super.connectedCallback?.();
10
+
11
+ // we are waiting for all components to listen before dispatching
12
+ setTimeout(this.#dispatchConnected)
13
+ }
14
+ }
15
+
16
+ disconnectedCallback() {
17
+ super.disconnectedCallback?.();
18
+
19
+ this.#dispatchDisconnected()
20
+ }
21
+ }
@@ -56,8 +56,8 @@ export const portalMixin = ({ name, selector, mappings = {} }) => (superclass) =
56
56
  this.#portalEle.onmouseleave = (e) => { e.target.removeAttribute('hover') }
57
57
  }
58
58
 
59
- connectedCallback() {
60
- super.connectedCallback?.();
59
+ init() {
60
+ super.init?.();
61
61
  forwardAttrs(this, this.#portalEle, { excludeAttrs: ['hover'] })
62
62
 
63
63
  this.#handleHoverAttribute();
@@ -1,4 +1,4 @@
1
- import { createDispatchEvent, createEventListener } from "../helpers/mixinsHelpers";
1
+ import { createDispatchEvent } from "../helpers/mixinsHelpers";
2
2
  import { inputValidationMixin } from "./inputValidationMixin";
3
3
 
4
4
  const errorAttrs = ['invalid', 'has-error-message'];
@@ -30,7 +30,7 @@ const getNestedInput = (ele) => {
30
30
  }
31
31
 
32
32
  export const proxyInputMixin = (superclass) =>
33
- class proxyInputMixinClass extends inputValidationMixin(superclass) {
33
+ class ProxyInputMixinClass extends inputValidationMixin(superclass) {
34
34
  static get observedAttributes() {
35
35
  return [...superclass.observedAttributes || [], ...errorAttrs];
36
36
  }
@@ -89,10 +89,10 @@ export const proxyInputMixin = (superclass) =>
89
89
  this.setAttribute('error-message', this.validationMessage)
90
90
  }
91
91
 
92
- connectedCallback() {
93
- super.connectedCallback?.();
92
+ init() {
93
+ super.init?.();
94
94
 
95
- createEventListener.call(this, 'input', (e) => {
95
+ this.inputElement.addEventListener('input', (e) => {
96
96
  if (!this.inputElement.checkValidity()) {
97
97
  this.inputElement.setCustomValidity('')
98
98
  // after updating the input validity we want to trigger set validity on the wrapping element
@@ -106,20 +106,20 @@ export const proxyInputMixin = (superclass) =>
106
106
 
107
107
  this.#handleErrorMessage()
108
108
  }
109
- }, { element: this.inputElement })
109
+ })
110
110
 
111
- createEventListener.call(this, 'change', () => {
111
+ this.baseElement.addEventListener('change', () => {
112
112
  this.#dispatchChange()
113
- }, { element: this.baseElement })
113
+ })
114
114
 
115
- createEventListener.call(this, 'blur', () => {
115
+ this.addEventListener('blur', () => {
116
116
  if (!this.checkValidity()) {
117
117
  this.setAttribute('invalid', 'true')
118
118
  this.#handleErrorMessage()
119
119
  }
120
120
  })
121
121
 
122
- createEventListener.call(this, 'focus', (e) => {
122
+ this.addEventListener('focus', (e) => {
123
123
  // when clicking on the form submit button and the input is invalid
124
124
  // we want it to appear as invalid
125
125
  if (e.relatedTarget?.form === this.form) {
@@ -133,7 +133,7 @@ export const proxyInputMixin = (superclass) =>
133
133
  }
134
134
  })
135
135
 
136
- createEventListener.call(this, 'invalid', this.#handleErrorMessage)
136
+ this.addEventListener('invalid', this.#handleErrorMessage)
137
137
 
138
138
  this.handleInternalInputErrorMessage()
139
139
 
@@ -0,0 +1,18 @@
1
+ export const readOnlyMixin = (superclass) => class ReadOnlyMixinClass extends superclass {
2
+ get isReadOnly() {
3
+ return this.hasAttribute('readonly') && this.getAttribute('readonly') !== 'false'
4
+ }
5
+
6
+ init() {
7
+ ['focus', 'blur'].forEach(event => {
8
+ this.addEventListener(event, (e) => {
9
+ if (this.isReadOnly) {
10
+ e.stopImmediatePropagation()
11
+ e.preventDefault()
12
+ }
13
+ }, true)
14
+ })
15
+
16
+ super.init?.()
17
+ }
18
+ }
@@ -23,7 +23,7 @@ const [helperTheme, helperRefs, helperVars] =
23
23
  verticalAlignment,
24
24
  horizontalAlignment,
25
25
  shadowColor: '#00000020' //if we want to support transparency vars, we should use different color format
26
- }, 'container')
26
+ }, Container.componentName)
27
27
 
28
28
  const container = {
29
29
  ...helperTheme,
@@ -0,0 +1,7 @@
1
+ import Image from "../../components/descope-image/Image";
2
+
3
+ const vars = Image.cssVarList
4
+
5
+ const image = {};
6
+
7
+ export default image;
@@ -14,6 +14,7 @@ import divider from './divider';
14
14
  import passcode from './passcode';
15
15
  import { loaderRadial, loaderLinear } from './loader';
16
16
  import comboBox from './comboBox';
17
+ import image from './image';
17
18
 
18
19
  export default {
19
20
  button,
@@ -32,5 +33,6 @@ export default {
32
33
  passcode,
33
34
  loaderRadial,
34
35
  loaderLinear,
35
- comboBox
36
+ comboBox,
37
+ image
36
38
  };
package/dist/umd/809.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[809],{3346:(e,t,s)=>{s.d(t,{s:()=>a});var n=s(2061),i=s(7878),r=s(4877);const a=({componentName:e,baseSelector:t=""})=>{class s extends HTMLElement{static get componentName(){return e}#e;#t=i.C.bind(this,"connected");#s=i.C.bind(this,"disconnected");get baseSelector(){return t}get baseElement(){return this.#e??=this.baseSelector?this.rootElement.querySelector(this.baseSelector):this,this.#e}get rootElement(){return this.shadowRoot||this}connectedCallback(){super.connectedCallback?.(),setTimeout(this.#t)}disconnectedCallback(){super.disconnectedCallback?.(),this.#s()}}return(0,n.qC)(r.Ae,r._A,r.QT)(s)}},5279:(e,t,s)=>{s.d(t,{gh:()=>n,k4:()=>i,qM:()=>a,qg:()=>r});const n="descope",i=3,r="host",a="@"},4567:(e,t,s)=>{s.d(t,{Db:()=>u,FX:()=>r,P$:()=>a,Tk:()=>h,iY:()=>c,oP:()=>d,tg:()=>l});var n=s(2061),i=s(5279);const r=(e,t,{excludeAttrs:s=[],includeAttrs:n=[]})=>{const i=Array.from(e.attributes).filter((e=>!s.includes(e.name)&&(!n.length||n.includes(e.name)))).map((e=>e.name));t(i),new MutationObserver((e=>{for(const i of e)"attributes"!==i.type||s.includes(i.attributeName)||n.length&&!n.includes(i.attributeName)||t([i.attributeName])})).observe(e,{attributes:!0})},a=(e,t)=>{t({addedNodes:Array.from(e.children),removedNodes:[]}),new MutationObserver((e=>{for(const s of e)"childList"===s.type&&t(s)})).observe(e,{childList:!0})},o=(e,t,s={})=>n=>{n.forEach((n=>{const i=s[n]||n,r=e.getAttribute(n);null!==r?t.getAttribute(i)!==r&&t.setAttribute(i,r):t.removeAttribute(i)}))},l=(e,t,s)=>{r(e,o(e,t),s),r(t,o(t,e),s)},c=e=>(0,n.E3)(i.gh,e),h=(...e)=>`--${(0,n.E3)(...e)}`,d=(e,t,s={})=>{r(e,o(e,t,s.mapAttrs),s)},u=(e,t,s=[])=>{if(!s.length)return;const n=s.reduce(((e,s)=>Object.assign(e,{[s]:{get:()=>t[s],set(e){t[s]=e}}})),{});Object.defineProperties(e,n)}},2061:(e,t,s)=>{s.d(t,{E3:()=>i,GL:()=>n,mf:()=>a,qC:()=>r});const n=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),i=(...e)=>n(e.filter((e=>!!e)).join("-")),r=(...e)=>t=>e.reduceRight(((e,t)=>t(e)),t),a=e=>"function"==typeof e},7878:(e,t,s)=>{function n(e,t={}){const s=new Event(e,t);this[`on${e}`]?.(s),this.dispatchEvent(s)}function i(e,t,{element:s,...n}={}){const i=setTimeout((()=>console.warn(this.localName,'is not using "createBaseClass", events will not be removed automatically on disconnect')),2e3);this.addEventListener("connected",(()=>{clearTimeout(i)}),{once:!0});const r=s||this,a=t.bind(this),o=()=>{r.removeEventListener(e,a)};return this.addEventListener("disconnected",o,{once:!0}),r.addEventListener(e,a,n),o}s.d(t,{C:()=>n,t:()=>i})},4877:(e,t,s)=>{s.d(t,{li:()=>M,Ae:()=>C,DM:()=>p,yk:()=>h,e4:()=>d,pY:()=>S,_A:()=>A,wX:()=>g,QT:()=>T,Iw:()=>k,dj:()=>f});var n=s(5279),i=s(2061),r=s(4567),a=s(5561);const o=(e,...t)=>`var(${e}${t.length?` , ${o(...t)}`:""})`;class l{constructor(){this.styleMap=new Map}add(e,t,s){this.styleMap.has(e)||this.styleMap.set(e,[]),this.styleMap.set(e,[...this.styleMap.get(e),{property:t,value:s}])}toString(){return Array.from(this.styleMap.entries()).reduce(((e,[t,s])=>e+`${t} { \n${s.map((({property:e,value:t})=>`${e}: ${t}`)).join(";\n")} \n}\n\n`),"")}}const c=(e,t)=>Object.keys(t).reduce(((t,s)=>Object.assign(t,{[s]:(0,r.Tk)(e,s)})),{}),h=({mappings:e={}})=>t=>class extends t{static get cssVarList(){return{...t.cssVarList,...c(t.componentName,{...e})}}#n;#i;#r;#a;#o;#l;#c;#h;constructor({getRootElement:t,componentNameSuffix:s="",themeSection:r=n.qg,baseSelector:a}={}){super(),this.#a=s,this.#o=r,this.#l=t?.(this)||this.shadowRoot,this.#c=a??this.baseSelector,this.#h=Object.keys(e).map((e=>(0,i.E3)("st",s,e)))}get componentTheme(){return a.componentsThemeManager.currentTheme?.[t.componentName]||""}#d(){this.#i.innerHTML=this.componentTheme[this.#o]}#u(){this.#i=document.createElement("style"),this.#i.id="style-mixin-theme",this.#l.prepend(this.#i),this.#r=a.componentsThemeManager.onCurrentThemeChange(this.#d.bind(this)),this.#d()}#m(){this.#n=document.createElement("style"),this.#n.id="style-mixin-overrides";const e=(s=t.componentName,i=n.k4,Array(i).fill(`.${s}`).join(""));var s,i;this.#n.innerText=`:host(${e}) {}`,this.#l.append(this.#n)}#p(e,s){const n=this.#n?.sheet?.cssRules[0].style;if(!n)return;const i=(0,r.Tk)(t.componentName,e.replace(new RegExp("^st-"),""));s?n?.setProperty(i,s):n?.removeProperty(i)}#b(e=[]){for(const t of e)this.#h.includes(t)&&this.#p(t,this.getAttribute(t));this.#n.innerHTML=this.#n?.sheet?.cssRules[0].cssText}#g(){const s=document.createElement("style");s.id="style-mixin-mappings",s.innerHTML=((e,t,s)=>{const n=new l;return Object.keys(s).forEach((a=>{const l=((e,t)=>{const s={selector:"",property:(0,i.GL)(e)};return t&&Object.keys(t).length?Array.isArray(t)?t.map((e=>Object.assign({},s,e))):[Object.assign({},s,t)]:[s]})(a,s[a]),c=(0,r.Tk)(e,a);l.forEach((({selector:e,property:s})=>{n.add(((e="",t="")=>(0,i.mf)(t)?t(e):`${e}${/^[A-Za-z]/.test(t)?` ${t}`:t}`)(t,e),(0,i.mf)(s)?s():s,o(c))}))})),n.toString()})((0,i.E3)(t.componentName,this.#a),this.#c,e),this.#l.prepend(s)}#y(e){(this.#l.classList||this.#l.host.classList).add(e)}connectedCallback(){super.connectedCallback?.(),this.shadowRoot.isConnected&&(this.#y(t.componentName),this.#g(),this.#u(),this.#m(),(0,r.FX)(this,this.#b.bind(this),{}))}disconnectedCallback(){super.disconnectedCallback?.(),this.#r?.()}},d=e=>class extends e{#E=null;static get observedAttributes(){return[...e.observedAttributes||[],"draggable"]}constructor(){super(),this.#E=document.createElement("style"),this.#E.innerText="* { cursor: inherit!important }"}#v(e){e?this.shadowRoot.appendChild(this.#E):this.#E.remove()}attributeChangedCallback(e,t,s){super.attributeChangedCallback?.(e,t,s),"draggable"===e&&this.#v("true"===s)}};var u=s(3346),m=s(7878);const p=({componentName:e,wrappedEleName:t,slots:s=[],style:n,excludeAttrsSync:a=[],includeAttrsSync:o=[],includeForwardProps:l=[]})=>{class c extends((0,u.s)({componentName:e,baseSelector:t})){#f=m.C.bind(this,"blur");#C=m.C.bind(this,"focus");constructor(){super().attachShadow({mode:"open"}).innerHTML=`\n\t\t\t<style id="create-proxy">${(0,i.mf)(n)?n():n}</style>\n\t\t\t<${t}>\n\t\t\t<slot></slot>\n\t\t\t${s.map((e=>`<slot name="${e}" slot="${e}"></slot>`)).join("")}\n\t\t\t</${t}>\n\t\t`}focus=()=>this.baseElement.focus();connectedCallback(){super.connectedCallback?.(),m.t.call(this,"blur",(e=>{this.#f()}),{element:this.baseElement}),m.t.call(this,"focus",(e=>{this.#C()}),{element:this.baseElement}),m.t.call(this,"focus",(e=>{e.isTrusted&&this.focus()})),(0,r.Db)(this,this.baseElement,l),this.baseElement.onkeydown=e=>{e.shiftKey&&9===e.keyCode&&this.getRootNode()===document&&(this.removeAttribute("tabindex"),setTimeout((()=>this.setAttribute("tabindex","0")),0))},(0,r.tg)(this.baseElement,this,{excludeAttrs:a,includeAttrs:o})}}return c},b=["required","pattern"],g=e=>class extends e{static get observedAttributes(){return[...e.observedAttributes||[],...b]}static get formAssociated(){return!0}#A;constructor(){super(),this.#A=this.attachInternals()}get defaultErrorMsgValueMissing(){return"Please fill out this field."}get defaultErrorMsgPatternMismatch(){return"Please match the requested format."}getErrorMessage(e){switch(!0){case e.valueMissing:return this.getAttribute("data-errormessage-value-missing")||this.defaultErrorMsgValueMissing;case e.patternMismatch||e.typeMismatch:return this.getAttribute("data-errormessage-pattern-mismatch")||this.defaultErrorMsgPatternMismatch;case e.customError:return this.validationMessage;default:return""}}#S(){const e=this.getValidity();this.#A.setValidity(e,this.getErrorMessage(e))}get validationMessage(){return this.#A.validationMessage}getValidity(){console.warn("getValidity","is not implemented")}checkValidity(){return this.#A.validity.valid}reportValidity(){return this.#A.reportValidity()}get validity(){return this.#A.validity}setCustomValidity(e){e?this.#A.setValidity({customError:!0},e):(this.#A.setValidity({}),this.#S())}get isRequired(){return this.hasAttribute("required")&&"false"!==this.getAttribute("required")}get pattern(){return this.getAttribute("pattern")}get form(){return this.#A.form}attributeChangedCallback(e,t,s){super.attributeChangedCallback?.(e,t,s),b.includes(e)&&this.#S()}connectedCallback(){super.connectedCallback?.(),m.t.call(this,"change",this.#S),m.t.call(this,"invalid",(e=>e.stopPropagation())),m.t.call(this,"input",this.#S),this.#S()}},y=["invalid","has-error-message"],E=(e,t,s)=>{Object.defineProperty(e,s,{set:function(e){return t[s]=e},get:function(){return t[s]},configurable:!0})},v=e=>{if(!e)return;let t=e;for(let e=0;e<10;e++)if(t=t.assignedElements()[0],"slot"!==t.localName)return t},f=e=>class extends(g(e)){static get observedAttributes(){return[...e.observedAttributes||[],...y]}#k;#M=m.C.bind(this,"change");constructor(){super(),this.#k=super.inputElement}get inputElement(){const e=this.baseElement.shadowRoot.querySelector('slot[name="input"]'),t=this.baseElement.shadowRoot.querySelector('slot[name="textarea"]');if(this.#k??=v(e)||v(t),!this.#k)throw Error("no input was found");return this.#k}set inputElement(e){this.#k=e}getValidity(){return this.inputElement.validity}reportValidityOnInternalInput(){setTimeout((()=>{this.inputElement.reportValidity()}))}reportValidity(){isValid||(this.setAttribute("invalid","true"),this.reportValidityOnInternalInput())}handleInternalInputErrorMessage(){this.inputElement.checkValidity()||this.inputElement.setCustomValidity(this.validationMessage)}#T(){this.handleInternalInputErrorMessage(),this.setAttribute("error-message",this.validationMessage)}connectedCallback(){super.connectedCallback?.(),m.t.call(this,"input",(e=>{this.inputElement.checkValidity()||(this.inputElement.setCustomValidity(""),this.setCustomValidity(""),this.baseElement.__onInput(e),this.#T())}),{element:this.inputElement}),m.t.call(this,"change",(()=>{this.#M()}),{element:this.baseElement}),m.t.call(this,"blur",(()=>{this.checkValidity()||(this.setAttribute("invalid","true"),this.#T())})),m.t.call(this,"focus",(e=>{e.relatedTarget?.form===this.form&&(this.checkValidity()||this.setAttribute("invalid","true"),this.hasAttribute("invalid")&&this.reportValidityOnInternalInput())})),m.t.call(this,"invalid",this.#T),this.handleInternalInputErrorMessage(),this.hasAttribute("tabindex")||this.getRootNode()!==document||this.setAttribute("tabindex",0),E(this,this.inputElement,"value"),E(this,this.inputElement,"selectionStart"),this.setSelectionRange=this.inputElement.setSelectionRange?.bind(this.inputElement)}},C=e=>class extends e{#V(){const t=this.localName;if(!e.componentName)throw Error('component name is not defined on super class, make sure you have a static get for "componentName"');if(t!==e.componentName)throw Error(`component name mismatch, expected "${e.componentName}", current "${t}"`)}connectedCallback(){super.connectedCallback?.(),this.#V()}},A=e=>class extends e{connectedCallback(){super.connectedCallback?.(),m.t.call(this,"mouseover",(e=>{this.setAttribute("hover","true"),e.target.addEventListener("mouseleave",(()=>this.removeAttribute("hover")),{once:!0})}),{element:this.baseElement})}},S=e=>class extends e{connectedCallback(){super.connectedCallback?.(),m.t.call(this,"blur",(e=>{e.isTrusted&&e.stopImmediatePropagation()})),m.t.call(this,"focus",(e=>{e.isTrusted&&e.stopImmediatePropagation()})),m.t.call(this,"focusout",(e=>{e.isTrusted&&e.stopImmediatePropagation()})),m.t.call(this,"focusin",(e=>{e.isTrusted&&e.stopImmediatePropagation()}))}},k=({name:e,selector:t,mappings:s={}})=>a=>{const o=e||(e=>e.replace(/[^\w\s]/gi,""))(t),l=h({mappings:s})(a);return class extends l{static get cssVarList(){return{...l.cssVarList,[o]:c((0,i.E3)(a.componentName,"_"+o),s)}}#x;constructor(){const e=e=>{const s=e.shadowRoot.querySelector(e.baseSelector),n=t?s.shadowRoot.querySelector(t):s;return n.shadowRoot||n};var s;super({getRootElement:e,componentNameSuffix:"_"+o,themeSection:n.qM+o,baseSelector:":host"}),this.#x=(s=e(this)).host||s}#N(){this.#x.onmouseenter=e=>{e.target.setAttribute("hover","true")},this.#x.onmouseleave=e=>{e.target.removeAttribute("hover")}}connectedCallback(){super.connectedCallback?.(),(0,r.oP)(this,this.#x,{excludeAttrs:["hover"]}),this.#N()}}},M=e=>class extends e{#M=m.C.bind(this,"change");connectedCallback(){super.connectedCallback?.(),this.prevValue=this.value,m.t.call(this,"change",(e=>{e.stopPropagation()})),m.t.call(this,"blur",(()=>{this.value!==this.prevValue&&(this.#M(),this.prevValue=this.value)}))}},T=e=>class extends e{attributeChangedCallback(e,t,s){""===s&&(this.setAttribute(e,"true"),s="true"),super.attributeChangedCallback?.(e,t,s)}}}}]);