|
1 | 1 | <script lang="ts">
|
2 |
| - import { Card, Tooltip } from '@appwrite.io/pink-svelte'; |
3 |
| - import type { HTMLAttributes } from 'svelte/elements'; |
4 |
| - import type { BaseCardProps } from './card.svelte'; |
5 | 2 | import type { ComponentType } from 'svelte';
|
| 3 | + import type { BaseCardProps } from './card.svelte'; |
| 4 | + import type { HTMLAttributes } from 'svelte/elements'; |
| 5 | + import { Card, Tooltip } from '@appwrite.io/pink-svelte'; |
6 | 6 |
|
7 | 7 | type Props = BaseCardProps &
|
8 | 8 | HTMLAttributes<HTMLInputElement> & {
|
|
22 | 22 |
|
23 | 23 | export let group: string;
|
24 | 24 | export let value: string;
|
25 |
| - export let tooltipText: string = null; |
| 25 | +
|
26 | 26 | export let tooltipShow = false;
|
| 27 | + export let tooltipText: string = null; |
| 28 | + export let tooltipWidth: string = undefined; |
27 | 29 |
|
28 | 30 | // Pink v2
|
29 | 31 | export let icon: Props['icon'] = undefined;
|
|
42 | 44 | let slotTitle: HTMLSpanElement;
|
43 | 45 | </script>
|
44 | 46 |
|
45 |
| -<Tooltip disabled={!tooltipText || !tooltipShow}> |
46 |
| - <Card.Selector |
47 |
| - {name} |
48 |
| - {src} |
49 |
| - {alt} |
50 |
| - {icon} |
51 |
| - {padding} |
52 |
| - {imageRadius} |
53 |
| - {variant} |
54 |
| - {value} |
55 |
| - {radius} |
56 |
| - {disabled} |
57 |
| - title={title ?? slotTitle?.innerText} |
58 |
| - bind:group> |
59 |
| - {#if $$slots.default} |
60 |
| - <slot /> |
61 |
| - {/if} |
62 |
| - <slot name="action" slot="action" /> |
63 |
| - </Card.Selector> |
| 47 | +<Tooltip maxWidth={tooltipWidth} disabled={!tooltipText || !tooltipShow}> |
| 48 | + <div style:cursor={disabled ? 'pointer' : ''}> |
| 49 | + <Card.Selector |
| 50 | + {name} |
| 51 | + {src} |
| 52 | + {alt} |
| 53 | + {icon} |
| 54 | + {padding} |
| 55 | + {imageRadius} |
| 56 | + {variant} |
| 57 | + {value} |
| 58 | + {radius} |
| 59 | + {disabled} |
| 60 | + title={title ?? slotTitle?.innerText} |
| 61 | + bind:group> |
| 62 | + {#if $$slots.default} |
| 63 | + <slot /> |
| 64 | + {/if} |
| 65 | + <slot name="action" slot="action" /> |
| 66 | + </Card.Selector> |
| 67 | + </div> |
64 | 68 | <span slot="tooltip">{tooltipText}</span>
|
65 | 69 | </Tooltip>
|
66 | 70 |
|
|
0 commit comments