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,184 +1,184 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { cn, type WithElementRef, type WithoutChildren } from "../../../utils.js";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
import { getPayloadConfigFromPayload, useChart, type TooltipPayload } from "./chart-utils.js";
|
|
5
|
-
import { getChartContext, Tooltip as TooltipPrimitive } from "layerchart";
|
|
6
|
-
import type { Snippet } from "svelte";
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
-
function defaultFormatter(value: any, _payload: TooltipPayload[]) {
|
|
10
|
-
return `${value}`;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let {
|
|
14
|
-
ref = $bindable(null),
|
|
15
|
-
class: className,
|
|
16
|
-
hideLabel = false,
|
|
17
|
-
indicator = "dot",
|
|
18
|
-
hideIndicator = false,
|
|
19
|
-
labelKey,
|
|
20
|
-
label,
|
|
21
|
-
labelFormatter = defaultFormatter,
|
|
22
|
-
labelClassName,
|
|
23
|
-
formatter,
|
|
24
|
-
nameKey,
|
|
25
|
-
color,
|
|
26
|
-
...restProps
|
|
27
|
-
}: WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> & {
|
|
28
|
-
hideLabel?: boolean;
|
|
29
|
-
label?: string;
|
|
30
|
-
indicator?: "line" | "dot" | "dashed";
|
|
31
|
-
nameKey?: string;
|
|
32
|
-
labelKey?: string;
|
|
33
|
-
hideIndicator?: boolean;
|
|
34
|
-
labelClassName?: string;
|
|
35
|
-
labelFormatter?: // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
-
((value: any, payload: TooltipPayload[]) => string | number | Snippet) | null;
|
|
37
|
-
formatter?: Snippet<
|
|
38
|
-
[
|
|
39
|
-
{
|
|
40
|
-
value: unknown;
|
|
41
|
-
name: string;
|
|
42
|
-
item: TooltipPayload;
|
|
43
|
-
index: number;
|
|
44
|
-
payload: TooltipPayload[];
|
|
45
|
-
},
|
|
46
|
-
]
|
|
47
|
-
>;
|
|
48
|
-
} = $props();
|
|
49
|
-
|
|
50
|
-
const chart = useChart();
|
|
51
|
-
const chartCtx = getChartContext();
|
|
52
|
-
|
|
53
|
-
// Filter to series with defined values (important for item-based charts like Pie/Arc
|
|
54
|
-
// where only the hovered item has a value)
|
|
55
|
-
const visibleSeries = $derived(
|
|
56
|
-
chartCtx.tooltip.series.filter((s: TooltipPayload) => s.value !== undefined)
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
const formattedLabel = $derived.by(() => {
|
|
60
|
-
if (hideLabel || !visibleSeries?.length) return null;
|
|
61
|
-
|
|
62
|
-
const [item] = visibleSeries;
|
|
63
|
-
const tooltipData = chartCtx.tooltip.data;
|
|
64
|
-
|
|
65
|
-
// Get the x-axis label value from the raw tooltip data (e.g. a Date or month string)
|
|
66
|
-
const dataLabel = tooltipData != null ? chartCtx.x(tooltipData) : undefined;
|
|
67
|
-
|
|
68
|
-
const key = labelKey ?? item?.label ?? item?.key ?? "value";
|
|
69
|
-
const itemConfig = getPayloadConfigFromPayload(
|
|
70
|
-
chart.config,
|
|
71
|
-
item,
|
|
72
|
-
key,
|
|
73
|
-
tooltipData as Record<string, unknown> | null
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
let value: unknown;
|
|
77
|
-
if (!labelKey && typeof label === "string") {
|
|
78
|
-
value = chart.config[label as keyof typeof chart.config]?.label ?? label;
|
|
79
|
-
} else if (labelKey) {
|
|
80
|
-
value = itemConfig?.label ?? dataLabel;
|
|
81
|
-
} else {
|
|
82
|
-
value = dataLabel;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (value === undefined) return null;
|
|
86
|
-
if (!labelFormatter) return value;
|
|
87
|
-
return labelFormatter(value, visibleSeries);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
const nestLabel = $derived(visibleSeries.length === 1 && indicator !== "dot");
|
|
91
|
-
</script>
|
|
92
|
-
|
|
93
|
-
{#snippet TooltipLabel()}
|
|
94
|
-
{#if formattedLabel}
|
|
95
|
-
<div class={cn("font-medium", labelClassName)}>
|
|
96
|
-
{#if typeof formattedLabel === "function"}
|
|
97
|
-
{@render formattedLabel()}
|
|
98
|
-
{:else}
|
|
99
|
-
{formattedLabel}
|
|
100
|
-
{/if}
|
|
101
|
-
</div>
|
|
102
|
-
{/if}
|
|
103
|
-
{/snippet}
|
|
104
|
-
|
|
105
|
-
<TooltipPrimitive.Root variant="none">
|
|
106
|
-
<div
|
|
107
|
-
bind:this={ref}
|
|
108
|
-
class={cn(
|
|
109
|
-
"border-border/50 bg-background grid min-w-[9rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
|
|
110
|
-
className
|
|
111
|
-
)}
|
|
112
|
-
{...restProps}
|
|
113
|
-
>
|
|
114
|
-
{#if !nestLabel}
|
|
115
|
-
{@render TooltipLabel()}
|
|
116
|
-
{/if}
|
|
117
|
-
<div class="grid gap-1.5">
|
|
118
|
-
{#each visibleSeries as item, i (item.key + i)}
|
|
119
|
-
{@const key = `${nameKey || item.key || item.label || "value"}`}
|
|
120
|
-
{@const itemConfig = getPayloadConfigFromPayload(
|
|
121
|
-
chart.config,
|
|
122
|
-
item,
|
|
123
|
-
key,
|
|
124
|
-
chartCtx.tooltip.data
|
|
125
|
-
)}
|
|
126
|
-
{@const indicatorColor = color || item.config?.color || item.color}
|
|
127
|
-
<div
|
|
128
|
-
class={cn(
|
|
129
|
-
"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:size-2.5",
|
|
130
|
-
indicator === "dot" && "items-center"
|
|
131
|
-
)}
|
|
132
|
-
>
|
|
133
|
-
{#if formatter && item.value !== undefined && item.label}
|
|
134
|
-
{@render formatter({
|
|
135
|
-
value: item.value,
|
|
136
|
-
name: item.label,
|
|
137
|
-
item,
|
|
138
|
-
index: i,
|
|
139
|
-
payload: visibleSeries,
|
|
140
|
-
})}
|
|
141
|
-
{:else}
|
|
142
|
-
{#if itemConfig?.icon}
|
|
143
|
-
<itemConfig.icon />
|
|
144
|
-
{:else if !hideIndicator}
|
|
145
|
-
<div
|
|
146
|
-
style="--color-bg: {indicatorColor}; --color-border: {indicatorColor};"
|
|
147
|
-
class={cn(
|
|
148
|
-
"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
|
|
149
|
-
{
|
|
150
|
-
"size-2.5": indicator === "dot",
|
|
151
|
-
"h-full w-1": indicator === "line",
|
|
152
|
-
"w-0 border-[1.5px] border-dashed bg-transparent":
|
|
153
|
-
indicator === "dashed",
|
|
154
|
-
"my-0.5": nestLabel && indicator === "dashed",
|
|
155
|
-
}
|
|
156
|
-
)}
|
|
157
|
-
></div>
|
|
158
|
-
{/if}
|
|
159
|
-
<div
|
|
160
|
-
class={cn(
|
|
161
|
-
"flex flex-1 shrink-0 justify-between leading-none",
|
|
162
|
-
nestLabel ? "items-end" : "items-center"
|
|
163
|
-
)}
|
|
164
|
-
>
|
|
165
|
-
<div class="grid gap-1.5">
|
|
166
|
-
{#if nestLabel}
|
|
167
|
-
{@render TooltipLabel()}
|
|
168
|
-
{/if}
|
|
169
|
-
<span class="text-muted-foreground">
|
|
170
|
-
{itemConfig?.label || item.label}
|
|
171
|
-
</span>
|
|
172
|
-
</div>
|
|
173
|
-
{#if item.value !== undefined}
|
|
174
|
-
<span class="text-foreground font-mono font-medium tabular-nums">
|
|
175
|
-
{item.value.toLocaleString()}
|
|
176
|
-
</span>
|
|
177
|
-
{/if}
|
|
178
|
-
</div>
|
|
179
|
-
{/if}
|
|
180
|
-
</div>
|
|
181
|
-
{/each}
|
|
182
|
-
</div>
|
|
183
|
-
</div>
|
|
184
|
-
</TooltipPrimitive.Root>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef, type WithoutChildren } from "../../../utils.js";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import { getPayloadConfigFromPayload, useChart, type TooltipPayload } from "./chart-utils.js";
|
|
5
|
+
import { getChartContext, Tooltip as TooltipPrimitive } from "layerchart";
|
|
6
|
+
import type { Snippet } from "svelte";
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
function defaultFormatter(value: any, _payload: TooltipPayload[]) {
|
|
10
|
+
return `${value}`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
ref = $bindable(null),
|
|
15
|
+
class: className,
|
|
16
|
+
hideLabel = false,
|
|
17
|
+
indicator = "dot",
|
|
18
|
+
hideIndicator = false,
|
|
19
|
+
labelKey,
|
|
20
|
+
label,
|
|
21
|
+
labelFormatter = defaultFormatter,
|
|
22
|
+
labelClassName,
|
|
23
|
+
formatter,
|
|
24
|
+
nameKey,
|
|
25
|
+
color,
|
|
26
|
+
...restProps
|
|
27
|
+
}: WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> & {
|
|
28
|
+
hideLabel?: boolean;
|
|
29
|
+
label?: string;
|
|
30
|
+
indicator?: "line" | "dot" | "dashed";
|
|
31
|
+
nameKey?: string;
|
|
32
|
+
labelKey?: string;
|
|
33
|
+
hideIndicator?: boolean;
|
|
34
|
+
labelClassName?: string;
|
|
35
|
+
labelFormatter?: // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
+
((value: any, payload: TooltipPayload[]) => string | number | Snippet) | null;
|
|
37
|
+
formatter?: Snippet<
|
|
38
|
+
[
|
|
39
|
+
{
|
|
40
|
+
value: unknown;
|
|
41
|
+
name: string;
|
|
42
|
+
item: TooltipPayload;
|
|
43
|
+
index: number;
|
|
44
|
+
payload: TooltipPayload[];
|
|
45
|
+
},
|
|
46
|
+
]
|
|
47
|
+
>;
|
|
48
|
+
} = $props();
|
|
49
|
+
|
|
50
|
+
const chart = useChart();
|
|
51
|
+
const chartCtx = getChartContext();
|
|
52
|
+
|
|
53
|
+
// Filter to series with defined values (important for item-based charts like Pie/Arc
|
|
54
|
+
// where only the hovered item has a value)
|
|
55
|
+
const visibleSeries = $derived(
|
|
56
|
+
chartCtx.tooltip.series.filter((s: TooltipPayload) => s.value !== undefined)
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const formattedLabel = $derived.by(() => {
|
|
60
|
+
if (hideLabel || !visibleSeries?.length) return null;
|
|
61
|
+
|
|
62
|
+
const [item] = visibleSeries;
|
|
63
|
+
const tooltipData = chartCtx.tooltip.data;
|
|
64
|
+
|
|
65
|
+
// Get the x-axis label value from the raw tooltip data (e.g. a Date or month string)
|
|
66
|
+
const dataLabel = tooltipData != null ? chartCtx.x(tooltipData) : undefined;
|
|
67
|
+
|
|
68
|
+
const key = labelKey ?? item?.label ?? item?.key ?? "value";
|
|
69
|
+
const itemConfig = getPayloadConfigFromPayload(
|
|
70
|
+
chart.config,
|
|
71
|
+
item,
|
|
72
|
+
key,
|
|
73
|
+
tooltipData as Record<string, unknown> | null
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
let value: unknown;
|
|
77
|
+
if (!labelKey && typeof label === "string") {
|
|
78
|
+
value = chart.config[label as keyof typeof chart.config]?.label ?? label;
|
|
79
|
+
} else if (labelKey) {
|
|
80
|
+
value = itemConfig?.label ?? dataLabel;
|
|
81
|
+
} else {
|
|
82
|
+
value = dataLabel;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (value === undefined) return null;
|
|
86
|
+
if (!labelFormatter) return value;
|
|
87
|
+
return labelFormatter(value, visibleSeries);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const nestLabel = $derived(visibleSeries.length === 1 && indicator !== "dot");
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
{#snippet TooltipLabel()}
|
|
94
|
+
{#if formattedLabel}
|
|
95
|
+
<div class={cn("font-medium", labelClassName)}>
|
|
96
|
+
{#if typeof formattedLabel === "function"}
|
|
97
|
+
{@render formattedLabel()}
|
|
98
|
+
{:else}
|
|
99
|
+
{formattedLabel}
|
|
100
|
+
{/if}
|
|
101
|
+
</div>
|
|
102
|
+
{/if}
|
|
103
|
+
{/snippet}
|
|
104
|
+
|
|
105
|
+
<TooltipPrimitive.Root variant="none">
|
|
106
|
+
<div
|
|
107
|
+
bind:this={ref}
|
|
108
|
+
class={cn(
|
|
109
|
+
"border-border/50 bg-background grid min-w-[9rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
|
|
110
|
+
className
|
|
111
|
+
)}
|
|
112
|
+
{...restProps}
|
|
113
|
+
>
|
|
114
|
+
{#if !nestLabel}
|
|
115
|
+
{@render TooltipLabel()}
|
|
116
|
+
{/if}
|
|
117
|
+
<div class="grid gap-1.5">
|
|
118
|
+
{#each visibleSeries as item, i (item.key + i)}
|
|
119
|
+
{@const key = `${nameKey || item.key || item.label || "value"}`}
|
|
120
|
+
{@const itemConfig = getPayloadConfigFromPayload(
|
|
121
|
+
chart.config,
|
|
122
|
+
item,
|
|
123
|
+
key,
|
|
124
|
+
chartCtx.tooltip.data
|
|
125
|
+
)}
|
|
126
|
+
{@const indicatorColor = color || item.config?.color || item.color}
|
|
127
|
+
<div
|
|
128
|
+
class={cn(
|
|
129
|
+
"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:size-2.5",
|
|
130
|
+
indicator === "dot" && "items-center"
|
|
131
|
+
)}
|
|
132
|
+
>
|
|
133
|
+
{#if formatter && item.value !== undefined && item.label}
|
|
134
|
+
{@render formatter({
|
|
135
|
+
value: item.value,
|
|
136
|
+
name: item.label,
|
|
137
|
+
item,
|
|
138
|
+
index: i,
|
|
139
|
+
payload: visibleSeries,
|
|
140
|
+
})}
|
|
141
|
+
{:else}
|
|
142
|
+
{#if itemConfig?.icon}
|
|
143
|
+
<itemConfig.icon />
|
|
144
|
+
{:else if !hideIndicator}
|
|
145
|
+
<div
|
|
146
|
+
style="--color-bg: {indicatorColor}; --color-border: {indicatorColor};"
|
|
147
|
+
class={cn(
|
|
148
|
+
"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
|
|
149
|
+
{
|
|
150
|
+
"size-2.5": indicator === "dot",
|
|
151
|
+
"h-full w-1": indicator === "line",
|
|
152
|
+
"w-0 border-[1.5px] border-dashed bg-transparent":
|
|
153
|
+
indicator === "dashed",
|
|
154
|
+
"my-0.5": nestLabel && indicator === "dashed",
|
|
155
|
+
}
|
|
156
|
+
)}
|
|
157
|
+
></div>
|
|
158
|
+
{/if}
|
|
159
|
+
<div
|
|
160
|
+
class={cn(
|
|
161
|
+
"flex flex-1 shrink-0 justify-between leading-none",
|
|
162
|
+
nestLabel ? "items-end" : "items-center"
|
|
163
|
+
)}
|
|
164
|
+
>
|
|
165
|
+
<div class="grid gap-1.5">
|
|
166
|
+
{#if nestLabel}
|
|
167
|
+
{@render TooltipLabel()}
|
|
168
|
+
{/if}
|
|
169
|
+
<span class="text-muted-foreground">
|
|
170
|
+
{itemConfig?.label || item.label}
|
|
171
|
+
</span>
|
|
172
|
+
</div>
|
|
173
|
+
{#if item.value !== undefined}
|
|
174
|
+
<span class="text-foreground font-mono font-medium tabular-nums">
|
|
175
|
+
{item.value.toLocaleString()}
|
|
176
|
+
</span>
|
|
177
|
+
{/if}
|
|
178
|
+
</div>
|
|
179
|
+
{/if}
|
|
180
|
+
</div>
|
|
181
|
+
{/each}
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
</TooltipPrimitive.Root>
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Checkbox as CheckboxPrimitive } from "bits-ui";
|
|
3
|
-
import { cn, type WithoutChildrenOrChild } from "../../../utils.js";
|
|
4
|
-
import { HugeiconsIcon } from "@hugeicons/svelte"
|
|
5
|
-
import { Tick02Icon } from '@hugeicons/core-free-icons';
|
|
6
|
-
import { MinusSignIcon } from '@hugeicons/core-free-icons';
|
|
7
|
-
|
|
8
|
-
let {
|
|
9
|
-
ref = $bindable(null),
|
|
10
|
-
checked = $bindable(false),
|
|
11
|
-
indeterminate = $bindable(false),
|
|
12
|
-
class: className,
|
|
13
|
-
...restProps
|
|
14
|
-
}: WithoutChildrenOrChild<CheckboxPrimitive.RootProps> = $props();
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<CheckboxPrimitive.Root
|
|
18
|
-
bind:ref
|
|
19
|
-
data-slot="checkbox"
|
|
20
|
-
class={cn(
|
|
21
|
-
"border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 flex size-4 items-center justify-center rounded-[6px] border transition-shadow group-has-disabled/field:opacity-50 focus-visible:ring-[3px] aria-invalid:ring-[3px] peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
22
|
-
className
|
|
23
|
-
)}
|
|
24
|
-
bind:checked
|
|
25
|
-
bind:indeterminate
|
|
26
|
-
{...restProps}
|
|
27
|
-
>
|
|
28
|
-
{#snippet children({ checked, indeterminate })}
|
|
29
|
-
<div
|
|
30
|
-
data-slot="checkbox-indicator"
|
|
31
|
-
class="[&>svg]:size-3.5 grid place-content-center text-current transition-none"
|
|
32
|
-
>
|
|
33
|
-
{#if checked}
|
|
34
|
-
<HugeiconsIcon icon={Tick02Icon} strokeWidth={2} />
|
|
35
|
-
{:else if indeterminate}
|
|
36
|
-
<HugeiconsIcon icon={MinusSignIcon} strokeWidth={2} />
|
|
37
|
-
{/if}
|
|
38
|
-
</div>
|
|
39
|
-
{/snippet}
|
|
40
|
-
</CheckboxPrimitive.Root>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Checkbox as CheckboxPrimitive } from "bits-ui";
|
|
3
|
+
import { cn, type WithoutChildrenOrChild } from "../../../utils.js";
|
|
4
|
+
import { HugeiconsIcon } from "@hugeicons/svelte"
|
|
5
|
+
import { Tick02Icon } from '@hugeicons/core-free-icons';
|
|
6
|
+
import { MinusSignIcon } from '@hugeicons/core-free-icons';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
ref = $bindable(null),
|
|
10
|
+
checked = $bindable(false),
|
|
11
|
+
indeterminate = $bindable(false),
|
|
12
|
+
class: className,
|
|
13
|
+
...restProps
|
|
14
|
+
}: WithoutChildrenOrChild<CheckboxPrimitive.RootProps> = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<CheckboxPrimitive.Root
|
|
18
|
+
bind:ref
|
|
19
|
+
data-slot="checkbox"
|
|
20
|
+
class={cn(
|
|
21
|
+
"border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 flex size-4 items-center justify-center rounded-[6px] border transition-shadow group-has-disabled/field:opacity-50 focus-visible:ring-[3px] aria-invalid:ring-[3px] peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
bind:checked
|
|
25
|
+
bind:indeterminate
|
|
26
|
+
{...restProps}
|
|
27
|
+
>
|
|
28
|
+
{#snippet children({ checked, indeterminate })}
|
|
29
|
+
<div
|
|
30
|
+
data-slot="checkbox-indicator"
|
|
31
|
+
class="[&>svg]:size-3.5 grid place-content-center text-current transition-none"
|
|
32
|
+
>
|
|
33
|
+
{#if checked}
|
|
34
|
+
<HugeiconsIcon icon={Tick02Icon} strokeWidth={2} />
|
|
35
|
+
{:else if indeterminate}
|
|
36
|
+
<HugeiconsIcon icon={MinusSignIcon} strokeWidth={2} />
|
|
37
|
+
{/if}
|
|
38
|
+
</div>
|
|
39
|
+
{/snippet}
|
|
40
|
+
</CheckboxPrimitive.Root>
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
<script
|
|
2
|
-
lang="ts"
|
|
3
|
-
generics="TData, TValue, TContext extends HeaderContext<TData, TValue> | CellContext<TData, TValue>"
|
|
4
|
-
>
|
|
5
|
-
import type { CellContext, ColumnDefTemplate, HeaderContext } from "@tanstack/table-core";
|
|
6
|
-
import { RenderComponentConfig, RenderSnippetConfig } from "./render-helpers.js";
|
|
7
|
-
import type { Attachment } from "svelte/attachments";
|
|
8
|
-
type Props = {
|
|
9
|
-
/** The cell or header field of the current cell's column definition. */
|
|
10
|
-
content?: TContext extends HeaderContext<TData, TValue>
|
|
11
|
-
? ColumnDefTemplate<HeaderContext<TData, TValue>>
|
|
12
|
-
: TContext extends CellContext<TData, TValue>
|
|
13
|
-
? ColumnDefTemplate<CellContext<TData, TValue>>
|
|
14
|
-
: never;
|
|
15
|
-
/** The result of the `getContext()` function of the header or cell */
|
|
16
|
-
context: TContext;
|
|
17
|
-
|
|
18
|
-
/** Used to pass attachments that can't be gotten through context */
|
|
19
|
-
attach?: Attachment;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
let { content, context, attach }: Props = $props();
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
{#if typeof content === "string"}
|
|
26
|
-
{content}
|
|
27
|
-
{:else if content instanceof Function}
|
|
28
|
-
<!-- It's unlikely that a CellContext will be passed to a Header -->
|
|
29
|
-
<!-- eslint-disable-next-line @typescript-eslint/no-explicit-any -->
|
|
30
|
-
{@const result = content(context as any)}
|
|
31
|
-
{#if result instanceof RenderComponentConfig}
|
|
32
|
-
{@const { component: Component, props } = result}
|
|
33
|
-
<Component {...props} {attach} />
|
|
34
|
-
{:else if result instanceof RenderSnippetConfig}
|
|
35
|
-
{@const { snippet, params } = result}
|
|
36
|
-
{@render snippet({ ...params, attach })}
|
|
37
|
-
{:else}
|
|
38
|
-
{result}
|
|
39
|
-
{/if}
|
|
40
|
-
{/if}
|
|
1
|
+
<script
|
|
2
|
+
lang="ts"
|
|
3
|
+
generics="TData, TValue, TContext extends HeaderContext<TData, TValue> | CellContext<TData, TValue>"
|
|
4
|
+
>
|
|
5
|
+
import type { CellContext, ColumnDefTemplate, HeaderContext } from "@tanstack/table-core";
|
|
6
|
+
import { RenderComponentConfig, RenderSnippetConfig } from "./render-helpers.js";
|
|
7
|
+
import type { Attachment } from "svelte/attachments";
|
|
8
|
+
type Props = {
|
|
9
|
+
/** The cell or header field of the current cell's column definition. */
|
|
10
|
+
content?: TContext extends HeaderContext<TData, TValue>
|
|
11
|
+
? ColumnDefTemplate<HeaderContext<TData, TValue>>
|
|
12
|
+
: TContext extends CellContext<TData, TValue>
|
|
13
|
+
? ColumnDefTemplate<CellContext<TData, TValue>>
|
|
14
|
+
: never;
|
|
15
|
+
/** The result of the `getContext()` function of the header or cell */
|
|
16
|
+
context: TContext;
|
|
17
|
+
|
|
18
|
+
/** Used to pass attachments that can't be gotten through context */
|
|
19
|
+
attach?: Attachment;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
let { content, context, attach }: Props = $props();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
{#if typeof content === "string"}
|
|
26
|
+
{content}
|
|
27
|
+
{:else if content instanceof Function}
|
|
28
|
+
<!-- It's unlikely that a CellContext will be passed to a Header -->
|
|
29
|
+
<!-- eslint-disable-next-line @typescript-eslint/no-explicit-any -->
|
|
30
|
+
{@const result = content(context as any)}
|
|
31
|
+
{#if result instanceof RenderComponentConfig}
|
|
32
|
+
{@const { component: Component, props } = result}
|
|
33
|
+
<Component {...props} {attach} />
|
|
34
|
+
{:else if result instanceof RenderSnippetConfig}
|
|
35
|
+
{@const { snippet, params } = result}
|
|
36
|
+
{@render snippet({ ...params, attach })}
|
|
37
|
+
{:else}
|
|
38
|
+
{result}
|
|
39
|
+
{/if}
|
|
40
|
+
{/if}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Drawer as DrawerPrimitive } from "vaul-svelte";
|
|
3
|
-
|
|
4
|
-
let { ref = $bindable(null), ...restProps }: DrawerPrimitive.CloseProps = $props();
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<DrawerPrimitive.Close bind:ref data-slot="drawer-close" {...restProps} />
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Drawer as DrawerPrimitive } from "vaul-svelte";
|
|
3
|
+
|
|
4
|
+
let { ref = $bindable(null), ...restProps }: DrawerPrimitive.CloseProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<DrawerPrimitive.Close bind:ref data-slot="drawer-close" {...restProps} />
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Drawer as DrawerPrimitive } from "vaul-svelte";
|
|
3
|
-
import DrawerPortal from "./drawer-portal.svelte";
|
|
4
|
-
import DrawerOverlay from "./drawer-overlay.svelte";
|
|
5
|
-
import { cn } from "../../../utils.js";
|
|
6
|
-
import type { ComponentProps } from "svelte";
|
|
7
|
-
import type { WithoutChildrenOrChild } from "../../../utils.js";
|
|
8
|
-
|
|
9
|
-
let {
|
|
10
|
-
ref = $bindable(null),
|
|
11
|
-
class: className,
|
|
12
|
-
portalProps,
|
|
13
|
-
children,
|
|
14
|
-
...restProps
|
|
15
|
-
}: DrawerPrimitive.ContentProps & {
|
|
16
|
-
portalProps?: WithoutChildrenOrChild<ComponentProps<typeof DrawerPortal>>;
|
|
17
|
-
} = $props();
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<DrawerPortal {...portalProps}>
|
|
21
|
-
<DrawerOverlay />
|
|
22
|
-
<DrawerPrimitive.Content
|
|
23
|
-
bind:ref
|
|
24
|
-
data-slot="drawer-content"
|
|
25
|
-
class={cn("before:bg-popover text-popover-foreground before:border-border relative flex h-auto flex-col bg-transparent p-4 text-sm before:absolute before:inset-2 before:-z-10 before:rounded-4xl before:border data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm group/drawer-content fixed z-50", className)}
|
|
26
|
-
{...restProps}
|
|
27
|
-
>
|
|
28
|
-
<div
|
|
29
|
-
class="bg-muted mx-auto mt-4 hidden h-1.5 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block bg-muted mx-auto hidden shrink-0 group-data-[vaul-drawer-direction=bottom]/drawer-content:block"
|
|
30
|
-
></div>
|
|
31
|
-
{@render children?.()}
|
|
32
|
-
</DrawerPrimitive.Content>
|
|
33
|
-
</DrawerPortal>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Drawer as DrawerPrimitive } from "vaul-svelte";
|
|
3
|
+
import DrawerPortal from "./drawer-portal.svelte";
|
|
4
|
+
import DrawerOverlay from "./drawer-overlay.svelte";
|
|
5
|
+
import { cn } from "../../../utils.js";
|
|
6
|
+
import type { ComponentProps } from "svelte";
|
|
7
|
+
import type { WithoutChildrenOrChild } from "../../../utils.js";
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
ref = $bindable(null),
|
|
11
|
+
class: className,
|
|
12
|
+
portalProps,
|
|
13
|
+
children,
|
|
14
|
+
...restProps
|
|
15
|
+
}: DrawerPrimitive.ContentProps & {
|
|
16
|
+
portalProps?: WithoutChildrenOrChild<ComponentProps<typeof DrawerPortal>>;
|
|
17
|
+
} = $props();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<DrawerPortal {...portalProps}>
|
|
21
|
+
<DrawerOverlay />
|
|
22
|
+
<DrawerPrimitive.Content
|
|
23
|
+
bind:ref
|
|
24
|
+
data-slot="drawer-content"
|
|
25
|
+
class={cn("before:bg-popover text-popover-foreground before:border-border relative flex h-auto flex-col bg-transparent p-4 text-sm before:absolute before:inset-2 before:-z-10 before:rounded-4xl before:border data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm group/drawer-content fixed z-50", className)}
|
|
26
|
+
{...restProps}
|
|
27
|
+
>
|
|
28
|
+
<div
|
|
29
|
+
class="bg-muted mx-auto mt-4 hidden h-1.5 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block bg-muted mx-auto hidden shrink-0 group-data-[vaul-drawer-direction=bottom]/drawer-content:block"
|
|
30
|
+
></div>
|
|
31
|
+
{@render children?.()}
|
|
32
|
+
</DrawerPrimitive.Content>
|
|
33
|
+
</DrawerPortal>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Drawer as DrawerPrimitive } from "vaul-svelte";
|
|
3
|
-
import { cn } from "../../../utils.js";
|
|
4
|
-
|
|
5
|
-
let {
|
|
6
|
-
ref = $bindable(null),
|
|
7
|
-
class: className,
|
|
8
|
-
...restProps
|
|
9
|
-
}: DrawerPrimitive.DescriptionProps = $props();
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<DrawerPrimitive.Description
|
|
13
|
-
bind:ref
|
|
14
|
-
data-slot="drawer-description"
|
|
15
|
-
class={cn("text-muted-foreground text-sm", className)}
|
|
16
|
-
{...restProps}
|
|
17
|
-
/>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Drawer as DrawerPrimitive } from "vaul-svelte";
|
|
3
|
+
import { cn } from "../../../utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: DrawerPrimitive.DescriptionProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<DrawerPrimitive.Description
|
|
13
|
+
bind:ref
|
|
14
|
+
data-slot="drawer-description"
|
|
15
|
+
class={cn("text-muted-foreground text-sm", className)}
|
|
16
|
+
{...restProps}
|
|
17
|
+
/>
|