compote-ui 0.25.10 → 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.
@@ -0,0 +1,51 @@
1
+ <script lang="ts">
2
+ import { Avatar } from '@ark-ui/svelte/avatar';
3
+ import { cn } from 'tailwind-variants';
4
+ import type { AvatarProps, AvatarSize } from './avatar.types';
5
+
6
+ const sizeClasses: Record<AvatarSize, string> = {
7
+ sm: 'size-8 text-xs',
8
+ md: 'size-10 text-sm',
9
+ lg: 'size-12 text-base',
10
+ xl: 'size-16 text-lg'
11
+ };
12
+
13
+ function getInitials(name: string): string {
14
+ return name
15
+ .trim()
16
+ .split(/\s+/)
17
+ .slice(0, 2)
18
+ .map((w) => w[0])
19
+ .join('')
20
+ .toUpperCase();
21
+ }
22
+
23
+ let {
24
+ src,
25
+ alt,
26
+ fallback,
27
+ size = 'md',
28
+ class: className,
29
+ ...rest
30
+ }: AvatarProps & { class?: string } = $props();
31
+
32
+ const displayFallback = $derived(fallback ? getInitials(fallback) : '');
33
+ </script>
34
+
35
+ <Avatar.Root
36
+ class={cn(
37
+ 'relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-surface-2 font-medium text-ink select-none',
38
+ sizeClasses[size],
39
+ className
40
+ )}
41
+ {...rest}
42
+ >
43
+ <Avatar.Image
44
+ {src}
45
+ {alt}
46
+ class="h-full w-full rounded-[inherit] object-cover data-[state=hidden]:hidden"
47
+ />
48
+ <Avatar.Fallback class="data-[state=hidden]:hidden">
49
+ {displayFallback}
50
+ </Avatar.Fallback>
51
+ </Avatar.Root>
@@ -0,0 +1,8 @@
1
+ import { Avatar } from '@ark-ui/svelte/avatar';
2
+ import type { AvatarProps } from './avatar.types';
3
+ type $$ComponentProps = AvatarProps & {
4
+ class?: string;
5
+ };
6
+ declare const Avatar: import("svelte").Component<$$ComponentProps, {}, "">;
7
+ type Avatar = ReturnType<typeof Avatar>;
8
+ export default Avatar;
@@ -0,0 +1,8 @@
1
+ import type { AvatarRootBaseProps } from '@ark-ui/svelte/avatar';
2
+ export type AvatarSize = 'sm' | 'md' | 'lg' | 'xl';
3
+ export interface AvatarProps extends Omit<AvatarRootBaseProps, 'children' | 'asChild' | 'ref'> {
4
+ src?: string;
5
+ alt?: string;
6
+ fallback?: string;
7
+ size?: AvatarSize;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as Avatar } from './avatar.svelte';
2
+ export type { AvatarProps, AvatarSize } from './avatar.types';
@@ -0,0 +1 @@
1
+ export { default as Avatar } from './avatar.svelte';
@@ -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/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { default as Avatar } from './components/avatar/avatar.svelte';
2
+ export type { AvatarProps, AvatarSize } from './components/avatar/avatar.types';
1
3
  export { default as Button } from './components/button/button.svelte';
2
4
  export { default as LinkButton } from './components/button/link-button.svelte';
3
5
  export * as Card from './components/card';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // Reexport your entry components here
2
+ export { default as Avatar } from './components/avatar/avatar.svelte';
2
3
  export { default as Button } from './components/button/button.svelte';
3
4
  export { default as LinkButton } from './components/button/link-button.svelte';
4
5
  export * as Card from './components/card';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compote-ui",
3
- "version": "0.25.10",
3
+ "version": "0.27.0",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -41,7 +41,7 @@
41
41
  "@sveltejs/adapter-auto": "^7.0.0",
42
42
  "@sveltejs/kit": "^2.57.1",
43
43
  "@sveltejs/package": "^2.5.7",
44
- "@sveltejs/vite-plugin-svelte": "6.2.4",
44
+ "@sveltejs/vite-plugin-svelte": "7.0.0",
45
45
  "@tailwindcss/vite": "^4.2.4",
46
46
  "@types/node": "^22",
47
47
  "eslint": "^10.2.1",
@@ -55,10 +55,10 @@
55
55
  "svelte": "^5.55.4",
56
56
  "svelte-check": "^4.4.6",
57
57
  "tailwindcss": "^4.2.4",
58
- "typescript": "^5.9.3",
58
+ "typescript": "^6.0.3",
59
59
  "typescript-eslint": "^8.58.2",
60
60
  "unplugin-icons": "^23.0.1",
61
- "vite": "^7.3.1",
61
+ "vite": "^8.0.10",
62
62
  "vite-plugin-devtools-json": "^1.0.0"
63
63
  },
64
64
  "keywords": [