You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@vaadin/tooltip

Package Overview
Dependencies
Maintainers
13
Versions
367
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vaadin/tooltip - npm Package Compare versions

Comparing version

to
25.0.0-alpha8

20

package.json
{
"name": "@vaadin/tooltip",
"version": "25.0.0-alpha7",
"version": "25.0.0-alpha8",
"publishConfig": {

@@ -40,13 +40,13 @@ "access": "public"

"@open-wc/dedupe-mixin": "^1.3.0",
"@vaadin/a11y-base": "25.0.0-alpha7",
"@vaadin/component-base": "25.0.0-alpha7",
"@vaadin/overlay": "25.0.0-alpha7",
"@vaadin/popover": "25.0.0-alpha7",
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha7",
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha7",
"@vaadin/a11y-base": "25.0.0-alpha8",
"@vaadin/component-base": "25.0.0-alpha8",
"@vaadin/overlay": "25.0.0-alpha8",
"@vaadin/popover": "25.0.0-alpha8",
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha8",
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha8",
"lit": "^3.0.0"
},
"devDependencies": {
"@vaadin/chai-plugins": "25.0.0-alpha7",
"@vaadin/test-runner-commands": "25.0.0-alpha7",
"@vaadin/chai-plugins": "25.0.0-alpha8",
"@vaadin/test-runner-commands": "25.0.0-alpha8",
"@vaadin/testing-helpers": "^2.0.0",

@@ -59,3 +59,3 @@ "sinon": "^18.0.0"

],
"gitHead": "87f72707ce6866892f8be5782fa0da008e87dcbc"
"gitHead": "ebf53673d5f639d2b1b6f2b31f640f530643ee2f"
}

