compote-ui 0.26.0 → 0.27.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.
@@ -20,14 +20,21 @@
20
20
  .toUpperCase();
21
21
  }
22
22
 
23
- let { src, alt, fallback, size = 'md', class: className, ...rest }: AvatarProps & { class?: string } = $props();
23
+ let {
24
+ src,
25
+ alt,
26
+ fallback,
27
+ size = 'md',
28
+ class: className,
29
+ ...rest
30
+ }: AvatarProps & { class?: string } = $props();
24
31
 
25
32
  const displayFallback = $derived(fallback ? getInitials(fallback) : '');
26
33
  </script>
27
34
 
28
35
  <Avatar.Root
29
36
  class={cn(
30
- 'inline-flex items-center justify-center relative overflow-hidden rounded-full select-none shrink-0 bg-surface-2 font-medium text-ink',
37
+ 'relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-surface-2 font-medium text-ink select-none',
31
38
  sizeClasses[size],
32
39
  className
33
40
  )}
@@ -36,7 +43,7 @@
36
43
  <Avatar.Image
37
44
  {src}
38
45
  {alt}
39
- class="object-cover w-full h-full rounded-[inherit] data-[state=hidden]:hidden"
46
+ class="h-full w-full rounded-[inherit] object-cover data-[state=hidden]:hidden"
40
47
  />
41
48
  <Avatar.Fallback class="data-[state=hidden]:hidden">
42
49
  {displayFallback}
@@ -112,9 +112,7 @@
112
112
  >
113
113
  <PhArrowClockwise class="size-4" />
114
114
  </Button>
115
- <Button variant="outline" size="sm" onclick={handleTrim} disabled={trimming}>
116
- Trim
117
- </Button>
115
+ <Button variant="outline" size="sm" onclick={handleTrim} disabled={trimming}>Trim</Button>
118
116
  </div>
119
117
  </div>
120
118
  <p>Width: {cropData.width}px / Height: {cropData.height}px</p>
@@ -1,4 +1,6 @@
1
1
  export { default as Root } from './tabs.svelte';
2
+ export { default as List } from './tab-list.svelte';
2
3
  export { default as Trigger } from './tab-trigger.svelte';
4
+ export { default as Indicator } from './tab-indicator.svelte';
3
5
  export { default as Content } from './tab-content.svelte';
4
6
  export type { TabsProps } from './types';
@@ -1,3 +1,5 @@
1
1
  export { default as Root } from './tabs.svelte';
2
+ export { default as List } from './tab-list.svelte';
2
3
  export { default as Trigger } from './tab-trigger.svelte';
4
+ export { default as Indicator } from './tab-indicator.svelte';
3
5
  export { default as Content } from './tab-content.svelte';
@@ -12,7 +12,7 @@
12
12
  <Tabs.Content
13
13
  {...rest}
14
14
  class={className ??
15
- 'flex-1 pt-4 outline-none data-[orientation=vertical]:pt-0 data-[orientation=vertical]:pl-4'}
15
+ 'flex-1 pt-4 outline-none focus-visible:rounded-sm focus-visible:outline-2 focus-visible:-outline-offset-2 data-[orientation=vertical]:pt-0 data-[orientation=vertical]:pl-4'}
16
16
  >
17
17
  {@render children?.()}
