@fluid-topics/ft-tooltip 0.3.5 → 0.3.7
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/build/ft-tooltip.d.ts +1 -0
- package/build/ft-tooltip.js +5 -3
- package/build/ft-tooltip.light.js +18 -17
- package/build/ft-tooltip.min.js +11 -10
- package/package.json +4 -4
package/build/ft-tooltip.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const FtTooltipCssVariables: {
|
|
|
13
13
|
backgroundColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
14
14
|
zIndex: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
15
15
|
borderRadiusS: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
16
|
+
maxWidth: import("@fluid-topics/ft-wc-utils").FtCssVariable;
|
|
16
17
|
};
|
|
17
18
|
export declare type Position = "top" | "bottom" | "left" | "right";
|
|
18
19
|
export declare class FtTooltip extends FtLitElement implements FtTooltipProperties {
|
package/build/ft-tooltip.js
CHANGED
|
@@ -14,6 +14,7 @@ export const FtTooltipCssVariables = {
|
|
|
14
14
|
backgroundColor: FtCssVariableFactory.create("--ft-tooltip-background-color", "COLOR", "#666666"),
|
|
15
15
|
zIndex: FtCssVariableFactory.create("--ft-tooltip-z-index", "NUMBER", "1"),
|
|
16
16
|
borderRadiusS: FtCssVariableFactory.external(designSystemVariables.borderRadiusS, "Design system"),
|
|
17
|
+
maxWidth: FtCssVariableFactory.create("--ft-tooltip-max-width", "SIZE", "150px"),
|
|
17
18
|
};
|
|
18
19
|
export class FtTooltip extends FtLitElement {
|
|
19
20
|
constructor() {
|
|
@@ -38,7 +39,8 @@ export class FtTooltip extends FtLitElement {
|
|
|
38
39
|
@touchstart=${this.onTouch}>
|
|
39
40
|
<div part="tooltip" class="ft-tooltip ft-tooltip--${this.position}" ?hidden=${!this.visible}>
|
|
40
41
|
<div part="tooltip-content" class="ft-tooltip--content">
|
|
41
|
-
<
|
|
42
|
+
<slot name="text"></slot>
|
|
43
|
+
<ft-typography variant="caption" ?hidden=${!this.text}>${this.text}</ft-typography>
|
|
42
44
|
</div>
|
|
43
45
|
</div>
|
|
44
46
|
<slot></slot>
|
|
@@ -132,7 +134,7 @@ export class FtTooltip extends FtLitElement {
|
|
|
132
134
|
const style = this.tooltip.style;
|
|
133
135
|
style.left = left + "px";
|
|
134
136
|
style.top = top + "px";
|
|
135
|
-
style.maxWidth =
|
|
137
|
+
style.maxWidth = `max(${box.width}px, ${FtTooltipCssVariables.maxWidth})`;
|
|
136
138
|
}
|
|
137
139
|
this.revealDebouncer.run(() => {
|
|
138
140
|
if (this.tooltipContent) {
|
|
@@ -185,7 +187,7 @@ FtTooltip.styles = css `
|
|
|
185
187
|
box-sizing: border-box;
|
|
186
188
|
overflow: hidden;
|
|
187
189
|
width: max-content;
|
|
188
|
-
max-width:
|
|
190
|
+
max-width: ${FtTooltipCssVariables.maxWidth};
|
|
189
191
|
text-align: center;
|
|
190
192
|
padding: ${FtTooltipCssVariables.distance};
|
|
191
193
|
z-index: ${FtTooltipCssVariables.zIndex};
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* Copyright 2017 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
6
|
*/
|
|
7
|
-
var s;const n=globalThis.trustedTypes,r=n?n.createPolicy("lit-html",{createHTML:t=>t}):void 0,h=`lit$${(Math.random()+"").slice(9)}$`,l="?"+h,a=`<${l}>`,p=document,f=(t="")=>p.createComment(t),y=t=>null===t||"object"!=typeof t&&"function"!=typeof t,g=Array.isArray,c=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,d=/-->/g,u=/>/g,v=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),$=/'/g,b=/"/g,m=/^(?:script|style|textarea|title)$/i,x=(t=>(i,...o)=>({_$litType$:t,strings:i,values:o}))(1),w=Symbol.for("lit-noChange"),z=Symbol.for("lit-nothing"),k=new WeakMap,A=p.createTreeWalker(p,129,null,!1),N=(t,i)=>{const o=t.length-1,e=[];let s,n=2===i?"<svg>":"",l=c;for(let i=0;i<o;i++){const o=t[i];let r,p,f=-1,y=0;for(;y<o.length&&(l.lastIndex=y,p=l.exec(o),null!==p);)y=l.lastIndex,l===c?"!--"===p[1]?l=d:void 0!==p[1]?l=u:void 0!==p[2]?(m.test(p[2])&&(s=RegExp("</"+p[2],"g")),l=v):void 0!==p[3]&&(l=v):l===v?">"===p[0]?(l=null!=s?s:c,f=-1):void 0===p[1]?f=-2:(f=l.lastIndex-p[2].length,r=p[1],l=void 0===p[3]?v:'"'===p[3]?b:$):l===b||l===$?l=v:l===d||l===u?l=c:(l=v,s=void 0);const g=l===v&&t[i+1].startsWith("/>")?" ":"";n+=l===c?o+a:f>=0?(e.push(r),o.slice(0,f)+"$lit$"+o.slice(f)+h+g):o+h+(-2===f?(e.push(void 0),i):g)}const p=n+(t[o]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==r?r.createHTML(p):p,e]};class _{constructor({strings:t,_$litType$:i},o){let e;this.parts=[];let s=0,r=0;const a=t.length-1,p=this.parts,[y,g]=N(t,i);if(this.el=_.createElement(y,o),A.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(e=A.nextNode())&&p.length<a;){if(1===e.nodeType){if(e.hasAttributes()){const t=[];for(const i of e.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(h)){const o=g[r++];if(t.push(i),void 0!==o){const t=e.getAttribute(o.toLowerCase()+"$lit$").split(h),i=/([.?@])?(.*)/.exec(o);p.push({type:1,index:s,name:i[2],strings:t,ctor:"."===i[1]?C:"?"===i[1]?
|
|
7
|
+
var s;const n=globalThis.trustedTypes,r=n?n.createPolicy("lit-html",{createHTML:t=>t}):void 0,h=`lit$${(Math.random()+"").slice(9)}$`,l="?"+h,a=`<${l}>`,p=document,f=(t="")=>p.createComment(t),y=t=>null===t||"object"!=typeof t&&"function"!=typeof t,g=Array.isArray,c=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,d=/-->/g,u=/>/g,v=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),$=/'/g,b=/"/g,m=/^(?:script|style|textarea|title)$/i,x=(t=>(i,...o)=>({_$litType$:t,strings:i,values:o}))(1),w=Symbol.for("lit-noChange"),z=Symbol.for("lit-nothing"),k=new WeakMap,A=p.createTreeWalker(p,129,null,!1),N=(t,i)=>{const o=t.length-1,e=[];let s,n=2===i?"<svg>":"",l=c;for(let i=0;i<o;i++){const o=t[i];let r,p,f=-1,y=0;for(;y<o.length&&(l.lastIndex=y,p=l.exec(o),null!==p);)y=l.lastIndex,l===c?"!--"===p[1]?l=d:void 0!==p[1]?l=u:void 0!==p[2]?(m.test(p[2])&&(s=RegExp("</"+p[2],"g")),l=v):void 0!==p[3]&&(l=v):l===v?">"===p[0]?(l=null!=s?s:c,f=-1):void 0===p[1]?f=-2:(f=l.lastIndex-p[2].length,r=p[1],l=void 0===p[3]?v:'"'===p[3]?b:$):l===b||l===$?l=v:l===d||l===u?l=c:(l=v,s=void 0);const g=l===v&&t[i+1].startsWith("/>")?" ":"";n+=l===c?o+a:f>=0?(e.push(r),o.slice(0,f)+"$lit$"+o.slice(f)+h+g):o+h+(-2===f?(e.push(void 0),i):g)}const p=n+(t[o]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==r?r.createHTML(p):p,e]};class _{constructor({strings:t,_$litType$:i},o){let e;this.parts=[];let s=0,r=0;const a=t.length-1,p=this.parts,[y,g]=N(t,i);if(this.el=_.createElement(y,o),A.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(e=A.nextNode())&&p.length<a;){if(1===e.nodeType){if(e.hasAttributes()){const t=[];for(const i of e.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(h)){const o=g[r++];if(t.push(i),void 0!==o){const t=e.getAttribute(o.toLowerCase()+"$lit$").split(h),i=/([.?@])?(.*)/.exec(o);p.push({type:1,index:s,name:i[2],strings:t,ctor:"."===i[1]?C:"?"===i[1]?R:"@"===i[1]?U:O})}else p.push({type:6,index:s})}for(const i of t)e.removeAttribute(i)}if(m.test(e.tagName)){const t=e.textContent.split(h),i=t.length-1;if(i>0){e.textContent=n?n.emptyScript:"";for(let o=0;o<i;o++)e.append(t[o],f()),A.nextNode(),p.push({type:2,index:++s});e.append(t[i],f())}}}else if(8===e.nodeType)if(e.data===l)p.push({type:2,index:s});else{let t=-1;for(;-1!==(t=e.data.indexOf(h,t+1));)p.push({type:7,index:s}),t+=h.length-1}s++}}static createElement(t,i){const o=p.createElement("template");return o.innerHTML=t,o}}function S(t,i,o=t,e){var s,n,r,h;if(i===w)return i;let l=void 0!==e?null===(s=o._$Cl)||void 0===s?void 0:s[e]:o._$Cu;const a=y(i)?void 0:i._$litDirective$;return(null==l?void 0:l.constructor)!==a&&(null===(n=null==l?void 0:l._$AO)||void 0===n||n.call(l,!1),void 0===a?l=void 0:(l=new a(t),l._$AT(t,o,e)),void 0!==e?(null!==(r=(h=o)._$Cl)&&void 0!==r?r:h._$Cl=[])[e]=l:o._$Cu=l),void 0!==l&&(i=S(t,l._$AS(t,i.values),l,e)),i}class T{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:o},parts:e}=this._$AD,s=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:p).importNode(o,!0);A.currentNode=s;let n=A.nextNode(),r=0,h=0,l=e[0];for(;void 0!==l;){if(r===l.index){let i;2===l.type?i=new E(n,n.nextSibling,this,t):1===l.type?i=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(i=new j(n,this,t)),this.v.push(i),l=e[++h]}r!==(null==l?void 0:l.index)&&(n=A.nextNode(),r++)}return s}m(t){let i=0;for(const o of this.v)void 0!==o&&(void 0!==o.strings?(o._$AI(t,o,i),i+=o.strings.length-2):o._$AI(t[i])),i++}}class E{constructor(t,i,o,e){var s;this.type=2,this._$AH=z,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=o,this.options=e,this._$C_=null===(s=null==e?void 0:e.isConnected)||void 0===s||s}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$C_}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),y(t)?t===z||null==t||""===t?(this._$AH!==z&&this._$AR(),this._$AH=z):t!==this._$AH&&t!==w&&this.T(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.k(t):(t=>g(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.S(t):this.T(t)}j(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.j(t))}T(t){this._$AH!==z&&y(this._$AH)?this._$AA.nextSibling.data=t:this.k(p.createTextNode(t)),this._$AH=t}$(t){var i;const{values:o,_$litType$:e}=t,s="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=_.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===s)this._$AH.m(o);else{const t=new T(s,this),i=t.p(this.options);t.m(o),this.k(i),this._$AH=t}}_$AC(t){let i=k.get(t.strings);return void 0===i&&k.set(t.strings,i=new _(t)),i}S(t){g(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let o,e=0;for(const s of t)e===i.length?i.push(o=new E(this.j(f()),this.j(f()),this,this.options)):o=i[e],o._$AI(s),e++;e<i.length&&(this._$AR(o&&o._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var o;for(null===(o=this._$AP)||void 0===o||o.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$C_=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class O{constructor(t,i,o,e,s){this.type=1,this._$AH=z,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=s,o.length>2||""!==o[0]||""!==o[1]?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=z}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,o,e){const s=this.strings;let n=!1;if(void 0===s)t=S(this,t,i,0),n=!y(t)||t!==this._$AH&&t!==w,n&&(this._$AH=t);else{const e=t;let r,h;for(t=s[0],r=0;r<s.length-1;r++)h=S(this,e[o+r],i,r),h===w&&(h=this._$AH[r]),n||(n=!y(h)||h!==this._$AH[r]),h===z?t=z:t!==z&&(t+=(null!=h?h:"")+s[r+1]),this._$AH[r]=h}n&&!e&&this.P(t)}P(t){t===z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class C extends O{constructor(){super(...arguments),this.type=3}P(t){this.element[this.name]=t===z?void 0:t}}const I=n?n.emptyScript:"";class R extends O{constructor(){super(...arguments),this.type=4}P(t){t&&t!==z?this.element.setAttribute(this.name,I):this.element.removeAttribute(this.name)}}class U extends O{constructor(t,i,o,e,s){super(t,i,o,e,s),this.type=5}_$AI(t,i=this){var o;if((t=null!==(o=S(this,t,i,0))&&void 0!==o?o:z)===w)return;const e=this._$AH,s=t===z&&e!==z||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==z&&(e===z||s);s&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,o;"function"==typeof this._$AH?this._$AH.call(null!==(o=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==o?o:this.element,t):this._$AH.handleEvent(t)}}class j{constructor(t,i,o){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t)}}const F=window.litHtmlPolyfillSupport;null==F||F(_,E),(null!==(s=globalThis.litHtmlVersions)&&void 0!==s?s:globalThis.litHtmlVersions=[]).push("2.2.7");
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
10
10
|
* Copyright 2020 Google LLC
|
|
11
11
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
12
|
*/
|
|
13
|
-
const
|
|
13
|
+
const M=Symbol.for(""),Z=t=>{if((null==t?void 0:t.r)===M)return null==t?void 0:t._$litStatic$},W=t=>({_$litStatic$:t,r:M}),B=new Map,G=(t=>(i,...o)=>{const e=o.length;let s,n;const r=[],h=[];let l,a=0,p=!1;for(;a<e;){for(l=i[a];a<e&&void 0!==(n=o[a],s=Z(n));)l+=s+i[++a],p=!0;h.push(n),r.push(l),a++}if(a===e&&r.push(i[e]),p){const t=r.join("$$lit$$");void 0===(i=B.get(t))&&(r.raw=r,B.set(t,i=r)),o=h}return t(i,...o)})(x);var H,L=function(t,i,o,e){for(var s,n=arguments.length,r=n<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,o):e,h=t.length-1;h>=0;h--)(s=t[h])&&(r=(n<3?s(r):n>3?s(i,o,r):s(i,o))||r);return n>3&&r&&Object.defineProperty(i,o,r),r};!function(t){t.title="title",t.title_dense="title-dense",t.subtitle1="subtitle1",t.subtitle2="subtitle2",t.body1="body1",t.body2="body2",t.caption="caption",t.breadcrumb="breadcrumb",t.overline="overline",t.button="button"}(H||(H={}));const P=i.FtCssVariableFactory.extend("--ft-typography-font-family",i.designSystemVariables.titleFont),K=i.FtCssVariableFactory.extend("--ft-typography-font-family",i.designSystemVariables.contentFont),D={fontFamily:K,fontSize:i.FtCssVariableFactory.create("--ft-typography-font-size","SIZE","16px"),fontWeight:i.FtCssVariableFactory.create("--ft-typography-font-weight","UNKNOWN","normal"),letterSpacing:i.FtCssVariableFactory.create("--ft-typography-letter-spacing","SIZE","0.496px"),lineHeight:i.FtCssVariableFactory.create("--ft-typography-line-height","NUMBER","1.5"),textTransform:i.FtCssVariableFactory.create("--ft-typography-text-transform","UNKNOWN","inherit")},q=i.FtCssVariableFactory.extend("--ft-typography-title-font-family",P),J=i.FtCssVariableFactory.extend("--ft-typography-title-font-size",D.fontSize,"20px"),Q=i.FtCssVariableFactory.extend("--ft-typography-title-font-weight",D.fontWeight,"normal"),V=i.FtCssVariableFactory.extend("--ft-typography-title-letter-spacing",D.letterSpacing,"0.15px"),X=i.FtCssVariableFactory.extend("--ft-typography-title-line-height",D.lineHeight,"1.2"),Y=i.FtCssVariableFactory.extend("--ft-typography-title-text-transform",D.textTransform,"inherit"),tt=i.FtCssVariableFactory.extend("--ft-typography-title-dense-font-family",P),it=i.FtCssVariableFactory.extend("--ft-typography-title-dense-font-size",D.fontSize,"14px"),ot=i.FtCssVariableFactory.extend("--ft-typography-title-dense-font-weight",D.fontWeight,"normal"),et=i.FtCssVariableFactory.extend("--ft-typography-title-dense-letter-spacing",D.letterSpacing,"0.105px"),st=i.FtCssVariableFactory.extend("--ft-typography-title-dense-line-height",D.lineHeight,"1.7"),nt=i.FtCssVariableFactory.extend("--ft-typography-title-dense-text-transform",D.textTransform,"inherit"),rt=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-font-family",K),ht=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-font-size",D.fontSize,"16px"),lt=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-font-weight",D.fontWeight,"600"),at=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-letter-spacing",D.letterSpacing,"0.144px"),pt=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-line-height",D.lineHeight,"1.5"),ft=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-text-transform",D.textTransform,"inherit"),yt=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-font-family",K),gt=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-font-size",D.fontSize,"14px"),ct=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-font-weight",D.fontWeight,"normal"),dt=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-letter-spacing",D.letterSpacing,"0.098px"),ut=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-line-height",D.lineHeight,"1.7"),vt=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-text-transform",D.textTransform,"inherit"),$t=i.FtCssVariableFactory.extend("--ft-typography-body1-font-family",K),bt=i.FtCssVariableFactory.extend("--ft-typography-body1-font-size",D.fontSize,"16px"),mt=i.FtCssVariableFactory.extend("--ft-typography-body1-font-weight",D.fontWeight,"normal"),xt=i.FtCssVariableFactory.extend("--ft-typography-body1-letter-spacing",D.letterSpacing,"0.496px"),wt=i.FtCssVariableFactory.extend("--ft-typography-body1-line-height",D.lineHeight,"1.5"),zt=i.FtCssVariableFactory.extend("--ft-typography-body1-text-transform",D.textTransform,"inherit"),kt=i.FtCssVariableFactory.extend("--ft-typography-body2-font-family",K),At=i.FtCssVariableFactory.extend("--ft-typography-body2-font-size",D.fontSize,"14px"),Nt=i.FtCssVariableFactory.extend("--ft-typography-body2-font-weight",D.fontWeight,"normal"),_t=i.FtCssVariableFactory.extend("--ft-typography-body2-letter-spacing",D.letterSpacing,"0.252px"),St=i.FtCssVariableFactory.extend("--ft-typography-body2-line-height",D.lineHeight,"1.4"),Tt=i.FtCssVariableFactory.extend("--ft-typography-body2-text-transform",D.textTransform,"inherit"),Et=i.FtCssVariableFactory.extend("--ft-typography-caption-font-family",K),Ot=i.FtCssVariableFactory.extend("--ft-typography-caption-font-size",D.fontSize,"12px"),Ct=i.FtCssVariableFactory.extend("--ft-typography-caption-font-weight",D.fontWeight,"normal"),It=i.FtCssVariableFactory.extend("--ft-typography-caption-letter-spacing",D.letterSpacing,"0.396px"),Rt=i.FtCssVariableFactory.extend("--ft-typography-caption-line-height",D.lineHeight,"1.33"),Ut=i.FtCssVariableFactory.extend("--ft-typography-caption-text-transform",D.textTransform,"inherit"),jt=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-font-family",K),Ft=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-font-size",D.fontSize,"10px"),Mt=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-font-weight",D.fontWeight,"normal"),Zt=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-letter-spacing",D.letterSpacing,"0.33px"),Wt=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-line-height",D.lineHeight,"1.6"),Bt=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-text-transform",D.textTransform,"inherit"),Gt=i.FtCssVariableFactory.extend("--ft-typography-overline-font-family",K),Ht=i.FtCssVariableFactory.extend("--ft-typography-overline-font-size",D.fontSize,"10px"),Lt=i.FtCssVariableFactory.extend("--ft-typography-overline-font-weight",D.fontWeight,"normal"),Pt=i.FtCssVariableFactory.extend("--ft-typography-overline-letter-spacing",D.letterSpacing,"1.5px"),Kt=i.FtCssVariableFactory.extend("--ft-typography-overline-line-height",D.lineHeight,"1.6"),Dt=i.FtCssVariableFactory.extend("--ft-typography-overline-text-transform",D.textTransform,"uppercase"),qt=i.FtCssVariableFactory.extend("--ft-typography-button-font-family",K),Jt=i.FtCssVariableFactory.extend("--ft-typography-button-font-size",D.fontSize,"14px"),Qt=i.FtCssVariableFactory.extend("--ft-typography-button-font-weight",D.fontWeight,"600"),Vt=i.FtCssVariableFactory.extend("--ft-typography-button-letter-spacing",D.letterSpacing,"1.246px"),Xt=i.FtCssVariableFactory.extend("--ft-typography-button-line-height",D.lineHeight,"1.15"),Yt=i.FtCssVariableFactory.extend("--ft-typography-button-text-transform",D.textTransform,"uppercase"),ti=o.css`
|
|
14
14
|
.ft-typography--title {
|
|
15
15
|
font-family: ${q};
|
|
16
16
|
font-size: ${J};
|
|
@@ -67,21 +67,21 @@ const F=Symbol.for(""),Z=t=>{if((null==t?void 0:t.r)===F)return null==t?void 0:t
|
|
|
67
67
|
}
|
|
68
68
|
`,ri=o.css`
|
|
69
69
|
.ft-typography--caption {
|
|
70
|
-
font-family: ${
|
|
71
|
-
font-size: ${
|
|
70
|
+
font-family: ${Et};
|
|
71
|
+
font-size: ${Ot};
|
|
72
72
|
font-weight: ${Ct};
|
|
73
73
|
letter-spacing: ${It};
|
|
74
|
-
line-height: ${
|
|
75
|
-
text-transform: ${
|
|
74
|
+
line-height: ${Rt};
|
|
75
|
+
text-transform: ${Ut};
|
|
76
76
|
}
|
|
77
77
|
`,hi=o.css`
|
|
78
78
|
.ft-typography--breadcrumb {
|
|
79
|
-
font-family: ${
|
|
80
|
-
font-size: ${
|
|
81
|
-
font-weight: ${
|
|
79
|
+
font-family: ${jt};
|
|
80
|
+
font-size: ${Ft};
|
|
81
|
+
font-weight: ${Mt};
|
|
82
82
|
letter-spacing: ${Zt};
|
|
83
|
-
line-height: ${
|
|
84
|
-
text-transform: ${
|
|
83
|
+
line-height: ${Wt};
|
|
84
|
+
text-transform: ${Bt};
|
|
85
85
|
}
|
|
86
86
|
`,li=o.css`
|
|
87
87
|
.ft-typography--overline {
|
|
@@ -102,17 +102,17 @@ const F=Symbol.for(""),Z=t=>{if((null==t?void 0:t.r)===F)return null==t?void 0:t
|
|
|
102
102
|
text-transform: ${Yt};
|
|
103
103
|
}
|
|
104
104
|
`;class pi extends i.FtLitElement{constructor(){super(...arguments),this.variant=H.body1}render(){return this.element?G`
|
|
105
|
-
<${
|
|
105
|
+
<${W(this.element)}
|
|
106
106
|
class="ft-typography ft-typography--${this.variant}">
|
|
107
107
|
<slot></slot>
|
|
108
|
-
</${
|
|
108
|
+
</${W(this.element)}>
|
|
109
109
|
`:G`
|
|
110
110
|
<slot class="ft-typography ft-typography--${this.variant}"></slot>
|
|
111
111
|
`}}pi.styles=[ti,ii,oi,ei,si,ni,ri,hi,li,ai,o.css`
|
|
112
112
|
.ft-typography {
|
|
113
113
|
vertical-align: inherit;
|
|
114
114
|
}
|
|
115
|
-
`],L([e.property()],pi.prototype,"element",void 0),L([e.property()],pi.prototype,"variant",void 0),i.customElement("ft-typography")(pi);var fi=function(t,i,o,e){for(var s,n=arguments.length,r=n<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,o):e,h=t.length-1;h>=0;h--)(s=t[h])&&(r=(n<3?s(r):n>3?s(i,o,r):s(i,o))||r);return n>3&&r&&Object.defineProperty(i,o,r),r};const yi={distance:i.FtCssVariableFactory.create("--ft-tooltip-distance","SIZE","4px"),color:i.FtCssVariableFactory.create("--ft-tooltip-color","COLOR","#FFFFFF"),backgroundColor:i.FtCssVariableFactory.create("--ft-tooltip-background-color","COLOR","#666666"),zIndex:i.FtCssVariableFactory.create("--ft-tooltip-z-index","NUMBER","1"),borderRadiusS:i.FtCssVariableFactory.external(i.designSystemVariables.borderRadiusS,"Design system")};class gi extends i.FtLitElement{constructor(){super(...arguments),this.text="",this.manual=!1,this.inline=!1,this.delay=500,this.position="bottom",this.visible=!1,this.hideDebounce=new i.Debouncer,this.revealDebouncer=new i.Debouncer}render(){return o.html`
|
|
115
|
+
`],L([e.property()],pi.prototype,"element",void 0),L([e.property()],pi.prototype,"variant",void 0),i.customElement("ft-typography")(pi);var fi=function(t,i,o,e){for(var s,n=arguments.length,r=n<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,o):e,h=t.length-1;h>=0;h--)(s=t[h])&&(r=(n<3?s(r):n>3?s(i,o,r):s(i,o))||r);return n>3&&r&&Object.defineProperty(i,o,r),r};const yi={distance:i.FtCssVariableFactory.create("--ft-tooltip-distance","SIZE","4px"),color:i.FtCssVariableFactory.create("--ft-tooltip-color","COLOR","#FFFFFF"),backgroundColor:i.FtCssVariableFactory.create("--ft-tooltip-background-color","COLOR","#666666"),zIndex:i.FtCssVariableFactory.create("--ft-tooltip-z-index","NUMBER","1"),borderRadiusS:i.FtCssVariableFactory.external(i.designSystemVariables.borderRadiusS,"Design system"),maxWidth:i.FtCssVariableFactory.create("--ft-tooltip-max-width","SIZE","150px")};class gi extends i.FtLitElement{constructor(){super(...arguments),this.text="",this.manual=!1,this.inline=!1,this.delay=500,this.position="bottom",this.visible=!1,this.hideDebounce=new i.Debouncer,this.revealDebouncer=new i.Debouncer}render(){return o.html`
|
|
116
116
|
<div part="container"
|
|
117
117
|
class="ft-tooltip--container ${this.inline?"ft-tooltip--inline":""}"
|
|
118
118
|
@mouseenter=${this.onHover}
|
|
@@ -122,12 +122,13 @@ const F=Symbol.for(""),Z=t=>{if((null==t?void 0:t.r)===F)return null==t?void 0:t
|
|
|
122
122
|
@touchstart=${this.onTouch}>
|
|
123
123
|
<div part="tooltip" class="ft-tooltip ft-tooltip--${this.position}" ?hidden=${!this.visible}>
|
|
124
124
|
<div part="tooltip-content" class="ft-tooltip--content">
|
|
125
|
-
<
|
|
125
|
+
<slot name="text"></slot>
|
|
126
|
+
<ft-typography variant="caption" ?hidden=${!this.text}>${this.text}</ft-typography>
|
|
126
127
|
</div>
|
|
127
128
|
</div>
|
|
128
129
|
<slot></slot>
|
|
129
130
|
</div>
|
|
130
|
-
`}update(t){t.has("visible")&&!this.visible&&this.resetTooltipContent(),super.update(t)}contentAvailableCallback(t){t.has("visible")&&this.visible&&this.positionTooltip()}show(t){this.visible=!0,null!=t&&this.hideDebounce.run((()=>this.hide()),t)}hide(){this.visible=!1}toggle(){this.visible=!this.visible}get slottedElement(){var t;return(null!==(t=this.slotNodes)&&void 0!==t?t:[]).filter((t=>t.nodeType==Node.ELEMENT_NODE))[0]}resetTooltipContent(){if(this.tooltip&&this.tooltipContent){const t=this.tooltipContent.style;switch(t.transition="none",this.position){case"top":t.top=this.tooltip.clientHeight+"px",t.left="0";break;case"bottom":t.top=-this.tooltip.clientHeight+"px",t.left="0";break;case"left":t.top="0",t.left=this.tooltip.clientWidth+"px";break;case"right":t.top="0",t.left=-this.tooltip.clientWidth+"px"}}}positionTooltip(){this.resetTooltipContent();const t=this.slottedElement;if(this.tooltip&&t){const i=t.getBoundingClientRect(),o=(i.height-this.tooltip.clientHeight)/2,e=(i.width-this.tooltip.clientWidth)/2;let s=0,n=0;switch(this.position){case"top":n=-this.tooltip.clientHeight,s=e;break;case"bottom":n=i.height,s=e;break;case"left":n=o,s=-this.tooltip.clientWidth;break;case"right":n=o,s=i.width}i.left+s+this.tooltip.clientWidth>window.innerWidth&&(s=window.innerWidth-this.tooltip.clientWidth-i.left),i.left+s<0&&(s=0);const r=this.tooltip.style;r.left=s+"px",r.top=n+"px",r.maxWidth
|
|
131
|
+
`}update(t){t.has("visible")&&!this.visible&&this.resetTooltipContent(),super.update(t)}contentAvailableCallback(t){t.has("visible")&&this.visible&&this.positionTooltip()}show(t){this.visible=!0,null!=t&&this.hideDebounce.run((()=>this.hide()),t)}hide(){this.visible=!1}toggle(){this.visible=!this.visible}get slottedElement(){var t;return(null!==(t=this.slotNodes)&&void 0!==t?t:[]).filter((t=>t.nodeType==Node.ELEMENT_NODE))[0]}resetTooltipContent(){if(this.tooltip&&this.tooltipContent){const t=this.tooltipContent.style;switch(t.transition="none",this.position){case"top":t.top=this.tooltip.clientHeight+"px",t.left="0";break;case"bottom":t.top=-this.tooltip.clientHeight+"px",t.left="0";break;case"left":t.top="0",t.left=this.tooltip.clientWidth+"px";break;case"right":t.top="0",t.left=-this.tooltip.clientWidth+"px"}}}positionTooltip(){this.resetTooltipContent();const t=this.slottedElement;if(this.tooltip&&t){const i=t.getBoundingClientRect(),o=(i.height-this.tooltip.clientHeight)/2,e=(i.width-this.tooltip.clientWidth)/2;let s=0,n=0;switch(this.position){case"top":n=-this.tooltip.clientHeight,s=e;break;case"bottom":n=i.height,s=e;break;case"left":n=o,s=-this.tooltip.clientWidth;break;case"right":n=o,s=i.width}i.left+s+this.tooltip.clientWidth>window.innerWidth&&(s=window.innerWidth-this.tooltip.clientWidth-i.left),i.left+s<0&&(s=0);const r=this.tooltip.style;r.left=s+"px",r.top=n+"px",r.maxWidth=`max(${i.width}px, ${yi.maxWidth})`}this.revealDebouncer.run((()=>{this.tooltipContent&&(this.tooltipContent.style.transition="top var(--ft-transition-duration, 250ms), left var(--ft-transition-duration, 250ms)",this.tooltipContent.style.top="0",this.tooltipContent.style.left="0")}),this.manual?0:this.delay)}onTouch(){this.manual||(this.show(),setTimeout((()=>window.addEventListener("touchstart",(t=>{t.composedPath().includes(this.container)||this.onOut()}),{once:!0})),100))}onHover(){this.manual||this.show()}onOut(){this.manual||(this.revealDebouncer.cancel(),this.hide())}}gi.elementDefinitions={"ft-typography":pi},gi.styles=o.css`
|
|
131
132
|
.ft-tooltip--container {
|
|
132
133
|
display: block;
|
|
133
134
|
position: relative;
|
|
@@ -143,7 +144,7 @@ const F=Symbol.for(""),Z=t=>{if((null==t?void 0:t.r)===F)return null==t?void 0:t
|
|
|
143
144
|
box-sizing: border-box;
|
|
144
145
|
overflow: hidden;
|
|
145
146
|
width: max-content;
|
|
146
|
-
max-width:
|
|
147
|
+
max-width: ${yi.maxWidth};
|
|
147
148
|
text-align: center;
|
|
148
149
|
padding: ${yi.distance};
|
|
149
150
|
z-index: ${yi.zIndex};
|
package/build/ft-tooltip.min.js
CHANGED
|
@@ -57,7 +57,7 @@ const h=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
|
|
|
57
57
|
* Copyright 2017 Google LLC
|
|
58
58
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
59
59
|
*/
|
|
60
|
-
var N;S.finalized=!0,S.elementProperties=new Map,S.elementStyles=[],S.shadowRootOptions={mode:"open"},null==x||x({ReactiveElement:S}),(null!==(v=globalThis.reactiveElementVersions)&&void 0!==v?v:globalThis.reactiveElementVersions=[]).push("1.3.4");const C=globalThis.trustedTypes,
|
|
60
|
+
var N;S.finalized=!0,S.elementProperties=new Map,S.elementStyles=[],S.shadowRootOptions={mode:"open"},null==x||x({ReactiveElement:S}),(null!==(v=globalThis.reactiveElementVersions)&&void 0!==v?v:globalThis.reactiveElementVersions=[]).push("1.3.4");const C=globalThis.trustedTypes,E=C?C.createPolicy("lit-html",{createHTML:t=>t}):void 0,R=`lit$${(Math.random()+"").slice(9)}$`,M="?"+R,k=`<${M}>`,U=document,F=(t="")=>U.createComment(t),L=t=>null===t||"object"!=typeof t&&"function"!=typeof t,A=Array.isArray,P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,z=/>/g,j=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),B=/'/g,_=/"/g,W=/^(?:script|style|textarea|title)$/i,D=(t=>(i,...e)=>({_$litType$:t,strings:i,values:e}))(1),H=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),I=new WeakMap,Z=U.createTreeWalker(U,129,null,!1),V=(t,i)=>{const e=t.length-1,o=[];let n,s=2===i?"<svg>":"",r=P;for(let i=0;i<e;i++){const e=t[i];let a,l,h=-1,c=0;for(;c<e.length&&(r.lastIndex=c,l=r.exec(e),null!==l);)c=r.lastIndex,r===P?"!--"===l[1]?r=T:void 0!==l[1]?r=z:void 0!==l[2]?(W.test(l[2])&&(n=RegExp("</"+l[2],"g")),r=j):void 0!==l[3]&&(r=j):r===j?">"===l[0]?(r=null!=n?n:P,h=-1):void 0===l[1]?h=-2:(h=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?j:'"'===l[3]?_:B):r===_||r===B?r=j:r===T||r===z?r=P:(r=j,n=void 0);const p=r===j&&t[i+1].startsWith("/>")?" ":"";s+=r===P?e+k:h>=0?(o.push(a),e.slice(0,h)+"$lit$"+e.slice(h)+R+p):e+R+(-2===h?(o.push(void 0),i):p)}const a=s+(t[e]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==E?E.createHTML(a):a,o]};class J{constructor({strings:t,_$litType$:i},e){let o;this.parts=[];let n=0,s=0;const r=t.length-1,a=this.parts,[l,h]=V(t,i);if(this.el=J.createElement(l,e),Z.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(o=Z.nextNode())&&a.length<r;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const i of o.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(R)){const e=h[s++];if(t.push(i),void 0!==e){const t=o.getAttribute(e.toLowerCase()+"$lit$").split(R),i=/([.?@])?(.*)/.exec(e);a.push({type:1,index:n,name:i[2],strings:t,ctor:"."===i[1]?Y:"?"===i[1]?it:"@"===i[1]?et:Q})}else a.push({type:6,index:n})}for(const i of t)o.removeAttribute(i)}if(W.test(o.tagName)){const t=o.textContent.split(R),i=t.length-1;if(i>0){o.textContent=C?C.emptyScript:"";for(let e=0;e<i;e++)o.append(t[e],F()),Z.nextNode(),a.push({type:2,index:++n});o.append(t[i],F())}}}else if(8===o.nodeType)if(o.data===M)a.push({type:2,index:n});else{let t=-1;for(;-1!==(t=o.data.indexOf(R,t+1));)a.push({type:7,index:n}),t+=R.length-1}n++}}static createElement(t,i){const e=U.createElement("template");return e.innerHTML=t,e}}function q(t,i,e=t,o){var n,s,r,a;if(i===H)return i;let l=void 0!==o?null===(n=e._$Cl)||void 0===n?void 0:n[o]:e._$Cu;const h=L(i)?void 0:i._$litDirective$;return(null==l?void 0:l.constructor)!==h&&(null===(s=null==l?void 0:l._$AO)||void 0===s||s.call(l,!1),void 0===h?l=void 0:(l=new h(t),l._$AT(t,e,o)),void 0!==o?(null!==(r=(a=e)._$Cl)&&void 0!==r?r:a._$Cl=[])[o]=l:e._$Cu=l),void 0!==l&&(i=q(t,l._$AS(t,i.values),l,o)),i}class X{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:e},parts:o}=this._$AD,n=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:U).importNode(e,!0);Z.currentNode=n;let s=Z.nextNode(),r=0,a=0,l=o[0];for(;void 0!==l;){if(r===l.index){let i;2===l.type?i=new G(s,s.nextSibling,this,t):1===l.type?i=new l.ctor(s,l.name,l.strings,this,t):6===l.type&&(i=new ot(s,this,t)),this.v.push(i),l=o[++a]}r!==(null==l?void 0:l.index)&&(s=Z.nextNode(),r++)}return n}m(t){let i=0;for(const e of this.v)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,i),i+=e.strings.length-2):e._$AI(t[i])),i++}}class G{constructor(t,i,e,o){var n;this.type=2,this._$AH=K,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=e,this.options=o,this._$C_=null===(n=null==o?void 0:o.isConnected)||void 0===n||n}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$C_}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=q(this,t,i),L(t)?t===K||null==t||""===t?(this._$AH!==K&&this._$AR(),this._$AH=K):t!==this._$AH&&t!==H&&this.T(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.k(t):(t=>A(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.S(t):this.T(t)}j(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.j(t))}T(t){this._$AH!==K&&L(this._$AH)?this._$AA.nextSibling.data=t:this.k(U.createTextNode(t)),this._$AH=t}$(t){var i;const{values:e,_$litType$:o}=t,n="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=J.createElement(o.h,this.options)),o);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===n)this._$AH.m(e);else{const t=new X(n,this),i=t.p(this.options);t.m(e),this.k(i),this._$AH=t}}_$AC(t){let i=I.get(t.strings);return void 0===i&&I.set(t.strings,i=new J(t)),i}S(t){A(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let e,o=0;for(const n of t)o===i.length?i.push(e=new G(this.j(F()),this.j(F()),this,this.options)):e=i[o],e._$AI(n),o++;o<i.length&&(this._$AR(e&&e._$AB.nextSibling,o),i.length=o)}_$AR(t=this._$AA.nextSibling,i){var e;for(null===(e=this._$AP)||void 0===e||e.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$C_=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class Q{constructor(t,i,e,o,n){this.type=1,this._$AH=K,this._$AN=void 0,this.element=t,this.name=i,this._$AM=o,this.options=n,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=K}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,e,o){const n=this.strings;let s=!1;if(void 0===n)t=q(this,t,i,0),s=!L(t)||t!==this._$AH&&t!==H,s&&(this._$AH=t);else{const o=t;let r,a;for(t=n[0],r=0;r<n.length-1;r++)a=q(this,o[e+r],i,r),a===H&&(a=this._$AH[r]),s||(s=!L(a)||a!==this._$AH[r]),a===K?t=K:t!==K&&(t+=(null!=a?a:"")+n[r+1]),this._$AH[r]=a}s&&!o&&this.P(t)}P(t){t===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Y extends Q{constructor(){super(...arguments),this.type=3}P(t){this.element[this.name]=t===K?void 0:t}}const tt=C?C.emptyScript:"";class it extends Q{constructor(){super(...arguments),this.type=4}P(t){t&&t!==K?this.element.setAttribute(this.name,tt):this.element.removeAttribute(this.name)}}class et extends Q{constructor(t,i,e,o,n){super(t,i,e,o,n),this.type=5}_$AI(t,i=this){var e;if((t=null!==(e=q(this,t,i,0))&&void 0!==e?e:K)===H)return;const o=this._$AH,n=t===K&&o!==K||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==K&&(o===K||n);n&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,e;"function"==typeof this._$AH?this._$AH.call(null!==(e=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==e?e:this.element,t):this._$AH.handleEvent(t)}}class ot{constructor(t,i,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){q(this,t)}}const nt=window.litHtmlPolyfillSupport;
|
|
61
61
|
/**
|
|
62
62
|
* @license
|
|
63
63
|
* Copyright 2017 Google LLC
|
|
@@ -88,12 +88,12 @@ var st,rt;null==nt||nt(J,G),(null!==(N=globalThis.litHtmlVersions)&&void 0!==N?N
|
|
|
88
88
|
* Copyright 2020 Google LLC
|
|
89
89
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
90
90
|
*/
|
|
91
|
-
const yt=Symbol.for(""),gt=t=>{if((null==t?void 0:t.r)===yt)return null==t?void 0:t._$litStatic$},vt=t=>({_$litStatic$:t,r:yt}),bt=new Map,mt=(t=>(i,...e)=>{const o=e.length;let n,s;const r=[],a=[];let l,h=0,c=!1;for(;h<o;){for(l=i[h];h<o&&void 0!==(s=e[h],n=gt(s));)l+=n+i[++h],c=!0;a.push(s),r.push(l),h++}if(h===o&&r.push(i[o]),c){const t=r.join("$$lit$$");void 0===(i=bt.get(t))&&(r.raw=r,bt.set(t,i=r)),e=a}return t(i,...e)})(D);var xt,wt=function(t,i,e,o){for(var n,s=arguments.length,r=s<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(s<3?n(r):s>3?n(i,e,r):n(i,e))||r);return s>3&&r&&Object.defineProperty(i,e,r),r};!function(t){t.title="title",t.title_dense="title-dense",t.subtitle1="subtitle1",t.subtitle2="subtitle2",t.body1="body1",t.body2="body2",t.caption="caption",t.breadcrumb="breadcrumb",t.overline="overline",t.button="button"}(xt||(xt={}));const $t=ht.extend("--ft-typography-font-family",ct.titleFont),Ot=ht.extend("--ft-typography-font-family",ct.contentFont),St={fontFamily:Ot,fontSize:ht.create("--ft-typography-font-size","SIZE","16px"),fontWeight:ht.create("--ft-typography-font-weight","UNKNOWN","normal"),letterSpacing:ht.create("--ft-typography-letter-spacing","SIZE","0.496px"),lineHeight:ht.create("--ft-typography-line-height","NUMBER","1.5"),textTransform:ht.create("--ft-typography-text-transform","UNKNOWN","inherit")},Nt=ht.extend("--ft-typography-title-font-family",$t),Ct=ht.extend("--ft-typography-title-font-size",St.fontSize,"20px"),
|
|
91
|
+
const yt=Symbol.for(""),gt=t=>{if((null==t?void 0:t.r)===yt)return null==t?void 0:t._$litStatic$},vt=t=>({_$litStatic$:t,r:yt}),bt=new Map,mt=(t=>(i,...e)=>{const o=e.length;let n,s;const r=[],a=[];let l,h=0,c=!1;for(;h<o;){for(l=i[h];h<o&&void 0!==(s=e[h],n=gt(s));)l+=n+i[++h],c=!0;a.push(s),r.push(l),h++}if(h===o&&r.push(i[o]),c){const t=r.join("$$lit$$");void 0===(i=bt.get(t))&&(r.raw=r,bt.set(t,i=r)),e=a}return t(i,...e)})(D);var xt,wt=function(t,i,e,o){for(var n,s=arguments.length,r=s<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(s<3?n(r):s>3?n(i,e,r):n(i,e))||r);return s>3&&r&&Object.defineProperty(i,e,r),r};!function(t){t.title="title",t.title_dense="title-dense",t.subtitle1="subtitle1",t.subtitle2="subtitle2",t.body1="body1",t.body2="body2",t.caption="caption",t.breadcrumb="breadcrumb",t.overline="overline",t.button="button"}(xt||(xt={}));const $t=ht.extend("--ft-typography-font-family",ct.titleFont),Ot=ht.extend("--ft-typography-font-family",ct.contentFont),St={fontFamily:Ot,fontSize:ht.create("--ft-typography-font-size","SIZE","16px"),fontWeight:ht.create("--ft-typography-font-weight","UNKNOWN","normal"),letterSpacing:ht.create("--ft-typography-letter-spacing","SIZE","0.496px"),lineHeight:ht.create("--ft-typography-line-height","NUMBER","1.5"),textTransform:ht.create("--ft-typography-text-transform","UNKNOWN","inherit")},Nt=ht.extend("--ft-typography-title-font-family",$t),Ct=ht.extend("--ft-typography-title-font-size",St.fontSize,"20px"),Et=ht.extend("--ft-typography-title-font-weight",St.fontWeight,"normal"),Rt=ht.extend("--ft-typography-title-letter-spacing",St.letterSpacing,"0.15px"),Mt=ht.extend("--ft-typography-title-line-height",St.lineHeight,"1.2"),kt=ht.extend("--ft-typography-title-text-transform",St.textTransform,"inherit"),Ut=ht.extend("--ft-typography-title-dense-font-family",$t),Ft=ht.extend("--ft-typography-title-dense-font-size",St.fontSize,"14px"),Lt=ht.extend("--ft-typography-title-dense-font-weight",St.fontWeight,"normal"),At=ht.extend("--ft-typography-title-dense-letter-spacing",St.letterSpacing,"0.105px"),Pt=ht.extend("--ft-typography-title-dense-line-height",St.lineHeight,"1.7"),Tt=ht.extend("--ft-typography-title-dense-text-transform",St.textTransform,"inherit"),zt=ht.extend("--ft-typography-subtitle1-font-family",Ot),jt=ht.extend("--ft-typography-subtitle1-font-size",St.fontSize,"16px"),Bt=ht.extend("--ft-typography-subtitle1-font-weight",St.fontWeight,"600"),_t=ht.extend("--ft-typography-subtitle1-letter-spacing",St.letterSpacing,"0.144px"),Wt=ht.extend("--ft-typography-subtitle1-line-height",St.lineHeight,"1.5"),Dt=ht.extend("--ft-typography-subtitle1-text-transform",St.textTransform,"inherit"),Ht=ht.extend("--ft-typography-subtitle2-font-family",Ot),Kt=ht.extend("--ft-typography-subtitle2-font-size",St.fontSize,"14px"),It=ht.extend("--ft-typography-subtitle2-font-weight",St.fontWeight,"normal"),Zt=ht.extend("--ft-typography-subtitle2-letter-spacing",St.letterSpacing,"0.098px"),Vt=ht.extend("--ft-typography-subtitle2-line-height",St.lineHeight,"1.7"),Jt=ht.extend("--ft-typography-subtitle2-text-transform",St.textTransform,"inherit"),qt=ht.extend("--ft-typography-body1-font-family",Ot),Xt=ht.extend("--ft-typography-body1-font-size",St.fontSize,"16px"),Gt=ht.extend("--ft-typography-body1-font-weight",St.fontWeight,"normal"),Qt=ht.extend("--ft-typography-body1-letter-spacing",St.letterSpacing,"0.496px"),Yt=ht.extend("--ft-typography-body1-line-height",St.lineHeight,"1.5"),ti=ht.extend("--ft-typography-body1-text-transform",St.textTransform,"inherit"),ii=ht.extend("--ft-typography-body2-font-family",Ot),ei=ht.extend("--ft-typography-body2-font-size",St.fontSize,"14px"),oi=ht.extend("--ft-typography-body2-font-weight",St.fontWeight,"normal"),ni=ht.extend("--ft-typography-body2-letter-spacing",St.letterSpacing,"0.252px"),si=ht.extend("--ft-typography-body2-line-height",St.lineHeight,"1.4"),ri=ht.extend("--ft-typography-body2-text-transform",St.textTransform,"inherit"),ai=ht.extend("--ft-typography-caption-font-family",Ot),li=ht.extend("--ft-typography-caption-font-size",St.fontSize,"12px"),hi=ht.extend("--ft-typography-caption-font-weight",St.fontWeight,"normal"),ci=ht.extend("--ft-typography-caption-letter-spacing",St.letterSpacing,"0.396px"),pi=ht.extend("--ft-typography-caption-line-height",St.lineHeight,"1.33"),fi=ht.extend("--ft-typography-caption-text-transform",St.textTransform,"inherit"),ui=ht.extend("--ft-typography-breadcrumb-font-family",Ot),di=ht.extend("--ft-typography-breadcrumb-font-size",St.fontSize,"10px"),yi=ht.extend("--ft-typography-breadcrumb-font-weight",St.fontWeight,"normal"),gi=ht.extend("--ft-typography-breadcrumb-letter-spacing",St.letterSpacing,"0.33px"),vi=ht.extend("--ft-typography-breadcrumb-line-height",St.lineHeight,"1.6"),bi=ht.extend("--ft-typography-breadcrumb-text-transform",St.textTransform,"inherit"),mi=ht.extend("--ft-typography-overline-font-family",Ot),xi=ht.extend("--ft-typography-overline-font-size",St.fontSize,"10px"),wi=ht.extend("--ft-typography-overline-font-weight",St.fontWeight,"normal"),$i=ht.extend("--ft-typography-overline-letter-spacing",St.letterSpacing,"1.5px"),Oi=ht.extend("--ft-typography-overline-line-height",St.lineHeight,"1.6"),Si=ht.extend("--ft-typography-overline-text-transform",St.textTransform,"uppercase"),Ni=ht.extend("--ft-typography-button-font-family",Ot),Ci=ht.extend("--ft-typography-button-font-size",St.fontSize,"14px"),Ei=ht.extend("--ft-typography-button-font-weight",St.fontWeight,"600"),Ri=ht.extend("--ft-typography-button-letter-spacing",St.letterSpacing,"1.246px"),Mi=ht.extend("--ft-typography-button-line-height",St.lineHeight,"1.15"),ki=ht.extend("--ft-typography-button-text-transform",St.textTransform,"uppercase"),Ui=d`
|
|
92
92
|
.ft-typography--title {
|
|
93
93
|
font-family: ${Nt};
|
|
94
94
|
font-size: ${Ct};
|
|
95
|
-
font-weight: ${
|
|
96
|
-
letter-spacing: ${
|
|
95
|
+
font-weight: ${Et};
|
|
96
|
+
letter-spacing: ${Rt};
|
|
97
97
|
line-height: ${Mt};
|
|
98
98
|
text-transform: ${kt};
|
|
99
99
|
}
|
|
@@ -174,8 +174,8 @@ const yt=Symbol.for(""),gt=t=>{if((null==t?void 0:t.r)===yt)return null==t?void
|
|
|
174
174
|
.ft-typography--button {
|
|
175
175
|
font-family: ${Ni};
|
|
176
176
|
font-size: ${Ci};
|
|
177
|
-
font-weight: ${
|
|
178
|
-
letter-spacing: ${
|
|
177
|
+
font-weight: ${Ei};
|
|
178
|
+
letter-spacing: ${Ri};
|
|
179
179
|
line-height: ${Mi};
|
|
180
180
|
text-transform: ${ki};
|
|
181
181
|
}
|
|
@@ -190,7 +190,7 @@ const yt=Symbol.for(""),gt=t=>{if((null==t?void 0:t.r)===yt)return null==t?void
|
|
|
190
190
|
.ft-typography {
|
|
191
191
|
vertical-align: inherit;
|
|
192
192
|
}
|
|
193
|
-
`],wt([o()],Wi.prototype,"element",void 0),wt([o()],Wi.prototype,"variant",void 0),l("ft-typography")(Wi);var Di=function(t,i,e,o){for(var n,s=arguments.length,r=s<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(s<3?n(r):s>3?n(i,e,r):n(i,e))||r);return s>3&&r&&Object.defineProperty(i,e,r),r};const Hi={distance:ht.create("--ft-tooltip-distance","SIZE","4px"),color:ht.create("--ft-tooltip-color","COLOR","#FFFFFF"),backgroundColor:ht.create("--ft-tooltip-background-color","COLOR","#666666"),zIndex:ht.create("--ft-tooltip-z-index","NUMBER","1"),borderRadiusS:ht.external(ct.borderRadiusS,"Design system")};class Ki extends dt{constructor(){super(...arguments),this.text="",this.manual=!1,this.inline=!1,this.delay=500,this.position="bottom",this.visible=!1,this.hideDebounce=new i,this.revealDebouncer=new i}render(){return D`
|
|
193
|
+
`],wt([o()],Wi.prototype,"element",void 0),wt([o()],Wi.prototype,"variant",void 0),l("ft-typography")(Wi);var Di=function(t,i,e,o){for(var n,s=arguments.length,r=s<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,a=t.length-1;a>=0;a--)(n=t[a])&&(r=(s<3?n(r):s>3?n(i,e,r):n(i,e))||r);return s>3&&r&&Object.defineProperty(i,e,r),r};const Hi={distance:ht.create("--ft-tooltip-distance","SIZE","4px"),color:ht.create("--ft-tooltip-color","COLOR","#FFFFFF"),backgroundColor:ht.create("--ft-tooltip-background-color","COLOR","#666666"),zIndex:ht.create("--ft-tooltip-z-index","NUMBER","1"),borderRadiusS:ht.external(ct.borderRadiusS,"Design system"),maxWidth:ht.create("--ft-tooltip-max-width","SIZE","150px")};class Ki extends dt{constructor(){super(...arguments),this.text="",this.manual=!1,this.inline=!1,this.delay=500,this.position="bottom",this.visible=!1,this.hideDebounce=new i,this.revealDebouncer=new i}render(){return D`
|
|
194
194
|
<div part="container"
|
|
195
195
|
class="ft-tooltip--container ${this.inline?"ft-tooltip--inline":""}"
|
|
196
196
|
@mouseenter=${this.onHover}
|
|
@@ -200,12 +200,13 @@ const yt=Symbol.for(""),gt=t=>{if((null==t?void 0:t.r)===yt)return null==t?void
|
|
|
200
200
|
@touchstart=${this.onTouch}>
|
|
201
201
|
<div part="tooltip" class="ft-tooltip ft-tooltip--${this.position}" ?hidden=${!this.visible}>
|
|
202
202
|
<div part="tooltip-content" class="ft-tooltip--content">
|
|
203
|
-
<
|
|
203
|
+
<slot name="text"></slot>
|
|
204
|
+
<ft-typography variant="caption" ?hidden=${!this.text}>${this.text}</ft-typography>
|
|
204
205
|
</div>
|
|
205
206
|
</div>
|
|
206
207
|
<slot></slot>
|
|
207
208
|
</div>
|
|
208
|
-
`}update(t){t.has("visible")&&!this.visible&&this.resetTooltipContent(),super.update(t)}contentAvailableCallback(t){t.has("visible")&&this.visible&&this.positionTooltip()}show(t){this.visible=!0,null!=t&&this.hideDebounce.run((()=>this.hide()),t)}hide(){this.visible=!1}toggle(){this.visible=!this.visible}get slottedElement(){var t;return(null!==(t=this.slotNodes)&&void 0!==t?t:[]).filter((t=>t.nodeType==Node.ELEMENT_NODE))[0]}resetTooltipContent(){if(this.tooltip&&this.tooltipContent){const t=this.tooltipContent.style;switch(t.transition="none",this.position){case"top":t.top=this.tooltip.clientHeight+"px",t.left="0";break;case"bottom":t.top=-this.tooltip.clientHeight+"px",t.left="0";break;case"left":t.top="0",t.left=this.tooltip.clientWidth+"px";break;case"right":t.top="0",t.left=-this.tooltip.clientWidth+"px"}}}positionTooltip(){this.resetTooltipContent();const t=this.slottedElement;if(this.tooltip&&t){const i=t.getBoundingClientRect(),e=(i.height-this.tooltip.clientHeight)/2,o=(i.width-this.tooltip.clientWidth)/2;let n=0,s=0;switch(this.position){case"top":s=-this.tooltip.clientHeight,n=o;break;case"bottom":s=i.height,n=o;break;case"left":s=e,n=-this.tooltip.clientWidth;break;case"right":s=e,n=i.width}i.left+n+this.tooltip.clientWidth>window.innerWidth&&(n=window.innerWidth-this.tooltip.clientWidth-i.left),i.left+n<0&&(n=0);const r=this.tooltip.style;r.left=n+"px",r.top=s+"px",r.maxWidth
|
|
209
|
+
`}update(t){t.has("visible")&&!this.visible&&this.resetTooltipContent(),super.update(t)}contentAvailableCallback(t){t.has("visible")&&this.visible&&this.positionTooltip()}show(t){this.visible=!0,null!=t&&this.hideDebounce.run((()=>this.hide()),t)}hide(){this.visible=!1}toggle(){this.visible=!this.visible}get slottedElement(){var t;return(null!==(t=this.slotNodes)&&void 0!==t?t:[]).filter((t=>t.nodeType==Node.ELEMENT_NODE))[0]}resetTooltipContent(){if(this.tooltip&&this.tooltipContent){const t=this.tooltipContent.style;switch(t.transition="none",this.position){case"top":t.top=this.tooltip.clientHeight+"px",t.left="0";break;case"bottom":t.top=-this.tooltip.clientHeight+"px",t.left="0";break;case"left":t.top="0",t.left=this.tooltip.clientWidth+"px";break;case"right":t.top="0",t.left=-this.tooltip.clientWidth+"px"}}}positionTooltip(){this.resetTooltipContent();const t=this.slottedElement;if(this.tooltip&&t){const i=t.getBoundingClientRect(),e=(i.height-this.tooltip.clientHeight)/2,o=(i.width-this.tooltip.clientWidth)/2;let n=0,s=0;switch(this.position){case"top":s=-this.tooltip.clientHeight,n=o;break;case"bottom":s=i.height,n=o;break;case"left":s=e,n=-this.tooltip.clientWidth;break;case"right":s=e,n=i.width}i.left+n+this.tooltip.clientWidth>window.innerWidth&&(n=window.innerWidth-this.tooltip.clientWidth-i.left),i.left+n<0&&(n=0);const r=this.tooltip.style;r.left=n+"px",r.top=s+"px",r.maxWidth=`max(${i.width}px, ${Hi.maxWidth})`}this.revealDebouncer.run((()=>{this.tooltipContent&&(this.tooltipContent.style.transition="top var(--ft-transition-duration, 250ms), left var(--ft-transition-duration, 250ms)",this.tooltipContent.style.top="0",this.tooltipContent.style.left="0")}),this.manual?0:this.delay)}onTouch(){this.manual||(this.show(),setTimeout((()=>window.addEventListener("touchstart",(t=>{t.composedPath().includes(this.container)||this.onOut()}),{once:!0})),100))}onHover(){this.manual||this.show()}onOut(){this.manual||(this.revealDebouncer.cancel(),this.hide())}}Ki.elementDefinitions={"ft-typography":Wi},Ki.styles=d`
|
|
209
210
|
.ft-tooltip--container {
|
|
210
211
|
display: block;
|
|
211
212
|
position: relative;
|
|
@@ -221,7 +222,7 @@ const yt=Symbol.for(""),gt=t=>{if((null==t?void 0:t.r)===yt)return null==t?void
|
|
|
221
222
|
box-sizing: border-box;
|
|
222
223
|
overflow: hidden;
|
|
223
224
|
width: max-content;
|
|
224
|
-
max-width:
|
|
225
|
+
max-width: ${Hi.maxWidth};
|
|
225
226
|
text-align: center;
|
|
226
227
|
padding: ${Hi.distance};
|
|
227
228
|
z-index: ${Hi.zIndex};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-tooltip",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "A simple tooltip component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-typography": "0.3.
|
|
23
|
-
"@fluid-topics/ft-wc-utils": "0.3.
|
|
22
|
+
"@fluid-topics/ft-typography": "0.3.7",
|
|
23
|
+
"@fluid-topics/ft-wc-utils": "0.3.7",
|
|
24
24
|
"lit": "2.2.8"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "fe65a046ba9d3df70aac994a4e0aac1b550df72f"
|
|
27
27
|
}
|