negodesign 0.0.1 → 0.0.3

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.
Files changed (115) hide show
  1. package/dist/components/core/breadcrumb/breadcrumb-list.svelte +31 -31
  2. package/dist/components/core/button/ButtonBack.svelte +18 -18
  3. package/dist/components/core/button/ButtonLogin.svelte +15 -15
  4. package/dist/components/core/button/ButtonLoginWith.svelte +57 -57
  5. package/dist/components/core/carousel/data/CarouselModel.d.ts +2 -1
  6. package/dist/components/core/datatable/ui/DataTableActions.svelte +28 -28
  7. package/dist/components/core/datatable/ui/DataTableCheckbox.svelte +22 -22
  8. package/dist/components/core/datatable/ui/DataTableContent.svelte +59 -59
  9. package/dist/components/core/datatable/ui/DataTableCore.svelte +151 -144
  10. package/dist/components/core/datatable/ui/DataTableDragHandle.svelte +8 -8
  11. package/dist/components/core/datatable/ui/DataTableListFilter.svelte +59 -59
  12. package/dist/components/core/datatable/ui/DataTableListPagination.svelte +35 -35
  13. package/dist/components/core/form/ui/input-base.svelte +81 -81
  14. package/dist/components/core/form/ui/input-email.svelte +23 -22
  15. package/dist/components/core/form/ui/input-password-confirm.svelte +23 -22
  16. package/dist/components/core/form/ui/input-password.svelte +23 -22
  17. package/dist/components/core/form/ui/input-phone.svelte +23 -0
  18. package/dist/components/core/form/ui/input-phone.svelte.d.ts +4 -0
  19. package/dist/components/core/form/ui/input-username.svelte +22 -21
  20. package/dist/components/core/label/LabelOr.svelte +25 -25
  21. package/dist/components/core/link/link-forget-password.svelte +12 -12
  22. package/dist/components/core/link/link-privacy-polity.svelte +12 -12
  23. package/dist/components/core/link/link-terms-of-service.svelte +12 -12
  24. package/dist/components/core/nav/ui/nav-menu-bar.svelte +97 -97
  25. package/dist/components/core/nav/ui/nav-menu-bottom-bar.svelte +33 -33
  26. package/dist/components/core/nav/ui/nav-menu-top-bar.svelte +103 -103
  27. package/dist/components/core/sidebar/{menu-bar-sidebar.svelte → MenuBarSidebar.svelte} +70 -62
  28. package/dist/components/core/sidebar/{menu-bar-sidebar.svelte.d.ts → MenuBarSidebar.svelte.d.ts} +8 -0
  29. package/dist/components/core/tabs/ui/tab-underline.svelte +41 -41
  30. package/dist/components/pages/admin/ui/{admin-content.svelte → AdminContent.svelte} +14 -13
  31. package/dist/components/pages/admin/ui/{admin-content.svelte.d.ts → AdminContent.svelte.d.ts} +1 -0
  32. package/dist/components/pages/admin/ui/{admin-panel.svelte → AdminPanel.svelte} +46 -40
  33. package/dist/components/pages/admin/ui/{admin-panel.svelte.d.ts → AdminPanel.svelte.d.ts} +6 -0
  34. package/dist/components/pages/login/01/data/page-props.d.ts +21 -0
  35. package/dist/components/pages/login/01/data/page-props.js +1 -0
  36. package/dist/components/pages/login/01/ui/AuthCard.svelte +91 -0
  37. package/dist/components/pages/login/01/ui/AuthCard.svelte.d.ts +20 -0
  38. package/dist/components/pages/login/01/ui/FormLogin.svelte +56 -0
  39. package/dist/components/pages/login/01/ui/FormLogin.svelte.d.ts +13 -0
  40. package/dist/components/pages/login/01/ui/FormLoginEmailPassword.svelte +13 -0
  41. package/dist/components/pages/login/01/ui/FormLoginEmailPassword.svelte.d.ts +8 -0
  42. package/dist/components/pages/login/01/ui/FormLoginPhonePassword.svelte +13 -0
  43. package/dist/components/pages/login/01/ui/FormLoginPhonePassword.svelte.d.ts +8 -0
  44. package/dist/components/pages/login/01/ui/FormLoginUsernamePassword.svelte +13 -0
  45. package/dist/components/pages/login/01/ui/FormLoginUsernamePassword.svelte.d.ts +8 -0
  46. package/dist/components/pages/login/{admin/01 → 01}/ui/FormRegister.svelte +28 -28
  47. package/dist/components/pages/login/{admin/01 → 01}/ui/LeftHero.svelte +105 -105
  48. package/dist/components/pages/login/{admin/01 → 01}/ui/LeftHero.svelte.d.ts +1 -1
  49. package/dist/components/pages/login/01/ui/PageLogin01.svelte +49 -0
  50. package/dist/components/pages/login/01/ui/PageLogin01.svelte.d.ts +4 -0
  51. package/dist/components/pages/login/PageLogin.svelte +21 -0
  52. package/dist/components/pages/login/PageLogin.svelte.d.ts +17 -0
  53. package/dist/components/ui/badge/badge.svelte +49 -49
  54. package/dist/components/ui/chart/chart-container.svelte +80 -80
  55. package/dist/components/ui/chart/chart-style.svelte +37 -37
  56. package/dist/components/ui/chart/chart-tooltip.svelte +184 -184
  57. package/dist/components/ui/checkbox/checkbox.svelte +40 -40
  58. package/dist/components/ui/checkbox/checkbox.svelte.d.ts +1 -1
  59. package/dist/components/ui/data-table/flex-render.svelte +40 -40
  60. package/dist/components/ui/drawer/drawer-close.svelte +7 -7
  61. package/dist/components/ui/drawer/drawer-content.svelte +33 -33
  62. package/dist/components/ui/drawer/drawer-description.svelte +17 -17
  63. package/dist/components/ui/drawer/drawer-footer.svelte +20 -20
  64. package/dist/components/ui/drawer/drawer-header.svelte +20 -20
  65. package/dist/components/ui/drawer/drawer-nested.svelte +12 -12
  66. package/dist/components/ui/drawer/drawer-overlay.svelte +17 -17
  67. package/dist/components/ui/drawer/drawer-portal.svelte +7 -7
  68. package/dist/components/ui/drawer/drawer-title.svelte +17 -17
  69. package/dist/components/ui/drawer/drawer-trigger.svelte +7 -7
  70. package/dist/components/ui/drawer/drawer.svelte +12 -12
  71. package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte.d.ts +1 -1
  72. package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte.d.ts +1 -1
  73. package/dist/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte.d.ts +1 -1
  74. package/dist/components/ui/input/input.svelte.d.ts +1 -1
  75. package/dist/components/ui/select/select-content.svelte +45 -45
  76. package/dist/components/ui/select/select-group-heading.svelte +21 -21
  77. package/dist/components/ui/select/select-group.svelte +17 -17
  78. package/dist/components/ui/select/select-item.svelte +41 -41
  79. package/dist/components/ui/select/select-label.svelte +20 -20
  80. package/dist/components/ui/select/select-portal.svelte +7 -7
  81. package/dist/components/ui/select/select-scroll-down-button.svelte +21 -21
  82. package/dist/components/ui/select/select-scroll-up-button.svelte +21 -21
  83. package/dist/components/ui/select/select-separator.svelte +18 -18
  84. package/dist/components/ui/select/select-trigger.svelte +30 -30
  85. package/dist/components/ui/select/select.svelte +11 -11
  86. package/dist/components/ui/sidebar/sidebar-input.svelte.d.ts +2 -2
  87. package/dist/components/ui/sidebar/sidebar-menu-sub-button.svelte +39 -39
  88. package/dist/components/ui/table/table-body.svelte +15 -15
  89. package/dist/components/ui/table/table-caption.svelte +20 -20
  90. package/dist/components/ui/table/table-cell.svelte +15 -15
  91. package/dist/components/ui/table/table-footer.svelte +20 -20
  92. package/dist/components/ui/table/table-head.svelte +15 -15
  93. package/dist/components/ui/table/table-header.svelte +20 -20
  94. package/dist/components/ui/table/table-row.svelte +15 -15
  95. package/dist/components/ui/table/table.svelte +17 -17
  96. package/dist/components/ui/tabs/tabs-content.svelte +17 -17
  97. package/dist/components/ui/tabs/tabs-list.svelte +40 -40
  98. package/dist/components/ui/tabs/tabs-trigger.svelte +23 -23
  99. package/dist/components/ui/tabs/tabs.svelte +19 -19
  100. package/dist/components/ui/tabs/tabs.svelte.d.ts +1 -1
  101. package/dist/components/ui/underline-tabs/underline-tabs.svelte.d.ts +1 -1
  102. package/dist/index.d.ts +30 -0
  103. package/dist/index.js +30 -2
  104. package/package.json +94 -88
  105. package/dist/components/pages/login/admin/01/ui/AuthCard.svelte +0 -58
  106. package/dist/components/pages/login/admin/01/ui/AuthCard.svelte.d.ts +0 -18
  107. package/dist/components/pages/login/admin/01/ui/FormLogin.svelte +0 -31
  108. package/dist/components/pages/login/admin/01/ui/FormLogin.svelte.d.ts +0 -3
  109. package/dist/components/pages/login/admin/01/ui/PageLogin.svelte +0 -49
  110. package/dist/components/pages/login/admin/01/ui/PageLogin.svelte.d.ts +0 -18
  111. package/dist/components/pages/login/admin/index.d.ts +0 -0
  112. package/dist/components/pages/login/admin/index.js +0 -1
  113. package/dist/components/pages/login/index.d.ts +0 -0
  114. package/dist/components/pages/login/index.js +0 -1
  115. /package/dist/components/pages/login/{admin/01 → 01}/ui/FormRegister.svelte.d.ts +0 -0
