yaxa-svelte 1.0.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/LICENSE +21 -0
- package/README.md +163 -0
- package/dist/assets/favicon.svg +15 -0
- package/dist/components/elements/Avatar.svelte +106 -0
- package/dist/components/elements/Avatar.svelte.d.ts +40 -0
- package/dist/components/elements/AvatarGroup.svelte +18 -0
- package/dist/components/elements/AvatarGroup.svelte.d.ts +8 -0
- package/dist/components/elements/Badge.svelte +202 -0
- package/dist/components/elements/Badge.svelte.d.ts +75 -0
- package/dist/components/elements/Button.svelte +300 -0
- package/dist/components/elements/Button.svelte.d.ts +109 -0
- package/dist/components/elements/ButtonGroup.svelte +22 -0
- package/dist/components/elements/ButtonGroup.svelte.d.ts +9 -0
- package/dist/components/elements/Chip.svelte +117 -0
- package/dist/components/elements/Chip.svelte.d.ts +15 -0
- package/dist/components/elements/DataTable.svelte +222 -0
- package/dist/components/elements/DataTable.svelte.d.ts +43 -0
- package/dist/components/elements/Icon.svelte +87 -0
- package/dist/components/elements/Icon.svelte.d.ts +10 -0
- package/dist/components/elements/Kbd.svelte +37 -0
- package/dist/components/elements/Kbd.svelte.d.ts +32 -0
- package/dist/components/elements/Link.svelte +63 -0
- package/dist/components/elements/Link.svelte.d.ts +15 -0
- package/dist/components/elements/Logo.svelte +77 -0
- package/dist/components/elements/Logo.svelte.d.ts +9 -0
- package/dist/components/elements/Meter.svelte +87 -0
- package/dist/components/elements/Meter.svelte.d.ts +14 -0
- package/dist/components/elements/Progress.svelte +63 -0
- package/dist/components/elements/Progress.svelte.d.ts +49 -0
- package/dist/components/elements/Skeleton.svelte +12 -0
- package/dist/components/elements/Skeleton.svelte.d.ts +6 -0
- package/dist/components/elements/Spinner.svelte +39 -0
- package/dist/components/elements/Spinner.svelte.d.ts +7 -0
- package/dist/components/forms/Checkbox.svelte +77 -0
- package/dist/components/forms/Checkbox.svelte.d.ts +17 -0
- package/dist/components/forms/ColorPicker.svelte +142 -0
- package/dist/components/forms/ColorPicker.svelte.d.ts +10 -0
- package/dist/components/forms/Form.svelte +84 -0
- package/dist/components/forms/Form.svelte.d.ts +14 -0
- package/dist/components/forms/FormField.svelte +56 -0
- package/dist/components/forms/FormField.svelte.d.ts +14 -0
- package/dist/components/forms/Input.svelte +138 -0
- package/dist/components/forms/Input.svelte.d.ts +58 -0
- package/dist/components/forms/RadioGroup.svelte +74 -0
- package/dist/components/forms/RadioGroup.svelte.d.ts +17 -0
- package/dist/components/forms/Select.svelte +91 -0
- package/dist/components/forms/Select.svelte.d.ts +50 -0
- package/dist/components/forms/Slider.svelte +37 -0
- package/dist/components/forms/Slider.svelte.d.ts +12 -0
- package/dist/components/forms/Switch.svelte +81 -0
- package/dist/components/forms/Switch.svelte.d.ts +53 -0
- package/dist/components/forms/Textarea.svelte +73 -0
- package/dist/components/forms/Textarea.svelte.d.ts +64 -0
- package/dist/components/layout/Card.svelte +89 -0
- package/dist/components/layout/Card.svelte.d.ts +64 -0
- package/dist/components/layout/Container.svelte +36 -0
- package/dist/components/layout/Container.svelte.d.ts +37 -0
- package/dist/components/layout/Divider.svelte +45 -0
- package/dist/components/layout/Divider.svelte.d.ts +11 -0
- package/dist/components/layout/Footer.svelte +96 -0
- package/dist/components/layout/Footer.svelte.d.ts +10 -0
- package/dist/components/layout/Header.svelte +175 -0
- package/dist/components/layout/Header.svelte.d.ts +12 -0
- package/dist/components/layout/Section.svelte +62 -0
- package/dist/components/layout/Section.svelte.d.ts +14 -0
- package/dist/components/layout/YaxaApp.svelte +48 -0
- package/dist/components/layout/YaxaApp.svelte.d.ts +12 -0
- package/dist/components/navigation/Breadcrumb.svelte +58 -0
- package/dist/components/navigation/Breadcrumb.svelte.d.ts +13 -0
- package/dist/components/navigation/CommandPalette.svelte +201 -0
- package/dist/components/navigation/CommandPalette.svelte.d.ts +19 -0
- package/dist/components/navigation/DropdownMenu.svelte +75 -0
- package/dist/components/navigation/DropdownMenu.svelte.d.ts +20 -0
- package/dist/components/navigation/Pagination.svelte +106 -0
- package/dist/components/navigation/Pagination.svelte.d.ts +10 -0
- package/dist/components/navigation/Tabs.svelte +91 -0
- package/dist/components/navigation/Tabs.svelte.d.ts +18 -0
- package/dist/components/overlays/Accordion.svelte +54 -0
- package/dist/components/overlays/Accordion.svelte.d.ts +16 -0
- package/dist/components/overlays/Alert.svelte +110 -0
- package/dist/components/overlays/Alert.svelte.d.ts +37 -0
- package/dist/components/overlays/ContextMenu.svelte +67 -0
- package/dist/components/overlays/ContextMenu.svelte.d.ts +21 -0
- package/dist/components/overlays/Modal.svelte +99 -0
- package/dist/components/overlays/Modal.svelte.d.ts +40 -0
- package/dist/components/overlays/Popover.svelte +33 -0
- package/dist/components/overlays/Popover.svelte.d.ts +11 -0
- package/dist/components/overlays/Slideover.svelte +102 -0
- package/dist/components/overlays/Slideover.svelte.d.ts +37 -0
- package/dist/components/overlays/Tooltip.svelte +39 -0
- package/dist/components/overlays/Tooltip.svelte.d.ts +12 -0
- package/dist/components/saas/AuthCard.svelte +273 -0
- package/dist/components/saas/AuthCard.svelte.d.ts +16 -0
- package/dist/components/saas/PricingCard.svelte +166 -0
- package/dist/components/saas/PricingCard.svelte.d.ts +19 -0
- package/dist/components/saas/PricingTable.svelte +139 -0
- package/dist/components/saas/PricingTable.svelte.d.ts +11 -0
- package/dist/components/saas/SubscriptionCard.svelte +162 -0
- package/dist/components/saas/SubscriptionCard.svelte.d.ts +16 -0
- package/dist/components/saas/UserMenu.svelte +137 -0
- package/dist/components/saas/UserMenu.svelte.d.ts +19 -0
- package/dist/components/seo/Favicons.svelte +22 -0
- package/dist/components/seo/Favicons.svelte.d.ts +8 -0
- package/dist/components/seo/OgImage.svelte +61 -0
- package/dist/components/seo/OgImage.svelte.d.ts +12 -0
- package/dist/components/seo/Seo.svelte +170 -0
- package/dist/components/seo/Seo.svelte.d.ts +21 -0
- package/dist/composables/useAuth.svelte.d.ts +23 -0
- package/dist/composables/useAuth.svelte.js +157 -0
- package/dist/composables/useClipboard.svelte.d.ts +9 -0
- package/dist/composables/useClipboard.svelte.js +36 -0
- package/dist/composables/useColorMode.svelte.d.ts +8 -0
- package/dist/composables/useColorMode.svelte.js +20 -0
- package/dist/composables/useDebounce.svelte.d.ts +3 -0
- package/dist/composables/useDebounce.svelte.js +17 -0
- package/dist/composables/useMediaQuery.svelte.d.ts +3 -0
- package/dist/composables/useMediaQuery.svelte.js +17 -0
- package/dist/composables/useShortcuts.svelte.d.ts +10 -0
- package/dist/composables/useShortcuts.svelte.js +50 -0
- package/dist/composables/useToast.d.ts +19 -0
- package/dist/composables/useToast.js +34 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.js +92 -0
- package/dist/server/auth/hook.d.ts +14 -0
- package/dist/server/auth/hook.js +36 -0
- package/dist/server/auth/index.d.ts +39 -0
- package/dist/server/auth/index.js +69 -0
- package/dist/server/db/index.d.ts +18 -0
- package/dist/server/db/index.js +43 -0
- package/dist/server/db/schema-pg.d.ts +977 -0
- package/dist/server/db/schema-pg.js +83 -0
- package/dist/server/db/schema-sqlite.d.ts +1045 -0
- package/dist/server/db/schema-sqlite.js +83 -0
- package/dist/server/db/types.d.ts +44 -0
- package/dist/server/db/types.js +1 -0
- package/dist/server/email/index.d.ts +27 -0
- package/dist/server/email/index.js +79 -0
- package/dist/server/polar/index.d.ts +29 -0
- package/dist/server/polar/index.js +49 -0
- package/dist/server/polar/webhook.d.ts +16 -0
- package/dist/server/polar/webhook.js +118 -0
- package/dist/site/config.d.ts +63 -0
- package/dist/site/config.js +48 -0
- package/dist/site/context.d.ts +11 -0
- package/dist/site/context.js +23 -0
- package/dist/site/hook.d.ts +15 -0
- package/dist/site/hook.js +38 -0
- package/dist/site/manifest.d.ts +6 -0
- package/dist/site/manifest.js +32 -0
- package/dist/site/og.d.ts +14 -0
- package/dist/site/og.js +116 -0
- package/dist/site/robots.d.ts +10 -0
- package/dist/site/robots.js +54 -0
- package/dist/site/schema.d.ts +67 -0
- package/dist/site/schema.js +67 -0
- package/dist/site/seo-helpers.d.ts +36 -0
- package/dist/site/seo-helpers.js +21 -0
- package/dist/site/sitemap-xsl.d.ts +6 -0
- package/dist/site/sitemap-xsl.js +164 -0
- package/dist/site/sitemap.d.ts +20 -0
- package/dist/site/sitemap.js +61 -0
- package/dist/styles/yaxa.css +84 -0
- package/dist/theme/theme.svelte.d.ts +74 -0
- package/dist/theme/theme.svelte.js +421 -0
- package/dist/utils/cn.d.ts +3 -0
- package/dist/utils/cn.js +3 -0
- package/dist/vite/index.d.ts +20 -0
- package/dist/vite/index.js +29 -0
- package/package.json +108 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from '../../utils/cn';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLButtonAttributes, HTMLAnchorAttributes } from 'svelte/elements';
|
|
5
|
+
|
|
6
|
+
export const buttonVariants = tv({
|
|
7
|
+
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]',
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
solid: 'shadow-xs text-white',
|
|
11
|
+
outline: 'border bg-transparent shadow-xs',
|
|
12
|
+
soft: '',
|
|
13
|
+
subtle: 'border',
|
|
14
|
+
ghost: 'bg-transparent',
|
|
15
|
+
link: 'p-0 underline-offset-4 hover:underline'
|
|
16
|
+
},
|
|
17
|
+
color: {
|
|
18
|
+
primary: '',
|
|
19
|
+
neutral: '',
|
|
20
|
+
success: '',
|
|
21
|
+
warning: '',
|
|
22
|
+
error: ''
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
xs: 'text-xs px-2 py-1 gap-1 rounded-md',
|
|
26
|
+
sm: 'text-sm px-2.5 py-1.5 gap-1.5 rounded-md',
|
|
27
|
+
md: 'text-sm px-3.5 py-2 gap-2 rounded-lg',
|
|
28
|
+
lg: 'text-base px-4 py-2.5 gap-2 rounded-lg',
|
|
29
|
+
xl: 'text-base px-5 py-3 gap-2.5 rounded-xl'
|
|
30
|
+
},
|
|
31
|
+
block: {
|
|
32
|
+
true: 'w-full'
|
|
33
|
+
},
|
|
34
|
+
square: {
|
|
35
|
+
true: 'aspect-square p-0'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
compoundVariants: [
|
|
39
|
+
// Solid
|
|
40
|
+
{
|
|
41
|
+
variant: 'solid',
|
|
42
|
+
color: 'primary',
|
|
43
|
+
class:
|
|
44
|
+
'bg-primary-600 hover:bg-primary-500 active:bg-primary-700 focus-visible:ring-primary-500'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
variant: 'solid',
|
|
48
|
+
color: 'neutral',
|
|
49
|
+
class:
|
|
50
|
+
'bg-neutral-900 text-neutral-50 hover:bg-neutral-800 dark:bg-neutral-100 dark:text-neutral-900 dark:hover:bg-neutral-200 focus-visible:ring-neutral-400'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
variant: 'solid',
|
|
54
|
+
color: 'success',
|
|
55
|
+
class: 'bg-emerald-600 hover:bg-emerald-500 focus-visible:ring-emerald-500'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
variant: 'solid',
|
|
59
|
+
color: 'warning',
|
|
60
|
+
class: 'bg-amber-600 hover:bg-amber-500 focus-visible:ring-amber-500'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
variant: 'solid',
|
|
64
|
+
color: 'error',
|
|
65
|
+
class: 'bg-rose-600 hover:bg-rose-500 focus-visible:ring-rose-500'
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
// Outline
|
|
69
|
+
{
|
|
70
|
+
variant: 'outline',
|
|
71
|
+
color: 'primary',
|
|
72
|
+
class:
|
|
73
|
+
'border-primary-500 text-primary-600 dark:text-primary-400 hover:bg-primary-50 dark:hover:bg-primary-950/40 focus-visible:ring-primary-500'
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
variant: 'outline',
|
|
77
|
+
color: 'neutral',
|
|
78
|
+
class:
|
|
79
|
+
'border-neutral-300 dark:border-neutral-700 text-neutral-900 dark:text-neutral-100 hover:bg-neutral-100 dark:hover:bg-neutral-800 focus-visible:ring-neutral-400'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
variant: 'outline',
|
|
83
|
+
color: 'success',
|
|
84
|
+
class:
|
|
85
|
+
'border-emerald-500 text-emerald-600 dark:text-emerald-400 hover:bg-emerald-50 dark:hover:bg-emerald-950/40 focus-visible:ring-emerald-500'
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
variant: 'outline',
|
|
89
|
+
color: 'warning',
|
|
90
|
+
class:
|
|
91
|
+
'border-amber-500 text-amber-600 dark:text-amber-400 hover:bg-amber-50 dark:hover:bg-amber-950/40 focus-visible:ring-amber-500'
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
variant: 'outline',
|
|
95
|
+
color: 'error',
|
|
96
|
+
class:
|
|
97
|
+
'border-rose-500 text-rose-600 dark:text-rose-400 hover:bg-rose-50 dark:hover:bg-rose-950/40 focus-visible:ring-rose-500'
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
// Soft
|
|
101
|
+
{
|
|
102
|
+
variant: 'soft',
|
|
103
|
+
color: 'primary',
|
|
104
|
+
class:
|
|
105
|
+
'bg-primary-50 text-primary-700 hover:bg-primary-100 dark:bg-primary-950/50 dark:text-primary-300 dark:hover:bg-primary-900/50 focus-visible:ring-primary-500'
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
variant: 'soft',
|
|
109
|
+
color: 'neutral',
|
|
110
|
+
class:
|
|
111
|
+
'bg-neutral-100 text-neutral-800 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-200 dark:hover:bg-neutral-700 focus-visible:ring-neutral-400'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
variant: 'soft',
|
|
115
|
+
color: 'success',
|
|
116
|
+
class:
|
|
117
|
+
'bg-emerald-50 text-emerald-700 hover:bg-emerald-100 dark:bg-emerald-950/50 dark:text-emerald-300 dark:hover:bg-emerald-900/50 focus-visible:ring-emerald-500'
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
variant: 'soft',
|
|
121
|
+
color: 'warning',
|
|
122
|
+
class:
|
|
123
|
+
'bg-amber-50 text-amber-700 hover:bg-amber-100 dark:bg-amber-950/50 dark:text-amber-300 dark:hover:bg-amber-900/50 focus-visible:ring-amber-500'
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
variant: 'soft',
|
|
127
|
+
color: 'error',
|
|
128
|
+
class:
|
|
129
|
+
'bg-rose-50 text-rose-700 hover:bg-rose-100 dark:bg-rose-950/50 dark:text-rose-300 dark:hover:bg-rose-900/50 focus-visible:ring-rose-500'
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
// Subtle
|
|
133
|
+
{
|
|
134
|
+
variant: 'subtle',
|
|
135
|
+
color: 'primary',
|
|
136
|
+
class:
|
|
137
|
+
'border-primary-200 bg-primary-50/50 text-primary-700 hover:bg-primary-100 dark:border-primary-800 dark:bg-primary-950/30 dark:text-primary-300 dark:hover:bg-primary-900/50'
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
variant: 'subtle',
|
|
141
|
+
color: 'neutral',
|
|
142
|
+
class:
|
|
143
|
+
'border-neutral-200 bg-neutral-50 text-neutral-800 hover:bg-neutral-100 dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-200 dark:hover:bg-neutral-800'
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
// Ghost
|
|
147
|
+
{
|
|
148
|
+
variant: 'ghost',
|
|
149
|
+
color: 'primary',
|
|
150
|
+
class:
|
|
151
|
+
'text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-950/50 focus-visible:ring-primary-500'
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
variant: 'ghost',
|
|
155
|
+
color: 'neutral',
|
|
156
|
+
class:
|
|
157
|
+
'text-neutral-600 hover:text-neutral-900 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-neutral-100 dark:hover:bg-neutral-800 focus-visible:ring-neutral-400'
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
variant: 'ghost',
|
|
161
|
+
color: 'error',
|
|
162
|
+
class:
|
|
163
|
+
'text-rose-600 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950/50 focus-visible:ring-rose-500'
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
// Link
|
|
167
|
+
{
|
|
168
|
+
variant: 'link',
|
|
169
|
+
color: 'primary',
|
|
170
|
+
class: 'text-primary-600 dark:text-primary-400'
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
variant: 'link',
|
|
174
|
+
color: 'neutral',
|
|
175
|
+
class: 'text-neutral-700 dark:text-neutral-300'
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
// Square sizes
|
|
179
|
+
{ square: true, size: 'xs', class: 'w-6 h-6' },
|
|
180
|
+
{ square: true, size: 'sm', class: 'w-8 h-8' },
|
|
181
|
+
{ square: true, size: 'md', class: 'w-9 h-9' },
|
|
182
|
+
{ square: true, size: 'lg', class: 'w-10 h-10' },
|
|
183
|
+
{ square: true, size: 'xl', class: 'w-12 h-12' }
|
|
184
|
+
],
|
|
185
|
+
defaultVariants: {
|
|
186
|
+
variant: 'solid',
|
|
187
|
+
color: 'primary',
|
|
188
|
+
size: 'md',
|
|
189
|
+
block: false,
|
|
190
|
+
square: false
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
export type ButtonProps = VariantProps<typeof buttonVariants> & {
|
|
195
|
+
href?: string;
|
|
196
|
+
loading?: boolean;
|
|
197
|
+
disabled?: boolean;
|
|
198
|
+
icon?: string;
|
|
199
|
+
trailingIcon?: string;
|
|
200
|
+
type?: 'button' | 'submit' | 'reset';
|
|
201
|
+
class?: string;
|
|
202
|
+
leading?: Snippet;
|
|
203
|
+
trailing?: Snippet;
|
|
204
|
+
children?: Snippet;
|
|
205
|
+
onclick?: (e: MouseEvent) => void;
|
|
206
|
+
'aria-label'?: string;
|
|
207
|
+
'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false' | boolean;
|
|
208
|
+
[key: string]: unknown;
|
|
209
|
+
};
|
|
210
|
+
</script>
|
|
211
|
+
|
|
212
|
+
<script lang="ts">
|
|
213
|
+
import Icon from './Icon.svelte';
|
|
214
|
+
import Spinner from './Spinner.svelte';
|
|
215
|
+
|
|
216
|
+
let {
|
|
217
|
+
href,
|
|
218
|
+
variant = 'solid',
|
|
219
|
+
color = 'primary',
|
|
220
|
+
size = 'md',
|
|
221
|
+
block = false,
|
|
222
|
+
square = false,
|
|
223
|
+
loading = false,
|
|
224
|
+
disabled = false,
|
|
225
|
+
icon,
|
|
226
|
+
trailingIcon,
|
|
227
|
+
type = 'button',
|
|
228
|
+
class: className = '',
|
|
229
|
+
leading,
|
|
230
|
+
trailing,
|
|
231
|
+
children,
|
|
232
|
+
onclick,
|
|
233
|
+
...restProps
|
|
234
|
+
}: ButtonProps = $props();
|
|
235
|
+
|
|
236
|
+
let classes = $derived(
|
|
237
|
+
buttonVariants({
|
|
238
|
+
variant,
|
|
239
|
+
color,
|
|
240
|
+
size,
|
|
241
|
+
block,
|
|
242
|
+
square,
|
|
243
|
+
class: className
|
|
244
|
+
})
|
|
245
|
+
);
|
|
246
|
+
</script>
|
|
247
|
+
|
|
248
|
+
{#if href}
|
|
249
|
+
<a
|
|
250
|
+
{href}
|
|
251
|
+
class={classes}
|
|
252
|
+
aria-disabled={disabled || loading}
|
|
253
|
+
{onclick}
|
|
254
|
+
{...restProps as HTMLAnchorAttributes}
|
|
255
|
+
>
|
|
256
|
+
{#if loading}
|
|
257
|
+
<Spinner size={size === 'xs' || size === 'sm' ? 'sm' : 'md'} />
|
|
258
|
+
{:else if leading}
|
|
259
|
+
{@render leading()}
|
|
260
|
+
{:else if icon}
|
|
261
|
+
<Icon name={icon} size={size === 'xs' ? 'xs' : size === 'sm' ? 'sm' : 'md'} />
|
|
262
|
+
{/if}
|
|
263
|
+
|
|
264
|
+
{#if children}
|
|
265
|
+
{@render children()}
|
|
266
|
+
{/if}
|
|
267
|
+
|
|
268
|
+
{#if trailing}
|
|
269
|
+
{@render trailing()}
|
|
270
|
+
{:else if trailingIcon}
|
|
271
|
+
<Icon name={trailingIcon} size={size === 'xs' ? 'xs' : size === 'sm' ? 'sm' : 'md'} />
|
|
272
|
+
{/if}
|
|
273
|
+
</a>
|
|
274
|
+
{:else}
|
|
275
|
+
<button
|
|
276
|
+
{type}
|
|
277
|
+
class={classes}
|
|
278
|
+
disabled={disabled || loading}
|
|
279
|
+
{onclick}
|
|
280
|
+
{...restProps as HTMLButtonAttributes}
|
|
281
|
+
>
|
|
282
|
+
{#if loading}
|
|
283
|
+
<Spinner size={size === 'xs' || size === 'sm' ? 'sm' : 'md'} />
|
|
284
|
+
{:else if leading}
|
|
285
|
+
{@render leading()}
|
|
286
|
+
{:else if icon}
|
|
287
|
+
<Icon name={icon} size={size === 'xs' ? 'xs' : size === 'sm' ? 'sm' : 'md'} />
|
|
288
|
+
{/if}
|
|
289
|
+
|
|
290
|
+
{#if children}
|
|
291
|
+
{@render children()}
|
|
292
|
+
{/if}
|
|
293
|
+
|
|
294
|
+
{#if trailing}
|
|
295
|
+
{@render trailing()}
|
|
296
|
+
{:else if trailingIcon}
|
|
297
|
+
<Icon name={trailingIcon} size={size === 'xs' ? 'xs' : size === 'sm' ? 'sm' : 'md'} />
|
|
298
|
+
{/if}
|
|
299
|
+
</button>
|
|
300
|
+
{/if}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { type VariantProps } from '../../utils/cn';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
variant: {
|
|
5
|
+
solid: "shadow-xs text-white";
|
|
6
|
+
outline: "border bg-transparent shadow-xs";
|
|
7
|
+
soft: "";
|
|
8
|
+
subtle: "border";
|
|
9
|
+
ghost: "bg-transparent";
|
|
10
|
+
link: "p-0 underline-offset-4 hover:underline";
|
|
11
|
+
};
|
|
12
|
+
color: {
|
|
13
|
+
primary: "";
|
|
14
|
+
neutral: "";
|
|
15
|
+
success: "";
|
|
16
|
+
warning: "";
|
|
17
|
+
error: "";
|
|
18
|
+
};
|
|
19
|
+
size: {
|
|
20
|
+
xs: "text-xs px-2 py-1 gap-1 rounded-md";
|
|
21
|
+
sm: "text-sm px-2.5 py-1.5 gap-1.5 rounded-md";
|
|
22
|
+
md: "text-sm px-3.5 py-2 gap-2 rounded-lg";
|
|
23
|
+
lg: "text-base px-4 py-2.5 gap-2 rounded-lg";
|
|
24
|
+
xl: "text-base px-5 py-3 gap-2.5 rounded-xl";
|
|
25
|
+
};
|
|
26
|
+
block: {
|
|
27
|
+
true: "w-full";
|
|
28
|
+
};
|
|
29
|
+
square: {
|
|
30
|
+
true: "aspect-square p-0";
|
|
31
|
+
};
|
|
32
|
+
}, undefined, "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]", {
|
|
33
|
+
variant: {
|
|
34
|
+
solid: "shadow-xs text-white";
|
|
35
|
+
outline: "border bg-transparent shadow-xs";
|
|
36
|
+
soft: "";
|
|
37
|
+
subtle: "border";
|
|
38
|
+
ghost: "bg-transparent";
|
|
39
|
+
link: "p-0 underline-offset-4 hover:underline";
|
|
40
|
+
};
|
|
41
|
+
color: {
|
|
42
|
+
primary: "";
|
|
43
|
+
neutral: "";
|
|
44
|
+
success: "";
|
|
45
|
+
warning: "";
|
|
46
|
+
error: "";
|
|
47
|
+
};
|
|
48
|
+
size: {
|
|
49
|
+
xs: "text-xs px-2 py-1 gap-1 rounded-md";
|
|
50
|
+
sm: "text-sm px-2.5 py-1.5 gap-1.5 rounded-md";
|
|
51
|
+
md: "text-sm px-3.5 py-2 gap-2 rounded-lg";
|
|
52
|
+
lg: "text-base px-4 py-2.5 gap-2 rounded-lg";
|
|
53
|
+
xl: "text-base px-5 py-3 gap-2.5 rounded-xl";
|
|
54
|
+
};
|
|
55
|
+
block: {
|
|
56
|
+
true: "w-full";
|
|
57
|
+
};
|
|
58
|
+
square: {
|
|
59
|
+
true: "aspect-square p-0";
|
|
60
|
+
};
|
|
61
|
+
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
62
|
+
variant: {
|
|
63
|
+
solid: "shadow-xs text-white";
|
|
64
|
+
outline: "border bg-transparent shadow-xs";
|
|
65
|
+
soft: "";
|
|
66
|
+
subtle: "border";
|
|
67
|
+
ghost: "bg-transparent";
|
|
68
|
+
link: "p-0 underline-offset-4 hover:underline";
|
|
69
|
+
};
|
|
70
|
+
color: {
|
|
71
|
+
primary: "";
|
|
72
|
+
neutral: "";
|
|
73
|
+
success: "";
|
|
74
|
+
warning: "";
|
|
75
|
+
error: "";
|
|
76
|
+
};
|
|
77
|
+
size: {
|
|
78
|
+
xs: "text-xs px-2 py-1 gap-1 rounded-md";
|
|
79
|
+
sm: "text-sm px-2.5 py-1.5 gap-1.5 rounded-md";
|
|
80
|
+
md: "text-sm px-3.5 py-2 gap-2 rounded-lg";
|
|
81
|
+
lg: "text-base px-4 py-2.5 gap-2 rounded-lg";
|
|
82
|
+
xl: "text-base px-5 py-3 gap-2.5 rounded-xl";
|
|
83
|
+
};
|
|
84
|
+
block: {
|
|
85
|
+
true: "w-full";
|
|
86
|
+
};
|
|
87
|
+
square: {
|
|
88
|
+
true: "aspect-square p-0";
|
|
89
|
+
};
|
|
90
|
+
}, undefined>>;
|
|
91
|
+
export type ButtonProps = VariantProps<typeof buttonVariants> & {
|
|
92
|
+
href?: string;
|
|
93
|
+
loading?: boolean;
|
|
94
|
+
disabled?: boolean;
|
|
95
|
+
icon?: string;
|
|
96
|
+
trailingIcon?: string;
|
|
97
|
+
type?: 'button' | 'submit' | 'reset';
|
|
98
|
+
class?: string;
|
|
99
|
+
leading?: Snippet;
|
|
100
|
+
trailing?: Snippet;
|
|
101
|
+
children?: Snippet;
|
|
102
|
+
onclick?: (e: MouseEvent) => void;
|
|
103
|
+
'aria-label'?: string;
|
|
104
|
+
'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false' | boolean;
|
|
105
|
+
[key: string]: unknown;
|
|
106
|
+
};
|
|
107
|
+
declare const Button: import("svelte").Component<ButtonProps, {}, "">;
|
|
108
|
+
type Button = ReturnType<typeof Button>;
|
|
109
|
+
export default Button;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
orientation?: 'horizontal' | 'vertical';
|
|
6
|
+
class?: string;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { orientation = 'horizontal', class: className = '', children }: Props = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
class="inline-flex {orientation === 'vertical'
|
|
15
|
+
? 'flex-col [&>*:not(:first-child)]:-mt-px [&>*:not(:first-child)]:rounded-t-none [&>*:not(:last-child)]:rounded-b-none'
|
|
16
|
+
: 'flex-row [&>*:not(:first-child)]:-ml-px [&>*:not(:first-child)]:rounded-l-none [&>*:not(:last-child)]:rounded-r-none'} {className}"
|
|
17
|
+
role="group"
|
|
18
|
+
>
|
|
19
|
+
{#if children}
|
|
20
|
+
{@render children()}
|
|
21
|
+
{/if}
|
|
22
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
orientation?: 'horizontal' | 'vertical';
|
|
4
|
+
class?: string;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
}
|
|
7
|
+
declare const ButtonGroup: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type ButtonGroup = ReturnType<typeof ButtonGroup>;
|
|
9
|
+
export default ButtonGroup;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
text?: string | number;
|
|
6
|
+
color?: 'primary' | 'success' | 'warning' | 'error' | 'neutral';
|
|
7
|
+
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
8
|
+
size?: '2xs' | 'xs' | 'sm' | 'md' | 'lg';
|
|
9
|
+
pulse?: boolean;
|
|
10
|
+
show?: boolean;
|
|
11
|
+
inset?: boolean;
|
|
12
|
+
class?: string;
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
text,
|
|
18
|
+
color = 'primary',
|
|
19
|
+
position = 'top-right',
|
|
20
|
+
size = 'sm',
|
|
21
|
+
pulse = false,
|
|
22
|
+
show = true,
|
|
23
|
+
inset = false,
|
|
24
|
+
class: className = '',
|
|
25
|
+
children
|
|
26
|
+
}: Props = $props();
|
|
27
|
+
|
|
28
|
+
let positionClasses = $derived.by(() => {
|
|
29
|
+
switch (position) {
|
|
30
|
+
case 'top-left':
|
|
31
|
+
return inset
|
|
32
|
+
? 'top-1 left-1 -translate-x-0 -translate-y-0'
|
|
33
|
+
: 'top-0 left-0 -translate-x-1/3 -translate-y-1/3';
|
|
34
|
+
case 'bottom-left':
|
|
35
|
+
return inset
|
|
36
|
+
? 'bottom-1 left-1 -translate-x-0 translate-y-0'
|
|
37
|
+
: 'bottom-0 left-0 -translate-x-1/3 translate-y-1/3';
|
|
38
|
+
case 'bottom-right':
|
|
39
|
+
return inset
|
|
40
|
+
? 'bottom-1 right-1 translate-x-0 translate-y-0'
|
|
41
|
+
: 'bottom-0 right-0 translate-x-1/3 translate-y-1/3';
|
|
42
|
+
case 'top-right':
|
|
43
|
+
default:
|
|
44
|
+
return inset
|
|
45
|
+
? 'top-1 right-1 translate-x-0 -translate-y-0'
|
|
46
|
+
: 'top-0 right-0 translate-x-1/3 -translate-y-1/3';
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
let colorClasses = $derived.by(() => {
|
|
51
|
+
switch (color) {
|
|
52
|
+
case 'success':
|
|
53
|
+
return 'bg-emerald-500 text-white ring-white dark:ring-neutral-950';
|
|
54
|
+
case 'warning':
|
|
55
|
+
return 'bg-amber-500 text-white ring-white dark:ring-neutral-950';
|
|
56
|
+
case 'error':
|
|
57
|
+
return 'bg-red-500 text-white ring-white dark:ring-neutral-950';
|
|
58
|
+
case 'neutral':
|
|
59
|
+
return 'bg-neutral-500 text-white ring-white dark:ring-neutral-950';
|
|
60
|
+
case 'primary':
|
|
61
|
+
default:
|
|
62
|
+
return 'bg-primary-600 text-white ring-white dark:ring-neutral-950';
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
let sizeClasses = $derived.by(() => {
|
|
67
|
+
if (text !== undefined && text !== '') {
|
|
68
|
+
switch (size) {
|
|
69
|
+
case '2xs':
|
|
70
|
+
return 'h-3.5 min-w-[14px] px-1 text-[9px] font-bold';
|
|
71
|
+
case 'xs':
|
|
72
|
+
return 'h-4 min-w-[16px] px-1 text-[10px] font-bold';
|
|
73
|
+
case 'lg':
|
|
74
|
+
return 'h-6 min-w-[24px] px-1.5 text-xs font-bold';
|
|
75
|
+
case 'md':
|
|
76
|
+
return 'h-5 min-w-[20px] px-1.5 text-[11px] font-bold';
|
|
77
|
+
case 'sm':
|
|
78
|
+
default:
|
|
79
|
+
return 'h-4.5 min-w-[18px] px-1 text-[10px] font-bold';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
switch (size) {
|
|
83
|
+
case '2xs':
|
|
84
|
+
return 'h-1.5 w-1.5';
|
|
85
|
+
case 'xs':
|
|
86
|
+
return 'h-2 w-2';
|
|
87
|
+
case 'md':
|
|
88
|
+
return 'h-3 w-3';
|
|
89
|
+
case 'lg':
|
|
90
|
+
return 'h-3.5 w-3.5';
|
|
91
|
+
case 'sm':
|
|
92
|
+
default:
|
|
93
|
+
return 'h-2.5 w-2.5';
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<div class="relative inline-flex shrink-0 {className}">
|
|
99
|
+
{#if children}
|
|
100
|
+
{@render children()}
|
|
101
|
+
{/if}
|
|
102
|
+
|
|
103
|
+
{#if show}
|
|
104
|
+
<span
|
|
105
|
+
class="absolute z-10 flex items-center justify-center rounded-full font-mono leading-none ring-2 {positionClasses} {colorClasses} {sizeClasses}"
|
|
106
|
+
>
|
|
107
|
+
{#if pulse}
|
|
108
|
+
<span
|
|
109
|
+
class="absolute inline-flex h-full w-full animate-ping rounded-full opacity-75 {colorClasses}"
|
|
110
|
+
></span>
|
|
111
|
+
{/if}
|
|
112
|
+
{#if text !== undefined}
|
|
113
|
+
<span>{text}</span>
|
|
114
|
+
{/if}
|
|
115
|
+
</span>
|
|
116
|
+
{/if}
|
|
117
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
text?: string | number;
|
|
4
|
+
color?: 'primary' | 'success' | 'warning' | 'error' | 'neutral';
|
|
5
|
+
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
6
|
+
size?: '2xs' | 'xs' | 'sm' | 'md' | 'lg';
|
|
7
|
+
pulse?: boolean;
|
|
8
|
+
show?: boolean;
|
|
9
|
+
inset?: boolean;
|
|
10
|
+
class?: string;
|
|
11
|
+
children?: Snippet;
|
|
12
|
+
}
|
|
13
|
+
declare const Chip: import("svelte").Component<Props, {}, "">;
|
|
14
|
+
type Chip = ReturnType<typeof Chip>;
|
|
15
|
+
export default Chip;
|