@finsweet/webflow-apps-utils 1.0.15 → 1.0.17
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/dist/ui/components/button/Button.svelte +1 -1
- package/dist/ui/components/controlled-buttons/ControlledButtons.svelte +3 -0
- package/dist/ui/components/section/Section.svelte +2 -1
- package/dist/ui/components/text/Text.stories.svelte +2 -1
- package/dist/ui/components/text/Text.svelte +1 -0
- package/dist/ui/components/tooltip/Tooltip.svelte +14 -31
- package/dist/ui/components/tooltip/Tooltip.svelte.d.ts +3 -31
- package/dist/ui/components/tooltip/types.d.ts +12 -0
- package/package.json +1 -1
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
listener={button.popupTrigger || 'click'}
|
|
24
24
|
listenerout={button.popupTrigger || 'click'}
|
|
25
25
|
width="210px"
|
|
26
|
+
stopPropagation={false}
|
|
26
27
|
>
|
|
27
28
|
{#snippet target()}
|
|
28
29
|
<Button
|
|
@@ -84,6 +85,7 @@
|
|
|
84
85
|
placement={button.tooltip?.placement || 'top'}
|
|
85
86
|
offsetVal={10}
|
|
86
87
|
showArrow={button.tooltip?.showArrow !== false}
|
|
88
|
+
stopPropagation={false}
|
|
87
89
|
>
|
|
88
90
|
{#snippet target()}
|
|
89
91
|
<Button
|
|
@@ -186,6 +188,7 @@
|
|
|
186
188
|
min-width: 150px;
|
|
187
189
|
background: var(--background);
|
|
188
190
|
border-radius: 4px;
|
|
191
|
+
width: 100%;
|
|
189
192
|
}
|
|
190
193
|
.popup-content-icon {
|
|
191
194
|
display: flex;
|
|
@@ -187,13 +187,14 @@
|
|
|
187
187
|
message={defaultDisabledMessage}
|
|
188
188
|
width={disabledTooltipWidth}
|
|
189
189
|
class="not-allowed"
|
|
190
|
+
stopPropagation={false}
|
|
190
191
|
>
|
|
191
192
|
{#snippet target()}
|
|
192
193
|
{@render sectionContent()}
|
|
193
194
|
{/snippet}
|
|
194
195
|
</Tooltip>
|
|
195
196
|
{:else if shouldShowTooltip}
|
|
196
|
-
<Tooltip {...tooltip}>
|
|
197
|
+
<Tooltip {...tooltip} stopPropagation={false}>
|
|
197
198
|
{#snippet target()}
|
|
198
199
|
{@render sectionContent()}
|
|
199
200
|
{/snippet}
|
|
@@ -227,7 +227,8 @@
|
|
|
227
227
|
active: true,
|
|
228
228
|
title: 'Remove',
|
|
229
229
|
subtitle: 'Alt + click',
|
|
230
|
-
description: 'This will remove the current selection.'
|
|
230
|
+
description: 'This will remove the current selection.',
|
|
231
|
+
onclick: () => console.log('Popup action clicked')
|
|
231
232
|
}
|
|
232
233
|
}}
|
|
233
234
|
/>
|
|
@@ -12,41 +12,15 @@
|
|
|
12
12
|
import { writable } from 'svelte/store';
|
|
13
13
|
import { v4 as uuidv4 } from 'uuid';
|
|
14
14
|
|
|
15
|
+
import { TooltipInfoCircleFilled } from '../../icons';
|
|
16
|
+
import ToolTipInfoCircleIcon from '../../icons/ToolTipInfoCircleIcon.svelte';
|
|
15
17
|
import { cleanupTooltipMessage } from '../../../utils';
|
|
16
18
|
|
|
17
19
|
import Text from '../text/Text.svelte';
|
|
20
|
+
import type { TooltipProps } from './types';
|
|
18
21
|
|
|
19
22
|
const activeTooltips = writable<string[]>([]);
|
|
20
23
|
|
|
21
|
-
interface Props {
|
|
22
|
-
message?: string;
|
|
23
|
-
listener?: 'click' | 'hover';
|
|
24
|
-
listenerout?: 'click' | 'hover';
|
|
25
|
-
placement?: Placement;
|
|
26
|
-
position?: string;
|
|
27
|
-
showArrow?: boolean;
|
|
28
|
-
offsetVal?: number;
|
|
29
|
-
hidden?: boolean;
|
|
30
|
-
disabled?: boolean;
|
|
31
|
-
tooltipIcon?: Component | null;
|
|
32
|
-
tooltipIconColor?: string;
|
|
33
|
-
width?: string;
|
|
34
|
-
padding?: string;
|
|
35
|
-
raw?: boolean;
|
|
36
|
-
isActive?: boolean;
|
|
37
|
-
fallbackPlacements?: Placement[];
|
|
38
|
-
stopPropagation?: boolean;
|
|
39
|
-
fontColor?: string;
|
|
40
|
-
bgColor?: string;
|
|
41
|
-
class?: string;
|
|
42
|
-
/** Target element snippet */
|
|
43
|
-
target?: Snippet;
|
|
44
|
-
/** Tooltip content snippet */
|
|
45
|
-
tooltip?: Snippet;
|
|
46
|
-
onshow?: (event: boolean) => void;
|
|
47
|
-
onclose?: (event: boolean) => void;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
24
|
let {
|
|
51
25
|
message = '',
|
|
52
26
|
listener = 'hover',
|
|
@@ -68,11 +42,12 @@
|
|
|
68
42
|
fontColor = 'var(--text2)',
|
|
69
43
|
bgColor = '',
|
|
70
44
|
class: className = '',
|
|
45
|
+
targetClassName = '',
|
|
71
46
|
target,
|
|
72
47
|
tooltip,
|
|
73
48
|
onshow,
|
|
74
49
|
onclose
|
|
75
|
-
}:
|
|
50
|
+
}: TooltipProps = $props();
|
|
76
51
|
|
|
77
52
|
type TooltipInstance = {
|
|
78
53
|
toggle: HTMLElement;
|
|
@@ -303,6 +278,8 @@
|
|
|
303
278
|
}
|
|
304
279
|
});
|
|
305
280
|
|
|
281
|
+
let isClickTarget = $state(listener === 'click' && listenerout === 'click');
|
|
282
|
+
|
|
306
283
|
const formattedMessage = $derived(cleanupTooltipMessage(message));
|
|
307
284
|
|
|
308
285
|
onMount(async () => {
|
|
@@ -331,9 +308,12 @@
|
|
|
331
308
|
});
|
|
332
309
|
</script>
|
|
333
310
|
|
|
334
|
-
<div class="target" bind:this={targetElement} aria-describedby={tooltipId}>
|
|
311
|
+
<div class="target {targetClassName}" bind:this={targetElement} aria-describedby={tooltipId}>
|
|
335
312
|
{#if target}
|
|
336
313
|
{@render target()}
|
|
314
|
+
{:else}
|
|
315
|
+
<!-- Default target for Demo only -->
|
|
316
|
+
<Text link label={isClickTarget ? 'Click me' : 'Hover me'} />
|
|
337
317
|
{/if}
|
|
338
318
|
|
|
339
319
|
<div
|
|
@@ -384,6 +364,9 @@
|
|
|
384
364
|
font-weight: 500;
|
|
385
365
|
font-size: 11px;
|
|
386
366
|
}
|
|
367
|
+
.target {
|
|
368
|
+
display: inline-flex;
|
|
369
|
+
}
|
|
387
370
|
.tooltip {
|
|
388
371
|
display: none;
|
|
389
372
|
top: 0;
|
|
@@ -1,34 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
message?: string;
|
|
5
|
-
listener?: 'click' | 'hover';
|
|
6
|
-
listenerout?: 'click' | 'hover';
|
|
7
|
-
placement?: Placement;
|
|
8
|
-
position?: string;
|
|
9
|
-
showArrow?: boolean;
|
|
10
|
-
offsetVal?: number;
|
|
11
|
-
hidden?: boolean;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
tooltipIcon?: Component | null;
|
|
14
|
-
tooltipIconColor?: string;
|
|
15
|
-
width?: string;
|
|
16
|
-
padding?: string;
|
|
17
|
-
raw?: boolean;
|
|
18
|
-
isActive?: boolean;
|
|
19
|
-
fallbackPlacements?: Placement[];
|
|
20
|
-
stopPropagation?: boolean;
|
|
21
|
-
fontColor?: string;
|
|
22
|
-
bgColor?: string;
|
|
23
|
-
class?: string;
|
|
24
|
-
/** Target element snippet */
|
|
25
|
-
target?: Snippet;
|
|
26
|
-
/** Tooltip content snippet */
|
|
27
|
-
tooltip?: Snippet;
|
|
28
|
-
onshow?: (event: boolean) => void;
|
|
29
|
-
onclose?: (event: boolean) => void;
|
|
30
|
-
}
|
|
31
|
-
declare const Tooltip: Component<Props, {
|
|
1
|
+
import { type Component } from 'svelte';
|
|
2
|
+
import type { TooltipProps } from './types';
|
|
3
|
+
declare const Tooltip: Component<TooltipProps, {
|
|
32
4
|
show: () => void | undefined;
|
|
33
5
|
hide: () => void | undefined;
|
|
34
6
|
}, "hidden" | "isActive">;
|
|
@@ -2,6 +2,14 @@ import type { Placement } from '@floating-ui/dom';
|
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
3
|
export type TooltipListener = 'click' | 'hover';
|
|
4
4
|
export interface TooltipProps {
|
|
5
|
+
/**
|
|
6
|
+
* Event handler for tooltip show
|
|
7
|
+
*/
|
|
8
|
+
onshow?: (event: boolean) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Event handler for tooltip show
|
|
11
|
+
*/
|
|
12
|
+
onclose?: (event: boolean) => void;
|
|
5
13
|
/**
|
|
6
14
|
* The tooltip message content
|
|
7
15
|
*/
|
|
@@ -74,6 +82,10 @@ export interface TooltipProps {
|
|
|
74
82
|
* Font color for tooltip text
|
|
75
83
|
*/
|
|
76
84
|
fontColor?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Target element class name
|
|
87
|
+
*/
|
|
88
|
+
targetClassName?: string;
|
|
77
89
|
/**
|
|
78
90
|
* Target element snippet (what triggers the tooltip)
|
|
79
91
|
*/
|