@vaadin/password-field 23.0.0-alpha1 → 23.0.0-alpha2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/password-field",
3
- "version": "23.0.0-alpha1",
3
+ "version": "23.0.0-alpha2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,14 +32,15 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@polymer/polymer": "^3.0.0",
35
- "@vaadin/text-field": "23.0.0-alpha1",
36
- "@vaadin/vaadin-lumo-styles": "23.0.0-alpha1",
37
- "@vaadin/vaadin-material-styles": "23.0.0-alpha1"
35
+ "@vaadin/button": "23.0.0-alpha2",
36
+ "@vaadin/text-field": "23.0.0-alpha2",
37
+ "@vaadin/vaadin-lumo-styles": "23.0.0-alpha2",
38
+ "@vaadin/vaadin-material-styles": "23.0.0-alpha2"
38
39
  },
39
40
  "devDependencies": {
40
41
  "@esm-bundle/chai": "^4.3.4",
41
42
  "@vaadin/testing-helpers": "^0.3.2",
42
43
  "sinon": "^9.2.1"
43
44
  },
44
- "gitHead": "fbcb07328fdf88260e3b461088d207426b21c710"
45
+ "gitHead": "070f586dead02ca41b66717820c647f48bf1665f"
45
46
  }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { html } from '@polymer/polymer/polymer-element.js';
7
+ import { Button } from '@vaadin/button/src/vaadin-button.js';
8
+
9
+ /**
10
+ * An element used internally by `<vaadin-password-field>`. Not intended to be used separately.
11
+ *
12
+ * @extends Button
13
+ * @private
14
+ */
15
+ class PasswordFieldButton extends Button {
16
+ static get is() {
17
+ return 'vaadin-password-field-button';
18
+ }
19
+
20
+ static get template() {
21
+ return html`
22
+ <style>
23
+ :host {
24
+ display: block;
25
+ }
26
+
27
+ :host([hidden]) {
28
+ display: none !important;
29
+ }
30
+ </style>
31
+ `;
32
+ }
33
+ }
34
+
35
+ customElements.define(PasswordFieldButton.is, PasswordFieldButton);
@@ -3,6 +3,7 @@
3
3
  * Copyright (c) 2021 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
+ import './vaadin-password-field-button.js';
6
7
  import { html } from '@polymer/polymer/lib/utils/html-tag.js';
7
8
  import { SlotStylesMixin } from '@vaadin/field-base/src/slot-styles-mixin.js';
8
9
  import { TextField } from '@vaadin/text-field/src/vaadin-text-field.js';
@@ -125,8 +126,7 @@ export class PasswordField extends SlotStylesMixin(TextField) {
125
126
  return {
126
127
  ...super.slots,
127
128
  reveal: () => {
128
- const btn = document.createElement('button');
129
- btn.setAttribute('type', 'button');
129
+ const btn = document.createElement('vaadin-password-field-button');
130
130
  btn.disabled = this.disabled;
131
131
  return btn;
132
132
  }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { button } from '@vaadin/button/theme/lumo/vaadin-button-styles.js';
7
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
+
9
+ const passwordFieldButton = css`
10
+ :host {
11
+ position: absolute;
12
+ right: 0;
13
+ top: 0;
14
+ margin: 0;
15
+ padding: 0;
16
+ width: 100%;
17
+ height: 100%;
18
+ min-width: auto;
19
+ background: transparent;
20
+ outline: none;
21
+ }
22
+ `;
23
+
24
+ registerStyles('vaadin-password-field-button', [button, passwordFieldButton], {
25
+ moduleId: 'lumo-password-field-button'
26
+ });
@@ -27,23 +27,6 @@ const passwordField = css`
27
27
  [part='reveal-button'][hidden] {
28
28
  display: none !important;
29
29
  }
30
-
31
- ::slotted([slot='reveal']) {
32
- position: absolute;
33
- top: 0;
34
- bottom: 0;
35
- left: 0;
36
- right: 0;
37
- width: 100%;
38
- background: transparent;
39
- border: none;
40
- }
41
-
42
- ::slotted([slot='reveal']:focus) {
43
- border-radius: var(--lumo-border-radius-s);
44
- box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);
45
- outline: none;
46
- }
47
30
  `;
48
31
 
49
32
  registerStyles('vaadin-password-field', [inputFieldShared, passwordField], { moduleId: 'lumo-password-field' });
@@ -4,5 +4,6 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/text-field/theme/lumo/vaadin-text-field.js';
7
+ import './vaadin-password-field-button-styles.js';
7
8
  import './vaadin-password-field-styles.js';
8
9
  import '../../src/vaadin-password-field.js';
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { button } from '@vaadin/button/theme/material/vaadin-button-styles.js';
7
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
+
9
+ const passwordFieldButton = css`
10
+ :host {
11
+ position: absolute;
12
+ right: 0;
13
+ top: 0;
14
+ margin: 0;
15
+ padding: 0;
16
+ width: 100%;
17
+ height: 100%;
18
+ min-width: auto;
19
+ background: transparent;
20
+ outline: none;
21
+ border-radius: 50%;
22
+ overflow: visible;
23
+ }
24
+
25
+ :host::before {
26
+ transform: scale(1.5);
27
+ }
28
+
29
+ /* Disable ripple */
30
+ :host::after {
31
+ display: none;
32
+ }
33
+ `;
34
+
35
+ registerStyles('vaadin-password-field-button', [button, passwordFieldButton], {
36
+ moduleId: 'material-password-field-button'
37
+ });
@@ -35,53 +35,9 @@ const passwordField = css`
35
35
  display: none !important;
36
36
  }
37
37
 
38
- ::slotted([slot='reveal']) {
39
- position: absolute;
40
- top: 0;
41
- bottom: 0;
42
- left: 0;
43
- right: 0;
44
- width: 100%;
45
- background: transparent;
46
- border: none;
47
- outline: none;
48
- }
49
-
50
- ::slotted([slot='reveal'])::before {
51
- position: absolute;
52
- content: '';
53
- top: 0;
54
- left: 0;
55
- width: 32px;
56
- height: 32px;
57
- border-radius: 50%;
58
- background-color: var(--material-body-text-color);
59
- transform: scale(0);
60
- opacity: 0;
61
- transition: transform 0.08s, opacity 0.01s;
62
- will-change: transform, opacity;
63
- }
64
-
65
38
  :host([focused]) ::slotted([slot='reveal'])::before {
66
39
  background-color: var(--material-primary-text-color);
67
40
  }
68
-
69
- ::slotted([slot='reveal']:hover)::before {
70
- opacity: 0.08;
71
- }
72
-
73
- ::slotted([slot='reveal']:focus)::before {
74
- opacity: 0.12;
75
- }
76
-
77
- ::slotted([slot='reveal']:active)::before {
78
- opacity: 0.16;
79
- }
80
-
81
- ::slotted([slot='reveal']:hover)::before,
82
- ::slotted([slot='reveal']:focus)::before {
83
- transform: scale(1.5);
84
- }
85
41
  `;
86
42
 
87
43
  registerStyles('vaadin-password-field', [inputFieldShared, passwordField], { moduleId: 'material-password-field' });
@@ -4,5 +4,6 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/text-field/theme/material/vaadin-text-field.js';
7
+ import './vaadin-password-field-button-styles.js';
7
8
  import './vaadin-password-field-styles.js';
8
9
  import '../../src/vaadin-password-field.js';