negodesign 0.0.59 → 0.0.60
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/banner/AdCardBanner.svelte +74 -74
- package/dist/components/core/banner/CtaCardBanner.svelte +118 -118
- 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 +103 -103
- package/dist/components/core/card/highlight/02/CardHighlight02.svelte +99 -99
- package/dist/components/core/card/highlight/CardHighlight.svelte +22 -22
- package/dist/components/core/card/media/01/CardMedia01.svelte +133 -133
- package/dist/components/core/card/media/02/CardMedia02.svelte +127 -127
- package/dist/components/core/card/media/CardMedia.svelte +18 -18
- package/dist/components/core/card/product/01/CardProduct01.svelte +136 -136
- package/dist/components/core/card/product/02/CardProduct02.svelte +124 -124
- package/dist/components/core/card/product/CardProduct.svelte +22 -22
- package/dist/components/core/card/profile/01/CardProfile01.svelte +134 -134
- package/dist/components/core/card/profile/02/CardProfile02.svelte +132 -132
- package/dist/components/core/card/profile/CardProfile.svelte +18 -18
- package/dist/components/core/card/promotion/CardPromotion.svelte +139 -139
- package/dist/components/core/card/promotion/CardPromotionPrice.svelte +32 -32
- package/dist/components/core/card/shared/CardButton.svelte +42 -42
- package/dist/components/core/card/shared/CardCart.svelte +36 -36
- package/dist/components/core/card/shared/CardDescription.svelte +41 -41
- package/dist/components/core/card/shared/CardFavorite.svelte +33 -33
- package/dist/components/core/card/shared/CardLogo.svelte +19 -19
- package/dist/components/core/card/shared/CardPhoneOrWhatsapp.svelte +45 -45
- package/dist/components/core/card/shared/CardStarRating.svelte +24 -24
- package/dist/components/core/card/shared/CardTags.svelte +95 -95
- package/dist/components/core/card/shared/CardThumbnailVideo.svelte +232 -232
- package/dist/components/core/card/shared/CardTitlePrice.svelte +24 -24
- package/dist/components/core/card/shared/TruncatableText.svelte +49 -49
- package/dist/components/core/carousel/badge/ui/CarouselBadge.svelte +109 -109
- package/dist/components/core/carousel/grid/shared/ui/CarouselGridSlot.svelte +38 -38
- package/dist/components/core/carousel/hero/ui/CarouselHero.svelte +163 -163
- package/dist/components/core/carousel/shared/ui/CarouselHeader.svelte +60 -60
- 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/footer/ui/Footer.svelte +18 -18
- 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/grid/ui/01/Grid01.svelte +28 -28
- package/dist/components/core/grid/ui/02/Grid02.svelte +28 -28
- package/dist/components/core/grid/ui/PanelGrid.svelte +27 -27
- package/dist/components/core/grid/ui/SimpleGrid.svelte +35 -35
- package/dist/components/core/grid/ui/shared/DescriptionGrid.svelte +23 -23
- package/dist/components/core/grid/ui/shared/IconRenderGrid.svelte +21 -21
- package/dist/components/core/grid/ui/shared/TitleGrid.svelte +19 -19
- 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/ComplexMenu.svelte +36 -36
- package/dist/components/core/nav/ui/Menu.svelte +70 -70
- package/dist/components/core/nav/ui/SimpleMenu.svelte +14 -14
- package/dist/components/core/nav/ui/mobile/MenuMobile.svelte +54 -54
- package/dist/components/core/nav/ui/shared/MenuButton.svelte +51 -51
- package/dist/components/core/nav/ui/shared/MenuLinks.svelte +40 -40
- package/dist/components/core/nav/ui/shared/MenuListItem.svelte +48 -48
- package/dist/components/core/nav/ui/shared/MenuLogo.svelte +13 -13
- package/dist/components/core/nav/ui/shared/navigation/NavigationMenuItem.svelte +15 -15
- package/dist/components/core/nav/ui/shared/navigation/NavigationMenuItemCard.svelte +62 -62
- package/dist/components/core/nav/ui/shared/navigation/NavigationMenuItemGrid.svelte +32 -32
- package/dist/components/core/nav/ui/shared/navigation/NavigationMenuItemList.svelte +24 -24
- package/dist/components/core/nav/ui/shared/navigation/NavigationMenuItems.svelte +21 -21
- package/dist/components/core/panel/CarouselSlot.svelte +57 -57
- package/dist/components/core/panel/LeftHero.svelte +117 -117
- 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/sidebar/ui/navbar/NavMenuBarSidebar.svelte +97 -97
- package/dist/components/core/sidebar/ui/navbar/NavMenuBottomSidebar.svelte +33 -33
- package/dist/components/core/sidebar/ui/navbar/NavMenuTopBarSidebar.svelte +103 -103
- 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/styles/globals.css +149 -149
- package/package.json +113 -113
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Button from "../../../../ui/button/button.svelte";
|
|
3
|
-
import { t } from "../../../../../i18n";
|
|
4
|
-
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
5
|
-
import { ArrowRight02Icon } from "@hugeicons/core-free-icons";
|
|
6
|
-
import type { CarouselHeaderProps } from "../../types";
|
|
7
|
-
import type { Snippet } from "svelte";
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
children: Snippet;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const {
|
|
14
|
-
title,
|
|
15
|
-
description,
|
|
16
|
-
titleClass,
|
|
17
|
-
descriptionClass,
|
|
18
|
-
containerClass = "",
|
|
19
|
-
onButtonViewAll,
|
|
20
|
-
children,
|
|
21
|
-
isBorder,
|
|
22
|
-
}: CarouselHeaderProps & Props = $props();
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<div class="w-full flex justify-center">
|
|
26
|
-
<div
|
|
27
|
-
class="w-[95%] p-2 rounded-xl
|
|
28
|
-
{isBorder ? 'border border-gray-50 dark:border-gray-800' : ''}
|
|
29
|
-
{containerClass}"
|
|
30
|
-
>
|
|
31
|
-
<div class="flex flex-col gap-1">
|
|
32
|
-
<div class="flex justify-between">
|
|
33
|
-
<div>
|
|
34
|
-
{#if title}
|
|
35
|
-
<h1 class={`text-xl ${titleClass}`}>{title}</h1>
|
|
36
|
-
{/if}
|
|
37
|
-
{#if description}
|
|
38
|
-
<div class={`mt-3 ${descriptionClass}`}>
|
|
39
|
-
{description}
|
|
40
|
-
</div>
|
|
41
|
-
{/if}
|
|
42
|
-
</div>
|
|
43
|
-
{#if onButtonViewAll}
|
|
44
|
-
<div>
|
|
45
|
-
<Button
|
|
46
|
-
variant="ghost"
|
|
47
|
-
size="sm"
|
|
48
|
-
class="flex items-center gap-0.5"
|
|
49
|
-
onclick={onButtonViewAll}
|
|
50
|
-
>
|
|
51
|
-
{$t("label.view.full")}
|
|
52
|
-
<HugeiconsIcon icon={ArrowRight02Icon} />
|
|
53
|
-
</Button>
|
|
54
|
-
</div>
|
|
55
|
-
{/if}
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
<div>{@render children()}</div>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button from "../../../../ui/button/button.svelte";
|
|
3
|
+
import { t } from "../../../../../i18n";
|
|
4
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
5
|
+
import { ArrowRight02Icon } from "@hugeicons/core-free-icons";
|
|
6
|
+
import type { CarouselHeaderProps } from "../../types";
|
|
7
|
+
import type { Snippet } from "svelte";
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
children: Snippet;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
title,
|
|
15
|
+
description,
|
|
16
|
+
titleClass,
|
|
17
|
+
descriptionClass,
|
|
18
|
+
containerClass = "",
|
|
19
|
+
onButtonViewAll,
|
|
20
|
+
children,
|
|
21
|
+
isBorder,
|
|
22
|
+
}: CarouselHeaderProps & Props = $props();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div class="w-full flex justify-center">
|
|
26
|
+
<div
|
|
27
|
+
class="w-[95%] p-2 rounded-xl
|
|
28
|
+
{isBorder ? 'border border-gray-50 dark:border-gray-800' : ''}
|
|
29
|
+
{containerClass}"
|
|
30
|
+
>
|
|
31
|
+
<div class="flex flex-col gap-1">
|
|
32
|
+
<div class="flex justify-between">
|
|
33
|
+
<div>
|
|
34
|
+
{#if title}
|
|
35
|
+
<h1 class={`text-xl ${titleClass}`}>{title}</h1>
|
|
36
|
+
{/if}
|
|
37
|
+
{#if description}
|
|
38
|
+
<div class={`mt-3 ${descriptionClass}`}>
|
|
39
|
+
{description}
|
|
40
|
+
</div>
|
|
41
|
+
{/if}
|
|
42
|
+
</div>
|
|
43
|
+
{#if onButtonViewAll}
|
|
44
|
+
<div>
|
|
45
|
+
<Button
|
|
46
|
+
variant="ghost"
|
|
47
|
+
size="sm"
|
|
48
|
+
class="flex items-center gap-0.5"
|
|
49
|
+
onclick={onButtonViewAll}
|
|
50
|
+
>
|
|
51
|
+
{$t("label.view.full")}
|
|
52
|
+
<HugeiconsIcon icon={ArrowRight02Icon} />
|
|
53
|
+
</Button>
|
|
54
|
+
</div>
|
|
55
|
+
{/if}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
<div>{@render children()}</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
<script lang="ts" generics="T">
|
|
2
|
-
import type { CellContext } from "@tanstack/table-core";
|
|
3
|
-
import * as DropdownMenu from "../../../ui/dropdown-menu/index.js";
|
|
4
|
-
import Button from "../../../ui/button/button.svelte";
|
|
5
|
-
import { MoreHorizontalIcon } from "@hugeicons/core-free-icons";
|
|
6
|
-
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
7
|
-
|
|
8
|
-
let { row }: CellContext<T, unknown> = $props();
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<DropdownMenu.Root>
|
|
12
|
-
<DropdownMenu.Trigger>
|
|
13
|
-
{#snippet child({ props })}
|
|
14
|
-
<Button {...props} variant="ghost" class="size-8 p-0">
|
|
15
|
-
<HugeiconsIcon icon={MoreHorizontalIcon} class="size-4" />
|
|
16
|
-
<span class="sr-only">Open menu</span>
|
|
17
|
-
</Button>
|
|
18
|
-
{/snippet}
|
|
19
|
-
</DropdownMenu.Trigger>
|
|
20
|
-
<DropdownMenu.Content align="end">
|
|
21
|
-
<DropdownMenu.Item onclick={() => console.log(row.original)}
|
|
22
|
-
>Copy</DropdownMenu.Item
|
|
23
|
-
>
|
|
24
|
-
<DropdownMenu.Item onclick={() => console.log(row.original)}
|
|
25
|
-
>Delete</DropdownMenu.Item
|
|
26
|
-
>
|
|
27
|
-
</DropdownMenu.Content>
|
|
28
|
-
</DropdownMenu.Root>
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import type { CellContext } from "@tanstack/table-core";
|
|
3
|
+
import * as DropdownMenu from "../../../ui/dropdown-menu/index.js";
|
|
4
|
+
import Button from "../../../ui/button/button.svelte";
|
|
5
|
+
import { MoreHorizontalIcon } from "@hugeicons/core-free-icons";
|
|
6
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
7
|
+
|
|
8
|
+
let { row }: CellContext<T, unknown> = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<DropdownMenu.Root>
|
|
12
|
+
<DropdownMenu.Trigger>
|
|
13
|
+
{#snippet child({ props })}
|
|
14
|
+
<Button {...props} variant="ghost" class="size-8 p-0">
|
|
15
|
+
<HugeiconsIcon icon={MoreHorizontalIcon} class="size-4" />
|
|
16
|
+
<span class="sr-only">Open menu</span>
|
|
17
|
+
</Button>
|
|
18
|
+
{/snippet}
|
|
19
|
+
</DropdownMenu.Trigger>
|
|
20
|
+
<DropdownMenu.Content align="end">
|
|
21
|
+
<DropdownMenu.Item onclick={() => console.log(row.original)}
|
|
22
|
+
>Copy</DropdownMenu.Item
|
|
23
|
+
>
|
|
24
|
+
<DropdownMenu.Item onclick={() => console.log(row.original)}
|
|
25
|
+
>Delete</DropdownMenu.Item
|
|
26
|
+
>
|
|
27
|
+
</DropdownMenu.Content>
|
|
28
|
+
</DropdownMenu.Root>
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Checkbox } from "../../../ui/checkbox";
|
|
3
|
-
|
|
4
|
-
let {
|
|
5
|
-
checked = $bindable(false),
|
|
6
|
-
indeterminate = $bindable(false),
|
|
7
|
-
onCheckedChange,
|
|
8
|
-
...restProps
|
|
9
|
-
}: {
|
|
10
|
-
checked?: boolean;
|
|
11
|
-
indeterminate?: boolean;
|
|
12
|
-
onCheckedChange?: (value: boolean) => void;
|
|
13
|
-
[key: string]: unknown;
|
|
14
|
-
} = $props();
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<Checkbox
|
|
18
|
-
bind:checked
|
|
19
|
-
bind:indeterminate
|
|
20
|
-
onCheckedChange={(v) => onCheckedChange?.(!!v)}
|
|
21
|
-
{...restProps}
|
|
22
|
-
/>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Checkbox } from "../../../ui/checkbox";
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
checked = $bindable(false),
|
|
6
|
+
indeterminate = $bindable(false),
|
|
7
|
+
onCheckedChange,
|
|
8
|
+
...restProps
|
|
9
|
+
}: {
|
|
10
|
+
checked?: boolean;
|
|
11
|
+
indeterminate?: boolean;
|
|
12
|
+
onCheckedChange?: (value: boolean) => void;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
} = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<Checkbox
|
|
18
|
+
bind:checked
|
|
19
|
+
bind:indeterminate
|
|
20
|
+
onCheckedChange={(v) => onCheckedChange?.(!!v)}
|
|
21
|
+
{...restProps}
|
|
22
|
+
/>
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
<script lang="ts" generics="T">
|
|
2
|
-
import type {
|
|
3
|
-
ColumnDef,
|
|
4
|
-
Table as TanstackTable,
|
|
5
|
-
} from "@tanstack/table-core";
|
|
6
|
-
import * as Table from "../../../ui/table/index.js";
|
|
7
|
-
import FlexRender from "../../../ui/data-table/flex-render.svelte";
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
table: TanstackTable<T>;
|
|
11
|
-
columns: ColumnDef<T>[];
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
let { table, columns }: Props = $props();
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<div class="rounded-md border">
|
|
18
|
-
<Table.Root>
|
|
19
|
-
<Table.Header>
|
|
20
|
-
{#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
|
|
21
|
-
<Table.Row>
|
|
22
|
-
{#each headerGroup.headers as header (header.id)}
|
|
23
|
-
<Table.Head class="[&:has([role=checkbox])]:ps-3">
|
|
24
|
-
{#if !header.isPlaceholder}
|
|
25
|
-
<FlexRender
|
|
26
|
-
content={header.column.columnDef.header}
|
|
27
|
-
context={header.getContext()}
|
|
28
|
-
/>
|
|
29
|
-
{/if}
|
|
30
|
-
</Table.Head>
|
|
31
|
-
{/each}
|
|
32
|
-
</Table.Row>
|
|
33
|
-
{/each}
|
|
34
|
-
</Table.Header>
|
|
35
|
-
<Table.Body>
|
|
36
|
-
{#each table.getRowModel().rows as row (row.id)}
|
|
37
|
-
<Table.Row data-state={row.getIsSelected() && "selected"}>
|
|
38
|
-
{#each row.getVisibleCells() as cell (cell.id)}
|
|
39
|
-
<Table.Cell class="[&:has([role=checkbox])]:ps-3">
|
|
40
|
-
<FlexRender
|
|
41
|
-
content={cell.column.columnDef.cell}
|
|
42
|
-
context={cell.getContext()}
|
|
43
|
-
/>
|
|
44
|
-
</Table.Cell>
|
|
45
|
-
{/each}
|
|
46
|
-
</Table.Row>
|
|
47
|
-
{:else}
|
|
48
|
-
<Table.Row>
|
|
49
|
-
<Table.Cell
|
|
50
|
-
colspan={columns.length}
|
|
51
|
-
class="h-24 text-center"
|
|
52
|
-
>
|
|
53
|
-
No results.
|
|
54
|
-
</Table.Cell>
|
|
55
|
-
</Table.Row>
|
|
56
|
-
{/each}
|
|
57
|
-
</Table.Body>
|
|
58
|
-
</Table.Root>
|
|
59
|
-
</div>
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import type {
|
|
3
|
+
ColumnDef,
|
|
4
|
+
Table as TanstackTable,
|
|
5
|
+
} from "@tanstack/table-core";
|
|
6
|
+
import * as Table from "../../../ui/table/index.js";
|
|
7
|
+
import FlexRender from "../../../ui/data-table/flex-render.svelte";
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
table: TanstackTable<T>;
|
|
11
|
+
columns: ColumnDef<T>[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
let { table, columns }: Props = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div class="rounded-md border">
|
|
18
|
+
<Table.Root>
|
|
19
|
+
<Table.Header>
|
|
20
|
+
{#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
|
|
21
|
+
<Table.Row>
|
|
22
|
+
{#each headerGroup.headers as header (header.id)}
|
|
23
|
+
<Table.Head class="[&:has([role=checkbox])]:ps-3">
|
|
24
|
+
{#if !header.isPlaceholder}
|
|
25
|
+
<FlexRender
|
|
26
|
+
content={header.column.columnDef.header}
|
|
27
|
+
context={header.getContext()}
|
|
28
|
+
/>
|
|
29
|
+
{/if}
|
|
30
|
+
</Table.Head>
|
|
31
|
+
{/each}
|
|
32
|
+
</Table.Row>
|
|
33
|
+
{/each}
|
|
34
|
+
</Table.Header>
|
|
35
|
+
<Table.Body>
|
|
36
|
+
{#each table.getRowModel().rows as row (row.id)}
|
|
37
|
+
<Table.Row data-state={row.getIsSelected() && "selected"}>
|
|
38
|
+
{#each row.getVisibleCells() as cell (cell.id)}
|
|
39
|
+
<Table.Cell class="[&:has([role=checkbox])]:ps-3">
|
|
40
|
+
<FlexRender
|
|
41
|
+
content={cell.column.columnDef.cell}
|
|
42
|
+
context={cell.getContext()}
|
|
43
|
+
/>
|
|
44
|
+
</Table.Cell>
|
|
45
|
+
{/each}
|
|
46
|
+
</Table.Row>
|
|
47
|
+
{:else}
|
|
48
|
+
<Table.Row>
|
|
49
|
+
<Table.Cell
|
|
50
|
+
colspan={columns.length}
|
|
51
|
+
class="h-24 text-center"
|
|
52
|
+
>
|
|
53
|
+
No results.
|
|
54
|
+
</Table.Cell>
|
|
55
|
+
</Table.Row>
|
|
56
|
+
{/each}
|
|
57
|
+
</Table.Body>
|
|
58
|
+
</Table.Root>
|
|
59
|
+
</div>
|
|
@@ -1,151 +1,151 @@
|
|
|
1
|
-
<script lang="ts" generics="T">
|
|
2
|
-
import {
|
|
3
|
-
type CellContext,
|
|
4
|
-
type ColumnDef,
|
|
5
|
-
type ColumnFiltersState,
|
|
6
|
-
type PaginationState,
|
|
7
|
-
type RowSelectionState,
|
|
8
|
-
type SortingState,
|
|
9
|
-
type VisibilityState,
|
|
10
|
-
getCoreRowModel,
|
|
11
|
-
getFilteredRowModel,
|
|
12
|
-
getPaginationRowModel,
|
|
13
|
-
getSortedRowModel,
|
|
14
|
-
} from "@tanstack/table-core";
|
|
15
|
-
import type { DataTableItem } from "../data/data-table";
|
|
16
|
-
import { resolveHeader } from "../data/resolve-header.svelte";
|
|
17
|
-
import { resolveCellBadge } from "../data/resolve-cell-badge.svelte";
|
|
18
|
-
import {
|
|
19
|
-
createDragColumn,
|
|
20
|
-
createSelectColumn,
|
|
21
|
-
} from "../data/columns-create";
|
|
22
|
-
import {
|
|
23
|
-
createSvelteTable,
|
|
24
|
-
renderComponent,
|
|
25
|
-
} from "../../../ui/data-table";
|
|
26
|
-
import DataTableListFilter from "./DataTableListFilter.svelte";
|
|
27
|
-
import DataTableContent from "./DataTableContent.svelte";
|
|
28
|
-
import DataTableListPagination from "./DataTableListPagination.svelte";
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Generic data table with pagination, sorting, and filtering.
|
|
32
|
-
* @property {DataTableItem<T>["config"]} config - Column definitions
|
|
33
|
-
* @property {keyof T} columnFilter - Key for column filtering
|
|
34
|
-
* @property {Component} actions - Per-row actions component
|
|
35
|
-
* @property {T[]} items - Table data
|
|
36
|
-
*/
|
|
37
|
-
let { config, columnFilter, actions, items = [] }: DataTableItem<T> = $props();
|
|
38
|
-
|
|
39
|
-
let columns: ColumnDef<T>[] = $derived([
|
|
40
|
-
createDragColumn<T>(),
|
|
41
|
-
createSelectColumn<T>(),
|
|
42
|
-
...config.map((it) => ({
|
|
43
|
-
accessorKey: it.accessorKey,
|
|
44
|
-
header: resolveHeader(it.header),
|
|
45
|
-
cell: resolveCellBadge(it.cell, it.badge),
|
|
46
|
-
enableSorting: it.enableSorting,
|
|
47
|
-
enableHiding: it.enableHiding,
|
|
48
|
-
})),
|
|
49
|
-
...(actions
|
|
50
|
-
? [{
|
|
51
|
-
id: "actions",
|
|
52
|
-
cell: (ctx: CellContext<T, unknown>) => renderComponent(actions, ctx as unknown),
|
|
53
|
-
enableSorting: false,
|
|
54
|
-
enableHiding: false,
|
|
55
|
-
} satisfies ColumnDef<T>]
|
|
56
|
-
: []),
|
|
57
|
-
]);
|
|
58
|
-
|
|
59
|
-
let pagination = $state<PaginationState>({ pageIndex: 0, pageSize: 10 });
|
|
60
|
-
let columnFilters = $state<ColumnFiltersState>([]);
|
|
61
|
-
let columnVisibility = $state<VisibilityState>({});
|
|
62
|
-
let rowSelection = $state<RowSelectionState>({});
|
|
63
|
-
let sorting = $state<SortingState>([]);
|
|
64
|
-
|
|
65
|
-
let table = $derived(
|
|
66
|
-
createSvelteTable({
|
|
67
|
-
data: items,
|
|
68
|
-
columns,
|
|
69
|
-
state: {
|
|
70
|
-
get pagination() {
|
|
71
|
-
return pagination;
|
|
72
|
-
},
|
|
73
|
-
get sorting() {
|
|
74
|
-
return sorting;
|
|
75
|
-
},
|
|
76
|
-
get columnVisibility() {
|
|
77
|
-
return columnVisibility;
|
|
78
|
-
},
|
|
79
|
-
get rowSelection() {
|
|
80
|
-
return rowSelection;
|
|
81
|
-
},
|
|
82
|
-
get columnFilters() {
|
|
83
|
-
return columnFilters;
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
getCoreRowModel: getCoreRowModel(),
|
|
87
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
88
|
-
getSortedRowModel: getSortedRowModel(),
|
|
89
|
-
getFilteredRowModel: getFilteredRowModel(),
|
|
90
|
-
onPaginationChange: (
|
|
91
|
-
updater:
|
|
92
|
-
| PaginationState
|
|
93
|
-
| ((arg0: PaginationState) => PaginationState),
|
|
94
|
-
) => {
|
|
95
|
-
if (typeof updater === "function") {
|
|
96
|
-
pagination = updater(pagination);
|
|
97
|
-
} else {
|
|
98
|
-
pagination = updater;
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
onSortingChange: (
|
|
102
|
-
updater: SortingState | ((arg0: SortingState) => SortingState),
|
|
103
|
-
) => {
|
|
104
|
-
if (typeof updater === "function") {
|
|
105
|
-
sorting = updater(sorting);
|
|
106
|
-
} else {
|
|
107
|
-
sorting = updater;
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
onColumnFiltersChange: (
|
|
111
|
-
updater:
|
|
112
|
-
| ColumnFiltersState
|
|
113
|
-
| ((arg0: ColumnFiltersState) => ColumnFiltersState),
|
|
114
|
-
) => {
|
|
115
|
-
if (typeof updater === "function") {
|
|
116
|
-
columnFilters = updater(columnFilters);
|
|
117
|
-
} else {
|
|
118
|
-
columnFilters = updater;
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
onColumnVisibilityChange: (
|
|
122
|
-
updater:
|
|
123
|
-
| VisibilityState
|
|
124
|
-
| ((arg0: VisibilityState) => VisibilityState),
|
|
125
|
-
) => {
|
|
126
|
-
if (typeof updater === "function") {
|
|
127
|
-
columnVisibility = updater(columnVisibility);
|
|
128
|
-
} else {
|
|
129
|
-
columnVisibility = updater;
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
onRowSelectionChange: (
|
|
133
|
-
updater:
|
|
134
|
-
| RowSelectionState
|
|
135
|
-
| ((arg0: RowSelectionState) => RowSelectionState),
|
|
136
|
-
) => {
|
|
137
|
-
if (typeof updater === "function") {
|
|
138
|
-
rowSelection = updater(rowSelection);
|
|
139
|
-
} else {
|
|
140
|
-
rowSelection = updater;
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
}),
|
|
144
|
-
);
|
|
145
|
-
</script>
|
|
146
|
-
|
|
147
|
-
<div class="-mb-8 w-full">
|
|
148
|
-
<DataTableListFilter {table} column={columnFilter} />
|
|
149
|
-
<DataTableContent {table} {columns} />
|
|
150
|
-
<DataTableListPagination {table} />
|
|
151
|
-
</div>
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import {
|
|
3
|
+
type CellContext,
|
|
4
|
+
type ColumnDef,
|
|
5
|
+
type ColumnFiltersState,
|
|
6
|
+
type PaginationState,
|
|
7
|
+
type RowSelectionState,
|
|
8
|
+
type SortingState,
|
|
9
|
+
type VisibilityState,
|
|
10
|
+
getCoreRowModel,
|
|
11
|
+
getFilteredRowModel,
|
|
12
|
+
getPaginationRowModel,
|
|
13
|
+
getSortedRowModel,
|
|
14
|
+
} from "@tanstack/table-core";
|
|
15
|
+
import type { DataTableItem } from "../data/data-table";
|
|
16
|
+
import { resolveHeader } from "../data/resolve-header.svelte";
|
|
17
|
+
import { resolveCellBadge } from "../data/resolve-cell-badge.svelte";
|
|
18
|
+
import {
|
|
19
|
+
createDragColumn,
|
|
20
|
+
createSelectColumn,
|
|
21
|
+
} from "../data/columns-create";
|
|
22
|
+
import {
|
|
23
|
+
createSvelteTable,
|
|
24
|
+
renderComponent,
|
|
25
|
+
} from "../../../ui/data-table";
|
|
26
|
+
import DataTableListFilter from "./DataTableListFilter.svelte";
|
|
27
|
+
import DataTableContent from "./DataTableContent.svelte";
|
|
28
|
+
import DataTableListPagination from "./DataTableListPagination.svelte";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Generic data table with pagination, sorting, and filtering.
|
|
32
|
+
* @property {DataTableItem<T>["config"]} config - Column definitions
|
|
33
|
+
* @property {keyof T} columnFilter - Key for column filtering
|
|
34
|
+
* @property {Component} actions - Per-row actions component
|
|
35
|
+
* @property {T[]} items - Table data
|
|
36
|
+
*/
|
|
37
|
+
let { config, columnFilter, actions, items = [] }: DataTableItem<T> = $props();
|
|
38
|
+
|
|
39
|
+
let columns: ColumnDef<T>[] = $derived([
|
|
40
|
+
createDragColumn<T>(),
|
|
41
|
+
createSelectColumn<T>(),
|
|
42
|
+
...config.map((it) => ({
|
|
43
|
+
accessorKey: it.accessorKey,
|
|
44
|
+
header: resolveHeader(it.header),
|
|
45
|
+
cell: resolveCellBadge(it.cell, it.badge),
|
|
46
|
+
enableSorting: it.enableSorting,
|
|
47
|
+
enableHiding: it.enableHiding,
|
|
48
|
+
})),
|
|
49
|
+
...(actions
|
|
50
|
+
? [{
|
|
51
|
+
id: "actions",
|
|
52
|
+
cell: (ctx: CellContext<T, unknown>) => renderComponent(actions, ctx as unknown),
|
|
53
|
+
enableSorting: false,
|
|
54
|
+
enableHiding: false,
|
|
55
|
+
} satisfies ColumnDef<T>]
|
|
56
|
+
: []),
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
let pagination = $state<PaginationState>({ pageIndex: 0, pageSize: 10 });
|
|
60
|
+
let columnFilters = $state<ColumnFiltersState>([]);
|
|
61
|
+
let columnVisibility = $state<VisibilityState>({});
|
|
62
|
+
let rowSelection = $state<RowSelectionState>({});
|
|
63
|
+
let sorting = $state<SortingState>([]);
|
|
64
|
+
|
|
65
|
+
let table = $derived(
|
|
66
|
+
createSvelteTable({
|
|
67
|
+
data: items,
|
|
68
|
+
columns,
|
|
69
|
+
state: {
|
|
70
|
+
get pagination() {
|
|
71
|
+
return pagination;
|
|
72
|
+
},
|
|
73
|
+
get sorting() {
|
|
74
|
+
return sorting;
|
|
75
|
+
},
|
|
76
|
+
get columnVisibility() {
|
|
77
|
+
return columnVisibility;
|
|
78
|
+
},
|
|
79
|
+
get rowSelection() {
|
|
80
|
+
return rowSelection;
|
|
81
|
+
},
|
|
82
|
+
get columnFilters() {
|
|
83
|
+
return columnFilters;
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
getCoreRowModel: getCoreRowModel(),
|
|
87
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
88
|
+
getSortedRowModel: getSortedRowModel(),
|
|
89
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
90
|
+
onPaginationChange: (
|
|
91
|
+
updater:
|
|
92
|
+
| PaginationState
|
|
93
|
+
| ((arg0: PaginationState) => PaginationState),
|
|
94
|
+
) => {
|
|
95
|
+
if (typeof updater === "function") {
|
|
96
|
+
pagination = updater(pagination);
|
|
97
|
+
} else {
|
|
98
|
+
pagination = updater;
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
onSortingChange: (
|
|
102
|
+
updater: SortingState | ((arg0: SortingState) => SortingState),
|
|
103
|
+
) => {
|
|
104
|
+
if (typeof updater === "function") {
|
|
105
|
+
sorting = updater(sorting);
|
|
106
|
+
} else {
|
|
107
|
+
sorting = updater;
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
onColumnFiltersChange: (
|
|
111
|
+
updater:
|
|
112
|
+
| ColumnFiltersState
|
|
113
|
+
| ((arg0: ColumnFiltersState) => ColumnFiltersState),
|
|
114
|
+
) => {
|
|
115
|
+
if (typeof updater === "function") {
|
|
116
|
+
columnFilters = updater(columnFilters);
|
|
117
|
+
} else {
|
|
118
|
+
columnFilters = updater;
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
onColumnVisibilityChange: (
|
|
122
|
+
updater:
|
|
123
|
+
| VisibilityState
|
|
124
|
+
| ((arg0: VisibilityState) => VisibilityState),
|
|
125
|
+
) => {
|
|
126
|
+
if (typeof updater === "function") {
|
|
127
|
+
columnVisibility = updater(columnVisibility);
|
|
128
|
+
} else {
|
|
129
|
+
columnVisibility = updater;
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
onRowSelectionChange: (
|
|
133
|
+
updater:
|
|
134
|
+
| RowSelectionState
|
|
135
|
+
| ((arg0: RowSelectionState) => RowSelectionState),
|
|
136
|
+
) => {
|
|
137
|
+
if (typeof updater === "function") {
|
|
138
|
+
rowSelection = updater(rowSelection);
|
|
139
|
+
} else {
|
|
140
|
+
rowSelection = updater;
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
}),
|
|
144
|
+
);
|
|
145
|
+
</script>
|
|
146
|
+
|
|
147
|
+
<div class="-mb-8 w-full">
|
|
148
|
+
<DataTableListFilter {table} column={columnFilter} />
|
|
149
|
+
<DataTableContent {table} {columns} />
|
|
150
|
+
<DataTableListPagination {table} />
|
|
151
|
+
</div>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { GripVerticalIcon } from "@hugeicons/core-free-icons";
|
|
3
|
-
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<button class="cursor-grab opacity-60 hover:opacity-100 w-min">
|
|
7
|
-
<HugeiconsIcon icon={GripVerticalIcon} class="size-4" />
|
|
8
|
-
</button>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { GripVerticalIcon } from "@hugeicons/core-free-icons";
|
|
3
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<button class="cursor-grab opacity-60 hover:opacity-100 w-min">
|
|
7
|
+
<HugeiconsIcon icon={GripVerticalIcon} class="size-4" />
|
|
8
|
+
</button>
|