@descope/web-components-ui 1.0.390 → 1.0.391
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 +1447 -1278
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1414 -1244
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/4619.js +1 -1
- package/dist/umd/DescopeDev.js +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-selection-group-index-js.js +1 -1
- package/dist/umd/button-selection-group-fields-descope-button-selection-group-item-index-js.js +1 -1
- package/dist/umd/descope-button-index-js.js +1 -1
- package/dist/umd/descope-date-field-descope-calendar-index-js.js +1 -1
- package/dist/umd/descope-grid-descope-grid-custom-column-index-js.js +1 -1
- package/dist/umd/descope-grid-descope-grid-item-details-column-index-js.js +3 -3
- package/dist/umd/descope-grid-descope-grid-text-column-index-js.js +1 -1
- package/dist/umd/descope-icon-index-js.js +1 -1
- package/dist/umd/descope-logo-index-js.js +1 -1
- package/dist/umd/descope-third-party-app-logo-index-js.js +1 -0
- package/dist/umd/descope-upload-file-index-js.js +1 -1
- package/dist/umd/descope-user-attribute-index-js.js +1 -1
- package/dist/umd/descope-user-auth-method-index-js.js +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-icon/helpers.js +2 -2
- package/src/components/descope-third-party-app-logo/ThirdPartyAppLogoClass.js +102 -0
- package/src/components/descope-third-party-app-logo/arrows.svg +4 -0
- package/src/components/descope-third-party-app-logo/index.js +7 -0
- package/src/helpers/index.js +8 -2
- package/src/index.cjs.js +1 -0
- package/src/index.js +1 -0
- package/src/mixins/createStyleMixin/helpers.js +32 -6
- package/src/mixins/createStyleMixin/index.js +1 -1
- package/src/theme/components/index.js +2 -0
- package/src/theme/components/thirdPartyAppLogo.js +36 -0
@@ -0,0 +1,102 @@
|
|
1
|
+
import { createBaseClass } from '../../baseClasses/createBaseClass';
|
2
|
+
import { compose } from '../../helpers';
|
3
|
+
import { getComponentName } from '../../helpers/componentHelpers';
|
4
|
+
import { componentNameValidationMixin, createStyleMixin, draggableMixin } from '../../mixins';
|
5
|
+
import { IconClass } from '../descope-icon/IconClass';
|
6
|
+
import { LogoClass } from '../descope-logo/LogoClass';
|
7
|
+
import arrowsImg from './arrows.svg';
|
8
|
+
|
9
|
+
export const componentName = getComponentName('third-party-app-logo');
|
10
|
+
class RawThirdPartyAppLogoClass extends createBaseClass({
|
11
|
+
componentName,
|
12
|
+
baseSelector: '.wrapper',
|
13
|
+
}) {
|
14
|
+
constructor() {
|
15
|
+
super();
|
16
|
+
this.attachShadow({ mode: 'open' }).innerHTML = `
|
17
|
+
<style>
|
18
|
+
:host {
|
19
|
+
display: inline-flex;
|
20
|
+
}
|
21
|
+
:host([draggable="true"]) > div {
|
22
|
+
pointer-events: none
|
23
|
+
}
|
24
|
+
|
25
|
+
.wrapper {
|
26
|
+
display: flex;
|
27
|
+
justify-content: center;
|
28
|
+
align-items: center;
|
29
|
+
}
|
30
|
+
|
31
|
+
.third-party-app-logo {
|
32
|
+
flex-shrink: 0;
|
33
|
+
display: inline-block;
|
34
|
+
max-width: 100%;
|
35
|
+
max-height: 100%;
|
36
|
+
object-fit: contain;
|
37
|
+
}
|
38
|
+
|
39
|
+
.company-logo-wrapper, .third-party-app-logo-wrapper {
|
40
|
+
flex-shrink: 0;
|
41
|
+
display: inline-flex;
|
42
|
+
}
|
43
|
+
|
44
|
+
.company-logo-wrapper {
|
45
|
+
justify-content: flex-end;
|
46
|
+
}
|
47
|
+
|
48
|
+
.third-party-app-logo-wrapper {
|
49
|
+
justify-content: flex-start;
|
50
|
+
}
|
51
|
+
|
52
|
+
.arrows {
|
53
|
+
flex-shrink: 0;
|
54
|
+
display: flex;
|
55
|
+
}
|
56
|
+
|
57
|
+
</style>
|
58
|
+
<div class="wrapper">
|
59
|
+
<div class="third-party-app-logo-wrapper">
|
60
|
+
<div class="third-party-app-logo"></div>
|
61
|
+
</div>
|
62
|
+
<div class="arrows">
|
63
|
+
<descope-icon src="${arrowsImg}"></descope-icon>
|
64
|
+
</div>
|
65
|
+
<div class="company-logo-wrapper">
|
66
|
+
<descope-logo></descope-logo>
|
67
|
+
</div>
|
68
|
+
</div>
|
69
|
+
`;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
const companyLogoWrapper = '>.company-logo-wrapper';
|
74
|
+
const thirdPartyAppLogoWrapper = '>.third-party-app-logo-wrapper';
|
75
|
+
|
76
|
+
export const ThirdPartyAppLogoClass = compose(
|
77
|
+
createStyleMixin({
|
78
|
+
mappings: {
|
79
|
+
logoMaxHeight: [
|
80
|
+
{ selector: companyLogoWrapper, property: 'height' },
|
81
|
+
{ selector: thirdPartyAppLogoWrapper, property: 'height' },
|
82
|
+
],
|
83
|
+
logoMaxWidth: [
|
84
|
+
{ selector: companyLogoWrapper, property: 'max-width' },
|
85
|
+
{ selector: thirdPartyAppLogoWrapper, property: 'max-width' },
|
86
|
+
],
|
87
|
+
thirdPartyAppLogo: {
|
88
|
+
selector: () => '.third-party-app-logo',
|
89
|
+
property: 'content',
|
90
|
+
fallback: {},
|
91
|
+
},
|
92
|
+
companyLogoFallback: {
|
93
|
+
selector: LogoClass.componentName,
|
94
|
+
property: LogoClass.cssVarList.fallbackUrl,
|
95
|
+
},
|
96
|
+
gap: {},
|
97
|
+
arrowsColor: { selector: IconClass.componentName, property: IconClass.cssVarList.fill },
|
98
|
+
},
|
99
|
+
}),
|
100
|
+
draggableMixin,
|
101
|
+
componentNameValidationMixin
|
102
|
+
)(RawThirdPartyAppLogoClass);
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<svg width="29" height="28" viewBox="0 0 29 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path d="M9.14492 15.645L7.49992 14L2.83325 18.6667L7.49992 23.3333L9.14492 21.6883L7.30159 19.8333H24.9999V17.5H7.30159L9.14492 15.645Z" fill="#636C74"/>
|
3
|
+
<path d="M19.855 12.3553L21.5 14.0003L26.1667 9.33366L21.5 4.66699L19.855 6.31199L21.6983 8.16699H4V10.5003H21.6983L19.855 12.3553Z" fill="#636C74"/>
|
4
|
+
</svg>
|
package/src/helpers/index.js
CHANGED
@@ -6,13 +6,19 @@ export const kebabCase = (str) =>
|
|
6
6
|
|
7
7
|
export const kebabCaseJoin = (...args) => kebabCase(args.filter((arg) => !!arg).join('-'));
|
8
8
|
|
9
|
+
export const upperFirst = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
10
|
+
|
11
|
+
export const camelCaseJoin = (...args) =>
|
12
|
+
args
|
13
|
+
.filter(Boolean)
|
14
|
+
.map((arg, index) => (index === 0 ? arg : upperFirst(arg)))
|
15
|
+
.join('');
|
16
|
+
|
9
17
|
export const compose =
|
10
18
|
(...fns) =>
|
11
19
|
(val) =>
|
12
20
|
fns.reduceRight((res, fn) => fn(res), val);
|
13
21
|
|
14
|
-
export const upperFirst = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
15
|
-
|
16
22
|
export const isFunction = (maybeFunc) => typeof maybeFunc === 'function';
|
17
23
|
|
18
24
|
export const isUrl = (maybeUrl) => {
|
package/src/index.cjs.js
CHANGED
@@ -53,3 +53,4 @@ export { ListClass } from './components/descope-list/ListClass';
|
|
53
53
|
export { ListItemClass } from './components/descope-list/ListItemClass';
|
54
54
|
export { AppsListClass } from './components/descope-apps-list/AppsListClass';
|
55
55
|
export { ScopesListClass } from './components/descope-scopes-list/ScopesListClass';
|
56
|
+
export { ThirdPartyAppLogoClass } from './components/descope-third-party-app-logo/ThirdPartyAppLogoClass';
|
package/src/index.js
CHANGED
@@ -45,6 +45,7 @@ export * from './components/descope-radio-group';
|
|
45
45
|
export * from './components/descope-list';
|
46
46
|
export * from './components/descope-apps-list';
|
47
47
|
export * from './components/descope-scopes-list';
|
48
|
+
export * from './components/descope-third-party-app-logo';
|
48
49
|
|
49
50
|
export {
|
50
51
|
globalsThemeToStyle,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { isFunction, kebabCase } from '../../helpers';
|
1
|
+
import { camelCaseJoin, isFunction, kebabCase, kebabCaseJoin } from '../../helpers';
|
2
2
|
import { getCssVarName } from '../../helpers/componentHelpers';
|
3
3
|
|
4
4
|
const createCssVar = (varName, fallback) => `var(${varName}${fallback ? `, ${fallback}` : ''})`;
|
@@ -46,8 +46,17 @@ const normalizeConfig = (attr, config) => {
|
|
46
46
|
return [{ ...defaultMapping, ...config }];
|
47
47
|
};
|
48
48
|
|
49
|
+
const getFallbackVarName = (origVarName, suffix = 'fallback') => kebabCaseJoin(origVarName, suffix);
|
50
|
+
|
49
51
|
export const createStyle = (componentName, baseSelector, mappings) => {
|
50
52
|
const style = new StyleBuilder();
|
53
|
+
const createFallbackVar = (fallback, origVarName) => {
|
54
|
+
if (!fallback) return '';
|
55
|
+
if (typeof fallback === 'string') return fallback;
|
56
|
+
|
57
|
+
const fallbackVarName = getFallbackVarName(origVarName, fallback?.suffix);
|
58
|
+
return createCssVar(fallbackVarName, createFallbackVar(fallback.fallback, fallbackVarName));
|
59
|
+
};
|
51
60
|
|
52
61
|
Object.keys(mappings).forEach((attr) => {
|
53
62
|
const attrConfig = normalizeConfig(attr, mappings[attr]);
|
@@ -56,10 +65,11 @@ export const createStyle = (componentName, baseSelector, mappings) => {
|
|
56
65
|
|
57
66
|
attrConfig.forEach(
|
58
67
|
({ selector: relativeSelectorOrSelectorFn, property, important, fallback }) => {
|
68
|
+
const fallbackValue = createFallbackVar(fallback, cssVarName);
|
59
69
|
style.add(
|
60
70
|
createCssSelector(baseSelector, relativeSelectorOrSelectorFn),
|
61
71
|
isFunction(property) ? property() : property,
|
62
|
-
createCssVar(cssVarName,
|
72
|
+
createCssVar(cssVarName, fallbackValue) + (important ? '!important' : '')
|
63
73
|
);
|
64
74
|
}
|
65
75
|
);
|
@@ -68,11 +78,27 @@ export const createStyle = (componentName, baseSelector, mappings) => {
|
|
68
78
|
return style.toString();
|
69
79
|
};
|
70
80
|
|
81
|
+
const getFallbackVarsNames = (attr, origVarName, { fallback }) => {
|
82
|
+
if (!fallback) return {};
|
83
|
+
|
84
|
+
const fallbackVarName = getFallbackVarName(origVarName, fallback.suffix);
|
85
|
+
const fallbackAttrName = camelCaseJoin(attr, fallback.suffix || 'fallback');
|
86
|
+
return {
|
87
|
+
[fallbackAttrName]: fallbackVarName,
|
88
|
+
...getFallbackVarsNames(fallbackAttrName, fallbackVarName, fallback),
|
89
|
+
};
|
90
|
+
};
|
91
|
+
|
71
92
|
export const createCssVarsList = (componentName, mappings) =>
|
72
|
-
Object.keys(mappings).reduce(
|
73
|
-
|
74
|
-
|
75
|
-
|
93
|
+
Object.keys(mappings).reduce((acc, attr) => {
|
94
|
+
const varName = getCssVarName(componentName, attr);
|
95
|
+
|
96
|
+
return Object.assign(
|
97
|
+
acc,
|
98
|
+
{ [attr]: varName },
|
99
|
+
getFallbackVarsNames(attr, varName, mappings[attr])
|
100
|
+
);
|
101
|
+
}, {});
|
76
102
|
|
77
103
|
// on some cases we need a selector to be more specific than another
|
78
104
|
// for this we have this fn that generate a class selector multiple times
|
@@ -54,7 +54,7 @@ export const createStyleMixin =
|
|
54
54
|
this.#baseSelector = baseSelector ?? this.baseSelector;
|
55
55
|
this.#getRootElement = getRootElement;
|
56
56
|
|
57
|
-
this.#styleAttributes = Object.keys(
|
57
|
+
this.#styleAttributes = Object.keys(CustomStyleMixinClass.cssVarList).map((key) =>
|
58
58
|
kebabCaseJoin(STYLE_OVERRIDE_ATTR_PREFIX, componentNameSuffix, key)
|
59
59
|
);
|
60
60
|
}
|
@@ -47,6 +47,7 @@ import * as list from './list/list';
|
|
47
47
|
import * as listItem from './list/listItem';
|
48
48
|
import * as appsList from './appsList';
|
49
49
|
import * as scopesList from './scopesList';
|
50
|
+
import * as thirdPartyAppLogo from './thirdPartyAppLogo';
|
50
51
|
|
51
52
|
const components = {
|
52
53
|
button,
|
@@ -99,6 +100,7 @@ const components = {
|
|
99
100
|
listItem,
|
100
101
|
appsList,
|
101
102
|
scopesList,
|
103
|
+
thirdPartyAppLogo,
|
102
104
|
};
|
103
105
|
|
104
106
|
const theme = Object.keys(components).reduce(
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { ThirdPartyAppLogoClass } from '../../components/descope-third-party-app-logo/ThirdPartyAppLogoClass';
|
2
|
+
import { getThemeRefs } from '../../helpers/themeHelpers';
|
3
|
+
import globals from '../globals';
|
4
|
+
|
5
|
+
const globalRefs = getThemeRefs(globals);
|
6
|
+
const vars = ThirdPartyAppLogoClass.cssVarList;
|
7
|
+
|
8
|
+
const thirdPartyAppLogo = {
|
9
|
+
[vars.gap]: globalRefs.spacing.lg,
|
10
|
+
[vars.arrowsColor]: globalRefs.colors.surface.dark,
|
11
|
+
[vars.thirdPartyAppLogoFallback]:
|
12
|
+
'url(https://imgs.descope.com/components/third-party-app-logo-placeholder.svg)',
|
13
|
+
[vars.companyLogoFallback]:
|
14
|
+
'url(https://imgs.descope.com/components/project-logo-placeholder.svg)',
|
15
|
+
size: {
|
16
|
+
xs: {
|
17
|
+
[vars.logoMaxHeight]: '30px',
|
18
|
+
[vars.logoMaxWidth]: '120px',
|
19
|
+
},
|
20
|
+
sm: {
|
21
|
+
[vars.logoMaxHeight]: '40px',
|
22
|
+
[vars.logoMaxWidth]: '160px',
|
23
|
+
},
|
24
|
+
md: {
|
25
|
+
[vars.logoMaxHeight]: '48px',
|
26
|
+
[vars.logoMaxWidth]: '200px',
|
27
|
+
},
|
28
|
+
lg: {
|
29
|
+
[vars.logoMaxHeight]: '60px',
|
30
|
+
[vars.logoMaxWidth]: '240px',
|
31
|
+
},
|
32
|
+
},
|
33
|
+
};
|
34
|
+
|
35
|
+
export default thirdPartyAppLogo;
|
36
|
+
export { vars };
|