18
18
  </Tabs.Content>
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import { Tabs } from '@ark-ui/svelte/tabs';
3
+ import type { TabIndicatorBaseProps } from '@ark-ui/svelte/tabs';
4
+
5
+ interface Props extends TabIndicatorBaseProps {
6
+ class?: string;
7
+ }
8
+
9
+ let { class: className, ...rest }: Props = $props();
10
+ </script>
11
+
12
+ <Tabs.Indicator
13
+ {...rest}
14
+ class={className ??
15
+ "absolute -z-10 rounded-md bg-surface-2 transition-[width,height,left,top] duration-200 ease-out data-[orientation='horizontal']:h-8 data-[orientation='horizontal']:w-(--width) data-[orientation='vertical']:h-(--height) data-[orientation='vertical']:w-full"}
16
+ />
@@ -0,0 +1,7 @@
1
+ import type { TabIndicatorBaseProps } from '@ark-ui/svelte/tabs';
2
+ interface Props extends TabIndicatorBaseProps {
3
+ class?: string;
4
+ }
5
+ declare const TabIndicator: import("svelte").Component<Props, {}, "">;
6
+ type TabIndicator = ReturnType<typeof TabIndicator>;
7
+ export default TabIndicator;
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ import { Tabs } from '@ark-ui/svelte/tabs';
3
+ import type { TabListBaseProps } from '@ark-ui/svelte/tabs';
4
+
5
+ interface Props extends TabListBaseProps {
6
+ class?: string;
7
+ }
8
+
9
+ let { class: className, children, ...rest }: Props = $props();
10
+ </script>
11
+
12
+ <Tabs.List
13
+ {...rest}
14
+ class={className ??
15
+ "relative isolate inline-flex gap-1 data-[orientation='horizontal']:flex-row data-[orientation='vertical']:flex-col"}
16
+ >
17
+ {@render children?.()}
18
+ </Tabs.List>
@@ -0,0 +1,7 @@
1
+ import type { TabListBaseProps } from '@ark-ui/svelte/tabs';
2
+ interface Props extends TabListBaseProps {
3
+ class?: string;
4
+ }
5
+ declare const TabList: import("svelte").Component<Props, {}, "">;
6
+ type TabList = ReturnType<typeof TabList>;
7
+ export default TabList;
@@ -12,7 +12,7 @@
12
12
  <Tabs.Trigger
13
13
  {...rest}
14
14
  class={className ??
15
- 'inline-flex h-8 items-center justify-center gap-2 rounded-md bg-transparent px-3 text-sm whitespace-nowrap text-ink-dim transition-colors outline-none hover:bg-surface-2 focus-visible:outline-2 focus-visible:outline-offset-2 data-selected:font-medium data-selected:text-ink data-[orientation=vertical]:w-full data-[orientation=vertical]:justify-start data-[orientation=vertical]:py-2'}
15
+ 'inline-flex h-8 items-center justify-center gap-2 rounded-md bg-transparent px-3 text-sm whitespace-nowrap text-ink-dim transition-colors outline-none hover:bg-surface-2 focus-visible:outline-2 focus-visible:outline-offset-2 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-disabled:grayscale data-selected:font-medium data-selected:text-ink data-[orientation=vertical]:w-full data-[orientation=vertical]:justify-start data-[orientation=vertical]:py-2'}
16
16
  >
17
17
  {@render children?.()}
18
18
  </Tabs.Trigger>
@@ -4,11 +4,9 @@
4
4
  import type { TabsProps } from './types';
5
5
 
6
6
  let {
7
- indicator = false,
8
7
  value = $bindable(),
9
8
  defaultValue,
10
9
  orientation = 'horizontal',
11
- triggers,
12
10
  children,
13
11
  ...rootProps
14
12
  }: TabsProps = $props();
@@ -22,18 +20,6 @@
22
20
  {orientation}
23
21
  class="flex data-[orientation='horizontal']:flex-col data-[orientation='vertical']:flex-row"
24
22
  >