@@ -1,105 +1,105 @@
1
- <script lang="ts">
2
- import { HugeiconsIcon } from "@hugeicons/svelte";
3
- import { ArrowRight01Icon } from "@hugeicons/core-free-icons";
4
- import type { CarouselProps } from "../../../../../core/carousel/data/CarouselModel";
5
- import type { Snippet } from "svelte";
6
- import Button from "../../../../../ui/button/button.svelte";
7
-
8
- type Props = {
9
- title?: string | Snippet;
10
- variant?: "NUMBER" | "DOT";
11
- autoPlayInterval?: number;
12
- };
13
-
14
- let {
15
- title,
16
- items = [],
17
- variant = "DOT",
18
- autoPlayInterval = 5000,
19
- }: Props & CarouselProps = $props();
20
-
21
- let currentIndex = $state(0);
22
- let currentItem = $derived(items[currentIndex] ?? items[0]);
23
-
24
- function goTo(index: number) {
25
- currentIndex = index;
26
- }
27
-
28
- function next() {
29
- if (items.length === 0) return;
30
- currentIndex = (currentIndex + 1) % items.length;
31
- }
32
-
33
- $effect(() => {
34
- if (items.length <= 1) return;
35
- const timer = setInterval(next, autoPlayInterval);
36
- return () => clearInterval(timer);
37
- });
38
- </script>
39
-
40
- <div
41
- class="relative flex flex-col justify-between overflow-hidden h-screen p-8 bg-gradient-left text-white"
42
- >
43
- <div class="flex items-center gap-2">
44
- <div class="font-bold text-xl tracking-wider flex items-center gap-2">
45
- {#if typeof title === "function"}
46
- {@render title()}
47
- {:else}
48
- {title || ""}
49
- {/if}
50
- </div>
51
- </div>
52
-
53
- <section class="flex flex-col gap-5">
54
- <div class="my-auto max-w-sm md:max-w-md">
55
- {#if currentItem}
56
- {#key currentIndex}
57
- <div
58
- class="text-xl md:text-2xl font-bold tracking-tight mb-4 leading-tight animate-in fade-in duration-300"
59
- >
60
- {currentItem.title}
61
- </div>
62
- <p
63
- class=" text-sm mb-6 leading-relaxed animate-in fade-in duration-300"
64
- >
65
- {currentItem.description}
66
- </p>
67
- {/key}
68
- <Button
69
- variant="outline"
70
- class="inline-flex items-center gap-2 text-sm font-semibold bg-primary"
71
- >
72
- {currentItem.buttonText}
73
- <HugeiconsIcon icon={ArrowRight01Icon} size={16} />
74
- </Button>
75
- {/if}
76
- </div>
77
-
78
- <div class="flex items-center gap-2 mb-2">
79
- {#each items as it, i (it.title)}
80
- <button
81
- type="button"
82
- onclick={() => goTo(i)}
83
- aria-label={`Ir para o item ${i + 1}`}
84
- aria-current={currentIndex === i}
85
- class="transition-all duration-300 focus:outline-none flex items-center justify-center {currentIndex ===
86
- i
87
- ? 'opacity-100 scale-110'
88
- : 'opacity-50 hover:opacity-75'}"
89
- >
90
- {#if variant === "NUMBER"}
91
- <span
92
- class="w-6 h-6 text-xs font-semibold rounded-full text-primary flex items-center justify-center"
93
- >
94
- {i + 1}
95
- </span>
96
- {:else}
97
- <span class="w-2 h-2 rounded-full bg-white"></span>
98
- {/if}
99
- </button>
100
- {/each}
101
- </div>
102
- </section>
103
- </div>
104
-
105
- <aside class="absolute grid-pattern p-0 top-0 h-screen w-8/12"></aside>
1
+ <script lang="ts">
2
+ import { HugeiconsIcon } from "@hugeicons/svelte";
3
+ import { ArrowRight01Icon } from "@hugeicons/core-free-icons";
4
+ import type { CarouselProps } from "../../../../core/carousel/data/CarouselModel";
5
+ import type { Snippet } from "svelte";
6
+ import Button from "../../../../ui/button/button.svelte";
7
+
8
+ type Props = {
9
+ title?: string | Snippet;
10
+ variant?: "NUMBER" | "DOT";
11
+ autoPlayInterval?: number;
12
+ };
13
+
14
+ let {
15
+ title,
16
+ items = [],
17
+ variant = "DOT",
18
+ autoPlayInterval = 5000,
19
+ }: Props & CarouselProps = $props();
20
+
21
+ let currentIndex = $state(0);
22
+ let currentItem = $derived(items[currentIndex] ?? items[0]);
23
+
24
+ function goTo(index: number) {
25
+ currentIndex = index;
26
+ }
27
+
28
+ function next() {
29
+ if (items.length === 0) return;
30
+ currentIndex = (currentIndex + 1) % items.length;
31
+ }
32
+
33
+ $effect(() => {
34
+ if (items.length <= 1) return;
35
+ const timer = setInterval(next, autoPlayInterval);
36
+ return () => clearInterval(timer);
37
+ });
38
+ </script>
39
+
40
+ <div
41
+ class="relative flex flex-col justify-between overflow-hidden h-screen p-8 bg-gradient-left text-white"
42
+ >
43
+ <div class="flex items-center gap-2">
44
+ <div class="font-bold text-xl tracking-wider flex items-center gap-2">
45
+ {#if typeof title === "function"}
46
+ {@render title()}
47
+ {:else}
48
+ {title || ""}
49
+ {/if}
50
+ </div>
51
+ </div>
52
+
53
+ <section class="flex flex-col gap-5">
54
+ <div class="my-auto max-w-sm md:max-w-md">
55
+ {#if currentItem}
56
+ {#key currentIndex}
57
+ <div
58
+ class="text-xl md:text-2xl font-bold tracking-tight mb-4 leading-tight animate-in fade-in duration-300"
59
+ >
60
+ {currentItem.title}
61
+ </div>
62
+ <p
63
+ class=" text-sm mb-6 leading-relaxed animate-in fade-in duration-300"
64
+ >
65
+ {currentItem.description}
66
+ </p>
67
+ {/key}
68
+ <Button
69
+ variant="outline"
70
+ class="inline-flex items-center gap-2 text-sm font-semibold bg-primary"
71
+ >
72
+ {currentItem.buttonText}
73
+ <HugeiconsIcon icon={ArrowRight01Icon} size={16} />
74
+ </Button>
75
+ {/if}
76
+ </div>
77
+
78
+ <div class="flex items-center gap-2 mb-2">
79
+ {#each items as it, i (it.title)}
80
+ <button
81
+ type="button"
82
+ onclick={() => goTo(i)}
83
+ aria-label={`Ir para o item ${i + 1}`}
84
+ aria-current={currentIndex === i}
85
+ class="transition-all duration-300 focus:outline-none flex items-center justify-center {currentIndex ===
86
+ i
87
+ ? 'opacity-100 scale-110'
88
+ : 'opacity-50 hover:opacity-75'}"
89
+ >
90
+ {#if variant === "NUMBER"}
91
+ <span
92
+ class="w-6 h-6 text-xs font-semibold rounded-full text-primary flex items-center justify-center"
93
+ >
94
+ {i + 1}
95
+ </span>
96
+ {:else}
97
+ <span class="w-2 h-2 rounded-full bg-white"></span>
98
+ {/if}
99
+ </button>
100
+ {/each}
101
+ </div>
102
+ </section>
103
+ </div>
104
+
105
+ <aside class="absolute grid-pattern p-0 top-0 h-screen w-8/12"></aside>
@@ -1,4 +1,4 @@
1
- import type { CarouselProps } from "../../../../../core/carousel/data/CarouselModel";
1
+ import type { CarouselProps } from "../../../../core/carousel/data/CarouselModel";
2
2
  import type { Snippet } from "svelte";
3
3
  type Props = {
4
4
  title?: string | Snippet;
@@ -0,0 +1,49 @@
1
+ <script lang="ts">
2
+ import AuthCard from "./AuthCard.svelte";
3
+ import LeftHero from "./LeftHero.svelte";
4
+ import type { PageLoginProps } from "../data/page-props";
5
+
6
+ /**
7
+ * Variante 01 da página de login.
8
+ * Layout split: hero à esquerda, auth card à direita.
9
+ * @property {CarouselItem[]} carousel - Itens do carousel
10
+ * @property {string} title - Título do hero
11
+ * @property {AuthFormType} formType - Tipo do form de login
12
+ * @property {LinkProps} privacyPolicy - Config do link de privacidade
13
+ * @property {LinkProps} termsOfService - Config do link de termos
14
+ */
15
+ let {
16
+ carousel,
17
+ varient,
18
+ title,
19
+ formType,
20
+ children,
21
+ privacyPolicy,
22
+ termsOfService,
23
+ }: PageLoginProps = $props();
24
+ </script>
25
+
26
+ <main class="h-screen w-screen flex items-center">
27
+ <div class="hidden md:block md:w-8/12">
28
+ <LeftHero {title} varient={varient ?? "POINTER"} items={carousel ?? []} />
29
+ </div>
30
+ <div class="w-full md:px-0 md:w-4/12 border-gray-900">
31
+ {#if children}
32
+ {@render children()}
33
+ {:else}
34
+ <AuthCard {formType} {privacyPolicy} {termsOfService} />
35
+ {/if}
36
+ </div>
37
+ </main>
38
+
39
+ <style>
40
+ :global(.grid-pattern) {
41
+ background-size: 40px 40px;
42
+ background-image: linear-gradient(
43
+ to right,
44
+ rgba(0, 0, 0, 0.1) 1px,
45
+ transparent 1px
46
+ ),
47
+ linear-gradient(to bottom, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
48
+ }
49
+ </style>
@@ -0,0 +1,4 @@
1
+ import type { PageLoginProps } from "../data/page-props";
2
+ declare const PageLogin01: import("svelte").Component<PageLoginProps, {}, "">;
3
+ type PageLogin01 = ReturnType<typeof PageLogin01>;
4
+ export default PageLogin01;
@@ -0,0 +1,21 @@
1
+ <script lang="ts">
2
+ import type { PageLoginProps } from "./01/data/page-props";
3
+ import PageLogin01 from "./01/ui/PageLogin01.svelte";
4
+
5
+ /**
6
+ * Página de login principal.
7
+ * @property {"01"} varient - Variante do layout de login
8
+ * @property {CarouselItem[]} carousel - Itens do carousel hero
9
+ * @property {string} title - Título do hero
10
+ * @property {AuthFormType} formType - Tipo do form (EMAIL_PASSWORD, USERNAME_PASSWORD, PHONE_PASSWORD)
11
+ * @property {LinkProps} privacyPolicy - Config do link de política de privacidade
12
+ * @property {LinkProps} termsOfService - Config do link de termos de serviço
13
+ */
14
+ type Props = {
15
+ varient?: "01";
16
+ };
17
+
18
+ let { ...props }: PageLoginProps & Props = $props();
19
+ </script>
20
+
21
+ <PageLogin01 {...props} />
@@ -0,0 +1,17 @@
1
+ import type { PageLoginProps } from "./01/data/page-props";
2
+ /**
3
+ * Página de login principal.
4
+ * @property {"01"} varient - Variante do layout de login
5
+ * @property {CarouselItem[]} carousel - Itens do carousel hero
6
+ * @property {string} title - Título do hero
7
+ * @property {AuthFormType} formType - Tipo do form (EMAIL_PASSWORD, USERNAME_PASSWORD, PHONE_PASSWORD)
8
+ * @property {LinkProps} privacyPolicy - Config do link de política de privacidade
9
+ * @property {LinkProps} termsOfService - Config do link de termos de serviço
10
+ */
11
+ type Props = {
12
+ varient?: "01";
13
+ };
14
+ type $$ComponentProps = PageLoginProps & Props;
15
+ declare const PageLogin: import("svelte").Component<$$ComponentProps, {}, "">;
16
+ type PageLogin = ReturnType<typeof PageLogin>;
17
+ 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}