@starwind-ui/core 1.12.0 → 1.12.1
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/package.json +1 -1
- package/dist/index.d.ts +0 -28
- package/dist/index.js +0 -81
- package/dist/index.js.map +0 -1
- package/dist/src/components/accordion/Accordion.astro +0 -247
- package/dist/src/components/accordion/AccordionContent.astro +0 -33
- package/dist/src/components/accordion/AccordionItem.astro +0 -27
- package/dist/src/components/accordion/AccordionTrigger.astro +0 -32
- package/dist/src/components/accordion/index.ts +0 -15
- package/dist/src/components/alert/Alert.astro +0 -31
- package/dist/src/components/alert/AlertDescription.astro +0 -14
- package/dist/src/components/alert/AlertTitle.astro +0 -16
- package/dist/src/components/alert/index.ts +0 -13
- package/dist/src/components/alert-dialog/AlertDialog.astro +0 -273
- package/dist/src/components/alert-dialog/AlertDialogAction.astro +0 -44
- package/dist/src/components/alert-dialog/AlertDialogCancel.astro +0 -45
- package/dist/src/components/alert-dialog/AlertDialogContent.astro +0 -52
- package/dist/src/components/alert-dialog/AlertDialogDescription.astro +0 -18
- package/dist/src/components/alert-dialog/AlertDialogFooter.astro +0 -16
- package/dist/src/components/alert-dialog/AlertDialogHeader.astro +0 -14
- package/dist/src/components/alert-dialog/AlertDialogTitle.astro +0 -20
- package/dist/src/components/alert-dialog/AlertDialogTrigger.astro +0 -47
- package/dist/src/components/alert-dialog/index.ts +0 -46
- package/dist/src/components/aspect-ratio/AspectRatio.astro +0 -32
- package/dist/src/components/aspect-ratio/index.ts +0 -7
- package/dist/src/components/avatar/Avatar.astro +0 -29
- package/dist/src/components/avatar/AvatarFallback.astro +0 -18
- package/dist/src/components/avatar/AvatarImage.astro +0 -49
- package/dist/src/components/avatar/index.ts +0 -13
- package/dist/src/components/badge/Badge.astro +0 -51
- package/dist/src/components/badge/index.ts +0 -7
- package/dist/src/components/breadcrumb/Breadcrumb.astro +0 -11
- package/dist/src/components/breadcrumb/BreadcrumbEllipsis.astro +0 -28
- package/dist/src/components/breadcrumb/BreadcrumbItem.astro +0 -14
- package/dist/src/components/breadcrumb/BreadcrumbLink.astro +0 -22
- package/dist/src/components/breadcrumb/BreadcrumbList.astro +0 -16
- package/dist/src/components/breadcrumb/BreadcrumbPage.astro +0 -21
- package/dist/src/components/breadcrumb/BreadcrumbSeparator.astro +0 -23
- package/dist/src/components/breadcrumb/index.ts +0 -37
- package/dist/src/components/button/Button.astro +0 -53
- package/dist/src/components/button/index.ts +0 -7
- package/dist/src/components/button-group/ButtonGroup.astro +0 -62
- package/dist/src/components/button-group/ButtonGroupSeparator.astro +0 -27
- package/dist/src/components/button-group/ButtonGroupText.astro +0 -19
- package/dist/src/components/button-group/index.ts +0 -17
- package/dist/src/components/card/Card.astro +0 -14
- package/dist/src/components/card/CardContent.astro +0 -14
- package/dist/src/components/card/CardDescription.astro +0 -14
- package/dist/src/components/card/CardFooter.astro +0 -14
- package/dist/src/components/card/CardHeader.astro +0 -14
- package/dist/src/components/card/CardTitle.astro +0 -14
- package/dist/src/components/card/index.ts +0 -26
- package/dist/src/components/carousel/Carousel.astro +0 -55
- package/dist/src/components/carousel/CarouselContent.astro +0 -26
- package/dist/src/components/carousel/CarouselItem.astro +0 -26
- package/dist/src/components/carousel/CarouselNext.astro +0 -37
- package/dist/src/components/carousel/CarouselPrevious.astro +0 -37
- package/dist/src/components/carousel/carousel-script.ts +0 -191
- package/dist/src/components/carousel/index.ts +0 -32
- package/dist/src/components/checkbox/Checkbox.astro +0 -127
- package/dist/src/components/checkbox/index.ts +0 -7
- package/dist/src/components/dialog/Dialog.astro +0 -263
- package/dist/src/components/dialog/DialogClose.astro +0 -35
- package/dist/src/components/dialog/DialogContent.astro +0 -67
- package/dist/src/components/dialog/DialogDescription.astro +0 -14
- package/dist/src/components/dialog/DialogFooter.astro +0 -14
- package/dist/src/components/dialog/DialogHeader.astro +0 -14
- package/dist/src/components/dialog/DialogTitle.astro +0 -20
- package/dist/src/components/dialog/DialogTrigger.astro +0 -47
- package/dist/src/components/dialog/index.ts +0 -45
- package/dist/src/components/dropdown/Dropdown.astro +0 -375
- package/dist/src/components/dropdown/DropdownContent.astro +0 -81
- package/dist/src/components/dropdown/DropdownItem.astro +0 -48
- package/dist/src/components/dropdown/DropdownLabel.astro +0 -29
- package/dist/src/components/dropdown/DropdownSeparator.astro +0 -21
- package/dist/src/components/dropdown/DropdownTrigger.astro +0 -52
- package/dist/src/components/dropdown/index.ts +0 -33
- package/dist/src/components/dropzone/Dropzone.astro +0 -233
- package/dist/src/components/dropzone/DropzoneFilesList.astro +0 -26
- package/dist/src/components/dropzone/DropzoneLoadingIndicator.astro +0 -10
- package/dist/src/components/dropzone/DropzoneUploadIndicator.astro +0 -10
- package/dist/src/components/dropzone/index.ts +0 -24
- package/dist/src/components/input/Input.astro +0 -24
- package/dist/src/components/input/index.ts +0 -7
- package/dist/src/components/item/Item.astro +0 -52
- package/dist/src/components/item/ItemActions.astro +0 -16
- package/dist/src/components/item/ItemContent.astro +0 -16
- package/dist/src/components/item/ItemDescription.astro +0 -19
- package/dist/src/components/item/ItemFooter.astro +0 -16
- package/dist/src/components/item/ItemGroup.astro +0 -16
- package/dist/src/components/item/ItemHeader.astro +0 -16
- package/dist/src/components/item/ItemMedia.astro +0 -40
- package/dist/src/components/item/ItemSeparator.astro +0 -21
- package/dist/src/components/item/ItemTitle.astro +0 -16
- package/dist/src/components/item/index.ts +0 -50
- package/dist/src/components/kbd/Kbd.astro +0 -21
- package/dist/src/components/kbd/KbdGroup.astro +0 -16
- package/dist/src/components/kbd/index.ts +0 -11
- package/dist/src/components/label/Label.astro +0 -22
- package/dist/src/components/label/index.ts +0 -7
- package/dist/src/components/pagination/Pagination.astro +0 -20
- package/dist/src/components/pagination/PaginationContent.astro +0 -16
- package/dist/src/components/pagination/PaginationEllipsis.astro +0 -35
- package/dist/src/components/pagination/PaginationItem.astro +0 -16
- package/dist/src/components/pagination/PaginationLink.astro +0 -24
- package/dist/src/components/pagination/PaginationNext.astro +0 -30
- package/dist/src/components/pagination/PaginationPrevious.astro +0 -30
- package/dist/src/components/pagination/index.ts +0 -38
- package/dist/src/components/progress/Progress.astro +0 -154
- package/dist/src/components/progress/index.ts +0 -10
- package/dist/src/components/radio-group/RadioGroup.astro +0 -157
- package/dist/src/components/radio-group/RadioGroupItem.astro +0 -129
- package/dist/src/components/radio-group/RadioGroupTypes.ts +0 -6
- package/dist/src/components/radio-group/index.ts +0 -23
- package/dist/src/components/select/Select.astro +0 -696
- package/dist/src/components/select/SelectContent.astro +0 -94
- package/dist/src/components/select/SelectGroup.astro +0 -9
- package/dist/src/components/select/SelectItem.astro +0 -51
- package/dist/src/components/select/SelectLabel.astro +0 -14
- package/dist/src/components/select/SelectSearch.astro +0 -49
- package/dist/src/components/select/SelectSeparator.astro +0 -12
- package/dist/src/components/select/SelectTrigger.astro +0 -58
- package/dist/src/components/select/SelectTypes.ts +0 -13
- package/dist/src/components/select/SelectValue.astro +0 -19
- package/dist/src/components/select/index.ts +0 -49
- package/dist/src/components/separator/Separator.astro +0 -36
- package/dist/src/components/separator/index.ts +0 -7
- package/dist/src/components/sheet/Sheet.astro +0 -13
- package/dist/src/components/sheet/SheetClose.astro +0 -13
- package/dist/src/components/sheet/SheetContent.astro +0 -92
- package/dist/src/components/sheet/SheetDescription.astro +0 -16
- package/dist/src/components/sheet/SheetFooter.astro +0 -16
- package/dist/src/components/sheet/SheetHeader.astro +0 -16
- package/dist/src/components/sheet/SheetTitle.astro +0 -16
- package/dist/src/components/sheet/SheetTrigger.astro +0 -13
- package/dist/src/components/sheet/index.ts +0 -41
- package/dist/src/components/skeleton/Skeleton.astro +0 -14
- package/dist/src/components/skeleton/index.ts +0 -9
- package/dist/src/components/spinner/Spinner.astro +0 -21
- package/dist/src/components/spinner/index.ts +0 -7
- package/dist/src/components/switch/Switch.astro +0 -191
- package/dist/src/components/switch/SwitchTypes.ts +0 -6
- package/dist/src/components/switch/index.ts +0 -12
- package/dist/src/components/table/Table.astro +0 -18
- package/dist/src/components/table/TableBody.astro +0 -16
- package/dist/src/components/table/TableCaption.astro +0 -16
- package/dist/src/components/table/TableCell.astro +0 -16
- package/dist/src/components/table/TableFoot.astro +0 -16
- package/dist/src/components/table/TableHead.astro +0 -16
- package/dist/src/components/table/TableHeader.astro +0 -16
- package/dist/src/components/table/TableRow.astro +0 -16
- package/dist/src/components/table/index.ts +0 -42
- package/dist/src/components/tabs/Tabs.astro +0 -269
- package/dist/src/components/tabs/TabsContent.astro +0 -28
- package/dist/src/components/tabs/TabsList.astro +0 -22
- package/dist/src/components/tabs/TabsTrigger.astro +0 -34
- package/dist/src/components/tabs/index.ts +0 -20
- package/dist/src/components/textarea/Textarea.astro +0 -28
- package/dist/src/components/textarea/index.ts +0 -9
- package/dist/src/components/toggle/Toggle.astro +0 -172
- package/dist/src/components/toggle/ToggleTypes.ts +0 -14
- package/dist/src/components/toggle/index.ts +0 -8
- package/dist/src/components/tooltip/Tooltip.astro +0 -237
- package/dist/src/components/tooltip/TooltipContent.astro +0 -114
- package/dist/src/components/tooltip/TooltipTrigger.astro +0 -10
- package/dist/src/components/tooltip/index.ts +0 -16
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import Loader2 from "@tabler/icons/outline/loader-2.svg";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
import { tv } from "tailwind-variants";
|
|
5
|
-
|
|
6
|
-
type Props = Omit<HTMLAttributes<"svg">, "role" | "aria-label">;
|
|
7
|
-
|
|
8
|
-
export const spinner = tv({
|
|
9
|
-
base: "size-4 animate-spin",
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const { class: className, ...rest } = Astro.props;
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
<Loader2
|
|
16
|
-
role="status"
|
|
17
|
-
aria-label="Loading"
|
|
18
|
-
class={spinner({ class: className })}
|
|
19
|
-
data-slot="spinner"
|
|
20
|
-
{...rest}
|
|
21
|
-
/>
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { tv } from "tailwind-variants";
|
|
4
|
-
|
|
5
|
-
type Props = Omit<HTMLAttributes<"button">, "role" | "type" | "aria-checked"> & {
|
|
6
|
-
/**
|
|
7
|
-
* Unique identifier for the switch component.
|
|
8
|
-
*/
|
|
9
|
-
id: string;
|
|
10
|
-
/**
|
|
11
|
-
* Optional text label to display alongside the switch.
|
|
12
|
-
*/
|
|
13
|
-
label?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Controls the checked state of the switch.
|
|
16
|
-
*/
|
|
17
|
-
checked?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Custom padding in pixels to apply around the switch.
|
|
20
|
-
*/
|
|
21
|
-
padding?: number;
|
|
22
|
-
/**
|
|
23
|
-
* Size variant of the switch component.
|
|
24
|
-
*/
|
|
25
|
-
size?: "sm" | "md" | "lg";
|
|
26
|
-
/**
|
|
27
|
-
* Visual style variant of the switch.
|
|
28
|
-
* @default "default"
|
|
29
|
-
*/
|
|
30
|
-
variant?: "default" | "primary" | "secondary" | "info" | "success" | "warning" | "error";
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const {
|
|
34
|
-
id,
|
|
35
|
-
label,
|
|
36
|
-
checked = false,
|
|
37
|
-
padding,
|
|
38
|
-
size = "md",
|
|
39
|
-
variant = "default",
|
|
40
|
-
class: className,
|
|
41
|
-
...rest
|
|
42
|
-
} = Astro.props;
|
|
43
|
-
|
|
44
|
-
// if no specific padding is set, base it off of size
|
|
45
|
-
let newPadding = padding;
|
|
46
|
-
if (!padding) {
|
|
47
|
-
newPadding = size === "sm" ? 2.5 : size === "lg" ? 4 : 3;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const sizeMultiplier = size === "sm" ? 4 : size === "lg" ? 6 : 5;
|
|
51
|
-
|
|
52
|
-
let ariaLabel;
|
|
53
|
-
if (rest["aria-label"]) {
|
|
54
|
-
ariaLabel = rest["aria-label"];
|
|
55
|
-
delete rest["aria-label"];
|
|
56
|
-
} else if (label) {
|
|
57
|
-
ariaLabel = label;
|
|
58
|
-
} else {
|
|
59
|
-
ariaLabel = "switch";
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export const switchButton = tv({
|
|
63
|
-
base: [
|
|
64
|
-
"border-input bg-muted inline-flex h-(--height) w-(--width) items-center rounded-full border",
|
|
65
|
-
"group peer ring-offset-background transition outline-none focus-visible:ring-3",
|
|
66
|
-
"not-disabled:cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",
|
|
67
|
-
],
|
|
68
|
-
variants: {
|
|
69
|
-
variant: {
|
|
70
|
-
primary: "aria-checked:border-primary focus-visible:border-primary/70 focus:ring-primary/50",
|
|
71
|
-
secondary:
|
|
72
|
-
"aria-checked:border-secondary focus-visible:border-secondary/70 focus:ring-secondary/50",
|
|
73
|
-
default: "aria-checked:border-foreground focus-visible:border-outline focus:ring-outline/50",
|
|
74
|
-
info: "aria-checked:border-info focus-visible:border-info/70 focus:ring-info/50",
|
|
75
|
-
success: "aria-checked:border-success focus-visible:border-success/70 focus:ring-success/50",
|
|
76
|
-
warning: "aria-checked:border-warning focus-visible:border-warning/70 focus:ring-warning/50",
|
|
77
|
-
error: "aria-checked:border-error focus-visible:border-error/70 focus:ring-error/50",
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
defaultVariants: { variant: "default" },
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
export const switchToggle = tv({
|
|
84
|
-
base: [
|
|
85
|
-
"bg-foreground inline-block transform rounded-full transition-transform",
|
|
86
|
-
"group-aria-checked:translate-x-(--translation) group-aria-[checked=false]:translate-x-[calc(var(--padding)-var(--border-offset))]",
|
|
87
|
-
],
|
|
88
|
-
variants: { size: { sm: "size-4", md: "size-5", lg: "size-6" } },
|
|
89
|
-
defaultVariants: { size: "md" },
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
export const switchLabel = tv({
|
|
93
|
-
base: "text-foreground ml-2 font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
94
|
-
variants: { size: { sm: "text-sm", md: "text-base", lg: "text-lg" } },
|
|
95
|
-
defaultVariants: { size: "md" },
|
|
96
|
-
});
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
<div class="starwind-switch flex items-center">
|
|
100
|
-
<button
|
|
101
|
-
type="button"
|
|
102
|
-
id={id}
|
|
103
|
-
role="switch"
|
|
104
|
-
aria-checked={checked ? "true" : "false"}
|
|
105
|
-
aria-label={ariaLabel}
|
|
106
|
-
class={switchButton({ variant, class: className })}
|
|
107
|
-
style={{
|
|
108
|
-
"--padding": `${newPadding}px`,
|
|
109
|
-
"--height": `calc((var(--spacing) * ${sizeMultiplier}) + (var(--padding) * 2))`,
|
|
110
|
-
"--width": `calc((var(--spacing) * ${sizeMultiplier} * 2) + (var(--padding) * 3))`,
|
|
111
|
-
"--border-offset": "1px",
|
|
112
|
-
}}
|
|
113
|
-
data-slot="switch-button"
|
|
114
|
-
{...rest}
|
|
115
|
-
>
|
|
116
|
-
<span
|
|
117
|
-
class={switchToggle({ size })}
|
|
118
|
-
data-slot="switch-toggle"
|
|
119
|
-
style={{
|
|
120
|
-
"--translation": `calc((var(--spacing) * ${sizeMultiplier}) + (var(--padding) * 2) - var(--border-offset))`,
|
|
121
|
-
}}></span>
|
|
122
|
-
</button>
|
|
123
|
-
{
|
|
124
|
-
label && (
|
|
125
|
-
<label for={id} class={switchLabel({ size })} data-slot="switch-label">
|
|
126
|
-
{label}
|
|
127
|
-
</label>
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
</div>
|
|
131
|
-
|
|
132
|
-
<script>
|
|
133
|
-
import type { SwitchChangeEvent } from "./SwitchTypes";
|
|
134
|
-
|
|
135
|
-
class SwitchHandler {
|
|
136
|
-
private switchButton: HTMLButtonElement;
|
|
137
|
-
|
|
138
|
-
constructor(switchButton: HTMLButtonElement) {
|
|
139
|
-
this.switchButton = switchButton;
|
|
140
|
-
this.setupEventListeners();
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
private setupEventListeners(): void {
|
|
144
|
-
this.switchButton.addEventListener("click", () => this.handleStateChange());
|
|
145
|
-
this.switchButton.addEventListener("keydown", (event) => this.handleKeyDown(event));
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
private handleStateChange(): void {
|
|
149
|
-
if (this.switchButton.disabled) return;
|
|
150
|
-
|
|
151
|
-
const isChecked = this.switchButton.getAttribute("aria-checked") === "true";
|
|
152
|
-
const newState = !isChecked;
|
|
153
|
-
|
|
154
|
-
this.switchButton.setAttribute("aria-checked", newState.toString());
|
|
155
|
-
|
|
156
|
-
// Dispatch custom event with the new state
|
|
157
|
-
const event = new CustomEvent<SwitchChangeEvent["detail"]>("starwind-switch:change", {
|
|
158
|
-
detail: { checked: newState, switchId: this.switchButton.id },
|
|
159
|
-
bubbles: true,
|
|
160
|
-
cancelable: true,
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
this.switchButton.dispatchEvent(event);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
private handleKeyDown(event: KeyboardEvent): void {
|
|
167
|
-
if (this.switchButton.disabled) return;
|
|
168
|
-
|
|
169
|
-
if (event.key === " " || event.key === "Enter") {
|
|
170
|
-
event.preventDefault();
|
|
171
|
-
this.handleStateChange();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// Store instances in a WeakMap to avoid memory leaks
|
|
177
|
-
const switchInstances = new WeakMap<HTMLButtonElement, SwitchHandler>();
|
|
178
|
-
|
|
179
|
-
const setupSwitches = () => {
|
|
180
|
-
document
|
|
181
|
-
.querySelectorAll<HTMLButtonElement>('.starwind-switch button[role="switch"]')
|
|
182
|
-
.forEach((switchButton) => {
|
|
183
|
-
if (!switchInstances.has(switchButton)) {
|
|
184
|
-
switchInstances.set(switchButton, new SwitchHandler(switchButton));
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
setupSwitches();
|
|
190
|
-
document.addEventListener("astro:after-swap", setupSwitches);
|
|
191
|
-
</script>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import Switch, { switchButton, switchLabel, switchToggle } from "./Switch.astro";
|
|
2
|
-
import type { SwitchChangeEvent } from "./SwitchTypes";
|
|
3
|
-
|
|
4
|
-
const SwitchVariants = {
|
|
5
|
-
switchButton,
|
|
6
|
-
switchToggle,
|
|
7
|
-
switchLabel,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export { Switch, type SwitchChangeEvent, SwitchVariants };
|
|
11
|
-
|
|
12
|
-
export default Switch;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { tv, type VariantProps } from "tailwind-variants";
|
|
4
|
-
|
|
5
|
-
type Props = HTMLAttributes<"table"> & VariantProps<typeof table>;
|
|
6
|
-
|
|
7
|
-
export const table = tv({
|
|
8
|
-
base: "w-full caption-bottom text-sm",
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const { class: className, ...rest } = Astro.props;
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<div data-slot="table-container" class="relative w-full overflow-x-auto">
|
|
15
|
-
<table data-slot="table" class={table({ class: className })} {...rest} role="table">
|
|
16
|
-
<slot />
|
|
17
|
-
</table>
|
|
18
|
-
</div>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { tv, type VariantProps } from "tailwind-variants";
|
|
4
|
-
|
|
5
|
-
type Props = HTMLAttributes<"tbody"> & VariantProps<typeof tableBody>;
|
|
6
|
-
|
|
7
|
-
export const tableBody = tv({
|
|
8
|
-
base: "[&_tr:last-child]:border-0",
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const { class: className, ...rest } = Astro.props;
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<tbody data-slot="table-body" class={tableBody({ class: className })} {...rest}>
|
|
15
|
-
<slot />
|
|
16
|
-
</tbody>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { tv, type VariantProps } from "tailwind-variants";
|
|
4
|
-
|
|
5
|
-
type Props = HTMLAttributes<"caption"> & VariantProps<typeof tableCaption>;
|
|
6
|
-
|
|
7
|
-
export const tableCaption = tv({
|
|
8
|
-
base: "text-muted-foreground mt-4 text-sm",
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const { class: className, ...rest } = Astro.props;
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<caption data-slot="table-caption" class={tableCaption({ class: className })} {...rest}>
|
|
15
|
-
<slot />
|
|
16
|
-
</caption>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { tv, type VariantProps } from "tailwind-variants";
|
|
4
|
-
|
|
5
|
-
type Props = HTMLAttributes<"td"> & VariantProps<typeof tableCell>;
|
|
6
|
-
|
|
7
|
-
export const tableCell = tv({
|
|
8
|
-
base: "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const { class: className, ...rest } = Astro.props;
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<td data-slot="table-cell" class={tableCell({ class: className })} {...rest}>
|
|
15
|
-
<slot />
|
|
16
|
-
</td>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { tv, type VariantProps } from "tailwind-variants";
|
|
4
|
-
|
|
5
|
-
type Props = HTMLAttributes<"tfoot"> & VariantProps<typeof tableFoot>;
|
|
6
|
-
|
|
7
|
-
export const tableFoot = tv({
|
|
8
|
-
base: "bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const { class: className, ...rest } = Astro.props;
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<tfoot data-slot="table-foot" class={tableFoot({ class: className })} {...rest}>
|
|
15
|
-
<slot />
|
|
16
|
-
</tfoot>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { tv, type VariantProps } from "tailwind-variants";
|
|
4
|
-
|
|
5
|
-
type Props = HTMLAttributes<"th"> & VariantProps<typeof tableHead>;
|
|
6
|
-
|
|
7
|
-
export const tableHead = tv({
|
|
8
|
-
base: "text-muted-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const { class: className, ...rest } = Astro.props;
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<th data-slot="table-head" class={tableHead({ class: className })} {...rest} role="columnheader">
|
|
15
|
-
<slot />
|
|
16
|
-
</th>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { tv, type VariantProps } from "tailwind-variants";
|
|
4
|
-
|
|
5
|
-
type Props = HTMLAttributes<"thead"> & VariantProps<typeof tableHeader>;
|
|
6
|
-
|
|
7
|
-
export const tableHeader = tv({
|
|
8
|
-
base: "[&_tr]:border-b",
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const { class: className, ...rest } = Astro.props;
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<thead data-slot="table-header" class={tableHeader({ class: className })} {...rest}>
|
|
15
|
-
<slot />
|
|
16
|
-
</thead>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { tv, type VariantProps } from "tailwind-variants";
|
|
4
|
-
|
|
5
|
-
type Props = HTMLAttributes<"tr"> & VariantProps<typeof tableRow>;
|
|
6
|
-
|
|
7
|
-
export const tableRow = tv({
|
|
8
|
-
base: "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const { class: className, ...rest } = Astro.props;
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<tr data-slot="table-row" class={tableRow({ class: className })} {...rest} role="row">
|
|
15
|
-
<slot />
|
|
16
|
-
</tr>
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import Table, { table } from "./Table.astro";
|
|
2
|
-
import TableBody, { tableBody } from "./TableBody.astro";
|
|
3
|
-
import TableCaption, { tableCaption } from "./TableCaption.astro";
|
|
4
|
-
import TableCell, { tableCell } from "./TableCell.astro";
|
|
5
|
-
import TableFoot, { tableFoot } from "./TableFoot.astro";
|
|
6
|
-
import TableHead, { tableHead } from "./TableHead.astro";
|
|
7
|
-
import TableHeader, { tableHeader } from "./TableHeader.astro";
|
|
8
|
-
import TableRow, { tableRow } from "./TableRow.astro";
|
|
9
|
-
|
|
10
|
-
const TableVariants = {
|
|
11
|
-
table,
|
|
12
|
-
tableBody,
|
|
13
|
-
tableCaption,
|
|
14
|
-
tableCell,
|
|
15
|
-
tableFoot,
|
|
16
|
-
tableHead,
|
|
17
|
-
tableHeader,
|
|
18
|
-
tableRow,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
Table,
|
|
23
|
-
TableBody,
|
|
24
|
-
TableCaption,
|
|
25
|
-
TableCell,
|
|
26
|
-
TableFoot,
|
|
27
|
-
TableHead,
|
|
28
|
-
TableHeader,
|
|
29
|
-
TableRow,
|
|
30
|
-
TableVariants,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default {
|
|
34
|
-
Root: Table,
|
|
35
|
-
Body: TableBody,
|
|
36
|
-
Caption: TableCaption,
|
|
37
|
-
Cell: TableCell,
|
|
38
|
-
Foot: TableFoot,
|
|
39
|
-
Head: TableHead,
|
|
40
|
-
Header: TableHeader,
|
|
41
|
-
Row: TableRow,
|
|
42
|
-
};
|