@descope/web-components-ui 1.0.290 → 1.0.292
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 +1336 -912
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +1565 -967
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/1000.js +1 -1
- package/dist/umd/descope-grid-index-js.js +1 -1
- package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js +1 -1
- package/dist/umd/descope-new-password-index-js.js +1 -1
- package/dist/umd/descope-policy-validation-index-js.js +1 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/mapping-fields-descope-mappings-field-descope-mapping-item-index-js.js +1 -1
- package/dist/umd/mapping-fields-descope-mappings-field-descope-mappings-field-internal-index-js.js +1 -1
- package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +2 -2
- package/dist/umd/mapping-fields-descope-saml-group-mappings-descope-saml-group-mappings-internal-index-js.js +1 -0
- package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -0
- package/package.json +1 -1
- package/src/components/descope-new-password/NewPasswordClass.js +30 -2
- package/src/components/descope-new-password/descope-new-password-internal/NewPasswordInternal.js +51 -3
- package/src/components/descope-new-password/index.js +1 -0
- package/src/components/descope-policy-validation/PolicyValidationClass.js +220 -0
- package/src/components/descope-policy-validation/helpers.js +2 -0
- package/src/components/descope-policy-validation/index.js +5 -0
- package/src/components/mapping-fields/descope-mappings-field/MappingsFieldClass.js +14 -1
- package/src/components/mapping-fields/descope-mappings-field/descope-mapping-item/MappingItem.js +1 -1
- package/src/components/mapping-fields/descope-mappings-field/descope-mappings-field-internal/MappingsFieldInternal.js +2 -2
- package/src/components/mapping-fields/descope-saml-group-mappings/SamlGroupMappingsClass.js +110 -0
- package/src/components/mapping-fields/descope-saml-group-mappings/descope-saml-group-mappings-internal/SamlGroupMappingsInternal.js +136 -0
- package/src/components/mapping-fields/descope-saml-group-mappings/descope-saml-group-mappings-internal/index.js +3 -0
- package/src/components/mapping-fields/descope-saml-group-mappings/index.js +10 -0
- package/src/index.cjs.js +2 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/mixins/proxyInputMixin.js +7 -0
- package/src/theme/components/index.js +4 -0
- package/src/theme/components/inputWrapper.js +3 -1
- package/src/theme/components/mappingsField.js +3 -1
- package/src/theme/components/newPassword.js +5 -0
- package/src/theme/components/policyValidation.js +29 -0
- package/src/theme/components/samlGroupMappings.js +13 -0
@@ -0,0 +1,136 @@
|
|
1
|
+
import { createBaseInputClass } from '../../../../baseClasses/createBaseInputClass';
|
2
|
+
import {
|
3
|
+
getComponentName,
|
4
|
+
forwardAttrs,
|
5
|
+
observeAttributes,
|
6
|
+
} from '../../../../helpers/componentHelpers';
|
7
|
+
|
8
|
+
export const componentName = getComponentName('saml-group-mappings-internal');
|
9
|
+
|
10
|
+
const BaseInputClass = createBaseInputClass({ componentName, baseSelector: '' });
|
11
|
+
|
12
|
+
class SamlGroupMappingsInternal extends BaseInputClass {
|
13
|
+
static get observedAttributes() {
|
14
|
+
return ['invalid'].concat(BaseInputClass.observedAttributes || []);
|
15
|
+
}
|
16
|
+
|
17
|
+
constructor() {
|
18
|
+
super();
|
19
|
+
|
20
|
+
this.innerHTML = `
|
21
|
+
<descope-text-field variant="body2" bordered="true"></descope-text-field>
|
22
|
+
<descope-mappings-field></descope-mappings-field>
|
23
|
+
`;
|
24
|
+
|
25
|
+
this.groupInputElement = this.querySelector('descope-text-field');
|
26
|
+
this.mappingsElement = this.querySelector('descope-mappings-field');
|
27
|
+
}
|
28
|
+
|
29
|
+
resetInvalidIndication() {
|
30
|
+
this.removeAttribute('invalid');
|
31
|
+
}
|
32
|
+
|
33
|
+
handleMappingsInvalidChange(changedAttributes) {
|
34
|
+
if (changedAttributes.includes('invalid')) {
|
35
|
+
if (!this.mappingsElement.hasAttribute('invalid')) {
|
36
|
+
this.resetInvalidIndication();
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
initFocusHandler() {
|
42
|
+
// This event listener needs to be placed before the super.init() call
|
43
|
+
this.addEventListener('focus', (e) => {
|
44
|
+
// we want to ignore focus events we are dispatching
|
45
|
+
if (e.isTrusted) {
|
46
|
+
const focusedElement = this.mappingsElement.checkValidity()
|
47
|
+
? this.groupInputElement
|
48
|
+
: this.mappingsElement;
|
49
|
+
focusedElement.focus();
|
50
|
+
}
|
51
|
+
});
|
52
|
+
}
|
53
|
+
|
54
|
+
init() {
|
55
|
+
// This needs to be placed before the super.init() call to work
|
56
|
+
this.initFocusHandler();
|
57
|
+
|
58
|
+
super.init?.();
|
59
|
+
|
60
|
+
forwardAttrs(this, this.groupInputElement, {
|
61
|
+
mapAttrs: { 'label-group': 'label' },
|
62
|
+
includeAttrs: ['size', 'label-group', 'readonly', 'disabled'],
|
63
|
+
});
|
64
|
+
|
65
|
+
forwardAttrs(this, this.mappingsElement, {
|
66
|
+
includeAttrs: [
|
67
|
+
'size',
|
68
|
+
'full-width',
|
69
|
+
'label-value',
|
70
|
+
'label-attr',
|
71
|
+
'button-label',
|
72
|
+
'separator',
|
73
|
+
'options',
|
74
|
+
'readonly',
|
75
|
+
'disabled',
|
76
|
+
'data-errormessage-pattern-mismatch',
|
77
|
+
],
|
78
|
+
});
|
79
|
+
|
80
|
+
// Observing the invalid attribute of the mappings field to reset the invalid state for this component.
|
81
|
+
// When an invalid item turns valid, the mappings field will remove the invalid attribute, and at this component
|
82
|
+
// level, we need to remove the invalid attribute as well to be able to mark the component as invalid the next time
|
83
|
+
observeAttributes(this.mappingsElement, this.handleMappingsInvalidChange.bind(this), {
|
84
|
+
includeAttrs: ['invalid'],
|
85
|
+
});
|
86
|
+
}
|
87
|
+
|
88
|
+
get value() {
|
89
|
+
return {
|
90
|
+
group: this.groupInputElement.value,
|
91
|
+
mappings: this.mappingsElement.value,
|
92
|
+
};
|
93
|
+
}
|
94
|
+
|
95
|
+
set value(value) {
|
96
|
+
if (value?.group && typeof value.group === 'string') {
|
97
|
+
this.groupInputElement.value = value.group;
|
98
|
+
}
|
99
|
+
if (Array.isArray(value?.mappings)) {
|
100
|
+
this.mappingsElement.value = value.mappings;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
getValidity() {
|
105
|
+
if (!this.groupInputElement.checkValidity()) {
|
106
|
+
return this.groupInputElement.validity;
|
107
|
+
}
|
108
|
+
if (!this.mappingsElement.checkValidity()) {
|
109
|
+
return this.mappingsElement.validity;
|
110
|
+
}
|
111
|
+
|
112
|
+
return {};
|
113
|
+
}
|
114
|
+
|
115
|
+
#handleInvalidState(isInvalid) {
|
116
|
+
if (isInvalid) {
|
117
|
+
if (!this.groupInputElement.checkValidity()) {
|
118
|
+
this.groupInputElement.setAttribute('invalid', 'true');
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
|
122
|
+
if (!this.mappingsElement.checkValidity()) {
|
123
|
+
this.mappingsElement.setAttribute('invalid', 'true');
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
attributeChangedCallback(attrName, oldValue, newValue) {
|
129
|
+
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
130
|
+
if (attrName === 'invalid') {
|
131
|
+
this.#handleInvalidState(newValue === 'true');
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
export default SamlGroupMappingsInternal;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import '@vaadin/custom-field';
|
2
|
+
|
3
|
+
import { componentName, SamlGroupMappingsClass } from './SamlGroupMappingsClass';
|
4
|
+
import '../../descope-text-field';
|
5
|
+
import '../descope-mappings-field';
|
6
|
+
import './descope-saml-group-mappings-internal';
|
7
|
+
|
8
|
+
customElements.define(componentName, SamlGroupMappingsClass);
|
9
|
+
|
10
|
+
export { SamlGroupMappingsClass };
|
package/src/index.cjs.js
CHANGED
@@ -40,3 +40,5 @@ export { MultiSelectComboBoxClass } from './components/descope-multi-select-comb
|
|
40
40
|
export { AvatarClass } from './components/descope-avatar/AvatarClass';
|
41
41
|
export { UserAttributeClass } from './components/descope-user-attribute/UserAttributeClass';
|
42
42
|
export { MappingsFieldClass } from './components/mapping-fields/descope-mappings-field/MappingsFieldClass';
|
43
|
+
export { SamlGroupMappingsClass } from './components/mapping-fields/descope-saml-group-mappings/SamlGroupMappingsClass';
|
44
|
+
export { PolicyValidationClass } from './components/descope-policy-validation/PolicyValidationClass';
|
package/src/index.d.ts
CHANGED
@@ -43,6 +43,8 @@ export { NotificationClass } from './components/descope-notification/';
|
|
43
43
|
export { BadgeClass } from './components/descope-badge/';
|
44
44
|
export { MultiSelectComboBoxClass } from './components/descope-multi-select-combo-box/';
|
45
45
|
export { MappingsFieldClass } from './components/mapping-fields/descope-mappings-field/';
|
46
|
+
export { SamlGroupMappingsClass } from './components/mapping-fields/descope-saml-group-mappings/';
|
47
|
+
export { PolicyValidationClass } from './components/descope-policy-validation/';
|
46
48
|
|
47
49
|
export type Theme = {
|
48
50
|
globals: {
|
package/src/index.js
CHANGED
@@ -34,6 +34,8 @@ export * from './components/descope-notification';
|
|
34
34
|
export * from './components/descope-avatar';
|
35
35
|
export * from './components/mapping-fields/descope-mappings-field';
|
36
36
|
export * from './components/descope-user-attribute';
|
37
|
+
export * from './components/mapping-fields/descope-saml-group-mappings';
|
38
|
+
export * from './components/descope-policy-validation';
|
37
39
|
|
38
40
|
export {
|
39
41
|
globalsThemeToStyle,
|
@@ -40,6 +40,7 @@ const proxyInputMixin =
|
|
40
40
|
// allows us to set the event that should trigger validation
|
41
41
|
// it can be either a string or an array of strings (for multiple events)
|
42
42
|
inputEvent = 'input',
|
43
|
+
triggerValidationEvents = [],
|
43
44
|
// Proxies all validations from the parent component to the input element
|
44
45
|
proxyParentValidation = false,
|
45
46
|
}) =>
|
@@ -128,6 +129,12 @@ const proxyInputMixin =
|
|
128
129
|
}
|
129
130
|
};
|
130
131
|
|
132
|
+
triggerValidationEvents.forEach((e) => {
|
133
|
+
this.baseElement?.addEventListener(e, () => {
|
134
|
+
this.inputElement?.setCustomValidity('');
|
135
|
+
});
|
136
|
+
});
|
137
|
+
|
131
138
|
// on some cases the base element is not ready so the inputElement is empty
|
132
139
|
// we are deferring this section to make sure the base element is ready
|
133
140
|
setTimeout(() => {
|
@@ -33,6 +33,8 @@ import * as badge from './badge';
|
|
33
33
|
import * as avatar from './avatar';
|
34
34
|
import * as mappingsField from './mappingsField';
|
35
35
|
import * as userAttribute from './userAttribute';
|
36
|
+
import * as samlGroupMappings from './samlGroupMappings';
|
37
|
+
import * as policyValidation from './policyValidation';
|
36
38
|
|
37
39
|
const components = {
|
38
40
|
button,
|
@@ -71,6 +73,8 @@ const components = {
|
|
71
73
|
avatar,
|
72
74
|
mappingsField,
|
73
75
|
userAttribute,
|
76
|
+
samlGroupMappings,
|
77
|
+
policyValidation,
|
74
78
|
};
|
75
79
|
|
76
80
|
const theme = Object.keys(components).reduce(
|
@@ -8,11 +8,13 @@ const globalRefs = getThemeRefs(globals);
|
|
8
8
|
const [theme, refs, vars] = createHelperVars(
|
9
9
|
{
|
10
10
|
labelTextColor: globalRefs.colors.surface.dark,
|
11
|
+
labelFontSize: globalRefs.typography.body2.size,
|
11
12
|
valueTextColor: globalRefs.colors.surface.contrast,
|
12
13
|
placeholderTextColor: globalRefs.colors.surface.dark,
|
13
14
|
requiredIndicator: "'*'",
|
14
|
-
errorMessageTextColor: globalRefs.colors.error.main,
|
15
15
|
helperTextColor: globalRefs.colors.surface.dark,
|
16
|
+
errorMessageTextColor: globalRefs.colors.error.main,
|
17
|
+
successMessageTextColor: globalRefs.colors.success.main,
|
16
18
|
|
17
19
|
borderWidth: globalRefs.border.xs,
|
18
20
|
borderRadius: globalRefs.radius.xs,
|
@@ -13,13 +13,15 @@ export const mappingsField = {
|
|
13
13
|
[vars.fontSize]: refs.fontSize,
|
14
14
|
[vars.fontFamily]: refs.fontFamily,
|
15
15
|
[vars.separatorFontSize]: '14px',
|
16
|
+
[vars.labelsFontSize]: '14px',
|
17
|
+
[vars.labelsLineHeight]: '1',
|
18
|
+
[vars.labelsMarginBottom]: '6px',
|
16
19
|
[vars.labelTextColor]: refs.labelTextColor,
|
17
20
|
[vars.itemMarginBottom]: '1em',
|
18
21
|
// To be positioned correctly, the min width has to match the text field min width
|
19
22
|
[vars.valueLabelMinWidth]: refs.minWidth,
|
20
23
|
// To be positioned correctly, the min width has to match the combo box field min width
|
21
24
|
[vars.attrLabelMinWidth]: `calc(12em + 2 * ${globalRefs.border.xs})`,
|
22
|
-
[vars.labelsMarginBottom]: `calc(${globalRefs.typography.body2.size} / 2)`,
|
23
25
|
[vars.separatorWidth]: '70px',
|
24
26
|
[vars.removeButtonWidth]: '60px',
|
25
27
|
};
|
@@ -1,6 +1,9 @@
|
|
1
|
+
import globals from '../globals';
|
1
2
|
import { NewPasswordClass } from '../../components/descope-new-password/NewPasswordClass';
|
2
3
|
import { refs } from './inputWrapper';
|
4
|
+
import { getThemeRefs } from '../../helpers/themeHelpers';
|
3
5
|
|
6
|
+
const globalRefs = getThemeRefs(globals);
|
4
7
|
const vars = NewPasswordClass.cssVarList;
|
5
8
|
|
6
9
|
const newPassword = {
|
@@ -11,6 +14,8 @@ const newPassword = {
|
|
11
14
|
[vars.fontFamily]: refs.fontFamily,
|
12
15
|
[vars.spaceBetweenInputs]: '1em',
|
13
16
|
[vars.errorMessageTextColor]: refs.errorMessageTextColor,
|
17
|
+
[vars.policyPreviewBackgroundColor]: 'none',
|
18
|
+
[vars.policyPreviewPadding]: globalRefs.spacing.lg,
|
14
19
|
|
15
20
|
_required: {
|
16
21
|
// NewPassword doesn't pass `required` attribute to its Password components.
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import globals from '../globals';
|
2
|
+
import { getThemeRefs } from '../../helpers/themeHelpers';
|
3
|
+
import { PolicyValidationClass } from '../../components/descope-policy-validation/PolicyValidationClass';
|
4
|
+
import { refs } from './inputWrapper';
|
5
|
+
|
6
|
+
const globalRefs = getThemeRefs(globals);
|
7
|
+
const vars = PolicyValidationClass.cssVarList;
|
8
|
+
|
9
|
+
const policyValidation = {
|
10
|
+
[vars.fontFamily]: refs.fontFamily,
|
11
|
+
[vars.fontSize]: refs.labelFontSize,
|
12
|
+
[vars.textColor]: refs.labelTextColor,
|
13
|
+
[vars.borderWidth]: refs.borderWidth,
|
14
|
+
[vars.borderStyle]: refs.borderStyle,
|
15
|
+
[vars.borderColor]: refs.borderColor,
|
16
|
+
[vars.borderRadius]: globalRefs.radius.sm,
|
17
|
+
[vars.backgroundColor]: 'none',
|
18
|
+
[vars.padding]: '0px',
|
19
|
+
[vars.labelMargin]: globalRefs.spacing.sm,
|
20
|
+
[vars.itemsSpacing]: globalRefs.spacing.lg,
|
21
|
+
[vars.itemSymbolDefault]: "'\\2022'", // "•"
|
22
|
+
[vars.itemSymbolSuccess]: "'\\2713'", // "✓"
|
23
|
+
[vars.itemSymbolError]: "'\\2A09'", // "⨉"
|
24
|
+
[vars.itemSymbolSuccessColor]: globalRefs.colors.success.main,
|
25
|
+
[vars.itemSymbolErrorColor]: globalRefs.colors.error.main,
|
26
|
+
};
|
27
|
+
|
28
|
+
export default policyValidation;
|
29
|
+
export { vars };
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { SamlGroupMappingsClass } from '../../components/mapping-fields/descope-saml-group-mappings/SamlGroupMappingsClass';
|
2
|
+
import { refs } from './inputWrapper';
|
3
|
+
|
4
|
+
const vars = SamlGroupMappingsClass.cssVarList;
|
5
|
+
|
6
|
+
export const samlGroupMappings = {
|
7
|
+
[vars.hostWidth]: refs.width,
|
8
|
+
[vars.hostDirection]: refs.direction,
|
9
|
+
[vars.groupNameInputMarginBottom]: '1em',
|
10
|
+
};
|
11
|
+
|
12
|
+
export default samlGroupMappings;
|
13
|
+
export { vars };
|