@descope-ui/descope-tooltip 2.2.13 → 2.2.15
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/CHANGELOG.md +4 -0
- package/e2e/descope-tooltip.spec.ts +8 -0
- package/package.json +5 -5
- package/src/component/TooltipClass.js +40 -5
- package/src/theme.js +33 -3
- package/stories/descope-tooltip.stories.js +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [2.2.15](https://github.com/descope/web-components-ui/compare/web-components-ui-2.2.14...web-components-ui-2.2.15) (2025-12-23)
|
|
6
|
+
|
|
7
|
+
## [2.2.14](https://github.com/descope/web-components-ui/compare/web-components-ui-2.2.13...web-components-ui-2.2.14) (2025-12-22)
|
|
8
|
+
|
|
5
9
|
## [2.2.13](https://github.com/descope/web-components-ui/compare/web-components-ui-2.2.12...web-components-ui-2.2.13) (2025-12-21)
|
|
6
10
|
|
|
7
11
|
# Changelog
|
|
@@ -18,6 +18,7 @@ const componentAttributes = {
|
|
|
18
18
|
'end-bottom',
|
|
19
19
|
],
|
|
20
20
|
opened: ['true', 'false'],
|
|
21
|
+
shadow: ['', 'sm', 'md', 'lg', 'xl'],
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
const storyName = 'descope-tooltip';
|
|
@@ -95,4 +96,11 @@ test.describe('logic', () => {
|
|
|
95
96
|
await page.waitForTimeout(3000);
|
|
96
97
|
expect(await container.screenshot()).toMatchSnapshot();
|
|
97
98
|
});
|
|
99
|
+
|
|
100
|
+
test('static-display', async ({ page }) => {
|
|
101
|
+
await page.goto(getStoryUrl(storyName, { opened: 'true', 'static-display': 'true' }));
|
|
102
|
+
const container = page.locator('.story-wrapper');
|
|
103
|
+
|
|
104
|
+
expect(await container.screenshot()).toMatchSnapshot();
|
|
105
|
+
});
|
|
98
106
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descope-ui/descope-tooltip",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.15",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./src/component/index.js"
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@playwright/test": "1.38.1",
|
|
17
|
-
"e2e-utils": "2.2.
|
|
17
|
+
"e2e-utils": "2.2.15"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@vaadin/tooltip": "24.3.4",
|
|
21
|
-
"@descope-ui/common": "2.2.
|
|
22
|
-
"@descope-ui/theme-globals": "2.2.
|
|
23
|
-
"@descope-ui/descope-enriched-text": "2.2.
|
|
21
|
+
"@descope-ui/common": "2.2.15",
|
|
22
|
+
"@descope-ui/theme-globals": "2.2.15",
|
|
23
|
+
"@descope-ui/descope-enriched-text": "2.2.15"
|
|
24
24
|
},
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"link-workspace-packages": false
|
|
@@ -46,6 +46,24 @@ class RawTooltip extends BaseClass {
|
|
|
46
46
|
return this.getAttribute('text')?.trim() || '';
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
get isStaticDisplay() {
|
|
50
|
+
return this.getAttribute('static-display') === 'true';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// We use `static-display` for presentation purposes, to show the tooltip content.
|
|
54
|
+
// This should be used only when `opened` is `true`. Once `static-display` is set,
|
|
55
|
+
// the overlay would become a `static` element, and will have layout in the presenting page.
|
|
56
|
+
// This is mainly aimed to solve the presentation problem on our Styles Page in the Console.
|
|
57
|
+
#handleStaticDisplay() {
|
|
58
|
+
if (this.isStaticDisplay) {
|
|
59
|
+
this.#revealWrappedParts();
|
|
60
|
+
this.setAttribute('inert', 'true');
|
|
61
|
+
} else {
|
|
62
|
+
this.#hideWrappedParts();
|
|
63
|
+
this.removeAttribute('inert');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
49
67
|
init() {
|
|
50
68
|
super.init();
|
|
51
69
|
|
|
@@ -54,15 +72,29 @@ class RawTooltip extends BaseClass {
|
|
|
54
72
|
this.insertAdjacentHTML('beforeend', '<vaadin-tooltip></vaadin-tooltip>');
|
|
55
73
|
this.tooltip = this.querySelector('vaadin-tooltip');
|
|
56
74
|
|
|
75
|
+
this.#hideWrappedParts();
|
|
76
|
+
|
|
77
|
+
this.#setTooltipTarget();
|
|
78
|
+
|
|
79
|
+
setTimeout(() => this.#onOverlayReady());
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#hideWrappedParts() {
|
|
57
83
|
this.tooltip.style.width = '0';
|
|
58
84
|
this.tooltip.style.height = '0';
|
|
59
85
|
this.tooltip.style.display = 'block';
|
|
60
86
|
this.tooltip.style.overflow = 'hidden';
|
|
61
87
|
this.tooltip.style.position = 'absolute';
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
#revealWrappedParts() {
|
|
91
|
+
this.tooltip.style.width = '100%';
|
|
92
|
+
this.tooltip.style.height = '100%';
|
|
93
|
+
this.tooltip.style.position = 'static';
|
|
94
|
+
this.tooltip.style.overflow = 'visible';
|
|
95
|
+
this.tooltip.textContent = '';
|
|
96
|
+
this.overlay.style.display = 'block';
|
|
97
|
+
this.overlay.style.position = 'static';
|
|
66
98
|
}
|
|
67
99
|
|
|
68
100
|
#onOverlayReady() {
|
|
@@ -127,7 +159,10 @@ class RawTooltip extends BaseClass {
|
|
|
127
159
|
// When `opened` attr is used, vaadin doesn't execute `_attachOverlay`,
|
|
128
160
|
// and the overlay element is rendered outside the component, on the top
|
|
129
161
|
// level. We need to move it back to the local component's DOM.
|
|
130
|
-
setTimeout(() =>
|
|
162
|
+
setTimeout(() => {
|
|
163
|
+
this.tooltip.shadowRoot.appendChild(this.overlay);
|
|
164
|
+
this.#handleStaticDisplay();
|
|
165
|
+
});
|
|
131
166
|
} else {
|
|
132
167
|
this.overlay._detachOverlay = () => {};
|
|
133
168
|
|
package/src/theme.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import globals from '@descope-ui/theme-globals';
|
|
2
|
-
import { getThemeRefs } from '@descope-ui/common/theme-helpers';
|
|
3
|
-
import { TooltipClass } from './component/TooltipClass';
|
|
2
|
+
import { getThemeRefs, createHelperVars } from '@descope-ui/common/theme-helpers';
|
|
3
|
+
import { TooltipClass, componentName } from './component/TooltipClass';
|
|
4
4
|
|
|
5
5
|
const globalRefs = getThemeRefs(globals);
|
|
6
6
|
const vars = TooltipClass.cssVarList;
|
|
7
7
|
|
|
8
|
+
const [helperTheme, helperRefs, helperVars] = createHelperVars(
|
|
9
|
+
{
|
|
10
|
+
shadowColor: '#00000020', // if we want to support transparency vars, we should use different color format
|
|
11
|
+
},
|
|
12
|
+
componentName
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const { shadowColor } = helperRefs;
|
|
16
|
+
const defaultShadow = `${globalRefs.shadow.wide.sm} ${shadowColor}, ${globalRefs.shadow.narrow.sm} ${shadowColor}`;
|
|
17
|
+
|
|
8
18
|
const tooltip = {
|
|
19
|
+
...helperTheme,
|
|
9
20
|
[vars.fontFamily]: globalRefs.fonts.font1.family,
|
|
10
21
|
[vars.fontSize]: globals.typography.body2.size,
|
|
11
22
|
[vars.fontWeight]: globals.typography.body2.weight,
|
|
@@ -18,7 +29,26 @@ const tooltip = {
|
|
|
18
29
|
[vars.borderRadius]: globalRefs.radius.xs,
|
|
19
30
|
[vars.horizontalPadding]: globalRefs.spacing.md,
|
|
20
31
|
[vars.verticalPadding]: globalRefs.spacing.sm,
|
|
21
|
-
[vars.boxShadow]:
|
|
32
|
+
[vars.boxShadow]: defaultShadow,
|
|
33
|
+
|
|
34
|
+
shadow: {
|
|
35
|
+
sm: {
|
|
36
|
+
[vars.boxShadow]: defaultShadow,
|
|
37
|
+
},
|
|
38
|
+
md: {
|
|
39
|
+
[vars.boxShadow]: `${globalRefs.shadow.wide.md} ${shadowColor}, ${globalRefs.shadow.narrow.md} ${shadowColor}`,
|
|
40
|
+
},
|
|
41
|
+
lg: {
|
|
42
|
+
[vars.boxShadow]: `${globalRefs.shadow.wide.lg} ${shadowColor}, ${globalRefs.shadow.narrow.lg} ${shadowColor}`,
|
|
43
|
+
},
|
|
44
|
+
xl: {
|
|
45
|
+
[vars.boxShadow]: `${globalRefs.shadow.wide.xl} ${shadowColor}, ${globalRefs.shadow.narrow.xl} ${shadowColor}`,
|
|
46
|
+
},
|
|
47
|
+
'2xl': {
|
|
48
|
+
[helperVars.shadowColor]: '#00000050', // mimic daisyUI shadow settings
|
|
49
|
+
[vars.boxShadow]: `${globalRefs.shadow.wide['2xl']} ${shadowColor}`,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
22
52
|
};
|
|
23
53
|
|
|
24
54
|
export default tooltip;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { componentName } from '../src/component';
|
|
2
|
-
import { directionControl } from '@descope-ui/common/sb-controls';
|
|
2
|
+
import { boxShadowControl, directionControl } from '@descope-ui/common/sb-controls';
|
|
3
3
|
|
|
4
4
|
const Template = ({
|
|
5
5
|
text,
|
|
@@ -11,6 +11,8 @@ const Template = ({
|
|
|
11
11
|
hideDelay,
|
|
12
12
|
opened,
|
|
13
13
|
readonly,
|
|
14
|
+
shadow,
|
|
15
|
+
'static-display': staticDisplay,
|
|
14
16
|
}) => `
|
|
15
17
|
<descope-tooltip
|
|
16
18
|
text="${text || ''}"
|
|
@@ -20,6 +22,8 @@ const Template = ({
|
|
|
20
22
|
st-host-direction="${direction ?? ''}"
|
|
21
23
|
opened="${opened || false}"
|
|
22
24
|
readonly="${readonly || false}"
|
|
25
|
+
shadow="${shadow || ''}"
|
|
26
|
+
static-display="${staticDisplay || false}"
|
|
23
27
|
>
|
|
24
28
|
${type === 'node' ? `<descope-button class="tooltip-anchor" size="md" variant="contained" mode="primary" full-width="true">Click</descope-button>` : ''}
|
|
25
29
|
${type === 'text' ? `<span class="tooltip-anchor">${textContent}</span>` : ''}
|
|
@@ -105,6 +109,11 @@ export default {
|
|
|
105
109
|
name: 'readonly',
|
|
106
110
|
control: { type: 'boolean' },
|
|
107
111
|
},
|
|
112
|
+
'static-display': {
|
|
113
|
+
name: 'Static Display',
|
|
114
|
+
control: { type: 'boolean' },
|
|
115
|
+
},
|
|
116
|
+
...boxShadowControl,
|
|
108
117
|
},
|
|
109
118
|
};
|
|
110
119
|
|