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,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
label?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
hint?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
name?: string;
|
|
9
|
+
class?: string;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
}
|
|
12
|
+
declare const FormField: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type FormField = ReturnType<typeof FormField>;
|
|
14
|
+
export default FormField;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from '../../utils/cn';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
5
|
+
|
|
6
|
+
export const inputVariants = tv({
|
|
7
|
+
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',
|
|
8
|
+
variants: {
|
|
9
|
+
size: {
|
|
10
|
+
xs: 'text-xs py-1 px-2',
|
|
11
|
+
sm: 'text-sm py-1.5 px-3',
|
|
12
|
+
md: 'text-base py-2 px-3.5',
|
|
13
|
+
lg: 'text-base py-2.5 px-4',
|
|
14
|
+
xl: 'text-lg py-3 px-4.5'
|
|
15
|
+
},
|
|
16
|
+
status: {
|
|
17
|
+
default:
|
|
18
|
+
'border-neutral-300 dark:border-neutral-700 focus:border-primary-500 focus:ring-primary-500/20',
|
|
19
|
+
error:
|
|
20
|
+
'border-rose-500 text-rose-900 dark:text-rose-100 focus:border-rose-500 focus:ring-rose-500/20',
|
|
21
|
+
success: 'border-emerald-500 focus:border-emerald-500 focus:ring-emerald-500/20'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
size: 'md',
|
|
26
|
+
status: 'default'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export type InputProps = Omit<HTMLInputAttributes, 'size'> &
|
|
31
|
+
VariantProps<typeof inputVariants> & {
|
|
32
|
+
value?: string | number;
|
|
33
|
+
icon?: string;
|
|
34
|
+
trailingIcon?: string;
|
|
35
|
+
loading?: boolean;
|
|
36
|
+
clearable?: boolean;
|
|
37
|
+
prefix?: string;
|
|
38
|
+
suffix?: string;
|
|
39
|
+
class?: string;
|
|
40
|
+
leading?: Snippet;
|
|
41
|
+
trailing?: Snippet;
|
|
42
|
+
};
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<script lang="ts">
|
|
46
|
+
import Icon from '../elements/Icon.svelte';
|
|
47
|
+
import Spinner from '../elements/Spinner.svelte';
|
|
48
|
+
|
|
49
|
+
let {
|
|
50
|
+
value = $bindable(''),
|
|
51
|
+
type = 'text',
|
|
52
|
+
size = 'md',
|
|
53
|
+
status = 'default',
|
|
54
|
+
icon,
|
|
55
|
+
trailingIcon,
|
|
56
|
+
loading = false,
|
|
57
|
+
clearable = false,
|
|
58
|
+
prefix,
|
|
59
|
+
suffix,
|
|
60
|
+
disabled = false,
|
|
61
|
+
class: className = '',
|
|
62
|
+
leading,
|
|
63
|
+
trailing,
|
|
64
|
+
...restProps
|
|
65
|
+
}: InputProps = $props();
|
|
66
|
+
|
|
67
|
+
let paddingLeftClass = $derived.by(() => {
|
|
68
|
+
if (icon || leading) {
|
|
69
|
+
return size === 'xs' || size === 'sm' ? 'pl-8' : 'pl-10';
|
|
70
|
+
}
|
|
71
|
+
if (prefix) return 'pl-12';
|
|
72
|
+
return '';
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
let paddingRightClass = $derived.by(() => {
|
|
76
|
+
if (trailingIcon || trailing || loading || (clearable && value)) {
|
|
77
|
+
return size === 'xs' || size === 'sm' ? 'pr-8' : 'pr-10';
|
|
78
|
+
}
|
|
79
|
+
if (suffix) return 'pr-12';
|
|
80
|
+
return '';
|
|
81
|
+
});
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<div class="relative flex w-full items-center">
|
|
85
|
+
{#if leading}
|
|
86
|
+
<div class="pointer-events-none absolute left-3 flex items-center text-neutral-400">
|
|
87
|
+
{@render leading()}
|
|
88
|
+
</div>
|
|
89
|
+
{:else if icon}
|
|
90
|
+
<div class="pointer-events-none absolute left-3 flex items-center text-neutral-400">
|
|
91
|
+
<Icon name={icon} size={size === 'xs' ? 'xs' : 'sm'} />
|
|
92
|
+
</div>
|
|
93
|
+
{:else if prefix}
|
|
94
|
+
<span class="pointer-events-none absolute left-3 text-sm font-medium text-neutral-500">
|
|
95
|
+
{prefix}
|
|
96
|
+
</span>
|
|
97
|
+
{/if}
|
|
98
|
+
|
|
99
|
+
<input
|
|
100
|
+
{type}
|
|
101
|
+
bind:value
|
|
102
|
+
{disabled}
|
|
103
|
+
class="{inputVariants({
|
|
104
|
+
size,
|
|
105
|
+
status,
|
|
106
|
+
class: className
|
|
107
|
+
})} {paddingLeftClass} {paddingRightClass}"
|
|
108
|
+
{...restProps}
|
|
109
|
+
/>
|
|
110
|
+
|
|
111
|
+
{#if loading}
|
|
112
|
+
<div class="absolute right-3 flex items-center text-neutral-400">
|
|
113
|
+
<Spinner size={size === 'xs' || size === 'sm' ? 'xs' : 'sm'} />
|
|
114
|
+
</div>
|
|
115
|
+
{:else if clearable && value && !disabled}
|
|
116
|
+
<button
|
|
117
|
+
type="button"
|
|
118
|
+
onclick={() => (value = '')}
|
|
119
|
+
class="absolute right-3 flex items-center text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-200"
|
|
120
|
+
tabindex={-1}
|
|
121
|
+
aria-label="Clear input"
|
|
122
|
+
>
|
|
123
|
+
<Icon name="cross" size="xs" />
|
|
124
|
+
</button>
|
|
125
|
+
{:else if trailing}
|
|
126
|
+
<div class="pointer-events-none absolute right-3 flex items-center text-neutral-400">
|
|
127
|
+
{@render trailing()}
|
|
128
|
+
</div>
|
|
129
|
+
{:else if trailingIcon}
|
|
130
|
+
<div class="pointer-events-none absolute right-3 flex items-center text-neutral-400">
|
|
131
|
+
<Icon name={trailingIcon} size={size === 'xs' ? 'xs' : 'sm'} />
|
|
132
|
+
</div>
|
|
133
|
+
{:else if suffix}
|
|
134
|
+
<span class="pointer-events-none absolute right-3 text-sm font-medium text-neutral-500">
|
|
135
|
+
{suffix}
|
|
136
|
+
</span>
|
|
137
|
+
{/if}
|
|
138
|
+
</div>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type VariantProps } from '../../utils/cn';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
4
|
+
export declare const inputVariants: import("tailwind-variants").TVReturnType<{
|
|
5
|
+
size: {
|
|
6
|
+
xs: "text-xs py-1 px-2";
|
|
7
|
+
sm: "text-sm py-1.5 px-3";
|
|
8
|
+
md: "text-base py-2 px-3.5";
|
|
9
|
+
lg: "text-base py-2.5 px-4";
|
|
10
|
+
xl: "text-lg py-3 px-4.5";
|
|
11
|
+
};
|
|
12
|
+
status: {
|
|
13
|
+
default: "border-neutral-300 dark:border-neutral-700 focus:border-primary-500 focus:ring-primary-500/20";
|
|
14
|
+
error: "border-rose-500 text-rose-900 dark:text-rose-100 focus:border-rose-500 focus:ring-rose-500/20";
|
|
15
|
+
success: "border-emerald-500 focus:border-emerald-500 focus:ring-emerald-500/20";
|
|
16
|
+
};
|
|
17
|
+
}, undefined, "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", {
|
|
18
|
+
size: {
|
|
19
|
+
xs: "text-xs py-1 px-2";
|
|
20
|
+
sm: "text-sm py-1.5 px-3";
|
|
21
|
+
md: "text-base py-2 px-3.5";
|
|
22
|
+
lg: "text-base py-2.5 px-4";
|
|
23
|
+
xl: "text-lg py-3 px-4.5";
|
|
24
|
+
};
|
|
25
|
+
status: {
|
|
26
|
+
default: "border-neutral-300 dark:border-neutral-700 focus:border-primary-500 focus:ring-primary-500/20";
|
|
27
|
+
error: "border-rose-500 text-rose-900 dark:text-rose-100 focus:border-rose-500 focus:ring-rose-500/20";
|
|
28
|
+
success: "border-emerald-500 focus:border-emerald-500 focus:ring-emerald-500/20";
|
|
29
|
+
};
|
|
30
|
+
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
31
|
+
size: {
|
|
32
|
+
xs: "text-xs py-1 px-2";
|
|
33
|
+
sm: "text-sm py-1.5 px-3";
|
|
34
|
+
md: "text-base py-2 px-3.5";
|
|
35
|
+
lg: "text-base py-2.5 px-4";
|
|
36
|
+
xl: "text-lg py-3 px-4.5";
|
|
37
|
+
};
|
|
38
|
+
status: {
|
|
39
|
+
default: "border-neutral-300 dark:border-neutral-700 focus:border-primary-500 focus:ring-primary-500/20";
|
|
40
|
+
error: "border-rose-500 text-rose-900 dark:text-rose-100 focus:border-rose-500 focus:ring-rose-500/20";
|
|
41
|
+
success: "border-emerald-500 focus:border-emerald-500 focus:ring-emerald-500/20";
|
|
42
|
+
};
|
|
43
|
+
}, undefined>>;
|
|
44
|
+
export type InputProps = Omit<HTMLInputAttributes, 'size'> & VariantProps<typeof inputVariants> & {
|
|
45
|
+
value?: string | number;
|
|
46
|
+
icon?: string;
|
|
47
|
+
trailingIcon?: string;
|
|
48
|
+
loading?: boolean;
|
|
49
|
+
clearable?: boolean;
|
|
50
|
+
prefix?: string;
|
|
51
|
+
suffix?: string;
|
|
52
|
+
class?: string;
|
|
53
|
+
leading?: Snippet;
|
|
54
|
+
trailing?: Snippet;
|
|
55
|
+
};
|
|
56
|
+
declare const Input: import("svelte").Component<InputProps, {}, "value">;
|
|
57
|
+
type Input = ReturnType<typeof Input>;
|
|
58
|
+
export default Input;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export interface RadioOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
interface Props {
|
|
12
|
+
value?: string;
|
|
13
|
+
options?: RadioOption[];
|
|
14
|
+
name?: string;
|
|
15
|
+
orientation?: 'horizontal' | 'vertical';
|
|
16
|
+
card?: boolean;
|
|
17
|
+
class?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
value = $bindable(''),
|
|
22
|
+
options = [],
|
|
23
|
+
name = 'radio-group',
|
|
24
|
+
orientation = 'vertical',
|
|
25
|
+
card = false,
|
|
26
|
+
class: className = ''
|
|
27
|
+
}: Props = $props();
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<div
|
|
31
|
+
class="flex {orientation === 'horizontal' ? 'flex-row gap-4' : 'flex-col gap-2'} {className}"
|
|
32
|
+
role="radiogroup"
|
|
33
|
+
>
|
|
34
|
+
{#each options as opt}
|
|
35
|
+
{@const isSelected = value === opt.value}
|
|
36
|
+
<label
|
|
37
|
+
class="relative flex items-start gap-3 select-none {opt.disabled
|
|
38
|
+
? 'cursor-not-allowed opacity-50'
|
|
39
|
+
: 'cursor-pointer'} {card
|
|
40
|
+
? `rounded-xl border p-4 transition-all ${
|
|
41
|
+
isSelected
|
|
42
|
+
? 'border-primary-500 bg-primary-50/30 dark:border-primary-500 dark:bg-primary-950/20'
|
|
43
|
+
: 'border-neutral-200 bg-white hover:border-neutral-300 dark:border-neutral-800 dark:bg-neutral-900 dark:hover:border-neutral-700'
|
|
44
|
+
}`
|
|
45
|
+
: ''}"
|
|
46
|
+
>
|
|
47
|
+
<input
|
|
48
|
+
type="radio"
|
|
49
|
+
{name}
|
|
50
|
+
value={opt.value}
|
|
51
|
+
disabled={opt.disabled}
|
|
52
|
+
checked={isSelected}
|
|
53
|
+
onchange={() => (value = opt.value)}
|
|
54
|
+
class="sr-only"
|
|
55
|
+
/>
|
|
56
|
+
<div
|
|
57
|
+
class="mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-all {isSelected
|
|
58
|
+
? 'border-primary-600 bg-primary-600 text-white'
|
|
59
|
+
: 'border-neutral-300 bg-white dark:border-neutral-700 dark:bg-neutral-900'}"
|
|
60
|
+
>
|
|
61
|
+
{#if isSelected}
|
|
62
|
+
<div class="h-1.5 w-1.5 rounded-full bg-white"></div>
|
|
63
|
+
{/if}
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<div class="text-sm leading-5">
|
|
67
|
+
<span class="font-medium text-neutral-800 dark:text-neutral-200">{opt.label}</span>
|
|
68
|
+
{#if opt.description}
|
|
69
|
+
<p class="text-sm text-neutral-500 dark:text-neutral-400">{opt.description}</p>
|
|
70
|
+
{/if}
|
|
71
|
+
</div>
|
|
72
|
+
</label>
|
|
73
|
+
{/each}
|
|
74
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface RadioOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface Props {
|
|
8
|
+
value?: string;
|
|
9
|
+
options?: RadioOption[];
|
|
10
|
+
name?: string;
|
|
11
|
+
orientation?: 'horizontal' | 'vertical';
|
|
12
|
+
card?: boolean;
|
|
13
|
+
class?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const RadioGroup: import("svelte").Component<Props, {}, "value">;
|
|
16
|
+
type RadioGroup = ReturnType<typeof RadioGroup>;
|
|
17
|
+
export default RadioGroup;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from '../../utils/cn';
|
|
3
|
+
|
|
4
|
+
export interface SelectOption {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const selectVariants = tv({
|
|
12
|
+
base: 'w-full rounded-lg border bg-white dark:bg-neutral-900 text-neutral-900 dark:text-neutral-100 focus:outline-none focus:ring-2 transition-all duration-150 disabled:cursor-not-allowed disabled:opacity-50 appearance-none',
|
|
13
|
+
variants: {
|
|
14
|
+
size: {
|
|
15
|
+
sm: 'text-sm py-1.5 pl-3 pr-8',
|
|
16
|
+
md: 'text-base py-2 pl-3.5 pr-10',
|
|
17
|
+
lg: 'text-base py-2.5 pl-4 pr-10'
|
|
18
|
+
},
|
|
19
|
+
status: {
|
|
20
|
+
default:
|
|
21
|
+
'border-neutral-300 dark:border-neutral-700 focus:border-primary-500 focus:ring-primary-500/20',
|
|
22
|
+
error:
|
|
23
|
+
'border-rose-500 text-rose-900 dark:text-rose-100 focus:border-rose-500 focus:ring-rose-500/20'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
size: 'md',
|
|
28
|
+
status: 'default'
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export type SelectProps = VariantProps<typeof selectVariants> & {
|
|
33
|
+
value?: string;
|
|
34
|
+
options?: SelectOption[];
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
icon?: string;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
name?: string;
|
|
39
|
+
class?: string;
|
|
40
|
+
};
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<script lang="ts">
|
|
44
|
+
import Icon from '../elements/Icon.svelte';
|
|
45
|
+
|
|
46
|
+
let {
|
|
47
|
+
value = $bindable(''),
|
|
48
|
+
options = [],
|
|
49
|
+
placeholder = 'Select an option...',
|
|
50
|
+
icon,
|
|
51
|
+
disabled = false,
|
|
52
|
+
name,
|
|
53
|
+
size = 'md',
|
|
54
|
+
status = 'default',
|
|
55
|
+
class: className = ''
|
|
56
|
+
}: SelectProps = $props();
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<div class="relative w-full">
|
|
60
|
+
{#if icon}
|
|
61
|
+
<div class="pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-neutral-400">
|
|
62
|
+
<Icon name={icon} size={size === 'sm' ? 'xs' : 'sm'} />
|
|
63
|
+
</div>
|
|
64
|
+
{/if}
|
|
65
|
+
|
|
66
|
+
<select
|
|
67
|
+
bind:value
|
|
68
|
+
{disabled}
|
|
69
|
+
{name}
|
|
70
|
+
class="{selectVariants({ size, status, class: className })} {icon
|
|
71
|
+
? size === 'sm'
|
|
72
|
+
? 'pl-8'
|
|
73
|
+
: 'pl-10'
|
|
74
|
+
: ''}"
|
|
75
|
+
>
|
|
76
|
+
{#if placeholder}
|
|
77
|
+
<option value="" disabled selected={!value}>
|
|
78
|
+
{placeholder}
|
|
79
|
+
</option>
|
|
80
|
+
{/if}
|
|
81
|
+
{#each options as opt}
|
|
82
|
+
<option value={opt.value} disabled={opt.disabled}>
|
|
83
|
+
{opt.label}
|
|
84
|
+
</option>
|
|
85
|
+
{/each}
|
|
86
|
+
</select>
|
|
87
|
+
|
|
88
|
+
<div class="pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 text-neutral-400">
|
|
89
|
+
<Icon name="chevron-down" size="xs" />
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type VariantProps } from '../../utils/cn';
|
|
2
|
+
export interface SelectOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const selectVariants: import("tailwind-variants").TVReturnType<{
|
|
9
|
+
size: {
|
|
10
|
+
sm: "text-sm py-1.5 pl-3 pr-8";
|
|
11
|
+
md: "text-base py-2 pl-3.5 pr-10";
|
|
12
|
+
lg: "text-base py-2.5 pl-4 pr-10";
|
|
13
|
+
};
|
|
14
|
+
status: {
|
|
15
|
+
default: "border-neutral-300 dark:border-neutral-700 focus:border-primary-500 focus:ring-primary-500/20";
|
|
16
|
+
error: "border-rose-500 text-rose-900 dark:text-rose-100 focus:border-rose-500 focus:ring-rose-500/20";
|
|
17
|
+
};
|
|
18
|
+
}, undefined, "w-full rounded-lg border bg-white dark:bg-neutral-900 text-neutral-900 dark:text-neutral-100 focus:outline-none focus:ring-2 transition-all duration-150 disabled:cursor-not-allowed disabled:opacity-50 appearance-none", {
|
|
19
|
+
size: {
|
|
20
|
+
sm: "text-sm py-1.5 pl-3 pr-8";
|
|
21
|
+
md: "text-base py-2 pl-3.5 pr-10";
|
|
22
|
+
lg: "text-base py-2.5 pl-4 pr-10";
|
|
23
|
+
};
|
|
24
|
+
status: {
|
|
25
|
+
default: "border-neutral-300 dark:border-neutral-700 focus:border-primary-500 focus:ring-primary-500/20";
|
|
26
|
+
error: "border-rose-500 text-rose-900 dark:text-rose-100 focus:border-rose-500 focus:ring-rose-500/20";
|
|
27
|
+
};
|
|
28
|
+
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
29
|
+
size: {
|
|
30
|
+
sm: "text-sm py-1.5 pl-3 pr-8";
|
|
31
|
+
md: "text-base py-2 pl-3.5 pr-10";
|
|
32
|
+
lg: "text-base py-2.5 pl-4 pr-10";
|
|
33
|
+
};
|
|
34
|
+
status: {
|
|
35
|
+
default: "border-neutral-300 dark:border-neutral-700 focus:border-primary-500 focus:ring-primary-500/20";
|
|
36
|
+
error: "border-rose-500 text-rose-900 dark:text-rose-100 focus:border-rose-500 focus:ring-rose-500/20";
|
|
37
|
+
};
|
|
38
|
+
}, undefined>>;
|
|
39
|
+
export type SelectProps = VariantProps<typeof selectVariants> & {
|
|
40
|
+
value?: string;
|
|
41
|
+
options?: SelectOption[];
|
|
42
|
+
placeholder?: string;
|
|
43
|
+
icon?: string;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
name?: string;
|
|
46
|
+
class?: string;
|
|
47
|
+
};
|
|
48
|
+
declare const Select: import("svelte").Component<SelectProps, {}, "value">;
|
|
49
|
+
type Select = ReturnType<typeof Select>;
|
|
50
|
+
export default Select;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
value?: number;
|
|
4
|
+
min?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
step?: number;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
name?: string;
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
value = $bindable(50),
|
|
14
|
+
min = 0,
|
|
15
|
+
max = 100,
|
|
16
|
+
step = 1,
|
|
17
|
+
disabled = false,
|
|
18
|
+
name,
|
|
19
|
+
class: className = ''
|
|
20
|
+
}: Props = $props();
|
|
21
|
+
|
|
22
|
+
let percentage = $derived(((value - min) / (max - min)) * 100);
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div class="relative flex w-full touch-none items-center select-none {className}">
|
|
26
|
+
<input
|
|
27
|
+
type="range"
|
|
28
|
+
bind:value
|
|
29
|
+
{min}
|
|
30
|
+
{max}
|
|
31
|
+
{step}
|
|
32
|
+
{disabled}
|
|
33
|
+
{name}
|
|
34
|
+
class="h-2 w-full cursor-pointer appearance-none rounded-lg bg-neutral-200 accent-primary-600 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-neutral-800"
|
|
35
|
+
style="background: linear-gradient(to right, rgb(37 99 235) {percentage}%, rgb(228 228 231) {percentage}%);"
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
value?: number;
|
|
3
|
+
min?: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
step?: number;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
name?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Slider: import("svelte").Component<Props, {}, "value">;
|
|
11
|
+
type Slider = ReturnType<typeof Slider>;
|
|
12
|
+
export default Slider;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from '../../utils/cn';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
export const switchVariants = tv({
|
|
6
|
+
base: 'peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary-600 data-[state=unchecked]:bg-neutral-300 dark:data-[state=unchecked]:bg-neutral-700',
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
sm: 'h-5 w-9',
|
|
10
|
+
md: 'h-6 w-11',
|
|
11
|
+
lg: 'h-7 w-14'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
size: 'md'
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const thumbVariants = tv({
|
|
20
|
+
base: 'pointer-events-none block rounded-full bg-white shadow-lg ring-0 transition-transform duration-200 data-[state=unchecked]:translate-x-0',
|
|
21
|
+
variants: {
|
|
22
|
+
size: {
|
|
23
|
+
sm: 'h-4 w-4 data-[state=checked]:translate-x-4',
|
|
24
|
+
md: 'h-5 w-5 data-[state=checked]:translate-x-5',
|
|
25
|
+
lg: 'h-6 w-6 data-[state=checked]:translate-x-7'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
size: 'md'
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export type SwitchProps = VariantProps<typeof switchVariants> & {
|
|
34
|
+
checked?: boolean;
|
|
35
|
+
label?: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
name?: string;
|
|
39
|
+
class?: string;
|
|
40
|
+
children?: Snippet;
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<script lang="ts">
|
|
45
|
+
import { Switch } from 'bits-ui';
|
|
46
|
+
|
|
47
|
+
let {
|
|
48
|
+
checked = $bindable(false),
|
|
49
|
+
size = 'md',
|
|
50
|
+
label,
|
|
51
|
+
description,
|
|
52
|
+
disabled = false,
|
|
53
|
+
name,
|
|
54
|
+
class: className = '',
|
|
55
|
+
children
|
|
56
|
+
}: SwitchProps = $props();
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<label
|
|
60
|
+
class="inline-flex items-start gap-3 select-none {disabled
|
|
61
|
+
? 'cursor-not-allowed opacity-60'
|
|
62
|
+
: 'cursor-pointer'} {className}"
|
|
63
|
+
>
|
|
64
|
+
<Switch.Root bind:checked {disabled} {name} class={switchVariants({ size })}>
|
|
65
|
+
<Switch.Thumb class={thumbVariants({ size })} />
|
|
66
|
+
</Switch.Root>
|
|
67
|
+
|
|
68
|
+
{#if label || description || children}
|
|
69
|
+
<div class="text-sm leading-5">
|
|
70
|
+
{#if label}
|
|
71
|
+
<span class="font-medium text-neutral-800 dark:text-neutral-200">{label}</span>
|
|
72
|
+
{/if}
|
|
73
|
+
{#if children}
|
|
74
|
+
{@render children()}
|
|
75
|
+
{/if}
|
|
76
|
+
{#if description}
|
|
77
|
+
<p class="text-sm text-neutral-500 dark:text-neutral-400">{description}</p>
|
|
78
|
+
{/if}
|
|
79
|
+
</div>
|
|
80
|
+
{/if}
|
|
81
|
+
</label>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type VariantProps } from '../../utils/cn';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export declare const switchVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
size: {
|
|
5
|
+
sm: "h-5 w-9";
|
|
6
|
+
md: "h-6 w-11";
|
|
7
|
+
lg: "h-7 w-14";
|
|
8
|
+
};
|
|
9
|
+
}, undefined, "peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary-600 data-[state=unchecked]:bg-neutral-300 dark:data-[state=unchecked]:bg-neutral-700", {
|
|
10
|
+
size: {
|
|
11
|
+
sm: "h-5 w-9";
|
|
12
|
+
md: "h-6 w-11";
|
|
13
|
+
lg: "h-7 w-14";
|
|
14
|
+
};
|
|
15
|
+
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
16
|
+
size: {
|
|
17
|
+
sm: "h-5 w-9";
|
|
18
|
+
md: "h-6 w-11";
|
|
19
|
+
lg: "h-7 w-14";
|
|
20
|
+
};
|
|
21
|
+
}, undefined>>;
|
|
22
|
+
export declare const thumbVariants: import("tailwind-variants").TVReturnType<{
|
|
23
|
+
size: {
|
|
24
|
+
sm: "h-4 w-4 data-[state=checked]:translate-x-4";
|
|
25
|
+
md: "h-5 w-5 data-[state=checked]:translate-x-5";
|
|
26
|
+
lg: "h-6 w-6 data-[state=checked]:translate-x-7";
|
|
27
|
+
};
|
|
28
|
+
}, undefined, "pointer-events-none block rounded-full bg-white shadow-lg ring-0 transition-transform duration-200 data-[state=unchecked]:translate-x-0", {
|
|
29
|
+
size: {
|
|
30
|
+
sm: "h-4 w-4 data-[state=checked]:translate-x-4";
|
|
31
|
+
md: "h-5 w-5 data-[state=checked]:translate-x-5";
|
|
32
|
+
lg: "h-6 w-6 data-[state=checked]:translate-x-7";
|
|
33
|
+
};
|
|
34
|
+
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
35
|
+
size: {
|
|
36
|
+
sm: "h-4 w-4 data-[state=checked]:translate-x-4";
|
|
37
|
+
md: "h-5 w-5 data-[state=checked]:translate-x-5";
|
|
38
|
+
lg: "h-6 w-6 data-[state=checked]:translate-x-7";
|
|
39
|
+
};
|
|
40
|
+
}, undefined>>;
|
|
41
|
+
export type SwitchProps = VariantProps<typeof switchVariants> & {
|
|
42
|
+
checked?: boolean;
|
|
43
|
+
label?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
name?: string;
|
|
47
|
+
class?: string;
|
|
48
|
+
children?: Snippet;
|
|
49
|
+
};
|
|
50
|
+
import { Switch } from 'bits-ui';
|
|
51
|
+
declare const Switch: import("svelte").Component<SwitchProps, {}, "checked">;
|
|
52
|
+
type Switch = ReturnType<typeof Switch>;
|
|
53
|
+
export default Switch;
|