@descope/web-components-ui 1.0.53 → 1.0.55
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.esm.js +1188 -813
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/832.js +1 -1
- package/dist/umd/942.js +1 -0
- package/dist/umd/descope-divider-index-js.js +1 -1
- package/dist/umd/descope-link-index-js.js +1 -0
- package/dist/umd/descope-text-index-js.js +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-link/Link.js +90 -0
- package/src/components/descope-link/index.js +6 -0
- package/src/componentsHelpers/createProxy/helpers.js +12 -7
- package/src/componentsHelpers/createProxy/index.js +6 -14
- package/src/componentsHelpers/hoverableMixin.js +23 -0
- package/src/index.js +11 -8
- package/src/theme/components/index.js +2 -0
- package/src/theme/components/link.js +57 -0
package/dist/umd/832.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[832],{8522:(e,
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[832],{8522:(t,e,s)=>{s.d(e,{V:()=>n});class n extends HTMLElement{}},9201:(t,e,s)=>{s.d(e,{o:()=>a,t:()=>i});const n=(t,e,{excludeAttrs:s=[],includeAttrs:n=[]})=>{e(...Array.from(t.attributes).filter((t=>!s.includes(t.name)&&(!n.length||n.includes(t.name)))).map((t=>t.name))),new MutationObserver((t=>{for(const o of t)"attributes"!==o.type||s.includes(o.attributeName)||n.length&&!n.includes(o.attributeName)||e([o.attributeName])})).observe(t,{attributes:!0})},o=(t,e,s={})=>(...n)=>{n.forEach((n=>{const o=s[n]||n,i=t.getAttribute(n);null!==i?e.getAttribute(o)!==i&&e.setAttribute(o,i):e.removeAttribute(o)}))},i=(t,e,s)=>{n(t,o(t,e),s),n(e,o(e,t),s)},a=(t,e,s={})=>{n(t,o(t,e,s.mapAttrs),s)}},3535:(t,e,s)=>{s.d(e,{SP:()=>r,wj:()=>a,zy:()=>l});var n=s(6225);const o=(t,...e)=>`var(${t}${e.length?` , ${o(...e)}`:""})`;class i{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 a=(t,e,s)=>{const a=new i;return Object.keys(s).forEach((i=>{const r=((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]})(i,s[i]),l=(0,n.Tk)(t,i);r.forEach((({selector:t,property:s})=>{a.add(((t="",e="")=>"function"==typeof e?e(t):`${t}${e}`)(e,t),s,o(l))}))})),a.toString()},r=(t,e)=>Object.keys(e).reduce(((e,s)=>Object.assign(e,{[s]:(0,n.Tk)(t,s)})),{}),l=(t={})=>[t,{...t,selector:()=>`:host${t.selector||""}`}]},893:(t,e,s)=>{s.d(e,{_:()=>n});const n=(t="")=>e=>class extends e{connectedCallback(){super.connectedCallback?.(),this.shadowRoot.querySelector(this.baseSelector+t).addEventListener("mouseover",(t=>{this.shadowRoot.host.setAttribute("hover","true"),t.target.addEventListener("mouseleave",(()=>this.shadowRoot.host.removeAttribute("hover")),{once:!0})}))}}},832:(t,e,s)=>{s.d(e,{Ae:()=>m,qC:()=>y,DM:()=>h,yk:()=>i,e4:()=>a,iY:()=>p,y7:()=>u});var n=s(6225),o=s(3535);const i=({mappings:t={},nestedMappings:e={}})=>s=>{const i=Object.keys(t).map((t=>(0,n.E3)("st",t)));return class extends s{static get observedAttributes(){return[...s.observedAttributes||[],...i]}static get cssVarList(){return(0,o.SP)(s.componentName,t)}#t=null;constructor(){super(),this.#e(),this.#s()}#s(){this.#t=document.createElement("style"),this.#t.id="style-mixin-overrides",this.#t.innerText="* {}",this.shadowRoot.prepend(this.#t)}#n(t,e){const o=this.#t.sheet?.cssRules[0].style,i=(0,n.Tk)(s.componentName,t.replace(/^st-/,""));e?o?.setProperty(i,e):o?.removeProperty(i)}#e(){const e=document.createElement("style");e.id="style-mixin-component",e.innerHTML=(0,o.wj)(s.componentName,this.baseSelector,t),this.shadowRoot.prepend(e)}#o(){const t=this.shadowRoot.host.getRootNode(),n=`${s.componentName}-style-mixin-component`,i=s.componentName;if(this.shadowRoot.host.classList.add(i),t.querySelector(`style#${n}`))return;const a=document.createElement("style");a.id=n,a.innerHTML=(0,o.wj)(s.componentName,`${s.componentName}${Array(3).fill(`.${i}`).join("")}`,e),"#document"===t.nodeName?t.head.append(a):t.append(a)}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),i.includes(t)&&this.#n(t,s)}connectedCallback(){super.connectedCallback?.(),this.shadowRoot.isConnected&&(this.#o(),Array.from(this.attributes).forEach((t=>{i.includes(t.nodeName)&&this.#n(t.nodeName,t.value)})))}}},a=t=>class extends t{#t=null;static get observedAttributes(){return[...t.observedAttributes||[],"draggable"]}constructor(){super(),this.#t=document.createElement("style"),this.#t.innerText=`${this.baseSelector} { cursor: inherit }`}#i(t){t?this.shadowRoot.appendChild(this.#t):this.#t.remove()}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),"draggable"===t&&this.#i("true"===s)}};var r=s(8522),l=s(893),c=s(9201);const h=({componentName:t,wrappedEleName:e,slots:s=[],style:n,excludeAttrsSync:o=[]})=>{const i=`\n\t\t<style id="create-proxy"></style>\n\t\t<${e}>\n\t\t<slot></slot>\n\t\t${s.map((t=>`<slot name="${t}" slot="${t}"></slot>`)).join("")}\n\t\t</${e}>\n\t`;class a extends r.V{static get componentName(){return t}constructor(){super().attachShadow({mode:"open"}).innerHTML=i,this.hostElement=this.shadowRoot.host,this.baseSelector=e,this.shadowRoot.getElementById("create-proxy").innerHTML="function"==typeof n?n():n}connectedCallback(){this.shadowRoot.isConnected&&(this.proxyElement=this.shadowRoot.querySelector(e),this.setAttribute("tabindex","0"),this.addEventListener("focus",(()=>{this.proxyElement.focus()})),this.proxyElement.onkeydown=t=>{t.shiftKey&&9===t.keyCode&&(this.removeAttribute("tabindex"),setTimeout((()=>this.setAttribute("tabindex","0")),0))},this.addEventListener=(...t)=>this.proxyElement.addEventListener(...t),(0,c.t)(this.proxyElement,this.hostElement,{excludeAttrs:o}))}disconnectedCallback(){this.proxyElement.removeEventListener("mouseover",this.mouseoverCbRef)}attributeChangedCallback(){this.proxyElement}}return y((0,l._)())(a)},d=["invalid","has-error-message"],u=t=>class extends t{static get formAssociated(){return!0}#a;constructor(){super(),this.#a=this.attachInternals()}formAssociatedCallback(){this.setValidity?.()}setValidationAttribute(t){const e=this.getAttribute(t);e&&this.proxyElement.setAttribute("error-message",e),d.forEach((t=>this.proxyElement.setAttribute(t,"true")))}validate(){const{valueMissing:t,patternMismatch:e,typeMismatch:s}=this.validity;t?this.setValidationAttribute("data-errormessage-value-missing"):(s||e)&&this.setValidationAttribute("data-errormessage-pattern-mismatch")}connectedCallback(){if(super.connectedCallback?.(),this.baseEle=this.shadowRoot.querySelector(this.baseSelector),this.hasAttribute("tabindex")||this.setAttribute("tabindex",0),this.inputElement??=this.baseEle.shadowRoot.querySelector('slot[name="input"]')?.assignedElements()[0]||this.baseEle.shadowRoot.querySelector('slot[name="textarea"]')?.assignedElements()[0],!this.inputElement)throw Error("no input was found");var t,e;t=this.inputElement,e="value",Object.defineProperty(this,e,{set:function(s){return t[e]=s},get:function(){return t[e]},configurable:!0}),this.setSelectionRange=this.inputElement.setSelectionRange?.bind(this.inputElement),this.validity=this.inputElement.validity,this.setValidity=()=>{this.#a.setValidity(this.inputElement.validity,this.inputElement.validationMessage)},this.inputElement.oninput=()=>{this.value=this.inputElement.value,this.setValidity()},this.onfocus=()=>{setTimeout((()=>this.inputElement.reportValidity()),0),this.validate()},this.inputElement.oninvalid=()=>{this.validate()}}},m=t=>class extends t{#r(){const e=this.shadowRoot.host.tagName.toLowerCase();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}"`)}connectedCallback(){super.connectedCallback?.(),this.shadowRoot.isConnected&&this.#r()}},p=t=>(0,n.E3)("descope",t),y=(...t)=>e=>t.reduceRight(((t,e)=>e(t)),e)},6225:(t,e,s)=>{s.d(e,{E3:()=>o,GL:()=>n,Tk:()=>i});const n=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),o=(...t)=>n(t.join("-")),i=(...t)=>`--${o(...t.filter((t=>!!t)))}`}}]);
|
package/dist/umd/942.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[942],{4942:(o,t,s)=>{s.d(t,{s:()=>c});var e=s(9201);const h=(o,t)=>{t.append(...o.childNodes),o.appendChild(t)},c=({nestingElementTagName:o,nestingElementDestSlotName:t,forwardAttrOptions:s})=>c=>{const d=()=>Object.assign(document.createElement(o),{slot:t});let i;const a=()=>i;return class extends c{constructor(){var t;super(),t=()=>{a().disconnect(this.shadowRoot.host);const t=this.shadowRoot.host.querySelector(o),c=this.shadowRoot.host.childNodes.length>0;!t&&c?h(this.shadowRoot.host,d()):t&&c?(this.shadowRoot.host.querySelector(child).remove(),h(this.shadowRoot.host,d())):t&&!c&&this.shadowRoot.host.querySelector(child).remove(),this.shadowRoot.host.querySelector(o)&&(0,e.o)(this.shadowRoot.host,this.shadowRoot.host.querySelector(o),s),a().observe(this.shadowRoot.host,{childList:!0})},i=new MutationObserver((o=>{for(const s of o)"childList"===s.type&&t()}))}connectedCallback(){super.connectedCallback?.(),this.shadowRoot.host.childNodes.length>0&&(h(this.shadowRoot.host,d()),(0,e.o)(this.shadowRoot.host,this.shadowRoot.host.querySelector(o),s)),a().observe(this.shadowRoot.host,{childList:!0})}}}}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[178],{
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[178],{6446:(t,e,n)=>{n.r(e),n.d(e,{Divider:()=>f});var o=n(832),s=n(4942),i=n(3535),r=n(8522);const l=(0,o.iY)("divider");class d extends r.V{static get componentName(){return l}constructor(){super();const t=document.createElement("template");t.innerHTML="\n\t\t\t<style>\n\t\t\t\t:host > div {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\theight: 100%;\n\t\t\t\t}\n\t\t\t\t:host > div::before,\n\t\t\t\t:host > div::after {\n\t\t\t\t\tcontent: '';\n\t\t\t\t\tflex-grow: 1;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t}\n\t\t\t\t::slotted(*) {\n\t\t\t\t\tflex-grow: 0;\n\t\t\t\t\tflex-shrink: 0;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div>\n\t\t\t\t<slot></slot>\n\t\t\t\t<slot name=\"text\"></slot>\n\t\t\t</div>\n\t\t",this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.baseSelector=":host > div"}}const{root:a,before:c,after:h,slotted:p}={root:{selector:""},before:{selector:"::before"},after:{selector:"::after"},slotted:{selector:()=>"::slotted(*)"}},f=(0,o.qC)((0,s.s)({nestingElementTagName:"descope-text",nestingElementDestSlotName:"text",forwardAttrOptions:{includeAttrs:["mode","variant"],excludeAttrs:[]}}),(0,o.yk)({mappings:{minHeight:a,alignItems:a,alignSelf:a,flexDirection:a,padding:p,width:(0,i.zy)(),height:[c,h],backgroundColor:[c,h],opacity:[c,h],textWidth:{...p,property:"width"}}}),o.e4,o.Ae)(d);n(1876),customElements.define(l,f)}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[58],{8029:(t,e,o)=>{o.r(e),o.d(e,{Link:()=>m});var n=o(832),s=o(9201),r=o(3535),a=o(4942),c=o(893),l=o(8522),i=o(8801);const d=(0,n.iY)("link");class p extends l.V{static get componentName(){return d}constructor(){super();const t=document.createElement("template");t.innerHTML='\n\t\t<style>\n\t\t:host {\n\t\t\tdisplay: inline-block;\n\t\t}\n\t\t:host a {\n\t\t\tdisplay: inline-block;\n\t\t}\n\t\t</style>\n\t\t<div>\n\t\t\t<a>\n\t\t\t\t<slot name="text"></slot>\n\t\t\t</a>\n\t\t</div>\n\t\t',this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(t.content.cloneNode(!0)),(0,s.o)(this.shadowRoot.host,this.shadowRoot.querySelector("a"),{includeAttrs:["href","target","tooltip"],mapAttrs:{tooltip:"title"}}),this.baseSelector=":host > div"}}const{anchor:h}={anchor:{selector:"> a"}},m=(0,n.qC)((0,a.s)({nestingElementTagName:"descope-text",nestingElementDestSlotName:"text",forwardAttrOptions:{includeAttrs:["variant","italic","uppercase","lowercase"]}}),(0,n.yk)({mappings:{width:(0,r.zy)(),textAlign:{},color:h,cursor:h,borderBottomWidth:h,borderBottomStyle:h,borderBottomColor:h},nestedMappings:{color:{selector:` ${i.Z.componentName}`,property:i.Z.cssVarList.color}}}),(0,c._)(h.selector),n.e4,n.Ae)(p);o(1876),customElements.define(d,m)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[528],{
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[528],{8801:(e,t,o)=>{o.d(t,{Z:()=>l,f:()=>c});var n=o(832),s=o(3535),r=o(8522);const c=(0,n.iY)("text");class a extends r.V{static get componentName(){return c}constructor(){super();const e=document.createElement("template");e.innerHTML="<slot></slot>",this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(e.content.cloneNode(!0)),this.baseSelector=":host > slot"}}const l=(0,n.qC)((0,n.yk)({mappings:{fontFamily:{},lineHeight:{},fontStyle:{},fontSize:{},fontWeight:{},width:{},color:{},letterSpacing:{},textShadow:{},borderWidth:{},borderStyle:{},borderColor:{},textTransform:{},textAlign:(0,s.zy)(),display:(0,s.zy)()}}),n.e4,n.Ae)(a)},1876:(e,t,o)=>{o.r(t),o.d(t,{Text:()=>n.Z});var n=o(8801);customElements.define(n.f,n.Z)}}]);
|
package/dist/umd/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.DescopeUI=o():e.DescopeUI=o()}(self,(()=>(()=>{var e,o,t,r={534:(e,o,t)=>{var r={"./descope-button/index.js":[3029,840,767,211,513,729,832,662],"./descope-checkbox/index.js":[7904,840,786,208,767,515,832,761],"./descope-combo/index.js":[2798,840,786,208,233,422,767,725,211,789,513,729,832,447,934,662,247],"./descope-container/index.js":[147,832,317],"./descope-date-picker/index.js":[2552,840,786,208,233,767,211,513,54,832,17],"./descope-divider/index.js":[
|
1
|
+
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.DescopeUI=o():e.DescopeUI=o()}(self,(()=>(()=>{var e,o,t,r={534:(e,o,t)=>{var r={"./descope-button/index.js":[3029,840,767,211,513,729,832,662],"./descope-checkbox/index.js":[7904,840,786,208,767,515,832,761],"./descope-combo/index.js":[2798,840,786,208,233,422,767,725,211,789,513,729,832,447,934,662,247],"./descope-container/index.js":[147,832,317],"./descope-date-picker/index.js":[2552,840,786,208,233,767,211,513,54,832,17],"./descope-divider/index.js":[6446,832,528,942,178],"./descope-email-field/index.js":[689,840,786,208,233,422,725,437,832,447,760],"./descope-link/index.js":[8029,832,528,942,58],"./descope-logo/index.js":[4641,832,984],"./descope-number-field/index.js":[4951,840,786,208,233,422,806,832,447,142],"./descope-passcode/descope-passcode-internal/index.js":[4775,832,841],"./descope-passcode/index.js":[7102,840,786,208,233,422,725,789,832,447,934,841,939],"./descope-password-field/index.js":[1721,840,786,208,233,422,767,725,211,56,832,447,320],"./descope-switch-toggle/index.js":[3774,840,786,208,767,515,832,739],"./descope-text-area/index.js":[178,840,786,233,422,101,832,322],"./descope-text-field/index.js":[9357,840,786,208,233,422,725,789,832,447,934],"./descope-text/index.js":[1876,832,528]};function s(e){if(!t.o(r,e))return Promise.resolve().then((()=>{var o=new Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}));var o=r[e],s=o[0];return Promise.all(o.slice(1).map(t.e)).then((()=>t(s)))}s.keys=()=>Object.keys(r),s.id=534,e.exports=s},7507:(e,o,t)=>{const r=t(534);e.exports=r.keys().reduce(((e,o)=>(e[o.replace(/.*?([^\/]+)\/index\.js$/,"$1")]=()=>r(o),e)),{})}},s={};function n(e){var o=s[e];if(void 0!==o)return o.exports;var t=s[e]={exports:{}};return r[e](t,t.exports,n),t.exports}n.m=r,e=[],n.O=(o,t,r,s)=>{if(!t){var d=1/0;for(a=0;a<e.length;a++){for(var[t,r,s]=e[a],i=!0,c=0;c<t.length;c++)(!1&s||d>=s)&&Object.keys(n.O).every((e=>n.O[e](t[c])))?t.splice(c--,1):(i=!1,s<d&&(d=s));if(i){e.splice(a--,1);var p=r();void 0!==p&&(o=p)}}return o}s=s||0;for(var a=e.length;a>0&&e[a-1][2]>s;a--)e[a]=e[a-1];e[a]=[t,r,s]},n.F={},n.E=e=>{Object.keys(n.F).map((o=>{n.F[o](e)}))},n.d=(e,o)=>{for(var t in o)n.o(o,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((o,t)=>(n.f[t](e,o),o)),[])),n.u=e=>(({17:"descope-date-picker-index-js",58:"descope-link-index-js",142:"descope-number-field-index-js",178:"descope-divider-index-js",247:"descope-combo-index-js",317:"descope-container-index-js",320:"descope-password-field-index-js",322:"descope-text-area-index-js",528:"descope-text-index-js",662:"descope-button-index-js",739:"descope-switch-toggle-index-js",760:"descope-email-field-index-js",761:"descope-checkbox-index-js",841:"descope-passcode-descope-passcode-internal-index-js",934:"descope-text-field-index-js",939:"descope-passcode-index-js",984:"descope-logo-index-js"}[e]||e)+".js"),n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),o={},t="DescopeUI:",n.l=(e,r,s,d)=>{if(o[e])o[e].push(r);else{var i,c;if(void 0!==s)for(var p=document.getElementsByTagName("script"),a=0;a<p.length;a++){var l=p[a];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==t+s){i=l;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,n.nc&&i.setAttribute("nonce",n.nc),i.setAttribute("data-webpack",t+s),i.src=e),o[e]=[r];var u=(t,r)=>{i.onerror=i.onload=null,clearTimeout(f);var s=o[e];if(delete o[e],i.parentNode&&i.parentNode.removeChild(i),s&&s.forEach((e=>e(r))),t)return t(r)},f=setTimeout(u.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=u.bind(null,i.onerror),i.onload=u.bind(null,i.onload),c&&document.head.appendChild(i)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var o=n.g.document;if(!e&&o&&(o.currentScript&&(e=o.currentScript.src),!e)){var t=o.getElementsByTagName("script");t.length&&(e=t[t.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={826:0};n.f.j=(o,t)=>{var r=n.o(e,o)?e[o]:void 0;if(0!==r)if(r)t.push(r[2]);else{var s=new Promise(((t,s)=>r=e[o]=[t,s]));t.push(r[2]=s);var d=n.p+n.u(o),i=new Error;n.l(d,(t=>{if(n.o(e,o)&&(0!==(r=e[o])&&(e[o]=void 0),r)){var s=t&&("load"===t.type?"missing":t.type),d=t&&t.target&&t.target.src;i.message="Loading chunk "+o+" failed.\n("+s+": "+d+")",i.name="ChunkLoadError",i.type=s,i.request=d,r[1](i)}}),"chunk-"+o,o)}},n.F.j=o=>{if(!n.o(e,o)||void 0===e[o]){e[o]=null;var t=document.createElement("link");n.nc&&t.setAttribute("nonce",n.nc),t.rel="prefetch",t.as="script",t.href=n.p+n.u(o),document.head.appendChild(t)}},n.O.j=o=>0===e[o];var o=(o,t)=>{var r,s,[d,i,c]=t,p=0;if(d.some((o=>0!==e[o]))){for(r in i)n.o(i,r)&&(n.m[r]=i[r]);if(c)var a=c(n)}for(o&&o(t);p<d.length;p++)s=d[p],n.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return n.O(a)},t=self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[];t.forEach(o.bind(null,0)),t.push=o.bind(null,t.push.bind(t))})(),n.O(0,[826],(()=>{[840,767,211,513,729,832,662,786,208,515,761,233,422,725,789,447,934,247,317,54,17,528,942,178,437,760,58,984,806,142,841,939,56,320,739,101,322].map(n.E)}),5);var d=n(7507);return n.O(d)})()));
|
package/package.json
CHANGED
@@ -0,0 +1,90 @@
|
|
1
|
+
import {
|
2
|
+
getComponentName,
|
3
|
+
createStyleMixin,
|
4
|
+
draggableMixin,
|
5
|
+
compose,
|
6
|
+
componentNameValidationMixin
|
7
|
+
} from '../../componentsHelpers';
|
8
|
+
import { forwardAttrs } from '../../componentsHelpers/createProxy/helpers';
|
9
|
+
import { matchHostStyle } from '../../componentsHelpers/createStyleMixin/helpers';
|
10
|
+
import { enforceNestingElementsStylesMixin } from '../../componentsHelpers/enforceNestingElementsStylesMixin';
|
11
|
+
import { hoverableMixin } from '../../componentsHelpers/hoverableMixin';
|
12
|
+
import { DescopeBaseClass } from '../DescopeBaseClass';
|
13
|
+
import Text from '../descope-text/Text';
|
14
|
+
|
15
|
+
export const componentName = getComponentName('link');
|
16
|
+
class RawLink extends DescopeBaseClass {
|
17
|
+
static get componentName() {
|
18
|
+
return componentName;
|
19
|
+
}
|
20
|
+
constructor() {
|
21
|
+
super();
|
22
|
+
const template = document.createElement('template');
|
23
|
+
|
24
|
+
template.innerHTML = `
|
25
|
+
<style>
|
26
|
+
:host {
|
27
|
+
display: inline-block;
|
28
|
+
}
|
29
|
+
:host a {
|
30
|
+
display: inline-block;
|
31
|
+
}
|
32
|
+
</style>
|
33
|
+
<div>
|
34
|
+
<a>
|
35
|
+
<slot name="text"></slot>
|
36
|
+
</a>
|
37
|
+
</div>
|
38
|
+
`;
|
39
|
+
|
40
|
+
this.attachShadow({ mode: 'open' });
|
41
|
+
this.shadowRoot.appendChild(template.content.cloneNode(true));
|
42
|
+
|
43
|
+
forwardAttrs(this.shadowRoot.host, this.shadowRoot.querySelector('a'), {
|
44
|
+
includeAttrs: ['href', 'target', 'tooltip'],
|
45
|
+
mapAttrs: {
|
46
|
+
tooltip: 'title'
|
47
|
+
}
|
48
|
+
});
|
49
|
+
|
50
|
+
this.baseSelector = ':host > div';
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
const selectors = {
|
55
|
+
anchor: { selector: '> a' }
|
56
|
+
};
|
57
|
+
|
58
|
+
const { anchor } = selectors;
|
59
|
+
|
60
|
+
const Link = compose(
|
61
|
+
enforceNestingElementsStylesMixin({
|
62
|
+
nestingElementTagName: 'descope-text',
|
63
|
+
nestingElementDestSlotName: 'text',
|
64
|
+
forwardAttrOptions: {
|
65
|
+
includeAttrs: ['variant', 'italic', 'uppercase', 'lowercase']
|
66
|
+
}
|
67
|
+
}),
|
68
|
+
createStyleMixin({
|
69
|
+
mappings: {
|
70
|
+
width: matchHostStyle(),
|
71
|
+
textAlign: {},
|
72
|
+
color: anchor,
|
73
|
+
cursor: anchor,
|
74
|
+
borderBottomWidth: anchor,
|
75
|
+
borderBottomStyle: anchor,
|
76
|
+
borderBottomColor: anchor
|
77
|
+
},
|
78
|
+
nestedMappings: {
|
79
|
+
color: {
|
80
|
+
selector: ` ${Text.componentName}`,
|
81
|
+
property: Text.cssVarList.color
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}),
|
85
|
+
hoverableMixin(anchor.selector),
|
86
|
+
draggableMixin,
|
87
|
+
componentNameValidationMixin
|
88
|
+
)(RawLink);
|
89
|
+
|
90
|
+
export default Link;
|
@@ -19,7 +19,7 @@ const observeAttributes = (
|
|
19
19
|
if (
|
20
20
|
mutation.type === 'attributes' &&
|
21
21
|
!excludeAttrs.includes(mutation.attributeName) &&
|
22
|
-
(!includeAttrs.length || includeAttrs.includes(
|
22
|
+
(!includeAttrs.length || includeAttrs.includes(mutation.attributeName))
|
23
23
|
) {
|
24
24
|
callback([mutation.attributeName]);
|
25
25
|
}
|
@@ -30,16 +30,17 @@ const observeAttributes = (
|
|
30
30
|
};
|
31
31
|
|
32
32
|
const createSyncAttrsCb =
|
33
|
-
(srcEle, targetEle) =>
|
33
|
+
(srcEle, targetEle, mapAttrs = {}) =>
|
34
34
|
(...attrNames) => {
|
35
35
|
attrNames.forEach((attrName) => {
|
36
|
+
const targetAttrName = mapAttrs[attrName] || attrName;
|
36
37
|
const srcAttrVal = srcEle.getAttribute(attrName);
|
37
38
|
if (srcAttrVal !== null) {
|
38
|
-
if (targetEle.getAttribute(
|
39
|
-
targetEle.setAttribute(
|
39
|
+
if (targetEle.getAttribute(targetAttrName) !== srcAttrVal) {
|
40
|
+
targetEle.setAttribute(targetAttrName, srcAttrVal);
|
40
41
|
}
|
41
42
|
} else {
|
42
|
-
targetEle.removeAttribute(
|
43
|
+
targetEle.removeAttribute(targetAttrName);
|
43
44
|
}
|
44
45
|
});
|
45
46
|
};
|
@@ -49,6 +50,10 @@ export const syncAttrs = (ele1, ele2, options) => {
|
|
49
50
|
observeAttributes(ele2, createSyncAttrsCb(ele2, ele1), options);
|
50
51
|
};
|
51
52
|
|
52
|
-
export const forwardAttrs = (source, dest, options) => {
|
53
|
-
observeAttributes(
|
53
|
+
export const forwardAttrs = (source, dest, options = {}) => {
|
54
|
+
observeAttributes(
|
55
|
+
source,
|
56
|
+
createSyncAttrsCb(source, dest, options.mapAttrs),
|
57
|
+
options
|
58
|
+
);
|
54
59
|
};
|
@@ -1,4 +1,6 @@
|
|
1
|
+
import { compose } from '..';
|
1
2
|
import { DescopeBaseClass } from '../../components/DescopeBaseClass';
|
3
|
+
import { hoverableMixin } from '../hoverableMixin';
|
2
4
|
import { syncAttrs } from './helpers';
|
3
5
|
|
4
6
|
export const createProxy = ({
|
@@ -37,7 +39,7 @@ export const createProxy = ({
|
|
37
39
|
// we want to focus on the proxy element when focusing our WC
|
38
40
|
this.addEventListener('focus', () => {
|
39
41
|
this.proxyElement.focus();
|
40
|
-
})
|
42
|
+
});
|
41
43
|
|
42
44
|
// `onkeydown` is set on `proxyElement` support proper tab-index navigation
|
43
45
|
// this support is needed since both proxy host and element catch `focus`/`blur` event
|
@@ -51,19 +53,9 @@ export const createProxy = ({
|
|
51
53
|
}
|
52
54
|
};
|
53
55
|
|
54
|
-
this.mouseoverCbRef = () => {
|
55
|
-
this.proxyElement.setAttribute('hover', '');
|
56
|
-
this.proxyElement.addEventListener(
|
57
|
-
'mouseleave',
|
58
|
-
() => this.proxyElement.removeAttribute('hover'),
|
59
|
-
{ once: true }
|
60
|
-
);
|
61
|
-
};
|
62
|
-
|
63
|
-
this.proxyElement.addEventListener('mouseover', this.mouseoverCbRef);
|
64
|
-
|
65
56
|
// sync events
|
66
|
-
this.addEventListener = (...args) =>
|
57
|
+
this.addEventListener = (...args) =>
|
58
|
+
this.proxyElement.addEventListener(...args);
|
67
59
|
|
68
60
|
syncAttrs(this.proxyElement, this.hostElement, {
|
69
61
|
excludeAttrs: excludeAttrsSync
|
@@ -82,5 +74,5 @@ export const createProxy = ({
|
|
82
74
|
}
|
83
75
|
}
|
84
76
|
|
85
|
-
return ProxyElement;
|
77
|
+
return compose(hoverableMixin())(ProxyElement);
|
86
78
|
};
|
@@ -0,0 +1,23 @@
|
|
1
|
+
export const hoverableMixin =
|
2
|
+
(relativeSelector = '') =>
|
3
|
+
(superclass) =>
|
4
|
+
class HovrerableMixinClass extends superclass {
|
5
|
+
connectedCallback() {
|
6
|
+
super.connectedCallback?.();
|
7
|
+
|
8
|
+
const onMouseOver = (e) => {
|
9
|
+
this.shadowRoot.host.setAttribute('hover', 'true');
|
10
|
+
e.target.addEventListener(
|
11
|
+
'mouseleave',
|
12
|
+
() => this.shadowRoot.host.removeAttribute('hover'),
|
13
|
+
{ once: true }
|
14
|
+
);
|
15
|
+
};
|
16
|
+
|
17
|
+
const baseElement = this.shadowRoot.querySelector(
|
18
|
+
this.baseSelector + relativeSelector
|
19
|
+
);
|
20
|
+
|
21
|
+
baseElement.addEventListener('mouseover', onMouseOver);
|
22
|
+
}
|
23
|
+
};
|
package/src/index.js
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
import './components/descope-button';
|
2
|
+
import './components/descope-checkbox';
|
2
3
|
import './components/descope-combo';
|
3
|
-
import './components/descope-text-field';
|
4
|
-
import './components/descope-number-field';
|
5
|
-
import './components/descope-email-field';
|
6
|
-
import './components/descope-password-field';
|
7
|
-
import './components/descope-text-area';
|
8
|
-
import './components/descope-date-picker';
|
9
4
|
import './components/descope-container';
|
10
|
-
import './components/descope-
|
5
|
+
import './components/descope-date-picker';
|
11
6
|
import './components/descope-divider';
|
7
|
+
import './components/descope-email-field';
|
8
|
+
import './components/descope-link';
|
12
9
|
import './components/descope-logo';
|
13
|
-
import './components/descope-
|
10
|
+
import './components/descope-number-field';
|
11
|
+
import './components/descope-passcode';
|
12
|
+
import './components/descope-password-field';
|
13
|
+
import './components/descope-switch-toggle';
|
14
|
+
import './components/descope-text';
|
15
|
+
import './components/descope-text-area';
|
16
|
+
import './components/descope-text-field';
|
14
17
|
|
15
18
|
export {
|
16
19
|
globalsThemeToStyle,
|
@@ -9,6 +9,7 @@ import switchToggle from './switchToggle';
|
|
9
9
|
import container from './container';
|
10
10
|
import logo from './logo';
|
11
11
|
import text from './text';
|
12
|
+
import link from './link';
|
12
13
|
import divider from './divider';
|
13
14
|
import passcode from './passcode';
|
14
15
|
|
@@ -24,6 +25,7 @@ export default {
|
|
24
25
|
container,
|
25
26
|
logo,
|
26
27
|
text,
|
28
|
+
link,
|
27
29
|
divider,
|
28
30
|
passcode
|
29
31
|
};
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import globals from '../globals';
|
2
|
+
import { getThemeRefs } from '../../themeHelpers';
|
3
|
+
import Link from '../../components/descope-link/Link';
|
4
|
+
|
5
|
+
const globalRefs = getThemeRefs(globals);
|
6
|
+
const vars = Link.cssVarList;
|
7
|
+
|
8
|
+
const link = {
|
9
|
+
[vars.cursor]: 'pointer',
|
10
|
+
[vars.borderBottomWidth]: '2px',
|
11
|
+
[vars.borderBottomStyle]: 'solid',
|
12
|
+
[vars.borderBottomColor]: 'transparent',
|
13
|
+
[vars.color]: globalRefs.colors.primary.main,
|
14
|
+
|
15
|
+
_hover: {
|
16
|
+
[vars.borderBottomColor]: globalRefs.colors.primary.main
|
17
|
+
},
|
18
|
+
|
19
|
+
textAlign: {
|
20
|
+
right: { [vars.textAlign]: 'right' },
|
21
|
+
left: { [vars.textAlign]: 'left' },
|
22
|
+
center: { [vars.textAlign]: 'center' }
|
23
|
+
},
|
24
|
+
|
25
|
+
_fullWidth: {
|
26
|
+
[vars.width]: '100%'
|
27
|
+
},
|
28
|
+
|
29
|
+
mode: {
|
30
|
+
primary: {
|
31
|
+
[vars.color]: globalRefs.colors.primary.main,
|
32
|
+
_hover: {
|
33
|
+
[vars.borderBottomColor]: globalRefs.colors.primary.main
|
34
|
+
}
|
35
|
+
},
|
36
|
+
secondary: {
|
37
|
+
[vars.color]: globalRefs.colors.secondary.main,
|
38
|
+
_hover: {
|
39
|
+
[vars.borderBottomColor]: globalRefs.colors.secondary.main
|
40
|
+
}
|
41
|
+
},
|
42
|
+
error: {
|
43
|
+
[vars.color]: globalRefs.colors.error.main,
|
44
|
+
_hover: {
|
45
|
+
[vars.borderBottomColor]: globalRefs.colors.error.main
|
46
|
+
}
|
47
|
+
},
|
48
|
+
success: {
|
49
|
+
[vars.color]: globalRefs.colors.success.main,
|
50
|
+
_hover: {
|
51
|
+
[vars.borderBottomColor]: globalRefs.colors.success.main
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
};
|
56
|
+
|
57
|
+
export default link;
|