odj-svelte-ui 0.2.0 → 0.2.2
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 +10 -1
- 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 +61 -12
- package/dist/dropdown/Dropdown.svelte.d.ts +6 -5
- package/dist/dropdown/DropdownLi.svelte +9 -3
- package/dist/dropdown/DropdownLi.svelte.d.ts +1 -0
- package/dist/dropdown/theme.d.ts +4 -12
- package/dist/dropdown/theme.js +7 -8
- package/dist/dropdown/type.d.ts +11 -5
- 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/dist/tooltip/Tooltip.svelte +25 -34
- package/dist/tooltip/Tooltip.svelte.d.ts +1 -1
- package/package.json +1 -5
- package/dist/sidebar/SidebarButton.svelte +0 -21
- package/dist/sidebar/SidebarButton.svelte.d.ts +0 -10
package/dist/sidebar/theme.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { tv } from "tailwind-variants";
|
|
2
2
|
export const sidebar = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base: "top-0 left-0 z-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
backdrop: "fixed top-0 start-0 z-40 w-full h-full"
|
|
4
|
+
base: "top-0 left-0 z-10 min-w-full",
|
|
5
|
+
div: "overflow-y-auto p-2 rounded-lg bg-light-surface-100 dark:bg-dark-surface-800",
|
|
6
|
+
active: "cursor-pointer flex items-center p-2 rounded-lg text-base font-normal text-light-surface-900 dark:text-white bg-light-surface-300 dark:bg-dark-surface-700 hover:bg-light-surface-300/50 dark:hover:bg-dark-surface-600",
|
|
7
|
+
nonactive: "cursor-pointer flex items-center p-2 rounded-lg text-base font-normal text-light-surface-700 dark:text-dark-surface-400 hover:bg-light-surface-300/50 dark:hover:bg-dark-surface-600 hover:text-light-surface-800 dark:hover:text-dark-surface-200"
|
|
9
8
|
},
|
|
10
9
|
variants: {
|
|
11
10
|
position: {
|
|
@@ -13,44 +12,44 @@ export const sidebar = tv({
|
|
|
13
12
|
absolute: { base: "absolute" },
|
|
14
13
|
static: { base: "static" }
|
|
15
14
|
},
|
|
16
|
-
isOpen: {
|
|
17
|
-
true: "block",
|
|
18
|
-
false: "hidden"
|
|
19
|
-
},
|
|
20
15
|
breakpoint: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
backdrop: {
|
|
28
|
-
true: { backdrop: "bg-gray-900/75" }
|
|
16
|
+
none: { base: "min-w-64 h-full", div: "h-full sm:rounded-none" },
|
|
17
|
+
sm: { base: "sm:min-w-64 sm:h-full", div: "sm:h-full sm:rounded-none" },
|
|
18
|
+
md: { base: "md:min-w-64 md:h-full", div: "md:h-full md:rounded-none" },
|
|
19
|
+
lg: { base: "lg:min-w-64 lg:h-full", div: "lg:h-full lg:rounded-none" },
|
|
20
|
+
xl: { base: "xl:min-w-64 xl:h-full", div: "xl:h-full xl:rounded-none" },
|
|
21
|
+
"2xl": { base: "2xl:min-w-64 2xl:h-full", div: "2xl:h-full 2xl:rounded-none" }
|
|
29
22
|
}
|
|
30
23
|
}
|
|
31
24
|
});
|
|
32
|
-
export const
|
|
33
|
-
|
|
25
|
+
export const sidebargroup = tv({
|
|
26
|
+
slots: {
|
|
27
|
+
base: "flex flex-row gap-2"
|
|
28
|
+
},
|
|
34
29
|
variants: {
|
|
35
30
|
breakpoint: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
none: { base: "flex-col" },
|
|
32
|
+
sm: { base: "sm:flex-col" },
|
|
33
|
+
md: { base: "md:flex-col" },
|
|
34
|
+
lg: { base: "lg:flex-col" },
|
|
35
|
+
xl: { base: "xl:flex-col" },
|
|
36
|
+
"2xl": { base: "2xl:flex-col" }
|
|
37
|
+
},
|
|
38
|
+
border: {
|
|
39
|
+
true: "pt-4 mt-4 border-t border-light-surface-200 dark:border-dark-surface-700"
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
});
|
|
44
43
|
export const sidebarcta = tv({
|
|
45
44
|
slots: {
|
|
46
|
-
base: "p-4 mt-
|
|
45
|
+
base: "p-4 mt-2 bg-primary-50 rounded-lg dark:bg-primary-900",
|
|
47
46
|
div: "flex items-center mb-3",
|
|
48
47
|
span: "bg-primary-100 text-primary-800 text-sm font-semibold me-2 px-2.5 py-0.5 rounded-sm dark:bg-primary-200 dark:text-primary-900"
|
|
49
48
|
}
|
|
50
49
|
});
|
|
51
50
|
export const sitebarbrand = tv({
|
|
52
51
|
slots: {
|
|
53
|
-
base: "flex items-center
|
|
52
|
+
base: "flex items-center px-2 my-2",
|
|
54
53
|
img: "h-6 me-3 sm:h-7",
|
|
55
54
|
span: "self-center text-xl font-semibold whitespace-nowrap dark:text-white"
|
|
56
55
|
}
|
|
@@ -58,9 +57,9 @@ export const sitebarbrand = tv({
|
|
|
58
57
|
export const sidebardropdownwrapper = tv({
|
|
59
58
|
slots: {
|
|
60
59
|
base: "",
|
|
61
|
-
btn: "flex items-center
|
|
60
|
+
btn: "group w-full cursor-pointer flex items-center p-2 rounded-lg text-base font-normal text-light-surface-700 dark:text-dark-surface-400 hover:bg-light-surface-300/50 dark:hover:bg-dark-surface-600 hover:text-light-surface-800 dark:hover:text-dark-surface-200",
|
|
62
61
|
span: "flex-1 ms-3 text-left whitespace-nowrap",
|
|
63
|
-
svg: "h-3 w-3 text-
|
|
62
|
+
svg: "h-3 w-3 text-light-surface-700 dark:text-dark-surface-400 group-hover:text-light-surface-800 dark:group-hover:text-dark-surface-200",
|
|
64
63
|
ul: "py-2 space-y-2"
|
|
65
64
|
}
|
|
66
65
|
});
|
package/dist/sidebar/type.d.ts
CHANGED
|
@@ -3,36 +3,26 @@ import type { Snippet } from "svelte";
|
|
|
3
3
|
import type { HTMLAttributes, HTMLButtonAttributes, HTMLAnchorAttributes } from "svelte/elements";
|
|
4
4
|
import type { TransitionFunc, ParamsType } from "../types";
|
|
5
5
|
type SidebarCtxType = {
|
|
6
|
-
closeSidebar?: () => void;
|
|
7
6
|
activeClass?: string;
|
|
8
7
|
nonActiveClass?: string;
|
|
9
8
|
isSingle?: boolean;
|
|
10
9
|
selected?: Writable<object>;
|
|
11
10
|
activeUrl?: string;
|
|
11
|
+
breakpoint?: BreakpointType;
|
|
12
12
|
};
|
|
13
|
-
type BreakpointType = "sm" | "md" | "lg" | "xl" | "2xl" | undefined;
|
|
13
|
+
type BreakpointType = "sm" | "md" | "lg" | "xl" | "2xl" | "none" | undefined;
|
|
14
14
|
type PosisionType = "fixed" | "absolute" | "static" | undefined;
|
|
15
15
|
interface SidebarProps extends HTMLAttributes<HTMLElement> {
|
|
16
16
|
children: Snippet;
|
|
17
|
-
isOpen?: boolean;
|
|
18
|
-
closeSidebar?: () => void;
|
|
19
|
-
activateClickOutside?: boolean;
|
|
20
17
|
isSingle?: boolean;
|
|
21
18
|
breakpoint?: BreakpointType;
|
|
22
19
|
position?: PosisionType;
|
|
23
|
-
ariaLabel?: string;
|
|
24
20
|
divClass?: string;
|
|
21
|
+
ariaLabel?: string;
|
|
25
22
|
nonActiveClass?: string;
|
|
26
23
|
activeClass?: string;
|
|
27
|
-
params?: ParamsType;
|
|
28
|
-
transition?: TransitionFunc;
|
|
29
|
-
backdrop?: boolean;
|
|
30
|
-
backdropClass?: string;
|
|
31
24
|
activeUrl?: string;
|
|
32
25
|
}
|
|
33
|
-
interface SidebarButtonProps extends HTMLButtonAttributes {
|
|
34
|
-
breakpoint?: BreakpointType;
|
|
35
|
-
}
|
|
36
26
|
interface SidebarCtaProps extends HTMLAttributes<HTMLDivElement> {
|
|
37
27
|
children: Snippet;
|
|
38
28
|
icon?: Snippet;
|
|
@@ -69,7 +59,6 @@ interface SidebarDropdownWrapperProps extends HTMLButtonAttributes {
|
|
|
69
59
|
}
|
|
70
60
|
interface SidebarGroupProps extends HTMLAttributes<HTMLUListElement> {
|
|
71
61
|
children: Snippet;
|
|
72
|
-
borderClass?: string;
|
|
73
62
|
border?: boolean;
|
|
74
63
|
}
|
|
75
64
|
interface SidebarItemProps extends HTMLAnchorAttributes {
|
|
@@ -82,4 +71,4 @@ interface SidebarItemProps extends HTMLAnchorAttributes {
|
|
|
82
71
|
aClass?: string;
|
|
83
72
|
active?: boolean;
|
|
84
73
|
}
|
|
85
|
-
export type { SidebarProps, SidebarDropdownWrapperProps, SidebarGroupProps, SidebarItemProps, SidebarCtxType,
|
|
74
|
+
export type { SidebarProps, SidebarDropdownWrapperProps, SidebarGroupProps, SidebarItemProps, SidebarCtxType, SidebarCtaProps, SidebarBrandProps, BreakpointType, PosisionType };
|
package/dist/theme/Theme.svelte
CHANGED
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
review,
|
|
62
62
|
scorerating,
|
|
63
63
|
sidebar,
|
|
64
|
-
sidebarbutton,
|
|
65
64
|
sidebarcta,
|
|
66
65
|
sitebarbrand,
|
|
67
66
|
sidebardropdownwrapper,
|
|
@@ -216,7 +215,6 @@
|
|
|
216
215
|
review,
|
|
217
216
|
scorerating,
|
|
218
217
|
sidebar,
|
|
219
|
-
sidebarbutton,
|
|
220
218
|
sidebarcta,
|
|
221
219
|
sitebarbrand,
|
|
222
220
|
sidebardropdownwrapper,
|
|
@@ -1,43 +1,34 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { tooltip } from "./theme";
|
|
3
3
|
import type { TooltipProps } from ".";
|
|
4
|
-
import {
|
|
5
|
-
FloatingArrow,
|
|
6
|
-
arrow,
|
|
7
|
-
autoUpdate,
|
|
8
|
-
flip,
|
|
9
|
-
offset as floatingUIOffset,
|
|
10
|
-
useDismiss,
|
|
11
|
-
useFloating,
|
|
12
|
-
useHover,
|
|
13
|
-
useInteractions,
|
|
14
|
-
useRole,
|
|
15
|
-
} from "@skeletonlabs/floating-ui-svelte";
|
|
4
|
+
import { FloatingArrow, arrow, autoUpdate, flip, offset as floatingUIOffset, useDismiss, useFloating, useHover, useInteractions, useRole } from "@skeletonlabs/floating-ui-svelte";
|
|
16
5
|
import { fade } from "svelte/transition";
|
|
17
6
|
|
|
18
|
-
let { children, color = "default", arrow: showArrow = false, offset = 8, triggeredBy, position = "top", class: className, arrowClass, open = $bindable(false), transition = fade, transitionOptions = { duration: 200 }, ...restProps }: TooltipProps = $props();
|
|
7
|
+
let { children, color = "default", arrow: showArrow = false, offset = 8, triggeredBy, position: placement = "top", class: className, arrowClass, open = $bindable(false), transition = fade, transitionOptions = { duration: 200 }, ...restProps }: TooltipProps = $props();
|
|
19
8
|
|
|
20
9
|
let arrowElement: HTMLElement | null = $state(null);
|
|
21
10
|
|
|
22
11
|
let { base, arrowBase } = $derived(tooltip({ color }));
|
|
23
|
-
|
|
12
|
+
|
|
24
13
|
// State
|
|
25
14
|
let elemArrow: HTMLElement | null = $state(null);
|
|
26
15
|
|
|
27
16
|
// Use Floating
|
|
28
|
-
let floating = $derived(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
17
|
+
let floating = $derived(
|
|
18
|
+
useFloating({
|
|
19
|
+
whileElementsMounted: autoUpdate,
|
|
20
|
+
get open() {
|
|
21
|
+
return open;
|
|
22
|
+
},
|
|
23
|
+
onOpenChange: (v) => {
|
|
24
|
+
open = v;
|
|
25
|
+
},
|
|
26
|
+
placement,
|
|
27
|
+
get middleware() {
|
|
28
|
+
return [floatingUIOffset(offset), flip(), elemArrow && arrow({ element: elemArrow })];
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
);
|
|
41
32
|
|
|
42
33
|
// Interactions
|
|
43
34
|
let role = $derived(useRole(floating.context, { role: "tooltip" }));
|
|
@@ -48,22 +39,22 @@
|
|
|
48
39
|
// Get elements
|
|
49
40
|
$effect(() => {
|
|
50
41
|
let triggerElement = document.querySelector(triggeredBy);
|
|
51
|
-
if (!triggerElement) return;
|
|
42
|
+
if (!triggerElement) return;
|
|
52
43
|
|
|
53
44
|
floating.elements.reference = triggerElement;
|
|
54
|
-
|
|
45
|
+
|
|
55
46
|
// Assign the props to the element
|
|
56
47
|
Object.entries(interactions.getReferenceProps()).forEach(([key, value]) => {
|
|
57
|
-
triggerElement[key] = value;
|
|
48
|
+
(triggerElement as any)[key] = value;
|
|
58
49
|
});
|
|
59
|
-
})
|
|
50
|
+
});
|
|
60
51
|
</script>
|
|
61
52
|
|
|
62
53
|
{#if open}
|
|
63
54
|
<div role="tooltip" bind:this={floating.elements.floating} style={floating.floatingStyles} {...interactions.getFloatingProps()} transition:transition={transitionOptions} {...restProps} class={base({ className })}>
|
|
64
55
|
{@render children()}
|
|
65
56
|
{#if showArrow}
|
|
66
|
-
<FloatingArrow bind:ref={arrowElement} context={floating.context} class={arrowBase({className: arrowClass})}/>
|
|
57
|
+
<FloatingArrow bind:ref={arrowElement} context={floating.context} class={arrowBase({ className: arrowClass })} />
|
|
67
58
|
{/if}
|
|
68
59
|
</div>
|
|
69
60
|
{/if}
|
|
@@ -75,7 +66,7 @@
|
|
|
75
66
|
@props:children: any;
|
|
76
67
|
@props:color: any = "default";
|
|
77
68
|
@props:arrow: any = false;
|
|
78
|
-
@props:offset:
|
|
69
|
+
@props:offset: number = 8;
|
|
79
70
|
@props:triggeredBy: any;
|
|
80
71
|
@props:position: string = "top";
|
|
81
72
|
@props:class: string;
|
|
@@ -83,4 +74,4 @@
|
|
|
83
74
|
@props:open: boolean = false;
|
|
84
75
|
@props:transition: any = "fade";
|
|
85
76
|
@props:transitionOptions: object = { duration: 200 };
|
|
86
|
-
-->
|
|
77
|
+
-->
|
|
@@ -5,7 +5,7 @@ import type { TooltipProps } from ".";
|
|
|
5
5
|
* @props:children: any;
|
|
6
6
|
* @props:color: any = "default";
|
|
7
7
|
* @props:arrow: any = false;
|
|
8
|
-
* @props:offset:
|
|
8
|
+
* @props:offset: number = 8;
|
|
9
9
|
* @props:triggeredBy: any;
|
|
10
10
|
* @props:position: string = "top";
|
|
11
11
|
* @props:class: string;
|
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.2",
|
|
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",
|
|
@@ -436,10 +436,6 @@
|
|
|
436
436
|
"types": "./dist/sidebar/SidebarBrand.svelte.d.ts",
|
|
437
437
|
"svelte": "./dist/sidebar/SidebarBrand.svelte"
|
|
438
438
|
},
|
|
439
|
-
"./SidebarButton.svelte": {
|
|
440
|
-
"types": "./dist/sidebar/SidebarButton.svelte.d.ts",
|
|
441
|
-
"svelte": "./dist/sidebar/SidebarButton.svelte"
|
|
442
|
-
},
|
|
443
439
|
"./SidebarCta.svelte": {
|
|
444
440
|
"types": "./dist/sidebar/SidebarCta.svelte.d.ts",
|
|
445
441
|
"svelte": "./dist/sidebar/SidebarCta.svelte"
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { type SidebarButtonProps as Props, sidebarbutton } from ".";
|
|
3
|
-
let { breakpoint = "md", class: className, ...restProps }: Props = $props();
|
|
4
|
-
|
|
5
|
-
const base = $derived(sidebarbutton({ breakpoint, className }));
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<button {...restProps} type="button" class={base}>
|
|
9
|
-
<span class="sr-only">Open sidebar</span>
|
|
10
|
-
<svg class="h-6 w-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
|
11
|
-
<path clip-rule="evenodd" fill-rule="evenodd" d="M2 4.75A.75.75 0 012.75 4h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 4.75zm0 10.5a.75.75 0 01.75-.75h7.5a.75.75 0 010 1.5h-7.5a.75.75 0 01-.75-.75zM2 10a.75.75 0 01.75-.75h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 10z"></path>
|
|
12
|
-
</svg>
|
|
13
|
-
</button>
|
|
14
|
-
|
|
15
|
-
<!--
|
|
16
|
-
@component
|
|
17
|
-
[Go to docs](https://svelte-5-ui-lib.codewithshin.com/)
|
|
18
|
-
## Props
|
|
19
|
-
@props: breakpoint: any = "md";
|
|
20
|
-
@props:class: string;
|
|
21
|
-
-->
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type SidebarButtonProps as Props } from ".";
|
|
2
|
-
/**
|
|
3
|
-
* [Go to docs](https://svelte-5-ui-lib.codewithshin.com/)
|
|
4
|
-
* ## Props
|
|
5
|
-
* @props: breakpoint: any = "md";
|
|
6
|
-
* @props:class: string;
|
|
7
|
-
*/
|
|
8
|
-
declare const SidebarButton: import("svelte").Component<Props, {}, "">;
|
|
9
|
-
type SidebarButton = ReturnType<typeof SidebarButton>;
|
|
10
|
-
export default SidebarButton;
|