@vaadin/password-field
Advanced tools
Comparing version
{ | ||
"name": "@vaadin/password-field", | ||
"version": "24.8.0-alpha9", | ||
"version": "25.0.0-alpha1", | ||
"publishConfig": { | ||
@@ -24,2 +24,4 @@ "access": "public" | ||
"src", | ||
"!src/*-base-styles.d.ts", | ||
"!src/*-base-styles.js", | ||
"theme", | ||
@@ -39,16 +41,14 @@ "vaadin-*.d.ts", | ||
"@open-wc/dedupe-mixin": "^1.3.0", | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/a11y-base": "24.8.0-alpha9", | ||
"@vaadin/button": "24.8.0-alpha9", | ||
"@vaadin/component-base": "24.8.0-alpha9", | ||
"@vaadin/field-base": "24.8.0-alpha9", | ||
"@vaadin/text-field": "24.8.0-alpha9", | ||
"@vaadin/vaadin-lumo-styles": "24.8.0-alpha9", | ||
"@vaadin/vaadin-material-styles": "24.8.0-alpha9", | ||
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha9", | ||
"@vaadin/a11y-base": "25.0.0-alpha1", | ||
"@vaadin/button": "25.0.0-alpha1", | ||
"@vaadin/component-base": "25.0.0-alpha1", | ||
"@vaadin/field-base": "25.0.0-alpha1", | ||
"@vaadin/text-field": "25.0.0-alpha1", | ||
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha1", | ||
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha1", | ||
"lit": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@vaadin/chai-plugins": "24.8.0-alpha9", | ||
"@vaadin/test-runner-commands": "24.8.0-alpha9", | ||
"@vaadin/chai-plugins": "25.0.0-alpha1", | ||
"@vaadin/test-runner-commands": "25.0.0-alpha1", | ||
"@vaadin/testing-helpers": "^1.1.0", | ||
@@ -61,3 +61,3 @@ "sinon": "^18.0.0" | ||
], | ||
"gitHead": "4de3809275ddfd733b0d13fd02af8faf73eb6770" | ||
"gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49" | ||
} |
@@ -27,25 +27,2 @@ # @vaadin/password-field | ||
## Themes | ||
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material. | ||
The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/password-field/vaadin-password-field.js) of the package uses Lumo theme. | ||
To use the Material theme, import the component from the `theme/material` folder: | ||
```js | ||
import '@vaadin/password-field/theme/material/vaadin-password-field.js'; | ||
``` | ||
You can also import the Lumo version of the component explicitly: | ||
```js | ||
import '@vaadin/password-field/theme/lumo/vaadin-password-field.js'; | ||
``` | ||
Finally, you can import the un-themed component from the `src` folder to get a minimal starting point: | ||
```js | ||
import '@vaadin/password-field/src/vaadin-password-field.js'; | ||
``` | ||
## Contributing | ||
@@ -52,0 +29,0 @@ |
@@ -6,11 +6,10 @@ /** | ||
*/ | ||
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js'; | ||
import { buttonStyles } from '@vaadin/button/src/vaadin-button-base.js'; | ||
import { html, LitElement } from 'lit'; | ||
import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js'; | ||
import { defineCustomElement } from '@vaadin/component-base/src/define.js'; | ||
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js'; | ||
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js'; | ||
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
import { passwordFieldButton } from './vaadin-password-field-button-core-styles.js'; | ||
registerStyles('vaadin-password-field-button', buttonStyles, { moduleId: 'vaadin-password-field-button-styles' }); | ||
/** | ||
@@ -26,3 +25,3 @@ * An element used internally by `<vaadin-password-field>`. Not intended to be used separately. | ||
*/ | ||
class PasswordFieldButton extends ButtonMixin(DirMixin(ThemableMixin(PolymerElement))) { | ||
class PasswordFieldButton extends ButtonMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) { | ||
static get is() { | ||
@@ -32,3 +31,8 @@ return 'vaadin-password-field-button'; | ||
static get template() { | ||
static get styles() { | ||
return passwordFieldButton; | ||
} | ||
/** @protected */ | ||
render() { | ||
return html``; | ||
@@ -35,0 +39,0 @@ } |
@@ -71,2 +71,8 @@ /** | ||
/** @override */ | ||
static get delegateAttrs() { | ||
// Do not delegate autocapitalize as it should be always set to "off" | ||
return super.delegateAttrs.filter((attr) => attr !== 'autocapitalize'); | ||
} | ||
constructor() { | ||
@@ -73,0 +79,0 @@ super(); |
@@ -7,15 +7,8 @@ /** | ||
import './vaadin-password-field-button.js'; | ||
import { html } from '@polymer/polymer/lib/utils/html-tag.js'; | ||
import { html } from 'lit'; | ||
import { defineCustomElement } from '@vaadin/component-base/src/define.js'; | ||
import { TextField } from '@vaadin/text-field/src/vaadin-text-field.js'; | ||
import { passwordFieldStyles } from './vaadin-password-field-core-styles.js'; | ||
import { PasswordFieldMixin } from './vaadin-password-field-mixin.js'; | ||
const ownTemplate = html` | ||
<div part="reveal-button" slot="suffix"> | ||
<slot name="reveal"></slot> | ||
</div> | ||
`; | ||
let memoizedTemplate; | ||
/** | ||
@@ -62,16 +55,17 @@ * `<vaadin-password-field>` is an extension of `<vaadin-text-field>` component for entering passwords. | ||
static get template() { | ||
if (!memoizedTemplate) { | ||
// Clone the superclass template | ||
memoizedTemplate = super.template.cloneNode(true); | ||
static get styles() { | ||
return [...super.styles, passwordFieldStyles]; | ||
} | ||
// Retrieve this element's dom-module template | ||
const revealButton = ownTemplate.content.querySelector('[part="reveal-button"]'); | ||
// Append reveal-button and styles to the text-field template | ||
const inputField = memoizedTemplate.content.querySelector('[part="input-field"]'); | ||
inputField.appendChild(revealButton); | ||
} | ||
return memoizedTemplate; | ||
/** | ||
* @protected | ||
* @override | ||
*/ | ||
_renderSuffix() { | ||
return html` | ||
${super._renderSuffix()} | ||
<div part="reveal-button" slot="suffix"> | ||
<slot name="reveal"></slot> | ||
</div> | ||
`; | ||
} | ||
@@ -78,0 +72,0 @@ } |
{ | ||
"$schema": "https://json.schemastore.org/web-types", | ||
"name": "@vaadin/password-field", | ||
"version": "24.8.0-alpha9", | ||
"version": "25.0.0-alpha1", | ||
"description-markup": "markdown", | ||
@@ -11,3 +11,3 @@ "contributions": { | ||
"name": "vaadin-password-field", | ||
"description": "`<vaadin-password-field>` is an extension of `<vaadin-text-field>` component for entering passwords.\n\n```html\n<vaadin-password-field label=\"Password\"></vaadin-password-field>\n```\n\n### Styling\n\n`<vaadin-password-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------------------------------------------\n`reveal-button` | The eye icon which toggles the password visibility\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n-------------------|---------------------------------\n`password-visible` | Set when the password is visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.", | ||
"description": "`<vaadin-password-field>` is an extension of `<vaadin-text-field>` component for entering passwords.\n\n```html\n<vaadin-password-field label=\"Password\"></vaadin-password-field>\n```\n\n### Styling\n\n`<vaadin-password-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------------------------------------------\n`reveal-button` | The eye icon which toggles the password visibility\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n-------------------|---------------------------------\n`password-visible` | Set when the password is visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.", | ||
"attributes": [ | ||
@@ -14,0 +14,0 @@ { |
{ | ||
"$schema": "https://json.schemastore.org/web-types", | ||
"name": "@vaadin/password-field", | ||
"version": "24.8.0-alpha9", | ||
"version": "25.0.0-alpha1", | ||
"description-markup": "markdown", | ||
@@ -19,3 +19,3 @@ "framework": "lit", | ||
"name": "vaadin-password-field", | ||
"description": "`<vaadin-password-field>` is an extension of `<vaadin-text-field>` component for entering passwords.\n\n```html\n<vaadin-password-field label=\"Password\"></vaadin-password-field>\n```\n\n### Styling\n\n`<vaadin-password-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------------------------------------------\n`reveal-button` | The eye icon which toggles the password visibility\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n-------------------|---------------------------------\n`password-visible` | Set when the password is visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.", | ||
"description": "`<vaadin-password-field>` is an extension of `<vaadin-text-field>` component for entering passwords.\n\n```html\n<vaadin-password-field label=\"Password\"></vaadin-password-field>\n```\n\n### Styling\n\n`<vaadin-password-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------------------------------------------\n`reveal-button` | The eye icon which toggles the password visibility\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n-------------------|---------------------------------\n`password-visible` | Set when the password is visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.", | ||
"extension": true, | ||
@@ -22,0 +22,0 @@ "attributes": [ |
9
-18.18%69879
-7.4%24
-27.27%1504
-7.27%37
-38.33%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated