compote-ui 0.25.9 → 0.26.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,44 @@
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 { src, alt, fallback, size = 'md', class: className, ...rest }: AvatarProps & { class?: string } = $props();
24
+
25
+ const displayFallback = $derived(fallback ? getInitials(fallback) : '');
26
+ </script>
27
+
28
+ <Avatar.Root
29
+ 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',
31
+ sizeClasses[size],
32
+ className
33
+ )}
34
+ {...rest}
35
+ >
36
+ <Avatar.Image
37
+ {src}
38
+ {alt}
39
+ class="object-cover w-full h-full rounded-[inherit] data-[state=hidden]:hidden"
40
+ />
41
+ <Avatar.Fallback class="data-[state=hidden]:hidden">
42
+ {displayFallback}
43
+ </Avatar.Fallback>
44
+ </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';
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/dist/theme.css CHANGED
@@ -2,8 +2,7 @@
2
2
  @import './open-props/props.colors-oklch.css';
3
3
  @import './open-props/props.gray-oklch.css';
4
4
 
5
- @source './components/**/*.svelte';
6
- @source './components/**/*.js';
5
+ @source './components/**/*.{svelte,js}';
7
6
 
8
7
  :root {
9
8
  color-scheme: light dark;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compote-ui",
3
- "version": "0.25.9",
3
+ "version": "0.26.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": [