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