@descope/web-components-ui 3.24.0 → 3.26.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.
Files changed (40) hide show
  1. package/dist/cjs/index.cjs.js +2134 -1370
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +3057 -2083
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/8961.js +1 -1
  6. package/dist/umd/8961.js.map +1 -1
  7. package/dist/umd/DescopeDev.js +1 -1
  8. package/dist/umd/DescopeDev.js.map +1 -1
  9. package/dist/umd/descope-email-field.js +55 -0
  10. package/dist/umd/descope-email-field.js.map +1 -0
  11. package/dist/umd/descope-hybrid-field-index-js.js +3 -3
  12. package/dist/umd/descope-hybrid-field-index-js.js.map +1 -1
  13. package/dist/umd/descope-new-email.js +55 -0
  14. package/dist/umd/descope-new-email.js.LICENSE.txt +11 -0
  15. package/dist/umd/descope-new-email.js.map +1 -0
  16. package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js +1 -1
  17. package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js.map +1 -1
  18. package/dist/umd/descope-new-password-index-js.js +1 -1
  19. package/dist/umd/descope-new-password-index-js.js.map +1 -1
  20. package/dist/umd/descope-policy-validation-index-js.js +1 -1
  21. package/dist/umd/descope-policy-validation-index-js.js.map +1 -1
  22. package/dist/umd/index.js +1 -1
  23. package/dist/umd/index.js.map +1 -1
  24. package/package.json +45 -43
  25. package/src/components/descope-hybrid-field/index.js +1 -1
  26. package/src/components/descope-new-password/NewPasswordClass.js +1 -0
  27. package/src/components/descope-new-password/descope-new-password-internal/NewPasswordInternal.js +1 -0
  28. package/src/components/descope-policy-validation/PolicyValidationClass.js +21 -6
  29. package/src/index.cjs.js +0 -1
  30. package/src/index.js +0 -1
  31. package/src/theme/components/index.js +3 -1
  32. package/stories/descope-email-field.stories.js +1 -1
  33. package/stories/descope-policy-validation.stories.js +21 -1
  34. package/dist/umd/descope-email-field-index-js.js +0 -55
  35. package/dist/umd/descope-email-field-index-js.js.map +0 -1
  36. package/src/components/descope-email-field/EmailFieldClass.js +0 -138
  37. package/src/components/descope-email-field/emailPattern.js +0 -7
  38. package/src/components/descope-email-field/index.js +0 -6
  39. package/src/theme/components/emailField.js +0 -55
  40. /package/dist/umd/{descope-email-field-index-js.js.LICENSE.txt → descope-email-field.js.LICENSE.txt} +0 -0
