@descope/web-components-ui 1.0.83 → 1.0.84

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/dist/index.esm.js +415 -311
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/umd/18.js +577 -0
  4. package/dist/umd/{233.js.LICENSE.txt → 18.js.LICENSE.txt} +6 -0
  5. package/dist/umd/803.js +1 -0
  6. package/dist/umd/boolean-fields-descope-boolean-field-internal-index-js.js +1 -0
  7. package/dist/umd/boolean-fields-descope-checkbox-index-js.js +1 -0
  8. package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js +1 -0
  9. package/dist/umd/descope-combo-box-index-js.js +1 -1
  10. package/dist/umd/descope-container-index-js.js +1 -1
  11. package/dist/umd/index.js +1 -1
  12. package/package.json +1 -1
  13. package/src/components/boolean-fields/booleanFieldMixin.js +38 -0
  14. package/src/components/boolean-fields/commonStyles.js +59 -0
  15. package/src/components/{descope-checkbox/descope-checkbox-internal/CheckboxInternal.js → boolean-fields/descope-boolean-field-internal/BooleanFieldInternal.js} +3 -3
  16. package/src/components/boolean-fields/descope-boolean-field-internal/index.js +3 -0
  17. package/src/components/{descope-checkbox → boolean-fields/descope-checkbox}/Checkbox.js +7 -95
  18. package/src/components/{descope-checkbox → boolean-fields/descope-checkbox}/index.js +3 -1
  19. package/src/components/boolean-fields/descope-switch-toggle/SwitchToggle.js +124 -0
  20. package/src/components/boolean-fields/descope-switch-toggle/index.js +8 -0
  21. package/src/components/descope-container/Container.js +2 -1
  22. package/src/index.js +2 -2
  23. package/src/index.umd.js +5 -0
  24. package/src/theme/components/checkbox.js +3 -6
  25. package/src/theme/components/container.js +1 -0
  26. package/src/theme/components/switchToggle.js +71 -4
  27. package/dist/umd/233.js +0 -577
  28. package/dist/umd/786.js +0 -2
  29. package/dist/umd/786.js.LICENSE.txt +0 -17
  30. package/dist/umd/descope-checkbox-descope-checkbox-internal-index-js.js +0 -1
  31. package/dist/umd/descope-checkbox-index-js.js +0 -1
  32. package/dist/umd/descope-switch-toggle-index-js.js +0 -1
  33. package/src/components/descope-checkbox/descope-checkbox-internal/index.js +0 -3
  34. package/src/components/descope-switch-toggle/SwitchToggle.js +0 -89
  35. package/src/components/descope-switch-toggle/index.js +0 -6
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[483],{3352:(t,e,o)=>{o.d(e,{Z:()=>p,f:()=>i});var r=o(2061),n=o(4567),a=o(4988);const i=(0,n.iY)("combo-box"),{host:s,input:d,placeholder:l,toggle:c}={host:{selector:()=>":host"},input:{selector:"::part(input-field)"},placeholder:{selector:"> input:placeholder-shown"},toggle:{selector:"::part(toggle-button)"}},b=(0,r.qC)((0,a.yk)({mappings:{width:s,height:d,padding:d,backgroundColor:d,boxShadow:d,borderColor:d,borderWidth:d,borderStyle:d,borderRadius:d,color:d,fontSize:[{},s],placeholderColor:{...l,property:"color"},toggleCursor:{...c,property:"cursor"},toggleColor:{...c,property:"color"},overlayBackground:{property:()=>b.cssVarList.overlay.backgroundColor},overlayBorder:{property:()=>b.cssVarList.overlay.border}}}),a.e4,(0,a.Iw)({name:"overlay",selector:"",mappings:{backgroundColor:{selector:"vaadin-combo-box-scroller"},cursor:{selector:"vaadin-combo-box-item"}},forward:{include:!1,attributes:["size"]}}),a.dj,a.Ae,(t=>class extends t{constructor(){super()}#t(){const t=this.shadowRoot.querySelector(this.baseSelector),e=Array.from(this.children);e.length&&(e.forEach((t=>{Object.defineProperty(t,"data-name",{value:t.getAttribute("data-name")}),Object.defineProperty(t,"data-id",{value:t.getAttribute("data-id")})})),t.items=e,t.renderer=(t,e,o)=>{t.innerHTML=o.item.outerHTML})}#e(){const t=this.baseElement.shadowRoot.querySelector("vaadin-combo-box-overlay");t._attachOverlay=function(){this.bringToFront()},t._detachOverlay=function(){},t._enterModalState=function(){}}init(){super.init?.(),this.#e(),(0,n.P$)(this,this.#t.bind(this))}}))((0,a.DM)({slots:["prefix"],wrappedEleName:"vaadin-combo-box",style:()=>'\n\t\t:host {\n\t\t\tdisplay: inline-flex;\n\t\t\tbox-sizing: border-box;\n\t\t\t-webkit-mask-image: none;\n\t\t}\n\t\tvaadin-combo-box {\n\t\t\tpadding: 0;\n\t\t}\n\t\tvaadin-combo-box [slot="input"] {\n\t\t\t-webkit-mask-image: none;\n\t\t\tmin-height: 0;\n\t\t}\n\t\tvaadin-combo-box::part(input-field) {\n\t\t\t-webkit-mask-image: none;\n\t\t\tborder-radius: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t\t',excludeAttrsSync:["tabindex","size"],componentName:i,includeForwardProps:["items","renderer"]})),p=b},1294:(t,e,o)=>{o.r(e),o.d(e,{ComboBox:()=>r.Z}),o(9314);var r=o(3352);customElements.define(r.f,r.Z)}}]);
1
+ "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[4],{3352:(t,e,o)=>{o.d(e,{Z:()=>p,f:()=>i});var r=o(2061),n=o(4567),a=o(4988);const i=(0,n.iY)("combo-box"),{host:s,input:d,placeholder:l,toggle:c}={host:{selector:()=>":host"},input:{selector:"::part(input-field)"},placeholder:{selector:"> input:placeholder-shown"},toggle:{selector:"::part(toggle-button)"}},b=(0,r.qC)((0,a.yk)({mappings:{width:s,height:d,padding:d,backgroundColor:d,boxShadow:d,borderColor:d,borderWidth:d,borderStyle:d,borderRadius:d,color:d,fontSize:[{},s],placeholderColor:{...l,property:"color"},toggleCursor:{...c,property:"cursor"},toggleColor:{...c,property:"color"},overlayBackground:{property:()=>b.cssVarList.overlay.backgroundColor},overlayBorder:{property:()=>b.cssVarList.overlay.border}}}),a.e4,(0,a.Iw)({name:"overlay",selector:"",mappings:{backgroundColor:{selector:"vaadin-combo-box-scroller"},cursor:{selector:"vaadin-combo-box-item"}},forward:{include:!1,attributes:["size"]}}),a.dj,a.Ae,(t=>class extends t{constructor(){super()}#t(){const t=this.shadowRoot.querySelector(this.baseSelector),e=Array.from(this.children);e.length&&(e.forEach((t=>{Object.defineProperty(t,"data-name",{value:t.getAttribute("data-name")}),Object.defineProperty(t,"data-id",{value:t.getAttribute("data-id")})})),t.items=e,t.renderer=(t,e,o)=>{t.innerHTML=o.item.outerHTML})}#e(){const t=this.baseElement.shadowRoot.querySelector("vaadin-combo-box-overlay");t._attachOverlay=function(){this.bringToFront()},t._detachOverlay=function(){},t._enterModalState=function(){}}init(){super.init?.(),this.#e(),(0,n.P$)(this,this.#t.bind(this))}}))((0,a.DM)({slots:["prefix"],wrappedEleName:"vaadin-combo-box",style:()=>'\n\t\t:host {\n\t\t\tdisplay: inline-flex;\n\t\t\tbox-sizing: border-box;\n\t\t\t-webkit-mask-image: none;\n\t\t}\n\t\tvaadin-combo-box {\n\t\t\tpadding: 0;\n\t\t}\n\t\tvaadin-combo-box [slot="input"] {\n\t\t\t-webkit-mask-image: none;\n\t\t\tmin-height: 0;\n\t\t}\n\t\tvaadin-combo-box::part(input-field) {\n\t\t\t-webkit-mask-image: none;\n\t\t\tborder-radius: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t\t',excludeAttrsSync:["tabindex","size"],componentName:i,includeForwardProps:["items","renderer"]})),p=b},1294:(t,e,o)=>{o.r(e),o.d(e,{ComboBox:()=>r.Z}),o(9314);var r=o(3352);customElements.define(r.f,r.Z)}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[317],{147:(t,e,o)=>{o.r(e),o.d(e,{Container:()=>a});var n=o(4988),s=o(693),r=o(2061);const i=(0,o(4567).iY)("container");class d extends((0,s.s)({componentName:i,baseSelector:":host > slot"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<style>\n\t\t\t:host > slot {\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 100%;\n\t\t\t\tdisplay: flex;\n\t\t\t\toverflow: auto;\n\t\t\t}\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t}\n\t\t</style>\n\t\t<slot></slot>\n\t"}}const a=(0,r.qC)((0,n.yk)({mappings:{height:{selector:()=>":host"},width:{selector:()=>":host"},verticalPadding:[{property:"padding-top"},{property:"padding-bottom"}],horizontalPadding:[{property:"padding-left"},{property:"padding-right"}],flexDirection:{},justifyContent:{},alignItems:{},gap:{},backgroundColor:{},borderRadius:{},borderColor:{},borderStyle:{},borderWidth:{},boxShadow:{}}}),n.e4,n.Ae)(d);customElements.define(i,a)}}]);
1
+ "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[317],{147:(t,e,o)=>{o.r(e),o.d(e,{Container:()=>a});var n=o(4988),r=o(693),s=o(2061);const i=(0,o(4567).iY)("container");class d extends((0,r.s)({componentName:i,baseSelector:":host > slot"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<style>\n\t\t\t:host > slot {\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 100%;\n\t\t\t\tdisplay: flex;\n\t\t\t\toverflow: auto;\n\t\t\t}\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t}\n\t\t</style>\n\t\t<slot></slot>\n\t"}}const a=(0,s.qC)((0,n.yk)({mappings:{height:{selector:()=>":host"},width:{selector:()=>":host"},verticalPadding:[{property:"padding-top"},{property:"padding-bottom"}],horizontalPadding:[{property:"padding-left"},{property:"padding-right"}],flexDirection:{},justifyContent:{},alignItems:{},gap:{},flexWrap:{},backgroundColor:{},borderRadius:{},borderColor:{},borderStyle:{},borderWidth:{},boxShadow:{}}}),n.e4,n.Ae)(d);customElements.define(i,a)}}]);
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,s,n={534:(e,o,s)=>{var n={"./descope-button/index.js":[3029,840,767,211,513,729,988,662],"./descope-checkbox/descope-checkbox-internal/index.js":[3537,988,878,409],"./descope-checkbox/index.js":[7904,840,786,233,208,422,725,767,789,515,988,878,409,761],"./descope-combo-box/index.js":[1294,840,786,233,208,824,314,988,483],"./descope-container/index.js":[147,988,317],"./descope-date-picker/index.js":[2552,840,786,233,208,767,824,211,513,541,988,17],"./descope-divider/index.js":[6446,988,528,178],"./descope-email-field/index.js":[689,840,786,233,208,422,725,437,988,447,760],"./descope-image/index.js":[8116,988,772],"./descope-link/index.js":[8029,988,528,58],"./descope-loader-linear/index.js":[9929,988,453],"./descope-loader-radial/index.js":[7603,988,72],"./descope-logo/index.js":[4641,988,984],"./descope-new-password/descope-new-password-internal/index.js":[1545,988,878,387,842],"./descope-new-password/index.js":[8974,840,786,233,208,422,725,767,789,211,56,988,878,447,934,387,842,320,55],"./descope-number-field/index.js":[4951,840,786,233,208,422,806,988,447,142],"./descope-passcode/descope-passcode-internal/index.js":[4775,988,878,841],"./descope-passcode/index.js":[7102,840,786,233,208,422,725,789,988,878,447,934,841,939],"./descope-password-field/index.js":[5702,840,786,233,208,422,725,767,211,56,988,387,320],"./descope-phone-field/descope-phone-field-internal/index.js":[4772,840,786,233,208,422,725,789,824,314,988,878,447,934,483,646],"./descope-phone-field/index.js":[4840,840,786,233,208,422,725,789,824,314,988,878,447,934,483,646,414],"./descope-switch-toggle/index.js":[3774,840,786,208,767,515,988,739],"./descope-text-area/index.js":[178,840,786,233,422,101,988,322],"./descope-text-field/index.js":[9357,840,786,233,208,422,725,789,988,447,934],"./descope-text/index.js":[1876,988,528]};function t(e){if(!s.o(n,e))return Promise.resolve().then((()=>{var o=new Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}));var o=n[e],t=o[0];return Promise.all(o.slice(1).map(s.e)).then((()=>s(t)))}t.keys=()=>Object.keys(n),t.id=534,e.exports=t},5561:(e,o,s)=>{"use strict";s.r(o),s.d(o,{componentsThemeManager:()=>n});const n=new class{static mountOnPropName="DescopeThemeManager";#e={};#o="light";#s=new Set;#n(){this.#s.forEach((e=>e?.()))}get currentThemeName(){return this.#o}set currentThemeName(e){this.#o=e,this.#n()}get currentTheme(){return this.#e[this.currentThemeName]}onCurrentThemeChange(e){return this.#s.add(e),()=>{this.#s.delete(e)}}set themes(e){this.#e=e,this.#n()}}},7507:(e,o,s)=>{const{componentsThemeManager:n}=s(5561),t=s(534);e.exports=t.keys().reduce(((e,o)=>(e[o.replace(/.*?([^\/]+)\/index\.js$/,"$1")]=()=>t(o),e)),{}),e.exports.componentsThemeManager=n}},t={};function r(e){var o=t[e];if(void 0!==o)return o.exports;var s=t[e]={exports:{}};return n[e](s,s.exports,r),s.exports}r.m=n,e=[],r.O=(o,s,n,t)=>{if(!s){var d=1/0;for(p=0;p<e.length;p++){for(var[s,n,t]=e[p],i=!0,c=0;c<s.length;c++)(!1&t||d>=t)&&Object.keys(r.O).every((e=>r.O[e](s[c])))?s.splice(c--,1):(i=!1,t<d&&(d=t));if(i){e.splice(p--,1);var a=n();void 0!==a&&(o=a)}}return o}t=t||0;for(var p=e.length;p>0&&e[p-1][2]>t;p--)e[p]=e[p-1];e[p]=[s,n,t]},r.F={},r.E=e=>{Object.keys(r.F).map((o=>{r.F[o](e)}))},r.d=(e,o)=>{for(var s in o)r.o(o,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:o[s]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((o,s)=>(r.f[s](e,o),o)),[])),r.u=e=>(({17:"descope-date-picker-index-js",55:"descope-new-password-index-js",58:"descope-link-index-js",72:"descope-loader-radial-index-js",142:"descope-number-field-index-js",178:"descope-divider-index-js",317:"descope-container-index-js",320:"descope-password-field-index-js",322:"descope-text-area-index-js",409:"descope-checkbox-descope-checkbox-internal-index-js",414:"descope-phone-field-index-js",453:"descope-loader-linear-index-js",483:"descope-combo-box-index-js",528:"descope-text-index-js",646:"descope-phone-field-descope-phone-field-internal-index-js",662:"descope-button-index-js",739:"descope-switch-toggle-index-js",760:"descope-email-field-index-js",761:"descope-checkbox-index-js",772:"descope-image-index-js",841:"descope-passcode-descope-passcode-internal-index-js",842:"descope-new-password-descope-new-password-internal-index-js",934:"descope-text-field-index-js",939:"descope-passcode-index-js",984:"descope-logo-index-js"}[e]||e)+".js"),r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),o={},s="DescopeUI:",r.l=(e,n,t,d)=>{if(o[e])o[e].push(n);else{var i,c;if(void 0!==t)for(var a=document.getElementsByTagName("script"),p=0;p<a.length;p++){var l=a[p];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==s+t){i=l;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,r.nc&&i.setAttribute("nonce",r.nc),i.setAttribute("data-webpack",s+t),i.src=e),o[e]=[n];var u=(s,n)=>{i.onerror=i.onload=null,clearTimeout(h);var t=o[e];if(delete o[e],i.parentNode&&i.parentNode.removeChild(i),t&&t.forEach((e=>e(n))),s)return s(n)},h=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)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var o=r.g.document;if(!e&&o&&(o.currentScript&&(e=o.currentScript.src),!e)){var s=o.getElementsByTagName("script");s.length&&(e=s[s.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),(()=>{var e={826:0};r.f.j=(o,s)=>{var n=r.o(e,o)?e[o]:void 0;if(0!==n)if(n)s.push(n[2]);else{var t=new Promise(((s,t)=>n=e[o]=[s,t]));s.push(n[2]=t);var d=r.p+r.u(o),i=new Error;r.l(d,(s=>{if(r.o(e,o)&&(0!==(n=e[o])&&(e[o]=void 0),n)){var t=s&&("load"===s.type?"missing":s.type),d=s&&s.target&&s.target.src;i.message="Loading chunk "+o+" failed.\n("+t+": "+d+")",i.name="ChunkLoadError",i.type=t,i.request=d,n[1](i)}}),"chunk-"+o,o)}},r.F.j=o=>{if(!r.o(e,o)||void 0===e[o]){e[o]=null;var s=document.createElement("link");r.nc&&s.setAttribute("nonce",r.nc),s.rel="prefetch",s.as="script",s.href=r.p+r.u(o),document.head.appendChild(s)}},r.O.j=o=>0===e[o];var o=(o,s)=>{var n,t,[d,i,c]=s,a=0;if(d.some((o=>0!==e[o]))){for(n in i)r.o(i,n)&&(r.m[n]=i[n]);if(c)var p=c(r)}for(o&&o(s);a<d.length;a++)t=d[a],r.o(e,t)&&e[t]&&e[t][0](),e[t]=0;return r.O(p)},s=self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[];s.forEach(o.bind(null,0)),s.push=o.bind(null,s.push.bind(s))})(),r.O(0,[826],(()=>{[840,767,211,513,729,988,662,878,409,786,233,208,422,725,789,515,761,824,314,483,317,541,17,528,178,437,447,760,772,58,453,72,984,387,842,56,934,320,55,806,142,841,939,646,414,739,101,322].map(r.E)}),5);var d=r(7507);return r.O(d)})()));
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,s,n={534:(e,o,s)=>{var n={"./boolean-fields/descope-boolean-field-internal/index.js":[6676,988,878,769],"./boolean-fields/descope-checkbox/index.js":[3570,840,18,208,422,725,789,767,515,988,878,769,803,726],"./boolean-fields/descope-switch-toggle/index.js":[4332,840,18,208,422,725,789,767,515,988,878,769,803,483],"./descope-button/index.js":[3029,840,767,211,513,729,988,662],"./descope-combo-box/index.js":[1294,840,18,208,824,314,988,4],"./descope-container/index.js":[147,988,317],"./descope-date-picker/index.js":[2552,840,18,208,767,824,211,513,541,988,17],"./descope-divider/index.js":[6446,988,528,178],"./descope-email-field/index.js":[689,840,18,208,422,725,437,988,447,760],"./descope-image/index.js":[8116,988,772],"./descope-link/index.js":[8029,988,528,58],"./descope-loader-linear/index.js":[9929,988,453],"./descope-loader-radial/index.js":[7603,988,72],"./descope-logo/index.js":[4641,988,984],"./descope-new-password/descope-new-password-internal/index.js":[1545,988,878,387,842],"./descope-new-password/index.js":[8974,840,18,208,422,725,789,767,211,56,988,878,447,934,387,842,320,55],"./descope-number-field/index.js":[4951,840,18,208,422,806,988,447,142],"./descope-passcode/descope-passcode-internal/index.js":[4775,988,878,841],"./descope-passcode/index.js":[7102,840,18,208,422,725,789,988,878,447,934,841,939],"./descope-password-field/index.js":[5702,840,18,208,422,725,767,211,56,988,387,320],"./descope-phone-field/descope-phone-field-internal/index.js":[4772,840,18,208,422,725,789,824,314,988,878,447,934,4,646],"./descope-phone-field/index.js":[4840,840,18,208,422,725,789,824,314,988,878,447,934,4,646,414],"./descope-text-area/index.js":[178,840,18,422,101,988,322],"./descope-text-field/index.js":[9357,840,18,208,422,725,789,988,447,934],"./descope-text/index.js":[1876,988,528]};function t(e){if(!s.o(n,e))return Promise.resolve().then((()=>{var o=new Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}));var o=n[e],t=o[0];return Promise.all(o.slice(1).map(s.e)).then((()=>s(t)))}t.keys=()=>Object.keys(n),t.id=534,e.exports=t},5561:(e,o,s)=>{"use strict";s.r(o),s.d(o,{componentsThemeManager:()=>n});const n=new class{static mountOnPropName="DescopeThemeManager";#e={};#o="light";#s=new Set;#n(){this.#s.forEach((e=>e?.()))}get currentThemeName(){return this.#o}set currentThemeName(e){this.#o=e,this.#n()}get currentTheme(){return this.#e[this.currentThemeName]}onCurrentThemeChange(e){return this.#s.add(e),()=>{this.#s.delete(e)}}set themes(e){this.#e=e,this.#n()}}},7507:(e,o,s)=>{const{componentsThemeManager:n}=s(5561),t=s(534);e.exports=t.keys().reduce(((e,o)=>{const s=o.replace(/.*?([^\/]+)\/index\.js$/,"$1");return s.endsWith("-internal")||(e[s]=()=>t(o)),e}),{}),e.exports.componentsThemeManager=n}},t={};function r(e){var o=t[e];if(void 0!==o)return o.exports;var s=t[e]={exports:{}};return n[e](s,s.exports,r),s.exports}r.m=n,e=[],r.O=(o,s,n,t)=>{if(!s){var d=1/0;for(p=0;p<e.length;p++){for(var[s,n,t]=e[p],i=!0,c=0;c<s.length;c++)(!1&t||d>=t)&&Object.keys(r.O).every((e=>r.O[e](s[c])))?s.splice(c--,1):(i=!1,t<d&&(d=t));if(i){e.splice(p--,1);var a=n();void 0!==a&&(o=a)}}return o}t=t||0;for(var p=e.length;p>0&&e[p-1][2]>t;p--)e[p]=e[p-1];e[p]=[s,n,t]},r.F={},r.E=e=>{Object.keys(r.F).map((o=>{r.F[o](e)}))},r.d=(e,o)=>{for(var s in o)r.o(o,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:o[s]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((o,s)=>(r.f[s](e,o),o)),[])),r.u=e=>(({4:"descope-combo-box-index-js",17:"descope-date-picker-index-js",55:"descope-new-password-index-js",58:"descope-link-index-js",72:"descope-loader-radial-index-js",142:"descope-number-field-index-js",178:"descope-divider-index-js",317:"descope-container-index-js",320:"descope-password-field-index-js",322:"descope-text-area-index-js",414:"descope-phone-field-index-js",453:"descope-loader-linear-index-js",483:"boolean-fields-descope-switch-toggle-index-js",528:"descope-text-index-js",646:"descope-phone-field-descope-phone-field-internal-index-js",662:"descope-button-index-js",726:"boolean-fields-descope-checkbox-index-js",760:"descope-email-field-index-js",769:"boolean-fields-descope-boolean-field-internal-index-js",772:"descope-image-index-js",841:"descope-passcode-descope-passcode-internal-index-js",842:"descope-new-password-descope-new-password-internal-index-js",934:"descope-text-field-index-js",939:"descope-passcode-index-js",984:"descope-logo-index-js"}[e]||e)+".js"),r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),o={},s="DescopeUI:",r.l=(e,n,t,d)=>{if(o[e])o[e].push(n);else{var i,c;if(void 0!==t)for(var a=document.getElementsByTagName("script"),p=0;p<a.length;p++){var l=a[p];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==s+t){i=l;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,r.nc&&i.setAttribute("nonce",r.nc),i.setAttribute("data-webpack",s+t),i.src=e),o[e]=[n];var u=(s,n)=>{i.onerror=i.onload=null,clearTimeout(f);var t=o[e];if(delete o[e],i.parentNode&&i.parentNode.removeChild(i),t&&t.forEach((e=>e(n))),s)return s(n)},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)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var o=r.g.document;if(!e&&o&&(o.currentScript&&(e=o.currentScript.src),!e)){var s=o.getElementsByTagName("script");s.length&&(e=s[s.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),(()=>{var e={826:0};r.f.j=(o,s)=>{var n=r.o(e,o)?e[o]:void 0;if(0!==n)if(n)s.push(n[2]);else{var t=new Promise(((s,t)=>n=e[o]=[s,t]));s.push(n[2]=t);var d=r.p+r.u(o),i=new Error;r.l(d,(s=>{if(r.o(e,o)&&(0!==(n=e[o])&&(e[o]=void 0),n)){var t=s&&("load"===s.type?"missing":s.type),d=s&&s.target&&s.target.src;i.message="Loading chunk "+o+" failed.\n("+t+": "+d+")",i.name="ChunkLoadError",i.type=t,i.request=d,n[1](i)}}),"chunk-"+o,o)}},r.F.j=o=>{if(!r.o(e,o)||void 0===e[o]){e[o]=null;var s=document.createElement("link");r.nc&&s.setAttribute("nonce",r.nc),s.rel="prefetch",s.as="script",s.href=r.p+r.u(o),document.head.appendChild(s)}},r.O.j=o=>0===e[o];var o=(o,s)=>{var n,t,[d,i,c]=s,a=0;if(d.some((o=>0!==e[o]))){for(n in i)r.o(i,n)&&(r.m[n]=i[n]);if(c)var p=c(r)}for(o&&o(s);a<d.length;a++)t=d[a],r.o(e,t)&&e[t]&&e[t][0](),e[t]=0;return r.O(p)},s=self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[];s.forEach(o.bind(null,0)),s.push=o.bind(null,s.push.bind(s))})(),r.O(0,[826],(()=>{[988,878,769,840,18,208,422,725,789,767,515,803,726,483,211,513,729,662,824,314,4,317,541,17,528,178,437,447,760,772,58,453,72,984,387,842,56,934,320,55,806,142,841,939,646,414,101,322].map(r.E)}),5);var d=r(7507);return r.O(d)})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/web-components-ui",
3
- "version": "1.0.83",
3
+ "version": "1.0.84",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -0,0 +1,38 @@
1
+ import { forwardAttrs, forwardProps, syncAttrs } from "../../helpers/componentHelpers";
2
+ import { componentName as descopeInternalComponentName } from './descope-boolean-field-internal/BooleanFieldInternal'
3
+
4
+ export const booleanFieldMixin = (superclass) =>
5
+ class BooleanFieldMixinClass extends superclass {
6
+ constructor() {
7
+ super();
8
+ }
9
+
10
+ init() {
11
+ super.init?.();
12
+
13
+ const template = document.createElement('template');
14
+ template.innerHTML = `
15
+ <${descopeInternalComponentName}
16
+ tabindex="-1"
17
+ slot="input"
18
+ ></${descopeInternalComponentName}>
19
+ `;
20
+
21
+ this.baseElement.appendChild(template.content.cloneNode(true));
22
+ this.inputElement = this.shadowRoot.querySelector(descopeInternalComponentName);
23
+ this.checkbox = this.inputElement.querySelector('vaadin-checkbox');
24
+
25
+ forwardAttrs(this, this.inputElement, {
26
+ includeAttrs: [
27
+ 'required',
28
+ 'full-width',
29
+ 'size',
30
+ 'label',
31
+ 'invalid',
32
+ ]
33
+ });
34
+
35
+ forwardProps(this.inputElement, this, ['checked']);
36
+ syncAttrs(this, this.inputElement, { includeAttrs: ['checked'] });
37
+ }
38
+ };
@@ -0,0 +1,59 @@
1
+ export default `
2
+ :host {
3
+ --vaadin-field-default-width: auto;
4
+ display: inline-flex;
5
+ }
6
+ .wrapper {
7
+ display: flex;
8
+ }
9
+
10
+ vaadin-text-field {
11
+ position: relative;
12
+ padding: 0;
13
+ display: inline-flex;
14
+ align-items: flex-start;
15
+ }
16
+ vaadin-text-field::before {
17
+ height: 0;
18
+ margin: 0;
19
+ }
20
+ vaadin-text-field::part(label) {
21
+ position: absolute;
22
+ top: 0;
23
+ }
24
+ vaadin-text-field::part(input-field) {
25
+ padding: 0;
26
+ background: none;
27
+ min-height: 0;
28
+ }
29
+ vaadin-text-field::part(input-field)::after {
30
+ background: none;
31
+ }
32
+ vaadin-text-field[focus-ring]::part(input-field) {
33
+ box-shadow: none;
34
+ }
35
+ vaadin-text-field[required]::part(required-indicator)::after {
36
+ content: "*";
37
+ }
38
+
39
+ vaadin-checkbox [slot="label"] {
40
+ align-self: flex-start;
41
+ opacity: 0;
42
+ padding: 0;
43
+ }
44
+ [required] vaadin-checkbox [slot="label"] {
45
+ padding-right: 1em;
46
+ }
47
+ vaadin-checkbox::part(checkbox) {
48
+ margin: 0;
49
+ }
50
+ vaadin-checkbox[focus-ring]::part(checkbox) {
51
+ box-shadow: none;
52
+ }
53
+
54
+ descope-boolean-field-internal {
55
+ -webkit-mask-image: none;
56
+ min-height: 0;
57
+ padding: 0;
58
+ }
59
+ `;
@@ -1,7 +1,7 @@
1
1
  import { createBaseInputClass } from '../../../baseClasses/createBaseInputClass';
2
2
  import { forwardAttrs, getComponentName, syncAttrs } from '../../../helpers/componentHelpers';
3
3
 
4
- export const componentName = getComponentName('checkbox-internal');
4
+ export const componentName = getComponentName('boolean-field-internal');
5
5
 
6
6
  const forwardAttributes = [
7
7
  'disabled',
@@ -12,7 +12,7 @@ const forwardAttributes = [
12
12
 
13
13
  const BaseInputClass = createBaseInputClass({ componentName, baseSelector: 'div' })
14
14
 
15
- class CheckboxInternal extends BaseInputClass {
15
+ class BooleanInputInternal extends BaseInputClass {
16
16
  constructor() {
17
17
  super();
18
18
  this.innerHTML = `
@@ -63,4 +63,4 @@ class CheckboxInternal extends BaseInputClass {
63
63
  };
64
64
  }
65
65
 
66
- export default CheckboxInternal;
66
+ export default BooleanInputInternal;
@@ -0,0 +1,3 @@
1
+ import BooleanFieldInternal, { componentName } from "./BooleanFieldInternal"
2
+
3
+ customElements.define(componentName, BooleanFieldInternal);
@@ -1,52 +1,17 @@
1
- import { getComponentName, forwardAttrs, syncAttrs, forwardProps } from '../../helpers/componentHelpers';
2
- import { componentName as descopeInternalComponentName } from './descope-checkbox-internal/CheckboxInternal';
3
- import { compose } from '../../helpers';
1
+ import { getComponentName } from '../../../helpers/componentHelpers';
2
+ import { compose } from '../../../helpers';
4
3
  import {
5
4
  createStyleMixin,
6
5
  proxyInputMixin,
7
6
  draggableMixin,
8
7
  componentNameValidationMixin,
9
8
  createProxy
10
- } from '../../mixins';
9
+ } from '../../../mixins';
10
+ import { booleanFieldMixin } from '../booleanFieldMixin';
11
+ import commonStyles from '../commonStyles';
11
12
 
12
13
  export const componentName = getComponentName('checkbox');
13
14
 
14
- const customMixin = (superclass) =>
15
- class CheckboxMixinClass extends superclass {
16
- constructor() {
17
- super();
18
- }
19
-
20
- init() {
21
- super.init?.();
22
-
23
- const template = document.createElement('template');
24
- template.innerHTML = `
25
- <${descopeInternalComponentName}
26
- tabindex="-1"
27
- slot="input"
28
- ></${descopeInternalComponentName}>
29
- `;
30
-
31
- this.baseElement.appendChild(template.content.cloneNode(true));
32
- this.inputElement = this.shadowRoot.querySelector(descopeInternalComponentName);
33
- this.checkbox = this.inputElement.querySelector('vaadin-checkbox');
34
-
35
- forwardAttrs(this, this.inputElement, {
36
- includeAttrs: [
37
- 'required',
38
- 'full-width',
39
- 'size',
40
- 'label',
41
- 'invalid',
42
- ]
43
- });
44
-
45
- forwardProps(this.inputElement, this, ['checked']);
46
- syncAttrs(this, this.inputElement, { includeAttrs: ['checked'] });
47
- }
48
- };
49
-
50
15
  const {
51
16
  host,
52
17
  component,
@@ -115,71 +80,18 @@ const Checkbox = compose(
115
80
  draggableMixin,
116
81
  proxyInputMixin,
117
82
  componentNameValidationMixin,
118
- customMixin
83
+ booleanFieldMixin
119
84
  )(
120
85
  createProxy({
121
86
  slots: [],
122
87
  wrappedEleName: 'vaadin-text-field',
123
88
  style: `
124
- :host {
125
- --vaadin-field-default-width: auto;
126
- display: inline-flex;
127
- }
128
- .wrapper {
129
- display: flex;
130
- }
131
-
132
- vaadin-text-field {
133
- position: relative;
134
- padding: 0;
135
- display: inline-flex;
136
- align-items: flex-start;
137
- }
138
- vaadin-text-field[focus-ring]::part(input-field) {
139
- box-shadow: none;
140
- }
141
- vaadin-text-field::before {
142
- height: auto;
143
- margin: 0;
144
- }
145
- vaadin-text-field::part(input-field) {
146
- padding: 0;
147
- background: none;
148
- min-height: 0;
149
- }
150
- vaadin-text-field::part(input-field)::after {
151
- background: none;
152
- }
153
- vaadin-text-field::part(label) {
154
- position: absolute;
155
- top: 0;
156
- }
157
- vaadin-text-field[required]::part(required-indicator)::after {
158
- content: "*";
159
- }
89
+ ${commonStyles}
160
90
 
161
91
  vaadin-checkbox [slot="label"] {
162
- opacity: 0;
163
92
  height: 100%;
164
- align-self: flex-start;
165
- padding: 0;
166
93
  cursor: pointer;
167
94
  }
168
- [required] vaadin-checkbox [slot="label"] {
169
- padding-right: 1em;
170
- }
171
- vaadin-checkbox::part(checkbox) {
172
- margin: 0;
173
- }
174
- vaadin-checkbox[focus-ring]::part(checkbox) {
175
- box-shadow: none;
176
- }
177
-
178
- descope-checkbox-internal {
179
- -webkit-mask-image: none;
180
- min-height: 0;
181
- padding: 0;
182
- }
183
95
  `,
184
96
  excludeAttrsSync: ['tabindex'],
185
97
  componentName
@@ -1,6 +1,8 @@
1
1
  import Checkbox, { componentName } from './Checkbox';
2
2
  import '@vaadin/checkbox'
3
3
  import '@vaadin/text-field'
4
- import './descope-checkbox-internal'
4
+ import '../descope-boolean-field-internal';
5
5
 
6
6
  customElements.define(componentName, Checkbox);
7
+
8
+ export { Checkbox };
@@ -0,0 +1,124 @@
1
+ import { getComponentName } from '../../../helpers/componentHelpers'
2
+ import { compose } from '../../../helpers';
3
+ import {
4
+ createStyleMixin,
5
+ proxyInputMixin,
6
+ draggableMixin,
7
+ componentNameValidationMixin,
8
+ createProxy
9
+ } from '../../../mixins';
10
+ import { booleanFieldMixin } from '../booleanFieldMixin';
11
+ import commonStyles from '../commonStyles';
12
+
13
+ export const componentName = getComponentName('switch-toggle');
14
+
15
+ const {
16
+ host,
17
+ component,
18
+ checkboxElement: track,
19
+ checkboxSurface: knob,
20
+ checkboxHiddenLabel,
21
+ label,
22
+ requiredIndicator,
23
+ } = {
24
+ host: { selector: () => ':host' },
25
+ label: { selector: '::part(label)' },
26
+ requiredIndicator: { selector: '::part(required-indicator)::after' },
27
+ component: { selector: 'vaadin-checkbox' },
28
+ checkboxElement: { selector: 'vaadin-checkbox::part(checkbox)' },
29
+ checkboxSurface: { selector: 'vaadin-checkbox::part(checkbox)::after' },
30
+ checkboxHiddenLabel: { selector: 'vaadin-checkbox [slot="label"]' },
31
+ };
32
+
33
+ const SwitchToggle = compose(
34
+ createStyleMixin({
35
+ mappings: {
36
+ width: host,
37
+ cursor: [component, checkboxHiddenLabel, track],
38
+ fontSize: [component, label, checkboxHiddenLabel],
39
+
40
+ // Track
41
+ trackBorderWidth: { ...track, property: 'border-width' },
42
+ trackBorderStyle: { ...track, property: 'border-style' },
43
+ trackBorderColor: { ...track, property: 'border-color' },
44
+
45
+ // Checkbox
46
+ trackBackgroundColor: { ...track, property: 'background-color' },
47
+ trackRadius: { ...track, property: 'border-radius' },
48
+
49
+ trackWidth: [
50
+ { ...track, property: 'width' },
51
+ ],
52
+ trackHeight: [
53
+ { ...knob, property: 'font-size' },
54
+ { ...track, property: 'height' }
55
+ ],
56
+ switchOutlineWidth: { ...track, property: 'outline-width' },
57
+ switchOutlineOffset: { ...track, property: 'outline-offset' },
58
+ switchOutlineColor: { ...track, property: 'outline-color' },
59
+ switchOutlineStyle: { ...track, property: 'outline-style' },
60
+
61
+ // Knob
62
+ knobSize: [
63
+ { ...knob, property: 'width' },
64
+ { ...knob, property: 'height' },
65
+ ],
66
+ knobTextColor: { ...knob, property: 'color' },
67
+ knobRadius: { ...knob, property: 'border-radius' },
68
+ knobTransition: { ...knob, property: 'transition' },
69
+ knobColor: { ...knob, property: 'background-color' },
70
+ knobTopOffset: { ...knob, property: 'top' },
71
+ knobPosition: { ...knob, property: 'left' },
72
+
73
+ // Label
74
+ labelMargin: [
75
+ { ...label, property: 'padding-left' },
76
+ { ...checkboxHiddenLabel, property: 'padding-left' }
77
+ ],
78
+ labelLineHeight: [
79
+ { ...label, property: 'line-height' },
80
+ { ...checkboxHiddenLabel, property: 'line-height' }
81
+ ],
82
+ labelFontWeight: [
83
+ { ...label, property: 'font-weight' },
84
+ { ...checkboxHiddenLabel, property: 'font-weight' }
85
+ ],
86
+ labelTextColor: [
87
+ { ...label, property: 'color' },
88
+ { ...requiredIndicator, property: 'color' },
89
+ ],
90
+ },
91
+ }),
92
+ draggableMixin,
93
+ proxyInputMixin,
94
+ componentNameValidationMixin,
95
+ booleanFieldMixin
96
+ )(
97
+ createProxy({
98
+ slots: [],
99
+ wrappedEleName: 'vaadin-text-field',
100
+ style: () => `
101
+ ${commonStyles}
102
+
103
+ vaadin-text-field::part(label) {
104
+ left: calc(var(${SwitchToggle.cssVarList.trackWidth}) + var(${SwitchToggle.cssVarList.trackBorderWidth}) * 2);
105
+ }
106
+
107
+ vaadin-checkbox[active]::part(checkbox) {
108
+ transform: none;
109
+ }
110
+ vaadin-checkbox[checked]::part(checkbox) {
111
+ background: none;
112
+ }
113
+ vaadin-checkbox::part(checkbox)::after {
114
+ position: absolute;
115
+ opacity: 1;
116
+ content: '';
117
+ }
118
+ `,
119
+ excludeAttrsSync: ['tabindex'],
120
+ componentName
121
+ })
122
+ );
123
+
124
+ export default SwitchToggle;
@@ -0,0 +1,8 @@
1
+ import SwitchToggle, { componentName } from './SwitchToggle';
2
+ import '@vaadin/checkbox'
3
+ import '@vaadin/text-field'
4
+ import '../descope-boolean-field-internal';
5
+
6
+ customElements.define(componentName, SwitchToggle);
7
+
8
+ export { SwitchToggle };
@@ -9,7 +9,7 @@ import { getComponentName } from '../../helpers/componentHelpers';
9
9
 
10
10
  export const componentName = getComponentName('container');
11
11
 
12
- class RawContainer extends createBaseClass({componentName, baseSelector: ':host > slot'}) {
12
+ class RawContainer extends createBaseClass({ componentName, baseSelector: ':host > slot' }) {
13
13
  constructor() {
14
14
  super();
15
15
 
@@ -50,6 +50,7 @@ const Container = compose(
50
50
  justifyContent: {},
51
51
  alignItems: {},
52
52
  gap: {},
53
+ flexWrap: {},
53
54
 
54
55
  backgroundColor: {},
55
56
  borderRadius: {},
package/src/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import './components/descope-button';
2
- import './components/descope-checkbox';
2
+ import './components/boolean-fields/descope-checkbox';
3
+ import './components/boolean-fields/descope-switch-toggle';
3
4
  import './components/descope-loader-linear';
4
5
  import './components/descope-loader-radial';
5
6
  import './components/descope-container';
@@ -11,7 +12,6 @@ import './components/descope-logo';
11
12
  import './components/descope-number-field';
12
13
  import './components/descope-passcode';
13
14
  import './components/descope-password-field';
14
- import './components/descope-switch-toggle';
15
15
  import './components/descope-text';
16
16
  import './components/descope-text-area';
17
17
  import './components/descope-text-field';
package/src/index.umd.js CHANGED
@@ -12,6 +12,11 @@ const components = import.meta.webpackContext('./components', {
12
12
  // e.g. ./descope-button/index.js
13
13
  module.exports = components.keys().reduce((acc, key) => {
14
14
  const componentName = key.replace(/.*?([^\/]+)\/index\.js$/, '$1');
15
+
16
+ if (componentName.endsWith('-internal')) {
17
+ return acc;
18
+ }
19
+
15
20
  acc[componentName] = () => components(key);
16
21
 
17
22
  return acc;
@@ -1,6 +1,6 @@
1
1
  import globals from '../globals';
2
2
  import { getThemeRefs } from '../../helpers/themeHelpers';
3
- import Checkbox from '../../components/descope-checkbox/Checkbox';
3
+ import Checkbox from '../../components/boolean-fields/descope-checkbox/Checkbox';
4
4
 
5
5
  const globalRefs = getThemeRefs(globals);
6
6
  const vars = Checkbox.cssVarList;
@@ -17,36 +17,33 @@ const checkbox = {
17
17
  [vars.checkboxHeight]: 'calc(1em - 2px)',
18
18
  [vars.labelMargin]: 'calc(1em + 5px)',
19
19
 
20
+ [vars.checkboxRadius]: globalRefs.radius.sm,
21
+
20
22
  size: {
21
23
  xs: {
22
24
  [vars.labelFontSize]: '12px',
23
25
  [vars.labelLineHeight]: '1.1em',
24
26
  [vars.checkmarkSize]: '18px',
25
- [vars.checkboxRadius]: globalRefs.radius.sm,
26
27
  },
27
28
  sm: {
28
29
  [vars.labelFontSize]: '14px',
29
30
  [vars.labelLineHeight]: '1.2em',
30
31
  [vars.checkmarkSize]: '22px',
31
- [vars.checkboxRadius]: globalRefs.radius.sm,
32
32
  },
33
33
  md: {
34
34
  [vars.labelFontSize]: '16px',
35
35
  [vars.labelLineHeight]: '1.35em',
36
36
  [vars.checkmarkSize]: '26px',
37
- [vars.checkboxRadius]: globalRefs.radius.sm,
38
37
  },
39
38
  lg: {
40
39
  [vars.labelFontSize]: '20px',
41
40
  [vars.labelLineHeight]: '1.5em',
42
41
  [vars.checkmarkSize]: '34px',
43
- [vars.checkboxRadius]: globalRefs.radius.sm,
44
42
  },
45
43
  xl: {
46
44
  [vars.labelFontSize]: '20px',
47
45
  [vars.labelLineHeight]: '1.75em',
48
46
  [vars.checkmarkSize]: '38px',
49
- [vars.checkboxRadius]: globalRefs.radius.sm,
50
47
  }
51
48
  },
52
49
 
@@ -43,6 +43,7 @@ const container = {
43
43
  [vars.flexDirection]: 'row',
44
44
  [vars.alignItems]: helperRefs.verticalAlignment,
45
45
  [vars.justifyContent]: helperRefs.horizontalAlignment,
46
+ [vars.flexWrap]: 'wrap',
46
47
  horizontalAlignment: {
47
48
  spaceBetween: { [helperVars.horizontalAlignment]: 'space-between' },
48
49
  }
@@ -1,10 +1,77 @@
1
- import SwitchToggle from '../../components/descope-switch-toggle/SwitchToggle';
1
+ import globals from '../globals';
2
+ import { getThemeRefs } from '../../helpers/themeHelpers';
3
+ import SwitchToggle from '../../components/boolean-fields/descope-switch-toggle/SwitchToggle';
2
4
 
5
+ const knobMargin = '2px';
6
+ const checkboxHeight = '1.25em';
7
+ const trackBorderWidth = '2px';
8
+
9
+ const globalRefs = getThemeRefs(globals);
3
10
  const vars = SwitchToggle.cssVarList;
4
11
 
5
12
  const switchToggle = {
6
- [vars.width]: '70px',
7
- [vars.cursor]: [{}, { selector: '> label' }]
13
+ size: {
14
+ xs: { [vars.fontSize]: '8px' },
15
+ sm: { [vars.fontSize]: '12px' },
16
+ md: { [vars.fontSize]: '16px' },
17
+ lg: { [vars.fontSize]: '20px' },
18
+ xl: { [vars.fontSize]: '24px' }
19
+ },
20
+
21
+ [vars.cursor]: 'pointer',
22
+
23
+ [vars.trackBorderStyle]: 'solid',
24
+ [vars.trackBorderWidth]: trackBorderWidth,
25
+ [vars.trackBorderColor]: globalRefs.colors.surface.contrast,
26
+
27
+ [vars.trackBackgroundColor]: 'none',
28
+ [vars.trackRadius]: globalRefs.radius.md,
29
+ [vars.trackWidth]: '2.5em',
30
+ [vars.trackHeight]: checkboxHeight,
31
+
32
+ [vars.knobSize]: `calc(1em - ${knobMargin})`,
33
+ [vars.knobRadius]: '50%',
34
+ [vars.knobTopOffset]: '1px',
35
+ [vars.knobColor]: globalRefs.colors.surface.contrast,
36
+ [vars.knobPosition]: knobMargin,
37
+ [vars.knobTransition]: '0.3s',
38
+
39
+ [vars.labelTextColor]: globalRefs.colors.surface.contrast,
40
+ [vars.labelFontWeight]: '400',
41
+ [vars.labelLineHeight]: `calc(${checkboxHeight} + 0.25em)`,
42
+ [vars.labelMargin]: '0.25em',
43
+
44
+ _fullWidth: {
45
+ [vars.width]: '100%',
46
+ },
47
+
48
+ _checked: {
49
+ [vars.trackBorderColor]: globalRefs.colors.primary.main,
50
+ [vars.knobPosition]: `calc(100% - var(${vars.knobSize}) - ${knobMargin})`,
51
+ [vars.knobColor]: globalRefs.colors.primary.main,
52
+ [vars.knobTextColor]: globalRefs.colors.primary.contrast,
53
+ },
54
+
55
+ _disabled: {
56
+ [vars.cursor]: 'not-allowed', // todo: fix cursor
57
+ [vars.knobColor]: globalRefs.colors.surface.main,
58
+ [vars.trackBorderColor]: globalRefs.colors.surface.main,
59
+ [vars.trackBackgroundColor]: globalRefs.colors.surface.light,
60
+ },
61
+
62
+ _focusRing: {
63
+ [vars.switchOutlineWidth]: '2px',
64
+ [vars.switchOutlineOffset]: '1px',
65
+ [vars.switchOutlineColor]: globalRefs.colors.primary.main,
66
+ [vars.switchOutlineStyle]: 'solid'
67
+ },
68
+
69
+ _invalid: {
70
+ [vars.switchOutlineColor]: globalRefs.colors.error.main,
71
+ [vars.trackBorderColor]: globalRefs.colors.error.main,
72
+ [vars.knobColor]: globalRefs.colors.error.main,
73
+ [vars.labelTextColor]: globalRefs.colors.error.main
74
+ },
8
75
  };
9
76
 
10
- export default switchToggle;
77
+ export default switchToggle;