@spectrum-web-components/tooltip 1.1.0 → 1.1.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/package.json +6 -6
- package/sp-tooltip.d.ts +6 -0
- package/sp-tooltip.dev.js +5 -0
- package/sp-tooltip.dev.js.map +7 -0
- package/sp-tooltip.js +2 -0
- package/sp-tooltip.js.map +7 -0
- package/src/Tooltip.d.ts +48 -0
- package/src/Tooltip.dev.js +259 -0
- package/src/Tooltip.dev.js.map +7 -0
- package/src/Tooltip.js +29 -0
- package/src/Tooltip.js.map +7 -0
- package/src/index.d.ts +1 -0
- package/src/index.dev.js +3 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -0
- package/src/index.js.map +7 -0
- package/src/spectrum-tooltip.css.d.ts +2 -0
- package/src/spectrum-tooltip.css.dev.js +7 -0
- package/src/spectrum-tooltip.css.dev.js.map +7 -0
- package/src/spectrum-tooltip.css.js +4 -0
- package/src/spectrum-tooltip.css.js.map +7 -0
- package/src/tooltip-directive.d.ts +5 -0
- package/src/tooltip-directive.dev.js +27 -0
- package/src/tooltip-directive.dev.js.map +7 -0
- package/src/tooltip-directive.js +6 -0
- package/src/tooltip-directive.js.map +7 -0
- package/src/tooltip-overrides.css.d.ts +2 -0
- package/src/tooltip-overrides.css.dev.js +7 -0
- package/src/tooltip-overrides.css.dev.js.map +7 -0
- package/src/tooltip-overrides.css.js +4 -0
- package/src/tooltip-overrides.css.js.map +7 -0
- package/src/tooltip.css.d.ts +2 -0
- package/src/tooltip.css.dev.js +7 -0
- package/src/tooltip.css.dev.js.map +7 -0
- package/src/tooltip.css.js +4 -0
- package/src/tooltip.css.js.map +7 -0
- package/stories/tooltip-directive.stories.js +117 -0
- package/stories/tooltip-directive.stories.js.map +7 -0
- package/stories/tooltip.stories.js +409 -0
- package/stories/tooltip.stories.js.map +7 -0
- package/test/benchmark/test-basic.js +12 -0
- package/test/benchmark/test-basic.js.map +7 -0
- package/test/benchmark/test-directive.js +13 -0
- package/test/benchmark/test-directive.js.map +7 -0
- package/test/benchmark/test-element.js +13 -0
- package/test/benchmark/test-element.js.map +7 -0
- package/test/benchmark/test-lazy.js +24 -0
- package/test/benchmark/test-lazy.js.map +7 -0
- package/test/tooltip-directive.test-vrt.js +5 -0
- package/test/tooltip-directive.test-vrt.js.map +7 -0
- package/test/tooltip-directive.test.js +101 -0
- package/test/tooltip-directive.test.js.map +7 -0
- package/test/tooltip-memory.test.js +8 -0
- package/test/tooltip-memory.test.js.map +7 -0
- package/test/tooltip.test-vrt.js +5 -0
- package/test/tooltip.test-vrt.js.map +7 -0
- package/test/tooltip.test.js +235 -0
- package/test/tooltip.test.js.map +7 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/tooltip/sp-tooltip.js";
|
|
3
|
+
import { html, nothing } from "@spectrum-web-components/base";
|
|
4
|
+
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
5
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js";
|
|
6
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark.js";
|
|
7
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-info.js";
|
|
8
|
+
import "@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js";
|
|
9
|
+
import "@spectrum-web-components/button/sp-button.js";
|
|
10
|
+
import "@spectrum-web-components/field-label/sp-field-label.js";
|
|
11
|
+
import "@spectrum-web-components/textfield/sp-textfield.js";
|
|
12
|
+
import "@spectrum-web-components/action-button/sp-action-button.js";
|
|
13
|
+
import "@spectrum-web-components/overlay/sp-overlay.js";
|
|
14
|
+
const iconOptions = {
|
|
15
|
+
"": () => html``,
|
|
16
|
+
negative: () => html`
|
|
17
|
+
<sp-icon-alert slot="icon"></sp-icon-alert>
|
|
18
|
+
`,
|
|
19
|
+
positive: () => html`
|
|
20
|
+
<sp-icon-checkmark slot="icon"></sp-icon-checkmark>
|
|
21
|
+
`,
|
|
22
|
+
info: () => html`
|
|
23
|
+
<sp-icon-info slot="icon"></sp-icon-info>
|
|
24
|
+
`
|
|
25
|
+
};
|
|
26
|
+
export default {
|
|
27
|
+
component: "sp-tooltip",
|
|
28
|
+
title: "Tooltip"
|
|
29
|
+
};
|
|
30
|
+
export const Default = ({
|
|
31
|
+
open,
|
|
32
|
+
placement,
|
|
33
|
+
variant,
|
|
34
|
+
text
|
|
35
|
+
}) => {
|
|
36
|
+
return html`
|
|
37
|
+
<sp-tooltip ?open=${open} placement=${placement} variant=${variant}>
|
|
38
|
+
${text}
|
|
39
|
+
</sp-tooltip>
|
|
40
|
+
`;
|
|
41
|
+
};
|
|
42
|
+
Default.args = {
|
|
43
|
+
open: true,
|
|
44
|
+
placement: "top",
|
|
45
|
+
variant: "",
|
|
46
|
+
text: "Tooltip"
|
|
47
|
+
};
|
|
48
|
+
Default.argTypes = {
|
|
49
|
+
open: {
|
|
50
|
+
name: "open",
|
|
51
|
+
type: { name: "boolean", required: false },
|
|
52
|
+
description: "Whether the tooltip is open.",
|
|
53
|
+
table: {
|
|
54
|
+
type: { summary: "boolean" },
|
|
55
|
+
defaultValue: { summary: false }
|
|
56
|
+
},
|
|
57
|
+
control: {
|
|
58
|
+
type: "boolean"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
placement: {
|
|
62
|
+
name: "placement",
|
|
63
|
+
type: { name: "string", required: false },
|
|
64
|
+
description: "The placement of the tooltip in relation to its parent",
|
|
65
|
+
table: {
|
|
66
|
+
type: { summary: "string" },
|
|
67
|
+
defaultValue: { summary: "top" }
|
|
68
|
+
},
|
|
69
|
+
control: {
|
|
70
|
+
type: "inline-radio",
|
|
71
|
+
options: [
|
|
72
|
+
"auto",
|
|
73
|
+
"auto-start",
|
|
74
|
+
"auto-end",
|
|
75
|
+
"top",
|
|
76
|
+
"bottom",
|
|
77
|
+
"right",
|
|
78
|
+
"left",
|
|
79
|
+
"top-start",
|
|
80
|
+
"top-end",
|
|
81
|
+
"bottom-start",
|
|
82
|
+
"bottom-end",
|
|
83
|
+
"right-start",
|
|
84
|
+
"right-end",
|
|
85
|
+
"left-start",
|
|
86
|
+
"left-end",
|
|
87
|
+
"none"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
text: {
|
|
92
|
+
name: "text",
|
|
93
|
+
type: { name: "string", required: false },
|
|
94
|
+
table: {
|
|
95
|
+
type: { summary: "string" },
|
|
96
|
+
defaultValue: { summary: "" }
|
|
97
|
+
},
|
|
98
|
+
control: "text"
|
|
99
|
+
},
|
|
100
|
+
variant: {
|
|
101
|
+
name: "variant",
|
|
102
|
+
type: { name: "string", required: false },
|
|
103
|
+
description: "The style of the tooltip.",
|
|
104
|
+
table: {
|
|
105
|
+
type: { summary: "string" },
|
|
106
|
+
defaultValue: { summary: "" }
|
|
107
|
+
},
|
|
108
|
+
control: {
|
|
109
|
+
type: "inline-radio",
|
|
110
|
+
options: ["info", "positive", "negative", ""]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
export const wIcon = ({
|
|
115
|
+
open,
|
|
116
|
+
placement,
|
|
117
|
+
variant,
|
|
118
|
+
text
|
|
119
|
+
}) => {
|
|
120
|
+
return html`
|
|
121
|
+
<sp-tooltip ?open=${open} placement=${placement} variant=${variant}>
|
|
122
|
+
${!!variant ? iconOptions[variant]() : nothing} ${text}
|
|
123
|
+
</sp-tooltip>
|
|
124
|
+
`;
|
|
125
|
+
};
|
|
126
|
+
wIcon.args = {
|
|
127
|
+
open: true,
|
|
128
|
+
placement: "top",
|
|
129
|
+
text: "Tooltip",
|
|
130
|
+
variant: "negative"
|
|
131
|
+
};
|
|
132
|
+
wIcon.argTypes = {
|
|
133
|
+
open: {
|
|
134
|
+
name: "open",
|
|
135
|
+
type: { name: "boolean", required: false },
|
|
136
|
+
description: "Whether the tooltip is open.",
|
|
137
|
+
table: {
|
|
138
|
+
type: { summary: "boolean" },
|
|
139
|
+
defaultValue: { summary: false }
|
|
140
|
+
},
|
|
141
|
+
control: {
|
|
142
|
+
type: "boolean"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
placement: {
|
|
146
|
+
name: "placement",
|
|
147
|
+
type: { name: "string", required: false },
|
|
148
|
+
description: "The placement of the tooltip in relation to its parent",
|
|
149
|
+
table: {
|
|
150
|
+
type: { summary: "string" },
|
|
151
|
+
defaultValue: { summary: "top" }
|
|
152
|
+
},
|
|
153
|
+
control: {
|
|
154
|
+
type: "inline-radio",
|
|
155
|
+
options: [
|
|
156
|
+
"auto",
|
|
157
|
+
"auto-start",
|
|
158
|
+
"auto-end",
|
|
159
|
+
"top",
|
|
160
|
+
"bottom",
|
|
161
|
+
"right",
|
|
162
|
+
"left",
|
|
163
|
+
"top-start",
|
|
164
|
+
"top-end",
|
|
165
|
+
"bottom-start",
|
|
166
|
+
"bottom-end",
|
|
167
|
+
"right-start",
|
|
168
|
+
"right-end",
|
|
169
|
+
"left-start",
|
|
170
|
+
"left-end",
|
|
171
|
+
"none"
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
text: {
|
|
176
|
+
name: "text",
|
|
177
|
+
type: { name: "string", required: false },
|
|
178
|
+
table: {
|
|
179
|
+
type: { summary: "string" },
|
|
180
|
+
defaultValue: { summary: "" }
|
|
181
|
+
},
|
|
182
|
+
control: "text"
|
|
183
|
+
},
|
|
184
|
+
variant: {
|
|
185
|
+
name: "variant",
|
|
186
|
+
type: { name: "string", required: false },
|
|
187
|
+
table: {
|
|
188
|
+
type: { summary: "string" },
|
|
189
|
+
defaultValue: { summary: "" }
|
|
190
|
+
},
|
|
191
|
+
control: {
|
|
192
|
+
type: "inline-radio",
|
|
193
|
+
options: ["info", "positive", "negative", ""]
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const overlayStyles = html`
|
|
198
|
+
<style>
|
|
199
|
+
html,
|
|
200
|
+
body,
|
|
201
|
+
#root,
|
|
202
|
+
#root-inner,
|
|
203
|
+
sp-story-decorator {
|
|
204
|
+
height: 100%;
|
|
205
|
+
margin: 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
sp-story-decorator > div {
|
|
209
|
+
display: contents;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
sp-story-decorator::part(container) {
|
|
213
|
+
display: flex;
|
|
214
|
+
flex-direction: column;
|
|
215
|
+
width: 100%;
|
|
216
|
+
height: 100%;
|
|
217
|
+
align-items: center;
|
|
218
|
+
justify-content: center;
|
|
219
|
+
gap: 24px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
sp-button:nth-of-type(1) {
|
|
223
|
+
margin-top: 24px;
|
|
224
|
+
}
|
|
225
|
+
</style>
|
|
226
|
+
`;
|
|
227
|
+
const overlaid = (openPlacement) => {
|
|
228
|
+
return html`
|
|
229
|
+
${overlayStyles}
|
|
230
|
+
${[
|
|
231
|
+
["bottom", ""],
|
|
232
|
+
["left", "negative"],
|
|
233
|
+
["right", "positive"],
|
|
234
|
+
["top", "info"],
|
|
235
|
+
["top-start", ""]
|
|
236
|
+
].map(([placement, variant]) => {
|
|
237
|
+
return html`
|
|
238
|
+
<sp-button id="trigger-${placement}" label="${placement} test">
|
|
239
|
+
Hover for ${variant ? variant : "tooltip"} on the
|
|
240
|
+
${placement}
|
|
241
|
+
</sp-button>
|
|
242
|
+
<sp-overlay
|
|
243
|
+
trigger="trigger-${placement}@hover"
|
|
244
|
+
type="hint"
|
|
245
|
+
placement=${placement}
|
|
246
|
+
open=${ifDefined(
|
|
247
|
+
openPlacement === placement ? "hover" : void 0
|
|
248
|
+
)}
|
|
249
|
+
>
|
|
250
|
+
<sp-tooltip variant=${variant} placement=${placement}>
|
|
251
|
+
${placement}
|
|
252
|
+
</sp-tooltip>
|
|
253
|
+
</sp-overlay>
|
|
254
|
+
`;
|
|
255
|
+
})}
|
|
256
|
+
`;
|
|
257
|
+
};
|
|
258
|
+
export const overlaidTop = () => overlaid("top");
|
|
259
|
+
export const overlaidRight = () => overlaid("right");
|
|
260
|
+
export const overlaidBottom = () => overlaid("bottom");
|
|
261
|
+
export const overlaidLeft = () => overlaid("left");
|
|
262
|
+
export const overlaidTopStart = () => overlaid("top-start");
|
|
263
|
+
export const selfManaged = ({
|
|
264
|
+
placement,
|
|
265
|
+
open,
|
|
266
|
+
offset,
|
|
267
|
+
delayed,
|
|
268
|
+
disabled
|
|
269
|
+
}) => html`
|
|
270
|
+
${overlayStyles}
|
|
271
|
+
<sp-action-button class="self-managed">
|
|
272
|
+
This is a button.
|
|
273
|
+
<sp-tooltip
|
|
274
|
+
self-managed
|
|
275
|
+
placement=${placement}
|
|
276
|
+
offset=${offset}
|
|
277
|
+
?delayed=${delayed}
|
|
278
|
+
?disabled=${disabled}
|
|
279
|
+
?open=${open}
|
|
280
|
+
>
|
|
281
|
+
Add paragraph text by dragging the Text tool on the canvas to use
|
|
282
|
+
this feature
|
|
283
|
+
</sp-tooltip>
|
|
284
|
+
</sp-action-button>
|
|
285
|
+
`;
|
|
286
|
+
selfManaged.args = {
|
|
287
|
+
placement: "top",
|
|
288
|
+
open: true,
|
|
289
|
+
offset: 6,
|
|
290
|
+
delayed: false,
|
|
291
|
+
disabled: false
|
|
292
|
+
};
|
|
293
|
+
selfManaged.argTypes = {
|
|
294
|
+
delayed: {
|
|
295
|
+
name: "delayed",
|
|
296
|
+
type: { name: "boolean", required: false },
|
|
297
|
+
description: "Whether to manage the tooltip with the warmup timer"
|
|
298
|
+
},
|
|
299
|
+
disabled: {
|
|
300
|
+
name: "disabled",
|
|
301
|
+
type: { name: "boolean", required: false },
|
|
302
|
+
description: "Whether the Tooltip is active and can be displayed"
|
|
303
|
+
},
|
|
304
|
+
offset: {
|
|
305
|
+
name: "offset",
|
|
306
|
+
type: { name: "number", required: false },
|
|
307
|
+
description: "The pixel distance from the parent element to place the tooltip"
|
|
308
|
+
},
|
|
309
|
+
open: {
|
|
310
|
+
name: "open",
|
|
311
|
+
type: { name: "boolean", required: false },
|
|
312
|
+
description: "Whether the tooltip is open.",
|
|
313
|
+
table: {
|
|
314
|
+
type: { summary: "boolean" },
|
|
315
|
+
defaultValue: { summary: false }
|
|
316
|
+
},
|
|
317
|
+
control: {
|
|
318
|
+
type: "boolean"
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
placement: {
|
|
322
|
+
name: "placement",
|
|
323
|
+
type: { name: "string", required: false },
|
|
324
|
+
description: "The placement of the tooltip in relation to its parent",
|
|
325
|
+
table: {
|
|
326
|
+
type: { summary: "string" },
|
|
327
|
+
defaultValue: { summary: "top" }
|
|
328
|
+
},
|
|
329
|
+
control: {
|
|
330
|
+
type: "inline-radio",
|
|
331
|
+
options: [
|
|
332
|
+
"auto",
|
|
333
|
+
"auto-start",
|
|
334
|
+
"auto-end",
|
|
335
|
+
"top",
|
|
336
|
+
"bottom",
|
|
337
|
+
"right",
|
|
338
|
+
"left",
|
|
339
|
+
"top-start",
|
|
340
|
+
"top-end",
|
|
341
|
+
"bottom-start",
|
|
342
|
+
"bottom-end",
|
|
343
|
+
"right-start",
|
|
344
|
+
"right-end",
|
|
345
|
+
"left-start",
|
|
346
|
+
"left-end",
|
|
347
|
+
"none"
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
export const selfManagedIconOnly = () => html`
|
|
353
|
+
${overlayStyles}
|
|
354
|
+
<sp-action-button class="self-managed">
|
|
355
|
+
<sp-icon-edit slot="icon"></sp-icon-edit>
|
|
356
|
+
<sp-tooltip self-managed>This is a tooltip.</sp-tooltip>
|
|
357
|
+
</sp-action-button>
|
|
358
|
+
<hr />
|
|
359
|
+
|
|
360
|
+
<sp-action-button class="self-managed">
|
|
361
|
+
<sp-icon-edit slot="icon"></sp-icon-edit>
|
|
362
|
+
</sp-action-button>
|
|
363
|
+
`;
|
|
364
|
+
export const selfManagedFieldLabel = () => html`
|
|
365
|
+
<div style="display: inline-flex; flex-direction: column;">
|
|
366
|
+
<sp-field-label for="input">
|
|
367
|
+
<sp-icon-edit></sp-icon-edit>
|
|
368
|
+
<sp-tooltip self-managed>Edit</sp-tooltip>
|
|
369
|
+
</sp-field-label>
|
|
370
|
+
<sp-textfield id="input"></sp-textfield>
|
|
371
|
+
</div>
|
|
372
|
+
`;
|
|
373
|
+
export const draggable = () => {
|
|
374
|
+
const handleDragStart = (event) => {
|
|
375
|
+
var _a;
|
|
376
|
+
(_a = event.dataTransfer) == null ? void 0 : _a.setDragImage(
|
|
377
|
+
event.target,
|
|
378
|
+
event.offsetX,
|
|
379
|
+
event.offsetY
|
|
380
|
+
);
|
|
381
|
+
};
|
|
382
|
+
return html`
|
|
383
|
+
<sp-button>
|
|
384
|
+
A simple button that should not be included in the DragImage
|
|
385
|
+
</sp-button>
|
|
386
|
+
<div
|
|
387
|
+
draggable="true"
|
|
388
|
+
id="draggableElement"
|
|
389
|
+
@dragstart=${handleDragStart}
|
|
390
|
+
style="margin-top: 16px; cursor: move; padding: 24px; border: red 1px solid;"
|
|
391
|
+
>
|
|
392
|
+
<p>Click and drag me to show DragImage</p>
|
|
393
|
+
<sp-action-button>
|
|
394
|
+
Action Button with self managed tooltip
|
|
395
|
+
<sp-tooltip self-managed placement="bottom">
|
|
396
|
+
My Tooltip
|
|
397
|
+
</sp-tooltip>
|
|
398
|
+
</sp-action-button>
|
|
399
|
+
</div>
|
|
400
|
+
`;
|
|
401
|
+
};
|
|
402
|
+
draggable.swc_vrt = {
|
|
403
|
+
skip: true
|
|
404
|
+
};
|
|
405
|
+
draggable.parameters = {
|
|
406
|
+
// Disables Chromatic's snapshotting on a global level
|
|
407
|
+
chromatic: { disableSnapshot: true }
|
|
408
|
+
};
|
|
409
|
+
//# sourceMappingURL=tooltip.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tooltip.stories.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport { html, nothing, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-info.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js';\nimport '@spectrum-web-components/button/sp-button.js';\nimport '@spectrum-web-components/field-label/sp-field-label.js';\nimport '@spectrum-web-components/textfield/sp-textfield.js';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { Placement } from '@spectrum-web-components/overlay';\nimport '@spectrum-web-components/overlay/sp-overlay.js';\n\nconst iconOptions: {\n [key: string]: ({\n width,\n height,\n hidden,\n title,\n }?: {\n width?: number;\n height?: number;\n hidden?: boolean;\n title?: string;\n }) => TemplateResult | string;\n} = {\n '': () => html``,\n negative: () => html`\n <sp-icon-alert slot=\"icon\"></sp-icon-alert>\n `,\n positive: () => html`\n <sp-icon-checkmark slot=\"icon\"></sp-icon-checkmark>\n `,\n info: () => html`\n <sp-icon-info slot=\"icon\"></sp-icon-info>\n `,\n};\n\nexport default {\n component: 'sp-tooltip',\n title: 'Tooltip',\n};\n\ninterface Properties {\n delayed?: boolean;\n disabled?: boolean;\n open?: boolean;\n placement?: Placement;\n variant?: string;\n text?: string;\n offset?: number;\n}\n\nexport const Default = ({\n open,\n placement,\n variant,\n text,\n}: Properties): TemplateResult => {\n return html`\n <sp-tooltip ?open=${open} placement=${placement} variant=${variant}>\n ${text}\n </sp-tooltip>\n `;\n};\nDefault.args = {\n open: true,\n placement: 'top',\n variant: '',\n text: 'Tooltip',\n};\nDefault.argTypes = {\n open: {\n name: 'open',\n type: { name: 'boolean', required: false },\n description: 'Whether the tooltip is open.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n placement: {\n name: 'placement',\n type: { name: 'string', required: false },\n description: 'The placement of the tooltip in relation to its parent',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'top' },\n },\n control: {\n type: 'inline-radio',\n options: [\n 'auto',\n 'auto-start',\n 'auto-end',\n 'top',\n 'bottom',\n 'right',\n 'left',\n 'top-start',\n 'top-end',\n 'bottom-start',\n 'bottom-end',\n 'right-start',\n 'right-end',\n 'left-start',\n 'left-end',\n 'none',\n ],\n },\n },\n text: {\n name: 'text',\n type: { name: 'string', required: false },\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: 'text',\n },\n variant: {\n name: 'variant',\n type: { name: 'string', required: false },\n description: 'The style of the tooltip.',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['info', 'positive', 'negative', ''],\n },\n },\n};\n\nexport const wIcon = ({\n open,\n placement,\n variant,\n text,\n}: Properties): TemplateResult => {\n return html`\n <sp-tooltip ?open=${open} placement=${placement} variant=${variant}>\n ${!!variant ? iconOptions[variant]() : nothing} ${text}\n </sp-tooltip>\n `;\n};\nwIcon.args = {\n open: true,\n placement: 'top',\n text: 'Tooltip',\n variant: 'negative',\n};\nwIcon.argTypes = {\n open: {\n name: 'open',\n type: { name: 'boolean', required: false },\n description: 'Whether the tooltip is open.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n placement: {\n name: 'placement',\n type: { name: 'string', required: false },\n description: 'The placement of the tooltip in relation to its parent',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'top' },\n },\n control: {\n type: 'inline-radio',\n options: [\n 'auto',\n 'auto-start',\n 'auto-end',\n 'top',\n 'bottom',\n 'right',\n 'left',\n 'top-start',\n 'top-end',\n 'bottom-start',\n 'bottom-end',\n 'right-start',\n 'right-end',\n 'left-start',\n 'left-end',\n 'none',\n ],\n },\n },\n text: {\n name: 'text',\n type: { name: 'string', required: false },\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: 'text',\n },\n variant: {\n name: 'variant',\n type: { name: 'string', required: false },\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['info', 'positive', 'negative', ''],\n },\n },\n};\n\nconst overlayStyles = html`\n <style>\n html,\n body,\n #root,\n #root-inner,\n sp-story-decorator {\n height: 100%;\n margin: 0;\n }\n\n sp-story-decorator > div {\n display: contents;\n }\n\n sp-story-decorator::part(container) {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n gap: 24px;\n }\n\n sp-button:nth-of-type(1) {\n margin-top: 24px;\n }\n </style>\n`;\n\nconst overlaid = (openPlacement: Placement): TemplateResult => {\n return html`\n ${overlayStyles}\n ${(\n [\n ['bottom', ''],\n ['left', 'negative'],\n ['right', 'positive'],\n ['top', 'info'],\n ['top-start', ''],\n ] as [Placement, string][]\n ).map(([placement, variant]) => {\n return html`\n <sp-button id=\"trigger-${placement}\" label=\"${placement} test\">\n Hover for ${variant ? variant : 'tooltip'} on the\n ${placement}\n </sp-button>\n <sp-overlay\n trigger=\"trigger-${placement}@hover\"\n type=\"hint\"\n placement=${placement}\n open=${ifDefined(\n openPlacement === placement ? 'hover' : undefined\n )}\n >\n <sp-tooltip variant=${variant} placement=${placement}>\n ${placement}\n </sp-tooltip>\n </sp-overlay>\n `;\n })}\n `;\n};\n\nexport const overlaidTop = (): TemplateResult => overlaid('top');\nexport const overlaidRight = (): TemplateResult => overlaid('right');\nexport const overlaidBottom = (): TemplateResult => overlaid('bottom');\nexport const overlaidLeft = (): TemplateResult => overlaid('left');\nexport const overlaidTopStart = (): TemplateResult => overlaid('top-start');\n\nexport const selfManaged = ({\n placement,\n open,\n offset,\n delayed,\n disabled,\n}: Properties): TemplateResult => html`\n ${overlayStyles}\n <sp-action-button class=\"self-managed\">\n This is a button.\n <sp-tooltip\n self-managed\n placement=${placement}\n offset=${offset}\n ?delayed=${delayed}\n ?disabled=${disabled}\n ?open=${open}\n >\n Add paragraph text by dragging the Text tool on the canvas to use\n this feature\n </sp-tooltip>\n </sp-action-button>\n`;\nselfManaged.args = {\n placement: 'top',\n open: true,\n offset: 6,\n delayed: false,\n disabled: false,\n};\nselfManaged.argTypes = {\n delayed: {\n name: 'delayed',\n type: { name: 'boolean', required: false },\n description: 'Whether to manage the tooltip with the warmup timer',\n },\n disabled: {\n name: 'disabled',\n type: { name: 'boolean', required: false },\n description: 'Whether the Tooltip is active and can be displayed',\n },\n offset: {\n name: 'offset',\n type: { name: 'number', required: false },\n description:\n 'The pixel distance from the parent element to place the tooltip',\n },\n open: {\n name: 'open',\n type: { name: 'boolean', required: false },\n description: 'Whether the tooltip is open.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n placement: {\n name: 'placement',\n type: { name: 'string', required: false },\n description: 'The placement of the tooltip in relation to its parent',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'top' },\n },\n control: {\n type: 'inline-radio',\n options: [\n 'auto',\n 'auto-start',\n 'auto-end',\n 'top',\n 'bottom',\n 'right',\n 'left',\n 'top-start',\n 'top-end',\n 'bottom-start',\n 'bottom-end',\n 'right-start',\n 'right-end',\n 'left-start',\n 'left-end',\n 'none',\n ],\n },\n },\n};\n\nexport const selfManagedIconOnly = (): TemplateResult => html`\n ${overlayStyles}\n <sp-action-button class=\"self-managed\">\n <sp-icon-edit slot=\"icon\"></sp-icon-edit>\n <sp-tooltip self-managed>This is a tooltip.</sp-tooltip>\n </sp-action-button>\n <hr />\n\n <sp-action-button class=\"self-managed\">\n <sp-icon-edit slot=\"icon\"></sp-icon-edit>\n </sp-action-button>\n`;\n\nexport const selfManagedFieldLabel = (): TemplateResult => html`\n <div style=\"display: inline-flex; flex-direction: column;\">\n <sp-field-label for=\"input\">\n <sp-icon-edit></sp-icon-edit>\n <sp-tooltip self-managed>Edit</sp-tooltip>\n </sp-field-label>\n <sp-textfield id=\"input\"></sp-textfield>\n </div>\n`;\n\nexport const draggable = (): TemplateResult => {\n const handleDragStart = (event: DragEvent): void => {\n event.dataTransfer?.setDragImage(\n event.target as HTMLElement,\n event.offsetX,\n event.offsetY\n );\n };\n return html`\n <sp-button>\n A simple button that should not be included in the DragImage\n </sp-button>\n <div\n draggable=\"true\"\n id=\"draggableElement\"\n @dragstart=${handleDragStart}\n style=\"margin-top: 16px; cursor: move; padding: 24px; border: red 1px solid;\"\n >\n <p>Click and drag me to show DragImage</p>\n <sp-action-button>\n Action Button with self managed tooltip\n <sp-tooltip self-managed placement=\"bottom\">\n My Tooltip\n </sp-tooltip>\n </sp-action-button>\n </div>\n `;\n};\n\ndraggable.swc_vrt = {\n skip: true,\n};\n\ndraggable.parameters = {\n // Disables Chromatic's snapshotting on a global level\n chromatic: { disableSnapshot: true },\n};\n"],
|
|
5
|
+
"mappings": ";AAWA,OAAO;AACP,SAAS,MAAM,eAA+B;AAC9C,SAAS,iBAAiB;AAC1B,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAEP,OAAO;AAEP,MAAM,cAYF;AAAA,EACA,IAAI,MAAM;AAAA,EACV,UAAU,MAAM;AAAA;AAAA;AAAA,EAGhB,UAAU,MAAM;AAAA;AAAA;AAAA,EAGhB,MAAM,MAAM;AAAA;AAAA;AAGhB;AAEA,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;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": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/tooltip/sp-tooltip.js";
|
|
3
|
+
import "@spectrum-web-components/action-button/sp-action-button.js";
|
|
4
|
+
import { html } from "lit";
|
|
5
|
+
import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
|
|
6
|
+
measureFixtureCreation(html`
|
|
7
|
+
<sp-action-button>
|
|
8
|
+
I'm a button...
|
|
9
|
+
<sp-tooltip self-managed>Tip me!</sp-tooltip>
|
|
10
|
+
</sp-action-button>
|
|
11
|
+
`);
|
|
12
|
+
//# sourceMappingURL=test-basic.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["test-basic.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-action-button>\n I'm a button...\n <sp-tooltip self-managed>Tip me!</sp-tooltip>\n </sp-action-button>\n`);\n"],
|
|
5
|
+
"mappings": ";AAYA,OAAO;AACP,OAAO;AACP,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEvC,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,CAKtB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { tooltip } from "@spectrum-web-components/tooltip/src/tooltip-directive.js";
|
|
3
|
+
import "@spectrum-web-components/action-button/sp-action-button.js";
|
|
4
|
+
import { html } from "lit";
|
|
5
|
+
import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
|
|
6
|
+
measureFixtureCreation(html`
|
|
7
|
+
<sp-action-button
|
|
8
|
+
${tooltip(() => html`Tip me!`)}
|
|
9
|
+
>
|
|
10
|
+
I'm a button...
|
|
11
|
+
</sp-action-button>
|
|
12
|
+
`);
|
|
13
|
+
//# sourceMappingURL=test-directive.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["test-directive.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { tooltip } from '@spectrum-web-components/tooltip/src/tooltip-directive.js';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-action-button\n ${tooltip(() => html`Tip me!`)}\n >\n I'm a button...\n </sp-action-button>\n`);\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,eAAe;AACxB,OAAO;AACP,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEvC,uBAAuB;AAAA;AAAA,UAEb,QAAQ,MAAM,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA,CAIrC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/tooltip/sp-tooltip.js";
|
|
3
|
+
import "@spectrum-web-components/action-button/sp-action-button.js";
|
|
4
|
+
import "@spectrum-web-components/overlay/sp-overlay.js";
|
|
5
|
+
import { html } from "lit";
|
|
6
|
+
import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
|
|
7
|
+
measureFixtureCreation(html`
|
|
8
|
+
<sp-action-button id="button">I'm a button...</sp-action-button>
|
|
9
|
+
<sp-overlay trigger="button@hover" type="hint">
|
|
10
|
+
<sp-tooltip>Tip me!</sp-tooltip>
|
|
11
|
+
</sp-overlay>
|
|
12
|
+
`);
|
|
13
|
+
//# sourceMappingURL=test-element.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["test-element.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/tooltip/sp-tooltip.js';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport '@spectrum-web-components/overlay/sp-overlay.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-action-button id=\"button\">I'm a button...</sp-action-button>\n <sp-overlay trigger=\"button@hover\" type=\"hint\">\n <sp-tooltip>Tip me!</sp-tooltip>\n </sp-overlay>\n`);\n"],
|
|
5
|
+
"mappings": ";AAYA,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEvC,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,CAKtB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import "@spectrum-web-components/action-button/sp-action-button.js";
|
|
3
|
+
import "@spectrum-web-components/overlay/sp-overlay.js";
|
|
4
|
+
import {
|
|
5
|
+
removeSlottableRequest
|
|
6
|
+
} from "@spectrum-web-components/overlay/src/slottable-request-event.js";
|
|
7
|
+
import { html, render } from "@spectrum-web-components/base";
|
|
8
|
+
import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
|
|
9
|
+
const handleSlottableRequest = (event) => {
|
|
10
|
+
import("@spectrum-web-components/tooltip/sp-tooltip.js");
|
|
11
|
+
const template = event.data === removeSlottableRequest ? void 0 : html`
|
|
12
|
+
<sp-tooltip>Tip me!</sp-tooltip>
|
|
13
|
+
`;
|
|
14
|
+
render(template, event.target);
|
|
15
|
+
};
|
|
16
|
+
measureFixtureCreation(html`
|
|
17
|
+
<sp-action-button id="button">I'm a button...</sp-action-button>
|
|
18
|
+
<sp-overlay
|
|
19
|
+
trigger="button@hover"
|
|
20
|
+
type="hint"
|
|
21
|
+
@slottable-request=${handleSlottableRequest}
|
|
22
|
+
></sp-overlay>
|
|
23
|
+
`);
|
|
24
|
+
//# sourceMappingURL=test-lazy.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["test-lazy.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport '@spectrum-web-components/overlay/sp-overlay.js';\nimport {\n removeSlottableRequest,\n type SlottableRequestEvent,\n} from '@spectrum-web-components/overlay/src/slottable-request-event.js';\nimport { html, render } from '@spectrum-web-components/base';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nconst handleSlottableRequest = (event: SlottableRequestEvent): void => {\n import('@spectrum-web-components/tooltip/sp-tooltip.js');\n const template =\n event.data === removeSlottableRequest\n ? undefined\n : html`\n <sp-tooltip>Tip me!</sp-tooltip>\n `;\n render(template, event.target as HTMLElement);\n};\n\nmeasureFixtureCreation(html`\n <sp-action-button id=\"button\">I'm a button...</sp-action-button>\n <sp-overlay\n trigger=\"button@hover\"\n type=\"hint\"\n @slottable-request=${handleSlottableRequest}\n ></sp-overlay>\n`);\n"],
|
|
5
|
+
"mappings": ";AAYA,OAAO;AACP,OAAO;AACP;AAAA,EACI;AAAA,OAEG;AACP,SAAS,MAAM,cAAc;AAC7B,SAAS,8BAA8B;AAEvC,MAAM,yBAAyB,CAAC,UAAuC;AACnE,SAAO,gDAAgD;AACvD,QAAM,WACF,MAAM,SAAS,yBACT,SACA;AAAA;AAAA;AAGV,SAAO,UAAU,MAAM,MAAqB;AAChD;AAEA,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,6BAKM,sBAAsB;AAAA;AAAA,CAElD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["tooltip-directive.test-vrt.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/tooltip-directive.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('TooltipDirectiveStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,2BAA2B,OAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|