@nuralyui/tooltips 0.0.1
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/demo/tooltips-demo.d.ts +18 -0
- package/demo/tooltips-demo.d.ts.map +1 -0
- package/demo/tooltips-demo.js +132 -0
- package/demo/tooltips-demo.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -0
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/package.json +15 -0
- package/react.d.ts +1 -0
- package/react.d.ts.map +1 -0
- package/react.js +2 -0
- package/react.js.map +1 -0
- package/test/tooltips_test.d.ts +2 -0
- package/test/tooltips_test.d.ts.map +1 -0
- package/test/tooltips_test.js +145 -0
- package/test/tooltips_test.js.map +1 -0
- package/tooltips.component.d.ts +34 -0
- package/tooltips.component.d.ts.map +1 -0
- package/tooltips.component.js +309 -0
- package/tooltips.component.js.map +1 -0
- package/tooltips.constant.d.ts +13 -0
- package/tooltips.constant.d.ts.map +1 -0
- package/tooltips.constant.js +15 -0
- package/tooltips.constant.js.map +1 -0
- package/tooltips.style.d.ts +2 -0
- package/tooltips.style.d.ts.map +1 -0
- package/tooltips.style.js +101 -0
- package/tooltips.style.js.map +1 -0
- package/tooltips.variables.d.ts +2 -0
- package/tooltips.variables.d.ts.map +1 -0
- package/tooltips.variables.js +14 -0
- package/tooltips.variables.js.map +1 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { LitElement } from 'lit';
|
|
7
|
+
import '../tooltips.component';
|
|
8
|
+
export declare class ElMeenuElement extends LitElement {
|
|
9
|
+
float: string;
|
|
10
|
+
protected render(): import("lit").TemplateResult<1>;
|
|
11
|
+
static styles: import("lit").CSSResult[];
|
|
12
|
+
}
|
|
13
|
+
declare global {
|
|
14
|
+
interface HTMLElementTagNameMap {
|
|
15
|
+
'hy-tooltips-demo': ElMeenuElement;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=tooltips-demo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltips-demo.d.ts","sourceRoot":"","sources":["../../../../src/components/tooltips/demo/tooltips-demo.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,EAAC,UAAU,EAAY,MAAM,KAAK,CAAC;AAG1C,OAAO,uBAAuB,CAAC;AAE/B,qBACa,cAAe,SAAQ,UAAU;IAE5C,KAAK,SAAU;cAEI,MAAM;IA6FzB,OAAgB,MAAM,4BASpB;CACH;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,cAAc,CAAC;KACpC;CACF"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2023 Google Laabidi Aymen
|
|
6
|
+
* SPDX-License-Identifier: MIT
|
|
7
|
+
*/
|
|
8
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
9
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13
|
+
};
|
|
14
|
+
import { LitElement, css, html } from 'lit';
|
|
15
|
+
import { customElement, state } from 'lit/decorators.js';
|
|
16
|
+
import '../tooltips.component';
|
|
17
|
+
let ElMeenuElement = class ElMeenuElement extends LitElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.float = 'left';
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
return html `
|
|
24
|
+
<h3>BOTTOM</h3>
|
|
25
|
+
<span>click me</span>
|
|
26
|
+
<hy-tooltip
|
|
27
|
+
.isPopConfirm=${true}
|
|
28
|
+
.popConfirmDescription=${'Are you sure to delete this task?'}
|
|
29
|
+
.popConfirmTitle=${'delete the task'}
|
|
30
|
+
.cancelText=${'Cancel'}
|
|
31
|
+
.okText=${'Ok'}
|
|
32
|
+
@onCancel=${() => {
|
|
33
|
+
console.log('canceled');
|
|
34
|
+
}}
|
|
35
|
+
@onConfirm=${() => {
|
|
36
|
+
console.log('confirm');
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
</hy-tooltip>
|
|
40
|
+
|
|
41
|
+
<br /><br /><br />
|
|
42
|
+
<p>hover me</p>
|
|
43
|
+
<hy-tooltip alignement=${'start'}>
|
|
44
|
+
<span>This is bottom and start</span>
|
|
45
|
+
</hy-tooltip>
|
|
46
|
+
|
|
47
|
+
<br /><br /><br />
|
|
48
|
+
<p>hover me</p>
|
|
49
|
+
<hy-tooltip alignement=${'end'}>
|
|
50
|
+
<span>This is bottom and end</span>
|
|
51
|
+
</hy-tooltip>
|
|
52
|
+
|
|
53
|
+
<br /><br /><br />
|
|
54
|
+
<h3>TOP</h3>
|
|
55
|
+
|
|
56
|
+
<p>hover me</p>
|
|
57
|
+
<hy-tooltip position=${'top'}>
|
|
58
|
+
<span>This is a description of the p in top and center</span>
|
|
59
|
+
</hy-tooltip>
|
|
60
|
+
<br /><br /><br />
|
|
61
|
+
<div>hover me</div>
|
|
62
|
+
|
|
63
|
+
<hy-tooltip position=${'top'} alignement=${'start'}>
|
|
64
|
+
<span>This is a description of the p in top and start </span>
|
|
65
|
+
</hy-tooltip>
|
|
66
|
+
<br /><br /><br />
|
|
67
|
+
|
|
68
|
+
<p>hover me</p>
|
|
69
|
+
|
|
70
|
+
<hy-tooltip position=${'top'} alignement=${'end'}>
|
|
71
|
+
<span>This is a description of the p in top and end</span>
|
|
72
|
+
</hy-tooltip>
|
|
73
|
+
<br /><br /><br />
|
|
74
|
+
<h3>RIGHT</h3>
|
|
75
|
+
<span>hover me</span>
|
|
76
|
+
<hy-tooltip position=${'right'}>
|
|
77
|
+
<span>This is a description of the p to the right and center</span>
|
|
78
|
+
</hy-tooltip>
|
|
79
|
+
|
|
80
|
+
<br /><br /><br />
|
|
81
|
+
|
|
82
|
+
<div>hover me</div>
|
|
83
|
+
<hy-tooltip position=${'right'} alignement=${'start'}>
|
|
84
|
+
<span>This is a description of the p to the right and start</span>
|
|
85
|
+
</hy-tooltip>
|
|
86
|
+
|
|
87
|
+
<br /><br /><br />
|
|
88
|
+
<span>hover me</span>
|
|
89
|
+
<hy-tooltip position=${'right'} alignement=${'end'}>
|
|
90
|
+
<span>This is a description of the p to the right and end</span>
|
|
91
|
+
</hy-tooltip>
|
|
92
|
+
|
|
93
|
+
<br /><br /><br />
|
|
94
|
+
<h3>LEFT</h3>
|
|
95
|
+
<span>hover me</span>
|
|
96
|
+
<hy-tooltip position=${'left'}>
|
|
97
|
+
<span>This is a description of the p to the left and center</span>
|
|
98
|
+
</hy-tooltip>
|
|
99
|
+
<br /><br /><br />
|
|
100
|
+
|
|
101
|
+
<span>hover me</span>
|
|
102
|
+
<hy-tooltip position=${'left'} alignement=${'start'}>
|
|
103
|
+
<span>This is a description of the p to the left and start</span>
|
|
104
|
+
</hy-tooltip>
|
|
105
|
+
|
|
106
|
+
<br /><br /><br />
|
|
107
|
+
|
|
108
|
+
<div>hover me</div>
|
|
109
|
+
<hy-tooltip position=${'left'} alignement=${'end'}>
|
|
110
|
+
<span>This is a description of the p to the left and end</span>
|
|
111
|
+
</hy-tooltip>
|
|
112
|
+
`;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
ElMeenuElement.styles = [
|
|
116
|
+
css `
|
|
117
|
+
:host {
|
|
118
|
+
width: 800px;
|
|
119
|
+
display: flex;
|
|
120
|
+
flex-direction: column;
|
|
121
|
+
align-items: center;
|
|
122
|
+
}
|
|
123
|
+
`,
|
|
124
|
+
];
|
|
125
|
+
__decorate([
|
|
126
|
+
state()
|
|
127
|
+
], ElMeenuElement.prototype, "float", void 0);
|
|
128
|
+
ElMeenuElement = __decorate([
|
|
129
|
+
customElement('hy-tooltips-demo')
|
|
130
|
+
], ElMeenuElement);
|
|
131
|
+
export { ElMeenuElement };
|
|
132
|
+
//# sourceMappingURL=tooltips-demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltips-demo.js","sourceRoot":"","sources":["../../../../src/components/tooltips/demo/tooltips-demo.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,uDAAuD;AACvD;;;;GAIG;;;;;;;AAEH,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAEvD,OAAO,uBAAuB,CAAC;AAG/B,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,UAAU;IAA9C;;QAEE,UAAK,GAAG,MAAM,CAAC;IAyGjB,CAAC;IAvGoB,MAAM;QACvB,OAAO,IAAI,CAAA;;;;wBAIS,IAAI;iCACK,mCAAmC;2BACzC,iBAAiB;sBACtB,QAAQ;kBACZ,IAAI;oBACF,GAAG,EAAE;YACf,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC1B,CAAC;qBACY,GAAG,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACzB,CAAC;;;;;;+BAMsB,OAAO;;;;;;+BAMP,KAAK;;;;;;;;6BAQP,KAAK;;;;;;6BAML,KAAK,eAAe,OAAO;;;;;;;6BAO3B,KAAK,eAAe,KAAK;;;;;;6BAMzB,OAAO;;;;;;;6BAOP,OAAO,eAAe,OAAO;;;;;;6BAM7B,OAAO,eAAe,KAAK;;;;;;;6BAO3B,MAAM;;;;;;6BAMN,MAAM,eAAe,OAAO;;;;;;;6BAO5B,MAAM,eAAe,KAAK;;;KAGlD,CAAC;IACJ,CAAC;CAYF,CAAA;AAViB,qBAAM,GAAG;IACvB,GAAG,CAAA;;;;;;;KAOF;CACD,CAAA;AAxGF;IADC,KAAK,EAAE;6CACO;AAFJ,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CA2G1B;SA3GY,cAAc","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * @license\n * Copyright 2023 Google Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport {LitElement, css, html} from 'lit';\nimport {customElement, state} from 'lit/decorators.js';\n\nimport '../tooltips.component';\n\n@customElement('hy-tooltips-demo')\nexport class ElMeenuElement extends LitElement {\n @state()\n float = 'left';\n\n protected override render() {\n return html`\n <h3>BOTTOM</h3>\n <span>click me</span>\n <hy-tooltip\n .isPopConfirm=${true}\n .popConfirmDescription=${'Are you sure to delete this task?'}\n .popConfirmTitle=${'delete the task'}\n .cancelText=${'Cancel'}\n .okText=${'Ok'}\n @onCancel=${() => {\n console.log('canceled');\n }}\n @onConfirm=${() => {\n console.log('confirm');\n }}\n >\n </hy-tooltip>\n\n <br /><br /><br />\n <p>hover me</p>\n <hy-tooltip alignement=${'start'}>\n <span>This is bottom and start</span>\n </hy-tooltip>\n\n <br /><br /><br />\n <p>hover me</p>\n <hy-tooltip alignement=${'end'}>\n <span>This is bottom and end</span>\n </hy-tooltip>\n\n <br /><br /><br />\n <h3>TOP</h3>\n\n <p>hover me</p>\n <hy-tooltip position=${'top'}>\n <span>This is a description of the p in top and center</span>\n </hy-tooltip>\n <br /><br /><br />\n <div>hover me</div>\n\n <hy-tooltip position=${'top'} alignement=${'start'}>\n <span>This is a description of the p in top and start </span>\n </hy-tooltip>\n <br /><br /><br />\n\n <p>hover me</p>\n\n <hy-tooltip position=${'top'} alignement=${'end'}>\n <span>This is a description of the p in top and end</span>\n </hy-tooltip>\n <br /><br /><br />\n <h3>RIGHT</h3>\n <span>hover me</span>\n <hy-tooltip position=${'right'}>\n <span>This is a description of the p to the right and center</span>\n </hy-tooltip>\n\n <br /><br /><br />\n\n <div>hover me</div>\n <hy-tooltip position=${'right'} alignement=${'start'}>\n <span>This is a description of the p to the right and start</span>\n </hy-tooltip>\n\n <br /><br /><br />\n <span>hover me</span>\n <hy-tooltip position=${'right'} alignement=${'end'}>\n <span>This is a description of the p to the right and end</span>\n </hy-tooltip>\n\n <br /><br /><br />\n <h3>LEFT</h3>\n <span>hover me</span>\n <hy-tooltip position=${'left'}>\n <span>This is a description of the p to the left and center</span>\n </hy-tooltip>\n <br /><br /><br />\n\n <span>hover me</span>\n <hy-tooltip position=${'left'} alignement=${'start'}>\n <span>This is a description of the p to the left and start</span>\n </hy-tooltip>\n\n <br /><br /><br />\n\n <div>hover me</div>\n <hy-tooltip position=${'left'} alignement=${'end'}>\n <span>This is a description of the p to the left and end</span>\n </hy-tooltip>\n `;\n }\n\n static override styles = [\n css`\n :host {\n width: 800px;\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n `,\n ];\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'hy-tooltips-demo': ElMeenuElement;\n }\n}\n"]}
|
package/index.d.ts
ADDED
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tooltips/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
package/index.js
ADDED
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nuralyui/tooltips",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"dayjs": "^1.11.7"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
12
|
+
},
|
|
13
|
+
"author": "Labidi Aymen",
|
|
14
|
+
"license": "ISC"
|
|
15
|
+
}
|
package/react.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=react.d.ts.map
|
package/react.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/components/tooltips/react.ts"],"names":[],"mappings":""}
|
package/react.js
ADDED
package/react.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/components/tooltips/react.ts"],"names":[],"mappings":"","sourcesContent":[""]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltips_test.d.ts","sourceRoot":"","sources":["../../../../src/components/tooltips/test/tooltips_test.ts"],"names":[],"mappings":"AACA,OAAO,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { html, fixture, expect } from '@open-wc/testing';
|
|
11
|
+
import '../tooltips.component';
|
|
12
|
+
import { TooltipAlignment, TooltipPosition } from '../tooltips.constant';
|
|
13
|
+
suite('TooltipElement', () => {
|
|
14
|
+
test('shows tooltip on mouseover and hides on mouseleave', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
const wrapper = yield fixture(html `
|
|
16
|
+
<div>
|
|
17
|
+
<span id="target">Hover me</span>
|
|
18
|
+
<hy-tooltip>Tooltip Content</hy-tooltip>
|
|
19
|
+
</div>
|
|
20
|
+
`);
|
|
21
|
+
const target = wrapper.querySelector('#target');
|
|
22
|
+
const tooltip = wrapper.querySelector('hy-tooltip');
|
|
23
|
+
expect(tooltip.show).to.be.false;
|
|
24
|
+
target.dispatchEvent(new MouseEvent('mouseover'));
|
|
25
|
+
expect(tooltip.show).to.be.true;
|
|
26
|
+
target.dispatchEvent(new MouseEvent('mouseleave'));
|
|
27
|
+
expect(tooltip.show).to.be.false;
|
|
28
|
+
}));
|
|
29
|
+
test('init tooltip position on mouseleave', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
const wrapper = yield fixture(html `
|
|
31
|
+
<div>
|
|
32
|
+
<span id="target">Hover me</span>
|
|
33
|
+
<hy-tooltip>Tooltip Content</hy-tooltip>
|
|
34
|
+
</div>
|
|
35
|
+
`);
|
|
36
|
+
const target = wrapper.querySelector('#target');
|
|
37
|
+
const tooltip = wrapper.querySelector('hy-tooltip');
|
|
38
|
+
target.dispatchEvent(new MouseEvent('mouseover'));
|
|
39
|
+
yield tooltip.updateComplete;
|
|
40
|
+
expect(tooltip.show).to.be.true;
|
|
41
|
+
expect(tooltip.style.top).to.not.be.empty;
|
|
42
|
+
expect(tooltip.style.left).to.not.be.empty;
|
|
43
|
+
expect(tooltip.style.width).to.not.be.empty;
|
|
44
|
+
target.dispatchEvent(new MouseEvent('mouseleave'));
|
|
45
|
+
expect(tooltip.show).to.be.false;
|
|
46
|
+
expect(tooltip.style.top).to.be.empty;
|
|
47
|
+
expect(tooltip.style.left).to.be.empty;
|
|
48
|
+
expect(tooltip.style.width).to.be.empty;
|
|
49
|
+
}));
|
|
50
|
+
suite('calculates tooltip style correctly', () => {
|
|
51
|
+
test('tooltip style when position is bottom and alignement is center', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
const wrapper = yield fixture(html `
|
|
53
|
+
<div>
|
|
54
|
+
<span id="target">Hover me</span>
|
|
55
|
+
<hy-tooltip position="${TooltipPosition.Bottom}" alignement="${TooltipAlignment.Center}">
|
|
56
|
+
Tooltip Content
|
|
57
|
+
</hy-tooltip>
|
|
58
|
+
</div>
|
|
59
|
+
`);
|
|
60
|
+
const target = wrapper.querySelector('#target');
|
|
61
|
+
const tooltip = wrapper.querySelector('hy-tooltip');
|
|
62
|
+
target.dispatchEvent(new MouseEvent('mouseover'));
|
|
63
|
+
yield tooltip.updateComplete;
|
|
64
|
+
const targetRect = target.getBoundingClientRect();
|
|
65
|
+
const tooltipRect = tooltip.getBoundingClientRect();
|
|
66
|
+
expect(Math.ceil(+tooltip.style.top.split('px')[0])).to.equal(Math.ceil(targetRect.bottom + tooltip.verticalOffset));
|
|
67
|
+
expect(Math.ceil(+tooltip.style.left.split('px')[0])).to.equal(Math.ceil(targetRect.left - tooltipRect.width / 2 + targetRect.width / 2));
|
|
68
|
+
}));
|
|
69
|
+
test('tooltip style when position is left and alignement is end', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
+
const wrapper = yield fixture(html `
|
|
71
|
+
<div>
|
|
72
|
+
<span id="target">Hover me</span>
|
|
73
|
+
<hy-tooltip position="${TooltipPosition.Left}" alignement="${TooltipAlignment.End}">
|
|
74
|
+
Tooltip Content
|
|
75
|
+
</hy-tooltip>
|
|
76
|
+
</div>
|
|
77
|
+
`);
|
|
78
|
+
const target = wrapper.querySelector('#target');
|
|
79
|
+
const tooltip = wrapper.querySelector('hy-tooltip');
|
|
80
|
+
target.dispatchEvent(new MouseEvent('mouseover'));
|
|
81
|
+
yield tooltip.updateComplete;
|
|
82
|
+
const targetRect = target.getBoundingClientRect();
|
|
83
|
+
const tooltipRect = tooltip.getBoundingClientRect();
|
|
84
|
+
expect(Math.ceil(+tooltip.style.top.split('px')[0])).to.equal(Math.ceil(targetRect.bottom - tooltipRect.height));
|
|
85
|
+
expect(Math.ceil(+tooltip.style.left.split('px')[0])).to.equal(Math.ceil(targetRect.left - tooltipRect.width - tooltip.horizontalOffset));
|
|
86
|
+
}));
|
|
87
|
+
test('tooltip style when position is top and alignement is start', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
|
+
const wrapper = yield fixture(html `
|
|
89
|
+
<div>
|
|
90
|
+
<span id="target">Hover me</span>
|
|
91
|
+
<hy-tooltip position="${TooltipPosition.Top}" alignement="${TooltipAlignment.Start}">
|
|
92
|
+
Tooltip Content
|
|
93
|
+
</hy-tooltip>
|
|
94
|
+
</div>
|
|
95
|
+
`);
|
|
96
|
+
const target = wrapper.querySelector('#target');
|
|
97
|
+
const tooltip = wrapper.querySelector('hy-tooltip');
|
|
98
|
+
target.dispatchEvent(new MouseEvent('mouseover'));
|
|
99
|
+
yield tooltip.updateComplete;
|
|
100
|
+
const targetRect = target.getBoundingClientRect();
|
|
101
|
+
const tooltipRect = tooltip.getBoundingClientRect();
|
|
102
|
+
expect(Math.ceil(+tooltip.style.top.split('px')[0])).to.equal(Math.ceil(targetRect.top - tooltipRect.height - tooltip.verticalOffset));
|
|
103
|
+
expect(Math.ceil(+tooltip.style.left.split('px')[0])).to.equal(Math.ceil(targetRect.left - tooltip.horizontalOffset));
|
|
104
|
+
}));
|
|
105
|
+
});
|
|
106
|
+
suite('removes event listeners on disconnectedCallback', () => {
|
|
107
|
+
test('removes mouseleave listener', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
108
|
+
const wrapper = yield fixture(html `
|
|
109
|
+
<div>
|
|
110
|
+
<span id="target">Hover me</span>
|
|
111
|
+
<hy-tooltip>Tooltip Content</hy-tooltip>
|
|
112
|
+
</div>
|
|
113
|
+
`);
|
|
114
|
+
const target = wrapper.querySelector('#target');
|
|
115
|
+
const tooltip = wrapper.querySelector('hy-tooltip');
|
|
116
|
+
target.dispatchEvent(new MouseEvent('mouseover'));
|
|
117
|
+
expect(tooltip.show).to.be.true;
|
|
118
|
+
target.dispatchEvent(new MouseEvent('mouseleave'));
|
|
119
|
+
expect(tooltip.show).to.be.false;
|
|
120
|
+
target.dispatchEvent(new MouseEvent('mouseover'));
|
|
121
|
+
expect(tooltip.show).to.be.true;
|
|
122
|
+
wrapper.removeChild(tooltip);
|
|
123
|
+
target.dispatchEvent(new MouseEvent('mouseleave'));
|
|
124
|
+
expect(tooltip.show).to.be.true;
|
|
125
|
+
}));
|
|
126
|
+
test('removes mouseover listener', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
127
|
+
const wrapper = yield fixture(html `
|
|
128
|
+
<div>
|
|
129
|
+
<span id="target">Hover me</span>
|
|
130
|
+
<hy-tooltip>Tooltip Content</hy-tooltip>
|
|
131
|
+
</div>
|
|
132
|
+
`);
|
|
133
|
+
const target = wrapper.querySelector('#target');
|
|
134
|
+
const tooltip = wrapper.querySelector('hy-tooltip');
|
|
135
|
+
target.dispatchEvent(new MouseEvent('mouseover'));
|
|
136
|
+
expect(tooltip.show).to.be.true;
|
|
137
|
+
target.dispatchEvent(new MouseEvent('mouseleave'));
|
|
138
|
+
expect(tooltip.show).to.be.false;
|
|
139
|
+
wrapper.removeChild(tooltip);
|
|
140
|
+
target.dispatchEvent(new MouseEvent('mouseover'));
|
|
141
|
+
expect(tooltip.show).to.be.false;
|
|
142
|
+
}));
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
//# sourceMappingURL=tooltips_test.js.map
|
|
@@ -0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AI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QACnC,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {html, fixture, expect} from '@open-wc/testing';\nimport '../tooltips.component';\nimport {TooltipElement} from '../tooltips.component';\nimport {TooltipAlignment, TooltipPosition} from '../tooltips.constant';\nsuite('TooltipElement', () => {\n test('shows tooltip on mouseover and hides on mouseleave', async () => {\n const wrapper = await fixture(html`\n <div>\n <span id=\"target\">Hover me</span>\n <hy-tooltip>Tooltip Content</hy-tooltip>\n </div>\n `);\n const target = wrapper.querySelector('#target')!;\n const tooltip: TooltipElement = wrapper.querySelector('hy-tooltip')!;\n\n expect(tooltip.show).to.be.false;\n\n target.dispatchEvent(new MouseEvent('mouseover'));\n expect(tooltip.show).to.be.true;\n\n target.dispatchEvent(new MouseEvent('mouseleave'));\n expect(tooltip.show).to.be.false;\n });\n\n test('init tooltip position on mouseleave', async () => {\n const wrapper = await fixture(html`\n <div>\n <span id=\"target\">Hover me</span>\n <hy-tooltip>Tooltip Content</hy-tooltip>\n </div>\n `);\n const target = wrapper.querySelector('#target')!;\n const tooltip: TooltipElement = wrapper.querySelector('hy-tooltip')!;\n target.dispatchEvent(new MouseEvent('mouseover'));\n await tooltip.updateComplete;\n expect(tooltip.show).to.be.true;\n expect(tooltip.style.top).to.not.be.empty;\n expect(tooltip.style.left).to.not.be.empty;\n expect(tooltip.style.width).to.not.be.empty;\n\n target.dispatchEvent(new MouseEvent('mouseleave'));\n expect(tooltip.show).to.be.false;\n expect(tooltip.style.top).to.be.empty;\n expect(tooltip.style.left).to.be.empty;\n expect(tooltip.style.width).to.be.empty;\n });\n\n suite('calculates tooltip style correctly', () => {\n test('tooltip style when position is bottom and alignement is center', async () => {\n const wrapper = await fixture(html`\n <div>\n <span id=\"target\">Hover me</span>\n <hy-tooltip position=\"${TooltipPosition.Bottom}\" alignement=\"${TooltipAlignment.Center}\">\n Tooltip Content\n </hy-tooltip>\n </div>\n `);\n const target = wrapper.querySelector('#target')!;\n const tooltip: TooltipElement = wrapper.querySelector('hy-tooltip')!;\n\n target.dispatchEvent(new MouseEvent('mouseover'));\n\n await tooltip.updateComplete;\n\n const targetRect = target.getBoundingClientRect();\n const tooltipRect = tooltip.getBoundingClientRect();\n\n expect(Math.ceil(+tooltip.style.top.split('px')[0])).to.equal(\n Math.ceil(targetRect.bottom + tooltip.verticalOffset)\n );\n expect(Math.ceil(+tooltip.style.left.split('px')[0])).to.equal(\n Math.ceil(targetRect.left - tooltipRect.width / 2 + targetRect.width / 2)\n );\n });\n\n test('tooltip style when position is left and alignement is end', async () => {\n const wrapper = await fixture(html`\n <div>\n <span id=\"target\">Hover me</span>\n <hy-tooltip position=\"${TooltipPosition.Left}\" alignement=\"${TooltipAlignment.End}\">\n Tooltip Content\n </hy-tooltip>\n </div>\n `);\n const target = wrapper.querySelector('#target')!;\n const tooltip: TooltipElement = wrapper.querySelector('hy-tooltip')!;\n\n target.dispatchEvent(new MouseEvent('mouseover'));\n\n await tooltip.updateComplete;\n\n const targetRect = target.getBoundingClientRect();\n const tooltipRect = tooltip.getBoundingClientRect();\n\n expect(Math.ceil(+tooltip.style.top.split('px')[0])).to.equal(Math.ceil(targetRect.bottom - tooltipRect.height));\n expect(Math.ceil(+tooltip.style.left.split('px')[0])).to.equal(\n Math.ceil(targetRect.left - tooltipRect.width - tooltip.horizontalOffset)\n );\n });\n\n test('tooltip style when position is top and alignement is start', async () => {\n const wrapper = await fixture(html`\n <div>\n <span id=\"target\">Hover me</span>\n <hy-tooltip position=\"${TooltipPosition.Top}\" alignement=\"${TooltipAlignment.Start}\">\n Tooltip Content\n </hy-tooltip>\n </div>\n `);\n const target = wrapper.querySelector('#target')!;\n const tooltip: TooltipElement = wrapper.querySelector('hy-tooltip')!;\n\n target.dispatchEvent(new MouseEvent('mouseover'));\n\n await tooltip.updateComplete;\n\n const targetRect = target.getBoundingClientRect();\n const tooltipRect = tooltip.getBoundingClientRect();\n\n expect(Math.ceil(+tooltip.style.top.split('px')[0])).to.equal(\n Math.ceil(targetRect.top - tooltipRect.height - tooltip.verticalOffset)\n );\n expect(Math.ceil(+tooltip.style.left.split('px')[0])).to.equal(\n Math.ceil(targetRect.left - tooltip.horizontalOffset)\n );\n });\n });\n\n suite('removes event listeners on disconnectedCallback', () => {\n test('removes mouseleave listener', async () => {\n const wrapper = await fixture(html`\n <div>\n <span id=\"target\">Hover me</span>\n <hy-tooltip>Tooltip Content</hy-tooltip>\n </div>\n `);\n const target = wrapper.querySelector('#target')!;\n const tooltip: TooltipElement = wrapper.querySelector('hy-tooltip')!;\n\n target.dispatchEvent(new MouseEvent('mouseover'));\n expect(tooltip.show).to.be.true;\n\n target.dispatchEvent(new MouseEvent('mouseleave'));\n expect(tooltip.show).to.be.false;\n\n target.dispatchEvent(new MouseEvent('mouseover'));\n expect(tooltip.show).to.be.true;\n\n wrapper.removeChild(tooltip);\n target.dispatchEvent(new MouseEvent('mouseleave'));\n expect(tooltip.show).to.be.true;\n });\n\n test('removes mouseover listener', async () => {\n const wrapper = await fixture(html`\n <div>\n <span id=\"target\">Hover me</span>\n <hy-tooltip>Tooltip Content</hy-tooltip>\n </div>\n `);\n const target = wrapper.querySelector('#target')!;\n const tooltip: TooltipElement = wrapper.querySelector('hy-tooltip')!;\n\n target.dispatchEvent(new MouseEvent('mouseover'));\n expect(tooltip.show).to.be.true;\n\n target.dispatchEvent(new MouseEvent('mouseleave'));\n expect(tooltip.show).to.be.false;\n\n wrapper.removeChild(tooltip);\n target.dispatchEvent(new MouseEvent('mouseover'));\n expect(tooltip.show).to.be.false;\n });\n });\n});\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LitElement, nothing, PropertyValueMap } from 'lit';
|
|
2
|
+
import '../button/hy-button.component.js';
|
|
3
|
+
import { TooltipAlignment, TooltipPosition } from './tooltips.constant.js';
|
|
4
|
+
export declare class TooltipElement extends LitElement {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
position: TooltipPosition;
|
|
7
|
+
alignement: TooltipAlignment;
|
|
8
|
+
target: Element;
|
|
9
|
+
show: boolean;
|
|
10
|
+
isPopConfirm: boolean;
|
|
11
|
+
popConfirmTitle: string;
|
|
12
|
+
popConfirmDescription: string;
|
|
13
|
+
okText: string;
|
|
14
|
+
cancelText: string;
|
|
15
|
+
horizontalOffset: number;
|
|
16
|
+
verticalOffset: number;
|
|
17
|
+
connectedCallback(): void;
|
|
18
|
+
private onMouseOver;
|
|
19
|
+
private onMouseLeave;
|
|
20
|
+
private onClick;
|
|
21
|
+
private initStyles;
|
|
22
|
+
updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
23
|
+
private calculatePosition;
|
|
24
|
+
private calculateYposition;
|
|
25
|
+
private calculateYalignement;
|
|
26
|
+
private calculateXposition;
|
|
27
|
+
private calculateXalignement;
|
|
28
|
+
onPopConfirmCancel(): void;
|
|
29
|
+
onPopConfirmConfirm(): void;
|
|
30
|
+
onClickOutside: (onClickEvent: Event) => void;
|
|
31
|
+
disconnectedCallback(): void;
|
|
32
|
+
render(): typeof nothing | import("lit").TemplateResult<1>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=tooltips.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltips.component.d.ts","sourceRoot":"","sources":["../../../src/components/tooltips/tooltips.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,UAAU,EAAE,OAAO,EAAE,gBAAgB,EAAC,MAAM,KAAK,CAAC;AAGhE,OAAO,kCAAkC,CAAC;AAC1C,OAAO,EAAe,gBAAgB,EAAE,eAAe,EAAC,MAAM,wBAAwB,CAAC;AACvF,qBACa,cAAe,SAAQ,UAAU;IAC5C,OAAgB,MAAM,4BAAU;IAGhC,QAAQ,kBAA0B;IAGlC,UAAU,mBAA2B;IAGrC,MAAM,EAAG,OAAO,CAAC;IAEjB,IAAI,UAAS;IAEb,YAAY,UAAS;IAErB,eAAe,SAAM;IAErB,qBAAqB,SAAM;IAE3B,MAAM,SAAS;IAEf,UAAU,SAAQ;IAElB,gBAAgB,SAAM;IACtB,cAAc,SAAM;IACX,iBAAiB,IAAI,IAAI;IAalC,OAAO,CAAC,WAAW,CAEjB;IAEF,OAAO,CAAC,YAAY,CAGlB;IAEF,OAAO,CAAC,OAAO,CAEb;IAEF,OAAO,CAAC,UAAU;IAOT,OAAO,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,IAAI;IAI7F,OAAO,CAAC,iBAAiB,CAWvB;IACF,OAAO,CAAC,kBAAkB,CA0BxB;IACF,OAAO,CAAC,oBAAoB,CA4C1B;IACF,OAAO,CAAC,kBAAkB,CA0BxB;IACF,OAAO,CAAC,oBAAoB,CA2C1B;IAEF,kBAAkB;IAKlB,mBAAmB;IAKnB,cAAc,iBAAkB,KAAK,UAInC;IACO,oBAAoB,IAAI,IAAI;IAW5B,MAAM;CAsBhB"}
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
+
import { html, LitElement, nothing } from 'lit';
|
|
9
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
10
|
+
import { styles } from './tooltips.style.js';
|
|
11
|
+
import '../button/hy-button.component.js';
|
|
12
|
+
import { EMPTY_STRING, TooltipAlignment, TooltipPosition } from './tooltips.constant.js';
|
|
13
|
+
let TooltipElement = class TooltipElement extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.position = TooltipPosition.Bottom;
|
|
17
|
+
this.alignement = TooltipAlignment.Center;
|
|
18
|
+
this.show = false;
|
|
19
|
+
this.isPopConfirm = false;
|
|
20
|
+
this.popConfirmTitle = '';
|
|
21
|
+
this.popConfirmDescription = '';
|
|
22
|
+
this.okText = 'Yes';
|
|
23
|
+
this.cancelText = 'No';
|
|
24
|
+
this.horizontalOffset = 10;
|
|
25
|
+
this.verticalOffset = 10;
|
|
26
|
+
this.onMouseOver = () => {
|
|
27
|
+
this.show = true;
|
|
28
|
+
};
|
|
29
|
+
this.onMouseLeave = () => {
|
|
30
|
+
this.show = false;
|
|
31
|
+
this.initStyles();
|
|
32
|
+
};
|
|
33
|
+
this.onClick = () => {
|
|
34
|
+
this.show = !this.show;
|
|
35
|
+
};
|
|
36
|
+
this.calculatePosition = () => {
|
|
37
|
+
this.initStyles();
|
|
38
|
+
this.style.width = `${this.clientWidth}px`;
|
|
39
|
+
if (this.position == TooltipPosition.Bottom || this.position == TooltipPosition.Top) {
|
|
40
|
+
this.calculateYposition();
|
|
41
|
+
this.calculateYalignement();
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.calculateXposition();
|
|
45
|
+
this.calculateXalignement();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this.calculateYposition = () => {
|
|
49
|
+
const targetRect = this.target.getBoundingClientRect();
|
|
50
|
+
const targetWithTopSpaceHeight = targetRect.bottom;
|
|
51
|
+
const topAvailableSpace = targetRect.top;
|
|
52
|
+
const totalViewPortHeight = window.visualViewport.height;
|
|
53
|
+
const tooltipHeight = this.clientHeight;
|
|
54
|
+
const isAvailableBottomSpace = tooltipHeight + this.verticalOffset < totalViewPortHeight - targetWithTopSpaceHeight;
|
|
55
|
+
const isAvailableTopSpace = tooltipHeight + this.verticalOffset < topAvailableSpace;
|
|
56
|
+
if (this.position == TooltipPosition.Bottom) {
|
|
57
|
+
if (isAvailableBottomSpace || !isAvailableTopSpace) {
|
|
58
|
+
this.classList.add('bottom-position');
|
|
59
|
+
this.style.top = `${targetWithTopSpaceHeight + this.verticalOffset}px`;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.classList.add('top-position');
|
|
63
|
+
this.style.top = `${topAvailableSpace - tooltipHeight - this.verticalOffset}px`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
if (isAvailableTopSpace || !isAvailableBottomSpace) {
|
|
68
|
+
this.classList.add('top-position');
|
|
69
|
+
this.style.top = `${topAvailableSpace - tooltipHeight - this.verticalOffset}px`;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
this.classList.add('bottom-position');
|
|
73
|
+
this.style.top = `${targetWithTopSpaceHeight + this.verticalOffset}px`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
this.calculateYalignement = () => {
|
|
78
|
+
const targetRect = this.target.getBoundingClientRect();
|
|
79
|
+
const leftSpaceAndTargetWidth = targetRect.right;
|
|
80
|
+
const targetWidth = targetRect.width;
|
|
81
|
+
const leftSpace = targetRect.left;
|
|
82
|
+
const tooltipWidth = this.clientWidth;
|
|
83
|
+
const leftSpaceAndHalfOfTargetWidth = leftSpace + targetWidth / 2;
|
|
84
|
+
const totalViewPortWidth = window.visualViewport.width;
|
|
85
|
+
const rightSpaceAndHalfOfTargetWidth = totalViewPortWidth - leftSpaceAndTargetWidth + targetWidth / 2;
|
|
86
|
+
if (this.alignement == TooltipAlignment.Start) {
|
|
87
|
+
const canBeAtStart = tooltipWidth + leftSpace < totalViewPortWidth;
|
|
88
|
+
if (canBeAtStart) {
|
|
89
|
+
this.classList.add('alignement-start');
|
|
90
|
+
this.style.left = `${leftSpace - this.horizontalOffset}px`;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
this.classList.add('alignement-end');
|
|
94
|
+
this.style.left = `${leftSpace - tooltipWidth + this.horizontalOffset}px`;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else if (this.alignement == TooltipAlignment.End) {
|
|
98
|
+
const canBeAtEnd = tooltipWidth < leftSpace;
|
|
99
|
+
if (canBeAtEnd) {
|
|
100
|
+
this.classList.add('alignement-end');
|
|
101
|
+
this.style.left = `${leftSpace - tooltipWidth + this.horizontalOffset}px`;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this.classList.add('alignement-start');
|
|
105
|
+
this.style.left = `${leftSpace - this.horizontalOffset}px`;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const canBeCentered = (tooltipWidth / 2 < leftSpaceAndHalfOfTargetWidth && tooltipWidth / 2 < rightSpaceAndHalfOfTargetWidth) ||
|
|
110
|
+
(tooltipWidth > leftSpaceAndHalfOfTargetWidth && tooltipWidth > rightSpaceAndHalfOfTargetWidth);
|
|
111
|
+
const canBeAtEnd = tooltipWidth < leftSpaceAndHalfOfTargetWidth;
|
|
112
|
+
if (canBeCentered) {
|
|
113
|
+
this.classList.add('alignement-center');
|
|
114
|
+
this.style.left = `${leftSpace - tooltipWidth / 2 + targetWidth / 2}px`;
|
|
115
|
+
}
|
|
116
|
+
else if (canBeAtEnd) {
|
|
117
|
+
this.classList.add('alignement-end');
|
|
118
|
+
this.style.left = `${leftSpace - tooltipWidth + this.horizontalOffset}px`;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this.classList.add('alignement-start');
|
|
122
|
+
this.style.left = `${leftSpace - this.horizontalOffset}px`;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
this.calculateXposition = () => {
|
|
127
|
+
const targetRect = this.target.getBoundingClientRect();
|
|
128
|
+
const leftSpace = targetRect.left;
|
|
129
|
+
const leftSpaceAndTargetWidth = targetRect.right;
|
|
130
|
+
const totalViewPortWidth = window.visualViewport.width;
|
|
131
|
+
const tooltipWidth = this.clientWidth;
|
|
132
|
+
const isAvailableRightSpace = tooltipWidth + this.horizontalOffset < totalViewPortWidth - leftSpaceAndTargetWidth;
|
|
133
|
+
const isAvailableLeftSpace = tooltipWidth + this.horizontalOffset < leftSpace;
|
|
134
|
+
if (this.position == TooltipPosition.Right) {
|
|
135
|
+
if (isAvailableRightSpace || !isAvailableLeftSpace) {
|
|
136
|
+
this.classList.add('right-position');
|
|
137
|
+
this.style.left = `${leftSpaceAndTargetWidth + this.horizontalOffset}px`;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
this.classList.add('left-position');
|
|
141
|
+
this.style.left = `${leftSpace - tooltipWidth - this.horizontalOffset}px`;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
if (isAvailableLeftSpace || !isAvailableRightSpace) {
|
|
146
|
+
this.classList.add('left-position');
|
|
147
|
+
this.style.left = `${leftSpace - tooltipWidth - this.horizontalOffset}px`;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
this.classList.add('right-position');
|
|
151
|
+
this.style.left = `${leftSpaceAndTargetWidth + this.horizontalOffset}px`;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
this.calculateXalignement = () => {
|
|
156
|
+
const targetRect = this.target.getBoundingClientRect();
|
|
157
|
+
const topSpace = targetRect.top;
|
|
158
|
+
const targetHeight = targetRect.height;
|
|
159
|
+
const targetWithTopSpaceHeight = targetRect.bottom;
|
|
160
|
+
const tooltipHeight = this.clientHeight;
|
|
161
|
+
const totalViewPortHeight = window.visualViewport.height;
|
|
162
|
+
const bottomSpace = totalViewPortHeight - targetWithTopSpaceHeight;
|
|
163
|
+
if (this.alignement == TooltipAlignment.End) {
|
|
164
|
+
const canBeAtEnd = tooltipHeight < topSpace;
|
|
165
|
+
if (canBeAtEnd) {
|
|
166
|
+
this.classList.add('alignement-end');
|
|
167
|
+
this.style.top = `${targetWithTopSpaceHeight - tooltipHeight}px`;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
this.classList.add('alignement-start');
|
|
171
|
+
this.style.top = `${topSpace - targetHeight / 4}px`;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
else if (this.alignement == TooltipAlignment.Start) {
|
|
175
|
+
const canBeAtStart = tooltipHeight < totalViewPortHeight - targetWithTopSpaceHeight;
|
|
176
|
+
if (canBeAtStart) {
|
|
177
|
+
this.classList.add('alignement-start');
|
|
178
|
+
this.style.top = `${topSpace - targetHeight / 4}px`;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
this.classList.add('alignement-end');
|
|
182
|
+
this.style.top = `${targetWithTopSpaceHeight - tooltipHeight}px`;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
const canBeCentered = (tooltipHeight / 2 < topSpace && tooltipHeight / 2 < bottomSpace) ||
|
|
187
|
+
(tooltipHeight > topSpace && tooltipHeight > bottomSpace);
|
|
188
|
+
const canBeAtEnd = tooltipHeight < topSpace;
|
|
189
|
+
if (canBeCentered) {
|
|
190
|
+
this.classList.add('alignement-center');
|
|
191
|
+
this.style.top = `${topSpace + targetHeight / 2 - tooltipHeight / 2}px`;
|
|
192
|
+
}
|
|
193
|
+
else if (canBeAtEnd) {
|
|
194
|
+
this.classList.add('alignement-end');
|
|
195
|
+
this.style.top = `${targetWithTopSpaceHeight - tooltipHeight}px`;
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
this.classList.add('alignement-start');
|
|
199
|
+
this.style.top = `${topSpace - targetHeight / 4}px`;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
this.onClickOutside = (onClickEvent) => {
|
|
204
|
+
const eventPath = onClickEvent.composedPath();
|
|
205
|
+
const outsideClick = !eventPath.includes(this.target) && !eventPath.includes(this);
|
|
206
|
+
if (outsideClick)
|
|
207
|
+
this.show = false;
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
connectedCallback() {
|
|
211
|
+
super.connectedCallback();
|
|
212
|
+
this.target = this.previousElementSibling;
|
|
213
|
+
if (!this.isPopConfirm) {
|
|
214
|
+
this.target.addEventListener('mouseover', this.onMouseOver);
|
|
215
|
+
this.target.addEventListener('mouseleave', this.onMouseLeave);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
document.addEventListener('scroll', this.calculatePosition);
|
|
219
|
+
this.target.addEventListener('click', this.onClick);
|
|
220
|
+
document.addEventListener('click', this.onClickOutside);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
initStyles() {
|
|
224
|
+
this.style.top = EMPTY_STRING;
|
|
225
|
+
this.style.left = EMPTY_STRING;
|
|
226
|
+
this.style.width = EMPTY_STRING;
|
|
227
|
+
this.classList.remove(...this.classList.values());
|
|
228
|
+
}
|
|
229
|
+
updated(_changedProperties) {
|
|
230
|
+
if (this.show)
|
|
231
|
+
this.calculatePosition();
|
|
232
|
+
}
|
|
233
|
+
onPopConfirmCancel() {
|
|
234
|
+
this.dispatchEvent(new CustomEvent('onCancel'));
|
|
235
|
+
this.show = false;
|
|
236
|
+
this.initStyles();
|
|
237
|
+
}
|
|
238
|
+
onPopConfirmConfirm() {
|
|
239
|
+
this.dispatchEvent(new CustomEvent('onConfirm'));
|
|
240
|
+
this.show = false;
|
|
241
|
+
this.initStyles();
|
|
242
|
+
}
|
|
243
|
+
disconnectedCallback() {
|
|
244
|
+
super.disconnectedCallback();
|
|
245
|
+
if (!this.isPopConfirm) {
|
|
246
|
+
this.target.removeEventListener('mouseover', this.onMouseOver);
|
|
247
|
+
this.target.removeEventListener('mouseleave', this.onMouseLeave);
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
this.target.removeEventListener('click', this.onClick);
|
|
251
|
+
document.removeEventListener('scroll', this.calculatePosition);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
render() {
|
|
255
|
+
return !this.isPopConfirm
|
|
256
|
+
? this.show
|
|
257
|
+
? html `<slot></slot>`
|
|
258
|
+
: nothing
|
|
259
|
+
: this.show
|
|
260
|
+
? html `
|
|
261
|
+
<div class="popconfirm-container">
|
|
262
|
+
<p class="popconfirm-title">${this.popConfirmTitle}</p>
|
|
263
|
+
<p class="popconfirm-description">${this.popConfirmDescription}</p>
|
|
264
|
+
<div class="btn-block">
|
|
265
|
+
<hy-button .size=${'small'} type=${'primary'} @click=${this.onPopConfirmConfirm}
|
|
266
|
+
>${this.okText}</hy-button
|
|
267
|
+
>
|
|
268
|
+
<hy-button .size=${'small'} type=${'danger'} @click=${this.onPopConfirmCancel}
|
|
269
|
+
>${this.cancelText}</hy-button
|
|
270
|
+
>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
`
|
|
274
|
+
: nothing;
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
TooltipElement.styles = styles;
|
|
278
|
+
__decorate([
|
|
279
|
+
property({ reflect: true })
|
|
280
|
+
], TooltipElement.prototype, "position", void 0);
|
|
281
|
+
__decorate([
|
|
282
|
+
property({ reflect: true })
|
|
283
|
+
], TooltipElement.prototype, "alignement", void 0);
|
|
284
|
+
__decorate([
|
|
285
|
+
state()
|
|
286
|
+
], TooltipElement.prototype, "target", void 0);
|
|
287
|
+
__decorate([
|
|
288
|
+
property({ reflect: true, type: Boolean })
|
|
289
|
+
], TooltipElement.prototype, "show", void 0);
|
|
290
|
+
__decorate([
|
|
291
|
+
property()
|
|
292
|
+
], TooltipElement.prototype, "isPopConfirm", void 0);
|
|
293
|
+
__decorate([
|
|
294
|
+
property()
|
|
295
|
+
], TooltipElement.prototype, "popConfirmTitle", void 0);
|
|
296
|
+
__decorate([
|
|
297
|
+
property()
|
|
298
|
+
], TooltipElement.prototype, "popConfirmDescription", void 0);
|
|
299
|
+
__decorate([
|
|
300
|
+
property()
|
|
301
|
+
], TooltipElement.prototype, "okText", void 0);
|
|
302
|
+
__decorate([
|
|
303
|
+
property()
|
|
304
|
+
], TooltipElement.prototype, "cancelText", void 0);
|
|
305
|
+
TooltipElement = __decorate([
|
|
306
|
+
customElement('hy-tooltip')
|
|
307
|
+
], TooltipElement);
|
|
308
|
+
export { TooltipElement };
|
|
309
|
+
//# sourceMappingURL=tooltips.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltips.component.js","sourceRoot":"","sources":["../../../src/components/tooltips/tooltips.component.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAuD;AACvD,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAmB,MAAM,KAAK,CAAC;AAChE,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAC3C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAEvF,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;QAcZ,gBAAW,GAAG,GAAG,EAAE;YACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;QAEM,iBAAY,GAAG,GA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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 '../button/hy-button.component.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 this.target = this.previousElementSibling!;\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 <hy-button .size=${'small'} type=${'primary'} @click=${this.onPopConfirmConfirm}\n >${this.okText}</hy-button\n >\n <hy-button .size=${'small'} type=${'danger'} @click=${this.onPopConfirmCancel}\n >${this.cancelText}</hy-button\n >\n </div>\n </div>\n `\n : nothing;\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum TooltipPosition {
|
|
2
|
+
Top = "top",
|
|
3
|
+
Bottom = "bottom",
|
|
4
|
+
Right = "right",
|
|
5
|
+
Left = "left"
|
|
6
|
+
}
|
|
7
|
+
export declare enum TooltipAlignment {
|
|
8
|
+
Start = "start",
|
|
9
|
+
Center = "center",
|
|
10
|
+
End = "end"
|
|
11
|
+
}
|
|
12
|
+
export declare const EMPTY_STRING = "";
|
|
13
|
+
//# sourceMappingURL=tooltips.constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltips.constant.d.ts","sourceRoot":"","sources":["../../../src/components/tooltips/tooltips.constant.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,GAAG,QAAQ;CACZ;AAGD,eAAO,MAAM,YAAY,KAAK,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export var TooltipPosition;
|
|
2
|
+
(function (TooltipPosition) {
|
|
3
|
+
TooltipPosition["Top"] = "top";
|
|
4
|
+
TooltipPosition["Bottom"] = "bottom";
|
|
5
|
+
TooltipPosition["Right"] = "right";
|
|
6
|
+
TooltipPosition["Left"] = "left";
|
|
7
|
+
})(TooltipPosition || (TooltipPosition = {}));
|
|
8
|
+
export var TooltipAlignment;
|
|
9
|
+
(function (TooltipAlignment) {
|
|
10
|
+
TooltipAlignment["Start"] = "start";
|
|
11
|
+
TooltipAlignment["Center"] = "center";
|
|
12
|
+
TooltipAlignment["End"] = "end";
|
|
13
|
+
})(TooltipAlignment || (TooltipAlignment = {}));
|
|
14
|
+
export const EMPTY_STRING = '';
|
|
15
|
+
//# sourceMappingURL=tooltips.constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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 = '';"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltips.style.d.ts","sourceRoot":"","sources":["../../../src/components/tooltips/tooltips.style.ts"],"names":[],"mappings":"AAoGA,eAAO,MAAM,MAAM,2BAAkC,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
import { styleVariables } from './tooltips.variables.js';
|
|
3
|
+
const tooltipStyles = css `
|
|
4
|
+
:host([show]) {
|
|
5
|
+
background-color: var(--hybrid-tooltip-background-color);
|
|
6
|
+
color: var(--hybrid-tooltip-text-color);
|
|
7
|
+
position: fixed;
|
|
8
|
+
padding: 5px;
|
|
9
|
+
text-align: center;
|
|
10
|
+
opacity: 0;
|
|
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(--hybrid-tooltip-background-color);
|
|
55
|
+
top: 100%;
|
|
56
|
+
}
|
|
57
|
+
:host(.left-position)::after {
|
|
58
|
+
border-left-color: var(--hybrid-tooltip-background-color);
|
|
59
|
+
left: 100%;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:host(.right-position)::after {
|
|
63
|
+
border-right-color: var(--hybrid-tooltip-background-color);
|
|
64
|
+
right: 100%;
|
|
65
|
+
}
|
|
66
|
+
:host(.bottom-position)::after {
|
|
67
|
+
border-bottom-color: var(--hybrid-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
|
+
`;
|
|
100
|
+
export const styles = [tooltipStyles, styleVariables];
|
|
101
|
+
//# sourceMappingURL=tooltips.style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltips.style.js","sourceRoot":"","sources":["../../../src/components/tooltips/tooltips.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEvD,MAAM,aAAa,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgGxB,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(--hybrid-tooltip-background-color);\n color: var(--hybrid-tooltip-text-color);\n position: fixed;\n padding: 5px;\n text-align: center;\n opacity: 0;\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(--hybrid-tooltip-background-color);\n top: 100%;\n }\n :host(.left-position)::after {\n border-left-color: var(--hybrid-tooltip-background-color);\n left: 100%;\n }\n\n :host(.right-position)::after {\n border-right-color: var(--hybrid-tooltip-background-color);\n right: 100%;\n }\n :host(.bottom-position)::after {\n border-bottom-color: var(--hybrid-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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltips.variables.d.ts","sourceRoot":"","sources":["../../../src/components/tooltips/tooltips.variables.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,yBAW1B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styleVariables = css `
|
|
3
|
+
:host {
|
|
4
|
+
--hybrid-tooltip-background-color: #393939;
|
|
5
|
+
--hybrid-tooltip-text-color: #ffffff;
|
|
6
|
+
}
|
|
7
|
+
@media (prefers-color-scheme: dark) {
|
|
8
|
+
:host {
|
|
9
|
+
--hybrid-tooltip-background-color: #f4f4f4;
|
|
10
|
+
--hybrid-tooltip-text-color: #161616;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
//# sourceMappingURL=tooltips.variables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltips.variables.js","sourceRoot":"","sources":["../../../src/components/tooltips/tooltips.variables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;CAWhC,CAAC","sourcesContent":["import {css} from 'lit';\n\nexport const styleVariables = css`\n :host {\n --hybrid-tooltip-background-color: #393939;\n --hybrid-tooltip-text-color: #ffffff;\n }\n @media (prefers-color-scheme: dark) {\n :host {\n --hybrid-tooltip-background-color: #f4f4f4;\n --hybrid-tooltip-text-color: #161616;\n }\n }\n`;\n"]}
|