compote-ui 0.48.0 → 0.48.1

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.
@@ -2,20 +2,42 @@
2
2
  import { Dialog } from '@ark-ui/svelte/dialog';
3
3
  import type { DialogCloseTriggerBaseProps } from '@ark-ui/svelte/dialog';
4
4
  import { PhX } from '../../icons';
5
- import type { ClassValue } from 'svelte/elements';
5
+ import {
6
+ button,
7
+ type ButtonVariant,
8
+ type ButtonSize
9
+ } from '../button/button.variants';
10
+ import type { ClassValue } from 'tailwind-variants';
6
11
 
7
12
  interface Props extends DialogCloseTriggerBaseProps {
13
+ variant?: ButtonVariant;
14
+ size?: ButtonSize;
8
15
  class?: ClassValue;
9
16
  }
10
17
 
11
- let { class: className, children, ...rest }: Props = $props();
18
+ let { class: className, variant, size, children, ...rest }: Props = $props();
19
+
20
+ const isIconMode = $derived(!children);
21
+
22
+ const classes = $derived(
23
+ isIconMode
24
+ ? button({
25
+ variant: variant ?? 'ghost',
26
+ size: size ?? 'icon-sm',
27
+ class: [
28
+ 'absolute top-3 right-3 opacity-70 hover:opacity-100 active:opacity-50',
29
+ className
30
+ ]
31
+ })
32
+ : button({
33
+ variant: variant ?? 'outline',
34
+ size: size ?? 'default',
35
+ class: className
36
+ })
37
+ );
12
38
  </script>
13
39
 
14
- <Dialog.CloseTrigger
15
- {...rest}
16
- class={className ??
17
- 'absolute top-3 right-3 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none active:opacity-50'}
18
- >
40
+ <Dialog.CloseTrigger {...rest} class={classes}>
19
41
  {#if children}
20
42
  {@render children()}
21
43
  {:else}
@@ -1,6 +1,9 @@
1
1
  import type { DialogCloseTriggerBaseProps } from '@ark-ui/svelte/dialog';
2
- import type { ClassValue } from 'svelte/elements';
2
+ import { type ButtonVariant, type ButtonSize } from '../button/button.variants';
3
+ import type { ClassValue } from 'tailwind-variants';
3
4
  interface Props extends DialogCloseTriggerBaseProps {
5
+ variant?: ButtonVariant;
6
+ size?: ButtonSize;
4
7
  class?: ClassValue;
5
8
  }
6
9
  declare const DialogCloseTrigger: import("svelte").Component<Props, {}, "">;
@@ -11,6 +11,11 @@
11
11
  let { class: className, children }: Props = $props();
12
12
  </script>
13
13
 
14
- <div class={cn('mt-auto flex flex-row items-center justify-end gap-2 border-t border-border p-4', className)}>
14
+ <div
15
+ class={cn(
16
+ 'mt-auto flex flex-row items-center justify-end gap-2 border-t border-border p-4',
17
+ className
18
+ )}
19
+ >
15
20
  {@render children()}
16
21
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compote-ui",
3
- "version": "0.48.0",
3
+ "version": "0.48.1",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev --open",