negodesign 0.0.24 → 0.0.26
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/dist/assets/start.png +0 -0
- package/dist/components/core/breadcrumb/breadcrumb-list.svelte +31 -31
- package/dist/components/core/button/ButtonBack.svelte +18 -18
- package/dist/components/core/button/ButtonLogin.svelte +15 -15
- package/dist/components/core/button/ButtonLoginWith.svelte +57 -57
- package/dist/components/core/button/ButtonSend.svelte +15 -15
- package/dist/components/core/card/highlight/01/CardHighlight01.svelte +91 -0
- package/dist/components/core/card/highlight/01/CardHighlight01.svelte.d.ts +8 -0
- package/dist/components/core/card/highlight/02/CardHighlight02.svelte +93 -0
- package/dist/components/core/card/highlight/02/CardHighlight02.svelte.d.ts +8 -0
- package/dist/components/core/card/highlight/CardHighlight.svelte +22 -44
- package/dist/components/core/card/highlight/CardHighlight.svelte.d.ts +5 -2
- package/dist/components/core/card/highlight/data.js +32 -1
- package/dist/components/core/card/media/01/CardMedia01.svelte +111 -114
- package/dist/components/core/card/media/02/CardMedia02.svelte +110 -113
- package/dist/components/core/card/media/CardMedia.svelte +17 -17
- package/dist/components/core/card/profile/01/CardProfile01.svelte +98 -101
- package/dist/components/core/card/profile/02/CardProfile02.svelte +98 -97
- package/dist/components/core/card/profile/CardProfile.svelte +17 -17
- package/dist/components/core/card/promotion/CardPromotion.svelte +112 -81
- package/dist/components/core/card/promotion/data.js +31 -0
- package/dist/components/core/card/shared/CardButton.svelte +30 -30
- package/dist/components/core/card/shared/CardCart.svelte +36 -32
- package/dist/components/core/card/shared/CardCart.svelte.d.ts +1 -0
- package/dist/components/core/card/shared/CardDescription.svelte +38 -23
- package/dist/components/core/card/shared/CardDescription.svelte.d.ts +3 -0
- package/dist/components/core/card/shared/CardFavorite.svelte +33 -29
- package/dist/components/core/card/shared/CardFavorite.svelte.d.ts +1 -0
- package/dist/components/core/card/shared/CardStarRating.svelte +20 -20
- package/dist/components/core/card/shared/CardStartPrice.svelte +34 -0
- package/dist/components/core/card/shared/CardStartPrice.svelte.d.ts +8 -0
- package/dist/components/core/card/shared/CardTags.svelte +73 -56
- package/dist/components/core/card/shared/CardTags.svelte.d.ts +2 -1
- package/dist/components/core/card/shared/CardThumbnailVideo.svelte +169 -169
- package/dist/components/core/card/shared/TruncatableText.svelte +55 -55
- package/dist/components/core/card/types.d.ts +13 -0
- package/dist/components/core/carousel/{shared/ui/SimpleBadgeCarousel.svelte → badge/ui/CarouselBadge.svelte} +83 -80
- package/dist/components/core/carousel/badge/ui/CarouselBadge.svelte.d.ts +4 -0
- package/dist/components/core/carousel/hero/CarouselHero.svelte +158 -158
- package/dist/components/core/carousel/highlights/types.d.ts +12 -0
- package/dist/components/core/carousel/highlights/types.js +1 -0
- package/dist/components/core/carousel/highlights/ui/CarouselHighlights.svelte +63 -65
- package/dist/components/core/carousel/highlights/ui/CarouselHighlights.svelte.d.ts +1 -1
- package/dist/components/core/carousel/promotion/types.d.ts +11 -0
- package/dist/components/core/carousel/promotion/types.js +1 -0
- package/dist/components/core/carousel/promotion/ui/CarouselPromotion.svelte +64 -65
- package/dist/components/core/carousel/promotion/ui/CarouselPromotion.svelte.d.ts +1 -1
- package/dist/components/core/carousel/shared/ui/CarouselHeader.svelte +55 -0
- package/dist/components/core/carousel/shared/ui/CarouselHeader.svelte.d.ts +9 -0
- package/dist/components/core/carousel/types.d.ts +10 -26
- package/dist/components/core/datatable/ui/DataTableActions.svelte +28 -28
- package/dist/components/core/datatable/ui/DataTableCheckbox.svelte +22 -22
- package/dist/components/core/datatable/ui/DataTableContent.svelte +59 -59
- package/dist/components/core/datatable/ui/DataTableCore.svelte +151 -151
- package/dist/components/core/datatable/ui/DataTableDragHandle.svelte +8 -8
- package/dist/components/core/datatable/ui/DataTableListFilter.svelte +59 -59
- package/dist/components/core/datatable/ui/DataTableListPagination.svelte +35 -35
- package/dist/components/core/form/ui/input-base.svelte +81 -81
- package/dist/components/core/form/ui/input-email-or-phone.svelte +23 -23
- package/dist/components/core/form/ui/input-email.svelte +23 -23
- package/dist/components/core/form/ui/input-password-confirm.svelte +23 -23
- package/dist/components/core/form/ui/input-password.svelte +23 -23
- package/dist/components/core/form/ui/input-phone.svelte +33 -33
- package/dist/components/core/form/ui/input-username.svelte +22 -22
- package/dist/components/core/hero/SimpleHero.svelte +65 -65
- package/dist/components/core/label/LabelOr.svelte +25 -25
- package/dist/components/core/link/link-forget-password.svelte +12 -12
- package/dist/components/core/link/link-privacy-polity.svelte +12 -12
- package/dist/components/core/link/link-terms-of-service.svelte +12 -12
- package/dist/components/core/nav/ui/menu-links.svelte +27 -27
- package/dist/components/core/nav/ui/mobile/nav-menu-drawer.svelte +85 -85
- package/dist/components/core/nav/ui/nav-menu-bottom-sidebar.svelte +33 -33
- package/dist/components/core/nav/ui/nav-menu-sidebar.svelte +97 -97
- package/dist/components/core/nav/ui/nav-menu-top-bar-sidebar.svelte +103 -103
- package/dist/components/core/nav/ui/nav-menu.svelte +106 -106
- package/dist/components/core/panel/CarouselSlot.svelte +63 -38
- package/dist/components/core/panel/CarouselSlot.svelte.d.ts +5 -2
- package/dist/components/core/panel/LeftHero.svelte +116 -116
- package/dist/components/core/search/SearchInput.svelte +32 -32
- package/dist/components/core/search/shared/SearchInputCore.svelte +66 -66
- package/dist/components/core/sidebar/MenuBarSidebar.svelte +70 -70
- package/dist/components/core/tabs/ui/tab-underline.svelte +43 -43
- package/dist/components/pages/admin/01/ui/AdminContent.svelte +14 -14
- package/dist/components/pages/admin/01/ui/AdminPanel.svelte +46 -46
- package/dist/components/pages/security/login/01/ui/FormRegister.svelte +28 -28
- package/dist/components/pages/security/login/01/ui/LoginCard.svelte +107 -107
- package/dist/components/pages/security/login/PageLogin.svelte +22 -22
- package/dist/components/ui/badge/badge.svelte +49 -49
- package/dist/components/ui/button/button.svelte +82 -82
- package/dist/components/ui/chart/chart-container.svelte +80 -80
- package/dist/components/ui/chart/chart-style.svelte +37 -37
- package/dist/components/ui/chart/chart-tooltip.svelte +184 -184
- package/dist/components/ui/checkbox/checkbox.svelte +40 -40
- package/dist/components/ui/data-table/flex-render.svelte +40 -40
- package/dist/components/ui/drawer/drawer-close.svelte +7 -7
- package/dist/components/ui/drawer/drawer-content.svelte +33 -33
- package/dist/components/ui/drawer/drawer-description.svelte +17 -17
- package/dist/components/ui/drawer/drawer-footer.svelte +20 -20
- package/dist/components/ui/drawer/drawer-header.svelte +20 -20
- package/dist/components/ui/drawer/drawer-nested.svelte +12 -12
- package/dist/components/ui/drawer/drawer-overlay.svelte +17 -17
- package/dist/components/ui/drawer/drawer-portal.svelte +7 -7
- package/dist/components/ui/drawer/drawer-title.svelte +17 -17
- package/dist/components/ui/drawer/drawer-trigger.svelte +7 -7
- package/dist/components/ui/drawer/drawer.svelte +12 -12
- package/dist/components/ui/select/select-content.svelte +45 -45
- package/dist/components/ui/select/select-group-heading.svelte +21 -21
- package/dist/components/ui/select/select-group.svelte +17 -17
- package/dist/components/ui/select/select-item.svelte +41 -41
- package/dist/components/ui/select/select-label.svelte +20 -20
- package/dist/components/ui/select/select-portal.svelte +7 -7
- package/dist/components/ui/select/select-scroll-down-button.svelte +21 -21
- package/dist/components/ui/select/select-scroll-up-button.svelte +21 -21
- package/dist/components/ui/select/select-separator.svelte +18 -18
- package/dist/components/ui/select/select-trigger.svelte +30 -30
- package/dist/components/ui/select/select.svelte +11 -11
- package/dist/components/ui/sidebar/sidebar-menu-sub-button.svelte +39 -39
- package/dist/components/ui/star-rating/star-rating-star.svelte +41 -41
- package/dist/components/ui/star-rating/star-rating.svelte +20 -20
- package/dist/components/ui/table/table-body.svelte +15 -15
- package/dist/components/ui/table/table-caption.svelte +20 -20
- package/dist/components/ui/table/table-cell.svelte +15 -15
- package/dist/components/ui/table/table-footer.svelte +20 -20
- package/dist/components/ui/table/table-head.svelte +15 -15
- package/dist/components/ui/table/table-header.svelte +20 -20
- package/dist/components/ui/table/table-row.svelte +15 -15
- package/dist/components/ui/table/table.svelte +17 -17
- package/dist/components/ui/tabs/tabs-content.svelte +17 -17
- package/dist/components/ui/tabs/tabs-list.svelte +40 -40
- package/dist/components/ui/tabs/tabs-trigger.svelte +23 -23
- package/dist/components/ui/tabs/tabs.svelte +19 -19
- package/dist/globals.css +143 -15
- package/dist/hooks/responsive.svelte.d.ts +1 -1
- package/dist/hooks/responsive.svelte.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/styles/globals.css +149 -149
- package/package.json +113 -113
- package/dist/components/core/carousel/shared/ui/SimpleBadgeCarousel.svelte.d.ts +0 -4
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
/**
|
|
3
|
-
* @component PageLogin
|
|
4
|
-
* Main login page. Routes to the specified layout variant.
|
|
5
|
-
*
|
|
6
|
-
* @example svelte
|
|
7
|
-
* <PageLogin varient="01" formType="EMAIL_PASSWORD" onSubmit={(cred) => login(cred)} />
|
|
8
|
-
*/
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<script lang="ts">
|
|
12
|
-
import type { PageLoginProps } from "./types";
|
|
13
|
-
import PageLogin01 from "./01/ui/PageLogin01.svelte";
|
|
14
|
-
|
|
15
|
-
type Props = {
|
|
16
|
-
variant?: 1;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
let { ...props }: PageLoginProps & Props = $props();
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<PageLogin01 {...props} />
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
/**
|
|
3
|
+
* @component PageLogin
|
|
4
|
+
* Main login page. Routes to the specified layout variant.
|
|
5
|
+
*
|
|
6
|
+
* @example svelte
|
|
7
|
+
* <PageLogin varient="01" formType="EMAIL_PASSWORD" onSubmit={(cred) => login(cred)} />
|
|
8
|
+
*/
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import type { PageLoginProps } from "./types";
|
|
13
|
+
import PageLogin01 from "./01/ui/PageLogin01.svelte";
|
|
14
|
+
|
|
15
|
+
type Props = {
|
|
16
|
+
variant?: 1;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
let { ...props }: PageLoginProps & Props = $props();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<PageLogin01 {...props} />
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import { type VariantProps, tv } from "tailwind-variants";
|
|
3
|
-
|
|
4
|
-
export const badgeVariants = tv({
|
|
5
|
-
base: "h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap transition-colors focus-visible:ring-[3px] [&>svg]:pointer-events-none",
|
|
6
|
-
variants: {
|
|
7
|
-
variant: {
|
|
8
|
-
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
9
|
-
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
10
|
-
destructive: "bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",
|
|
11
|
-
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground bg-input/30",
|
|
12
|
-
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
13
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
defaultVariants: {
|
|
17
|
-
variant: "default",
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export type BadgeVariant = VariantProps<typeof badgeVariants>["variant"];
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<script lang="ts">
|
|
25
|
-
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
26
|
-
import { cn, type WithElementRef } from "../../../utils.js";
|
|
27
|
-
|
|
28
|
-
let {
|
|
29
|
-
ref = $bindable(null),
|
|
30
|
-
href,
|
|
31
|
-
class: className,
|
|
32
|
-
variant = "default",
|
|
33
|
-
children,
|
|
34
|
-
...restProps
|
|
35
|
-
}: WithElementRef<HTMLAnchorAttributes> & {
|
|
36
|
-
variant?: BadgeVariant;
|
|
37
|
-
} = $props();
|
|
38
|
-
</script>
|
|
39
|
-
|
|
40
|
-
<svelte:element
|
|
41
|
-
this={href ? "a" : "span"}
|
|
42
|
-
bind:this={ref}
|
|
43
|
-
data-slot="badge"
|
|
44
|
-
{href}
|
|
45
|
-
class={cn(badgeVariants({ variant }), className)}
|
|
46
|
-
{...restProps}
|
|
47
|
-
>
|
|
48
|
-
{@render children?.()}
|
|
49
|
-
</svelte:element>
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { type VariantProps, tv } from "tailwind-variants";
|
|
3
|
+
|
|
4
|
+
export const badgeVariants = tv({
|
|
5
|
+
base: "h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap transition-colors focus-visible:ring-[3px] [&>svg]:pointer-events-none",
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
9
|
+
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
10
|
+
destructive: "bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",
|
|
11
|
+
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground bg-input/30",
|
|
12
|
+
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
13
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
variant: "default",
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type BadgeVariant = VariantProps<typeof badgeVariants>["variant"];
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<script lang="ts">
|
|
25
|
+
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
26
|
+
import { cn, type WithElementRef } from "../../../utils.js";
|
|
27
|
+
|
|
28
|
+
let {
|
|
29
|
+
ref = $bindable(null),
|
|
30
|
+
href,
|
|
31
|
+
class: className,
|
|
32
|
+
variant = "default",
|
|
33
|
+
children,
|
|
34
|
+
...restProps
|
|
35
|
+
}: WithElementRef<HTMLAnchorAttributes> & {
|
|
36
|
+
variant?: BadgeVariant;
|
|
37
|
+
} = $props();
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<svelte:element
|
|
41
|
+
this={href ? "a" : "span"}
|
|
42
|
+
bind:this={ref}
|
|
43
|
+
data-slot="badge"
|
|
44
|
+
{href}
|
|
45
|
+
class={cn(badgeVariants({ variant }), className)}
|
|
46
|
+
{...restProps}
|
|
47
|
+
>
|
|
48
|
+
{@render children?.()}
|
|
49
|
+
</svelte:element>
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import { type VariantProps, tv } from "tailwind-variants";
|
|
3
|
-
import { cn, type WithElementRef } from "../../../utils.js";
|
|
4
|
-
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
export const buttonVariants = tv({
|
|
7
|
-
base: "rounded-sm border border-transparent bg-clip-padding text-sm font-medium focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
8
|
-
variants: {
|
|
9
|
-
variant: {
|
|
10
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
11
|
-
outline: "border-border bg-input/30 hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground",
|
|
12
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
13
|
-
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
14
|
-
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
15
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
16
|
-
},
|
|
17
|
-
size: {
|
|
18
|
-
default: "h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5",
|
|
19
|
-
xs: "h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3",
|
|
20
|
-
sm: "h-8 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
21
|
-
lg: "h-10 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
|
|
22
|
-
icon: "size-9",
|
|
23
|
-
"icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3",
|
|
24
|
-
"icon-sm": "size-8",
|
|
25
|
-
"icon-lg": "size-10",
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
defaultVariants: {
|
|
29
|
-
variant: "default",
|
|
30
|
-
size: "default",
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
export type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
|
|
35
|
-
export type ButtonSize = VariantProps<typeof buttonVariants>["size"];
|
|
36
|
-
|
|
37
|
-
export type ButtonProps = WithElementRef<HTMLButtonAttributes> &
|
|
38
|
-
WithElementRef<HTMLAnchorAttributes> & {
|
|
39
|
-
variant?: ButtonVariant;
|
|
40
|
-
size?: ButtonSize;
|
|
41
|
-
};
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
<script lang="ts">
|
|
45
|
-
let {
|
|
46
|
-
class: className,
|
|
47
|
-
variant = "default",
|
|
48
|
-
size = "default",
|
|
49
|
-
ref = $bindable(null),
|
|
50
|
-
href = undefined,
|
|
51
|
-
type = "button",
|
|
52
|
-
disabled,
|
|
53
|
-
children,
|
|
54
|
-
...restProps
|
|
55
|
-
}: ButtonProps = $props();
|
|
56
|
-
</script>
|
|
57
|
-
|
|
58
|
-
{#if href}
|
|
59
|
-
<a
|
|
60
|
-
bind:this={ref}
|
|
61
|
-
data-slot="button"
|
|
62
|
-
class={cn(buttonVariants({ variant, size }), className)}
|
|
63
|
-
href={disabled ? undefined : href}
|
|
64
|
-
aria-disabled={disabled}
|
|
65
|
-
role={disabled ? "link" : undefined}
|
|
66
|
-
tabindex={disabled ? -1 : undefined}
|
|
67
|
-
{...restProps}
|
|
68
|
-
>
|
|
69
|
-
{@render children?.()}
|
|
70
|
-
</a>
|
|
71
|
-
{:else}
|
|
72
|
-
<button
|
|
73
|
-
bind:this={ref}
|
|
74
|
-
data-slot="button"
|
|
75
|
-
class={cn(buttonVariants({ variant, size }), className)}
|
|
76
|
-
{type}
|
|
77
|
-
{disabled}
|
|
78
|
-
{...restProps}
|
|
79
|
-
>
|
|
80
|
-
{@render children?.()}
|
|
81
|
-
</button>
|
|
82
|
-
{/if}
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { type VariantProps, tv } from "tailwind-variants";
|
|
3
|
+
import { cn, type WithElementRef } from "../../../utils.js";
|
|
4
|
+
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from "svelte/elements";
|
|
5
|
+
|
|
6
|
+
export const buttonVariants = tv({
|
|
7
|
+
base: "rounded-sm border border-transparent bg-clip-padding text-sm font-medium focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
11
|
+
outline: "border-border bg-input/30 hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground",
|
|
12
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
13
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
14
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
15
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
default: "h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5",
|
|
19
|
+
xs: "h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3",
|
|
20
|
+
sm: "h-8 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
21
|
+
lg: "h-10 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
|
|
22
|
+
icon: "size-9",
|
|
23
|
+
"icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3",
|
|
24
|
+
"icon-sm": "size-8",
|
|
25
|
+
"icon-lg": "size-10",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
variant: "default",
|
|
30
|
+
size: "default",
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
|
|
35
|
+
export type ButtonSize = VariantProps<typeof buttonVariants>["size"];
|
|
36
|
+
|
|
37
|
+
export type ButtonProps = WithElementRef<HTMLButtonAttributes> &
|
|
38
|
+
WithElementRef<HTMLAnchorAttributes> & {
|
|
39
|
+
variant?: ButtonVariant;
|
|
40
|
+
size?: ButtonSize;
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<script lang="ts">
|
|
45
|
+
let {
|
|
46
|
+
class: className,
|
|
47
|
+
variant = "default",
|
|
48
|
+
size = "default",
|
|
49
|
+
ref = $bindable(null),
|
|
50
|
+
href = undefined,
|
|
51
|
+
type = "button",
|
|
52
|
+
disabled,
|
|
53
|
+
children,
|
|
54
|
+
...restProps
|
|
55
|
+
}: ButtonProps = $props();
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
{#if href}
|
|
59
|
+
<a
|
|
60
|
+
bind:this={ref}
|
|
61
|
+
data-slot="button"
|
|
62
|
+
class={cn(buttonVariants({ variant, size }), className)}
|
|
63
|
+
href={disabled ? undefined : href}
|
|
64
|
+
aria-disabled={disabled}
|
|
65
|
+
role={disabled ? "link" : undefined}
|
|
66
|
+
tabindex={disabled ? -1 : undefined}
|
|
67
|
+
{...restProps}
|
|
68
|
+
>
|
|
69
|
+
{@render children?.()}
|
|
70
|
+
</a>
|
|
71
|
+
{:else}
|
|
72
|
+
<button
|
|
73
|
+
bind:this={ref}
|
|
74
|
+
data-slot="button"
|
|
75
|
+
class={cn(buttonVariants({ variant, size }), className)}
|
|
76
|
+
{type}
|
|
77
|
+
{disabled}
|
|
78
|
+
{...restProps}
|
|
79
|
+
>
|
|
80
|
+
{@render children?.()}
|
|
81
|
+
</button>
|
|
82
|
+
{/if}
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { cn, type WithElementRef } from "../../../utils.js";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
import ChartStyle from "./chart-style.svelte";
|
|
5
|
-
import { setChartContext, type ChartConfig } from "./chart-utils.js";
|
|
6
|
-
|
|
7
|
-
const uid = $props.id();
|
|
8
|
-
|
|
9
|
-
let {
|
|
10
|
-
ref = $bindable(null),
|
|
11
|
-
id = uid,
|
|
12
|
-
class: className,
|
|
13
|
-
children,
|
|
14
|
-
config,
|
|
15
|
-
...restProps
|
|
16
|
-
}: WithElementRef<HTMLAttributes<HTMLElement>> & {
|
|
17
|
-
config: ChartConfig;
|
|
18
|
-
} = $props();
|
|
19
|
-
|
|
20
|
-
const chartId = $derived(`chart-${id || uid.replace(/:/g, "")}`);
|
|
21
|
-
|
|
22
|
-
setChartContext({
|
|
23
|
-
get config() {
|
|
24
|
-
return config;
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<div
|
|
30
|
-
bind:this={ref}
|
|
31
|
-
data-chart={chartId}
|
|
32
|
-
data-slot="chart"
|
|
33
|
-
class={cn(
|
|
34
|
-
"flex aspect-video justify-center overflow-visible text-xs",
|
|
35
|
-
// Overrides
|
|
36
|
-
//
|
|
37
|
-
// Stroke around dots/marks when hovering
|
|
38
|
-
"[&_.lc-highlight-point]:stroke-transparent",
|
|
39
|
-
// override the default stroke color of lines
|
|
40
|
-
"[&_.lc-line]:stroke-border/50",
|
|
41
|
-
|
|
42
|
-
// by default, layerchart shows a line intersecting the point when hovering, this hides that
|
|
43
|
-
"[&_.lc-highlight-line]:stroke-0",
|
|
44
|
-
|
|
45
|
-
// by default, when you hover a point on a stacked series chart, it will drop the opacity
|
|
46
|
-
// of the other series, this overrides that
|
|
47
|
-
"[&_.lc-area-path]:opacity-100 [&_.lc-highlight-line]:opacity-100 [&_.lc-highlight-point]:opacity-100 [&_.lc-spline-path]:opacity-100 [&_.lc-text]:text-xs [&_.lc-text-svg]:overflow-visible",
|
|
48
|
-
|
|
49
|
-
// We don't want the little tick lines between the axis labels and the chart, so we remove
|
|
50
|
-
// the stroke. The alternative is to manually disable `tickMarks` on the x/y axis of every
|
|
51
|
-
// chart.
|
|
52
|
-
"[&_.lc-axis-tick]:stroke-0",
|
|
53
|
-
|
|
54
|
-
// We don't want to display the rule on the x/y axis, as there is already going to be
|
|
55
|
-
// a grid line there and rule ends up overlapping the marks because it is rendered after
|
|
56
|
-
// the marks
|
|
57
|
-
"[&_.lc-rule-x-line:not(.lc-grid-x-rule)]:stroke-0 [&_.lc-rule-y-line:not(.lc-grid-y-rule)]:stroke-0",
|
|
58
|
-
"[&_.lc-grid-x-radial-line]:stroke-border [&_.lc-grid-x-radial-circle]:stroke-border",
|
|
59
|
-
"[&_.lc-grid-y-radial-line]:stroke-border [&_.lc-grid-y-radial-circle]:stroke-border",
|
|
60
|
-
|
|
61
|
-
// Legend adjustments
|
|
62
|
-
"[&_.lc-legend-swatch-button]:items-center [&_.lc-legend-swatch-button]:gap-1.5",
|
|
63
|
-
"[&_.lc-legend-swatch-group]:items-center [&_.lc-legend-swatch-group]:gap-4",
|
|
64
|
-
"[&_.lc-legend-swatch]:size-2.5 [&_.lc-legend-swatch]:rounded-[2px]",
|
|
65
|
-
|
|
66
|
-
// Labels
|
|
67
|
-
"[&_.lc-labels-text:not([fill])]:fill-foreground [&_text]:stroke-transparent",
|
|
68
|
-
|
|
69
|
-
// Tick labels on th x/y axes
|
|
70
|
-
"[&_.lc-axis-tick-label]:fill-muted-foreground [&_.lc-axis-tick-label]:font-normal",
|
|
71
|
-
"[&_.lc-tooltip-rects-g]:fill-transparent",
|
|
72
|
-
"[&_.lc-layout-svg-g]:fill-transparent",
|
|
73
|
-
"[&_.lc-root-container]:w-full",
|
|
74
|
-
className
|
|
75
|
-
)}
|
|
76
|
-
{...restProps}
|
|
77
|
-
>
|
|
78
|
-
<ChartStyle id={chartId} {config} />
|
|
79
|
-
{@render children?.()}
|
|
80
|
-
</div>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from "../../../utils.js";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import ChartStyle from "./chart-style.svelte";
|
|
5
|
+
import { setChartContext, type ChartConfig } from "./chart-utils.js";
|
|
6
|
+
|
|
7
|
+
const uid = $props.id();
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
ref = $bindable(null),
|
|
11
|
+
id = uid,
|
|
12
|
+
class: className,
|
|
13
|
+
children,
|
|
14
|
+
config,
|
|
15
|
+
...restProps
|
|
16
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> & {
|
|
17
|
+
config: ChartConfig;
|
|
18
|
+
} = $props();
|
|
19
|
+
|
|
20
|
+
const chartId = $derived(`chart-${id || uid.replace(/:/g, "")}`);
|
|
21
|
+
|
|
22
|
+
setChartContext({
|
|
23
|
+
get config() {
|
|
24
|
+
return config;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<div
|
|
30
|
+
bind:this={ref}
|
|
31
|
+
data-chart={chartId}
|
|
32
|
+
data-slot="chart"
|
|
33
|
+
class={cn(
|
|
34
|
+
"flex aspect-video justify-center overflow-visible text-xs",
|
|
35
|
+
// Overrides
|
|
36
|
+
//
|
|
37
|
+
// Stroke around dots/marks when hovering
|
|
38
|
+
"[&_.lc-highlight-point]:stroke-transparent",
|
|
39
|
+
// override the default stroke color of lines
|
|
40
|
+
"[&_.lc-line]:stroke-border/50",
|
|
41
|
+
|
|
42
|
+
// by default, layerchart shows a line intersecting the point when hovering, this hides that
|
|
43
|
+
"[&_.lc-highlight-line]:stroke-0",
|
|
44
|
+
|
|
45
|
+
// by default, when you hover a point on a stacked series chart, it will drop the opacity
|
|
46
|
+
// of the other series, this overrides that
|
|
47
|
+
"[&_.lc-area-path]:opacity-100 [&_.lc-highlight-line]:opacity-100 [&_.lc-highlight-point]:opacity-100 [&_.lc-spline-path]:opacity-100 [&_.lc-text]:text-xs [&_.lc-text-svg]:overflow-visible",
|
|
48
|
+
|
|
49
|
+
// We don't want the little tick lines between the axis labels and the chart, so we remove
|
|
50
|
+
// the stroke. The alternative is to manually disable `tickMarks` on the x/y axis of every
|
|
51
|
+
// chart.
|
|
52
|
+
"[&_.lc-axis-tick]:stroke-0",
|
|
53
|
+
|
|
54
|
+
// We don't want to display the rule on the x/y axis, as there is already going to be
|
|
55
|
+
// a grid line there and rule ends up overlapping the marks because it is rendered after
|
|
56
|
+
// the marks
|
|
57
|
+
"[&_.lc-rule-x-line:not(.lc-grid-x-rule)]:stroke-0 [&_.lc-rule-y-line:not(.lc-grid-y-rule)]:stroke-0",
|
|
58
|
+
"[&_.lc-grid-x-radial-line]:stroke-border [&_.lc-grid-x-radial-circle]:stroke-border",
|
|
59
|
+
"[&_.lc-grid-y-radial-line]:stroke-border [&_.lc-grid-y-radial-circle]:stroke-border",
|
|
60
|
+
|
|
61
|
+
// Legend adjustments
|
|
62
|
+
"[&_.lc-legend-swatch-button]:items-center [&_.lc-legend-swatch-button]:gap-1.5",
|
|
63
|
+
"[&_.lc-legend-swatch-group]:items-center [&_.lc-legend-swatch-group]:gap-4",
|
|
64
|
+
"[&_.lc-legend-swatch]:size-2.5 [&_.lc-legend-swatch]:rounded-[2px]",
|
|
65
|
+
|
|
66
|
+
// Labels
|
|
67
|
+
"[&_.lc-labels-text:not([fill])]:fill-foreground [&_text]:stroke-transparent",
|
|
68
|
+
|
|
69
|
+
// Tick labels on th x/y axes
|
|
70
|
+
"[&_.lc-axis-tick-label]:fill-muted-foreground [&_.lc-axis-tick-label]:font-normal",
|
|
71
|
+
"[&_.lc-tooltip-rects-g]:fill-transparent",
|
|
72
|
+
"[&_.lc-layout-svg-g]:fill-transparent",
|
|
73
|
+
"[&_.lc-root-container]:w-full",
|
|
74
|
+
className
|
|
75
|
+
)}
|
|
76
|
+
{...restProps}
|
|
77
|
+
>
|
|
78
|
+
<ChartStyle id={chartId} {config} />
|
|
79
|
+
{@render children?.()}
|
|
80
|
+
</div>
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { THEMES, type ChartConfig } from "./chart-utils.js";
|
|
3
|
-
|
|
4
|
-
let { id, config }: { id: string; config: ChartConfig } = $props();
|
|
5
|
-
|
|
6
|
-
const colorConfig = $derived(
|
|
7
|
-
config ? Object.entries(config).filter(([, config]) => config.theme || config.color) : null
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
const themeContents = $derived.by(() => {
|
|
11
|
-
if (!colorConfig || !colorConfig.length) return;
|
|
12
|
-
|
|
13
|
-
const themeContents = [];
|
|
14
|
-
for (const [_theme, prefix] of Object.entries(THEMES)) {
|
|
15
|
-
let content = `${prefix} [data-chart=${id}] {\n`;
|
|
16
|
-
const color = colorConfig.map(([key, itemConfig]) => {
|
|
17
|
-
const theme = _theme as keyof typeof itemConfig.theme;
|
|
18
|
-
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
19
|
-
return color ? `\t--color-${key}: ${color};` : null;
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
content += color.join("\n") + "\n}";
|
|
23
|
-
|
|
24
|
-
themeContents.push(content);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return themeContents.join("\n");
|
|
28
|
-
});
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
|
-
{#if themeContents}
|
|
32
|
-
{#key id}
|
|
33
|
-
<svelte:element this={"style"}>
|
|
34
|
-
{themeContents}
|
|
35
|
-
</svelte:element>
|
|
36
|
-
{/key}
|
|
37
|
-
{/if}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { THEMES, type ChartConfig } from "./chart-utils.js";
|
|
3
|
+
|
|
4
|
+
let { id, config }: { id: string; config: ChartConfig } = $props();
|
|
5
|
+
|
|
6
|
+
const colorConfig = $derived(
|
|
7
|
+
config ? Object.entries(config).filter(([, config]) => config.theme || config.color) : null
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
const themeContents = $derived.by(() => {
|
|
11
|
+
if (!colorConfig || !colorConfig.length) return;
|
|
12
|
+
|
|
13
|
+
const themeContents = [];
|
|
14
|
+
for (const [_theme, prefix] of Object.entries(THEMES)) {
|
|
15
|
+
let content = `${prefix} [data-chart=${id}] {\n`;
|
|
16
|
+
const color = colorConfig.map(([key, itemConfig]) => {
|
|
17
|
+
const theme = _theme as keyof typeof itemConfig.theme;
|
|
18
|
+
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
19
|
+
return color ? `\t--color-${key}: ${color};` : null;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
content += color.join("\n") + "\n}";
|
|
23
|
+
|
|
24
|
+
themeContents.push(content);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return themeContents.join("\n");
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
{#if themeContents}
|
|
32
|
+
{#key id}
|
|
33
|
+
<svelte:element this={"style"}>
|
|
34
|
+
{themeContents}
|
|
35
|
+
</svelte:element>
|
|
36
|
+
{/key}
|
|
37
|
+
{/if}
|