fleetcor-lwc 1.4.0 → 1.4.2
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/README.md
CHANGED
|
@@ -68,22 +68,17 @@ Icon:
|
|
|
68
68
|
|
|
69
69
|
<flt-icon icon="arrow-left"></flt-icon>
|
|
70
70
|
|
|
71
|
-
arrow-left
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
oil | key | blocked | multiple-users |
|
|
75
|
-
arrow-right |
|
|
76
|
-
...
|
|
71
|
+
arrow-left | ev | carwash | car | van | unleaded | fuel | driver | vehicle |
|
|
72
|
+
both | shared-card | ev-and-fuel | oil | key | blocked | multiple-users |
|
|
73
|
+
arrow-right | ...
|
|
77
74
|
```
|
|
78
75
|
|
|
79
76
|
```html
|
|
80
77
|
Tooltip:
|
|
81
78
|
|
|
82
|
-
<flt-tooltip
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<!-- Any html element -->
|
|
86
|
-
<flt-icon icon="arrow-left"></flt-icon>
|
|
79
|
+
<flt-tooltip content="Text description info" corner="12">
|
|
80
|
+
<!-- Any html element -->
|
|
81
|
+
<flt-icon icon="arrow-left"></flt-icon>
|
|
87
82
|
</flt-tooltip>
|
|
88
83
|
|
|
89
84
|
...
|
|
@@ -134,6 +129,16 @@ $FLT_BUTTON_LINK_HOVER_COLOR: var(--flt-button-link-hover-color, #6b7280);
|
|
|
134
129
|
|
|
135
130
|
## Release Notes:
|
|
136
131
|
|
|
132
|
+
- v.1.4.2
|
|
133
|
+
- Bug fix selectors conflicts
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
- v.1.4.1
|
|
138
|
+
- Bug fix with empty content and svg max width
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
137
142
|
- v.1.4.0
|
|
138
143
|
- Added Component `flt-tooltip`
|
|
139
144
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template lwc:render-mode="light">
|
|
2
|
-
<div class="tooltip" onmouseover={over} ontouchstart={over} onmouseout={out} ontouchend={out}>
|
|
2
|
+
<div class="flt-tooltip" onmouseover={over} ontouchstart={over} onmouseout={out} ontouchend={out}>
|
|
3
3
|
<slot></slot>
|
|
4
|
-
<div class={tooltipVisibility} style={conentStyle}>
|
|
5
|
-
<svg class="tooltip__svg" height={svgH} width={svgW} style={svgStyle}>
|
|
6
|
-
<path class="tooltip__path" d={svgD}></path>
|
|
4
|
+
<div if:true={content} class={tooltipVisibility} style={conentStyle}>
|
|
5
|
+
<svg class="flt-tooltip__svg" height={svgH} width={svgW} style={svgStyle}>
|
|
6
|
+
<path class="flt-tooltip__path" d={svgD}></path>
|
|
7
7
|
</svg>
|
|
8
|
-
<p class="tooltip__text" style={textStyle}></p>
|
|
8
|
+
<p class="flt-tooltip__text" style={textStyle}></p>
|
|
9
9
|
</div>
|
|
10
10
|
</div>
|
|
11
11
|
</template>
|
|
@@ -56,7 +56,7 @@ export default class Tooltip extends LightningElement {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
get tooltipVisibility() {
|
|
59
|
-
return this.active ? 'tooltip__content tooltip__content_visible' : 'tooltip__content'
|
|
59
|
+
return this.active ? 'flt-tooltip__content flt-tooltip__content_visible' : 'flt-tooltip__content'
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
get svgD() {
|
|
@@ -200,24 +200,28 @@ export default class Tooltip extends LightningElement {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
connectedCallback() {
|
|
203
|
-
|
|
203
|
+
if (this.content) {
|
|
204
|
+
this.resizeObserver = new ResizeObserver(this.update.bind(this))
|
|
205
|
+
}
|
|
204
206
|
}
|
|
205
207
|
|
|
206
208
|
update() {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
if (this.content) {
|
|
210
|
+
const text = this.firstChild.querySelector('.flt-tooltip__text')
|
|
211
|
+
text.innerHTML = this.content
|
|
212
|
+
this.createTooltip()
|
|
213
|
+
}
|
|
210
214
|
}
|
|
211
215
|
|
|
212
216
|
over() {
|
|
213
|
-
if (!this.active) {
|
|
217
|
+
if (!this.active && this.content) {
|
|
214
218
|
this.active = true
|
|
215
219
|
this.createTooltip()
|
|
216
220
|
}
|
|
217
221
|
}
|
|
218
222
|
|
|
219
223
|
out() {
|
|
220
|
-
if (this.active) {
|
|
224
|
+
if (this.active && this.content) {
|
|
221
225
|
this.active = false
|
|
222
226
|
this.childElementRect = this.firstChild.firstChild.getBoundingClientRect()
|
|
223
227
|
this.leftPosition = (this.childElementRect.width - this.svgW) / 2
|
|
@@ -228,7 +232,7 @@ export default class Tooltip extends LightningElement {
|
|
|
228
232
|
|
|
229
233
|
createTooltip() {
|
|
230
234
|
// 1. find width of tooltip
|
|
231
|
-
const text = this.firstChild.querySelector('.tooltip__text')
|
|
235
|
+
const text = this.firstChild.querySelector('.flt-tooltip__text')
|
|
232
236
|
this.minimalWidth = getLineWidth(text)
|
|
233
237
|
if (this.minimalWidth < this.maxWidth) {
|
|
234
238
|
this.minimalWidth = this.minimalWidth + this.paddingX * 2 + 2 * this.delta
|
|
@@ -262,7 +266,9 @@ export default class Tooltip extends LightningElement {
|
|
|
262
266
|
}
|
|
263
267
|
|
|
264
268
|
renderedCallback() {
|
|
265
|
-
|
|
269
|
+
if (this.content) {
|
|
270
|
+
this.resizeObserver.observe(this.firstChild)
|
|
271
|
+
}
|
|
266
272
|
}
|
|
267
273
|
}
|
|
268
274
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@import './../../../common/mixins_aquamarine';
|
|
2
2
|
/* mixins */
|
|
3
3
|
|
|
4
|
-
.tooltip {
|
|
4
|
+
.flt-tooltip {
|
|
5
5
|
display: inline-block;
|
|
6
6
|
cursor: pointer;
|
|
7
7
|
position: relative;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
opacity: 0;
|
|
16
16
|
font-size: 16px;
|
|
17
17
|
line-height: 1.3;
|
|
18
|
+
max-width: initial;
|
|
18
19
|
transition: opacity 0.3s ease-out;
|
|
19
20
|
|
|
20
21
|
&_visible {
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
|
|
35
36
|
&__svg {
|
|
36
37
|
position: absolute;
|
|
38
|
+
max-width: initial;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
&__path {
|