@classic-homes/theme-svelte 0.1.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/README.md +305 -0
- package/dist/lib/components/Alert.svelte +51 -0
- package/dist/lib/components/Alert.svelte.d.ts +9 -0
- package/dist/lib/components/AlertDescription.svelte +16 -0
- package/dist/lib/components/AlertDescription.svelte.d.ts +9 -0
- package/dist/lib/components/AlertDialog.svelte +136 -0
- package/dist/lib/components/AlertDialog.svelte.d.ts +79 -0
- package/dist/lib/components/AlertTitle.svelte +16 -0
- package/dist/lib/components/AlertTitle.svelte.d.ts +9 -0
- package/dist/lib/components/Avatar.svelte +56 -0
- package/dist/lib/components/Avatar.svelte.d.ts +26 -0
- package/dist/lib/components/AvatarFallback.svelte +31 -0
- package/dist/lib/components/AvatarFallback.svelte.d.ts +17 -0
- package/dist/lib/components/AvatarImage.svelte +29 -0
- package/dist/lib/components/AvatarImage.svelte.d.ts +12 -0
- package/dist/lib/components/Badge.svelte +73 -0
- package/dist/lib/components/Badge.svelte.d.ts +11 -0
- package/dist/lib/components/Button.svelte +130 -0
- package/dist/lib/components/Button.svelte.d.ts +17 -0
- package/dist/lib/components/Card.svelte +58 -0
- package/dist/lib/components/Card.svelte.d.ts +26 -0
- package/dist/lib/components/CardContent.svelte +16 -0
- package/dist/lib/components/CardContent.svelte.d.ts +9 -0
- package/dist/lib/components/CardDescription.svelte +16 -0
- package/dist/lib/components/CardDescription.svelte.d.ts +9 -0
- package/dist/lib/components/CardFooter.svelte +16 -0
- package/dist/lib/components/CardFooter.svelte.d.ts +9 -0
- package/dist/lib/components/CardHeader.svelte +16 -0
- package/dist/lib/components/CardHeader.svelte.d.ts +9 -0
- package/dist/lib/components/CardTitle.svelte +16 -0
- package/dist/lib/components/CardTitle.svelte.d.ts +9 -0
- package/dist/lib/components/Checkbox.svelte +65 -0
- package/dist/lib/components/Checkbox.svelte.d.ts +14 -0
- package/dist/lib/components/DataTable.svelte +334 -0
- package/dist/lib/components/DataTable.svelte.d.ts +103 -0
- package/dist/lib/components/Dialog.svelte +111 -0
- package/dist/lib/components/Dialog.svelte.d.ts +22 -0
- package/dist/lib/components/DropdownMenu.svelte +135 -0
- package/dist/lib/components/DropdownMenu.svelte.d.ts +33 -0
- package/dist/lib/components/FileUpload.svelte +448 -0
- package/dist/lib/components/FileUpload.svelte.d.ts +42 -0
- package/dist/lib/components/FormField.svelte +134 -0
- package/dist/lib/components/FormField.svelte.d.ts +37 -0
- package/dist/lib/components/Input.svelte +61 -0
- package/dist/lib/components/Input.svelte.d.ts +19 -0
- package/dist/lib/components/Label.svelte +33 -0
- package/dist/lib/components/Label.svelte.d.ts +11 -0
- package/dist/lib/components/LoadingLogo.svelte +124 -0
- package/dist/lib/components/LoadingLogo.svelte.d.ts +16 -0
- package/dist/lib/components/LogoMain.svelte +237 -0
- package/dist/lib/components/LogoMain.svelte.d.ts +20 -0
- package/dist/lib/components/PageHeader.svelte +90 -0
- package/dist/lib/components/PageHeader.svelte.d.ts +28 -0
- package/dist/lib/components/Section.svelte +44 -0
- package/dist/lib/components/Section.svelte.d.ts +28 -0
- package/dist/lib/components/Select.svelte +174 -0
- package/dist/lib/components/Select.svelte.d.ts +32 -0
- package/dist/lib/components/Separator.svelte +29 -0
- package/dist/lib/components/Separator.svelte.d.ts +9 -0
- package/dist/lib/components/Skeleton.svelte +35 -0
- package/dist/lib/components/Skeleton.svelte.d.ts +7 -0
- package/dist/lib/components/Spinner.svelte +50 -0
- package/dist/lib/components/Spinner.svelte.d.ts +8 -0
- package/dist/lib/components/Switch.svelte +56 -0
- package/dist/lib/components/Switch.svelte.d.ts +14 -0
- package/dist/lib/components/TabPanel.svelte +44 -0
- package/dist/lib/components/TabPanel.svelte.d.ts +12 -0
- package/dist/lib/components/Tabs.svelte +125 -0
- package/dist/lib/components/Tabs.svelte.d.ts +19 -0
- package/dist/lib/components/Textarea.svelte +54 -0
- package/dist/lib/components/Textarea.svelte.d.ts +16 -0
- package/dist/lib/components/Toast.svelte +116 -0
- package/dist/lib/components/Toast.svelte.d.ts +12 -0
- package/dist/lib/components/ToastContainer.svelte +56 -0
- package/dist/lib/components/ToastContainer.svelte.d.ts +8 -0
- package/dist/lib/components/Tooltip.svelte +55 -0
- package/dist/lib/components/Tooltip.svelte.d.ts +18 -0
- package/dist/lib/components/layout/AppShell.svelte +82 -0
- package/dist/lib/components/layout/AppShell.svelte.d.ts +44 -0
- package/dist/lib/components/layout/DashboardLayout.svelte +248 -0
- package/dist/lib/components/layout/DashboardLayout.svelte.d.ts +62 -0
- package/dist/lib/components/layout/Footer.svelte +130 -0
- package/dist/lib/components/layout/Footer.svelte.d.ts +32 -0
- package/dist/lib/components/layout/FormPageLayout.svelte +92 -0
- package/dist/lib/components/layout/FormPageLayout.svelte.d.ts +33 -0
- package/dist/lib/components/layout/Header.svelte +94 -0
- package/dist/lib/components/layout/Header.svelte.d.ts +30 -0
- package/dist/lib/components/layout/PublicLayout.svelte +180 -0
- package/dist/lib/components/layout/PublicLayout.svelte.d.ts +39 -0
- package/dist/lib/components/layout/QuickLinks.svelte +112 -0
- package/dist/lib/components/layout/QuickLinks.svelte.d.ts +27 -0
- package/dist/lib/components/layout/Sidebar.svelte +243 -0
- package/dist/lib/components/layout/Sidebar.svelte.d.ts +48 -0
- package/dist/lib/composables/index.d.ts +8 -0
- package/dist/lib/composables/index.js +10 -0
- package/dist/lib/composables/useAsync.svelte.d.ts +102 -0
- package/dist/lib/composables/useAsync.svelte.js +210 -0
- package/dist/lib/composables/useForm.svelte.d.ts +123 -0
- package/dist/lib/composables/useForm.svelte.js +245 -0
- package/dist/lib/index.d.ts +65 -0
- package/dist/lib/index.js +83 -0
- package/dist/lib/performance.d.ts +79 -0
- package/dist/lib/performance.js +170 -0
- package/dist/lib/schemas/auth.d.ts +410 -0
- package/dist/lib/schemas/auth.js +216 -0
- package/dist/lib/schemas/common.d.ts +267 -0
- package/dist/lib/schemas/common.js +268 -0
- package/dist/lib/schemas/index.d.ts +24 -0
- package/dist/lib/schemas/index.js +32 -0
- package/dist/lib/stores/sidebar.svelte.d.ts +25 -0
- package/dist/lib/stores/sidebar.svelte.js +38 -0
- package/dist/lib/stores/theme.svelte.d.ts +72 -0
- package/dist/lib/stores/theme.svelte.js +150 -0
- package/dist/lib/stores/toast.svelte.d.ts +62 -0
- package/dist/lib/stores/toast.svelte.js +93 -0
- package/dist/lib/types/components.d.ts +85 -0
- package/dist/lib/types/components.js +7 -0
- package/dist/lib/types/layout.d.ts +258 -0
- package/dist/lib/types/layout.js +7 -0
- package/dist/lib/utils.d.ts +6 -0
- package/dist/lib/utils.js +9 -0
- package/dist/lib/validation.d.ts +101 -0
- package/dist/lib/validation.js +170 -0
- package/package.json +56 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Avatar - User/entity representation component
|
|
3
|
+
*
|
|
4
|
+
* Built on Bits UI Avatar primitive for accessibility and loading state handling.
|
|
5
|
+
* Displays user images with fallback placeholder support.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Multiple size variants (xs, sm, md, lg)
|
|
9
|
+
* - Automatic image loading state management
|
|
10
|
+
* - Fallback display when image fails/loading
|
|
11
|
+
* - Circular design by default
|
|
12
|
+
*/
|
|
13
|
+
import type { Snippet } from 'svelte';
|
|
14
|
+
declare const Avatar: import("svelte").Component<{
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
/** Size variant */
|
|
17
|
+
size?: "sm" | "md" | "lg" | "xl" | "xs" | undefined;
|
|
18
|
+
/** Delay before showing fallback (ms) */
|
|
19
|
+
delayMs?: number;
|
|
20
|
+
/** Additional classes */
|
|
21
|
+
class?: string;
|
|
22
|
+
/** Avatar content (AvatarImage and/or AvatarFallback) */
|
|
23
|
+
children: Snippet;
|
|
24
|
+
}, {}, "">;
|
|
25
|
+
type Avatar = ReturnType<typeof Avatar>;
|
|
26
|
+
export default Avatar;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* AvatarFallback - Fallback content when Avatar image is loading or unavailable
|
|
4
|
+
*
|
|
5
|
+
* Displays initials or placeholder content when the image cannot be shown.
|
|
6
|
+
* Should be used inside an Avatar component.
|
|
7
|
+
*/
|
|
8
|
+
import type { Snippet } from 'svelte';
|
|
9
|
+
import { Avatar as AvatarPrimitive } from 'bits-ui';
|
|
10
|
+
import { cn } from '../utils.js';
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
/** Additional classes */
|
|
14
|
+
class?: string;
|
|
15
|
+
/** Fallback content (typically initials) */
|
|
16
|
+
children: Snippet;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let { class: className, children, ...restProps }: Props = $props();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<AvatarPrimitive.Fallback
|
|
24
|
+
class={cn(
|
|
25
|
+
'flex h-full w-full items-center justify-center rounded-full bg-primary/20 text-sm font-medium',
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...restProps}
|
|
29
|
+
>
|
|
30
|
+
{@render children()}
|
|
31
|
+
</AvatarPrimitive.Fallback>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AvatarFallback - Fallback content when Avatar image is loading or unavailable
|
|
3
|
+
*
|
|
4
|
+
* Displays initials or placeholder content when the image cannot be shown.
|
|
5
|
+
* Should be used inside an Avatar component.
|
|
6
|
+
*/
|
|
7
|
+
import type { Snippet } from 'svelte';
|
|
8
|
+
interface Props {
|
|
9
|
+
/** Additional classes */
|
|
10
|
+
class?: string;
|
|
11
|
+
/** Fallback content (typically initials) */
|
|
12
|
+
children: Snippet;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
declare const AvatarFallback: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
type AvatarFallback = ReturnType<typeof AvatarFallback>;
|
|
17
|
+
export default AvatarFallback;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* AvatarImage - The image displayed within an Avatar
|
|
4
|
+
*
|
|
5
|
+
* Handles image loading states automatically via Bits UI.
|
|
6
|
+
* Should be used inside an Avatar component.
|
|
7
|
+
*/
|
|
8
|
+
import { Avatar as AvatarPrimitive } from 'bits-ui';
|
|
9
|
+
import { cn } from '../utils.js';
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
/** Image source URL */
|
|
13
|
+
src: string;
|
|
14
|
+
/** Alt text for accessibility */
|
|
15
|
+
alt: string;
|
|
16
|
+
/** Additional classes */
|
|
17
|
+
class?: string;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let { src, alt, class: className, ...restProps }: Props = $props();
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<AvatarPrimitive.Image
|
|
25
|
+
{src}
|
|
26
|
+
{alt}
|
|
27
|
+
class={cn('aspect-square h-full w-full object-cover', className)}
|
|
28
|
+
{...restProps}
|
|
29
|
+
/>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
/** Image source URL */
|
|
3
|
+
src: string;
|
|
4
|
+
/** Alt text for accessibility */
|
|
5
|
+
alt: string;
|
|
6
|
+
/** Additional classes */
|
|
7
|
+
class?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
declare const AvatarImage: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type AvatarImage = ReturnType<typeof AvatarImage>;
|
|
12
|
+
export default AvatarImage;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
5
|
+
|
|
6
|
+
const badgeVariants = tv({
|
|
7
|
+
base: 'inline-flex items-center justify-center rounded-md border font-medium w-fit whitespace-nowrap shrink-0 gap-1 transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: 'border-transparent bg-primary text-primary-foreground',
|
|
11
|
+
secondary: 'border-transparent bg-secondary text-secondary-foreground',
|
|
12
|
+
destructive: 'border-transparent bg-destructive text-white',
|
|
13
|
+
outline: 'text-foreground',
|
|
14
|
+
success: 'border-transparent bg-green-500 text-white',
|
|
15
|
+
warning: 'border-transparent bg-yellow-500 text-white',
|
|
16
|
+
info: 'border-transparent bg-blue-500 text-white',
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
default: 'px-2 py-0.5 text-xs',
|
|
20
|
+
sm: 'px-1.5 py-0.5 text-xs',
|
|
21
|
+
dot: 'h-5 w-5 p-0 text-xs',
|
|
22
|
+
},
|
|
23
|
+
clickable: {
|
|
24
|
+
true: 'cursor-pointer',
|
|
25
|
+
false: '',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
compoundVariants: [
|
|
29
|
+
{ variant: 'default', clickable: true, class: 'hover:bg-primary/90' },
|
|
30
|
+
{ variant: 'secondary', clickable: true, class: 'hover:bg-secondary/90' },
|
|
31
|
+
{ variant: 'destructive', clickable: true, class: 'hover:bg-destructive/90' },
|
|
32
|
+
{
|
|
33
|
+
variant: 'outline',
|
|
34
|
+
clickable: true,
|
|
35
|
+
class: 'hover:bg-accent hover:text-accent-foreground',
|
|
36
|
+
},
|
|
37
|
+
{ variant: 'success', clickable: true, class: 'hover:bg-green-600' },
|
|
38
|
+
{ variant: 'warning', clickable: true, class: 'hover:bg-yellow-600' },
|
|
39
|
+
{ variant: 'info', clickable: true, class: 'hover:bg-blue-600' },
|
|
40
|
+
],
|
|
41
|
+
defaultVariants: {
|
|
42
|
+
variant: 'default',
|
|
43
|
+
size: 'default',
|
|
44
|
+
clickable: false,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
type BadgeVariants = VariantProps<typeof badgeVariants>;
|
|
49
|
+
|
|
50
|
+
interface Props {
|
|
51
|
+
variant?: BadgeVariants['variant'];
|
|
52
|
+
size?: BadgeVariants['size'];
|
|
53
|
+
clickable?: boolean;
|
|
54
|
+
class?: string;
|
|
55
|
+
children: Snippet;
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let {
|
|
60
|
+
variant = 'default',
|
|
61
|
+
size = 'default',
|
|
62
|
+
clickable = false,
|
|
63
|
+
class: className,
|
|
64
|
+
children,
|
|
65
|
+
...restProps
|
|
66
|
+
}: Props = $props();
|
|
67
|
+
|
|
68
|
+
const classes = $derived(cn(badgeVariants({ variant, size, clickable }), className));
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<span class={classes} {...restProps}>
|
|
72
|
+
{@render children()}
|
|
73
|
+
</span>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
declare const Badge: import("svelte").Component<{
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "success" | "warning" | "info" | undefined;
|
|
5
|
+
size?: "default" | "sm" | "dot" | undefined;
|
|
6
|
+
clickable?: boolean;
|
|
7
|
+
class?: string;
|
|
8
|
+
children: Snippet;
|
|
9
|
+
}, {}, "">;
|
|
10
|
+
type Badge = ReturnType<typeof Badge>;
|
|
11
|
+
export default Badge;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
5
|
+
|
|
6
|
+
const buttonVariants = tv({
|
|
7
|
+
base: 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: 'bg-primary text-primary-foreground hover:opacity-90',
|
|
11
|
+
secondary: 'bg-secondary text-secondary-foreground hover:opacity-90',
|
|
12
|
+
destructive:
|
|
13
|
+
'bg-destructive text-destructive-foreground hover:opacity-90 focus-visible:ring-destructive',
|
|
14
|
+
outline:
|
|
15
|
+
'border-2 border-primary text-primary bg-transparent hover:bg-primary hover:text-primary-foreground',
|
|
16
|
+
ghost: 'hover:bg-muted hover:text-foreground',
|
|
17
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
default: 'h-10 px-4 py-2',
|
|
21
|
+
sm: 'h-9 rounded-md px-3 text-sm',
|
|
22
|
+
lg: 'h-11 rounded-md px-8',
|
|
23
|
+
icon: 'h-10 w-10',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
variant: 'default',
|
|
28
|
+
size: 'default',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
type ButtonVariants = VariantProps<typeof buttonVariants>;
|
|
33
|
+
|
|
34
|
+
interface Props {
|
|
35
|
+
variant?: ButtonVariants['variant'];
|
|
36
|
+
size?: ButtonVariants['size'];
|
|
37
|
+
type?: 'button' | 'submit' | 'reset';
|
|
38
|
+
href?: string;
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
loading?: boolean;
|
|
41
|
+
/** Text to show when loading (replaces children) */
|
|
42
|
+
loadingText?: string;
|
|
43
|
+
class?: string;
|
|
44
|
+
onclick?: (e: MouseEvent) => void;
|
|
45
|
+
children: Snippet;
|
|
46
|
+
[key: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let {
|
|
50
|
+
variant = 'default',
|
|
51
|
+
size = 'default',
|
|
52
|
+
type = 'button',
|
|
53
|
+
href,
|
|
54
|
+
disabled = false,
|
|
55
|
+
loading = false,
|
|
56
|
+
loadingText,
|
|
57
|
+
class: className,
|
|
58
|
+
onclick,
|
|
59
|
+
children,
|
|
60
|
+
...restProps
|
|
61
|
+
}: Props = $props();
|
|
62
|
+
|
|
63
|
+
const classes = $derived(cn(buttonVariants({ variant, size }), className));
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
{#if href}
|
|
67
|
+
<a {href} class={classes} {...restProps}>
|
|
68
|
+
{#if loading}
|
|
69
|
+
<svg
|
|
70
|
+
class="h-4 w-4 animate-spin"
|
|
71
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
72
|
+
fill="none"
|
|
73
|
+
viewBox="0 0 24 24"
|
|
74
|
+
aria-hidden="true"
|
|
75
|
+
>
|
|
76
|
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"
|
|
77
|
+
></circle>
|
|
78
|
+
<path
|
|
79
|
+
class="opacity-75"
|
|
80
|
+
fill="currentColor"
|
|
81
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
82
|
+
></path>
|
|
83
|
+
</svg>
|
|
84
|
+
{#if loadingText}
|
|
85
|
+
<span>{loadingText}</span>
|
|
86
|
+
<span class="sr-only">Loading</span>
|
|
87
|
+
{:else}
|
|
88
|
+
{@render children()}
|
|
89
|
+
{/if}
|
|
90
|
+
{:else}
|
|
91
|
+
{@render children()}
|
|
92
|
+
{/if}
|
|
93
|
+
</a>
|
|
94
|
+
{:else}
|
|
95
|
+
<button
|
|
96
|
+
{type}
|
|
97
|
+
class={classes}
|
|
98
|
+
disabled={disabled || loading}
|
|
99
|
+
aria-disabled={disabled || loading || undefined}
|
|
100
|
+
aria-busy={loading || undefined}
|
|
101
|
+
{onclick}
|
|
102
|
+
{...restProps}
|
|
103
|
+
>
|
|
104
|
+
{#if loading}
|
|
105
|
+
<svg
|
|
106
|
+
class="h-4 w-4 animate-spin"
|
|
107
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
108
|
+
fill="none"
|
|
109
|
+
viewBox="0 0 24 24"
|
|
110
|
+
aria-hidden="true"
|
|
111
|
+
>
|
|
112
|
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"
|
|
113
|
+
></circle>
|
|
114
|
+
<path
|
|
115
|
+
class="opacity-75"
|
|
116
|
+
fill="currentColor"
|
|
117
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
118
|
+
></path>
|
|
119
|
+
</svg>
|
|
120
|
+
{#if loadingText}
|
|
121
|
+
<span>{loadingText}</span>
|
|
122
|
+
<span class="sr-only">Loading</span>
|
|
123
|
+
{:else}
|
|
124
|
+
{@render children()}
|
|
125
|
+
{/if}
|
|
126
|
+
{:else}
|
|
127
|
+
{@render children()}
|
|
128
|
+
{/if}
|
|
129
|
+
</button>
|
|
130
|
+
{/if}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
declare const Button: import("svelte").Component<{
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | undefined;
|
|
6
|
+
type?: "button" | "submit" | "reset";
|
|
7
|
+
href?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
/** Text to show when loading (replaces children) */
|
|
11
|
+
loadingText?: string;
|
|
12
|
+
class?: string;
|
|
13
|
+
onclick?: (e: MouseEvent) => void;
|
|
14
|
+
children: Snippet;
|
|
15
|
+
}, {}, "">;
|
|
16
|
+
type Button = ReturnType<typeof Button>;
|
|
17
|
+
export default Button;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Card - Content container component
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - Clean border styling with sharp look
|
|
7
|
+
* - Optional hover shadow effect for interactive cards
|
|
8
|
+
* - Featured variant with thicker border (border-2)
|
|
9
|
+
* - Consistent with brand guidelines
|
|
10
|
+
*/
|
|
11
|
+
import type { Snippet } from 'svelte';
|
|
12
|
+
import { cn } from '../utils.js';
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
/** Enable hover shadow effect for interactive cards */
|
|
16
|
+
interactive?: boolean;
|
|
17
|
+
/** Card variant - default has 1px border, featured has 2px border */
|
|
18
|
+
variant?: 'default' | 'featured';
|
|
19
|
+
/** Border color for featured variant */
|
|
20
|
+
borderColor?: 'default' | 'primary' | 'muted';
|
|
21
|
+
/** Additional classes */
|
|
22
|
+
class?: string;
|
|
23
|
+
/** Card content */
|
|
24
|
+
children: Snippet;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let {
|
|
29
|
+
interactive = false,
|
|
30
|
+
variant = 'default',
|
|
31
|
+
borderColor = 'default',
|
|
32
|
+
class: className,
|
|
33
|
+
children,
|
|
34
|
+
...restProps
|
|
35
|
+
}: Props = $props();
|
|
36
|
+
|
|
37
|
+
const borderColorClasses = {
|
|
38
|
+
default: 'border-border',
|
|
39
|
+
primary: 'border-primary',
|
|
40
|
+
muted: 'border-gray-200',
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<div
|
|
45
|
+
class={cn(
|
|
46
|
+
'rounded-md bg-card text-card-foreground',
|
|
47
|
+
// Border thickness based on variant
|
|
48
|
+
variant === 'featured' ? 'border-2' : 'border',
|
|
49
|
+
// Border color
|
|
50
|
+
borderColorClasses[borderColor],
|
|
51
|
+
// Interactive hover effect
|
|
52
|
+
interactive && 'hover:shadow-lg transition-shadow duration-200',
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
55
|
+
{...restProps}
|
|
56
|
+
>
|
|
57
|
+
{@render children()}
|
|
58
|
+
</div>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Card - Content container component
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - Clean border styling with sharp look
|
|
6
|
+
* - Optional hover shadow effect for interactive cards
|
|
7
|
+
* - Featured variant with thicker border (border-2)
|
|
8
|
+
* - Consistent with brand guidelines
|
|
9
|
+
*/
|
|
10
|
+
import type { Snippet } from 'svelte';
|
|
11
|
+
interface Props {
|
|
12
|
+
/** Enable hover shadow effect for interactive cards */
|
|
13
|
+
interactive?: boolean;
|
|
14
|
+
/** Card variant - default has 1px border, featured has 2px border */
|
|
15
|
+
variant?: 'default' | 'featured';
|
|
16
|
+
/** Border color for featured variant */
|
|
17
|
+
borderColor?: 'default' | 'primary' | 'muted';
|
|
18
|
+
/** Additional classes */
|
|
19
|
+
class?: string;
|
|
20
|
+
/** Card content */
|
|
21
|
+
children: Snippet;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}
|
|
24
|
+
declare const Card: import("svelte").Component<Props, {}, "">;
|
|
25
|
+
type Card = ReturnType<typeof Card>;
|
|
26
|
+
export default Card;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
class?: string;
|
|
7
|
+
children: Snippet;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { class: className, children, ...restProps }: Props = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div class={cn('p-6 pt-0', className)} {...restProps}>
|
|
15
|
+
{@render children()}
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
class?: string;
|
|
4
|
+
children: Snippet;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
declare const CardContent: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type CardContent = ReturnType<typeof CardContent>;
|
|
9
|
+
export default CardContent;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
class?: string;
|
|
7
|
+
children: Snippet;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { class: className, children, ...restProps }: Props = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<p class={cn('text-sm text-muted-foreground', className)} {...restProps}>
|
|
15
|
+
{@render children()}
|
|
16
|
+
</p>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
class?: string;
|
|
4
|
+
children: Snippet;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
declare const CardDescription: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type CardDescription = ReturnType<typeof CardDescription>;
|
|
9
|
+
export default CardDescription;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
class?: string;
|
|
7
|
+
children: Snippet;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { class: className, children, ...restProps }: Props = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div class={cn('flex items-center p-6 pt-0', className)} {...restProps}>
|
|
15
|
+
{@render children()}
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
class?: string;
|
|
4
|
+
children: Snippet;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
declare const CardFooter: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type CardFooter = ReturnType<typeof CardFooter>;
|
|
9
|
+
export default CardFooter;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
class?: string;
|
|
7
|
+
children: Snippet;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { class: className, children, ...restProps }: Props = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div class={cn('flex flex-col space-y-1.5 p-6', className)} {...restProps}>
|
|
15
|
+
{@render children()}
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
class?: string;
|
|
4
|
+
children: Snippet;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
declare const CardHeader: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type CardHeader = ReturnType<typeof CardHeader>;
|
|
9
|
+
export default CardHeader;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
class?: string;
|
|
7
|
+
children: Snippet;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { class: className, children, ...restProps }: Props = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<h3 class={cn('text-2xl font-semibold leading-none tracking-tight', className)} {...restProps}>
|
|
15
|
+
{@render children()}
|
|
16
|
+
</h3>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
class?: string;
|
|
4
|
+
children: Snippet;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
declare const CardTitle: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type CardTitle = ReturnType<typeof CardTitle>;
|
|
9
|
+
export default CardTitle;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Checkbox as CheckboxPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
name?: string;
|
|
10
|
+
value?: string;
|
|
11
|
+
id?: string;
|
|
12
|
+
class?: string;
|
|
13
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
checked = $bindable(false),
|
|
19
|
+
disabled = false,
|
|
20
|
+
required = false,
|
|
21
|
+
name,
|
|
22
|
+
value,
|
|
23
|
+
id,
|
|
24
|
+
class: className,
|
|
25
|
+
onCheckedChange,
|
|
26
|
+
...restProps
|
|
27
|
+
}: Props = $props();
|
|
28
|
+
|
|
29
|
+
function handleCheckedChange(newChecked: boolean | 'indeterminate') {
|
|
30
|
+
if (typeof newChecked === 'boolean') {
|
|
31
|
+
checked = newChecked;
|
|
32
|
+
onCheckedChange?.(newChecked);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<CheckboxPrimitive.Root
|
|
38
|
+
bind:checked
|
|
39
|
+
{disabled}
|
|
40
|
+
{required}
|
|
41
|
+
{name}
|
|
42
|
+
{value}
|
|
43
|
+
{id}
|
|
44
|
+
onCheckedChange={handleCheckedChange}
|
|
45
|
+
class={cn(
|
|
46
|
+
'peer relative h-5 w-5 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground flex items-center justify-center',
|
|
47
|
+
className
|
|
48
|
+
)}
|
|
49
|
+
{...restProps}
|
|
50
|
+
>
|
|
51
|
+
<!-- Touch target expansion (invisible, extends clickable area to 44x44px) -->
|
|
52
|
+
<span class="absolute inset-0 -m-3" aria-hidden="true"></span>
|
|
53
|
+
{#if checked}
|
|
54
|
+
<svg
|
|
55
|
+
class="h-5 w-5"
|
|
56
|
+
fill="none"
|
|
57
|
+
stroke="currentColor"
|
|
58
|
+
stroke-width="2"
|
|
59
|
+
viewBox="0 0 24 24"
|
|
60
|
+
aria-hidden="true"
|
|
61
|
+
>
|
|
62
|
+
<polyline points="20 6 9 17 4 12" />
|
|
63
|
+
</svg>
|
|
64
|
+
{/if}
|
|
65
|
+
</CheckboxPrimitive.Root>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
checked?: boolean;
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
name?: string;
|
|
6
|
+
value?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
declare const Checkbox: import("svelte").Component<Props, {}, "checked">;
|
|
13
|
+
type Checkbox = ReturnType<typeof Checkbox>;
|
|
14
|
+
export default Checkbox;
|