odj-svelte-ui 0.2.3 → 0.2.5
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 +3 -1
- package/dist/avatar/Avatar.svelte +2 -2
- package/dist/avatar/theme.js +10 -10
- package/dist/avatar/type.d.ts +1 -0
- package/dist/cards/Card.svelte +11 -3
- package/dist/cards/theme.d.ts +21 -7
- package/dist/cards/theme.js +4 -2
- package/dist/cards/type.d.ts +1 -0
- package/dist/forms/dropzone/Dropzone.svelte +3 -0
- package/dist/forms/dropzone/theme.d.ts +1 -1
- package/dist/forms/dropzone/theme.js +1 -1
- package/dist/forms/toggle/theme.d.ts +7 -0
- package/dist/forms/toggle/theme.js +6 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@ This is a fork from [Flowbite for Svelte 5 with Runes](https://svelte-5-ui-lib.c
|
|
|
5
5
|
- [Original Docs](https://svelte-5-ui-lib.codewithshin.com/)
|
|
6
6
|
|
|
7
7
|
## Differences to Flowbite
|
|
8
|
+
|
|
8
9
|
- Migration to Tailwind v4;
|
|
9
10
|
- You can choose the "background" color instead of using the hard-coded `gray` color. You have to choose your colors defining `light-surface` and `dark-surface` on `app.css`;
|
|
10
11
|
- Some components have the design slightly different:
|
|
@@ -31,7 +32,7 @@ This is a fork from [Flowbite for Svelte 5 with Runes](https://svelte-5-ui-lib.c
|
|
|
31
32
|
- `Avatar` supports a `fallback` snippet to show when the image is loading or can't be loaded;
|
|
32
33
|
- `Sidebar` can not be opened or closed anymore. If you want this behaviour, this component should be inside the `Drawer` component. On mobile, `Sidebar` will look like tabs;
|
|
33
34
|
- `SidebarButton` has been removed. Please use the `Drawer` component to maintain the old sidebar behaviour;
|
|
34
|
-
|
|
35
|
+
- `Card` can be a button now adding `clickable` prop;
|
|
35
36
|
|
|
36
37
|
## Installation
|
|
37
38
|
|
|
@@ -46,6 +47,7 @@ bun dev
|
|
|
46
47
|
```
|
|
47
48
|
|
|
48
49
|
Add the following to app.css:
|
|
50
|
+
|
|
49
51
|
> 💡 TIP: Get colors' codes [here](https://tailwindcss.com/docs/colors#default-color-palette-reference).
|
|
50
52
|
|
|
51
53
|
```js
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { onMount } from "svelte";
|
|
4
4
|
import { type AvatarProps as Props, avatar, fallback as fallbackTheme } from ".";
|
|
5
5
|
|
|
6
|
-
let { children, src, href, target, cornerStyle = "circular", border = false, stacked = false, dot, class: className, alt, size = "md", onclick, fallback, fallbackClass: fallbackClassName, ...restProps }: Props = $props();
|
|
6
|
+
let { children, src, href, target, cornerStyle = "circular", border = false, stacked = false, dot, class: className, alt, size = "md", onclick, fallback, fallbackClass: fallbackClassName, placeholderClass, ...restProps }: Props = $props();
|
|
7
7
|
|
|
8
8
|
dot = dot && { placement: "top-right", color: "red", size: "lg", ...dot };
|
|
9
9
|
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
{:else if children}
|
|
57
57
|
{@render children()}
|
|
58
58
|
{:else}
|
|
59
|
-
<svg class="h-full w-full {cornerStyle === 'circular' ? 'rounded-full' : 'rounded-sm'}" fill="currentColor" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
|
59
|
+
<svg class="h-full w-full {placeholderClass} {cornerStyle === 'circular' ? 'rounded-full' : 'rounded-sm'}" fill="currentColor" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
|
60
60
|
<path fill-rule="evenodd" d="M8 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd"></path>
|
|
61
61
|
</svg>
|
|
62
62
|
{/if}
|
package/dist/avatar/theme.js
CHANGED
|
@@ -15,11 +15,11 @@ const avatar = tv({
|
|
|
15
15
|
false: ""
|
|
16
16
|
},
|
|
17
17
|
size: {
|
|
18
|
-
xs: "
|
|
19
|
-
sm: "
|
|
20
|
-
md: "
|
|
21
|
-
lg: "
|
|
22
|
-
xl: "
|
|
18
|
+
xs: "size-6",
|
|
19
|
+
sm: "size-8",
|
|
20
|
+
md: "size-10",
|
|
21
|
+
lg: "size-20",
|
|
22
|
+
xl: "size-36"
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
defaultVariants: {
|
|
@@ -45,11 +45,11 @@ const fallback = tv({
|
|
|
45
45
|
false: ""
|
|
46
46
|
},
|
|
47
47
|
size: {
|
|
48
|
-
xs: "
|
|
49
|
-
sm: "
|
|
50
|
-
md: "
|
|
51
|
-
lg: "
|
|
52
|
-
xl: "
|
|
48
|
+
xs: "size-6",
|
|
49
|
+
sm: "size-8",
|
|
50
|
+
md: "size-10",
|
|
51
|
+
lg: "size-20",
|
|
52
|
+
xl: "size-36"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
defaultVariants: {
|
package/dist/avatar/type.d.ts
CHANGED
package/dist/cards/Card.svelte
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { card, type CardProps as Props } from ".";
|
|
3
|
-
import type { HTMLAttributes, HTMLAnchorAttributes } from "svelte/elements";
|
|
3
|
+
import type { HTMLAttributes, HTMLAnchorAttributes, HTMLButtonAttributes } from "svelte/elements";
|
|
4
4
|
|
|
5
|
-
let { children, href, color = "
|
|
5
|
+
let { children, href, color = "default", horizontal = false, shadow = "md", reverse = false, img, padding = "lg", size = "sm", clickable, class: className, imgClass, contentClass, ...restProps }: Props = $props();
|
|
6
6
|
|
|
7
7
|
const { base, image, content } = $derived(
|
|
8
8
|
card({
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
padding,
|
|
13
13
|
horizontal,
|
|
14
14
|
reverse,
|
|
15
|
-
href: !!href
|
|
15
|
+
href: !!href || !!clickable
|
|
16
16
|
})
|
|
17
17
|
);
|
|
18
18
|
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
href
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
+
const buttonProps: HTMLButtonAttributes = $derived({
|
|
31
|
+
...commonProps
|
|
32
|
+
});
|
|
33
|
+
|
|
30
34
|
const divProps: HTMLAttributes<HTMLDivElement> = $derived({
|
|
31
35
|
...commonProps
|
|
32
36
|
});
|
|
@@ -49,6 +53,10 @@
|
|
|
49
53
|
<a {...anchorProps}>
|
|
50
54
|
{@render childSlot()}
|
|
51
55
|
</a>
|
|
56
|
+
{:else if clickable}
|
|
57
|
+
<button {...buttonProps}>
|
|
58
|
+
{@render childSlot()}
|
|
59
|
+
</button>
|
|
52
60
|
{:else}
|
|
53
61
|
<div {...divProps}>
|
|
54
62
|
{@render childSlot()}
|
package/dist/cards/theme.d.ts
CHANGED
|
@@ -138,7 +138,9 @@ export declare const card: import("tailwind-variants").TVReturnType<{
|
|
|
138
138
|
};
|
|
139
139
|
};
|
|
140
140
|
href: {
|
|
141
|
-
true:
|
|
141
|
+
true: {
|
|
142
|
+
base: string;
|
|
143
|
+
};
|
|
142
144
|
false: string;
|
|
143
145
|
};
|
|
144
146
|
hasImage: {
|
|
@@ -289,7 +291,9 @@ export declare const card: import("tailwind-variants").TVReturnType<{
|
|
|
289
291
|
};
|
|
290
292
|
};
|
|
291
293
|
href: {
|
|
292
|
-
true:
|
|
294
|
+
true: {
|
|
295
|
+
base: string;
|
|
296
|
+
};
|
|
293
297
|
false: string;
|
|
294
298
|
};
|
|
295
299
|
hasImage: {
|
|
@@ -436,7 +440,9 @@ export declare const card: import("tailwind-variants").TVReturnType<{
|
|
|
436
440
|
};
|
|
437
441
|
};
|
|
438
442
|
href: {
|
|
439
|
-
true:
|
|
443
|
+
true: {
|
|
444
|
+
base: string;
|
|
445
|
+
};
|
|
440
446
|
false: string;
|
|
441
447
|
};
|
|
442
448
|
hasImage: {
|
|
@@ -583,7 +589,9 @@ export declare const card: import("tailwind-variants").TVReturnType<{
|
|
|
583
589
|
};
|
|
584
590
|
};
|
|
585
591
|
href: {
|
|
586
|
-
true:
|
|
592
|
+
true: {
|
|
593
|
+
base: string;
|
|
594
|
+
};
|
|
587
595
|
false: string;
|
|
588
596
|
};
|
|
589
597
|
hasImage: {
|
|
@@ -734,7 +742,9 @@ export declare const card: import("tailwind-variants").TVReturnType<{
|
|
|
734
742
|
};
|
|
735
743
|
};
|
|
736
744
|
href: {
|
|
737
|
-
true:
|
|
745
|
+
true: {
|
|
746
|
+
base: string;
|
|
747
|
+
};
|
|
738
748
|
false: string;
|
|
739
749
|
};
|
|
740
750
|
hasImage: {
|
|
@@ -885,7 +895,9 @@ export declare const card: import("tailwind-variants").TVReturnType<{
|
|
|
885
895
|
};
|
|
886
896
|
};
|
|
887
897
|
href: {
|
|
888
|
-
true:
|
|
898
|
+
true: {
|
|
899
|
+
base: string;
|
|
900
|
+
};
|
|
889
901
|
false: string;
|
|
890
902
|
};
|
|
891
903
|
hasImage: {
|
|
@@ -1032,7 +1044,9 @@ export declare const card: import("tailwind-variants").TVReturnType<{
|
|
|
1032
1044
|
};
|
|
1033
1045
|
};
|
|
1034
1046
|
href: {
|
|
1035
|
-
true:
|
|
1047
|
+
true: {
|
|
1048
|
+
base: string;
|
|
1049
|
+
};
|
|
1036
1050
|
false: string;
|
|
1037
1051
|
};
|
|
1038
1052
|
hasImage: {
|
package/dist/cards/theme.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tv } from "tailwind-variants";
|
|
2
2
|
export const card = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base: "w-full flex max-w-sm bg-white border border-
|
|
4
|
+
base: "w-full flex max-w-sm bg-white border border-light-surface-200 rounded-lg dark:bg-dark-surface-700 dark:border-light-surface-600",
|
|
5
5
|
image: "rounded-t-lg",
|
|
6
6
|
content: ""
|
|
7
7
|
},
|
|
@@ -64,7 +64,9 @@ export const card = tv({
|
|
|
64
64
|
false: { base: "flex-col", image: "rounded-t-lg" }
|
|
65
65
|
},
|
|
66
66
|
href: {
|
|
67
|
-
true:
|
|
67
|
+
true: {
|
|
68
|
+
base: "cursor-pointer focus-visible:outline-hidden focus-visible:ring-4 focus-visible:ring-primary-300 dark:focus-visible:ring-primary-800 hover:bg-dark-surface-100 dark:hover:bg-dark-surface-600 dark:hover:border-dark-surface-500"
|
|
69
|
+
},
|
|
68
70
|
false: ""
|
|
69
71
|
},
|
|
70
72
|
hasImage: {
|
package/dist/cards/type.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const dropzone: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "flex flex-col justify-center items-center w-full h-64 bg-
|
|
1
|
+
export declare const dropzone: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "flex flex-col justify-center items-center w-full h-64 bg-light-surface-50 rounded-lg border-2 border-light-surface-300 border-dashed cursor-pointer dark:hover:bg-dark-surface-800 dark:bg-dark-surface-700 hover:bg-light-surface-100 dark:border-dark-surface-600 dark:hover:border-dark-surface-500 dark:hover:bg-dark-surface-600 focus-visible:ring-4 focus-visible:outline-hidden focus-visible:ring-primary-300 dark:focus-visible:ring-primary-800", import("tailwind-variants/dist/config").TVConfig<unknown, {} | {}>, {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, "flex flex-col justify-center items-center w-full h-64 bg-light-surface-50 rounded-lg border-2 border-light-surface-300 border-dashed cursor-pointer dark:hover:bg-dark-surface-800 dark:bg-dark-surface-700 hover:bg-light-surface-100 dark:border-dark-surface-600 dark:hover:border-dark-surface-500 dark:hover:bg-dark-surface-600 focus-visible:ring-4 focus-visible:outline-hidden focus-visible:ring-primary-300 dark:focus-visible:ring-primary-800", import("tailwind-variants/dist/config").TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { tv } from "tailwind-variants";
|
|
2
2
|
export const dropzone = tv({
|
|
3
|
-
base: "flex flex-col justify-center items-center w-full h-64 bg-
|
|
3
|
+
base: "flex flex-col justify-center items-center w-full h-64 bg-light-surface-50 rounded-lg border-2 border-light-surface-300 border-dashed cursor-pointer dark:hover:bg-dark-surface-800 dark:bg-dark-surface-700 hover:bg-light-surface-100 dark:border-dark-surface-600 dark:hover:border-dark-surface-500 dark:hover:bg-dark-surface-600 focus-visible:ring-4 focus-visible:outline-hidden focus-visible:ring-primary-300 dark:focus-visible:ring-primary-800"
|
|
4
4
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const toggle: import("tailwind-variants").TVReturnType<{
|
|
2
2
|
disabled: {
|
|
3
3
|
true: {
|
|
4
|
+
span: string;
|
|
4
5
|
label: string;
|
|
5
6
|
};
|
|
6
7
|
};
|
|
@@ -88,6 +89,7 @@ export declare const toggle: import("tailwind-variants").TVReturnType<{
|
|
|
88
89
|
}, undefined, import("tailwind-variants/dist/config").TVConfig<{
|
|
89
90
|
disabled: {
|
|
90
91
|
true: {
|
|
92
|
+
span: string;
|
|
91
93
|
label: string;
|
|
92
94
|
};
|
|
93
95
|
};
|
|
@@ -171,6 +173,7 @@ export declare const toggle: import("tailwind-variants").TVReturnType<{
|
|
|
171
173
|
}, {
|
|
172
174
|
disabled: {
|
|
173
175
|
true: {
|
|
176
|
+
span: string;
|
|
174
177
|
label: string;
|
|
175
178
|
};
|
|
176
179
|
};
|
|
@@ -254,6 +257,7 @@ export declare const toggle: import("tailwind-variants").TVReturnType<{
|
|
|
254
257
|
}>, {
|
|
255
258
|
disabled: {
|
|
256
259
|
true: {
|
|
260
|
+
span: string;
|
|
257
261
|
label: string;
|
|
258
262
|
};
|
|
259
263
|
};
|
|
@@ -341,6 +345,7 @@ export declare const toggle: import("tailwind-variants").TVReturnType<{
|
|
|
341
345
|
}, import("tailwind-variants").TVReturnType<{
|
|
342
346
|
disabled: {
|
|
343
347
|
true: {
|
|
348
|
+
span: string;
|
|
344
349
|
label: string;
|
|
345
350
|
};
|
|
346
351
|
};
|
|
@@ -428,6 +433,7 @@ export declare const toggle: import("tailwind-variants").TVReturnType<{
|
|
|
428
433
|
}, undefined, import("tailwind-variants/dist/config").TVConfig<{
|
|
429
434
|
disabled: {
|
|
430
435
|
true: {
|
|
436
|
+
span: string;
|
|
431
437
|
label: string;
|
|
432
438
|
};
|
|
433
439
|
};
|
|
@@ -511,6 +517,7 @@ export declare const toggle: import("tailwind-variants").TVReturnType<{
|
|
|
511
517
|
}, {
|
|
512
518
|
disabled: {
|
|
513
519
|
true: {
|
|
520
|
+
span: string;
|
|
514
521
|
label: string;
|
|
515
522
|
};
|
|
516
523
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { tv } from "tailwind-variants";
|
|
2
2
|
export const toggle = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
span: "me-3 shrink-0 bg-
|
|
4
|
+
span: "me-3 shrink-0 bg-light-surface-200 rounded-full peer-focus-visible:ring-4 peer-checked:after:translate-x-full peer-checked:rtl:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:bg-white after:border-light-surface-300 after:border after:rounded-full after:transition-all dark:bg-dark-surface-600 dark:border-dark-surface-500 relative cursor-pointer",
|
|
5
5
|
label: "flex items-center",
|
|
6
|
-
input: "w-4 h-4 bg-
|
|
6
|
+
input: "w-4 h-4 bg-light-surface-100 border-light-surface-300 dark:ring-offset-dark-surface-800 focus:ring-2 rounded-sm dark:bg-dark-surface-700 dark:border-dark-surface-600 sr-only peer"
|
|
7
7
|
},
|
|
8
8
|
variants: {
|
|
9
9
|
disabled: {
|
|
10
|
-
true: {
|
|
10
|
+
true: {
|
|
11
|
+
span: "cursor-not-allowed",
|
|
12
|
+
label: "cursor-not-allowed opacity-50"
|
|
13
|
+
}
|
|
11
14
|
},
|
|
12
15
|
checked: {
|
|
13
16
|
true: "",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "odj-svelte-ui",
|
|
3
3
|
"author": "orbitadajogatina",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.5",
|
|
5
5
|
"description": "This is a fork from Flowbite Svelte 5 with Runes. I just made some changes that fits better my taste.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|