odj-svelte-ui 0.2.4 → 0.2.6
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 +4 -1
- package/dist/avatar/Avatar.svelte +2 -2
- 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 +9 -7
- package/dist/cards/type.d.ts +1 -0
- package/dist/tabs/theme.js +4 -4
- 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:
|
|
@@ -21,6 +22,7 @@ This is a fork from [Flowbite for Svelte 5 with Runes](https://svelte-5-ui-lib.c
|
|
|
21
22
|
- `Dropdown` is more modern;
|
|
22
23
|
- `Avatar` has better borders;
|
|
23
24
|
- `Sidebar` has better hover colors and some other design tweaks, like border radius;
|
|
25
|
+
- `Card` is now rounded-xl;
|
|
24
26
|
- `Tabs` styles are fixed and introduced underline animations and a complete modern redesign for "Full" style;
|
|
25
27
|
- The `Tooltip` component received a rework;
|
|
26
28
|
- `Modal` has <kbd>Esc</kbd> to close again;
|
|
@@ -31,7 +33,7 @@ This is a fork from [Flowbite for Svelte 5 with Runes](https://svelte-5-ui-lib.c
|
|
|
31
33
|
- `Avatar` supports a `fallback` snippet to show when the image is loading or can't be loaded;
|
|
32
34
|
- `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
35
|
- `SidebarButton` has been removed. Please use the `Drawer` component to maintain the old sidebar behaviour;
|
|
34
|
-
|
|
36
|
+
- `Card` can be a button now adding `clickable` prop;
|
|
35
37
|
|
|
36
38
|
## Installation
|
|
37
39
|
|
|
@@ -46,6 +48,7 @@ bun dev
|
|
|
46
48
|
```
|
|
47
49
|
|
|
48
50
|
Add the following to app.css:
|
|
51
|
+
|
|
49
52
|
> 💡 TIP: Get colors' codes [here](https://tailwindcss.com/docs/colors#default-color-palette-reference).
|
|
50
53
|
|
|
51
54
|
```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/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,8 +1,8 @@
|
|
|
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-
|
|
5
|
-
image: "rounded-t-
|
|
4
|
+
base: "w-full flex max-w-sm bg-white border border-light-surface-200 rounded-xl dark:bg-dark-surface-700 dark:border-light-surface-600",
|
|
5
|
+
image: "rounded-t-xl",
|
|
6
6
|
content: ""
|
|
7
7
|
},
|
|
8
8
|
variants: {
|
|
@@ -60,11 +60,13 @@ export const card = tv({
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
reverse: {
|
|
63
|
-
true: { base: "flex-col-reverse", image: "rounded-b-
|
|
64
|
-
false: { base: "flex-col", image: "rounded-t-
|
|
63
|
+
true: { base: "flex-col-reverse", image: "rounded-b-xl rounded-tl-none" },
|
|
64
|
+
false: { base: "flex-col", image: "rounded-t-xl" }
|
|
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: {
|
|
@@ -76,12 +78,12 @@ export const card = tv({
|
|
|
76
78
|
{
|
|
77
79
|
horizontal: true,
|
|
78
80
|
reverse: true,
|
|
79
|
-
class: { base: "md:flex-row-reverse", image: "md:rounded-e-
|
|
81
|
+
class: { base: "md:flex-row-reverse", image: "md:rounded-e-xl" }
|
|
80
82
|
},
|
|
81
83
|
{
|
|
82
84
|
horizontal: true,
|
|
83
85
|
reverse: false,
|
|
84
|
-
class: { base: "md:flex-row", image: "md:rounded-s-
|
|
86
|
+
class: { base: "md:flex-row", image: "md:rounded-s-xl" }
|
|
85
87
|
},
|
|
86
88
|
// gray, primary, secondary, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose
|
|
87
89
|
{
|
package/dist/cards/type.d.ts
CHANGED
package/dist/tabs/theme.js
CHANGED
|
@@ -4,8 +4,8 @@ export const tabs = tv({
|
|
|
4
4
|
base: "flex space-x-2 rtl:space-x-reverse",
|
|
5
5
|
content: "rounded-lg mt-2",
|
|
6
6
|
divider: "h-px bg-light-surface-200 dark:bg-dark-surface-700",
|
|
7
|
-
active: "p-4 text-primary-600 bg-light-surface-100
|
|
8
|
-
inactive: "p-4 text-light-surface-500
|
|
7
|
+
active: "p-4 text-primary-600 bg-light-surface-100",
|
|
8
|
+
inactive: "p-4 text-light-surface-500",
|
|
9
9
|
slider: ""
|
|
10
10
|
},
|
|
11
11
|
variants: {
|
|
@@ -27,8 +27,8 @@ export const tabs = tv({
|
|
|
27
27
|
slider: "absolute bottom-0 transition-all duration-200 border-b-2 border-primary-600 dark:border-primary-500 m-0! z-10"
|
|
28
28
|
},
|
|
29
29
|
none: {
|
|
30
|
-
active: "dark:bg-dark-surface-800 dark:text-primary-500",
|
|
31
|
-
inactive: "hover:text-light-surface-600 hover:bg-light-surface-50 dark:text-dark-surface-400 dark:hover:bg-dark-surface-800 dark:hover:text-dark-surface-300"
|
|
30
|
+
active: "dark:bg-dark-surface-800 dark:text-primary-500 rounded-t-lg",
|
|
31
|
+
inactive: "hover:text-light-surface-600 hover:bg-light-surface-50 dark:text-dark-surface-400 dark:hover:bg-dark-surface-800 dark:hover:text-dark-surface-300 rounded-t-lg"
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
hasDivider: {
|
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.6",
|
|
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",
|