negodesign 0.0.1 → 0.0.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/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/carousel/data/CarouselModel.d.ts +2 -1
- 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 +144 -144
- 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.svelte +22 -22
- package/dist/components/core/form/ui/input-password-confirm.svelte +22 -22
- package/dist/components/core/form/ui/input-password.svelte +22 -22
- package/dist/components/core/form/ui/input-phone.svelte +22 -0
- package/dist/components/core/form/ui/input-phone.svelte.d.ts +4 -0
- package/dist/components/core/form/ui/input-username.svelte +21 -21
- 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/nav-menu-bar.svelte +97 -97
- package/dist/components/core/nav/ui/nav-menu-bottom-bar.svelte +33 -33
- package/dist/components/core/nav/ui/nav-menu-top-bar.svelte +103 -103
- package/dist/components/core/sidebar/menu-bar-sidebar.svelte +62 -62
- package/dist/components/core/tabs/ui/tab-underline.svelte +41 -41
- package/dist/components/pages/admin/ui/admin-content.svelte +13 -13
- package/dist/components/pages/admin/ui/admin-panel.svelte +40 -40
- package/dist/components/pages/login/admin/01/data/page-props.d.ts +10 -0
- package/dist/components/pages/login/admin/01/data/page-props.js +1 -0
- package/dist/components/pages/login/admin/01/ui/AuthCard.svelte +84 -58
- package/dist/components/pages/login/admin/01/ui/AuthCard.svelte.d.ts +11 -17
- package/dist/components/pages/login/admin/01/ui/FormLogin.svelte +25 -5
- package/dist/components/pages/login/admin/01/ui/FormLogin.svelte.d.ts +6 -1
- package/dist/components/pages/login/admin/01/ui/FormLoginEmailPassword.svelte +12 -0
- package/dist/components/pages/login/admin/01/ui/FormLoginEmailPassword.svelte.d.ts +7 -0
- package/dist/components/pages/login/admin/01/ui/FormLoginPhonePassword.svelte +12 -0
- package/dist/components/pages/login/admin/01/ui/FormLoginPhonePassword.svelte.d.ts +7 -0
- package/dist/components/pages/login/admin/01/ui/FormLoginUsernamePassword.svelte +12 -0
- package/dist/components/pages/login/admin/01/ui/FormLoginUsernamePassword.svelte.d.ts +7 -0
- package/dist/components/pages/login/admin/01/ui/FormRegister.svelte +28 -28
- package/dist/components/pages/login/admin/01/ui/LeftHero.svelte +105 -105
- package/dist/components/pages/login/admin/01/ui/PageLogin.svelte +47 -49
- package/dist/components/pages/login/admin/01/ui/PageLogin.svelte.d.ts +14 -17
- package/dist/components/ui/badge/badge.svelte +49 -49
- 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/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/index.js +0 -1
- package/package.json +94 -88
|
@@ -1,49 +1,47 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
</style>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type {
|
|
3
|
+
CarouselItem,
|
|
4
|
+
CarouselItemType,
|
|
5
|
+
} from "../../../../../core/carousel/data/CarouselModel";
|
|
6
|
+
import type { Snippet } from "svelte";
|
|
7
|
+
import AuthCard from "./AuthCard.svelte";
|
|
8
|
+
import LeftHero from "./LeftHero.svelte";
|
|
9
|
+
import type { AuthFormType, LinkProps } from "../data/page-props";
|
|
10
|
+
|
|
11
|
+
type Props = {
|
|
12
|
+
carousel?: CarouselItem[];
|
|
13
|
+
varient?: CarouselItemType;
|
|
14
|
+
title?: string;
|
|
15
|
+
children?: Snippet;
|
|
16
|
+
formType?: AuthFormType;
|
|
17
|
+
privacyPolicy?: LinkProps;
|
|
18
|
+
termsOfService?: LinkProps;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
let { carousel, varient, title, formType, children, privacyPolicy, termsOfService }: Props = $props();
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<main class="h-screen w-screen flex items-center">
|
|
25
|
+
<div class="hidden md:block md:w-8/12">
|
|
26
|
+
<LeftHero {title} varient={varient ?? "POINTER"} items={carousel ?? []} />
|
|
27
|
+
</div>
|
|
28
|
+
<div class="w-full md:px-0 md:w-4/12 border-gray-900">
|
|
29
|
+
{#if children}
|
|
30
|
+
{@render children()}
|
|
31
|
+
{:else}
|
|
32
|
+
<AuthCard {formType} {privacyPolicy} {termsOfService} />
|
|
33
|
+
{/if}
|
|
34
|
+
</div>
|
|
35
|
+
</main>
|
|
36
|
+
|
|
37
|
+
<style>
|
|
38
|
+
:global(.grid-pattern) {
|
|
39
|
+
background-size: 40px 40px;
|
|
40
|
+
background-image: linear-gradient(
|
|
41
|
+
to right,
|
|
42
|
+
rgba(0, 0, 0, 0.1) 1px,
|
|
43
|
+
transparent 1px
|
|
44
|
+
),
|
|
45
|
+
linear-gradient(to bottom, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
[evt: string]: CustomEvent<any>;
|
|
16
|
-
}, {}, {}, string>;
|
|
17
|
-
type PageLogin = InstanceType<typeof PageLogin>;
|
|
1
|
+
import type { CarouselItem, CarouselItemType } from "../../../../../core/carousel/data/CarouselModel";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { AuthFormType, LinkProps } from "../data/page-props";
|
|
4
|
+
type Props = {
|
|
5
|
+
carousel?: CarouselItem[];
|
|
6
|
+
varient?: CarouselItemType;
|
|
7
|
+
title?: string;
|
|
8
|
+
children?: Snippet;
|
|
9
|
+
formType?: AuthFormType;
|
|
10
|
+
privacyPolicy?: LinkProps;
|
|
11
|
+
termsOfService?: LinkProps;
|
|
12
|
+
};
|
|
13
|
+
declare const PageLogin: import("svelte").Component<Props, {}, "">;
|
|
14
|
+
type PageLogin = ReturnType<typeof PageLogin>;
|
|
18
15
|
export default PageLogin;
|
|
@@ -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,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}
|