@descope/web-components-ui 1.0.221 → 1.0.223
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +790 -642
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +778 -631
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/1000.js +1 -1
- package/dist/umd/1037.js +2 -0
- package/dist/umd/1037.js.LICENSE.txt +5 -0
- package/dist/umd/1932.js +310 -0
- package/dist/umd/1932.js.LICENSE.txt +5 -0
- package/dist/umd/1990.js +1 -1
- package/dist/umd/262.js +2 -0
- package/dist/umd/262.js.LICENSE.txt +5 -0
- package/dist/umd/3660.js +17 -0
- package/dist/umd/3660.js.LICENSE.txt +23 -0
- package/dist/umd/3952.js +123 -0
- package/dist/umd/{1883.js → 4273.js} +5 -5
- package/dist/umd/5345.js +94 -0
- package/dist/umd/5345.js.LICENSE.txt +11 -0
- package/dist/umd/5806.js +1 -1
- package/dist/umd/6116.js +8 -8
- package/dist/umd/7056.js +1 -1
- package/dist/umd/7101.js +1 -1
- package/dist/umd/7196.js +360 -0
- package/dist/umd/{1852.js.LICENSE.txt → 7196.js.LICENSE.txt} +0 -12
- package/dist/umd/8725.js +2 -2
- package/dist/umd/9211.js +2 -2
- package/dist/umd/9437.js +1 -1
- package/dist/umd/9515.js +1 -1
- package/dist/umd/descope-combo-box-index-js.js +1 -1
- package/dist/umd/descope-modal-index-js.js +1 -0
- package/dist/umd/index.js +1 -1
- package/package.json +3 -2
- package/src/components/descope-modal/ModalClass.js +109 -0
- package/src/components/descope-modal/index.js +6 -0
- package/src/index.cjs.js +1 -0
- package/src/mixins/createStyleMixin/helpers.js +2 -2
- package/src/mixins/createStyleMixin/index.js +2 -2
- package/src/mixins/portalMixin.js +24 -4
- package/src/theme/components/button.js +7 -0
- package/src/theme/components/index.js +2 -0
- package/src/theme/components/modal.js +16 -0
- package/dist/umd/1852.js +0 -375
- package/dist/umd/4767.js +0 -215
- /package/dist/umd/{4767.js.LICENSE.txt → 3952.js.LICENSE.txt} +0 -0
- /package/dist/umd/{1883.js.LICENSE.txt → 4273.js.LICENSE.txt} +0 -0
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,n,s={534:(e,o,n)=>{var s={"./boolean-fields/descope-boolean-field-internal/index.js":[6676,5910,1e3,3878,769],"./boolean-fields/descope-checkbox/index.js":[3483,5910,
|
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,n,s={534:(e,o,n)=>{var s={"./boolean-fields/descope-boolean-field-internal/index.js":[6676,5910,1e3,3878,769],"./boolean-fields/descope-checkbox/index.js":[3483,5910,7196,3660,1037,6116,3208,422,8725,1224,9789,9515,1e3,4201,3878,769,4803,3726],"./boolean-fields/descope-switch-toggle/index.js":[9203,5910,7196,3660,1037,6116,3208,422,8725,1224,9789,9515,1e3,4201,3878,769,4803,4483],"./descope-button-selection-group/descope-button-selection-group-internal/index.js":[8460,5910,7196,3660,1224,9211,4513,729,1e3,3878,9662,1348],"./descope-button-selection-group/descope-button-selection-group-item/index.js":[7901,5910,7196,3660,1224,9211,4513,729,1e3,9662,206],"./descope-button-selection-group/index.js":[8086,5910,7196,3660,1224,9211,4513,729,1e3,4201,3878,9662,1348,6699],"./descope-button/index.js":[2018,5910,7196,3660,1224,9211,4513,729,1e3,9662],"./descope-combo-box/index.js":[1294,5910,7196,3660,1037,6116,3208,3952,5345,262,4273,1e3,4201,9483],"./descope-container/index.js":[7107,5910,1e3,7317],"./descope-date-picker/index.js":[2552,5910,7196,3660,1037,6116,3208,1224,9211,3952,4513,5345,1990,1e3,8017],"./descope-divider/index.js":[6162,5910,1e3,2528,4178],"./descope-email-field/index.js":[1272,5910,7196,3660,1037,6116,3208,422,8725,9437,1e3,4201,4447,9760],"./descope-image/index.js":[8278,5910,1e3,6772],"./descope-link/index.js":[5846,5910,1e3,2528,58],"./descope-loader-linear/index.js":[7845,5910,1e3,6453],"./descope-loader-radial/index.js":[2797,5910,1e3,3072],"./descope-logo/index.js":[1034,5910,1e3,3585,1984],"./descope-modal/index.js":[958,5910,7196,1037,3952,262,1932,1e3,4641],"./descope-new-password/descope-new-password-internal/index.js":[1545,5910,1e3,4201,3878,2481,1842],"./descope-new-password/index.js":[8974,5910,7196,3660,1037,6116,3208,422,8725,1224,9789,9211,7056,1e3,4201,3878,4447,2934,2481,1842,8106,7055],"./descope-number-field/index.js":[6916,5910,7196,3660,1037,6116,3208,422,5806,1e3,4201,4447,2142],"./descope-passcode/descope-passcode-internal/index.js":[4775,5910,1e3,3878,1841],"./descope-passcode/index.js":[4919,5910,7196,3660,1037,6116,3208,422,8725,9789,1e3,4201,3878,4447,2934,1841,939],"./descope-password/index.js":[9279,5910,7196,3660,1037,6116,3208,422,8725,1224,9211,7056,1e3,4201,2481,8106],"./descope-recaptcha/index.js":[8164,5910,1e3,964],"./descope-text-area/index.js":[1962,5910,7196,3660,1037,6116,422,7101,1e3,4201,3322],"./descope-text-field/index.js":[9357,5910,7196,3660,1037,6116,3208,422,8725,9789,1e3,4201,4447,2934],"./descope-text/index.js":[1876,5910,1e3,2528],"./descope-totp-image/index.js":[1331,5910,1e3,3585,5364],"./descope-upload-file/index.js":[6667,5910,7196,3660,1224,9211,4513,729,1e3,3878,9662,5874],"./phone-fields/descope-phone-field/descope-phone-field-internal/index.js":[9240,5910,7196,3660,1037,6116,3208,422,8725,9789,3952,5345,262,4273,1e3,4201,3878,4447,2934,7262,9483,9288],"./phone-fields/descope-phone-field/index.js":[6581,5910,7196,3660,1037,6116,3208,422,8725,9789,3952,5345,262,4273,1e3,4201,3878,4447,2934,7262,9483,9288,9806],"./phone-fields/descope-phone-input-box-field/descope-phone-input-box-internal/index.js":[3067,5910,7196,3660,1037,6116,3208,422,8725,9789,1e3,4201,3878,4447,2934,7262,4981],"./phone-fields/descope-phone-input-box-field/index.js":[9423,5910,7196,3660,1037,6116,3208,422,8725,9789,3952,5345,262,4273,1e3,4201,3878,4447,2934,7262,9483,4981,5119]};function t(e){if(!n.o(s,e))return Promise.resolve().then((()=>{var o=new Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}));var o=s[e],t=o[0];return Promise.all(o.slice(1).map(n.e)).then((()=>n(t)))}t.keys=()=>Object.keys(s),t.id=534,e.exports=t},5561:(e,o,n)=>{"use strict";n.r(o),n.d(o,{componentsThemeManager:()=>s});const s=new class{static mountOnPropName="DescopeThemeManager";#e={};#o="light";#n=new Set;#s(){this.#n.forEach((e=>e?.()))}get currentThemeName(){return this.#o}set currentThemeName(e){this.#o=e,this.#s()}get currentTheme(){return this.#e[this.currentThemeName]}onCurrentThemeChange(e){return this.#n.add(e),()=>{this.#n.delete(e)}}set themes(e){this.#e=e,this.#s()}}},7507:(e,o,n)=>{const{componentsThemeManager:s}=n(5561),t=n(534);e.exports=t.keys().reduce(((e,o)=>{const n=o.replace(/.*?([^\/]+)\/index\.js$/,"$1");return n.endsWith("-internal")||(e[n]=()=>t(o)),e}),{}),e.exports.componentsThemeManager=s}},t={};function d(e){var o=t[e];if(void 0!==o)return o.exports;var n=t[e]={exports:{}};return s[e](n,n.exports,d),n.exports}d.m=s,e=[],d.O=(o,n,s,t)=>{if(!n){var i=1/0;for(a=0;a<e.length;a++){for(var[n,s,t]=e[a],r=!0,c=0;c<n.length;c++)(!1&t||i>=t)&&Object.keys(d.O).every((e=>d.O[e](n[c])))?n.splice(c--,1):(r=!1,t<i&&(i=t));if(r){e.splice(a--,1);var p=s();void 0!==p&&(o=p)}}return o}t=t||0;for(var a=e.length;a>0&&e[a-1][2]>t;a--)e[a]=e[a-1];e[a]=[n,s,t]},d.F={},d.E=e=>{Object.keys(d.F).map((o=>{d.F[o](e)}))},d.d=(e,o)=>{for(var n in o)d.o(o,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[n]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce(((o,n)=>(d.f[n](e,o),o)),[])),d.u=e=>(({58:"descope-link-index-js",206:"descope-button-selection-group-descope-button-selection-group-item-index-js",769:"boolean-fields-descope-boolean-field-internal-index-js",939:"descope-passcode-index-js",964:"descope-recaptcha-index-js",1348:"descope-button-selection-group-descope-button-selection-group-internal-index-js",1841:"descope-passcode-descope-passcode-internal-index-js",1842:"descope-new-password-descope-new-password-internal-index-js",1984:"descope-logo-index-js",2142:"descope-number-field-index-js",2528:"descope-text-index-js",2934:"descope-text-field-index-js",3072:"descope-loader-radial-index-js",3322:"descope-text-area-index-js",3726:"boolean-fields-descope-checkbox-index-js",4178:"descope-divider-index-js",4483:"boolean-fields-descope-switch-toggle-index-js",4641:"descope-modal-index-js",4981:"phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js",5119:"phone-fields-descope-phone-input-box-field-index-js",5364:"descope-totp-image-index-js",5874:"descope-upload-file-index-js",6453:"descope-loader-linear-index-js",6699:"descope-button-selection-group-index-js",6772:"descope-image-index-js",7055:"descope-new-password-index-js",7317:"descope-container-index-js",8017:"descope-date-picker-index-js",8106:"descope-password-index-js",9288:"phone-fields-descope-phone-field-descope-phone-field-internal-index-js",9483:"descope-combo-box-index-js",9662:"descope-button-index-js",9760:"descope-email-field-index-js",9806:"phone-fields-descope-phone-field-index-js"}[e]||e)+".js"),d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),o={},n="DescopeUI:",d.l=(e,s,t,i)=>{if(o[e])o[e].push(s);else{var r,c;if(void 0!==t)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")==n+t){r=l;break}}r||(c=!0,(r=document.createElement("script")).charset="utf-8",r.timeout=120,d.nc&&r.setAttribute("nonce",d.nc),r.setAttribute("data-webpack",n+t),r.src=e),o[e]=[s];var u=(n,s)=>{r.onerror=r.onload=null,clearTimeout(f);var t=o[e];if(delete o[e],r.parentNode&&r.parentNode.removeChild(r),t&&t.forEach((e=>e(s))),n)return n(s)},f=setTimeout(u.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=u.bind(null,r.onerror),r.onload=u.bind(null,r.onload),c&&document.head.appendChild(r)}},d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;d.g.importScripts&&(e=d.g.location+"");var o=d.g.document;if(!e&&o&&(o.currentScript&&(e=o.currentScript.src),!e)){var n=o.getElementsByTagName("script");if(n.length)for(var s=n.length-1;s>-1&&!e;)e=n[s--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),d.p=e})(),(()=>{var e={4826:0};d.f.j=(o,n)=>{var s=d.o(e,o)?e[o]:void 0;if(0!==s)if(s)n.push(s[2]);else{var t=new Promise(((n,t)=>s=e[o]=[n,t]));n.push(s[2]=t);var i=d.p+d.u(o),r=new Error;d.l(i,(n=>{if(d.o(e,o)&&(0!==(s=e[o])&&(e[o]=void 0),s)){var t=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;r.message="Loading chunk "+o+" failed.\n("+t+": "+i+")",r.name="ChunkLoadError",r.type=t,r.request=i,s[1](r)}}),"chunk-"+o,o)}},d.F.j=o=>{if(!d.o(e,o)||void 0===e[o]){e[o]=null;var n=document.createElement("link");d.nc&&n.setAttribute("nonce",d.nc),n.rel="prefetch",n.as="script",n.href=d.p+d.u(o),document.head.appendChild(n)}},d.O.j=o=>0===e[o];var o=(o,n)=>{var s,t,[i,r,c]=n,p=0;if(i.some((o=>0!==e[o]))){for(s in r)d.o(r,s)&&(d.m[s]=r[s]);if(c)var a=c(d)}for(o&&o(n);p<i.length;p++)t=i[p],d.o(e,t)&&e[t]&&e[t][0](),e[t]=0;return d.O(a)},n=self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[];n.forEach(o.bind(null,0)),n.push=o.bind(null,n.push.bind(n))})(),d.O(0,[4826],(()=>{[5910,1e3,3878,769,7196,3660,1037,6116,3208,422,8725,1224,9789,9515,4201,4803,3726,4483,9211,4513,729,9662,1348,206,6699,3952,5345,262,4273,9483,7317,1990,8017,2528,4178,9437,4447,9760,6772,58,6453,3072,3585,1984,1932,4641,2481,1842,7056,2934,8106,7055,5806,2142,1841,939,964,7101,3322,5364,5874,7262,9288,9806,4981,5119].map(d.E)}),5);var i=d(7507);return d.O(i)})()));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@descope/web-components-ui",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.223",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/cjs/index.cjs.js",
|
6
6
|
"module": "dist/index.esm.js",
|
@@ -71,8 +71,8 @@
|
|
71
71
|
"jest-environment-jsdom": "^29.5.0",
|
72
72
|
"prettier": "^3.0.2",
|
73
73
|
"rollup": "^3.21.4",
|
74
|
-
"webpack": "^5.79.0",
|
75
74
|
"rollup-plugin-import-css": "^3.2.1",
|
75
|
+
"webpack": "^5.79.0",
|
76
76
|
"webpack-cli": "^5.0.1",
|
77
77
|
"webpack-dev-server": "^4.13.3"
|
78
78
|
},
|
@@ -81,6 +81,7 @@
|
|
81
81
|
"@vaadin/checkbox": "24.2.5",
|
82
82
|
"@vaadin/combo-box": "24.2.5",
|
83
83
|
"@vaadin/date-picker": "24.2.5",
|
84
|
+
"@vaadin/dialog": "24.2.5",
|
84
85
|
"@vaadin/email-field": "24.2.5",
|
85
86
|
"@vaadin/number-field": "24.2.5",
|
86
87
|
"@vaadin/password-field": "24.2.5",
|
@@ -0,0 +1,109 @@
|
|
1
|
+
import { compose } from '../../helpers';
|
2
|
+
import { forwardAttrs, getComponentName } from '../../helpers/componentHelpers';
|
3
|
+
import {
|
4
|
+
createStyleMixin,
|
5
|
+
draggableMixin,
|
6
|
+
createProxy,
|
7
|
+
componentNameValidationMixin,
|
8
|
+
portalMixin,
|
9
|
+
} from '../../mixins';
|
10
|
+
|
11
|
+
export const componentName = getComponentName('modal');
|
12
|
+
|
13
|
+
const customMixin = (superclass) =>
|
14
|
+
class ModalMixinClass extends superclass {
|
15
|
+
get opened() {
|
16
|
+
return this.getAttribute('opened') === 'true';
|
17
|
+
}
|
18
|
+
|
19
|
+
handleOpened() {
|
20
|
+
forwardAttrs(this, this.baseElement, { includeAttrs: ['opened'] });
|
21
|
+
if (this.opened) {
|
22
|
+
this.style.display = '';
|
23
|
+
} else {
|
24
|
+
this.style.display = 'none';
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
init() {
|
29
|
+
super.init?.();
|
30
|
+
this.style.display = 'none';
|
31
|
+
|
32
|
+
// vaadin-dialog might not be loaded in time
|
33
|
+
// in order to make sure it's loaded before this block is running
|
34
|
+
// we are wrapping it with setTimeout
|
35
|
+
setTimeout(() => {
|
36
|
+
// we want to sync descope-modal content through vaadin-dialog into the overlay
|
37
|
+
// so we are adding a slot to the overlay, which allows us to forward the content from
|
38
|
+
// vaadin-dialog to vaadin-dialog-overlay
|
39
|
+
this.baseElement.shadowRoot
|
40
|
+
.querySelector('vaadin-dialog-overlay')
|
41
|
+
.appendChild(document.createElement('slot'));
|
42
|
+
|
43
|
+
this.#overrideOverlaySettings();
|
44
|
+
|
45
|
+
// we need to always open the modal in `opened=false`
|
46
|
+
// to prevent it from rendering outside the dialog
|
47
|
+
// first, we have to run `overrideOverlaySettings` to setup
|
48
|
+
// the component.
|
49
|
+
this.handleOpened();
|
50
|
+
});
|
51
|
+
}
|
52
|
+
|
53
|
+
// the default vaadin behavior is to attach the overlay to the body when opened
|
54
|
+
// we do not want that because it's difficult to style the overlay in this way
|
55
|
+
// so we override it to open inside the shadow DOM
|
56
|
+
#overrideOverlaySettings() {
|
57
|
+
const overlay = this.baseElement.shadowRoot.querySelector('vaadin-dialog-overlay');
|
58
|
+
|
59
|
+
overlay._attachOverlay = () => {
|
60
|
+
overlay.bringToFront();
|
61
|
+
this.baseElement.setAttribute('style', 'display:flex!important;');
|
62
|
+
};
|
63
|
+
overlay._detachOverlay = () => {
|
64
|
+
this.baseElement.style.display = 'none';
|
65
|
+
};
|
66
|
+
overlay._enterModalState = () => {};
|
67
|
+
|
68
|
+
overlay.close = () => false;
|
69
|
+
}
|
70
|
+
};
|
71
|
+
|
72
|
+
export const ModalClass = compose(
|
73
|
+
createStyleMixin({
|
74
|
+
mappings: {
|
75
|
+
overlayBackgroundColor: { property: () => ModalClass.cssVarList.overlay.backgroundColor },
|
76
|
+
overlayShadow: { property: () => ModalClass.cssVarList.overlay.shadow },
|
77
|
+
overlayWidth: { property: () => ModalClass.cssVarList.overlay.width },
|
78
|
+
},
|
79
|
+
}),
|
80
|
+
portalMixin({
|
81
|
+
name: 'overlay',
|
82
|
+
selector: '',
|
83
|
+
mappings: {
|
84
|
+
hostDisplay: {
|
85
|
+
selector: () => ':host(.descope-modal)',
|
86
|
+
property: 'display',
|
87
|
+
important: true,
|
88
|
+
},
|
89
|
+
backgroundColor: { selector: () => '::part(content)', property: 'background-color' },
|
90
|
+
width: { selector: () => '::part(overlay)', property: 'width' },
|
91
|
+
shadow: { selector: () => '::part(overlay)', property: 'box-shadow' },
|
92
|
+
},
|
93
|
+
forward: {
|
94
|
+
include: false,
|
95
|
+
attributes: ['opened'],
|
96
|
+
},
|
97
|
+
}),
|
98
|
+
draggableMixin,
|
99
|
+
componentNameValidationMixin,
|
100
|
+
customMixin
|
101
|
+
)(
|
102
|
+
createProxy({
|
103
|
+
slots: [''],
|
104
|
+
wrappedEleName: 'vaadin-dialog',
|
105
|
+
style: () => ``,
|
106
|
+
excludeAttrsSync: ['tabindex', 'opened'],
|
107
|
+
componentName,
|
108
|
+
})
|
109
|
+
);
|
package/src/index.cjs.js
CHANGED
@@ -29,3 +29,4 @@ export { RecaptchaClass } from './components/descope-recaptcha/RecaptchaClass';
|
|
29
29
|
export { UploadFileClass } from './components/descope-upload-file/UploadFileClass';
|
30
30
|
export { ButtonSelectionGroupClass } from './components/descope-button-selection-group/ButtonSelectionGroupClass';
|
31
31
|
export { ButtonSelectionGroupItemClass } from './components/descope-button-selection-group/descope-button-selection-group-item/ButtonSelectionGroupItemClass';
|
32
|
+
export { ModalClass } from './components/descope-modal/ModalClass';
|
@@ -55,11 +55,11 @@ export const createStyle = (componentName, baseSelector, mappings) => {
|
|
55
55
|
|
56
56
|
const cssVarName = getCssVarName(componentName, attr);
|
57
57
|
|
58
|
-
attrConfig.forEach(({ selector: relativeSelectorOrSelectorFn, property }) => {
|
58
|
+
attrConfig.forEach(({ selector: relativeSelectorOrSelectorFn, property, important }) => {
|
59
59
|
style.add(
|
60
60
|
createCssSelector(baseSelector, relativeSelectorOrSelectorFn),
|
61
61
|
isFunction(property) ? property() : property,
|
62
|
-
createCssVarFallback(cssVarName)
|
62
|
+
createCssVarFallback(cssVarName) + (important ? '!important' : '')
|
63
63
|
);
|
64
64
|
});
|
65
65
|
});
|
@@ -142,10 +142,10 @@ export const createStyleMixin =
|
|
142
142
|
(this.#rootElement.classList || this.#rootElement.host.classList).add(className);
|
143
143
|
}
|
144
144
|
|
145
|
-
init() {
|
145
|
+
async init() {
|
146
146
|
super.init?.();
|
147
147
|
if (this.shadowRoot.isConnected) {
|
148
|
-
this.#rootElement = this.#getRootElement?.(this) || this.shadowRoot;
|
148
|
+
this.#rootElement = (await this.#getRootElement?.(this)) || this.shadowRoot;
|
149
149
|
|
150
150
|
this.#addClassName(componentName);
|
151
151
|
|
@@ -13,7 +13,27 @@ const DISPLAY_NAME_SEPARATOR = '_';
|
|
13
13
|
|
14
14
|
const sanitizeSelector = (selector) => selector.replace(/[^\w\s]/gi, '');
|
15
15
|
|
16
|
-
const
|
16
|
+
const withWaitForShadowRoot = (getRootElementFn) => (that) =>
|
17
|
+
new Promise((res) => {
|
18
|
+
const MAX_RETRIES = 20;
|
19
|
+
const ele = getRootElementFn(that);
|
20
|
+
let counter = 0;
|
21
|
+
|
22
|
+
const check = () => {
|
23
|
+
if (counter > MAX_RETRIES) {
|
24
|
+
// eslint-disable-next-line no-console
|
25
|
+
console.error('could not get shadow root for element', ele);
|
26
|
+
res(ele);
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
|
30
|
+
counter++;
|
31
|
+
|
32
|
+
if (!ele.shadowRoot) setTimeout(check);
|
33
|
+
else res(ele.shadowRoot);
|
34
|
+
};
|
35
|
+
check();
|
36
|
+
});
|
17
37
|
|
18
38
|
export const portalMixin =
|
19
39
|
({ name, selector, mappings = {}, forward: { attributes = [], include = true } = {} }) =>
|
@@ -43,17 +63,17 @@ export const portalMixin =
|
|
43
63
|
const baseEle = that.shadowRoot.querySelector(that.baseSelector);
|
44
64
|
const portal = selector ? baseEle.shadowRoot.querySelector(selector) : baseEle;
|
45
65
|
|
46
|
-
return portal
|
66
|
+
return portal;
|
47
67
|
};
|
48
68
|
|
49
69
|
super({
|
50
|
-
getRootElement,
|
70
|
+
getRootElement: withWaitForShadowRoot(getRootElement),
|
51
71
|
componentNameSuffix: DISPLAY_NAME_SEPARATOR + eleDisplayName,
|
52
72
|
themeSection: PORTAL_THEME_PREFIX + eleDisplayName,
|
53
73
|
baseSelector: ':host',
|
54
74
|
});
|
55
75
|
|
56
|
-
this.#portalEle =
|
76
|
+
this.#portalEle = getRootElement(this);
|
57
77
|
}
|
58
78
|
|
59
79
|
#handleHoverAttribute() {
|
@@ -60,6 +60,13 @@ const button = {
|
|
60
60
|
[compVars.labelTextColor]: helperRefs.main,
|
61
61
|
},
|
62
62
|
|
63
|
+
_disabled: {
|
64
|
+
[helperVars.main]: globalRefs.colors.surface.main,
|
65
|
+
[helperVars.dark]: globalRefs.colors.surface.dark,
|
66
|
+
[helperVars.light]: globalRefs.colors.surface.light,
|
67
|
+
[helperVars.contrast]: globalRefs.colors.surface.contrast,
|
68
|
+
},
|
69
|
+
|
63
70
|
variant: {
|
64
71
|
contained: {
|
65
72
|
[compVars.labelTextColor]: helperRefs.contrast,
|
@@ -23,6 +23,7 @@ import * as inputWrapper from './inputWrapper';
|
|
23
23
|
import * as uploadFile from './uploadFile';
|
24
24
|
import * as buttonSelectionGroupItem from './buttonSelectionGroup/buttonSelectionGroupItem';
|
25
25
|
import * as buttonSelectionGroup from './buttonSelectionGroup/buttonSelectionGroup';
|
26
|
+
import * as modal from './modal';
|
26
27
|
|
27
28
|
const components = {
|
28
29
|
button,
|
@@ -51,6 +52,7 @@ const components = {
|
|
51
52
|
uploadFile,
|
52
53
|
buttonSelectionGroupItem,
|
53
54
|
buttonSelectionGroup,
|
55
|
+
modal,
|
54
56
|
};
|
55
57
|
|
56
58
|
const theme = Object.keys(components).reduce(
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { ModalClass } from '../../components/descope-modal/ModalClass';
|
2
|
+
|
3
|
+
const compVars = ModalClass.cssVarList;
|
4
|
+
|
5
|
+
const modal = {
|
6
|
+
[compVars.hostWidth]: '400px',
|
7
|
+
[compVars.hostHeight]: '400px',
|
8
|
+
[compVars.overlayShadow]: 'none',
|
9
|
+
[compVars.overlayWidth]: '700px',
|
10
|
+
};
|
11
|
+
|
12
|
+
export default modal;
|
13
|
+
|
14
|
+
export const vars = {
|
15
|
+
...compVars,
|
16
|
+
};
|