@@ -1,138 +0,0 @@
1
- import textFieldMappings from '@descope-ui/descope-text-field/mappings';
2
- import {
3
- createStyleMixin,
4
- draggableMixin,
5
- createProxy,
6
- proxyInputMixin,
7
- componentNameValidationMixin,
8
- externalInputMixin,
9
- } from '../../mixins';
10
- import { compose } from '../../helpers';
11
- import { asciiPattern, unicodePattern } from './emailPattern';
12
- import { getComponentName } from '../../helpers/componentHelpers';
13
- import {
14
- inputFloatingLabelStyle,
15
- resetInputLabelPosition,
16
- resetInputOverrides,
17
- useHostExternalPadding,
18
- } from '../../helpers/themeHelpers/resetHelpers';
19
-
20
- export const componentName = getComponentName('email-field');
21
-
22
- const defaultAutocomplete = 'username';
23
- const defaultInputMode = 'email';
24
-
25
- const customMixin = (superclass) =>
26
- class EmailFieldMixinClass extends superclass {
27
- // On by default - `accept-unicode="false"` restores the pre-unicode field:
28
- // native `type="email"` validation and the ASCII pattern.
29
- //
30
- // Read once, in `init`. Changing the attribute afterwards has no effect; it
31
- // is static configuration, which is how every consumer sets it.
32
- get acceptsUnicode() {
33
- return this.getAttribute('accept-unicode') !== 'false';
34
- }
35
-
36
- init() {
37
- super.init?.();
38
-
39
- // we need to set the pattern on the base element because vaadin-email-field is overriding it
40
- this.baseElement.setAttribute('pattern', asciiPattern);
41
-
42
- if (!this.getAttribute('autocomplete')) {
43
- this.setAttribute('autocomplete', defaultAutocomplete);
44
- }
45
-
46
- this.createExternalInput();
47
-
48
- [this.inputElement, this.externalInput].filter(Boolean).forEach((input) => {
49
- input.addEventListener('change', this.stripSurroundingWhitespace);
50
- });
51
-
52
- if (this.acceptsUnicode) {
53
- this.enableUnicode();
54
- }
55
- }
56
-
57
- enableUnicode() {
58
- this.baseElement.setAttribute('pattern', unicodePattern);
59
-
60
- // native `type="email"` validation is ASCII only and sets typeMismatch
61
- // before `pattern` is consulted, so `text` is what lets the pattern decide.
62
- // Through vaadin's `_setType` because `type` is a readOnly property bound
63
- // to the inner input - assigning `input.type` is re-applied over.
64
- this.baseElement._setType('text');
65
-
66
- if (this.externalInput) {
67
- this.externalInput.type = 'text';
68
- }
69
-
70
- // `type="text"` loses the email keyboard on mobile
71
- if (!this.getAttribute('inputmode')) {
72
- this.setAttribute('inputmode', defaultInputMode);
73
- }
74
-
75
- this.externalInput?.setAttribute('inputmode', defaultInputMode);
76
- }
77
-
78
- stripSurroundingWhitespace = (e) => {
79
- const trimmed = e.target.value.trim();
80
- if (trimmed === e.target.value) return;
81
- this.value = trimmed;
82
-
83
- // validity is cached and was computed against the untrimmed value
84
- this.inputElement.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
85
- };
86
- };
87
-
88
- export const EmailFieldClass = compose(
89
- createStyleMixin({
90
- mappings: textFieldMappings,
91
- }),
92
- draggableMixin,
93
- externalInputMixin({
94
- inputType: 'email',
95
- inputName: 'email',
96
- autocompleteType: 'username',
97
- includeAttrs: ['disabled', 'readonly', 'pattern'],
98
- }),
99
- proxyInputMixin({ proxyProps: ['value', 'selectionStart'], useProxyTargets: true }),
100
- componentNameValidationMixin,
101
- customMixin
102
- )(
103
- createProxy({
104
- slots: ['', 'suffix'],
105
- wrappedEleName: 'vaadin-email-field',
106
- style: () => `
107
- :host {
108
- display: inline-block;
109
- max-width: 100%;
110
- padding: calc(var(${EmailFieldClass.cssVarList.inputOutlineWidth}) + var(${
111
- EmailFieldClass.cssVarList.inputOutlineOffset
112
- }));
113
- box-sizing: border-box;
114
- }
115
- ${resetInputLabelPosition('vaadin-email-field')}
116
- ${useHostExternalPadding(EmailFieldClass.cssVarList)}
117
- ${resetInputOverrides('vaadin-email-field', EmailFieldClass.cssVarList)}
118
- ${inputFloatingLabelStyle()}
119
-
120
- vaadin-email-field[label-type="floating"]:not([focused])[readonly] > input:placeholder-shown {
121
- opacity: 0;
122
- }
123
- vaadin-email-field[label-type="floating"]:not([focused])[disabled] > input:placeholder-shown {
124
- opacity: 0;
125
- }
126
-
127
- :host ::slotted(*) {
128
- -webkit-mask-image: none;
129
- }
130
-
131
- vaadin-email-field[external-input="true"] > input:not(:placeholder-shown) {
132
- opacity: 0;
133
- }
134
- `,
135
- excludeAttrsSync: ['tabindex', 'style'],
136
- componentName,
137
- })
138
- );
@@ -1,7 +0,0 @@
1
- // Kept in its own module (with no imports) so it can be unit tested without
2
- // pulling in the whole component / vaadin dependency chain.
3
-
4
- export const asciiPattern = "^[\\w\\.\\%\\+\\-']+@[\\w\\.\\-]+\\.[A-Za-z]{2,}$";
5
-
6
- export const unicodePattern =
7
- "^[\\p{L}\\p{M}\\p{N}._%+'\\-]+@[\\p{L}\\p{M}\\p{N}.\\-]+\\.[\\p{L}\\p{M}][\\p{L}\\p{M}\\p{N}\\-]+$";
@@ -1,6 +0,0 @@
1
- import '@vaadin/email-field';
2
- import { componentName, EmailFieldClass } from './EmailFieldClass';
3
-
4
- customElements.define(componentName, EmailFieldClass);
5
-
6
- export { EmailFieldClass, componentName };
@@ -1,55 +0,0 @@
1
- import { EmailFieldClass } from '../../components/descope-email-field/EmailFieldClass';
2
- import { refs } from './inputWrapper';
3
-
4
- const vars = EmailFieldClass.cssVarList;
5
-
6
- const emailField = {
7
- [vars.hostWidth]: refs.width,
8
- [vars.hostMinWidth]: refs.minWidth,
9
- [vars.hostDirection]: refs.direction,
10
- [vars.fontSize]: refs.fontSize,
11
- [vars.fontFamily]: refs.fontFamily,
12
- [vars.labelFontSize]: refs.labelFontSize,
13
- [vars.labelFontWeight]: refs.labelFontWeight,
14
- [vars.inputValueFontWeight]: refs.inputValueFontWeight,
15
- [vars.inputPlaceholderFontWeight]: refs.inputPlaceholderFontWeight,
16
- [vars.helperTextFontWeight]: refs.helperTextFontWeight,
17
- [vars.errorMessageFontWeight]: refs.errorMessageFontWeight,
18
- [vars.labelTextColor]: refs.labelTextColor,
19
- [vars.errorMessageTextColor]: refs.errorMessageTextColor,
20
- [vars.inputValueTextColor]: refs.valueTextColor,
21
- [vars.labelRequiredIndicator]: refs.requiredIndicator,
22
- [vars.inputPlaceholderColor]: refs.placeholderTextColor,
23
- [vars.inputBorderWidth]: refs.borderWidth,
24
- [vars.inputBorderStyle]: refs.borderStyle,
25
- [vars.inputBorderColor]: refs.borderColor,
26
- [vars.inputBorderRadius]: refs.borderRadius,
27
- [vars.inputOutlineWidth]: refs.outlineWidth,
28
- [vars.inputOutlineStyle]: refs.outlineStyle,
29
- [vars.inputOutlineColor]: refs.outlineColor,
30
- [vars.inputOutlineOffset]: refs.outlineOffset,
31
- [vars.inputBackgroundColor]: refs.backgroundColor,
32
- [vars.inputHorizontalPadding]: refs.horizontalPadding,
33
- [vars.inputHeight]: refs.inputHeight,
34
- [vars.labelPosition]: refs.labelPosition,
35
- [vars.labelTopPosition]: refs.labelTopPosition,
36
- [vars.labelHorizontalPosition]: refs.labelHorizontalPosition,
37
- [vars.inputTransformY]: refs.inputTransformY,
38
- [vars.inputTransition]: refs.inputTransition,
39
- [vars.marginInlineStart]: refs.marginInlineStart,
40
- [vars.placeholderOpacity]: refs.placeholderOpacity,
41
- [vars.inputVerticalAlignment]: refs.inputVerticalAlignment,
42
- [vars.valueInputHeight]: refs.valueInputHeight,
43
- [vars.valueInputMarginBottom]: refs.valueInputMarginBottom,
44
-
45
- // error message icon
46
- [vars.errorMessageIcon]: refs.errorMessageIcon,
47
- [vars.errorMessageIconSize]: refs.errorMessageIconSize,
48
- [vars.errorMessageIconPadding]: refs.errorMessageIconPadding,
49
- [vars.errorMessageIconRepeat]: refs.errorMessageIconRepeat,
50
- [vars.errorMessageIconPosition]: refs.errorMessageIconPosition,
51
- [vars.errorMessageFontSize]: refs.errorMessageFontSize,
52
- };
53
-
54
- export default emailField;
55
- export { vars };