odj-svelte-ui 0.2.0 → 0.2.1
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 +9 -0
- package/dist/avatar/Avatar.svelte +43 -5
- package/dist/avatar/Avatar.svelte.d.ts +3 -1
- package/dist/avatar/index.d.ts +2 -2
- package/dist/avatar/index.js +2 -2
- package/dist/avatar/theme.d.ts +144 -3
- package/dist/avatar/theme.js +34 -4
- package/dist/avatar/type.d.ts +2 -0
- package/dist/dropdown/Dropdown.svelte +12 -1
- package/dist/dropdown/DropdownLi.svelte +9 -3
- package/dist/dropdown/DropdownLi.svelte.d.ts +1 -0
- package/dist/dropdown/theme.d.ts +4 -4
- package/dist/dropdown/theme.js +7 -7
- package/dist/dropdown/type.d.ts +2 -0
- package/dist/forms/checkbox/Checkbox.svelte +34 -5
- package/dist/forms/checkbox/theme.js +26 -24
- package/dist/forms/checkbox/type.d.ts +1 -0
- package/dist/forms/toggle/theme.js +22 -22
- package/dist/nav/Navbar.svelte +13 -11
- package/dist/nav/theme.d.ts +6 -6
- package/dist/nav/theme.js +20 -20
- package/dist/sidebar/Sidebar.svelte +9 -54
- package/dist/sidebar/Sidebar.svelte.d.ts +0 -7
- package/dist/sidebar/SidebarGroup.svelte +8 -5
- package/dist/sidebar/SidebarGroup.svelte.d.ts +1 -2
- package/dist/sidebar/SidebarItem.svelte +1 -1
- package/dist/sidebar/index.d.ts +3 -4
- package/dist/sidebar/index.js +2 -3
- package/dist/sidebar/theme.d.ts +223 -108
- package/dist/sidebar/theme.js +27 -28
- package/dist/sidebar/type.d.ts +4 -15
- package/dist/theme/Theme.svelte +0 -2
- package/package.json +1 -5
- package/dist/sidebar/SidebarButton.svelte +0 -21
- package/dist/sidebar/SidebarButton.svelte.d.ts +0 -10
|
@@ -1,76 +1,78 @@
|
|
|
1
1
|
import { tv } from "tailwind-variants";
|
|
2
|
+
// peer inline-flex size-[25px] items-center justify-center rounded-md border border-muted bg-foreground transition-all duration-150 ease-in-out active:scale-98 data-[state=unchecked]:border-border-input data-[state=unchecked]:bg-background data-[state=unchecked]:hover:border-dark-40
|
|
3
|
+
// w-4 h-4 bg-light-surface-100 border-light-surface-300 dark:ring-offset-dark-surface-800 focus-visible:ring-2 me-2 rounded-sm
|
|
2
4
|
export const checkbox = tv({
|
|
3
5
|
slots: {
|
|
4
|
-
base: "
|
|
5
|
-
label: ""
|
|
6
|
+
base: "mr-2 my-auto appearance-none size-4 shrink-0 cursor-default rounded-sm transition-colors duration-150 bg-light-surface-100 dark:bg-dark-surface-700 border border-light-surface-300 dark:border-dark-surface-600 hover:border-light-surface-400 focus-visible:ring-2 focus-visible:ring-white outline-hidden disabled:opacity-50",
|
|
7
|
+
label: "flex items-center disabled:opacity-50 transition-all duration-150"
|
|
6
8
|
},
|
|
7
9
|
variants: {
|
|
8
10
|
color: {
|
|
9
11
|
// primary, secondary, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose
|
|
10
12
|
primary: {
|
|
11
|
-
base: "text-primary-600
|
|
13
|
+
base: "text-primary-600"
|
|
12
14
|
},
|
|
13
15
|
secondary: {
|
|
14
|
-
base: "text-secondary-600
|
|
16
|
+
base: "text-secondary-600"
|
|
15
17
|
},
|
|
16
18
|
gray: {
|
|
17
|
-
base: "text-gray-600
|
|
19
|
+
base: "text-gray-600"
|
|
18
20
|
},
|
|
19
21
|
red: {
|
|
20
|
-
base: "text-red-600
|
|
22
|
+
base: "text-red-600"
|
|
21
23
|
},
|
|
22
24
|
orange: {
|
|
23
|
-
base: "text-orange-600
|
|
25
|
+
base: "text-orange-600"
|
|
24
26
|
},
|
|
25
27
|
amber: {
|
|
26
|
-
base: "text-amber-600
|
|
28
|
+
base: "text-amber-600"
|
|
27
29
|
},
|
|
28
30
|
yellow: {
|
|
29
|
-
base: "text-yellow-400
|
|
31
|
+
base: "text-yellow-400"
|
|
30
32
|
},
|
|
31
33
|
lime: {
|
|
32
|
-
base: "text-lime-700
|
|
34
|
+
base: "text-lime-700"
|
|
33
35
|
},
|
|
34
36
|
green: {
|
|
35
|
-
base: "text-green-600
|
|
37
|
+
base: "text-green-600"
|
|
36
38
|
},
|
|
37
39
|
emerald: {
|
|
38
|
-
base: "text-emerald-600
|
|
40
|
+
base: "text-emerald-600"
|
|
39
41
|
},
|
|
40
42
|
teal: {
|
|
41
|
-
base: "text-teal-600
|
|
43
|
+
base: "text-teal-600"
|
|
42
44
|
},
|
|
43
45
|
cyan: {
|
|
44
|
-
base: "text-cyan-600
|
|
46
|
+
base: "text-cyan-600"
|
|
45
47
|
},
|
|
46
48
|
sky: {
|
|
47
|
-
base: "text-sky-600
|
|
49
|
+
base: "text-sky-600"
|
|
48
50
|
},
|
|
49
51
|
blue: {
|
|
50
|
-
base: "text-blue-700
|
|
52
|
+
base: "text-blue-700"
|
|
51
53
|
},
|
|
52
54
|
indigo: {
|
|
53
|
-
base: "text-indigo-700
|
|
55
|
+
base: "text-indigo-700"
|
|
54
56
|
},
|
|
55
57
|
violet: {
|
|
56
|
-
base: "text-violet-600
|
|
58
|
+
base: "text-violet-600"
|
|
57
59
|
},
|
|
58
60
|
purple: {
|
|
59
|
-
base: "text-purple-600
|
|
61
|
+
base: "text-purple-600"
|
|
60
62
|
},
|
|
61
63
|
fuchsia: {
|
|
62
|
-
base: "text-fuchsia-600
|
|
64
|
+
base: "text-fuchsia-600"
|
|
63
65
|
},
|
|
64
66
|
pink: {
|
|
65
|
-
base: "text-pink-600
|
|
67
|
+
base: "text-pink-600"
|
|
66
68
|
},
|
|
67
69
|
rose: {
|
|
68
|
-
base: "text-rose-600
|
|
70
|
+
base: "text-rose-600"
|
|
69
71
|
}
|
|
70
72
|
},
|
|
71
73
|
tinted: {
|
|
72
|
-
true: { base: "dark:bg-
|
|
73
|
-
false: { base: "dark:bg-
|
|
74
|
+
true: { base: "dark:bg-light-surface-600 dark:border-dark-surface-500" },
|
|
75
|
+
false: { base: "dark:bg-light-surface-700 dark:border-dark-surface-600" }
|
|
74
76
|
},
|
|
75
77
|
custom: {
|
|
76
78
|
true: { base: "sr-only peer" }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tv } from "tailwind-variants";
|
|
2
2
|
export const toggle = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
span: "me-3 shrink-0 bg-gray-200 rounded-full peer-focus: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-gray-300 after:border after:rounded-full after:transition-all dark:bg-gray-600 dark:border-gray-500 relative ",
|
|
4
|
+
span: "me-3 shrink-0 bg-gray-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-gray-300 after:border after:rounded-full after:transition-all dark:bg-gray-600 dark:border-gray-500 relative cursor-pointer",
|
|
5
5
|
label: "flex items-center",
|
|
6
6
|
input: "w-4 h-4 bg-gray-100 border-gray-300 dark:ring-offset-gray-800 focus:ring-2 rounded-sm dark:bg-gray-700 dark:border-gray-600 sr-only peer"
|
|
7
7
|
},
|
|
@@ -16,64 +16,64 @@ export const toggle = tv({
|
|
|
16
16
|
color: {
|
|
17
17
|
// primary, secondary, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose
|
|
18
18
|
primary: {
|
|
19
|
-
span: "peer-focus:ring-primary-300 dark:peer-focus:ring-primary-800 peer-checked:bg-primary-600"
|
|
19
|
+
span: "peer-focus-visible:ring-primary-300 dark:peer-focus-visible:ring-primary-800 peer-checked:bg-primary-600"
|
|
20
20
|
},
|
|
21
21
|
secondary: {
|
|
22
|
-
span: "peer-focus:ring-secondary-300 dark:peer-focus:ring-secondary-800 peer-checked:bg-secondary-600"
|
|
22
|
+
span: "peer-focus-visible:ring-secondary-300 dark:peer-focus-visible:ring-secondary-800 peer-checked:bg-secondary-600"
|
|
23
23
|
},
|
|
24
24
|
gray: {
|
|
25
|
-
span: "peer-focus:ring-gray-300 dark:peer-focus:ring-gray-800 peer-checked:bg-gray-500"
|
|
25
|
+
span: "peer-focus-visible:ring-gray-300 dark:peer-focus-visible:ring-gray-800 peer-checked:bg-gray-500"
|
|
26
26
|
},
|
|
27
27
|
red: {
|
|
28
|
-
span: "peer-focus:ring-red-300 dark:peer-focus:ring-red-800 peer-checked:bg-red-600"
|
|
28
|
+
span: "peer-focus-visible:ring-red-300 dark:peer-focus-visible:ring-red-800 peer-checked:bg-red-600"
|
|
29
29
|
},
|
|
30
30
|
orange: {
|
|
31
|
-
span: "peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 peer-checked:bg-orange-500"
|
|
31
|
+
span: "peer-focus-visible:ring-orange-300 dark:peer-focus-visible:ring-orange-800 peer-checked:bg-orange-500"
|
|
32
32
|
},
|
|
33
33
|
amber: {
|
|
34
|
-
span: "peer-focus:ring-amber-300 dark:peer-focus:ring-amber-800 peer-checked:bg-amber-600"
|
|
34
|
+
span: "peer-focus-visible:ring-amber-300 dark:peer-focus-visible:ring-amber-800 peer-checked:bg-amber-600"
|
|
35
35
|
},
|
|
36
36
|
yellow: {
|
|
37
|
-
span: "peer-focus:ring-yellow-300 dark:peer-focus:ring-yellow-800 peer-checked:bg-yellow-400"
|
|
37
|
+
span: "peer-focus-visible:ring-yellow-300 dark:peer-focus-visible:ring-yellow-800 peer-checked:bg-yellow-400"
|
|
38
38
|
},
|
|
39
39
|
lime: {
|
|
40
|
-
span: "peer-focus:ring-lime-300 dark:peer-focus:ring-lime-800 peer-checked:bg-lime-500"
|
|
40
|
+
span: "peer-focus-visible:ring-lime-300 dark:peer-focus-visible:ring-lime-800 peer-checked:bg-lime-500"
|
|
41
41
|
},
|
|
42
42
|
green: {
|
|
43
|
-
span: "peer-focus:ring-green-300 dark:peer-focus:ring-green-800 peer-checked:bg-green-600"
|
|
43
|
+
span: "peer-focus-visible:ring-green-300 dark:peer-focus-visible:ring-green-800 peer-checked:bg-green-600"
|
|
44
44
|
},
|
|
45
45
|
emerald: {
|
|
46
|
-
span: "peer-focus:ring-emerald-300 dark:peer-focus:ring-emerald-800 peer-checked:bg-emerald-600"
|
|
46
|
+
span: "peer-focus-visible:ring-emerald-300 dark:peer-focus-visible:ring-emerald-800 peer-checked:bg-emerald-600"
|
|
47
47
|
},
|
|
48
48
|
teal: {
|
|
49
|
-
span: "peer-focus:ring-teal-300 dark:peer-focus:ring-teal-800 peer-checked:bg-teal-600"
|
|
49
|
+
span: "peer-focus-visible:ring-teal-300 dark:peer-focus-visible:ring-teal-800 peer-checked:bg-teal-600"
|
|
50
50
|
},
|
|
51
51
|
cyan: {
|
|
52
|
-
span: "peer-focus:ring-cyan-300 dark:peer-focus:ring-cyan-800 peer-checked:bg-cyan-600"
|
|
52
|
+
span: "peer-focus-visible:ring-cyan-300 dark:peer-focus-visible:ring-cyan-800 peer-checked:bg-cyan-600"
|
|
53
53
|
},
|
|
54
54
|
sky: {
|
|
55
|
-
span: "peer-focus:ring-sky-300 dark:peer-focus:ring-sky-800 peer-checked:bg-sky-600"
|
|
55
|
+
span: "peer-focus-visible:ring-sky-300 dark:peer-focus-visible:ring-sky-800 peer-checked:bg-sky-600"
|
|
56
56
|
},
|
|
57
57
|
blue: {
|
|
58
|
-
span: "peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 peer-checked:bg-blue-600"
|
|
58
|
+
span: "peer-focus-visible:ring-blue-300 dark:peer-focus-visible:ring-blue-800 peer-checked:bg-blue-600"
|
|
59
59
|
},
|
|
60
60
|
indigo: {
|
|
61
|
-
span: "peer-focus:ring-indigo-300 dark:peer-focus:ring-indigo-800 peer-checked:bg-indigo-600"
|
|
61
|
+
span: "peer-focus-visible:ring-indigo-300 dark:peer-focus-visible:ring-indigo-800 peer-checked:bg-indigo-600"
|
|
62
62
|
},
|
|
63
63
|
violet: {
|
|
64
|
-
span: "peer-focus:ring-violet-300 dark:peer-focus:ring-violet-800 peer-checked:bg-violet-600"
|
|
64
|
+
span: "peer-focus-visible:ring-violet-300 dark:peer-focus-visible:ring-violet-800 peer-checked:bg-violet-600"
|
|
65
65
|
},
|
|
66
66
|
purple: {
|
|
67
|
-
span: "peer-focus:ring-purple-300 dark:peer-focus:ring-purple-800 peer-checked:bg-purple-600"
|
|
67
|
+
span: "peer-focus-visible:ring-purple-300 dark:peer-focus-visible:ring-purple-800 peer-checked:bg-purple-600"
|
|
68
68
|
},
|
|
69
69
|
fuchsia: {
|
|
70
|
-
span: "peer-focus:ring-fuchsia-300 dark:peer-focus:ring-fuchsia-800 peer-checked:bg-fuchsia-600"
|
|
70
|
+
span: "peer-focus-visible:ring-fuchsia-300 dark:peer-focus-visible:ring-fuchsia-800 peer-checked:bg-fuchsia-600"
|
|
71
71
|
},
|
|
72
72
|
pink: {
|
|
73
|
-
span: "peer-focus:ring-pink-300 dark:peer-focus:ring-pink-800 peer-checked:bg-pink-600"
|
|
73
|
+
span: "peer-focus-visible:ring-pink-300 dark:peer-focus-visible:ring-pink-800 peer-checked:bg-pink-600"
|
|
74
74
|
},
|
|
75
75
|
rose: {
|
|
76
|
-
span: "peer-focus:ring-rose-300 dark:peer-focus:ring-rose-800 peer-checked:bg-rose-600"
|
|
76
|
+
span: "peer-focus-visible:ring-rose-300 dark:peer-focus-visible:ring-rose-800 peer-checked:bg-rose-600"
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
size: {
|
|
@@ -84,7 +84,7 @@ export const toggle = tv({
|
|
|
84
84
|
span: "w-11 h-6 after:top-0.5 after:start-[2px] after:h-5 after:w-5"
|
|
85
85
|
},
|
|
86
86
|
large: {
|
|
87
|
-
span: "w-
|
|
87
|
+
span: "w-13 h-7 after:top-0.5 after:start-[2px] after:h-6 after:w-6"
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
},
|
package/dist/nav/Navbar.svelte
CHANGED
|
@@ -35,17 +35,19 @@
|
|
|
35
35
|
|
|
36
36
|
<nav {...restProps} class={base({ class: navClass })} use:clickOutside={closeNav}>
|
|
37
37
|
<div class={container({ class: divClass })}>
|
|
38
|
-
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
<div class="flex flex-row items-center">
|
|
39
|
+
{#if hamburgerMenu}
|
|
40
|
+
<button onclick={toggleNav} type="button" class={toggleButton({ class: btnClass })}>
|
|
41
|
+
<span class="sr-only">Open main menu</span>
|
|
42
|
+
<svg class="h-5 w-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 14">
|
|
43
|
+
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 1h15M1 7h15M1 13h15" />
|
|
44
|
+
</svg>
|
|
45
|
+
</button>
|
|
46
|
+
{/if}
|
|
47
|
+
{#if brand}
|
|
48
|
+
{@render brand()}
|
|
49
|
+
{/if}
|
|
50
|
+
</div>
|
|
49
51
|
{#if navSlotBlock}
|
|
50
52
|
{@render navSlotBlock()}
|
|
51
53
|
{/if}
|
package/dist/nav/theme.d.ts
CHANGED
|
@@ -300,7 +300,7 @@ export declare const navUl: import("tailwind-variants").TVReturnType<{
|
|
|
300
300
|
xl: string;
|
|
301
301
|
xxl: string;
|
|
302
302
|
};
|
|
303
|
-
}, undefined, "
|
|
303
|
+
}, undefined, "bg-light-surface-200 dark:bg-dark-surface-800 text-light-surface-700 dark:text-dark-surface-400 rounded-xl border border-light-surface-300 dark:border-dark-surface-700 divide-light-surface-100 dark:divide-dark-surface-700 flex flex-col gap-2 p-2 mt-2 rtl:space-x-reverse", import("tailwind-variants/dist/config").TVConfig<{
|
|
304
304
|
breakPoint: {
|
|
305
305
|
md: string;
|
|
306
306
|
lg: string;
|
|
@@ -328,7 +328,7 @@ export declare const navUl: import("tailwind-variants").TVReturnType<{
|
|
|
328
328
|
xl: string;
|
|
329
329
|
xxl: string;
|
|
330
330
|
};
|
|
331
|
-
}, undefined, "
|
|
331
|
+
}, undefined, "bg-light-surface-200 dark:bg-dark-surface-800 text-light-surface-700 dark:text-dark-surface-400 rounded-xl border border-light-surface-300 dark:border-dark-surface-700 divide-light-surface-100 dark:divide-dark-surface-700 flex flex-col gap-2 p-2 mt-2 rtl:space-x-reverse", import("tailwind-variants/dist/config").TVConfig<{
|
|
332
332
|
breakPoint: {
|
|
333
333
|
md: string;
|
|
334
334
|
lg: string;
|
|
@@ -543,7 +543,7 @@ export declare const navcontainer: import("tailwind-variants").TVReturnType<{
|
|
|
543
543
|
true: string;
|
|
544
544
|
false: string;
|
|
545
545
|
};
|
|
546
|
-
}, undefined, "mx-
|
|
546
|
+
}, undefined, "mx-0 flex flex-wrap justify-between items-center max-w-none", import("tailwind-variants/dist/config").TVConfig<{
|
|
547
547
|
fluid: {
|
|
548
548
|
true: string;
|
|
549
549
|
false: string;
|
|
@@ -563,7 +563,7 @@ export declare const navcontainer: import("tailwind-variants").TVReturnType<{
|
|
|
563
563
|
true: string;
|
|
564
564
|
false: string;
|
|
565
565
|
};
|
|
566
|
-
}, undefined, "mx-
|
|
566
|
+
}, undefined, "mx-0 flex flex-wrap justify-between items-center max-w-none", import("tailwind-variants/dist/config").TVConfig<{
|
|
567
567
|
fluid: {
|
|
568
568
|
true: string;
|
|
569
569
|
false: string;
|
|
@@ -581,7 +581,7 @@ export declare const navhamburger: import("tailwind-variants").TVReturnType<{
|
|
|
581
581
|
xl: string;
|
|
582
582
|
xxl: string;
|
|
583
583
|
};
|
|
584
|
-
}, undefined, "inline-flex h-10 w-10 items-center justify-center rounded-lg p-2 text-sm text-
|
|
584
|
+
}, undefined, "inline-flex h-10 w-10 items-center justify-center rounded-lg p-2 text-sm text-light-surface-500 hover:bg-light-surface-100 focus:outline-hidden focus-visible:ring-2 focus-visible:ring-light-surface-200 dark:text-dark-surface-400 dark:hover:bg-dark-surface-700 dark:focus-visible:ring-dark-surface-600", import("tailwind-variants/dist/config").TVConfig<{
|
|
585
585
|
breakPoint: {
|
|
586
586
|
md: string;
|
|
587
587
|
lg: string;
|
|
@@ -609,7 +609,7 @@ export declare const navhamburger: import("tailwind-variants").TVReturnType<{
|
|
|
609
609
|
xl: string;
|
|
610
610
|
xxl: string;
|
|
611
611
|
};
|
|
612
|
-
}, undefined, "inline-flex h-10 w-10 items-center justify-center rounded-lg p-2 text-sm text-
|
|
612
|
+
}, undefined, "inline-flex h-10 w-10 items-center justify-center rounded-lg p-2 text-sm text-light-surface-500 hover:bg-light-surface-100 focus:outline-hidden focus-visible:ring-2 focus-visible:ring-light-surface-200 dark:text-dark-surface-400 dark:hover:bg-dark-surface-700 dark:focus-visible:ring-dark-surface-600", import("tailwind-variants/dist/config").TVConfig<{
|
|
613
613
|
breakPoint: {
|
|
614
614
|
md: string;
|
|
615
615
|
lg: string;
|
package/dist/nav/theme.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { tv } from "tailwind-variants";
|
|
2
2
|
export const navbar = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base: "bg-
|
|
4
|
+
base: "z-50 bg-light-surface-100/80 dark:bg-dark-surface-900/80 backdrop-blur-lg text-light-surface-700 dark:text-dark-surface-400 border-light-surface-300 dark:border-dark-surface-600 border-b px-2 sm:px-4 py-2.5 w-full",
|
|
5
5
|
container: "mx-auto flex flex-wrap items-center justify-between",
|
|
6
|
-
toggleButton: "inline-flex h-10 w-10 items-center justify-center rounded-lg p-2 text-sm text-
|
|
6
|
+
toggleButton: "inline-flex h-10 w-10 items-center justify-center rounded-lg p-2 mr-2 text-sm focus:outline-hidden text-light-surface-500 focus-visible:ring-light-surface-400 dark:focus-visible:ring-dark-surface-400 active:bg-light-surface-300 dark:active:bg-dark-surface-700/30 hover:bg-light-surface-200 dark:hover:bg-dark-surface-700/40 dark:hover:text-dark-surface-400",
|
|
7
7
|
menuContainer: "w-full",
|
|
8
8
|
activeLink: "block py-2 px-3 text-white bg-primary-700 rounded-sm dark:text-white",
|
|
9
|
-
inactiveLink: "block py-2 px-3 text-
|
|
9
|
+
inactiveLink: "block py-2 px-3 text-light-surface-900 rounded-sm hover:bg-light-surface-100 dark:text-white dark:hover:bg-dark-surface-700 dark:hover:text-white"
|
|
10
10
|
},
|
|
11
11
|
variants: {
|
|
12
12
|
fluid: {
|
|
@@ -55,13 +55,13 @@ export const navbar = tv({
|
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
export const navUl = tv({
|
|
58
|
-
base: "
|
|
58
|
+
base: "bg-light-surface-200 dark:bg-dark-surface-800 text-light-surface-700 dark:text-dark-surface-400 rounded-xl border border-light-surface-300 dark:border-dark-surface-700 divide-light-surface-100 dark:divide-dark-surface-700 flex flex-col gap-2 p-2 mt-2 rtl:space-x-reverse",
|
|
59
59
|
variants: {
|
|
60
60
|
breakPoint: {
|
|
61
|
-
md: "md:
|
|
62
|
-
lg: "lg:
|
|
63
|
-
xl: "xl:
|
|
64
|
-
xxl: "2xl:
|
|
61
|
+
md: "dark:md:bg-transparent md:bg-transparent md:text-sm md:font-medium md:border-0 md:mt-0 md:flex-row md:items-center md:gap-8 md:p-0",
|
|
62
|
+
lg: "dark:lg:bg-transparent lg:bg-transparent lg:text-sm lg:font-medium lg:border-0 lg:mt-0 lg:flex-row lg:items-center lg:gap-8 lg:p-0",
|
|
63
|
+
xl: "dark:xl:bg-transparent xl:bg-transparent xl:text-sm xl:font-medium xl:border-0 xl:mt-0 xl:flex-row xl:items-center xl:gap-8 lg:p-0",
|
|
64
|
+
xxl: "dark:2xl:bg-transparent 2xl:bg-transparent 2xl:text-sm 2xl:font-medium 2xl:border-0 2xl:mt-0 2xl:flex-row 2xl:items-center 2xl:gap-8 2xl:p-0"
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
});
|
|
@@ -74,26 +74,26 @@ export const navbrand = tv({
|
|
|
74
74
|
export const navLi = tv({
|
|
75
75
|
slots: {
|
|
76
76
|
base: "list-none",
|
|
77
|
-
link: "block py-2
|
|
77
|
+
link: "block py-2 px-4 rounded-lg text-light-surface-700 hover:text-light-surface-800 dark:text-dark-surface-400 dark:hover:text-white hover:bg-light-surface-50 dark:hover:bg-dark-surface-700 transition-all"
|
|
78
78
|
},
|
|
79
79
|
variants: {
|
|
80
80
|
active: {
|
|
81
81
|
true: {
|
|
82
|
-
link: "bg-primary-700 text-white"
|
|
82
|
+
link: "bg-primary-700 hover:bg-primary-800 dark:hover:bg-primary-800 text-white hover:text-white dark:text-white"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
breakPoint: {
|
|
86
86
|
md: {
|
|
87
|
-
link: "md:
|
|
87
|
+
link: "md:p-0 md:hover:text-dark-surface-900 md:dark:hover:text-white md:hover:bg-transparent md:dark:hover:bg-transparent md:border-0"
|
|
88
88
|
},
|
|
89
89
|
lg: {
|
|
90
|
-
link: "lg:
|
|
90
|
+
link: "lg:p-0 lg:hover:text-dark-surface-900 lg:dark:hover:text-white lg:hover:bg-transparent lg:dark:hover:bg-transparent lg:border-0"
|
|
91
91
|
},
|
|
92
92
|
xl: {
|
|
93
|
-
link: "xl:
|
|
93
|
+
link: "xl:p-0 xl:hover:text-dark-surface-900 xl:dark:hover:text-white xl:hover:bg-transparent xl:dark:hover:bg-transparent xl:border-0"
|
|
94
94
|
},
|
|
95
95
|
xxl: {
|
|
96
|
-
link: "2xl:
|
|
96
|
+
link: "2xl:p-0 2xl:hover:text-dark-surface-900 2xl:dark:hover:text-white 2xl:hover:bg-transparent 2xl:dark:hover:bg-transparent 2xl:border-0"
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
},
|
|
@@ -102,28 +102,28 @@ export const navLi = tv({
|
|
|
102
102
|
active: true,
|
|
103
103
|
breakPoint: "md",
|
|
104
104
|
class: {
|
|
105
|
-
link: "md:bg-transparent md:text-primary-700 md:
|
|
105
|
+
link: "md:bg-transparent md:text-primary-700 md:dark:text-primary-600 md:hover:text-primary-900 md:dark:hover:text-primary-500 md:font-medium md:p-0"
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
109
|
active: true,
|
|
110
110
|
breakPoint: "lg",
|
|
111
111
|
class: {
|
|
112
|
-
link: "lg:bg-transparent lg:text-primary-700 lg:
|
|
112
|
+
link: "lg:bg-transparent lg:text-primary-700 lg:dark:text-primary-600 lg:hover:text-primary-900 lg:dark:hover:text-primary-500 lg:font-medium lg:p-0"
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
116
|
active: true,
|
|
117
117
|
breakPoint: "xl",
|
|
118
118
|
class: {
|
|
119
|
-
link: "xl:bg-transparent xl:text-primary-700 xl:
|
|
119
|
+
link: "xl:bg-transparent xl:text-primary-700 xl:dark:text-primary-600 xl:hover:text-primary-900 xl:dark:hover:text-primary-500 xl:font-medium xl:p-0"
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
active: true,
|
|
124
124
|
breakPoint: "xxl",
|
|
125
125
|
class: {
|
|
126
|
-
link: "2xl:bg-transparent 2xl:text-primary-700 2xl:
|
|
126
|
+
link: "2xl:bg-transparent 2xl:text-primary-700 2xl:dark:text-primary-6002 xl:hover:text-primary-900 2xl:dark:hover:text-primary-500 2xl:font-medium 2xl:p-0"
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
],
|
|
@@ -133,7 +133,7 @@ export const navLi = tv({
|
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
135
|
export const navcontainer = tv({
|
|
136
|
-
base: "mx-
|
|
136
|
+
base: "mx-0 flex flex-wrap justify-between items-center max-w-none",
|
|
137
137
|
variants: {
|
|
138
138
|
fluid: {
|
|
139
139
|
true: "w-full",
|
|
@@ -142,7 +142,7 @@ export const navcontainer = tv({
|
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
export const navhamburger = tv({
|
|
145
|
-
base: "inline-flex h-10 w-10 items-center justify-center rounded-lg p-2 text-sm text-
|
|
145
|
+
base: "inline-flex h-10 w-10 items-center justify-center rounded-lg p-2 text-sm text-light-surface-500 hover:bg-light-surface-100 focus:outline-hidden focus-visible:ring-2 focus-visible:ring-light-surface-200 dark:text-dark-surface-400 dark:hover:bg-dark-surface-700 dark:focus-visible:ring-dark-surface-600",
|
|
146
146
|
variants: {
|
|
147
147
|
breakPoint: {
|
|
148
148
|
md: "md:hidden",
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { setContext } from "svelte";
|
|
3
|
-
import { fly } from "svelte/transition";
|
|
4
3
|
import { writable } from "svelte/store";
|
|
5
|
-
import { sineIn } from "svelte/easing";
|
|
6
4
|
import { type SidebarProps as Props, sidebar, type SidebarCtxType } from ".";
|
|
7
5
|
|
|
8
|
-
let { children,
|
|
9
|
-
|
|
10
|
-
const breakpointValues = {
|
|
11
|
-
sm: 640,
|
|
12
|
-
md: 768,
|
|
13
|
-
lg: 1024,
|
|
14
|
-
xl: 1280,
|
|
15
|
-
"2xl": 1536
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
let isLargeScreen = $state(false);
|
|
6
|
+
let { children, isSingle = true, breakpoint = "md", position = "fixed", divClass, ariaLabel, nonActiveClass, activeClass, activeUrl = "", class: className, ...restProps }: Props = $props();
|
|
19
7
|
|
|
20
8
|
const activeUrlStore = writable("");
|
|
21
9
|
setContext("activeUrl", activeUrlStore);
|
|
@@ -23,69 +11,36 @@
|
|
|
23
11
|
activeUrlStore.set(activeUrl);
|
|
24
12
|
});
|
|
25
13
|
|
|
26
|
-
|
|
27
|
-
isLargeScreen = window.innerWidth >= breakpointValues[breakpoint];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const { base, active, nonactive, div, backdrop: backdropCls } = $derived(sidebar({ isOpen, breakpoint, position, backdrop }));
|
|
14
|
+
const { base, active, nonactive, div } = $derived(sidebar({ breakpoint, position }));
|
|
31
15
|
|
|
32
16
|
let sidebarCtx: SidebarCtxType = {
|
|
33
|
-
get closeSidebar() {
|
|
34
|
-
return closeSidebar;
|
|
35
|
-
},
|
|
36
17
|
get activeClass() {
|
|
37
18
|
return active({ class: activeClass });
|
|
38
19
|
},
|
|
39
20
|
get nonActiveClass() {
|
|
40
21
|
return nonactive({ class: nonActiveClass });
|
|
41
22
|
},
|
|
42
|
-
isSingle
|
|
23
|
+
isSingle,
|
|
24
|
+
breakpoint
|
|
43
25
|
};
|
|
44
26
|
|
|
45
|
-
let transitionParams = params ? params : { x: -320, duration: 200, easing: sineIn };
|
|
46
|
-
|
|
47
27
|
setContext("sidebarContext", sidebarCtx);
|
|
48
|
-
$effect(() => {
|
|
49
|
-
checkScreenSize();
|
|
50
|
-
window.addEventListener("resize", checkScreenSize);
|
|
51
|
-
return () => window.removeEventListener("resize", checkScreenSize);
|
|
52
|
-
});
|
|
53
28
|
</script>
|
|
54
29
|
|
|
55
|
-
{
|
|
56
|
-
{
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<div role="presentation" class={backdropCls({ class: backdropClass })}></div>
|
|
61
|
-
{:else if !backdrop && activateClickOutside}
|
|
62
|
-
<div role="presentation" class="fixed start-0 top-0 z-50 h-full w-full" onclick={closeSidebar}></div>
|
|
63
|
-
{:else if !backdrop && !activateClickOutside}
|
|
64
|
-
<div role="presentation" class="fixed start-0 top-0 z-50 h-full w-full"></div>
|
|
65
|
-
{/if}
|
|
66
|
-
{/if}
|
|
67
|
-
<aside transition:transition={transitionParams} {...restProps} class={base({ className })} aria-label={ariaLabel}>
|
|
68
|
-
<div class={div({ class: divClass })}>
|
|
69
|
-
{@render children()}
|
|
70
|
-
</div>
|
|
71
|
-
</aside>
|
|
72
|
-
{/if}
|
|
30
|
+
<aside {...restProps} class={base({ className })} aria-label={ariaLabel}>
|
|
31
|
+
<div class={div({ class: divClass })}>
|
|
32
|
+
{@render children()}
|
|
33
|
+
</div>
|
|
34
|
+
</aside>
|
|
73
35
|
|
|
74
36
|
<!--
|
|
75
37
|
@component
|
|
76
38
|
[Go to docs](https://svelte-5-ui-lib.codewithshin.com/)
|
|
77
39
|
## Props
|
|
78
40
|
@props: children: any;
|
|
79
|
-
@props:isOpen: any = false;
|
|
80
|
-
@props:closeSidebar: any;
|
|
81
41
|
@props:isSingle: any = true;
|
|
82
42
|
@props:breakpoint: any = "md";
|
|
83
43
|
@props:position: any = "fixed";
|
|
84
|
-
@props:activateClickOutside: any = true;
|
|
85
|
-
@props:backdrop: any = true;
|
|
86
|
-
@props:backdropClass: any;
|
|
87
|
-
@props:transition: any = fly;
|
|
88
|
-
@props:params: any;
|
|
89
44
|
@props:divClass: any;
|
|
90
45
|
@props:ariaLabel: any;
|
|
91
46
|
@props:nonActiveClass: any;
|
|
@@ -3,16 +3,9 @@ import { type SidebarProps as Props } from ".";
|
|
|
3
3
|
* [Go to docs](https://svelte-5-ui-lib.codewithshin.com/)
|
|
4
4
|
* ## Props
|
|
5
5
|
* @props: children: any;
|
|
6
|
-
* @props:isOpen: any = false;
|
|
7
|
-
* @props:closeSidebar: any;
|
|
8
6
|
* @props:isSingle: any = true;
|
|
9
7
|
* @props:breakpoint: any = "md";
|
|
10
8
|
* @props:position: any = "fixed";
|
|
11
|
-
* @props:activateClickOutside: any = true;
|
|
12
|
-
* @props:backdrop: any = true;
|
|
13
|
-
* @props:backdropClass: any;
|
|
14
|
-
* @props:transition: any = fly;
|
|
15
|
-
* @props:params: any;
|
|
16
9
|
* @props:divClass: any;
|
|
17
10
|
* @props:ariaLabel: any;
|
|
18
11
|
* @props:nonActiveClass: any;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { type SidebarGroupProps as Props } from ".";
|
|
2
|
+
import { type SidebarGroupProps as Props, sidebargroup, type SidebarCtxType } from ".";
|
|
3
|
+
import { getContext } from "svelte";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
const context = getContext<SidebarCtxType>("sidebarContext") ?? {};
|
|
6
|
+
|
|
7
|
+
let { children, class: className, border = false, ...restProps }: Props = $props();
|
|
8
|
+
const { base } = $derived(sidebargroup({ breakpoint: context.breakpoint, border }));
|
|
5
9
|
</script>
|
|
6
10
|
|
|
7
|
-
<ul {...restProps} class={
|
|
11
|
+
<ul {...restProps} class={base({ className })}>
|
|
8
12
|
{@render children()}
|
|
9
13
|
</ul>
|
|
10
14
|
|
|
@@ -14,6 +18,5 @@
|
|
|
14
18
|
## Props
|
|
15
19
|
@props: children: any;
|
|
16
20
|
@props:class: string = "space-y-2";
|
|
17
|
-
@props:
|
|
18
|
-
@props:border: any = false;
|
|
21
|
+
@props:border:boolean = false;
|
|
19
22
|
-->
|
|
@@ -4,8 +4,7 @@ import { type SidebarGroupProps as Props } from ".";
|
|
|
4
4
|
* ## Props
|
|
5
5
|
* @props: children: any;
|
|
6
6
|
* @props:class: string = "space-y-2";
|
|
7
|
-
* @props:
|
|
8
|
-
* @props:border: any = false;
|
|
7
|
+
* @props:border:boolean = false;
|
|
9
8
|
*/
|
|
10
9
|
declare const SidebarGroup: import("svelte").Component<Props, {}, "">;
|
|
11
10
|
type SidebarGroup = ReturnType<typeof SidebarGroup>;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
29
|
<li class={className}>
|
|
30
|
-
<a
|
|
30
|
+
<a {...restProps} {href} aria-current={(activeItem ?? sidebarUrl === href) ? "page" : undefined} class={twMerge(aCls, aClass)}>
|
|
31
31
|
{#if iconSlot}
|
|
32
32
|
{@render iconSlot()}
|
|
33
33
|
{/if}
|
package/dist/sidebar/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { SidebarProps, SidebarDropdownWrapperProps, SidebarGroupProps, SidebarItemProps,
|
|
1
|
+
import type { SidebarProps, SidebarDropdownWrapperProps, SidebarGroupProps, SidebarItemProps, SidebarCtaProps, SidebarBrandProps, SidebarCtxType, PosisionType, BreakpointType } from "./type";
|
|
2
2
|
import Sidebar from "./Sidebar.svelte";
|
|
3
3
|
import SidebarDropdownWrapper from "./SidebarDropdownWrapper.svelte";
|
|
4
4
|
import SidebarGroup from "./SidebarGroup.svelte";
|
|
5
5
|
import SidebarItem from "./SidebarItem.svelte";
|
|
6
|
-
import SidebarButton from "./SidebarButton.svelte";
|
|
7
6
|
import SidebarCta from "./SidebarCta.svelte";
|
|
8
7
|
import SidebarBrand from "./SidebarBrand.svelte";
|
|
9
|
-
import { sidebar,
|
|
10
|
-
export { Sidebar, sidebar, type SidebarProps, SidebarDropdownWrapper, sidebardropdownwrapper, type SidebarDropdownWrapperProps, SidebarGroup, type SidebarGroupProps, SidebarItem, type SidebarItemProps, type SidebarCtxType,
|
|
8
|
+
import { sidebar, sidebarcta, sitebarbrand, sidebargroup, sidebardropdownwrapper } from "./theme";
|
|
9
|
+
export { Sidebar, sidebar, type SidebarProps, SidebarDropdownWrapper, sidebardropdownwrapper, type SidebarDropdownWrapperProps, SidebarGroup, sidebargroup, type SidebarGroupProps, SidebarItem, type SidebarItemProps, type SidebarCtxType, SidebarCta, sidebarcta, type SidebarCtaProps, SidebarBrand, sitebarbrand, type SidebarBrandProps, type BreakpointType, type PosisionType };
|
package/dist/sidebar/index.js
CHANGED
|
@@ -2,8 +2,7 @@ import Sidebar from "./Sidebar.svelte";
|
|
|
2
2
|
import SidebarDropdownWrapper from "./SidebarDropdownWrapper.svelte";
|
|
3
3
|
import SidebarGroup from "./SidebarGroup.svelte";
|
|
4
4
|
import SidebarItem from "./SidebarItem.svelte";
|
|
5
|
-
import SidebarButton from "./SidebarButton.svelte";
|
|
6
5
|
import SidebarCta from "./SidebarCta.svelte";
|
|
7
6
|
import SidebarBrand from "./SidebarBrand.svelte";
|
|
8
|
-
import { sidebar,
|
|
9
|
-
export { Sidebar, sidebar, SidebarDropdownWrapper, sidebardropdownwrapper, SidebarGroup,
|
|
7
|
+
import { sidebar, sidebarcta, sitebarbrand, sidebargroup, sidebardropdownwrapper } from "./theme";
|
|
8
|
+
export { Sidebar, sidebar, SidebarDropdownWrapper, sidebardropdownwrapper, SidebarGroup, sidebargroup, SidebarItem, SidebarCta, sidebarcta, SidebarBrand, sitebarbrand };
|