yaxa-svelte 1.0.0 → 1.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 +39 -8
- package/dist/components/elements/Badge.svelte +2 -1
- package/dist/components/elements/Badge.svelte.d.ts +2 -1
- package/dist/components/elements/Button.svelte +3 -2
- package/dist/components/elements/Button.svelte.d.ts +3 -2
- package/dist/components/elements/Icon.svelte +41 -7
- package/dist/components/elements/Icon.svelte.d.ts +11 -4
- package/dist/components/forms/Input.svelte +3 -2
- package/dist/components/forms/Input.svelte.d.ts +3 -2
- package/dist/components/forms/Select.svelte +3 -2
- package/dist/components/forms/Select.svelte.d.ts +3 -2
- package/dist/components/layout/Divider.svelte +9 -5
- package/dist/components/layout/Divider.svelte.d.ts +4 -3
- package/dist/components/navigation/Breadcrumb.svelte +4 -2
- package/dist/components/navigation/Breadcrumb.svelte.d.ts +3 -2
- package/dist/components/navigation/CommandPalette.svelte +3 -1
- package/dist/components/navigation/CommandPalette.svelte.d.ts +2 -1
- package/dist/components/navigation/DropdownMenu.svelte +3 -1
- package/dist/components/navigation/DropdownMenu.svelte.d.ts +2 -1
- package/dist/components/navigation/Pagination.svelte +15 -7
- package/dist/components/navigation/Pagination.svelte.d.ts +5 -2
- package/dist/components/navigation/Tabs.svelte +3 -1
- package/dist/components/navigation/Tabs.svelte.d.ts +2 -1
- package/dist/components/overlays/Accordion.svelte +10 -8
- package/dist/components/overlays/Accordion.svelte.d.ts +5 -4
- package/dist/components/overlays/Alert.svelte +2 -1
- package/dist/components/overlays/Alert.svelte.d.ts +2 -1
- package/dist/components/overlays/ContextMenu.svelte +2 -2
- package/dist/components/overlays/ContextMenu.svelte.d.ts +2 -1
- package/dist/index.d.ts +14 -0
- package/package.json +8 -1
package/README.md
CHANGED
|
@@ -31,17 +31,42 @@ _Nuxt UI v4 & Nuxt UI Pro Equivalent for SvelteKit 2.7+ & Svelte 5 with Built-in
|
|
|
31
31
|
|
|
32
32
|
---
|
|
33
33
|
|
|
34
|
-
## 📦 Quickstart
|
|
34
|
+
## 📦 Quickstart
|
|
35
35
|
|
|
36
|
-
### 1. Install
|
|
36
|
+
### 1. Install Dependencies
|
|
37
|
+
|
|
38
|
+
Install `yaxa-svelte` along with Tailwind CSS v4 and `@lucide/svelte`:
|
|
37
39
|
|
|
38
40
|
```bash
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
# Core package & icons
|
|
42
|
+
pnpm add yaxa-svelte @lucide/svelte
|
|
43
|
+
|
|
44
|
+
# Tailwind CSS v4 (Dev Dependencies)
|
|
45
|
+
pnpm add -D tailwindcss @tailwindcss/vite @tailwindcss/typography
|
|
42
46
|
```
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
_(Optional full-stack SaaS features: `pnpm add better-auth drizzle-orm @polar-sh/sdk resend`)_
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
### 2. Configure `vite.config.ts`
|
|
53
|
+
|
|
54
|
+
Add Tailwind CSS to your Vite plugins:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
// vite.config.ts
|
|
58
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
59
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
60
|
+
import { defineConfig } from 'vite';
|
|
61
|
+
|
|
62
|
+
export default defineConfig({
|
|
63
|
+
plugins: [tailwindcss(), sveltekit()]
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### 3. Define Your Site Configuration
|
|
45
70
|
|
|
46
71
|
Create `src/site.config.ts` — your single source of truth for branding, metadata, and SEO:
|
|
47
72
|
|
|
@@ -55,7 +80,8 @@ export const siteConfig = defineSiteConfig({
|
|
|
55
80
|
description: 'Fast, beautiful, accessible web applications.',
|
|
56
81
|
url: 'https://my-app.com',
|
|
57
82
|
theme: {
|
|
58
|
-
|
|
83
|
+
accent: 'svelte', // 'svelte' | 'emerald' | 'amber' | 'sky' | 'violet' | 'rose' | 'indigo'
|
|
84
|
+
neutral: 'zinc', // 'zinc' | 'slate' | 'stone' | 'neutral'
|
|
59
85
|
defaultMode: 'dark'
|
|
60
86
|
},
|
|
61
87
|
socials: {
|
|
@@ -65,11 +91,16 @@ export const siteConfig = defineSiteConfig({
|
|
|
65
91
|
});
|
|
66
92
|
```
|
|
67
93
|
|
|
68
|
-
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### 4. Import CSS & Wrap Root Layout
|
|
97
|
+
|
|
98
|
+
Import `yaxa-svelte/yaxa.css` and wrap your app in `<YaxaApp>`:
|
|
69
99
|
|
|
70
100
|
```svelte
|
|
71
101
|
<!-- src/routes/+layout.svelte -->
|
|
72
102
|
<script lang="ts">
|
|
103
|
+
import 'yaxa-svelte/yaxa.css';
|
|
73
104
|
import { YaxaApp } from 'yaxa-svelte';
|
|
74
105
|
import { siteConfig } from '../site.config';
|
|
75
106
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { tv, type VariantProps } from '../../utils/cn';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { IconSource } from './Icon.svelte';
|
|
4
5
|
|
|
5
6
|
export const badgeVariants = tv({
|
|
6
7
|
base: 'inline-flex items-center font-medium select-none transition-colors duration-150',
|
|
@@ -150,7 +151,7 @@
|
|
|
150
151
|
|
|
151
152
|
export type BadgeProps = VariantProps<typeof badgeVariants> & {
|
|
152
153
|
dot?: boolean;
|
|
153
|
-
icon?:
|
|
154
|
+
icon?: IconSource;
|
|
154
155
|
class?: string;
|
|
155
156
|
children?: Snippet;
|
|
156
157
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type VariantProps } from '../../utils/cn';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { IconSource } from './Icon.svelte';
|
|
3
4
|
export declare const badgeVariants: import("tailwind-variants").TVReturnType<{
|
|
4
5
|
variant: {
|
|
5
6
|
solid: "text-white";
|
|
@@ -66,7 +67,7 @@ export declare const badgeVariants: import("tailwind-variants").TVReturnType<{
|
|
|
66
67
|
}, undefined>>;
|
|
67
68
|
export type BadgeProps = VariantProps<typeof badgeVariants> & {
|
|
68
69
|
dot?: boolean;
|
|
69
|
-
icon?:
|
|
70
|
+
icon?: IconSource;
|
|
70
71
|
class?: string;
|
|
71
72
|
children?: Snippet;
|
|
72
73
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { tv, type VariantProps } from '../../utils/cn';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import type { HTMLButtonAttributes, HTMLAnchorAttributes } from 'svelte/elements';
|
|
5
|
+
import type { IconSource } from './Icon.svelte';
|
|
5
6
|
|
|
6
7
|
export const buttonVariants = tv({
|
|
7
8
|
base: 'inline-flex items-center justify-center font-medium transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 select-none active:scale-[0.98]',
|
|
@@ -195,8 +196,8 @@
|
|
|
195
196
|
href?: string;
|
|
196
197
|
loading?: boolean;
|
|
197
198
|
disabled?: boolean;
|
|
198
|
-
icon?:
|
|
199
|
-
trailingIcon?:
|
|
199
|
+
icon?: IconSource;
|
|
200
|
+
trailingIcon?: IconSource;
|
|
200
201
|
type?: 'button' | 'submit' | 'reset';
|
|
201
202
|
class?: string;
|
|
202
203
|
leading?: Snippet;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type VariantProps } from '../../utils/cn';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { IconSource } from './Icon.svelte';
|
|
3
4
|
export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
4
5
|
variant: {
|
|
5
6
|
solid: "shadow-xs text-white";
|
|
@@ -92,8 +93,8 @@ export type ButtonProps = VariantProps<typeof buttonVariants> & {
|
|
|
92
93
|
href?: string;
|
|
93
94
|
loading?: boolean;
|
|
94
95
|
disabled?: boolean;
|
|
95
|
-
icon?:
|
|
96
|
-
trailingIcon?:
|
|
96
|
+
icon?: IconSource;
|
|
97
|
+
trailingIcon?: IconSource;
|
|
97
98
|
type?: 'button' | 'submit' | 'reset';
|
|
98
99
|
class?: string;
|
|
99
100
|
leading?: Snippet;
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Component, Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
export type IconSource =
|
|
5
|
+
string | Component<{ class?: string; size?: string | number; [key: string]: any }>;
|
|
3
6
|
|
|
4
|
-
interface
|
|
5
|
-
name?:
|
|
7
|
+
export interface IconProps {
|
|
8
|
+
name?: IconSource;
|
|
9
|
+
icon?: IconSource;
|
|
6
10
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number;
|
|
7
11
|
class?: string;
|
|
8
12
|
children?: Snippet;
|
|
13
|
+
[key: string]: unknown;
|
|
9
14
|
}
|
|
15
|
+
</script>
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
let {
|
|
19
|
+
name,
|
|
20
|
+
icon,
|
|
21
|
+
size = 'md',
|
|
22
|
+
class: className = '',
|
|
23
|
+
children,
|
|
24
|
+
...restProps
|
|
25
|
+
}: IconProps = $props();
|
|
12
26
|
|
|
13
27
|
let sizeClass = $derived.by(() => {
|
|
14
28
|
if (typeof size === 'number') return `w-[${size}px] h-[${size}px]`;
|
|
@@ -27,6 +41,18 @@
|
|
|
27
41
|
}
|
|
28
42
|
});
|
|
29
43
|
|
|
44
|
+
let IconComponent = $derived.by(() => {
|
|
45
|
+
if (icon && typeof icon !== 'string') return icon;
|
|
46
|
+
if (name && typeof name !== 'string') return name;
|
|
47
|
+
return null;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
let stringIconName = $derived.by(() => {
|
|
51
|
+
if (typeof icon === 'string') return icon;
|
|
52
|
+
if (typeof name === 'string') return name;
|
|
53
|
+
return null;
|
|
54
|
+
});
|
|
55
|
+
|
|
30
56
|
// Common built-in SVGs for immediate zero-config use
|
|
31
57
|
const builtInIcons: Record<string, string> = {
|
|
32
58
|
check:
|
|
@@ -66,14 +92,21 @@
|
|
|
66
92
|
<span class="inline-flex shrink-0 items-center justify-center {sizeClass} {className}">
|
|
67
93
|
{@render children()}
|
|
68
94
|
</span>
|
|
69
|
-
{:else if
|
|
95
|
+
{:else if IconComponent}
|
|
96
|
+
{@const RenderIcon = IconComponent}
|
|
97
|
+
<RenderIcon
|
|
98
|
+
class="inline-flex shrink-0 items-center justify-center {sizeClass} {className}"
|
|
99
|
+
{...restProps}
|
|
100
|
+
/>
|
|
101
|
+
{:else if stringIconName && builtInIcons[stringIconName]}
|
|
70
102
|
<svg
|
|
71
103
|
class="inline-flex shrink-0 items-center justify-center {sizeClass} {className}"
|
|
72
104
|
viewBox="0 0 24 24"
|
|
73
105
|
fill="none"
|
|
74
106
|
aria-hidden="true"
|
|
107
|
+
{...restProps}
|
|
75
108
|
>
|
|
76
|
-
{@html builtInIcons[
|
|
109
|
+
{@html builtInIcons[stringIconName]}
|
|
77
110
|
</svg>
|
|
78
111
|
{:else}
|
|
79
112
|
<svg
|
|
@@ -81,6 +114,7 @@
|
|
|
81
114
|
viewBox="0 0 24 24"
|
|
82
115
|
fill="none"
|
|
83
116
|
aria-hidden="true"
|
|
117
|
+
{...restProps}
|
|
84
118
|
>
|
|
85
119
|
<circle cx="12" cy="12" r="9" stroke="currentColor" stroke-width="2" stroke-dasharray="4 4" />
|
|
86
120
|
</svg>
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { Component, Snippet } from 'svelte';
|
|
2
|
+
export type IconSource = string | Component<{
|
|
3
|
+
class?: string;
|
|
4
|
+
size?: string | number;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}>;
|
|
7
|
+
export interface IconProps {
|
|
8
|
+
name?: IconSource;
|
|
9
|
+
icon?: IconSource;
|
|
4
10
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number;
|
|
5
11
|
class?: string;
|
|
6
12
|
children?: Snippet;
|
|
13
|
+
[key: string]: unknown;
|
|
7
14
|
}
|
|
8
|
-
declare const Icon:
|
|
15
|
+
declare const Icon: Component<IconProps, {}, "">;
|
|
9
16
|
type Icon = ReturnType<typeof Icon>;
|
|
10
17
|
export default Icon;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { tv, type VariantProps } from '../../utils/cn';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
5
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
5
6
|
|
|
6
7
|
export const inputVariants = tv({
|
|
7
8
|
base: 'w-full rounded-lg border bg-white dark:bg-neutral-900 text-neutral-900 dark:text-neutral-100 placeholder:text-neutral-400 dark:placeholder:text-neutral-500 focus:outline-none focus:ring-2 transition-all duration-150 disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-neutral-50 dark:disabled:bg-neutral-950',
|
|
@@ -30,8 +31,8 @@
|
|
|
30
31
|
export type InputProps = Omit<HTMLInputAttributes, 'size'> &
|
|
31
32
|
VariantProps<typeof inputVariants> & {
|
|
32
33
|
value?: string | number;
|
|
33
|
-
icon?:
|
|
34
|
-
trailingIcon?:
|
|
34
|
+
icon?: IconSource;
|
|
35
|
+
trailingIcon?: IconSource;
|
|
35
36
|
loading?: boolean;
|
|
36
37
|
clearable?: boolean;
|
|
37
38
|
prefix?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from '../../utils/cn';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
4
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
4
5
|
export declare const inputVariants: import("tailwind-variants").TVReturnType<{
|
|
5
6
|
size: {
|
|
6
7
|
xs: "text-xs py-1 px-2";
|
|
@@ -43,8 +44,8 @@ export declare const inputVariants: import("tailwind-variants").TVReturnType<{
|
|
|
43
44
|
}, undefined>>;
|
|
44
45
|
export type InputProps = Omit<HTMLInputAttributes, 'size'> & VariantProps<typeof inputVariants> & {
|
|
45
46
|
value?: string | number;
|
|
46
|
-
icon?:
|
|
47
|
-
trailingIcon?:
|
|
47
|
+
icon?: IconSource;
|
|
48
|
+
trailingIcon?: IconSource;
|
|
48
49
|
loading?: boolean;
|
|
49
50
|
clearable?: boolean;
|
|
50
51
|
prefix?: string;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { tv, type VariantProps } from '../../utils/cn';
|
|
3
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
3
4
|
|
|
4
5
|
export interface SelectOption {
|
|
5
6
|
value: string;
|
|
6
7
|
label: string;
|
|
7
|
-
icon?:
|
|
8
|
+
icon?: IconSource;
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
}
|
|
10
11
|
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
value?: string;
|
|
34
35
|
options?: SelectOption[];
|
|
35
36
|
placeholder?: string;
|
|
36
|
-
icon?:
|
|
37
|
+
icon?: IconSource;
|
|
37
38
|
disabled?: boolean;
|
|
38
39
|
name?: string;
|
|
39
40
|
class?: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type VariantProps } from '../../utils/cn';
|
|
2
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
2
3
|
export interface SelectOption {
|
|
3
4
|
value: string;
|
|
4
5
|
label: string;
|
|
5
|
-
icon?:
|
|
6
|
+
icon?: IconSource;
|
|
6
7
|
disabled?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export declare const selectVariants: import("tailwind-variants").TVReturnType<{
|
|
@@ -40,7 +41,7 @@ export type SelectProps = VariantProps<typeof selectVariants> & {
|
|
|
40
41
|
value?: string;
|
|
41
42
|
options?: SelectOption[];
|
|
42
43
|
placeholder?: string;
|
|
43
|
-
icon?:
|
|
44
|
+
icon?: IconSource;
|
|
44
45
|
disabled?: boolean;
|
|
45
46
|
name?: string;
|
|
46
47
|
class?: string;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
<script lang="ts">
|
|
1
|
+
<script module lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import
|
|
3
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
4
4
|
|
|
5
|
-
interface
|
|
5
|
+
export interface DividerProps {
|
|
6
6
|
label?: string;
|
|
7
|
-
icon?:
|
|
7
|
+
icon?: IconSource;
|
|
8
8
|
orientation?: 'horizontal' | 'vertical';
|
|
9
9
|
class?: string;
|
|
10
10
|
children?: Snippet;
|
|
11
11
|
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import Icon from '../elements/Icon.svelte';
|
|
12
16
|
|
|
13
17
|
let {
|
|
14
18
|
label,
|
|
@@ -16,7 +20,7 @@
|
|
|
16
20
|
orientation = 'horizontal',
|
|
17
21
|
class: className = '',
|
|
18
22
|
children
|
|
19
|
-
}:
|
|
23
|
+
}: DividerProps = $props();
|
|
20
24
|
</script>
|
|
21
25
|
|
|
22
26
|
{#if orientation === 'vertical'}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
3
|
+
export interface DividerProps {
|
|
3
4
|
label?: string;
|
|
4
|
-
icon?:
|
|
5
|
+
icon?: IconSource;
|
|
5
6
|
orientation?: 'horizontal' | 'vertical';
|
|
6
7
|
class?: string;
|
|
7
8
|
children?: Snippet;
|
|
8
9
|
}
|
|
9
|
-
declare const Divider: import("svelte").Component<
|
|
10
|
+
declare const Divider: import("svelte").Component<DividerProps, {}, "">;
|
|
10
11
|
type Divider = ReturnType<typeof Divider>;
|
|
11
12
|
export default Divider;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
3
|
+
|
|
2
4
|
export interface BreadcrumbItem {
|
|
3
5
|
label: string;
|
|
4
6
|
href?: string;
|
|
5
|
-
icon?:
|
|
7
|
+
icon?: IconSource;
|
|
6
8
|
}
|
|
7
9
|
</script>
|
|
8
10
|
|
|
@@ -11,7 +13,7 @@
|
|
|
11
13
|
|
|
12
14
|
interface Props {
|
|
13
15
|
items: BreadcrumbItem[];
|
|
14
|
-
separator?:
|
|
16
|
+
separator?: IconSource;
|
|
15
17
|
class?: string;
|
|
16
18
|
}
|
|
17
19
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
1
2
|
export interface BreadcrumbItem {
|
|
2
3
|
label: string;
|
|
3
4
|
href?: string;
|
|
4
|
-
icon?:
|
|
5
|
+
icon?: IconSource;
|
|
5
6
|
}
|
|
6
7
|
interface Props {
|
|
7
8
|
items: BreadcrumbItem[];
|
|
8
|
-
separator?:
|
|
9
|
+
separator?: IconSource;
|
|
9
10
|
class?: string;
|
|
10
11
|
}
|
|
11
12
|
declare const Breadcrumb: import("svelte").Component<Props, {}, "">;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
3
|
+
|
|
2
4
|
export interface CommandItem {
|
|
3
5
|
id: string;
|
|
4
6
|
label: string;
|
|
5
7
|
description?: string;
|
|
6
|
-
icon?:
|
|
8
|
+
icon?: IconSource;
|
|
7
9
|
group?: string;
|
|
8
10
|
shortcut?: string;
|
|
9
11
|
onSelect?: () => void;
|
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import Icon from '../elements/Icon.svelte';
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
4
3
|
|
|
5
|
-
interface
|
|
4
|
+
export interface PaginationProps {
|
|
6
5
|
page?: number;
|
|
7
6
|
total: number;
|
|
8
7
|
pageSize?: number;
|
|
9
8
|
siblingCount?: number;
|
|
9
|
+
prevIcon?: IconSource;
|
|
10
|
+
nextIcon?: IconSource;
|
|
10
11
|
class?: string;
|
|
11
12
|
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import Button from '../elements/Button.svelte';
|
|
17
|
+
import Icon from '../elements/Icon.svelte';
|
|
12
18
|
|
|
13
19
|
let {
|
|
14
20
|
page = $bindable(1),
|
|
15
21
|
total,
|
|
16
22
|
pageSize = 10,
|
|
17
23
|
siblingCount = 1,
|
|
24
|
+
prevIcon = 'chevron-left',
|
|
25
|
+
nextIcon = 'chevron-right',
|
|
18
26
|
class: className = ''
|
|
19
|
-
}:
|
|
27
|
+
}: PaginationProps = $props();
|
|
20
28
|
|
|
21
29
|
let totalPages = $derived(Math.max(1, Math.ceil(total / pageSize)));
|
|
22
30
|
|
|
@@ -69,7 +77,7 @@
|
|
|
69
77
|
onclick={() => (page = Math.max(1, page - 1))}
|
|
70
78
|
aria-label="Previous page"
|
|
71
79
|
>
|
|
72
|
-
<Icon name=
|
|
80
|
+
<Icon name={prevIcon} size="xs" />
|
|
73
81
|
</Button>
|
|
74
82
|
|
|
75
83
|
<!-- Page Numbers -->
|
|
@@ -101,6 +109,6 @@
|
|
|
101
109
|
onclick={() => (page = Math.min(totalPages, page + 1))}
|
|
102
110
|
aria-label="Next page"
|
|
103
111
|
>
|
|
104
|
-
<Icon name=
|
|
112
|
+
<Icon name={nextIcon} size="xs" />
|
|
105
113
|
</Button>
|
|
106
114
|
</nav>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
2
|
+
export interface PaginationProps {
|
|
2
3
|
page?: number;
|
|
3
4
|
total: number;
|
|
4
5
|
pageSize?: number;
|
|
5
6
|
siblingCount?: number;
|
|
7
|
+
prevIcon?: IconSource;
|
|
8
|
+
nextIcon?: IconSource;
|
|
6
9
|
class?: string;
|
|
7
10
|
}
|
|
8
|
-
declare const Pagination: import("svelte").Component<
|
|
11
|
+
declare const Pagination: import("svelte").Component<PaginationProps, {}, "page">;
|
|
9
12
|
type Pagination = ReturnType<typeof Pagination>;
|
|
10
13
|
export default Pagination;
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
3
|
+
|
|
2
4
|
export interface AccordionItem {
|
|
3
5
|
value: string;
|
|
4
6
|
title: string;
|
|
5
7
|
content?: string;
|
|
6
|
-
icon?:
|
|
8
|
+
icon?: IconSource;
|
|
7
9
|
disabled?: boolean;
|
|
8
10
|
}
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<script lang="ts">
|
|
12
|
-
import { Accordion } from 'bits-ui';
|
|
13
|
-
import Icon from '../elements/Icon.svelte';
|
|
14
11
|
|
|
15
|
-
interface
|
|
12
|
+
export interface AccordionProps {
|
|
16
13
|
items: AccordionItem[];
|
|
17
14
|
type?: 'single' | 'multiple';
|
|
18
15
|
class?: string;
|
|
19
16
|
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
import { Accordion } from 'bits-ui';
|
|
21
|
+
import Icon from '../elements/Icon.svelte';
|
|
20
22
|
|
|
21
|
-
let { items, type = 'single', class: className = '' }:
|
|
23
|
+
let { items, type = 'single', class: className = '' }: AccordionProps = $props();
|
|
22
24
|
</script>
|
|
23
25
|
|
|
24
26
|
<Accordion.Root
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
1
2
|
export interface AccordionItem {
|
|
2
3
|
value: string;
|
|
3
4
|
title: string;
|
|
4
5
|
content?: string;
|
|
5
|
-
icon?:
|
|
6
|
+
icon?: IconSource;
|
|
6
7
|
disabled?: boolean;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
interface Props {
|
|
9
|
+
export interface AccordionProps {
|
|
10
10
|
items: AccordionItem[];
|
|
11
11
|
type?: 'single' | 'multiple';
|
|
12
12
|
class?: string;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
import { Accordion } from 'bits-ui';
|
|
15
|
+
declare const Accordion: import("svelte").Component<AccordionProps, {}, "">;
|
|
15
16
|
type Accordion = ReturnType<typeof Accordion>;
|
|
16
17
|
export default Accordion;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { tv, type VariantProps } from '../../utils/cn';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
4
5
|
|
|
5
6
|
export const alertVariants = tv({
|
|
6
7
|
base: 'relative w-full rounded-xl border p-4 transition-all duration-150',
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
export type AlertProps = VariantProps<typeof alertVariants> & {
|
|
24
25
|
title?: string;
|
|
25
26
|
description?: string;
|
|
26
|
-
icon?:
|
|
27
|
+
icon?: IconSource;
|
|
27
28
|
closable?: boolean;
|
|
28
29
|
onclose?: () => void;
|
|
29
30
|
actions?: Snippet;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type VariantProps } from '../../utils/cn';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { IconSource } from '../elements/Icon.svelte';
|
|
3
4
|
export declare const alertVariants: import("tailwind-variants").TVReturnType<{
|
|
4
5
|
color: {
|
|
5
6
|
info: "border-sky-200 bg-sky-50/70 text-sky-900 dark:border-sky-900/50 dark:bg-sky-950/30 dark:text-sky-200";
|
|
@@ -25,7 +26,7 @@ export declare const alertVariants: import("tailwind-variants").TVReturnType<{
|
|
|
25
26
|
export type AlertProps = VariantProps<typeof alertVariants> & {
|
|
26
27
|
title?: string;
|
|
27
28
|
description?: string;
|
|
28
|
-
icon?:
|
|
29
|
+
icon?: IconSource;
|
|
29
30
|
closable?: boolean;
|
|
30
31
|
onclose?: () => void;
|
|
31
32
|
actions?: Snippet;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import { ContextMenu } from 'bits-ui';
|
|
4
|
-
import Icon from '../elements/Icon.svelte';
|
|
4
|
+
import Icon, { type IconSource } from '../elements/Icon.svelte';
|
|
5
5
|
import Kbd from '../elements/Kbd.svelte';
|
|
6
6
|
|
|
7
7
|
export interface ContextMenuItem {
|
|
8
8
|
id: string;
|
|
9
9
|
label: string;
|
|
10
|
-
icon?:
|
|
10
|
+
icon?: IconSource;
|
|
11
11
|
shortcut?: string;
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
destructive?: boolean;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import { ContextMenu } from 'bits-ui';
|
|
3
|
+
import { type IconSource } from '../elements/Icon.svelte';
|
|
3
4
|
export interface ContextMenuItem {
|
|
4
5
|
id: string;
|
|
5
6
|
label: string;
|
|
6
|
-
icon?:
|
|
7
|
+
icon?: IconSource;
|
|
7
8
|
shortcut?: string;
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
destructive?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
export { default as Button } from './components/elements/Button.svelte';
|
|
2
|
+
export type { ButtonProps } from './components/elements/Button.svelte';
|
|
2
3
|
export { default as ButtonGroup } from './components/elements/ButtonGroup.svelte';
|
|
3
4
|
export { default as Badge } from './components/elements/Badge.svelte';
|
|
5
|
+
export type { BadgeProps } from './components/elements/Badge.svelte';
|
|
4
6
|
export { default as Avatar } from './components/elements/Avatar.svelte';
|
|
5
7
|
export { default as AvatarGroup } from './components/elements/AvatarGroup.svelte';
|
|
6
8
|
export { default as Kbd } from './components/elements/Kbd.svelte';
|
|
7
9
|
export { default as Icon } from './components/elements/Icon.svelte';
|
|
10
|
+
export type { IconProps, IconSource } from './components/elements/Icon.svelte';
|
|
8
11
|
export { default as Spinner } from './components/elements/Spinner.svelte';
|
|
9
12
|
export { default as Progress } from './components/elements/Progress.svelte';
|
|
10
13
|
export { default as Skeleton } from './components/elements/Skeleton.svelte';
|
|
@@ -17,10 +20,12 @@ export { default as Meter } from './components/elements/Meter.svelte';
|
|
|
17
20
|
export { default as Form } from './components/forms/Form.svelte';
|
|
18
21
|
export { default as FormField } from './components/forms/FormField.svelte';
|
|
19
22
|
export { default as Input } from './components/forms/Input.svelte';
|
|
23
|
+
export type { InputProps } from './components/forms/Input.svelte';
|
|
20
24
|
export { default as Textarea } from './components/forms/Textarea.svelte';
|
|
21
25
|
export { default as Checkbox } from './components/forms/Checkbox.svelte';
|
|
22
26
|
export { default as Switch } from './components/forms/Switch.svelte';
|
|
23
27
|
export { default as Select } from './components/forms/Select.svelte';
|
|
28
|
+
export type { SelectProps, SelectOption } from './components/forms/Select.svelte';
|
|
24
29
|
export { default as RadioGroup } from './components/forms/RadioGroup.svelte';
|
|
25
30
|
export { default as Slider } from './components/forms/Slider.svelte';
|
|
26
31
|
export { default as ColorPicker } from './components/forms/ColorPicker.svelte';
|
|
@@ -30,18 +35,27 @@ export { default as Footer } from './components/layout/Footer.svelte';
|
|
|
30
35
|
export { default as Section } from './components/layout/Section.svelte';
|
|
31
36
|
export { default as Card } from './components/layout/Card.svelte';
|
|
32
37
|
export { default as Divider } from './components/layout/Divider.svelte';
|
|
38
|
+
export type { DividerProps } from './components/layout/Divider.svelte';
|
|
33
39
|
export { default as YaxaApp } from './components/layout/YaxaApp.svelte';
|
|
34
40
|
export { default as Tabs } from './components/navigation/Tabs.svelte';
|
|
41
|
+
export type { TabItem } from './components/navigation/Tabs.svelte';
|
|
35
42
|
export { default as Breadcrumb } from './components/navigation/Breadcrumb.svelte';
|
|
43
|
+
export type { BreadcrumbItem as NavBreadcrumbItem } from './components/navigation/Breadcrumb.svelte';
|
|
36
44
|
export { default as Pagination } from './components/navigation/Pagination.svelte';
|
|
45
|
+
export type { PaginationProps } from './components/navigation/Pagination.svelte';
|
|
37
46
|
export { default as CommandPalette } from './components/navigation/CommandPalette.svelte';
|
|
47
|
+
export type { CommandItem } from './components/navigation/CommandPalette.svelte';
|
|
38
48
|
export { default as DropdownMenu } from './components/navigation/DropdownMenu.svelte';
|
|
49
|
+
export type { MenuItem } from './components/navigation/DropdownMenu.svelte';
|
|
39
50
|
export { default as Modal } from './components/overlays/Modal.svelte';
|
|
51
|
+
export type { ModalProps } from './components/overlays/Modal.svelte';
|
|
40
52
|
export { default as Slideover } from './components/overlays/Slideover.svelte';
|
|
41
53
|
export { default as Popover } from './components/overlays/Popover.svelte';
|
|
42
54
|
export { default as Tooltip } from './components/overlays/Tooltip.svelte';
|
|
43
55
|
export { default as Alert } from './components/overlays/Alert.svelte';
|
|
56
|
+
export type { AlertProps } from './components/overlays/Alert.svelte';
|
|
44
57
|
export { default as Accordion } from './components/overlays/Accordion.svelte';
|
|
58
|
+
export type { AccordionProps, AccordionItem } from './components/overlays/Accordion.svelte';
|
|
45
59
|
export { default as ContextMenu } from './components/overlays/ContextMenu.svelte';
|
|
46
60
|
export type { ContextMenuItem } from './components/overlays/ContextMenu.svelte';
|
|
47
61
|
export { useClipboard } from './composables/useClipboard.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yaxa-svelte",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "The Intuitive Svelte UI Library — Nuxt UI v4 equivalent for SvelteKit 2.7+ & Svelte 5 with automated SEO, dynamic OpenGraph cards, sitemaps, robots.txt, and Tailwind CSS v4.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://yaxa.vercel.app",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@eslint/js": "^10.0.1",
|
|
52
52
|
"@iconify/json": "^2.2.525",
|
|
53
|
+
"@lucide/svelte": "^1.45.0",
|
|
53
54
|
"@sveltejs/adapter-vercel": "^6.3.3",
|
|
54
55
|
"@sveltejs/kit": "^2.63.0",
|
|
55
56
|
"@sveltejs/package": "^2.5.8",
|
|
@@ -92,9 +93,15 @@
|
|
|
92
93
|
"zod": "^4.5.4"
|
|
93
94
|
},
|
|
94
95
|
"peerDependencies": {
|
|
96
|
+
"@lucide/svelte": "^1.0.0",
|
|
95
97
|
"@sveltejs/kit": "^2.0.0",
|
|
96
98
|
"svelte": "^5.0.0"
|
|
97
99
|
},
|
|
100
|
+
"peerDependenciesMeta": {
|
|
101
|
+
"@lucide/svelte": {
|
|
102
|
+
"optional": true
|
|
103
|
+
}
|
|
104
|
+
},
|
|
98
105
|
"scripts": {
|
|
99
106
|
"dev": "vite dev",
|
|
100
107
|
"build": "vite build",
|