@aquera/nile-elements 0.1.28-beta-1.4 → 0.1.28-beta-1.5

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.
@@ -1,30 +1,13 @@
1
- import{__decorate as t}from"tslib";import{s as i}from"./nile-tooltip.css.esm.js";import"../nile-popup/nile-popup.esm.js";import{p as s,s as e,a as o}from"../internal/animate.esm.js";import{classMap as h}from"lit/directives/class-map.js";import{query as a,property as l,customElement as n}from"lit/decorators.js";import{s as r,g as p}from"../utilities/animation-registry.esm.js";import{html as d}from"lit";import{w as c}from"../internal/event.esm.js";import{w as m}from"../internal/watch.esm.js";import{N as u}from"../internal/nile-element.esm.js";import"../nile-popup/nile-popup.css.esm.js";let f=class extends u{constructor(){super(...arguments),this.content="",this.size="small",this.placement="top",this.disabled=!1,this.distance=8,this.open=!1,this.skidding=0,this.trigger="hover focus",this.hoist=!1}static get styles(){return[i]}connectedCallback(){super.connectedCallback(),this.handleBlur=this.handleBlur.bind(this),this.handleClick=this.handleClick.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseOver=this.handleMouseOver.bind(this),this.handleMouseOut=this.handleMouseOut.bind(this),this.updateComplete.then((()=>{this.addEventListener("blur",this.handleBlur,!0),this.addEventListener("focus",this.handleFocus,!0),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("mouseover",this.handleMouseOver),this.addEventListener("mouseout",this.handleMouseOut)}))}firstUpdated(){this.body.hidden=!this.open,this.open&&(this.popup.active=!0,this.popup.reposition())}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("blur",this.handleBlur,!0),this.removeEventListener("focus",this.handleFocus,!0),this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("mouseover",this.handleMouseOver),this.removeEventListener("mouseout",this.handleMouseOut)}handleBlur(){this.hasTrigger("focus")&&this.hide()}handleClick(){this.hasTrigger("click")&&(this.open?this.hide():this.show())}handleFocus(){this.hasTrigger("focus")&&this.show()}handleKeyDown(t){this.open&&"Escape"===t.key&&(t.stopPropagation(),this.hide())}handleMouseOver(){if(this.hasTrigger("hover")){const t=s(getComputedStyle(this).getPropertyValue("--show-delay"));clearTimeout(this.hoverTimeout),this.hoverTimeout=window.setTimeout((()=>this.show()),t)}}handleMouseOut(){if(this.hasTrigger("hover")){const t=s(getComputedStyle(this).getPropertyValue("--hide-delay"));clearTimeout(this.hoverTimeout),this.hoverTimeout=window.setTimeout((()=>this.hide()),t)}}hasTrigger(t){return this.trigger.split(" ").includes(t)}async handleOpenChange(){if(this.open){if(this.disabled)return;this.emit("nile-show"),await e(this.body),this.body.hidden=!1,this.popup.active=!0;const{keyframes:t,options:i}=p(this,"tooltip.show",{dir:""});await o(this.popup.popup,t,i),this.emit("nile-after-show")}else{this.emit("nile-hide"),await e(this.body);const{keyframes:t,options:i}=p(this,"tooltip.hide",{dir:""});await o(this.popup.popup,t,i),this.popup.active=!1,this.body.hidden=!0,this.emit("nile-after-hide")}}async handleOptionsChange(){this.hasUpdated&&(await this.updateComplete,this.popup.reposition())}handleDisabledChange(){this.disabled&&this.open&&this.hide()}async show(){if(!this.open&&this.content?.trim().length)return this.open=!0,c(this,"nile-after-show")}async hide(){if(this.open)return this.open=!1,c(this,"nile-after-hide")}render(){return d`
2
- <nile-popup
3
- part="base"
4
- exportparts="
5
- popup:base__popup,
6
- arrow:base__arrow
7
- "
8
- class=${h({tooltip:!0,"tooltip--open":this.open})}
9
- placement=${this.placement}
10
- distance=${this.distance}
11
- skidding=${this.skidding}
12
- strategy=${this.hoist?"fixed":"absolute"}
13
- flip
14
- shift
15
- arrow
16
- >
17
- <slot slot="anchor" aria-describedby="tooltip"></slot>
18
-
19
- <slot
20
- name="content"
21
- part="body"
22
- id="tooltip"
23
- class=${h({tooltip__body:!0,"tooltip__body--large":"large"===this.size})}
24
- role="tooltip"
25
- aria-live=${this.open?"polite":"off"}
26
- >
27
- ${this.content}
28
- </slot>
29
- </nile-popup>
30
- `}};t([a("slot:not([name])")],f.prototype,"defaultSlot",void 0),t([a(".tooltip__body")],f.prototype,"body",void 0),t([a("nile-popup")],f.prototype,"popup",void 0),t([l({type:String,reflect:!0})],f.prototype,"content",void 0),t([l({reflect:!0})],f.prototype,"size",void 0),t([l()],f.prototype,"placement",void 0),t([l({type:Boolean,reflect:!0})],f.prototype,"disabled",void 0),t([l({type:Number})],f.prototype,"distance",void 0),t([l({type:Boolean,reflect:!0})],f.prototype,"open",void 0),t([l({type:Number})],f.prototype,"skidding",void 0),t([l()],f.prototype,"trigger",void 0),t([l({type:Boolean})],f.prototype,"hoist",void 0),t([m("open",{waitUntilFirstUpdate:!0})],f.prototype,"handleOpenChange",null),t([m(["content","distance","hoist","placement","skidding"])],f.prototype,"handleOptionsChange",null),t([m("disabled")],f.prototype,"handleDisabledChange",null),f=t([n("nile-tooltip")],f),r("tooltip.show",{keyframes:[{opacity:0,scale:.8},{opacity:1,scale:1}],options:{duration:150,easing:"ease"}}),r("tooltip.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.8}],options:{duration:150,easing:"ease"}});export{f as N};
1
+ import{__decorate as t}from"tslib";import{html as i}from"lit";import{property as s,query as e,customElement as o}from"lit/decorators.js";import{classMap as h}from"lit/directives/class-map.js";import{s as r}from"./nile-tooltip.css.esm.js";import{N as l}from"../internal/nile-element.esm.js";let n=class extends l{constructor(){super(...arguments),this.content="",this.size="small",this.placement="top",this.disabled=!1,this.open=!1,this.trigger="hover focus",this.distance=8,this.skidding=0,this.hoist=!1,this.updateTooltipPosition=()=>{if(!this.tooltip||!this.open)return;const t=this.slotElement.assignedElements()[0];if(!t)return;const i=t.getBoundingClientRect(),s=this.tooltip.getBoundingClientRect(),e=window.innerWidth,o=window.innerHeight;let h=0,r=0,l=this.placement;const n=this.getBasePlacement(this.placement),a=this.getAlignmentModifier(this.placement),d=i.left-s.width-this.distance>0,c=i.right+s.width+this.distance<e,p=i.bottom+s.height+this.distance<o,m=i.top-s.height-this.distance>0;let u=n;"left"===n&&!d||"right"===n&&!c?u=p?"bottom":m?"top":"bottom":"top"!==n||m?"bottom"!==n||p||(u=m?"top":d?"left":"right"):u=p?"bottom":d?"left":"right";let f=a;switch("left"!==n&&"right"!==n||"top"!==u&&"bottom"!==u||("start"===a?f="start":"end"===a&&(f="end")),u){case"left":h=i.top+(i.height-s.height)/2+this.skidding,r=i.left-s.width-this.distance;break;case"right":h=i.top+(i.height-s.height)/2+this.skidding,r=i.right+this.distance;break;case"top":h=i.top-s.height-this.distance,r=i.left+(i.width-s.width)/2+this.skidding;break;case"bottom":h=i.bottom+this.distance,r=i.left+(i.width-s.width)/2+this.skidding}"top"!==u&&"bottom"!==u||!f||("start"===f?r=i.left+this.skidding:"end"===f&&(r=i.right-s.width+this.skidding)),"left"!==u&&"right"!==u||!f||("start"===f?h=i.top+this.skidding:"end"===f&&(h=i.bottom-s.height+this.skidding)),l=f?`${u}-${f}`:u,r<0&&(r=5),r+s.width>e&&(r=e-s.width-5),h<0&&(h=5),h+s.height>o&&(h=o-s.height-5),this.tooltip.style.top=`${h}px`,this.tooltip.style.left=`${r}px`,this.tooltip.setAttribute("data-placement",l)},this.showTooltip=()=>{this.disabled||(this.open=!0,this.emit("nile-show"),this.updateComplete.then((()=>{this.updateTooltipPosition(),this.tooltip.addEventListener("transitionend",this.handleAfterShow,{once:!0})})))},this.handleAfterShow=()=>{this.emit("nile-after-show")},this.hideTooltip=()=>{this.open&&(this.emit("nile-hide"),this.open=!1,this.tooltip.addEventListener("transitionend",this.handleAfterHide,{once:!0}))},this.handleAfterHide=()=>{this.emit("nile-after-hide")},this.handleMouseOver=()=>{this.trigger.includes("hover")&&(clearTimeout(this.hoverTimeout),this.hoverTimeout=window.setTimeout((()=>this.showTooltip()),150))},this.handleMouseOut=()=>{this.trigger.includes("hover")&&(clearTimeout(this.hoverTimeout),this.hoverTimeout=window.setTimeout((()=>this.hideTooltip()),0))},this.handleClick=()=>{this.trigger.includes("click")&&(this.open=!this.open,this.emit("nile-show"),this.updateComplete.then((()=>this.updateTooltipPosition())))},this.handleFocus=()=>{this.trigger.includes("focus")&&this.showTooltip()},this.handleBlur=()=>{this.trigger.includes("focus")&&this.hideTooltip()}}static get styles(){return[r]}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.updateTooltipPosition),window.addEventListener("scroll",this.updateTooltipPosition,!0)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.updateTooltipPosition),window.removeEventListener("scroll",this.updateTooltipPosition,!0)}getBasePlacement(t){return t.split("-")[0]}getAlignmentModifier(t){const i=t.split("-");return i.length>1?i[1]:null}updated(t){super.updated(t),(t.has("open")||t.has("hoist"))&&this.open&&this.hoist}render(){return i`
2
+ <div class=${h({tooltip:!0,"tooltip__body--large":"large"===this.size})}>
3
+ ${this.content}
4
+ </div>
5
+ <slot
6
+ @mouseover=${this.handleMouseOver}
7
+ @mouseout=${this.handleMouseOut}
8
+ @click=${this.handleClick}
9
+ @focus=${this.handleFocus}
10
+ @blur=${this.handleBlur}
11
+ aria-describedby="tooltip"
12
+ ></slot>
13
+ `}};t([s({type:String})],n.prototype,"content",void 0),t([s({reflect:!0})],n.prototype,"size",void 0),t([s({type:String})],n.prototype,"placement",void 0),t([s({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0),t([s({type:Boolean,reflect:!0})],n.prototype,"open",void 0),t([s()],n.prototype,"trigger",void 0),t([s({type:Number})],n.prototype,"distance",void 0),t([s({type:Number})],n.prototype,"skidding",void 0),t([s({type:Boolean})],n.prototype,"hoist",void 0),t([e(".tooltip")],n.prototype,"tooltip",void 0),t([e("slot")],n.prototype,"slotElement",void 0),n=t([o("nile-tooltip")],n);export{n as N};
@@ -9,60 +9,119 @@ import { css } from 'lit';
9
9
  * Tooltip CSS
10
10
  */
11
11
  export const styles = css `
12
- :host {
13
- --max-width: 20rem;
14
- --hide-delay: 0ms;
15
- --show-delay: 150ms;
16
-
17
- display: contents;
18
- }
19
-
20
- .tooltip {
21
- --arrow-size: 6px;
22
- --arrow-color: var(--nile-tooltip-color-background);
23
- }
24
-
25
- .tooltip::part(popup) {
26
- pointer-events: none;
27
- z-index: 1000;
28
- }
29
-
30
- .tooltip[placement^='top']::part(popup) {
31
- transform-origin: bottom;
32
- }
33
-
34
- .tooltip[placement^='bottom']::part(popup) {
35
- transform-origin: top;
36
- }
37
-
38
- .tooltip[placement^='left']::part(popup) {
39
- transform-origin: right;
40
- }
41
-
42
- .tooltip[placement^='right']::part(popup) {
43
- transform-origin: left;
44
- }
45
-
46
- .tooltip__body {
47
- display: block;
48
- width: max-content;
49
- max-width: var(--max-width);
50
- border-radius: 4px;
51
- background-color: var(--nile-tooltip-color-background);
52
- font-size: var(--nile-tooltip-font-size-sm);
53
- font-weight: var(--nile-tooltip-font-weight-sm);
54
- line-height: var(--nile-tooltip-line-height-sm);
55
- padding: var(--nile-tooltip-padding-y) var(--nile-tooltip-padding-x);
56
- color: var(--nile-colors-white-base);
57
- pointer-events: none;
58
- word-break: break-word;
59
- }
60
-
61
- .tooltip__body--large {
62
- font-size: var(--nile-tooltip-font-size-lg);
63
- line-height: var(--nile-tooltip-line-height-lg);
64
- font-weight: var(--nile-tooltip-font-weight-lg);
65
- }
12
+
13
+
14
+ :host {
15
+ position: relative;
16
+ display: inline-block;
17
+ }
18
+
19
+ .tooltip {
20
+ position: fixed;
21
+ z-index: 1000;
22
+ background-color: var(--nile-tooltip-color-background, #333);
23
+ color: var(--nile-colors-white-base, #fff);
24
+ padding: 6px 10px;
25
+ border-radius: 4px;
26
+ font-size: var(--nile-tooltip-font-size-sm, 14px);
27
+ line-height: var(--nile-tooltip-line-height-sm, 1.5);
28
+ opacity: 0;
29
+ transition: opacity 0.2s, transform 0.2s;
30
+ pointer-events: none;
31
+ white-space: nowrap;
32
+ visibility: hidden;
33
+ transform: scale(0.95);
34
+ transition: opacity 0.2s ease-out, transform 0.2s ease-out;
35
+ }
36
+
37
+ .tooltip[open] {
38
+ opacity: 1;
39
+ transform: scale(1);
40
+ }
41
+
42
+ :host([open]) .tooltip {
43
+ opacity: 1;
44
+ visibility: visible;
45
+ pointer-events: auto;
46
+ }
47
+
48
+ .tooltip__body--large {
49
+ font-size: var(--nile-type-scale-4, 16px);
50
+ line-height: var(--nile-tooltip-line-height-lg, 1.75);
51
+ }
52
+
53
+ /* Tooltip Arrow */
54
+ .tooltip::after {
55
+ content: '';
56
+ position: absolute;
57
+ width: 0;
58
+ height: 0;
59
+ border-style: solid;
60
+ }
61
+
62
+ /* Basic Arrow Positions */
63
+ .tooltip[data-placement^="top"]::after {
64
+ bottom: -6px;
65
+ border-width: 6px 6px 0 6px;
66
+ border-color: var(--nile-tooltip-color-background, #333) transparent transparent transparent;
67
+ }
68
+
69
+ .tooltip[data-placement^="bottom"]::after {
70
+ top: -6px;
71
+ border-width: 0 6px 6px 6px;
72
+ border-color: transparent transparent var(--nile-tooltip-color-background, #333) transparent;
73
+ }
74
+
75
+ .tooltip[data-placement^="left"]::after {
76
+ right: -6px;
77
+ border-width: 6px 0 6px 6px;
78
+ border-color: transparent transparent transparent var(--nile-tooltip-color-background, #333);
79
+ }
80
+
81
+ .tooltip[data-placement^="right"]::after {
82
+ left: -6px;
83
+ border-width: 6px 6px 6px 0;
84
+ border-color: transparent var(--nile-tooltip-color-background, #333) transparent transparent;
85
+ }
86
+
87
+ /* Arrow Horizontal Alignment for top/bottom placements */
88
+ .tooltip[data-placement="top"]::after,
89
+ .tooltip[data-placement="bottom"]::after {
90
+ left: 50%;
91
+ transform: translateX(-50%);
92
+ }
93
+
94
+ .tooltip[data-placement="top-start"]::after,
95
+ .tooltip[data-placement="bottom-start"]::after {
96
+ left: 12px;
97
+ }
98
+
99
+ .tooltip[data-placement="top-end"]::after,
100
+ .tooltip[data-placement="bottom-end"]::after {
101
+ right: 12px;
102
+ left: auto;
103
+ }
104
+
105
+ /* Arrow Vertical Alignment for left/right placements */
106
+ .tooltip[data-placement="left"]::after,
107
+ .tooltip[data-placement="right"]::after {
108
+ top: 50%;
109
+ transform: translateY(-50%);
110
+ }
111
+
112
+ .tooltip[data-placement="left-start"]::after,
113
+ .tooltip[data-placement="right-start"]::after {
114
+ top: 12px;
115
+ transform: none;
116
+ }
117
+
118
+ .tooltip[data-placement="left-end"]::after,
119
+ .tooltip[data-placement="right-end"]::after {
120
+ bottom: 12px;
121
+ top: auto;
122
+ transform: none;
123
+ }
124
+
66
125
  `;
67
126
  export default [styles];
68
127
  //# sourceMappingURL=nile-tooltip.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-tooltip.css.js","sourceRoot":"","sources":["../../../src/nile-tooltip/nile-tooltip.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * Tooltip CSS\n */\nexport const styles = css`\n :host {\n --max-width: 20rem;\n --hide-delay: 0ms;\n --show-delay: 150ms;\n\n display: contents;\n }\n\n .tooltip {\n --arrow-size: 6px;\n --arrow-color: var(--nile-tooltip-color-background);\n }\n\n .tooltip::part(popup) {\n pointer-events: none;\n z-index: 1000;\n }\n\n .tooltip[placement^='top']::part(popup) {\n transform-origin: bottom;\n }\n\n .tooltip[placement^='bottom']::part(popup) {\n transform-origin: top;\n }\n\n .tooltip[placement^='left']::part(popup) {\n transform-origin: right;\n }\n\n .tooltip[placement^='right']::part(popup) {\n transform-origin: left;\n }\n\n .tooltip__body {\n display: block;\n width: max-content;\n max-width: var(--max-width);\n border-radius: 4px;\n background-color: var(--nile-tooltip-color-background);\n font-size: var(--nile-tooltip-font-size-sm);\n font-weight: var(--nile-tooltip-font-weight-sm);\n line-height: var(--nile-tooltip-line-height-sm);\n padding: var(--nile-tooltip-padding-y) var(--nile-tooltip-padding-x);\n color: var(--nile-colors-white-base);\n pointer-events: none;\n word-break: break-word;\n }\n\n .tooltip__body--large {\n font-size: var(--nile-tooltip-font-size-lg);\n line-height: var(--nile-tooltip-line-height-lg);\n font-weight: var(--nile-tooltip-font-weight-lg);\n }\n`;\n\nexport default [styles];\n"]}
1
+ {"version":3,"file":"nile-tooltip.css.js","sourceRoot":"","sources":["../../../src/nile-tooltip/nile-tooltip.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkHxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * Tooltip CSS\n */\nexport const styles = css`\n\n\n:host {\n position: relative;\n display: inline-block;\n }\n\n .tooltip {\n position: fixed;\n z-index: 1000;\n background-color: var(--nile-tooltip-color-background, #333);\n color: var(--nile-colors-white-base, #fff);\n padding: 6px 10px;\n border-radius: 4px;\n font-size: var(--nile-tooltip-font-size-sm, 14px);\n line-height: var(--nile-tooltip-line-height-sm, 1.5);\n opacity: 0;\n transition: opacity 0.2s, transform 0.2s;\n pointer-events: none;\n white-space: nowrap;\n visibility: hidden;\n transform: scale(0.95);\n transition: opacity 0.2s ease-out, transform 0.2s ease-out;\n }\n\n .tooltip[open] {\n opacity: 1;\n transform: scale(1);\n}\n\n :host([open]) .tooltip {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n }\n\n .tooltip__body--large {\n font-size: var(--nile-type-scale-4, 16px);\n line-height: var(--nile-tooltip-line-height-lg, 1.75);\n }\n\n /* Tooltip Arrow */\n .tooltip::after {\n content: '';\n position: absolute;\n width: 0;\n height: 0;\n border-style: solid;\n }\n\n /* Basic Arrow Positions */\n .tooltip[data-placement^=\"top\"]::after {\n bottom: -6px;\n border-width: 6px 6px 0 6px;\n border-color: var(--nile-tooltip-color-background, #333) transparent transparent transparent;\n }\n\n .tooltip[data-placement^=\"bottom\"]::after {\n top: -6px;\n border-width: 0 6px 6px 6px;\n border-color: transparent transparent var(--nile-tooltip-color-background, #333) transparent;\n }\n\n .tooltip[data-placement^=\"left\"]::after {\n right: -6px;\n border-width: 6px 0 6px 6px;\n border-color: transparent transparent transparent var(--nile-tooltip-color-background, #333);\n }\n\n .tooltip[data-placement^=\"right\"]::after {\n left: -6px;\n border-width: 6px 6px 6px 0;\n border-color: transparent var(--nile-tooltip-color-background, #333) transparent transparent;\n }\n\n /* Arrow Horizontal Alignment for top/bottom placements */\n .tooltip[data-placement=\"top\"]::after,\n .tooltip[data-placement=\"bottom\"]::after {\n left: 50%;\n transform: translateX(-50%);\n }\n\n .tooltip[data-placement=\"top-start\"]::after,\n .tooltip[data-placement=\"bottom-start\"]::after {\n left: 12px;\n }\n\n .tooltip[data-placement=\"top-end\"]::after,\n .tooltip[data-placement=\"bottom-end\"]::after {\n right: 12px;\n left: auto;\n }\n\n /* Arrow Vertical Alignment for left/right placements */\n .tooltip[data-placement=\"left\"]::after,\n .tooltip[data-placement=\"right\"]::after {\n top: 50%;\n transform: translateY(-50%);\n }\n\n .tooltip[data-placement=\"left-start\"]::after,\n .tooltip[data-placement=\"right-start\"]::after {\n top: 12px;\n transform: none;\n }\n\n .tooltip[data-placement=\"left-end\"]::after,\n .tooltip[data-placement=\"right-end\"]::after {\n bottom: 12px;\n top: auto;\n transform: none;\n }\n \n`;\n\nexport default [styles];\n"]}
@@ -1,80 +1,40 @@
1
- /**
2
- * Copyright Aquera Inc 2023
3
- *
4
- * This source code is licensed under the BSD-3-Clause license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { CSSResultArray, TemplateResult } from 'lit';
8
- import '../nile-popup/nile-popup';
1
+ import { CSSResultArray } from 'lit';
9
2
  import NileElement from '../internal/nile-element';
10
- import type NilePopup from '../nile-popup/nile-popup';
11
- /**
12
- * Nile icon component.
13
- *
14
- * @tag nile-tooltip
15
- *
16
- */
3
+ type TooltipPlacement = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
17
4
  export declare class NileTooltip extends NileElement {
18
- /**
19
- * The styles for Tooltip
20
- * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
21
- */
22
- static get styles(): CSSResultArray;
23
- private hoverTimeout;
24
- defaultSlot: HTMLSlotElement;
25
- body: HTMLElement;
26
- popup: NilePopup;
27
- /** The tooltip's content. If you need to display HTML, use the `content` slot instead. */
28
5
  content: string;
29
- /** Size Property to decide the tool tip size */
30
6
  size: 'small' | 'large';
31
- /**
32
- * The preferred placement of the tooltip. Note that the actual placement may vary as needed to keep the tooltip
33
- * inside of the viewport.
34
- */
35
- placement: 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
36
- /** Disables the tooltip so it won't show when triggered. */
7
+ placement: TooltipPlacement;
37
8
  disabled: boolean;
38
- /** The distance in pixels from which to offset the tooltip away from its target. */
39
- distance: number;
40
- /** Indicates whether or not the tooltip is open. You can use this in lieu of the show/hide methods. */
41
9
  open: boolean;
42
- /** The distance in pixels from which to offset the tooltip along its target. */
43
- skidding: number;
44
- /**
45
- * Controls how the tooltip is activated. Possible options include `click`, `hover`, `focus`, and `manual`. Multiple
46
- * options can be passed by separating them with a space. When manual is used, the tooltip must be activated
47
- * programmatically.
48
- */
49
10
  trigger: string;
50
- /**
51
- * Enable this option to prevent the tooltip from being clipped when the component is placed inside a container with
52
- * `overflow: auto|hidden|scroll`. Hoisting uses a fixed positioning strategy that works in many, but not all,
53
- * scenarios.
54
- */
11
+ distance: number;
12
+ skidding: number;
55
13
  hoist: boolean;
14
+ tooltip: HTMLElement;
15
+ slotElement: HTMLSlotElement;
16
+ private hoverTimeout;
17
+ static get styles(): CSSResultArray;
56
18
  connectedCallback(): void;
57
- firstUpdated(): void;
58
19
  disconnectedCallback(): void;
59
- private handleBlur;
60
- private handleClick;
61
- private handleFocus;
62
- private handleKeyDown;
20
+ private getBasePlacement;
21
+ private getAlignmentModifier;
22
+ private updateTooltipPosition;
23
+ private showTooltip;
24
+ private handleAfterShow;
25
+ private hideTooltip;
26
+ private handleAfterHide;
63
27
  private handleMouseOver;
64
28
  private handleMouseOut;
65
- private hasTrigger;
66
- handleOpenChange(): Promise<void>;
67
- handleOptionsChange(): Promise<void>;
68
- handleDisabledChange(): void;
69
- /** Shows the tooltip. */
70
- show(): Promise<void>;
71
- /** Hides the tooltip */
72
- hide(): Promise<void>;
73
- render(): TemplateResult<1>;
29
+ private handleClick;
30
+ updated(changedProperties: Map<string, any>): void;
31
+ private handleFocus;
32
+ private handleBlur;
33
+ render(): import("lit-html").TemplateResult<1>;
74
34
  }
75
- export default NileTooltip;
76
35
  declare global {
77
36
  interface HTMLElementTagNameMap {
78
37
  'nile-tooltip': NileTooltip;
79
38
  }
80
39
  }
40
+ export {};