compote-ui 0.30.2 → 0.31.0
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/components/dialog/dialog.svelte +33 -33
- package/dist/components/image-crop-dialog/image-crop-dialog.svelte +8 -7
- package/dist/components/toggle-group/toggle-group-item.svelte +3 -2
- package/dist/components/toggle-group/toggle-group-item.svelte.d.ts +2 -1
- package/dist/components/tooltip/index.d.ts +3 -0
- package/dist/components/tooltip/index.js +3 -0
- package/dist/components/tooltip/tooltip-content.svelte +68 -0
- package/dist/components/tooltip/tooltip-content.svelte.d.ts +10 -0
- package/dist/components/tooltip/tooltip-root.svelte +15 -0
- package/dist/components/tooltip/tooltip-root.svelte.d.ts +8 -0
- package/dist/components/tooltip/tooltip-trigger.svelte +30 -0
- package/dist/components/tooltip/tooltip-trigger.svelte.d.ts +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Dialog } from '@ark-ui/svelte/dialog';
|
|
3
|
-
import { Portal } from '@ark-ui/svelte/portal';
|
|
4
|
-
import { cn } from 'tailwind-variants';
|
|
5
|
-
import type { DialogProps } from './dialog.types';
|
|
6
|
-
|
|
7
|
-
let {
|
|
8
|
-
open = $bindable(),
|
|
9
|
-
children,
|
|
10
|
-
contentClass,
|
|
11
|
-
lazyMount = true,
|
|
12
|
-
unmountOnExit = true,
|
|
13
|
-
...restProps
|
|
14
|
-
}: DialogProps = $props();
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<Dialog.Root bind:open {lazyMount} {unmountOnExit} {...restProps}>
|
|
18
|
-
<Portal>
|
|
19
|
-
<Dialog.Backdrop
|
|
20
|
-
class="data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 fixed inset-0 z-50 bg-black/50"
|
|
21
|
-
/>
|
|
22
|
-
<Dialog.Positioner class="fixed inset-0 z-50 flex items-center justify-center p-4">
|
|
23
|
-
<Dialog.Content
|
|
24
|
-
class={cn(
|
|
25
|
-
'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 relative w-full max-w-2xl rounded-lg border bg-surface-1 p-6 shadow-xl',
|
|
26
|
-
contentClass
|
|
27
|
-
)}
|
|
28
|
-
>
|
|
29
|
-
{@render children()}
|
|
30
|
-
</Dialog.Content>
|
|
31
|
-
</Dialog.Positioner>
|
|
32
|
-
</Portal>
|
|
33
|
-
</Dialog.Root>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog } from '@ark-ui/svelte/dialog';
|
|
3
|
+
import { Portal } from '@ark-ui/svelte/portal';
|
|
4
|
+
import { cn } from 'tailwind-variants';
|
|
5
|
+
import type { DialogProps } from './dialog.types';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
open = $bindable(),
|
|
9
|
+
children,
|
|
10
|
+
contentClass,
|
|
11
|
+
lazyMount = true,
|
|
12
|
+
unmountOnExit = true,
|
|
13
|
+
...restProps
|
|
14
|
+
}: DialogProps = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<Dialog.Root bind:open {lazyMount} {unmountOnExit} {...restProps}>
|
|
18
|
+
<Portal>
|
|
19
|
+
<Dialog.Backdrop
|
|
20
|
+
class="data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 fixed inset-0 z-50 bg-black/50"
|
|
21
|
+
/>
|
|
22
|
+
<Dialog.Positioner class="fixed inset-0 z-50 flex items-center justify-center p-4">
|
|
23
|
+
<Dialog.Content
|
|
24
|
+
class={cn(
|
|
25
|
+
'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 relative w-full max-w-2xl rounded-lg border bg-surface-1 p-6 shadow-xl',
|
|
26
|
+
contentClass
|
|
27
|
+
)}
|
|
28
|
+
>
|
|
29
|
+
{@render children()}
|
|
30
|
+
</Dialog.Content>
|
|
31
|
+
</Dialog.Positioner>
|
|
32
|
+
</Portal>
|
|
33
|
+
</Dialog.Root>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import Dialog from '../dialog
|
|
2
|
+
import * as Dialog from '../dialog';
|
|
3
3
|
import ImageCropper from '../image-cropper/image-cropper.svelte';
|
|
4
4
|
import { Button } from '../..';
|
|
5
5
|
import { cropImage, processImage } from '../../utils/image-processing';
|
|
@@ -47,16 +47,17 @@
|
|
|
47
47
|
}
|
|
48
48
|
</script>
|
|
49
49
|
|
|
50
|
-
<Dialog
|
|
50
|
+
<Dialog.Root
|
|
51
51
|
bind:open
|
|
52
|
-
{title}
|
|
53
|
-
{description}
|
|
54
52
|
onOpenChange={(details) => {
|
|
55
53
|
if (!details.open) onCancel();
|
|
56
54
|
}}
|
|
57
55
|
>
|
|
56
|
+
<Dialog.Title>{title}</Dialog.Title>
|
|
57
|
+
<Dialog.Description>{description}</Dialog.Description>
|
|
58
|
+
|
|
58
59
|
<ImageCropper bind:getCropData src={imageSrc} alt="Crop preview" {aspectRatio} />
|
|
59
|
-
|
|
60
|
+
<Dialog.Footer>
|
|
60
61
|
<Button variant="outline" onclick={onCancel} disabled={processing}>Cancel</Button>
|
|
61
62
|
{#if showSkipCrop}
|
|
62
63
|
<Button variant="outline" onclick={handleSkipCrop} disabled={processing}>
|
|
@@ -66,5 +67,5 @@
|
|
|
66
67
|
<Button onclick={handleCrop} disabled={processing}>
|
|
67
68
|
{processing ? 'Processing...' : confirmLabel}
|
|
68
69
|
</Button>
|
|
69
|
-
|
|
70
|
-
</Dialog>
|
|
70
|
+
</Dialog.Footer>
|
|
71
|
+
</Dialog.Root>
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import { ToggleGroup } from '@ark-ui/svelte/toggle-group';
|
|
3
3
|
import type { ToggleGroupItemBaseProps } from '@ark-ui/svelte/toggle-group';
|
|
4
4
|
import { cn } from 'tailwind-variants';
|
|
5
|
+
import type { ClassValue } from 'svelte/elements';
|
|
5
6
|
|
|
6
7
|
interface Props extends ToggleGroupItemBaseProps {
|
|
7
|
-
class?:
|
|
8
|
+
class?: ClassValue | null;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
let { class: className, children, ...rest }: Props = $props();
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
{...rest}
|
|
15
16
|
class={cn(
|
|
16
17
|
'inline-flex h-8 min-w-8 items-center justify-center rounded-md text-sm text-ink-dim transition-colors select-none hover:bg-surface-2 hover:text-ink focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[state=on]:bg-surface-2 data-[state=on]:text-ink data-[state=on]:shadow-sm',
|
|
17
|
-
className
|
|
18
|
+
className as never
|
|
18
19
|
)}
|
|
19
20
|
>
|
|
20
21
|
{@render children?.()}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ToggleGroupItemBaseProps } from '@ark-ui/svelte/toggle-group';
|
|
2
|
+
import type { ClassValue } from 'svelte/elements';
|
|
2
3
|
interface Props extends ToggleGroupItemBaseProps {
|
|
3
|
-
class?:
|
|
4
|
+
class?: ClassValue | null;
|
|
4
5
|
}
|
|
5
6
|
declare const ToggleGroupItem: import("svelte").Component<Props, {}, "">;
|
|
6
7
|
type ToggleGroupItem = ReturnType<typeof ToggleGroupItem>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Portal } from '@ark-ui/svelte/portal';
|
|
3
|
+
import { Tooltip } from '@ark-ui/svelte/tooltip';
|
|
4
|
+
import type { TooltipContentBaseProps } from '@ark-ui/svelte/tooltip';
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
6
|
+
import { cn } from 'tailwind-variants';
|
|
7
|
+
|
|
8
|
+
type Props = TooltipContentBaseProps & {
|
|
9
|
+
class?: string;
|
|
10
|
+
children: Snippet;
|
|
11
|
+
showArrow?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const { class: className, children, showArrow = true, ...restProps }: Props = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<Portal>
|
|
18
|
+
<Tooltip.Positioner>
|
|
19
|
+
<Tooltip.Content
|
|
20
|
+
{...restProps}
|
|
21
|
+
class={cn(
|
|
22
|
+
'z-50 max-w-80 rounded-md border bg-surface-1 px-2.5 py-1.5 text-xs font-medium text-ink shadow-md outline-none [--arrow-background:var(--compote-surface-1)] [--arrow-size:10px]',
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
>
|
|
26
|
+
{#if showArrow}
|
|
27
|
+
<Tooltip.Arrow>
|
|
28
|
+
<Tooltip.ArrowTip class="border-l border-t" />
|
|
29
|
+
</Tooltip.Arrow>
|
|
30
|
+
{/if}
|
|
31
|
+
{@render children()}
|
|
32
|
+
</Tooltip.Content>
|
|
33
|
+
</Tooltip.Positioner>
|
|
34
|
+
</Portal>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
:global([data-scope='tooltip'][data-part='content'][data-state='open']) {
|
|
38
|
+
animation: tooltip-scale-fade-in 0.15s ease-out;
|
|
39
|
+
transform-origin: var(--transform-origin);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:global([data-scope='tooltip'][data-part='content'][data-state='closed']) {
|
|
43
|
+
animation: tooltip-scale-fade-out 0.1s ease-in;
|
|
44
|
+
transform-origin: var(--transform-origin);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@keyframes tooltip-scale-fade-in {
|
|
48
|
+
from {
|
|
49
|
+
opacity: 0;
|
|
50
|
+
transform: scale(0.96);
|
|
51
|
+
}
|
|
52
|
+
to {
|
|
53
|
+
opacity: 1;
|
|
54
|
+
transform: scale(1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@keyframes tooltip-scale-fade-out {
|
|
59
|
+
from {
|
|
60
|
+
opacity: 1;
|
|
61
|
+
transform: scale(1);
|
|
62
|
+
}
|
|
63
|
+
to {
|
|
64
|
+
opacity: 0;
|
|
65
|
+
transform: scale(0.96);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TooltipContentBaseProps } from '@ark-ui/svelte/tooltip';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type Props = TooltipContentBaseProps & {
|
|
4
|
+
class?: string;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
showArrow?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const TooltipContent: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type TooltipContent = ReturnType<typeof TooltipContent>;
|
|
10
|
+
export default TooltipContent;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Tooltip } from '@ark-ui/svelte/tooltip';
|
|
3
|
+
import type { TooltipRootBaseProps } from '@ark-ui/svelte/tooltip';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
|
|
6
|
+
type Props = TooltipRootBaseProps & {
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const { children, ...restProps }: Props = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Tooltip.Root {...restProps}>
|
|
14
|
+
{@render children?.()}
|
|
15
|
+
</Tooltip.Root>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TooltipRootBaseProps } from '@ark-ui/svelte/tooltip';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type Props = TooltipRootBaseProps & {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const TooltipRoot: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type TooltipRoot = ReturnType<typeof TooltipRoot>;
|
|
8
|
+
export default TooltipRoot;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Tooltip } from '@ark-ui/svelte/tooltip';
|
|
3
|
+
import type { TooltipTriggerBaseProps } from '@ark-ui/svelte/tooltip';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
import { button, type ButtonSize, type ButtonVariant } from '../button/button.variants';
|
|
6
|
+
|
|
7
|
+
type Props = TooltipTriggerBaseProps & {
|
|
8
|
+
variant?: ButtonVariant;
|
|
9
|
+
size?: ButtonSize;
|
|
10
|
+
class?: string;
|
|
11
|
+
children?: Snippet;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
asChild,
|
|
16
|
+
variant = 'ghost',
|
|
17
|
+
size = 'icon',
|
|
18
|
+
class: className,
|
|
19
|
+
children,
|
|
20
|
+
...restProps
|
|
21
|
+
}: Props = $props();
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Tooltip.Trigger
|
|
25
|
+
{...restProps}
|
|
26
|
+
{asChild}
|
|
27
|
+
class={asChild ? className : button({ variant, size, class: className })}
|
|
28
|
+
>
|
|
29
|
+
{@render children?.()}
|
|
30
|
+
</Tooltip.Trigger>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TooltipTriggerBaseProps } from '@ark-ui/svelte/tooltip';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { type ButtonSize, type ButtonVariant } from '../button/button.variants';
|
|
4
|
+
type Props = TooltipTriggerBaseProps & {
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
size?: ButtonSize;
|
|
7
|
+
class?: string;
|
|
8
|
+
children?: Snippet;
|
|
9
|
+
};
|
|
10
|
+
declare const TooltipTrigger: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type TooltipTrigger = ReturnType<typeof TooltipTrigger>;
|
|
12
|
+
export default TooltipTrigger;
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export { default as Switch } from './components/switch/switch.svelte';
|
|
|
32
32
|
export * as Tabs from './components/tabs';
|
|
33
33
|
export * as ToggleGroup from './components/toggle-group';
|
|
34
34
|
export * as Menu from './components/menu';
|
|
35
|
+
export * as Tooltip from './components/tooltip';
|
|
35
36
|
export * as Field from './components/field';
|
|
36
37
|
export * as Fieldset from './components/fieldset';
|
|
37
38
|
export { default as TreeView } from './components/tree-view/tree-view.svelte';
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ export { default as Switch } from './components/switch/switch.svelte';
|
|
|
25
25
|
export * as Tabs from './components/tabs';
|
|
26
26
|
export * as ToggleGroup from './components/toggle-group';
|
|
27
27
|
export * as Menu from './components/menu';
|
|
28
|
+
export * as Tooltip from './components/tooltip';
|
|
28
29
|
export * as Field from './components/field';
|
|
29
30
|
export * as Fieldset from './components/fieldset';
|
|
30
31
|
export { default as TreeView } from './components/tree-view/tree-view.svelte';
|