@everymatrix/general-input 1.10.2 → 1.15.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/checkbox-group-input_10.cjs.entry.js +35539 -0
- package/dist/cjs/general-input.cjs.entry.js +34 -13
- package/dist/cjs/general-input.cjs.js +2 -2
- package/dist/cjs/{index-64a5cb7f.js → index-132a0774.js} +119 -6
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/locale.utils-7665b010.js +71 -0
- package/dist/cjs/toggle-checkbox-input.cjs.entry.js +85 -0
- package/dist/cjs/tooltipIcon-092a795f.js +5 -0
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/checkbox-group-input/checkbox-group-input.css +62 -0
- package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +366 -0
- package/dist/collection/components/checkbox-input/checkbox-input.css +47 -1
- package/dist/collection/components/checkbox-input/checkbox-input.js +143 -16
- package/dist/collection/components/date-input/date-input.css +64 -30
- package/dist/collection/components/date-input/date-input.js +194 -13
- package/dist/collection/components/email-input/email-input.css +63 -28
- package/dist/collection/components/email-input/email-input.js +197 -21
- package/dist/collection/components/general-input/general-input.js +163 -21
- package/dist/collection/components/number-input/number-input.css +65 -30
- package/dist/collection/components/number-input/number-input.js +174 -19
- package/dist/collection/components/password-input/password-input.css +120 -29
- package/dist/collection/components/password-input/password-input.js +341 -25
- package/dist/collection/components/radio-input/radio-input.css +22 -1
- package/dist/collection/components/radio-input/radio-input.js +89 -10
- package/dist/collection/components/select-input/select-input.css +75 -22
- package/dist/collection/components/select-input/select-input.js +180 -37
- package/dist/collection/components/tel-input/tel-input.css +91 -33
- package/dist/collection/components/tel-input/tel-input.js +202 -24
- package/dist/collection/components/text-input/text-input.css +63 -28
- package/dist/collection/components/text-input/text-input.js +208 -39
- package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.css +76 -0
- package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +324 -0
- package/dist/collection/utils/locale.utils.js +52 -13
- package/dist/collection/utils/tooltipIcon.svg +5 -0
- package/dist/components/active-mixin.js +975 -0
- package/dist/components/checkbox-group-input.d.ts +11 -0
- package/dist/components/checkbox-group-input.js +6 -0
- package/dist/components/checkbox-group-input2.js +1125 -0
- package/dist/components/checkbox-input2.js +62 -12
- package/dist/components/date-input2.js +10247 -15
- package/dist/components/email-input2.js +98 -21
- package/dist/components/field-mixin.js +12712 -0
- package/dist/components/general-input.js +1 -118
- package/dist/components/general-input2.js +331 -0
- package/dist/components/input-field-shared-styles.js +1114 -0
- package/dist/components/number-input2.js +92 -16
- package/dist/components/password-input2.js +924 -24
- package/dist/components/pattern-mixin.js +85 -0
- package/dist/components/radio-input2.js +45 -11
- package/dist/components/select-input2.js +87 -27
- package/dist/components/tel-input2.js +122 -22
- package/dist/components/text-input2.js +120 -34
- package/dist/components/toggle-checkbox-input.d.ts +11 -0
- package/dist/components/toggle-checkbox-input.js +6 -0
- package/dist/components/tooltipIcon.js +70 -0
- package/dist/components/vaadin-button.js +461 -0
- package/dist/components/vaadin-combo-box.js +4329 -0
- package/dist/components/virtual-keyboard-controller.js +2658 -0
- package/dist/esm/checkbox-group-input_10.entry.js +35526 -0
- package/dist/esm/general-input.entry.js +34 -13
- package/dist/esm/general-input.js +2 -2
- package/dist/esm/{index-df80f936.js → index-db76d5b5.js} +118 -7
- package/dist/esm/loader.js +2 -2
- package/dist/esm/locale.utils-95ea2605.js +68 -0
- package/dist/esm/toggle-checkbox-input.entry.js +81 -0
- package/dist/esm/tooltipIcon-99c1c7b7.js +3 -0
- package/dist/general-input/general-input.esm.js +1 -1
- package/dist/general-input/p-0966f523.entry.js +3581 -0
- package/dist/general-input/p-916a1319.entry.js +1 -0
- package/dist/general-input/p-b408093e.js +1 -0
- package/dist/general-input/p-c2d4d6ac.entry.js +1 -0
- package/dist/general-input/p-f4f4ccda.js +1 -0
- package/dist/general-input/p-f6132f1d.js +1 -0
- package/dist/types/components/checkbox-group-input/checkbox-group-input.d.ts +74 -0
- package/dist/types/components/checkbox-input/checkbox-input.d.ts +28 -2
- package/dist/types/components/date-input/date-input.d.ts +43 -1
- package/dist/types/components/email-input/email-input.d.ts +37 -3
- package/dist/types/components/general-input/general-input.d.ts +30 -0
- package/dist/types/components/number-input/number-input.d.ts +34 -3
- package/dist/types/components/password-input/password-input.d.ts +56 -7
- package/dist/types/components/radio-input/radio-input.d.ts +17 -1
- package/dist/types/components/select-input/select-input.d.ts +36 -3
- package/dist/types/components/tel-input/tel-input.d.ts +40 -5
- package/dist/types/components/text-input/text-input.d.ts +84 -0
- package/dist/types/components/toggle-checkbox-input/toggle-checkbox-input.d.ts +67 -0
- package/dist/types/components.d.ts +568 -9
- package/dist/types/utils/locale.utils.d.ts +9 -0
- package/dist/types/utils/types.d.ts +41 -9
- package/package.json +8 -1
- package/dist/cjs/checkbox-input_9.cjs.entry.js +0 -623
- package/dist/components/locale.utils.js +0 -29
- package/dist/esm/checkbox-input_9.entry.js +0 -611
- package/dist/general-input/p-1703fce3.entry.js +0 -1
- package/dist/general-input/p-d9f7fa2e.js +0 -1
- package/dist/general-input/p-dea0a4ac.entry.js +0 -1
- /package/dist/types/Users/{user/workspace/everymatrix → adrian.pripon/Documents/Work}/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +0 -0
|
@@ -6,55 +6,146 @@
|
|
|
6
6
|
box-sizing: border-box;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
.password {
|
|
10
|
+
font-family: "Roboto";
|
|
11
|
+
font-style: normal;
|
|
12
|
+
}
|
|
9
13
|
.password__wrapper {
|
|
10
14
|
position: relative;
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
17
|
+
.password__wrapper--autofilled {
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
}
|
|
20
|
+
.password__wrapper--autofilled .password__label {
|
|
21
|
+
color: #979797;
|
|
22
|
+
}
|
|
23
|
+
.password__wrapper--autofilled .password__input::part(input-field) {
|
|
24
|
+
color: #979797;
|
|
25
|
+
}
|
|
26
|
+
.password__wrapper--flex {
|
|
11
27
|
display: flex;
|
|
12
|
-
|
|
13
|
-
|
|
28
|
+
gap: 5px;
|
|
29
|
+
}
|
|
30
|
+
.password__wrapper--relative {
|
|
31
|
+
position: relative;
|
|
14
32
|
}
|
|
15
33
|
.password__label {
|
|
16
|
-
|
|
34
|
+
font-family: inherit;
|
|
35
|
+
font-style: normal;
|
|
36
|
+
font-weight: 500;
|
|
17
37
|
font-size: 16px;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
left: 5px;
|
|
21
|
-
transform: translateY(-25px);
|
|
22
|
-
transition: all 0.3s cubic-bezier(0.5, 0, 0.5, 1);
|
|
38
|
+
line-height: 20px;
|
|
39
|
+
color: #2A3841;
|
|
23
40
|
}
|
|
24
41
|
.password__label--required::after {
|
|
25
42
|
content: "*";
|
|
26
|
-
|
|
27
|
-
color: #
|
|
43
|
+
font-family: inherit;
|
|
44
|
+
color: #2A3841;
|
|
45
|
+
margin-left: 2px;
|
|
28
46
|
}
|
|
29
47
|
.password__input {
|
|
30
48
|
width: inherit;
|
|
31
|
-
padding: 15px 6px;
|
|
32
|
-
position: relative;
|
|
33
49
|
border: none;
|
|
34
|
-
|
|
35
|
-
background-color: transparent;
|
|
36
|
-
color: #666666;
|
|
37
|
-
font-size: 16px;
|
|
38
|
-
font-family: inherit;
|
|
50
|
+
margin-bottom: 5px;
|
|
39
51
|
}
|
|
40
|
-
.password__input
|
|
41
|
-
|
|
42
|
-
box-shadow: 0 5px 5px rgba(16, 15, 15, 0.1);
|
|
52
|
+
.password__input[focused]::part(input-field) {
|
|
53
|
+
border-color: #3E3E3E;
|
|
43
54
|
}
|
|
44
|
-
.password__input::
|
|
45
|
-
color: #
|
|
55
|
+
.password__input[invalid]::part(input-field) {
|
|
56
|
+
border-color: #cc0000b3;
|
|
46
57
|
}
|
|
47
|
-
.password__input
|
|
48
|
-
border-
|
|
58
|
+
.password__input::part(input-field) {
|
|
59
|
+
border-radius: 4px;
|
|
60
|
+
background-color: transparent;
|
|
61
|
+
font-family: inherit;
|
|
62
|
+
font-style: normal;
|
|
63
|
+
font-weight: 300;
|
|
64
|
+
font-size: 16px;
|
|
65
|
+
line-height: 19px;
|
|
66
|
+
color: #2A2E3F;
|
|
67
|
+
width: 100%;
|
|
68
|
+
position: relative;
|
|
69
|
+
border: 2px solid #DEE1EE;
|
|
49
70
|
}
|
|
50
|
-
.password__input:placeholder-shown
|
|
51
|
-
|
|
52
|
-
visibility: hidden;
|
|
53
|
-
transform: translateY(0);
|
|
71
|
+
.password__input > input:placeholder-shown {
|
|
72
|
+
color: #979797;
|
|
54
73
|
}
|
|
55
74
|
.password__error-message {
|
|
56
75
|
position: absolute;
|
|
57
76
|
top: calc(100% + 5px);
|
|
58
77
|
left: 0;
|
|
59
|
-
color: #
|
|
78
|
+
color: #cc0000b3;
|
|
79
|
+
}
|
|
80
|
+
.password__complexity {
|
|
81
|
+
position: relative;
|
|
82
|
+
padding: 10px;
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
gap: 20px;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
margin-top: 20px;
|
|
88
|
+
font-weight: 300;
|
|
89
|
+
background: #FFFFFF;
|
|
90
|
+
-webkit-border-radius: 10px;
|
|
91
|
+
-moz-border-radius: 10px;
|
|
92
|
+
border-radius: 10px;
|
|
93
|
+
height: 150px;
|
|
94
|
+
border: 1px solid #B0B0B0;
|
|
95
|
+
}
|
|
96
|
+
.password__complexity--strength {
|
|
97
|
+
display: flex;
|
|
98
|
+
justify-content: space-evenly;
|
|
99
|
+
}
|
|
100
|
+
.password__complexity--strength meter::-webkit-meter-optimum-value {
|
|
101
|
+
background: #1F1F1F;
|
|
102
|
+
}
|
|
103
|
+
.password__complexity--strength meter::-moz-meter-bar {
|
|
104
|
+
/* Firefox Pseudo Class */
|
|
105
|
+
background: #B0B0B0;
|
|
106
|
+
}
|
|
107
|
+
.password__complexity--hidden {
|
|
108
|
+
display: none;
|
|
109
|
+
}
|
|
110
|
+
.password__complexity--text-bold {
|
|
111
|
+
font-weight: 500;
|
|
112
|
+
}
|
|
113
|
+
.password__complexity--checkbox {
|
|
114
|
+
margin-right: 5px;
|
|
115
|
+
}
|
|
116
|
+
.password__complexity:after {
|
|
117
|
+
content: "";
|
|
118
|
+
position: absolute;
|
|
119
|
+
width: 25px;
|
|
120
|
+
height: 25px;
|
|
121
|
+
border-top: 1px solid #B0B0B0;
|
|
122
|
+
border-right: 0 solid #B0B0B0;
|
|
123
|
+
border-left: 1px solid #B0B0B0;
|
|
124
|
+
border-bottom: 0 solid #B0B0B0;
|
|
125
|
+
bottom: 92%;
|
|
126
|
+
left: 50%;
|
|
127
|
+
margin-left: -25px;
|
|
128
|
+
transform: rotate(45deg);
|
|
129
|
+
margin-top: -25px;
|
|
130
|
+
background-color: #FFFFFF;
|
|
131
|
+
}
|
|
132
|
+
.password__tooltip-icon {
|
|
133
|
+
width: 16px;
|
|
134
|
+
height: auto;
|
|
135
|
+
}
|
|
136
|
+
.password__tooltip {
|
|
137
|
+
position: absolute;
|
|
138
|
+
top: 0;
|
|
139
|
+
left: 20px;
|
|
140
|
+
background-color: #FFFFFF;
|
|
141
|
+
border: 1px solid #B0B0B0;
|
|
142
|
+
color: #2B2D3F;
|
|
143
|
+
padding: 10px;
|
|
144
|
+
border-radius: 5px;
|
|
145
|
+
opacity: 0;
|
|
146
|
+
transition: opacity 0.3s ease-in-out;
|
|
147
|
+
z-index: 10;
|
|
148
|
+
}
|
|
149
|
+
.password__tooltip.visible {
|
|
150
|
+
opacity: 1;
|
|
60
151
|
}
|
|
@@ -1,8 +1,54 @@
|
|
|
1
|
-
import { Component, h, Prop, State, Watch, Event } from '@stencil/core';
|
|
1
|
+
import { Component, h, Prop, State, Watch, Event, Listen, Element } from '@stencil/core';
|
|
2
2
|
import { translate } from '../../utils/locale.utils';
|
|
3
|
+
import '@vaadin/password-field';
|
|
4
|
+
import tooltipIcon from '../../utils/tooltipIcon.svg';
|
|
3
5
|
export class PasswordInput {
|
|
4
6
|
constructor() {
|
|
7
|
+
/**
|
|
8
|
+
* Default value for the input.
|
|
9
|
+
*/
|
|
10
|
+
this.defaultValue = '';
|
|
11
|
+
/**
|
|
12
|
+
* Client custom styling via inline style
|
|
13
|
+
*/
|
|
14
|
+
this.clientStyling = '';
|
|
15
|
+
this.limitStylingAppends = false;
|
|
16
|
+
this.showTooltip = false;
|
|
17
|
+
this.value = '';
|
|
18
|
+
this.touched = false;
|
|
19
|
+
this.originalValid = false;
|
|
5
20
|
this.validationPattern = '';
|
|
21
|
+
this.duplicateInputValue = null;
|
|
22
|
+
this.handleInput = (event) => {
|
|
23
|
+
this.value = event.target.value;
|
|
24
|
+
this.calculateComplexity(this.value);
|
|
25
|
+
this.showPopup = true;
|
|
26
|
+
this.touched = true;
|
|
27
|
+
if (this.debounceTime) {
|
|
28
|
+
clearTimeout(this.debounceTime);
|
|
29
|
+
}
|
|
30
|
+
this.debounceTime = setTimeout(() => {
|
|
31
|
+
this.isValid = this.setValidity();
|
|
32
|
+
this.errorMessage = this.setErrorMessage();
|
|
33
|
+
this.emitValueHandler(true);
|
|
34
|
+
}, 500);
|
|
35
|
+
};
|
|
36
|
+
this.handleBlur = (event) => {
|
|
37
|
+
this.value = event.target.value;
|
|
38
|
+
this.showPopup = false;
|
|
39
|
+
this.touched = true;
|
|
40
|
+
this.isValid = this.setValidity();
|
|
41
|
+
this.errorMessage = this.setErrorMessage();
|
|
42
|
+
};
|
|
43
|
+
this.handleFocus = () => {
|
|
44
|
+
this.showPopup = true;
|
|
45
|
+
this.calculateComplexity(this.value);
|
|
46
|
+
};
|
|
47
|
+
this.setClientStyling = () => {
|
|
48
|
+
let sheet = document.createElement('style');
|
|
49
|
+
sheet.innerHTML = this.clientStyling;
|
|
50
|
+
this.stylingContainer.prepend(sheet);
|
|
51
|
+
};
|
|
6
52
|
}
|
|
7
53
|
validityChanged() {
|
|
8
54
|
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
@@ -10,39 +56,119 @@ export class PasswordInput {
|
|
|
10
56
|
this.valueHandler({ name: this.name, value: this.value });
|
|
11
57
|
}
|
|
12
58
|
}
|
|
13
|
-
|
|
14
|
-
this.
|
|
59
|
+
valueChanged() {
|
|
60
|
+
if (!this.isDuplicateInput) {
|
|
61
|
+
// recalculate complexity immediately in order to send the correct validity to the duplicate
|
|
62
|
+
this.calculateComplexity(this.value);
|
|
63
|
+
this.sendOriginalValidityState.emit({ name: this.name, valid: this.setValidity() });
|
|
64
|
+
}
|
|
15
65
|
}
|
|
16
66
|
emitValueHandler(newValue) {
|
|
17
67
|
if (newValue == true && this.isValid) {
|
|
18
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
68
|
+
this.valueHandler({ name: this.name, value: this.value, type: 'duplicate' });
|
|
19
69
|
}
|
|
20
70
|
}
|
|
71
|
+
validityStateHandler(inputStateEvent) {
|
|
72
|
+
this.sendValidityState.emit(inputStateEvent);
|
|
73
|
+
}
|
|
21
74
|
valueHandler(inputValueEvent) {
|
|
22
75
|
this.sendInputValue.emit(inputValueEvent);
|
|
23
76
|
}
|
|
24
|
-
|
|
25
|
-
|
|
77
|
+
originalValidityChangedHandler(event) {
|
|
78
|
+
if (this.isDuplicateInput) {
|
|
79
|
+
if (event.detail.valid) {
|
|
80
|
+
this.originalValid = true;
|
|
81
|
+
this.isValid = this.setValidity();
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
this.originalValid = false;
|
|
85
|
+
this.isValid = false;
|
|
86
|
+
// only show error if the user has touched the input, in order to not show errors on empty inputs
|
|
87
|
+
this.value !== '' && (this.errorMessage = this.setErrorMessage());
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
valueChangedHandler(event) {
|
|
92
|
+
if (this.isDuplicateInput && this.name === event.detail.name + 'Duplicate') {
|
|
93
|
+
this.duplicateInputValue = event.detail.value;
|
|
94
|
+
if (this.touched) {
|
|
95
|
+
this.isValid = this.setValidity();
|
|
96
|
+
this.errorMessage = this.setErrorMessage();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (this.name === event.detail.name + 'Duplicate'
|
|
100
|
+
&& this.name.replace('Duplicate', '') === event.detail.name
|
|
101
|
+
&& this.touched === true) {
|
|
102
|
+
this.isValid = this.setValidity();
|
|
103
|
+
this.errorMessage = this.setErrorMessage();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
handleClickOutside(event) {
|
|
107
|
+
if (event.composedPath()[0] === this.tooltipIconReference)
|
|
108
|
+
return;
|
|
109
|
+
if (event.composedPath()[0] !== this.tooltipReference)
|
|
110
|
+
this.showTooltip = false;
|
|
111
|
+
}
|
|
112
|
+
componentDidRender() {
|
|
113
|
+
// start custom styling area
|
|
114
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
115
|
+
if (this.clientStyling)
|
|
116
|
+
this.setClientStyling();
|
|
117
|
+
this.limitStylingAppends = true;
|
|
118
|
+
}
|
|
119
|
+
// end custom styling area
|
|
26
120
|
}
|
|
27
|
-
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
121
|
+
componentDidLoad() {
|
|
122
|
+
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
123
|
+
this.passwordButton = this.element.shadowRoot.querySelector('vaadin-password-field-button');
|
|
124
|
+
this.passwordButton.tabIndex = -1;
|
|
125
|
+
if (this.defaultValue) {
|
|
126
|
+
this.value = this.defaultValue;
|
|
127
|
+
this.calculateComplexity(this.value);
|
|
128
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
129
|
+
if (this.isDuplicateInput) {
|
|
130
|
+
this.duplicateInputValue = this.defaultValue;
|
|
131
|
+
this.touched = true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
30
134
|
this.isValid = this.setValidity();
|
|
31
|
-
|
|
32
|
-
|
|
135
|
+
}
|
|
136
|
+
calculateComplexity(password) {
|
|
137
|
+
this.passwordComplexity = this.validation.custom
|
|
138
|
+
.filter(rule => rule.rule === 'regex')
|
|
139
|
+
.map(rule => {
|
|
140
|
+
const ruleRegex = new RegExp(rule.pattern);
|
|
141
|
+
const passed = ruleRegex.test(password);
|
|
142
|
+
return { rule: rule.displayName, ruleKey: rule.errorKey, passed };
|
|
143
|
+
});
|
|
33
144
|
}
|
|
34
145
|
setValidity() {
|
|
35
|
-
|
|
146
|
+
var _a, _b;
|
|
147
|
+
if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
else if (!((_a = this.passwordComplexity) === null || _a === void 0 ? void 0 : _a.every(complexity => complexity.passed))) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
return (_b = this.inputReference) === null || _b === void 0 ? void 0 : _b.validity.valid;
|
|
155
|
+
}
|
|
36
156
|
}
|
|
37
157
|
setPattern() {
|
|
38
|
-
var _a;
|
|
158
|
+
var _a, _b;
|
|
39
159
|
if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
40
|
-
return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
|
|
160
|
+
return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
|
|
41
161
|
}
|
|
42
162
|
}
|
|
43
163
|
setErrorMessage() {
|
|
164
|
+
var _a, _b, _c, _d;
|
|
165
|
+
if (this.isDuplicateInput && !this.originalValid) {
|
|
166
|
+
return translate('invalidOriginalPasswordError', this.language);
|
|
167
|
+
}
|
|
44
168
|
if (this.inputReference.validity.patternMismatch) {
|
|
45
|
-
|
|
169
|
+
const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
|
|
170
|
+
const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
|
|
171
|
+
return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
|
|
46
172
|
}
|
|
47
173
|
if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
|
|
48
174
|
return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
@@ -50,13 +176,51 @@ export class PasswordInput {
|
|
|
50
176
|
if (this.inputReference.validity.valueMissing) {
|
|
51
177
|
return translate('requiredError', this.language);
|
|
52
178
|
}
|
|
179
|
+
if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
|
|
180
|
+
const errorCode = (_c = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _c === void 0 ? void 0 : _c.errorKey;
|
|
181
|
+
const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
|
|
182
|
+
return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
renderTooltip() {
|
|
186
|
+
if (this.showTooltip) {
|
|
187
|
+
return (h("div", { class: `password__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
188
|
+
}
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
renderComplexityPopup() {
|
|
192
|
+
const totalRules = this.passwordComplexity.length;
|
|
193
|
+
const passedRules = this.passwordComplexity.filter(complexity => complexity.passed).length;
|
|
194
|
+
const meterValue = passedRules / totalRules;
|
|
195
|
+
const allRulesPassed = this.passwordComplexity.every(complexity => complexity.passed);
|
|
196
|
+
return (h("div", { class: `password__complexity ${!this.showPopup ? 'password__complexity--hidden' : ''}` },
|
|
197
|
+
h("div", { class: 'password__complexity--strength' },
|
|
198
|
+
h("p", { class: 'password__complexity--text' },
|
|
199
|
+
translate('passwordStrength', this.language),
|
|
200
|
+
"\u00A0",
|
|
201
|
+
h("span", { class: 'password__complexity--text-bold' }, translate(`${allRulesPassed ? 'passwordStrengthStrong' : 'passwordStrengthWeak'}`, this.language))),
|
|
202
|
+
h("meter", { value: meterValue, min: "0", max: "1" })),
|
|
203
|
+
h("div", null, this.passwordComplexity.map((complexity, index) => {
|
|
204
|
+
return (h("div", { key: index },
|
|
205
|
+
h("input", { class: 'password__complexity--checkbox', type: "checkbox", checked: complexity.passed, disabled: true }),
|
|
206
|
+
h("span", null, translate(`${complexity.ruleKey}`, this.language) ? translate(`${complexity.ruleKey}`, this.language) : complexity.rule)));
|
|
207
|
+
}))));
|
|
53
208
|
}
|
|
54
209
|
render() {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
210
|
+
let invalidClass = '';
|
|
211
|
+
if (this.touched) {
|
|
212
|
+
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
213
|
+
}
|
|
214
|
+
return h("div", { class: `password__wrapper ${this.autofilled ? 'password__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el },
|
|
215
|
+
h("div", { class: 'password__wrapper--flex' },
|
|
216
|
+
h("label", { class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName),
|
|
217
|
+
h("div", { class: 'password__wrapper--relative' },
|
|
218
|
+
this.tooltip &&
|
|
219
|
+
h("img", { class: 'password__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }),
|
|
220
|
+
this.renderTooltip())),
|
|
221
|
+
h("vaadin-password-field", { type: "password", id: `${this.name}__input`, class: `password__input ${invalidClass}`, name: this.name, readOnly: this.autofilled, value: this.defaultValue, required: this.validation.mandatory, maxlength: this.validation.maxLength, minlength: this.validation.minLength, pattern: this.validationPattern, placeholder: `${this.placeholder}`, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: this.handleFocus }),
|
|
222
|
+
h("small", { class: 'password__error-message' }, this.errorMessage),
|
|
223
|
+
this.passwordComplexity && this.showPopup && !this.isDuplicateInput && this.renderComplexityPopup());
|
|
60
224
|
}
|
|
61
225
|
static get is() { return "password-input"; }
|
|
62
226
|
static get encapsulation() { return "shadow"; }
|
|
@@ -82,7 +246,7 @@ export class PasswordInput {
|
|
|
82
246
|
"text": "Name of the input."
|
|
83
247
|
},
|
|
84
248
|
"attribute": "name",
|
|
85
|
-
"reflect":
|
|
249
|
+
"reflect": true
|
|
86
250
|
},
|
|
87
251
|
"displayName": {
|
|
88
252
|
"type": "string",
|
|
@@ -99,7 +263,76 @@ export class PasswordInput {
|
|
|
99
263
|
"text": "Name of input to be shown to the user."
|
|
100
264
|
},
|
|
101
265
|
"attribute": "display-name",
|
|
102
|
-
"reflect":
|
|
266
|
+
"reflect": true
|
|
267
|
+
},
|
|
268
|
+
"placeholder": {
|
|
269
|
+
"type": "string",
|
|
270
|
+
"mutable": false,
|
|
271
|
+
"complexType": {
|
|
272
|
+
"original": "string",
|
|
273
|
+
"resolved": "string",
|
|
274
|
+
"references": {}
|
|
275
|
+
},
|
|
276
|
+
"required": false,
|
|
277
|
+
"optional": false,
|
|
278
|
+
"docs": {
|
|
279
|
+
"tags": [],
|
|
280
|
+
"text": "Placeholder text to be shown."
|
|
281
|
+
},
|
|
282
|
+
"attribute": "placeholder",
|
|
283
|
+
"reflect": true
|
|
284
|
+
},
|
|
285
|
+
"defaultValue": {
|
|
286
|
+
"type": "string",
|
|
287
|
+
"mutable": false,
|
|
288
|
+
"complexType": {
|
|
289
|
+
"original": "string",
|
|
290
|
+
"resolved": "string",
|
|
291
|
+
"references": {}
|
|
292
|
+
},
|
|
293
|
+
"required": false,
|
|
294
|
+
"optional": false,
|
|
295
|
+
"docs": {
|
|
296
|
+
"tags": [],
|
|
297
|
+
"text": "Default value for the input."
|
|
298
|
+
},
|
|
299
|
+
"attribute": "default-value",
|
|
300
|
+
"reflect": true,
|
|
301
|
+
"defaultValue": "''"
|
|
302
|
+
},
|
|
303
|
+
"autofilled": {
|
|
304
|
+
"type": "boolean",
|
|
305
|
+
"mutable": false,
|
|
306
|
+
"complexType": {
|
|
307
|
+
"original": "boolean",
|
|
308
|
+
"resolved": "boolean",
|
|
309
|
+
"references": {}
|
|
310
|
+
},
|
|
311
|
+
"required": false,
|
|
312
|
+
"optional": false,
|
|
313
|
+
"docs": {
|
|
314
|
+
"tags": [],
|
|
315
|
+
"text": "Boolean. Determines if input should be readonly."
|
|
316
|
+
},
|
|
317
|
+
"attribute": "autofilled",
|
|
318
|
+
"reflect": true
|
|
319
|
+
},
|
|
320
|
+
"tooltip": {
|
|
321
|
+
"type": "string",
|
|
322
|
+
"mutable": false,
|
|
323
|
+
"complexType": {
|
|
324
|
+
"original": "string",
|
|
325
|
+
"resolved": "string",
|
|
326
|
+
"references": {}
|
|
327
|
+
},
|
|
328
|
+
"required": false,
|
|
329
|
+
"optional": false,
|
|
330
|
+
"docs": {
|
|
331
|
+
"tags": [],
|
|
332
|
+
"text": "Tooltip text."
|
|
333
|
+
},
|
|
334
|
+
"attribute": "tooltip",
|
|
335
|
+
"reflect": true
|
|
103
336
|
},
|
|
104
337
|
"validation": {
|
|
105
338
|
"type": "unknown",
|
|
@@ -136,7 +369,7 @@ export class PasswordInput {
|
|
|
136
369
|
"text": "Currently selected language."
|
|
137
370
|
},
|
|
138
371
|
"attribute": "language",
|
|
139
|
-
"reflect":
|
|
372
|
+
"reflect": true
|
|
140
373
|
},
|
|
141
374
|
"emitValue": {
|
|
142
375
|
"type": "boolean",
|
|
@@ -153,14 +386,74 @@ export class PasswordInput {
|
|
|
153
386
|
"text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
|
|
154
387
|
},
|
|
155
388
|
"attribute": "emit-value",
|
|
156
|
-
"reflect":
|
|
389
|
+
"reflect": true
|
|
390
|
+
},
|
|
391
|
+
"isDuplicateInput": {
|
|
392
|
+
"type": "boolean",
|
|
393
|
+
"mutable": false,
|
|
394
|
+
"complexType": {
|
|
395
|
+
"original": "boolean",
|
|
396
|
+
"resolved": "boolean",
|
|
397
|
+
"references": {}
|
|
398
|
+
},
|
|
399
|
+
"required": false,
|
|
400
|
+
"optional": false,
|
|
401
|
+
"docs": {
|
|
402
|
+
"tags": [],
|
|
403
|
+
"text": "Flag for duplicate inputs, it sets up the input for certain validation rules."
|
|
404
|
+
},
|
|
405
|
+
"attribute": "is-duplicate-input",
|
|
406
|
+
"reflect": true
|
|
407
|
+
},
|
|
408
|
+
"clientStyling": {
|
|
409
|
+
"type": "string",
|
|
410
|
+
"mutable": false,
|
|
411
|
+
"complexType": {
|
|
412
|
+
"original": "string",
|
|
413
|
+
"resolved": "string",
|
|
414
|
+
"references": {}
|
|
415
|
+
},
|
|
416
|
+
"required": false,
|
|
417
|
+
"optional": false,
|
|
418
|
+
"docs": {
|
|
419
|
+
"tags": [],
|
|
420
|
+
"text": "Client custom styling via inline style"
|
|
421
|
+
},
|
|
422
|
+
"attribute": "client-styling",
|
|
423
|
+
"reflect": true,
|
|
424
|
+
"defaultValue": "''"
|
|
157
425
|
}
|
|
158
426
|
}; }
|
|
159
427
|
static get states() { return {
|
|
160
428
|
"isValid": {},
|
|
161
|
-
"errorMessage": {}
|
|
429
|
+
"errorMessage": {},
|
|
430
|
+
"limitStylingAppends": {},
|
|
431
|
+
"showTooltip": {},
|
|
432
|
+
"passwordComplexity": {},
|
|
433
|
+
"showPopup": {},
|
|
434
|
+
"value": {}
|
|
162
435
|
}; }
|
|
163
436
|
static get events() { return [{
|
|
437
|
+
"method": "sendOriginalValidityState",
|
|
438
|
+
"name": "sendOriginalValidityState",
|
|
439
|
+
"bubbles": true,
|
|
440
|
+
"cancelable": true,
|
|
441
|
+
"composed": true,
|
|
442
|
+
"docs": {
|
|
443
|
+
"tags": [],
|
|
444
|
+
"text": ""
|
|
445
|
+
},
|
|
446
|
+
"complexType": {
|
|
447
|
+
"original": "InputStateEvent",
|
|
448
|
+
"resolved": "InputStateEvent",
|
|
449
|
+
"references": {
|
|
450
|
+
"InputStateEvent": {
|
|
451
|
+
"location": "import",
|
|
452
|
+
"path": "../../utils/types"
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}, {
|
|
164
457
|
"method": "sendValidityState",
|
|
165
458
|
"name": "sendValidityState",
|
|
166
459
|
"bubbles": true,
|
|
@@ -201,11 +494,34 @@ export class PasswordInput {
|
|
|
201
494
|
}
|
|
202
495
|
}
|
|
203
496
|
}]; }
|
|
497
|
+
static get elementRef() { return "element"; }
|
|
204
498
|
static get watchers() { return [{
|
|
205
499
|
"propName": "isValid",
|
|
206
500
|
"methodName": "validityChanged"
|
|
501
|
+
}, {
|
|
502
|
+
"propName": "value",
|
|
503
|
+
"methodName": "valueChanged"
|
|
207
504
|
}, {
|
|
208
505
|
"propName": "emitValue",
|
|
209
506
|
"methodName": "emitValueHandler"
|
|
210
507
|
}]; }
|
|
508
|
+
static get listeners() { return [{
|
|
509
|
+
"name": "sendOriginalValidityState",
|
|
510
|
+
"method": "originalValidityChangedHandler",
|
|
511
|
+
"target": "body",
|
|
512
|
+
"capture": false,
|
|
513
|
+
"passive": false
|
|
514
|
+
}, {
|
|
515
|
+
"name": "sendInputValue",
|
|
516
|
+
"method": "valueChangedHandler",
|
|
517
|
+
"target": "body",
|
|
518
|
+
"capture": false,
|
|
519
|
+
"passive": false
|
|
520
|
+
}, {
|
|
521
|
+
"name": "click",
|
|
522
|
+
"method": "handleClickOutside",
|
|
523
|
+
"target": "document",
|
|
524
|
+
"capture": false,
|
|
525
|
+
"passive": false
|
|
526
|
+
}]; }
|
|
211
527
|
}
|
|
@@ -18,5 +18,26 @@
|
|
|
18
18
|
position: absolute;
|
|
19
19
|
top: calc(100% + 5px);
|
|
20
20
|
left: 0;
|
|
21
|
-
color:
|
|
21
|
+
color: #cc0000b3;
|
|
22
|
+
}
|
|
23
|
+
.radio__tooltip-icon {
|
|
24
|
+
position: absolute;
|
|
25
|
+
right: 0;
|
|
26
|
+
bottom: 10px;
|
|
27
|
+
}
|
|
28
|
+
.radio__tooltip {
|
|
29
|
+
position: absolute;
|
|
30
|
+
bottom: 35px;
|
|
31
|
+
right: 10px;
|
|
32
|
+
background-color: #FFFFFF;
|
|
33
|
+
border: 1px solid #B0B0B0;
|
|
34
|
+
color: #2B2D3F;
|
|
35
|
+
padding: 10px;
|
|
36
|
+
border-radius: 5px;
|
|
37
|
+
opacity: 0;
|
|
38
|
+
transition: opacity 0.3s ease-in-out;
|
|
39
|
+
z-index: 10;
|
|
40
|
+
}
|
|
41
|
+
.radio__tooltip.visible {
|
|
42
|
+
opacity: 1;
|
|
22
43
|
}
|