@nuralyui/tooltips 0.0.6 → 0.0.8
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/bundle.js +123 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/react.js.map +1 -1
- package/tooltips.component.d.ts +1 -1
- package/tooltips.component.js.map +1 -1
- package/tooltips.constant.js.map +1 -1
- package/tooltips.style.js.map +1 -1
- package/tooltips.variables.js.map +1 -1
package/bundle.js
CHANGED
|
@@ -1 +1,123 @@
|
|
|
1
|
-
import{css as t,LitElement as i,html as o,nothing as s}from"lit";import{property as n,state as e,customElement as h}from"lit/decorators.js";const r=[t
|
|
1
|
+
import{css as t,LitElement as i,html as o,nothing as s}from"lit";import{property as n,state as e,customElement as h}from"lit/decorators.js";const r=[t`
|
|
2
|
+
:host([show]) {
|
|
3
|
+
background-color: var(--nuraly-tooltip-background-color);
|
|
4
|
+
color: var(--nuraly-tooltip-text-color);
|
|
5
|
+
position: fixed;
|
|
6
|
+
padding: 5px;
|
|
7
|
+
text-align: center;
|
|
8
|
+
opacity: 0;
|
|
9
|
+
font-size: 14px;
|
|
10
|
+
z-index: 9999;
|
|
11
|
+
border-radius: 4px;
|
|
12
|
+
animation-name: show-animation;
|
|
13
|
+
animation-duration: 0.4s;
|
|
14
|
+
animation-fill-mode: forwards;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.popconfirm-container {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
}
|
|
21
|
+
.btn-block {
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: end;
|
|
24
|
+
gap: 10px;
|
|
25
|
+
margin: 10px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.popconfirm-description,
|
|
29
|
+
.popconfirm-title {
|
|
30
|
+
margin: 5px;
|
|
31
|
+
text-align: left;
|
|
32
|
+
}
|
|
33
|
+
.popconfirm-title {
|
|
34
|
+
font-weight: bold;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@keyframes show-animation {
|
|
38
|
+
from {
|
|
39
|
+
opacity: 0;
|
|
40
|
+
}
|
|
41
|
+
to {
|
|
42
|
+
opacity: 1;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:host::after {
|
|
47
|
+
content: '';
|
|
48
|
+
height: 0;
|
|
49
|
+
width: 0;
|
|
50
|
+
position: absolute;
|
|
51
|
+
border: 5px solid transparent;
|
|
52
|
+
}
|
|
53
|
+
:host(.top-position)::after {
|
|
54
|
+
border-top-color: var(--nuraly-tooltip-background-color);
|
|
55
|
+
top: 100%;
|
|
56
|
+
}
|
|
57
|
+
:host(.left-position)::after {
|
|
58
|
+
border-left-color: var(--nuraly-tooltip-background-color);
|
|
59
|
+
left: 100%;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:host(.right-position)::after {
|
|
63
|
+
border-right-color: var(--nuraly-tooltip-background-color);
|
|
64
|
+
right: 100%;
|
|
65
|
+
}
|
|
66
|
+
:host(.bottom-position)::after {
|
|
67
|
+
border-bottom-color: var(--nuraly-tooltip-background-color);
|
|
68
|
+
bottom: 100%;
|
|
69
|
+
}
|
|
70
|
+
:host(.alignement-center.top-position)::after,
|
|
71
|
+
:host(.alignement-center.bottom-position)::after {
|
|
72
|
+
right: 50%;
|
|
73
|
+
transform: translate(50%);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:host(.alignement-start.top-position)::after,
|
|
77
|
+
:host(.alignement-start.bottom-position)::after {
|
|
78
|
+
left: 4%;
|
|
79
|
+
}
|
|
80
|
+
:host(.top-position.alignement-end)::after,
|
|
81
|
+
:host(.alignement-end.bottom-position)::after {
|
|
82
|
+
right: 4%;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
:host(.alignement-center.left-position)::after,
|
|
86
|
+
:host(.alignement-center.right-position)::after {
|
|
87
|
+
top: 50%;
|
|
88
|
+
transform: translate(0%, -50%);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:host(.alignement-start.left-position)::after,
|
|
92
|
+
:host(.alignement-start.right-position)::after {
|
|
93
|
+
top: 5px;
|
|
94
|
+
}
|
|
95
|
+
:host(.alignement-end.left-position)::after,
|
|
96
|
+
:host(.alignement-end.right-position)::after {
|
|
97
|
+
bottom: 5px;
|
|
98
|
+
}
|
|
99
|
+
`,t`
|
|
100
|
+
:host {
|
|
101
|
+
--nuraly-tooltip-background-color: #393939;
|
|
102
|
+
--nuraly-tooltip-text-color: #ffffff;
|
|
103
|
+
}
|
|
104
|
+
@media (prefers-color-scheme: dark) {
|
|
105
|
+
:host {
|
|
106
|
+
--nuraly-tooltip-background-color: #f4f4f4;
|
|
107
|
+
--nuraly-tooltip-text-color: #161616;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
`];var a,l;!function(t){t.Top="top",t.Bottom="bottom",t.Right="right",t.Left="left"}(a||(a={})),function(t){t.Start="start",t.Center="center",t.End="end"}(l||(l={}));var p=function(t,i,o,s){for(var n,e=arguments.length,h=e<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,o):s,r=t.length-1;r>=0;r--)(n=t[r])&&(h=(e<3?n(h):e>3?n(i,o,h):n(i,o))||h);return e>3&&h&&Object.defineProperty(i,o,h),h};let c=class extends i{constructor(){super(...arguments),this.position=a.Bottom,this.alignement=l.Center,this.show=!1,this.isPopConfirm=!1,this.popConfirmTitle="",this.popConfirmDescription="",this.okText="Yes",this.cancelText="No",this.horizontalOffset=10,this.verticalOffset=10,this.onMouseOver=()=>{this.show=!0},this.onMouseLeave=()=>{this.show=!1,this.initStyles()},this.onClick=()=>{this.show=!this.show},this.calculatePosition=()=>{this.initStyles(),this.style.width=`${this.clientWidth}px`,this.position==a.Bottom||this.position==a.Top?(this.calculateYposition(),this.calculateYalignement()):(this.calculateXposition(),this.calculateXalignement())},this.calculateYposition=()=>{const t=this.target.getBoundingClientRect(),i=t.bottom,o=t.top,s=window.visualViewport.height,n=this.clientHeight,e=n+this.verticalOffset<s-i,h=n+this.verticalOffset<o;this.position==a.Bottom?e||!h?(this.classList.add("bottom-position"),this.style.top=`${i+this.verticalOffset}px`):(this.classList.add("top-position"),this.style.top=o-n-this.verticalOffset+"px"):h||!e?(this.classList.add("top-position"),this.style.top=o-n-this.verticalOffset+"px"):(this.classList.add("bottom-position"),this.style.top=`${i+this.verticalOffset}px`)},this.calculateYalignement=()=>{const t=this.target.getBoundingClientRect(),i=t.right,o=t.width,s=t.left,n=this.clientWidth,e=s+o/2,h=window.visualViewport.width,r=h-i+o/2;if(this.alignement==l.Start){n+s<h?(this.classList.add("alignement-start"),this.style.left=s-this.horizontalOffset+"px"):(this.classList.add("alignement-end"),this.style.left=`${s-n+this.horizontalOffset}px`)}else if(this.alignement==l.End){n<s?(this.classList.add("alignement-end"),this.style.left=`${s-n+this.horizontalOffset}px`):(this.classList.add("alignement-start"),this.style.left=s-this.horizontalOffset+"px")}else{const t=n<e;n/2<e&&n/2<r||n>e&&n>r?(this.classList.add("alignement-center"),this.style.left=s-n/2+o/2+"px"):t?(this.classList.add("alignement-end"),this.style.left=`${s-n+this.horizontalOffset}px`):(this.classList.add("alignement-start"),this.style.left=s-this.horizontalOffset+"px")}},this.calculateXposition=()=>{const t=this.target.getBoundingClientRect(),i=t.left,o=t.right,s=window.visualViewport.width,n=this.clientWidth,e=n+this.horizontalOffset<s-o,h=n+this.horizontalOffset<i;this.position==a.Right?e||!h?(this.classList.add("right-position"),this.style.left=`${o+this.horizontalOffset}px`):(this.classList.add("left-position"),this.style.left=i-n-this.horizontalOffset+"px"):h||!e?(this.classList.add("left-position"),this.style.left=i-n-this.horizontalOffset+"px"):(this.classList.add("right-position"),this.style.left=`${o+this.horizontalOffset}px`)},this.calculateXalignement=()=>{const t=this.target.getBoundingClientRect(),i=t.top,o=t.height,s=t.bottom,n=this.clientHeight,e=window.visualViewport.height,h=e-s;if(this.alignement==l.End){n<i?(this.classList.add("alignement-end"),this.style.top=s-n+"px"):(this.classList.add("alignement-start"),this.style.top=i-o/4+"px")}else if(this.alignement==l.Start){n<e-s?(this.classList.add("alignement-start"),this.style.top=i-o/4+"px"):(this.classList.add("alignement-end"),this.style.top=s-n+"px")}else{const t=n<i;n/2<i&&n/2<h||n>i&&n>h?(this.classList.add("alignement-center"),this.style.top=i+o/2-n/2+"px"):t?(this.classList.add("alignement-end"),this.style.top=s-n+"px"):(this.classList.add("alignement-start"),this.style.top=i-o/4+"px")}},this.onClickOutside=t=>{const i=t.composedPath();!i.includes(this.target)&&!i.includes(this)&&(this.show=!1)}}connectedCallback(){super.connectedCallback(),this.target=this.target||this.previousElementSibling,this.target?this.isPopConfirm?(document.addEventListener("scroll",this.calculatePosition),this.target.addEventListener("click",this.onClick),document.addEventListener("click",this.onClickOutside)):(this.target.addEventListener("mouseover",this.onMouseOver),this.target.addEventListener("mouseleave",this.onMouseLeave)):console.error("Tooltip target is not defined or found. Ensure target is explicitly set or precedes the tooltip.")}initStyles(){this.style.top="",this.style.left="",this.style.width="",this.classList.remove(...this.classList.values())}updated(t){this.show&&this.calculatePosition()}onPopConfirmCancel(){this.dispatchEvent(new CustomEvent("onCancel")),this.show=!1,this.initStyles()}onPopConfirmConfirm(){this.dispatchEvent(new CustomEvent("onConfirm")),this.show=!1,this.initStyles()}disconnectedCallback(){super.disconnectedCallback(),this.isPopConfirm?(this.target.removeEventListener("click",this.onClick),document.removeEventListener("scroll",this.calculatePosition)):(this.target.removeEventListener("mouseover",this.onMouseOver),this.target.removeEventListener("mouseleave",this.onMouseLeave))}render(){return this.isPopConfirm?this.show?o`
|
|
111
|
+
<div class="popconfirm-container">
|
|
112
|
+
<p class="popconfirm-title">${this.popConfirmTitle}</p>
|
|
113
|
+
<p class="popconfirm-description">${this.popConfirmDescription}</p>
|
|
114
|
+
<div class="btn-block">
|
|
115
|
+
<nr-button .size=${"small"} type=${"primary"} @click=${this.onPopConfirmConfirm}
|
|
116
|
+
>${this.okText}</nr-button
|
|
117
|
+
>
|
|
118
|
+
<nr-button .size=${"small"} type=${"danger"} @click=${this.onPopConfirmCancel}
|
|
119
|
+
>${this.cancelText}</nr-button
|
|
120
|
+
>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
`:s:this.show?o`<slot></slot>`:s}};c.styles=r,p([n({reflect:!0})],c.prototype,"position",void 0),p([n({reflect:!0})],c.prototype,"alignement",void 0),p([e()],c.prototype,"target",void 0),p([n({reflect:!0,type:Boolean})],c.prototype,"show",void 0),p([n()],c.prototype,"isPopConfirm",void 0),p([n()],c.prototype,"popConfirmTitle",void 0),p([n()],c.prototype,"popConfirmDescription",void 0),p([n()],c.prototype,"okText",void 0),p([n()],c.prototype,"cancelText",void 0),c=p([h("hy-tooltip")],c);export{c as TooltipElement};
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/tooltips/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC","sourcesContent":["export * from './tooltips.component.js';\n"]}
|
package/package.json
CHANGED
package/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../../src/components/tooltips/react.ts"],"names":[],"mappings":"","sourcesContent":[""]}
|
package/tooltips.component.d.ts
CHANGED
|
@@ -28,6 +28,6 @@ export declare class TooltipElement extends LitElement {
|
|
|
28
28
|
onPopConfirmConfirm(): void;
|
|
29
29
|
onClickOutside: (onClickEvent: Event) => void;
|
|
30
30
|
disconnectedCallback(): void;
|
|
31
|
-
render(): typeof nothing | import("lit").TemplateResult<1>;
|
|
31
|
+
render(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
32
32
|
}
|
|
33
33
|
//# sourceMappingURL=tooltips.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1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AAC,iBAAiB,CAAC,CAAC;SAChE;IACH,CAAC;IAEQ,MAAM;QACb,OAAO,CAAC,IAAI,CAAC,YAAY;YACvB,CAAC,CAAC,IAAI,CAAC,IAAI;gBACT,CAAC,CAAC,IAAI,CAAA,eAAe;gBACrB,CAAC,CAAC,OAAO;YACX,CAAC,CAAC,IAAI,CAAC,IAAI;gBACX,CAAC,CAAC,IAAI,CAAA;;0CAE8B,IAAI,CAAC,eAAe;gDACd,IAAI,CAAC,qBAAqB;;iCAEzC,OAAO,SAAS,SAAS,WAAW,IAAI,CAAC,mBAAmB;mBAC1E,IAAI,CAAC,MAAM;;iCAEG,OAAO,SAAS,QAAQ,WAAW,IAAI,CAAC,kBAAkB;mBACxE,IAAI,CAAC,UAAU;;;;SAIzB;gBACH,CAAC,CAAC,OAAO,CAAC;IACd,CAAC;CACF,CAAA;AAlRiB,qBAAM,GAAG,MAAO,CAAA;AAGhC;IADC,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;gDACQ;AAGlC;IADC,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;kDACW;AAGrC;IADC,KAAK,EAAE;8CACS;AAEjB;IADC,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAC,CAAC;4CAC5B;AAEb;IADC,QAAQ,EAAE;oDACU;AAErB;IADC,QAAQ,EAAE;uDACU;AAErB;IADC,QAAQ,EAAE;6DACgB;AAE3B;IADC,QAAQ,EAAE;8CACI;AAEf;IADC,QAAQ,EAAE;kDACO;AAtBP,cAAc;IAD1B,aAAa,CAAC,YAAY,CAAC;GACf,cAAc,CAmR1B;SAnRY,cAAc","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { html, LitElement, nothing, PropertyValueMap } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { styles } from './tooltips.style.js';\nimport { EMPTY_STRING, TooltipAlignment, TooltipPosition } from './tooltips.constant.js';\n@customElement('hy-tooltip')\nexport class TooltipElement extends LitElement {\n static override styles = styles;\n\n @property({reflect: true})\n position = TooltipPosition.Bottom;\n\n @property({reflect: true})\n alignement = TooltipAlignment.Center;\n\n @state()\n target!: Element;\n @property({reflect: true, type: Boolean})\n show = false;\n @property()\n isPopConfirm = false;\n @property()\n popConfirmTitle = '';\n @property()\n popConfirmDescription = '';\n @property()\n okText = 'Yes';\n @property()\n cancelText = 'No';\n\n horizontalOffset = 10;\n verticalOffset = 10;\n override connectedCallback(): void {\n super.connectedCallback();\n\n // Assign the target to a previous sibling or expect it to be set via property.\n this.target = this.target || this.previousElementSibling;\n\n if (!this.target) {\n console.error('Tooltip target is not defined or found. Ensure target is explicitly set or precedes the tooltip.');\n return;\n }\n\n if (!this.isPopConfirm) {\n this.target.addEventListener('mouseover', this.onMouseOver);\n this.target.addEventListener('mouseleave', this.onMouseLeave);\n } else {\n document.addEventListener('scroll', this.calculatePosition);\n this.target.addEventListener('click', this.onClick);\n document.addEventListener('click', this.onClickOutside);\n }\n }\n\n private onMouseOver = () => {\n this.show = true;\n };\n\n private onMouseLeave = () => {\n this.show = false;\n this.initStyles();\n };\n\n private onClick = () => {\n this.show = !this.show;\n };\n\n private initStyles() {\n this.style.top = EMPTY_STRING;\n this.style.left = EMPTY_STRING;\n this.style.width = EMPTY_STRING;\n this.classList.remove(...this.classList.values());\n }\n\n override updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {\n if (this.show) this.calculatePosition();\n }\n\n private calculatePosition = () => {\n this.initStyles();\n\n this.style.width = `${this.clientWidth}px`;\n if (this.position == TooltipPosition.Bottom || this.position == TooltipPosition.Top) {\n this.calculateYposition();\n this.calculateYalignement();\n } else {\n this.calculateXposition();\n this.calculateXalignement();\n }\n };\n private calculateYposition = () => {\n const targetRect = this.target.getBoundingClientRect();\n const targetWithTopSpaceHeight = targetRect.bottom;\n const topAvailableSpace = targetRect.top;\n const totalViewPortHeight = window.visualViewport!.height;\n const tooltipHeight = this.clientHeight;\n const isAvailableBottomSpace = tooltipHeight + this.verticalOffset < totalViewPortHeight - targetWithTopSpaceHeight;\n const isAvailableTopSpace = tooltipHeight + this.verticalOffset < topAvailableSpace;\n\n if (this.position == TooltipPosition.Bottom) {\n if (isAvailableBottomSpace || !isAvailableTopSpace) {\n this.classList.add('bottom-position');\n this.style.top = `${targetWithTopSpaceHeight + this.verticalOffset}px`;\n } else {\n this.classList.add('top-position');\n this.style.top = `${topAvailableSpace - tooltipHeight - this.verticalOffset}px`;\n }\n } else {\n if (isAvailableTopSpace || !isAvailableBottomSpace) {\n this.classList.add('top-position');\n this.style.top = `${topAvailableSpace - tooltipHeight - this.verticalOffset}px`;\n } else {\n this.classList.add('bottom-position');\n this.style.top = `${targetWithTopSpaceHeight + this.verticalOffset}px`;\n }\n }\n };\n private calculateYalignement = () => {\n const targetRect = this.target.getBoundingClientRect();\n const leftSpaceAndTargetWidth = targetRect.right;\n const targetWidth = targetRect.width;\n const leftSpace = targetRect.left;\n const tooltipWidth = this.clientWidth;\n const leftSpaceAndHalfOfTargetWidth = leftSpace + targetWidth / 2;\n const totalViewPortWidth = window.visualViewport!.width;\n const rightSpaceAndHalfOfTargetWidth = totalViewPortWidth - leftSpaceAndTargetWidth + targetWidth / 2;\n\n if (this.alignement == TooltipAlignment.Start) {\n const canBeAtStart = tooltipWidth + leftSpace < totalViewPortWidth;\n if (canBeAtStart) {\n this.classList.add('alignement-start');\n this.style.left = `${leftSpace - this.horizontalOffset}px`;\n } else {\n this.classList.add('alignement-end');\n this.style.left = `${leftSpace - tooltipWidth + this.horizontalOffset}px`;\n }\n } else if (this.alignement == TooltipAlignment.End) {\n const canBeAtEnd = tooltipWidth < leftSpace;\n if (canBeAtEnd) {\n this.classList.add('alignement-end');\n this.style.left = `${leftSpace - tooltipWidth + this.horizontalOffset}px`;\n } else {\n this.classList.add('alignement-start');\n this.style.left = `${leftSpace - this.horizontalOffset}px`;\n }\n } else {\n const canBeCentered =\n (tooltipWidth / 2 < leftSpaceAndHalfOfTargetWidth && tooltipWidth / 2 < rightSpaceAndHalfOfTargetWidth) ||\n (tooltipWidth > leftSpaceAndHalfOfTargetWidth && tooltipWidth > rightSpaceAndHalfOfTargetWidth);\n const canBeAtEnd = tooltipWidth < leftSpaceAndHalfOfTargetWidth;\n if (canBeCentered) {\n this.classList.add('alignement-center');\n this.style.left = `${leftSpace - tooltipWidth / 2 + targetWidth / 2}px`;\n } else if (canBeAtEnd) {\n this.classList.add('alignement-end');\n this.style.left = `${leftSpace - tooltipWidth + this.horizontalOffset}px`;\n } else {\n this.classList.add('alignement-start');\n this.style.left = `${leftSpace - this.horizontalOffset}px`;\n }\n }\n };\n private calculateXposition = () => {\n const targetRect = this.target.getBoundingClientRect();\n const leftSpace = targetRect.left;\n const leftSpaceAndTargetWidth = targetRect.right;\n const totalViewPortWidth = window.visualViewport!.width;\n const tooltipWidth = this.clientWidth;\n const isAvailableRightSpace = tooltipWidth + this.horizontalOffset < totalViewPortWidth - leftSpaceAndTargetWidth;\n const isAvailableLeftSpace = tooltipWidth + this.horizontalOffset < leftSpace;\n\n if (this.position == TooltipPosition.Right) {\n if (isAvailableRightSpace || !isAvailableLeftSpace) {\n this.classList.add('right-position');\n this.style.left = `${leftSpaceAndTargetWidth + this.horizontalOffset}px`;\n } else {\n this.classList.add('left-position');\n this.style.left = `${leftSpace - tooltipWidth - this.horizontalOffset}px`;\n }\n } else {\n if (isAvailableLeftSpace || !isAvailableRightSpace) {\n this.classList.add('left-position');\n this.style.left = `${leftSpace - tooltipWidth - this.horizontalOffset}px`;\n } else {\n this.classList.add('right-position');\n this.style.left = `${leftSpaceAndTargetWidth + this.horizontalOffset}px`;\n }\n }\n };\n private calculateXalignement = () => {\n const targetRect = this.target.getBoundingClientRect();\n const topSpace = targetRect.top;\n const targetHeight = targetRect.height;\n const targetWithTopSpaceHeight = targetRect.bottom;\n const tooltipHeight = this.clientHeight;\n const totalViewPortHeight = window.visualViewport!.height;\n const bottomSpace = totalViewPortHeight - targetWithTopSpaceHeight;\n\n if (this.alignement == TooltipAlignment.End) {\n const canBeAtEnd = tooltipHeight < topSpace;\n if (canBeAtEnd) {\n this.classList.add('alignement-end');\n this.style.top = `${targetWithTopSpaceHeight - tooltipHeight}px`;\n } else {\n this.classList.add('alignement-start');\n this.style.top = `${topSpace - targetHeight / 4}px`;\n }\n } else if (this.alignement == TooltipAlignment.Start) {\n const canBeAtStart = tooltipHeight < totalViewPortHeight - targetWithTopSpaceHeight;\n if (canBeAtStart) {\n this.classList.add('alignement-start');\n this.style.top = `${topSpace - targetHeight / 4}px`;\n } else {\n this.classList.add('alignement-end');\n this.style.top = `${targetWithTopSpaceHeight - tooltipHeight}px`;\n }\n } else {\n const canBeCentered =\n (tooltipHeight / 2 < topSpace && tooltipHeight / 2 < bottomSpace) ||\n (tooltipHeight > topSpace && tooltipHeight > bottomSpace);\n const canBeAtEnd = tooltipHeight < topSpace;\n if (canBeCentered) {\n this.classList.add('alignement-center');\n this.style.top = `${topSpace + targetHeight / 2 - tooltipHeight / 2}px`;\n } else if (canBeAtEnd) {\n this.classList.add('alignement-end');\n this.style.top = `${targetWithTopSpaceHeight - tooltipHeight}px`;\n } else {\n this.classList.add('alignement-start');\n this.style.top = `${topSpace - targetHeight / 4}px`;\n }\n }\n };\n\n onPopConfirmCancel() {\n this.dispatchEvent(new CustomEvent('onCancel'));\n this.show = false;\n this.initStyles();\n }\n onPopConfirmConfirm() {\n this.dispatchEvent(new CustomEvent('onConfirm'));\n this.show = false;\n this.initStyles();\n }\n onClickOutside = (onClickEvent: Event) => {\n const eventPath = onClickEvent.composedPath();\n const outsideClick = !eventPath.includes(this.target) && !eventPath.includes(this);\n if (outsideClick) this.show = false;\n };\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (!this.isPopConfirm) {\n this.target.removeEventListener('mouseover', this.onMouseOver);\n this.target.removeEventListener('mouseleave', this.onMouseLeave);\n } else {\n this.target.removeEventListener('click', this.onClick);\n document.removeEventListener('scroll', this.calculatePosition);\n }\n }\n\n override render() {\n return !this.isPopConfirm\n ? this.show\n ? html`<slot></slot>`\n : nothing\n : this.show\n ? html`\n <div class=\"popconfirm-container\">\n <p class=\"popconfirm-title\">${this.popConfirmTitle}</p>\n <p class=\"popconfirm-description\">${this.popConfirmDescription}</p>\n <div class=\"btn-block\">\n <nr-button .size=${'small'} type=${'primary'} @click=${this.onPopConfirmConfirm}\n >${this.okText}</nr-button\n >\n <nr-button .size=${'small'} type=${'danger'} @click=${this.onPopConfirmCancel}\n >${this.cancelText}</nr-button\n >\n </div>\n </div>\n `\n : nothing;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tooltips.component.js","sourceRoot":"","sources":["../../../../src/components/tooltips/tooltips.component.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAuD;AACvD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAoB,MAAM,KAAK,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzF,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,UAAU;IAA9C;;QAIE,aAAQ,GAAG,eAAe,CAAC,MAAM,CAAC;QAGlC,eAAU,GAAG,gBAAgB,CAAC,MAAM,CAAC;QAKrC,SAAI,GAAG,KAAK,CAAC;QAEb,iBAAY,GAAG,KAAK,CAAC;QAErB,oBAAe,GAAG,EAAE,CAAC;QAErB,0BAAqB,GAAG,EAAE,CAAC;QAE3B,WAAM,GAAG,KAAK,CAAC;QAEf,eAAU,GAAG,IAAI,CAAC;QAElB,qBAAgB,GAAG,EAAE,CAAC;QACtB,mBAAc,GAAG,EAAE,CAAC;QAsBZ,gBAAW,GAAG,GAAG,EAAE;YACzB,IAAI,CAAC,I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Q,EAAE;oDACU;AAErB;IADC,QAAQ,EAAE;uDACU;AAErB;IADC,QAAQ,EAAE;6DACgB;AAE3B;IADC,QAAQ,EAAE;8CACI;AAEf;IADC,QAAQ,EAAE;kDACO;AAtBP,cAAc;IAD1B,aAAa,CAAC,YAAY,CAAC;GACf,cAAc,CAmR1B;SAnRY,cAAc","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { html, LitElement, nothing, PropertyValueMap } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { styles } from './tooltips.style.js';\nimport { EMPTY_STRING, TooltipAlignment, TooltipPosition } from './tooltips.constant.js';\n@customElement('hy-tooltip')\nexport class TooltipElement extends LitElement {\n static override styles = styles;\n\n @property({reflect: true})\n position = TooltipPosition.Bottom;\n\n @property({reflect: true})\n alignement = TooltipAlignment.Center;\n\n @state()\n target!: Element;\n @property({reflect: true, type: Boolean})\n show = false;\n @property()\n isPopConfirm = false;\n @property()\n popConfirmTitle = '';\n @property()\n popConfirmDescription = '';\n @property()\n okText = 'Yes';\n @property()\n cancelText = 'No';\n\n horizontalOffset = 10;\n verticalOffset = 10;\n override connectedCallback(): void {\n super.connectedCallback();\n\n // Assign the target to a previous sibling or expect it to be set via property.\n this.target = this.target || this.previousElementSibling;\n\n if (!this.target) {\n console.error('Tooltip target is not defined or found. Ensure target is explicitly set or precedes the tooltip.');\n return;\n }\n\n if (!this.isPopConfirm) {\n this.target.addEventListener('mouseover', this.onMouseOver);\n this.target.addEventListener('mouseleave', this.onMouseLeave);\n } else {\n document.addEventListener('scroll', this.calculatePosition);\n this.target.addEventListener('click', this.onClick);\n document.addEventListener('click', this.onClickOutside);\n }\n }\n\n private onMouseOver = () => {\n this.show = true;\n };\n\n private onMouseLeave = () => {\n this.show = false;\n this.initStyles();\n };\n\n private onClick = () => {\n this.show = !this.show;\n };\n\n private initStyles() {\n this.style.top = EMPTY_STRING;\n this.style.left = EMPTY_STRING;\n this.style.width = EMPTY_STRING;\n this.classList.remove(...this.classList.values());\n }\n\n override updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {\n if (this.show) this.calculatePosition();\n }\n\n private calculatePosition = () => {\n this.initStyles();\n\n this.style.width = `${this.clientWidth}px`;\n if (this.position == TooltipPosition.Bottom || this.position == TooltipPosition.Top) {\n this.calculateYposition();\n this.calculateYalignement();\n } else {\n this.calculateXposition();\n this.calculateXalignement();\n }\n };\n private calculateYposition = () => {\n const targetRect = this.target.getBoundingClientRect();\n const targetWithTopSpaceHeight = targetRect.bottom;\n const topAvailableSpace = targetRect.top;\n const totalViewPortHeight = window.visualViewport!.height;\n const tooltipHeight = this.clientHeight;\n const isAvailableBottomSpace = tooltipHeight + this.verticalOffset < totalViewPortHeight - targetWithTopSpaceHeight;\n const isAvailableTopSpace = tooltipHeight + this.verticalOffset < topAvailableSpace;\n\n if (this.position == TooltipPosition.Bottom) {\n if (isAvailableBottomSpace || !isAvailableTopSpace) {\n this.classList.add('bottom-position');\n this.style.top = `${targetWithTopSpaceHeight + this.verticalOffset}px`;\n } else {\n this.classList.add('top-position');\n this.style.top = `${topAvailableSpace - tooltipHeight - this.verticalOffset}px`;\n }\n } else {\n if (isAvailableTopSpace || !isAvailableBottomSpace) {\n this.classList.add('top-position');\n this.style.top = `${topAvailableSpace - tooltipHeight - this.verticalOffset}px`;\n } else {\n this.classList.add('bottom-position');\n this.style.top = `${targetWithTopSpaceHeight + this.verticalOffset}px`;\n }\n }\n };\n private calculateYalignement = () => {\n const targetRect = this.target.getBoundingClientRect();\n const leftSpaceAndTargetWidth = targetRect.right;\n const targetWidth = targetRect.width;\n const leftSpace = targetRect.left;\n const tooltipWidth = this.clientWidth;\n const leftSpaceAndHalfOfTargetWidth = leftSpace + targetWidth / 2;\n const totalViewPortWidth = window.visualViewport!.width;\n const rightSpaceAndHalfOfTargetWidth = totalViewPortWidth - leftSpaceAndTargetWidth + targetWidth / 2;\n\n if (this.alignement == TooltipAlignment.Start) {\n const canBeAtStart = tooltipWidth + leftSpace < totalViewPortWidth;\n if (canBeAtStart) {\n this.classList.add('alignement-start');\n this.style.left = `${leftSpace - this.horizontalOffset}px`;\n } else {\n this.classList.add('alignement-end');\n this.style.left = `${leftSpace - tooltipWidth + this.horizontalOffset}px`;\n }\n } else if (this.alignement == TooltipAlignment.End) {\n const canBeAtEnd = tooltipWidth < leftSpace;\n if (canBeAtEnd) {\n this.classList.add('alignement-end');\n this.style.left = `${leftSpace - tooltipWidth + this.horizontalOffset}px`;\n } else {\n this.classList.add('alignement-start');\n this.style.left = `${leftSpace - this.horizontalOffset}px`;\n }\n } else {\n const canBeCentered =\n (tooltipWidth / 2 < leftSpaceAndHalfOfTargetWidth && tooltipWidth / 2 < rightSpaceAndHalfOfTargetWidth) ||\n (tooltipWidth > leftSpaceAndHalfOfTargetWidth && tooltipWidth > rightSpaceAndHalfOfTargetWidth);\n const canBeAtEnd = tooltipWidth < leftSpaceAndHalfOfTargetWidth;\n if (canBeCentered) {\n this.classList.add('alignement-center');\n this.style.left = `${leftSpace - tooltipWidth / 2 + targetWidth / 2}px`;\n } else if (canBeAtEnd) {\n this.classList.add('alignement-end');\n this.style.left = `${leftSpace - tooltipWidth + this.horizontalOffset}px`;\n } else {\n this.classList.add('alignement-start');\n this.style.left = `${leftSpace - this.horizontalOffset}px`;\n }\n }\n };\n private calculateXposition = () => {\n const targetRect = this.target.getBoundingClientRect();\n const leftSpace = targetRect.left;\n const leftSpaceAndTargetWidth = targetRect.right;\n const totalViewPortWidth = window.visualViewport!.width;\n const tooltipWidth = this.clientWidth;\n const isAvailableRightSpace = tooltipWidth + this.horizontalOffset < totalViewPortWidth - leftSpaceAndTargetWidth;\n const isAvailableLeftSpace = tooltipWidth + this.horizontalOffset < leftSpace;\n\n if (this.position == TooltipPosition.Right) {\n if (isAvailableRightSpace || !isAvailableLeftSpace) {\n this.classList.add('right-position');\n this.style.left = `${leftSpaceAndTargetWidth + this.horizontalOffset}px`;\n } else {\n this.classList.add('left-position');\n this.style.left = `${leftSpace - tooltipWidth - this.horizontalOffset}px`;\n }\n } else {\n if (isAvailableLeftSpace || !isAvailableRightSpace) {\n this.classList.add('left-position');\n this.style.left = `${leftSpace - tooltipWidth - this.horizontalOffset}px`;\n } else {\n this.classList.add('right-position');\n this.style.left = `${leftSpaceAndTargetWidth + this.horizontalOffset}px`;\n }\n }\n };\n private calculateXalignement = () => {\n const targetRect = this.target.getBoundingClientRect();\n const topSpace = targetRect.top;\n const targetHeight = targetRect.height;\n const targetWithTopSpaceHeight = targetRect.bottom;\n const tooltipHeight = this.clientHeight;\n const totalViewPortHeight = window.visualViewport!.height;\n const bottomSpace = totalViewPortHeight - targetWithTopSpaceHeight;\n\n if (this.alignement == TooltipAlignment.End) {\n const canBeAtEnd = tooltipHeight < topSpace;\n if (canBeAtEnd) {\n this.classList.add('alignement-end');\n this.style.top = `${targetWithTopSpaceHeight - tooltipHeight}px`;\n } else {\n this.classList.add('alignement-start');\n this.style.top = `${topSpace - targetHeight / 4}px`;\n }\n } else if (this.alignement == TooltipAlignment.Start) {\n const canBeAtStart = tooltipHeight < totalViewPortHeight - targetWithTopSpaceHeight;\n if (canBeAtStart) {\n this.classList.add('alignement-start');\n this.style.top = `${topSpace - targetHeight / 4}px`;\n } else {\n this.classList.add('alignement-end');\n this.style.top = `${targetWithTopSpaceHeight - tooltipHeight}px`;\n }\n } else {\n const canBeCentered =\n (tooltipHeight / 2 < topSpace && tooltipHeight / 2 < bottomSpace) ||\n (tooltipHeight > topSpace && tooltipHeight > bottomSpace);\n const canBeAtEnd = tooltipHeight < topSpace;\n if (canBeCentered) {\n this.classList.add('alignement-center');\n this.style.top = `${topSpace + targetHeight / 2 - tooltipHeight / 2}px`;\n } else if (canBeAtEnd) {\n this.classList.add('alignement-end');\n this.style.top = `${targetWithTopSpaceHeight - tooltipHeight}px`;\n } else {\n this.classList.add('alignement-start');\n this.style.top = `${topSpace - targetHeight / 4}px`;\n }\n }\n };\n\n onPopConfirmCancel() {\n this.dispatchEvent(new CustomEvent('onCancel'));\n this.show = false;\n this.initStyles();\n }\n onPopConfirmConfirm() {\n this.dispatchEvent(new CustomEvent('onConfirm'));\n this.show = false;\n this.initStyles();\n }\n onClickOutside = (onClickEvent: Event) => {\n const eventPath = onClickEvent.composedPath();\n const outsideClick = !eventPath.includes(this.target) && !eventPath.includes(this);\n if (outsideClick) this.show = false;\n };\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (!this.isPopConfirm) {\n this.target.removeEventListener('mouseover', this.onMouseOver);\n this.target.removeEventListener('mouseleave', this.onMouseLeave);\n } else {\n this.target.removeEventListener('click', this.onClick);\n document.removeEventListener('scroll', this.calculatePosition);\n }\n }\n\n override render() {\n return !this.isPopConfirm\n ? this.show\n ? html`<slot></slot>`\n : nothing\n : this.show\n ? html`\n <div class=\"popconfirm-container\">\n <p class=\"popconfirm-title\">${this.popConfirmTitle}</p>\n <p class=\"popconfirm-description\">${this.popConfirmDescription}</p>\n <div class=\"btn-block\">\n <nr-button .size=${'small'} type=${'primary'} @click=${this.onPopConfirmConfirm}\n >${this.okText}</nr-button\n >\n <nr-button .size=${'small'} type=${'danger'} @click=${this.onPopConfirmCancel}\n >${this.cancelText}</nr-button\n >\n </div>\n </div>\n `\n : nothing;\n }\n}\n"]}
|
package/tooltips.constant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltips.constant.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"tooltips.constant.js","sourceRoot":"","sources":["../../../../src/components/tooltips/tooltips.constant.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,8BAAW,CAAA;IACX,oCAAiB,CAAA;IACjB,kCAAe,CAAA;IACf,gCAAa,CAAA;AACf,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AAED,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,qCAAiB,CAAA;IACjB,+BAAW,CAAA;AACb,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B;AAGD,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC","sourcesContent":["export enum TooltipPosition {\n Top = 'top',\n Bottom = 'bottom',\n Right = 'right',\n Left = 'left',\n}\n\nexport enum TooltipAlignment {\n Start = 'start',\n Center = 'center',\n End = 'end',\n}\n\n\nexport const EMPTY_STRING = '';"]}
|
package/tooltips.style.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltips.style.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"tooltips.style.js","sourceRoot":"","sources":["../../../../src/components/tooltips/tooltips.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,aAAa,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGxB,CAAC;AACF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { css } from 'lit';\nimport { styleVariables } from './tooltips.variables.js';\n\nconst tooltipStyles = css`\n :host([show]) {\n background-color: var(--nuraly-tooltip-background-color);\n color: var(--nuraly-tooltip-text-color);\n position: fixed;\n padding: 5px;\n text-align: center;\n opacity: 0;\n font-size: 14px;\n z-index: 9999;\n border-radius: 4px;\n animation-name: show-animation;\n animation-duration: 0.4s;\n animation-fill-mode: forwards;\n }\n\n .popconfirm-container {\n display: flex;\n flex-direction: column;\n }\n .btn-block {\n display: flex;\n justify-content: end;\n gap: 10px;\n margin: 10px;\n }\n\n .popconfirm-description,\n .popconfirm-title {\n margin: 5px;\n text-align: left;\n }\n .popconfirm-title {\n font-weight: bold;\n }\n\n @keyframes show-animation {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n :host::after {\n content: '';\n height: 0;\n width: 0;\n position: absolute;\n border: 5px solid transparent;\n }\n :host(.top-position)::after {\n border-top-color: var(--nuraly-tooltip-background-color);\n top: 100%;\n }\n :host(.left-position)::after {\n border-left-color: var(--nuraly-tooltip-background-color);\n left: 100%;\n }\n\n :host(.right-position)::after {\n border-right-color: var(--nuraly-tooltip-background-color);\n right: 100%;\n }\n :host(.bottom-position)::after {\n border-bottom-color: var(--nuraly-tooltip-background-color);\n bottom: 100%;\n }\n :host(.alignement-center.top-position)::after,\n :host(.alignement-center.bottom-position)::after {\n right: 50%;\n transform: translate(50%);\n }\n\n :host(.alignement-start.top-position)::after,\n :host(.alignement-start.bottom-position)::after {\n left: 4%;\n }\n :host(.top-position.alignement-end)::after,\n :host(.alignement-end.bottom-position)::after {\n right: 4%;\n }\n\n :host(.alignement-center.left-position)::after,\n :host(.alignement-center.right-position)::after {\n top: 50%;\n transform: translate(0%, -50%);\n }\n\n :host(.alignement-start.left-position)::after,\n :host(.alignement-start.right-position)::after {\n top: 5px;\n }\n :host(.alignement-end.left-position)::after,\n :host(.alignement-end.right-position)::after {\n bottom: 5px;\n }\n`;\nexport const styles = [tooltipStyles, styleVariables];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltips.variables.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"tooltips.variables.js","sourceRoot":"","sources":["../../../../src/components/tooltips/tooltips.variables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;CAWhC,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styleVariables = css`\n :host {\n --nuraly-tooltip-background-color: #393939;\n --nuraly-tooltip-text-color: #ffffff;\n }\n @media (prefers-color-scheme: dark) {\n :host {\n --nuraly-tooltip-background-color: #f4f4f4;\n --nuraly-tooltip-text-color: #161616;\n }\n }\n`;\n"]}
|