@descope/web-components-ui 1.35.0 → 1.37.0
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 +3816 -3784
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +716 -685
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/1519.js +1 -1
- package/dist/umd/1519.js.map +1 -1
- package/dist/umd/2672.js +1 -1
- package/dist/umd/2672.js.map +1 -1
- package/dist/umd/6424.js +1 -1
- package/dist/umd/6424.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/DescopeDev.js.map +1 -1
- package/dist/umd/button-selection-group-fields-descope-button-multi-selection-group-index-js.js +1 -1
- package/dist/umd/button-selection-group-fields-descope-button-multi-selection-group-index-js.js.map +1 -1
- package/dist/umd/button-selection-group-fields-descope-button-selection-group-index-js.js +1 -1
- package/dist/umd/button-selection-group-fields-descope-button-selection-group-index-js.js.map +1 -1
- package/dist/umd/button-selection-group-fields-descope-button-selection-group-item-index-js.js +1 -1
- package/dist/umd/button-selection-group-fields-descope-button-selection-group-item-index-js.js.map +1 -1
- package/dist/umd/{descope-button-index-js.js → descope-button.js} +3 -3
- package/dist/umd/descope-button.js.map +1 -0
- package/dist/umd/descope-date-field-descope-calendar-index-js.js +1 -1
- package/dist/umd/descope-date-field-descope-calendar-index-js.js.map +1 -1
- package/dist/umd/descope-icon.js +2 -0
- package/dist/umd/descope-icon.js.map +1 -0
- package/dist/umd/descope-modal-index-js.js +1 -1
- package/dist/umd/descope-modal-index-js.js.map +1 -1
- package/dist/umd/descope-third-party-app-logo-index-js.js +1 -1
- package/dist/umd/descope-third-party-app-logo-index-js.js.map +1 -1
- package/dist/umd/descope-upload-file-index-js.js +1 -1
- package/dist/umd/descope-upload-file-index-js.js.map +1 -1
- package/dist/umd/descope-user-attribute-index-js.js +1 -1
- package/dist/umd/descope-user-attribute-index-js.js.map +1 -1
- package/dist/umd/descope-user-auth-method-index-js.js +1 -1
- package/dist/umd/descope-user-auth-method-index-js.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
- package/dist/umd/mapping-fields-descope-mappings-field-index-js.js.map +1 -1
- package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -1
- package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js.map +1 -1
- package/package.json +3 -3
- package/src/components/button-selection-group-fields/descope-button-selection-group-item/ButtonSelectionGroupItemClass.js +1 -1
- package/src/components/button-selection-group-fields/descope-button-selection-group-item/index.js +1 -1
- package/src/components/descope-date-field/descope-calendar/CalendarClass.js +1 -1
- package/src/components/descope-date-field/descope-calendar/index.js +1 -1
- package/src/components/descope-modal/ModalClass.js +15 -1
- package/src/components/descope-third-party-app-logo/ThirdPartyAppLogoClass.js +1 -1
- package/src/components/descope-third-party-app-logo/index.js +1 -1
- package/src/components/descope-upload-file/UploadFileClass.js +1 -1
- package/src/components/descope-upload-file/index.js +1 -1
- package/src/components/descope-user-attribute/UserAttributeClass.js +1 -1
- package/src/components/descope-user-attribute/index.js +1 -1
- package/src/components/descope-user-auth-method/UserAuthMethodClass.js +2 -2
- package/src/components/descope-user-auth-method/index.js +1 -1
- package/src/components/mapping-fields/descope-mappings-field/index.js +1 -1
- package/src/index.cjs.js +0 -1
- package/src/index.js +0 -2
- package/src/theme/components/index.js +2 -2
- package/dist/umd/descope-button-index-js.js.map +0 -1
- package/dist/umd/descope-icon-index-js.js +0 -2
- package/dist/umd/descope-icon-index-js.js.map +0 -1
- package/src/components/descope-button/ButtonClass.js +0 -163
- package/src/components/descope-button/clickableMixin.js +0 -10
- package/src/components/descope-button/index.js +0 -6
- package/src/components/descope-icon/IconClass.js +0 -98
- package/src/components/descope-icon/helpers.js +0 -51
- package/src/components/descope-icon/index.js +0 -5
- package/src/theme/components/button.js +0 -133
- package/src/theme/components/icon.js +0 -7
- /package/dist/umd/{descope-button-index-js.js.LICENSE.txt → descope-button.js.LICENSE.txt} +0 -0
@@ -1,98 +0,0 @@
|
|
1
|
-
/* eslint-disable no-use-before-define */
|
2
|
-
import { createStyleMixin, draggableMixin, componentNameValidationMixin } from '../../mixins';
|
3
|
-
import { createBaseClass } from '../../baseClasses/createBaseClass';
|
4
|
-
import { compose } from '../../helpers';
|
5
|
-
import { getComponentName } from '../../helpers/componentHelpers';
|
6
|
-
import { createIcon } from './helpers';
|
7
|
-
import { injectStyle } from '@descope-ui/common/components-helpers';
|
8
|
-
|
9
|
-
export const componentName = getComponentName('icon');
|
10
|
-
|
11
|
-
class RawIcon extends createBaseClass({ componentName, baseSelector: 'slot' }) {
|
12
|
-
static get observedAttributes() {
|
13
|
-
return ['src'];
|
14
|
-
}
|
15
|
-
|
16
|
-
#icon;
|
17
|
-
|
18
|
-
constructor() {
|
19
|
-
super();
|
20
|
-
|
21
|
-
this.attachShadow({ mode: 'open' }).innerHTML = `
|
22
|
-
<slot></slot>
|
23
|
-
`;
|
24
|
-
|
25
|
-
injectStyle(
|
26
|
-
`
|
27
|
-
:host > slot {
|
28
|
-
box-sizing: border-box;
|
29
|
-
width: 100%;
|
30
|
-
height: 100%;
|
31
|
-
display: flex;
|
32
|
-
overflow: hidden;
|
33
|
-
}
|
34
|
-
:host {
|
35
|
-
display: inline-block;
|
36
|
-
}
|
37
|
-
`,
|
38
|
-
this
|
39
|
-
);
|
40
|
-
}
|
41
|
-
|
42
|
-
init() {
|
43
|
-
super.init?.();
|
44
|
-
this.toggleVisibility(this.src);
|
45
|
-
}
|
46
|
-
|
47
|
-
toggleVisibility(isVisible) {
|
48
|
-
this.style.display = isVisible ? '' : 'none';
|
49
|
-
}
|
50
|
-
|
51
|
-
get src() {
|
52
|
-
return this.getAttribute('src');
|
53
|
-
}
|
54
|
-
|
55
|
-
// in order to fill an SVG with `currentColor` override all of its `fill` and `path` nodes
|
56
|
-
// with the value from the `st-fill` attribute
|
57
|
-
// eslint-disable-next-line class-methods-use-this
|
58
|
-
updateFillColor(node) {
|
59
|
-
// set fill to root node and all its relevant selectors
|
60
|
-
const elementsToReplace = [node, ...node.querySelectorAll('*[fill]')];
|
61
|
-
|
62
|
-
elementsToReplace.forEach((ele) => {
|
63
|
-
ele.setAttribute(
|
64
|
-
'fill',
|
65
|
-
`var(${IconClass.cssVarList.fill}, ${ele.getAttribute('fill') || "''"})`
|
66
|
-
);
|
67
|
-
});
|
68
|
-
}
|
69
|
-
|
70
|
-
attributeChangedCallback(attrName, oldValue, newValue) {
|
71
|
-
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
72
|
-
|
73
|
-
if (oldValue === newValue) return;
|
74
|
-
|
75
|
-
if (attrName === 'src') {
|
76
|
-
this.toggleVisibility(newValue);
|
77
|
-
|
78
|
-
createIcon(this.src).then((res) => {
|
79
|
-
this.innerHTML = '';
|
80
|
-
if (res) {
|
81
|
-
const clonedNode = res.cloneNode(true);
|
82
|
-
this.updateFillColor(clonedNode);
|
83
|
-
this.appendChild(clonedNode);
|
84
|
-
}
|
85
|
-
});
|
86
|
-
}
|
87
|
-
}
|
88
|
-
}
|
89
|
-
|
90
|
-
export const IconClass = compose(
|
91
|
-
createStyleMixin({
|
92
|
-
mappings: {
|
93
|
-
fill: {},
|
94
|
-
},
|
95
|
-
}),
|
96
|
-
draggableMixin,
|
97
|
-
componentNameValidationMixin
|
98
|
-
)(RawIcon);
|
@@ -1,51 +0,0 @@
|
|
1
|
-
import DOMPurify from 'dompurify';
|
2
|
-
|
3
|
-
const getFileExtension = (path) => {
|
4
|
-
const match = path.match(/\.([0-9a-z]+)(?:[\\?#]|$)/i);
|
5
|
-
return match ? match[1] : null;
|
6
|
-
};
|
7
|
-
|
8
|
-
const base64Prefix = 'data:image/svg+xml;base64,';
|
9
|
-
|
10
|
-
const isBase64Svg = (src) => src.startsWith(base64Prefix);
|
11
|
-
|
12
|
-
const createImgEle = (src) => {
|
13
|
-
const ele = document.createElement('img');
|
14
|
-
ele.setAttribute('src', src);
|
15
|
-
return ele;
|
16
|
-
};
|
17
|
-
|
18
|
-
const createSvgEle = (text) => {
|
19
|
-
// we want to purify the SVG to avoid XSS attacks
|
20
|
-
const clean = DOMPurify.sanitize(text, { USE_PROFILES: { svg: true, svgFilters: true } });
|
21
|
-
|
22
|
-
const parser = new DOMParser();
|
23
|
-
const ele = parser.parseFromString(clean, 'image/svg+xml').querySelector('svg');
|
24
|
-
return ele;
|
25
|
-
};
|
26
|
-
|
27
|
-
export const createIcon = async (src) => {
|
28
|
-
try {
|
29
|
-
let ele;
|
30
|
-
if (isBase64Svg(src)) {
|
31
|
-
// handle base64 source
|
32
|
-
const svgXml = atob(src.slice(base64Prefix.length));
|
33
|
-
ele = createSvgEle(svgXml);
|
34
|
-
} else if (getFileExtension(src) === 'svg') {
|
35
|
-
// handle urls
|
36
|
-
const fetchedSrc = await fetch(src);
|
37
|
-
const text = await fetchedSrc.text();
|
38
|
-
ele = createSvgEle(text);
|
39
|
-
} else {
|
40
|
-
// handle binary
|
41
|
-
ele = createImgEle(src);
|
42
|
-
}
|
43
|
-
|
44
|
-
ele.style.setProperty('max-width', '100%');
|
45
|
-
ele.style.setProperty('max-height', '100%');
|
46
|
-
|
47
|
-
return ele;
|
48
|
-
} catch {
|
49
|
-
return null;
|
50
|
-
}
|
51
|
-
};
|
@@ -1,133 +0,0 @@
|
|
1
|
-
import globals from '../globals';
|
2
|
-
import { getThemeRefs, createHelperVars } from '../../helpers/themeHelpers';
|
3
|
-
import { componentName, ButtonClass } from '../../components/descope-button/ButtonClass';
|
4
|
-
|
5
|
-
const globalRefs = getThemeRefs(globals);
|
6
|
-
const compVars = ButtonClass.cssVarList;
|
7
|
-
|
8
|
-
const mode = {
|
9
|
-
primary: globalRefs.colors.primary,
|
10
|
-
secondary: globalRefs.colors.secondary,
|
11
|
-
success: globalRefs.colors.success,
|
12
|
-
error: globalRefs.colors.error,
|
13
|
-
surface: globalRefs.colors.surface,
|
14
|
-
};
|
15
|
-
|
16
|
-
const [helperTheme, helperRefs, helperVars] = createHelperVars({ mode }, componentName);
|
17
|
-
|
18
|
-
const button = {
|
19
|
-
...helperTheme,
|
20
|
-
|
21
|
-
[compVars.fontFamily]: globalRefs.fonts.font1.family,
|
22
|
-
|
23
|
-
[compVars.cursor]: 'pointer',
|
24
|
-
[compVars.hostHeight]: '3em',
|
25
|
-
[compVars.hostWidth]: 'auto',
|
26
|
-
[compVars.hostDirection]: globalRefs.direction,
|
27
|
-
|
28
|
-
[compVars.borderRadius]: globalRefs.radius.sm,
|
29
|
-
[compVars.borderWidth]: globalRefs.border.xs,
|
30
|
-
[compVars.borderStyle]: 'solid',
|
31
|
-
[compVars.borderColor]: 'transparent',
|
32
|
-
|
33
|
-
[compVars.labelSpacing]: '0.25em',
|
34
|
-
|
35
|
-
[compVars.textAlign]: 'center', // default text align center
|
36
|
-
textAlign: {
|
37
|
-
right: { [compVars.textAlign]: 'right' },
|
38
|
-
left: { [compVars.textAlign]: 'left' },
|
39
|
-
center: { [compVars.textAlign]: 'center' },
|
40
|
-
},
|
41
|
-
|
42
|
-
[compVars.verticalPadding]: '1em',
|
43
|
-
[compVars.horizontalPadding]: '0.875em',
|
44
|
-
|
45
|
-
[compVars.outlineWidth]: globals.border.sm,
|
46
|
-
[compVars.outlineOffset]: '0px', // keep `px` unit for external calc
|
47
|
-
[compVars.outlineStyle]: 'solid',
|
48
|
-
[compVars.outlineColor]: 'transparent',
|
49
|
-
|
50
|
-
[compVars.iconSize]: '1.5em',
|
51
|
-
|
52
|
-
size: {
|
53
|
-
xs: { [compVars.fontSize]: '12px' },
|
54
|
-
sm: { [compVars.fontSize]: '14px' },
|
55
|
-
md: { [compVars.fontSize]: '16px' },
|
56
|
-
lg: { [compVars.fontSize]: '18px' },
|
57
|
-
},
|
58
|
-
|
59
|
-
_square: {
|
60
|
-
[compVars.hostHeight]: '3em',
|
61
|
-
[compVars.hostWidth]: '3em',
|
62
|
-
[compVars.verticalPadding]: '0',
|
63
|
-
},
|
64
|
-
|
65
|
-
_fullWidth: {
|
66
|
-
[compVars.hostWidth]: '100%',
|
67
|
-
},
|
68
|
-
|
69
|
-
_loading: {
|
70
|
-
[compVars.cursor]: 'wait',
|
71
|
-
[compVars.labelTextColor]: helperRefs.main,
|
72
|
-
},
|
73
|
-
|
74
|
-
_disabled: {
|
75
|
-
[helperVars.main]: globalRefs.colors.surface.light,
|
76
|
-
[helperVars.dark]: globalRefs.colors.surface.dark,
|
77
|
-
[helperVars.light]: globalRefs.colors.surface.light,
|
78
|
-
[helperVars.contrast]: globalRefs.colors.surface.main,
|
79
|
-
[compVars.iconColor]: globalRefs.colors.surface.main,
|
80
|
-
},
|
81
|
-
|
82
|
-
variant: {
|
83
|
-
contained: {
|
84
|
-
[compVars.labelTextColor]: helperRefs.contrast,
|
85
|
-
[compVars.backgroundColor]: helperRefs.main,
|
86
|
-
_hover: {
|
87
|
-
[compVars.backgroundColor]: helperRefs.dark,
|
88
|
-
_loading: {
|
89
|
-
[compVars.backgroundColor]: helperRefs.main,
|
90
|
-
},
|
91
|
-
},
|
92
|
-
_active: {
|
93
|
-
[compVars.backgroundColor]: helperRefs.main,
|
94
|
-
},
|
95
|
-
},
|
96
|
-
|
97
|
-
outline: {
|
98
|
-
[compVars.labelTextColor]: helperRefs.main,
|
99
|
-
[compVars.borderColor]: helperRefs.main,
|
100
|
-
_hover: {
|
101
|
-
[compVars.labelTextColor]: helperRefs.dark,
|
102
|
-
[compVars.borderColor]: helperRefs.dark,
|
103
|
-
},
|
104
|
-
_active: {
|
105
|
-
[compVars.labelTextColor]: helperRefs.main,
|
106
|
-
[compVars.borderColor]: helperRefs.main,
|
107
|
-
},
|
108
|
-
},
|
109
|
-
|
110
|
-
link: {
|
111
|
-
[compVars.labelTextColor]: helperRefs.main,
|
112
|
-
[compVars.horizontalPadding]: '0.125em',
|
113
|
-
_hover: {
|
114
|
-
[compVars.labelTextColor]: helperRefs.dark,
|
115
|
-
[compVars.labelTextDecoration]: 'underline',
|
116
|
-
},
|
117
|
-
_active: {
|
118
|
-
[compVars.labelTextColor]: helperRefs.main,
|
119
|
-
},
|
120
|
-
},
|
121
|
-
},
|
122
|
-
|
123
|
-
_focused: {
|
124
|
-
[compVars.outlineColor]: helperRefs.light,
|
125
|
-
},
|
126
|
-
};
|
127
|
-
|
128
|
-
export default button;
|
129
|
-
|
130
|
-
export const vars = {
|
131
|
-
...compVars,
|
132
|
-
...helperVars,
|
133
|
-
};
|
File without changes
|