@@ -10,48 +10,50 @@ /**

export const tooltipOverlayStyles = css`
@layer base {
[part='overlay'] {
max-width: var(--vaadin-tooltip-max-width, 40ch);
padding: var(--vaadin-tooltip-padding, var(--vaadin-padding-container));
border-radius: var(--vaadin-tooltip-border-radius, var(--vaadin-radius-m));
background: var(--vaadin-tooltip-background, var(--vaadin-background-color));
color: var(--vaadin-tooltip-color, inherit);
font-size: var(--vaadin-tooltip-font-size, 0.9em);
font-weight: var(--vaadin-tooltip-font-weight, inherit);
line-height: var(--vaadin-tooltip-line-height, inherit);
border: 0;
box-shadow:
0 0 0 var(--vaadin-tooltip-border-width, 1px) var(--vaadin-tooltip-border-color, var(--vaadin-border-color)),
var(--vaadin-tooltip-box-shadow, 0 3px 8px -1px rgba(0, 0, 0, 0.2));
}
:host {
--_vaadin-tooltip-default-offset: 4px;
}
[part='content'] {
white-space: pre-wrap;
}
[part='overlay'] {
max-width: var(--vaadin-tooltip-max-width, 40ch);
padding: var(--vaadin-tooltip-padding, var(--vaadin-padding-container));
border-radius: var(--vaadin-tooltip-border-radius, var(--vaadin-radius-m));
background: var(--vaadin-tooltip-background, var(--vaadin-background-color));
color: var(--vaadin-tooltip-color, inherit);
font-size: var(--vaadin-tooltip-font-size, 0.9em);
font-weight: var(--vaadin-tooltip-font-weight, inherit);
line-height: var(--vaadin-tooltip-line-height, inherit);
border: 0;
box-shadow:
0 0 0 var(--vaadin-tooltip-border-width, 1px) var(--vaadin-tooltip-border-color, var(--vaadin-border-color)),
var(--vaadin-tooltip-box-shadow, 0 3px 8px -1px rgba(0, 0, 0, 0.2));
}
:host([position^='top'][top-aligned]) [part='overlay'],
:host([position^='bottom'][top-aligned]) [part='overlay'] {
margin-top: var(--vaadin-tooltip-offset-top, 0.25rem);
}
[part='content'] {
white-space: pre-wrap;
}
:host([position^='top'][bottom-aligned]) [part='overlay'],
:host([position^='bottom'][bottom-aligned]) [part='overlay'] {
margin-bottom: var(--vaadin-tooltip-offset-bottom, 0.25rem);
}
:host([position^='top'][top-aligned]) [part='overlay'],
:host([position^='bottom'][top-aligned]) [part='overlay'] {
margin-top: var(--vaadin-tooltip-offset-top, var(--_vaadin-tooltip-default-offset));
}
:host([position^='start'][start-aligned]) [part='overlay'],
:host([position^='end'][start-aligned]) [part='overlay'] {
margin-inline-start: var(--vaadin-tooltip-offset-start, 0.25rem);
}
:host([position^='top'][bottom-aligned]) [part='overlay'],
:host([position^='bottom'][bottom-aligned]) [part='overlay'] {
margin-bottom: var(--vaadin-tooltip-offset-bottom, var(--_vaadin-tooltip-default-offset));
}
:host([position^='start'][end-aligned]) [part='overlay'],
:host([position^='end'][end-aligned]) [part='overlay'] {
margin-inline-end: var(--vaadin-tooltip-offset-end, 0.25rem);
}
:host([position^='start'][start-aligned]) [part='overlay'],
:host([position^='end'][start-aligned]) [part='overlay'] {
margin-inline-start: var(--vaadin-tooltip-offset-start, var(--_vaadin-tooltip-default-offset));
}
@media (forced-colors: active) {
[part='overlay'] {
border: 1px dashed;
}
:host([position^='start'][end-aligned]) [part='overlay'],
:host([position^='end'][end-aligned]) [part='overlay'] {
margin-inline-end: var(--vaadin-tooltip-offset-end, var(--_vaadin-tooltip-default-offset));
}
@media (forced-colors: active) {
[part='overlay'] {
border: 1px dashed;
}
}
`;

@@ -9,2 +9,6 @@ /**

export const tooltipOverlayStyles = css`
:host {
--_vaadin-tooltip-default-offset: 0;
}
[part='overlay'] {

@@ -20,3 +24,3 @@ max-width: 40ch;

:host([position^='bottom'][top-aligned]) [part='overlay'] {
margin-top: var(--vaadin-tooltip-offset-top, 0);
margin-top: var(--vaadin-tooltip-offset-top, var(--_vaadin-tooltip-default-offset));
}

@@ -26,3 +30,3 @@

:host([position^='bottom'][bottom-aligned]) [part='overlay'] {
margin-bottom: var(--vaadin-tooltip-offset-bottom, 0);
margin-bottom: var(--vaadin-tooltip-offset-bottom, var(--_vaadin-tooltip-default-offset));
}

@@ -32,3 +36,3 @@

:host([position^='end'][start-aligned]) [part='overlay'] {
margin-inline-start: var(--vaadin-tooltip-offset-start, 0);
margin-inline-start: var(--vaadin-tooltip-offset-start, var(--_vaadin-tooltip-default-offset));
}

@@ -38,3 +42,3 @@

:host([position^='end'][end-aligned]) [part='overlay'] {
margin-inline-end: var(--vaadin-tooltip-offset-end, 0);
margin-inline-end: var(--vaadin-tooltip-offset-end, var(--_vaadin-tooltip-default-offset));
}

@@ -41,0 +45,0 @@

@@ -333,3 +333,2 @@ /**

type: String,
observer: '__textChanged',
},

@@ -370,22 +369,5 @@

},
/** @private */
_srLabel: {
type: Object,
},
/** @private */
_overlayContent: {
type: String,
},
};
}
static get observers() {
return [
'__generatorChanged(_overlayElement, generator, context)',
'__updateSrLabelText(_srLabel, _overlayContent)',
];
}
/**

@@ -425,3 +407,2 @@ * Sets the default focus delay to be used by all tooltip instances,

this._uniqueId = `vaadin-tooltip-${generateUniqueId()}`;
this._renderer = this.__tooltipRenderer.bind(this);

@@ -473,15 +454,20 @@ this.__onFocusin = this.__onFocusin.bind(this);

this._srLabelController = new SlotController(this, 'sr-label', 'div', {
this.__contentController = new SlotController(this, 'overlay', 'div', {
initializer: (element) => {
element.id = this._uniqueId;
element.setAttribute('role', 'tooltip');
this._srLabel = element;
this.__contentNode = element;
},
});
this.addController(this._srLabelController);
this.addController(this.__contentController);
}
/** @private */
__computeOpened(manual, opened, autoOpened, connected) {
return connected && (manual ? opened : autoOpened);
/** @protected */
updated(props) {
super.updated(props);
if (props.has('text') || props.has('generator') || props.has('context')) {
this.__updateContent();
this.$.overlay.toggleAttribute('hidden', this.__contentNode.textContent.trim() === '');
}
}

@@ -695,17 +681,7 @@

/** @private */
__textChanged(text, oldText) {
if (this._overlayElement && (text || oldText)) {
this._overlayElement.requestContentUpdate();
}
__updateContent() {
this.__contentNode.textContent = typeof this.generator === 'function' ? this.generator(this.context) : this.text;
}
/** @private */
__tooltipRenderer(root) {
root.textContent = typeof this.generator === 'function' ? this.generator(this.context) : this.text;
// Update the sr-only label text content
this._overlayContent = root.textContent;
}
/** @private */
__computeAriaTarget(ariaTarget, target) {

@@ -731,21 +707,2 @@ const isElementNode = (el) => el && el.nodeType === Node.ELEMENT_NODE;

}
/** @private */
__generatorChanged(overlayElement, generator, context) {
if (overlayElement) {
if (generator !== this.__oldTextGenerator || context !== this.__oldContext) {
overlayElement.requestContentUpdate();
}
this.__oldTextGenerator = generator;
this.__oldContext = context;
}
}
/** @private */
__updateSrLabelText(srLabel, textContent) {
if (srLabel) {
srLabel.textContent = textContent;
}
}
};

@@ -27,3 +27,3 @@ /**

class TooltipOverlay extends PopoverOverlayMixin(
DirMixin(ThemableMixin(LumoInjectionMixin(PolylitMixin(LitElement)))),
DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
) {

@@ -38,15 +38,5 @@ static get is() {

/**
* Tag name prefix used by custom properties.
* @protected
* @return {string}
*/
get _tagNamePrefix() {
return 'vaadin-tooltip';
}
/** @protected */
render() {
return html`
<div id="backdrop" part="backdrop" hidden></div>
<div part="overlay" id="overlay">

@@ -58,6 +48,16 @@ <div part="content" id="content"><slot></slot></div>

requestContentUpdate() {
super.requestContentUpdate();
/**
* @protected
* @override
*/
_attachOverlay() {
this.showPopover();
}
this.toggleAttribute('hidden', this.textContent.trim() === '');
/**
* @protected
* @override
*/
_detachOverlay() {
this.hidePopover();
}

@@ -64,0 +64,0 @@ }

@@ -22,7 +22,8 @@ /**

*
* `<vaadin-tooltip>` uses `<vaadin-tooltip-overlay>` internal
* themable component as the actual visible overlay.
* The following shadow DOM parts are available for styling:
*
* See [`<vaadin-overlay>`](#/elements/vaadin-overlay) documentation
* for `<vaadin-tooltip-overlay>` parts.
* Part name | Description
* ----------- | ---------------
* `overlay` | The overlay element
* `content` | The overlay content element
*

@@ -29,0 +30,0 @@ * The following state attributes are available for styling:

@@ -25,7 +25,8 @@ /**

*
* `<vaadin-tooltip>` uses `<vaadin-tooltip-overlay>` internal
* themable component as the actual visible overlay.
* The following shadow DOM parts are available for styling:
*
* See [`<vaadin-overlay>`](#/elements/vaadin-overlay) documentation
* for `<vaadin-tooltip-overlay>` parts.
* Part name | Description
* ----------- | ---------------
* `overlay` | The overlay element
* `content` | The overlay content element
*

@@ -68,3 +69,3 @@ * The following state attributes are available for styling:

:host {
display: none;
display: contents;
}

@@ -81,3 +82,3 @@ `;

id="overlay"
.renderer="${this._renderer}"
popover="manual"
.owner="${this}"

@@ -95,5 +96,5 @@ theme="${ifDefined(this._theme)}"

modeless
exportparts="overlay, content"
><slot name="overlay"></slot
></vaadin-tooltip-overlay>
<slot name="sr-label"></slot>
`;

@@ -100,0 +101,0 @@ }

@@ -9,6 +9,3 @@ import '@vaadin/vaadin-lumo-styles/color.js';

:host {
--vaadin-tooltip-offset-top: var(--lumo-space-xs);
--vaadin-tooltip-offset-bottom: var(--lumo-space-xs);
--vaadin-tooltip-offset-start: var(--lumo-space-xs);
--vaadin-tooltip-offset-end: var(--lumo-space-xs);
--_vaadin-tooltip-default-offset: var(--lumo-space-xs);
}

@@ -15,0 +12,0 @@

{
"$schema": "https://json.schemastore.org/web-types",
"name": "@vaadin/tooltip",
"version": "25.0.0-alpha7",
"version": "25.0.0-alpha8",
"description-markup": "markdown",

@@ -11,3 +11,3 @@ "contributions": {

"name": "vaadin-tooltip",
"description": "`<vaadin-tooltip>` is a Web Component for creating tooltips.\n\n```html\n<button id=\"confirm\">Confirm</button>\n<vaadin-tooltip text=\"Click to save changes\" for=\"confirm\"></vaadin-tooltip>\n```\n\n### Styling\n\n`<vaadin-tooltip>` uses `<vaadin-tooltip-overlay>` internal\nthemable component as the actual visible overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha7/#/elements/vaadin-overlay) documentation\nfor `<vaadin-tooltip-overlay>` parts.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`position` | Reflects the `position` property value.\n\nNote: the `theme` attribute value set on `<vaadin-tooltip>` is\npropagated to the internal `<vaadin-tooltip-overlay>` component.\n\n### Custom CSS Properties\n\nThe following custom CSS properties are available on the `<vaadin-tooltip>` element:\n\nCustom CSS property | Description\n---------------------------------|-------------\n`--vaadin-tooltip-offset-top` | Used as an offset when the tooltip is aligned vertically below the target\n`--vaadin-tooltip-offset-bottom` | Used as an offset when the tooltip is aligned vertically above the target\n`--vaadin-tooltip-offset-start` | Used as an offset when the tooltip is aligned horizontally after the target\n`--vaadin-tooltip-offset-end` | Used as an offset when the tooltip is aligned horizontally before the target\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
"description": "`<vaadin-tooltip>` is a Web Component for creating tooltips.\n\n```html\n<button id=\"confirm\">Confirm</button>\n<vaadin-tooltip text=\"Click to save changes\" for=\"confirm\"></vaadin-tooltip>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------- | ---------------\n`overlay` | The overlay element\n`content` | The overlay content element\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`position` | Reflects the `position` property value.\n\nNote: the `theme` attribute value set on `<vaadin-tooltip>` is\npropagated to the internal `<vaadin-tooltip-overlay>` component.\n\n### Custom CSS Properties\n\nThe following custom CSS properties are available on the `<vaadin-tooltip>` element:\n\nCustom CSS property | Description\n---------------------------------|-------------\n`--vaadin-tooltip-offset-top` | Used as an offset when the tooltip is aligned vertically below the target\n`--vaadin-tooltip-offset-bottom` | Used as an offset when the tooltip is aligned vertically above the target\n`--vaadin-tooltip-offset-start` | Used as an offset when the tooltip is aligned horizontally after the target\n`--vaadin-tooltip-offset-end` | Used as an offset when the tooltip is aligned horizontally before the target\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/tooltip",
"version": "25.0.0-alpha7",
"version": "25.0.0-alpha8",
"description-markup": "markdown",

@@ -19,3 +19,3 @@ "framework": "lit",

"name": "vaadin-tooltip",
"description": "`<vaadin-tooltip>` is a Web Component for creating tooltips.\n\n```html\n<button id=\"confirm\">Confirm</button>\n<vaadin-tooltip text=\"Click to save changes\" for=\"confirm\"></vaadin-tooltip>\n```\n\n### Styling\n\n`<vaadin-tooltip>` uses `<vaadin-tooltip-overlay>` internal\nthemable component as the actual visible overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha7/#/elements/vaadin-overlay) documentation\nfor `<vaadin-tooltip-overlay>` parts.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`position` | Reflects the `position` property value.\n\nNote: the `theme` attribute value set on `<vaadin-tooltip>` is\npropagated to the internal `<vaadin-tooltip-overlay>` component.\n\n### Custom CSS Properties\n\nThe following custom CSS properties are available on the `<vaadin-tooltip>` element:\n\nCustom CSS property | Description\n---------------------------------|-------------\n`--vaadin-tooltip-offset-top` | Used as an offset when the tooltip is aligned vertically below the target\n`--vaadin-tooltip-offset-bottom` | Used as an offset when the tooltip is aligned vertically above the target\n`--vaadin-tooltip-offset-start` | Used as an offset when the tooltip is aligned horizontally after the target\n`--vaadin-tooltip-offset-end` | Used as an offset when the tooltip is aligned horizontally before the target\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
"description": "`<vaadin-tooltip>` is a Web Component for creating tooltips.\n\n```html\n<button id=\"confirm\">Confirm</button>\n<vaadin-tooltip text=\"Click to save changes\" for=\"confirm\"></vaadin-tooltip>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------- | ---------------\n`overlay` | The overlay element\n`content` | The overlay content element\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`position` | Reflects the `position` property value.\n\nNote: the `theme` attribute value set on `<vaadin-tooltip>` is\npropagated to the internal `<vaadin-tooltip-overlay>` component.\n\n### Custom CSS Properties\n\nThe following custom CSS properties are available on the `<vaadin-tooltip>` element:\n\nCustom CSS property | Description\n---------------------------------|-------------\n`--vaadin-tooltip-offset-top` | Used as an offset when the tooltip is aligned vertically below the target\n`--vaadin-tooltip-offset-bottom` | Used as an offset when the tooltip is aligned vertically above the target\n`--vaadin-tooltip-offset-start` | Used as an offset when the tooltip is aligned horizontally after the target\n`--vaadin-tooltip-offset-end` | Used as an offset when the tooltip is aligned horizontally before the target\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
"extension": true,

@@ -22,0 +22,0 @@ "attributes": [