25
- <Tabs.List
26
- class="relative isolate inline-flex gap-1 data-[orientation='horizontal']:flex-row data-[orientation='vertical']:flex-col"
27
- >
28
- {#if triggers}
29
- {@render triggers()}
30
- {/if}
31
- {#if indicator}
32
- <Tabs.Indicator
33
- class="absolute -z-10 rounded-md bg-surface-2 transition-[width,height,left,top] duration-200 ease-out data-[orientation='horizontal']:h-8 data-[orientation='horizontal']:w-(--width) data-[orientation='vertical']:h-(--height) data-[orientation='vertical']:w-full"
34
- />
35
- {/if}
36
- </Tabs.List>
37
23
  {@render children?.()}
38
24
  </Tabs.Root>
39
25
  </ClientOnly>
@@ -1,5 +1,4 @@
1
1
  import { Tabs } from '@ark-ui/svelte/tabs';
2
- import type { TabsProps } from './types';
3
- declare const Tabs: import("svelte").Component<TabsProps, {}, "value">;
2
+ declare const Tabs: import("svelte").Component<Tabs.RootBaseProps, {}, "value">;
4
3
  type Tabs = ReturnType<typeof Tabs>;
5
4
  export default Tabs;
@@ -1,8 +1,2 @@
1
1
  import type { TabsRootBaseProps } from '@ark-ui/svelte/tabs';
2
- import type { Snippet } from 'svelte';
3
- export interface TabsProps extends TabsRootBaseProps {
4
- /** Whether to show the animated indicator behind the active tab */
5
- indicator?: boolean;
6
- /** Snippet for rendering tab triggers inside the list */
7
- triggers?: Snippet;
8
- }
2
+ export type TabsProps = TabsRootBaseProps;
@@ -1,18 +1,21 @@
1
- <script lang="ts">
2
- import { ToggleGroup } from '@ark-ui/svelte/toggle-group';
3
- import type { ToggleGroupItemBaseProps } from '@ark-ui/svelte/toggle-group';
4
- import { cn } from 'tailwind-variants';
5
-
6
- interface Props extends ToggleGroupItemBaseProps {
7
- class?: string;
8
- }
9
-
10
- let { class: className, children, ...rest }: Props = $props();
11
- </script>
12
-
13
- <ToggleGroup.Item
14
- {...rest}
15
- class={cn('inline-flex h-8 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', className)}
16
- >
17
- {@render children?.()}
18
- </ToggleGroup.Item>
1
+ <script lang="ts">
2
+ import { ToggleGroup } from '@ark-ui/svelte/toggle-group';
3
+ import type { ToggleGroupItemBaseProps } from '@ark-ui/svelte/toggle-group';
4
+ import { cn } from 'tailwind-variants';
5
+
6
+ interface Props extends ToggleGroupItemBaseProps {
7
+ class?: string;
8
+ }
9
+
10
+ let { class: className, children, ...rest }: Props = $props();
11
+ </script>
12
+
13
+ <ToggleGroup.Item
14
+ {...rest}
15
+ class={cn(
16
+ 'inline-flex h-8 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
+ )}
19
+ >
20
+ {@render children?.()}
21
+ </ToggleGroup.Item>
@@ -1,19 +1,22 @@
1
- <script lang="ts">
2
- import { ToggleGroup } from '@ark-ui/svelte/toggle-group';
3
- import type { ToggleGroupRootBaseProps } from '@ark-ui/svelte/toggle-group';
4
- import { cn } from 'tailwind-variants';
5
-
6
- interface Props extends ToggleGroupRootBaseProps {
7
- class?: string;
8
- }
9
-
10
- let { class: className, children, value = $bindable(), ...rootProps }: Props = $props();
11
- </script>
12
-
13
- <ToggleGroup.Root
14
- {...rootProps}
15
- bind:value
16
- class={cn('inline-flex gap-1 rounded-lg border border-border bg-surface-1 p-1 data-[orientation=vertical]:flex-col', className)}
17
- >
18
- {@render children?.()}
19
- </ToggleGroup.Root>
1
+ <script lang="ts">
2
+ import { ToggleGroup } from '@ark-ui/svelte/toggle-group';
3
+ import type { ToggleGroupRootBaseProps } from '@ark-ui/svelte/toggle-group';
4
+ import { cn } from 'tailwind-variants';
5
+
6
+ interface Props extends ToggleGroupRootBaseProps {
7
+ class?: string;
8
+ }
9
+
10
+ let { class: className, children, value = $bindable(), ...rootProps }: Props = $props();
11
+ </script>
12
+
13
+ <ToggleGroup.Root
14
+ {...rootProps}
15
+ bind:value
16
+ class={cn(
17
+ 'inline-flex gap-1 rounded-lg border border-border bg-surface-1 p-1 data-[orientation=vertical]:flex-col',
18
+ className
19
+ )}
20
+ >
21
+ {@render children?.()}
22
+ </ToggleGroup.Root>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compote-ui",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev",