@starwind-ui/core 1.8.0 → 1.10.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 +50 -23
- package/dist/index.js.map +1 -1
- package/dist/src/components/accordion/Accordion.astro +8 -2
- package/dist/src/components/accordion/AccordionContent.astro +2 -1
- package/dist/src/components/accordion/AccordionItem.astro +8 -2
- package/dist/src/components/accordion/AccordionTrigger.astro +4 -3
- package/dist/src/components/accordion/index.ts +7 -5
- package/dist/src/components/alert/Alert.astro +6 -3
- package/dist/src/components/alert/AlertDescription.astro +4 -4
- package/dist/src/components/alert/AlertTitle.astro +3 -3
- package/dist/src/components/alert/index.ts +6 -4
- package/dist/src/components/alert-dialog/AlertDialog.astro +273 -0
- package/dist/src/components/alert-dialog/AlertDialogAction.astro +44 -0
- package/dist/src/components/alert-dialog/AlertDialogCancel.astro +45 -0
- package/dist/src/components/alert-dialog/AlertDialogContent.astro +50 -0
- package/dist/src/components/alert-dialog/AlertDialogDescription.astro +18 -0
- package/dist/src/components/alert-dialog/AlertDialogFooter.astro +16 -0
- package/dist/src/components/alert-dialog/AlertDialogHeader.astro +14 -0
- package/dist/src/components/alert-dialog/AlertDialogTitle.astro +20 -0
- package/dist/src/components/alert-dialog/AlertDialogTrigger.astro +47 -0
- package/dist/src/components/alert-dialog/index.ts +46 -0
- package/dist/src/components/aspect-ratio/AspectRatio.astro +32 -0
- package/dist/src/components/aspect-ratio/index.ts +7 -0
- package/dist/src/components/avatar/Avatar.astro +2 -2
- package/dist/src/components/avatar/AvatarFallback.astro +2 -2
- package/dist/src/components/avatar/AvatarImage.astro +13 -2
- package/dist/src/components/avatar/index.ts +6 -4
- package/dist/src/components/badge/Badge.astro +15 -12
- package/dist/src/components/badge/index.ts +4 -2
- package/dist/src/components/breadcrumb/Breadcrumb.astro +1 -1
- package/dist/src/components/breadcrumb/BreadcrumbEllipsis.astro +4 -1
- package/dist/src/components/breadcrumb/BreadcrumbItem.astro +2 -2
- package/dist/src/components/breadcrumb/BreadcrumbLink.astro +2 -2
- package/dist/src/components/breadcrumb/BreadcrumbList.astro +2 -2
- package/dist/src/components/breadcrumb/BreadcrumbPage.astro +2 -1
- package/dist/src/components/breadcrumb/BreadcrumbSeparator.astro +2 -1
- package/dist/src/components/breadcrumb/index.ts +16 -6
- package/dist/src/components/button/Button.astro +15 -15
- package/dist/src/components/button/index.ts +4 -2
- package/dist/src/components/card/Card.astro +2 -2
- package/dist/src/components/card/CardContent.astro +2 -2
- package/dist/src/components/card/CardDescription.astro +2 -2
- package/dist/src/components/card/CardFooter.astro +2 -2
- package/dist/src/components/card/CardHeader.astro +2 -2
- package/dist/src/components/card/CardTitle.astro +2 -2
- package/dist/src/components/card/index.ts +16 -7
- package/dist/src/components/carousel/Carousel.astro +55 -0
- package/dist/src/components/carousel/CarouselContent.astro +26 -0
- package/dist/src/components/carousel/CarouselItem.astro +26 -0
- package/dist/src/components/carousel/CarouselNext.astro +33 -0
- package/dist/src/components/carousel/CarouselPrevious.astro +33 -0
- package/dist/src/components/carousel/carousel-script.ts +191 -0
- package/dist/src/components/carousel/index.ts +32 -0
- package/dist/src/components/checkbox/Checkbox.astro +28 -12
- package/dist/src/components/checkbox/index.ts +4 -2
- package/dist/src/components/dialog/Dialog.astro +24 -11
- package/dist/src/components/dialog/DialogClose.astro +7 -2
- package/dist/src/components/dialog/DialogContent.astro +9 -6
- package/dist/src/components/dialog/DialogDescription.astro +2 -2
- package/dist/src/components/dialog/DialogFooter.astro +2 -2
- package/dist/src/components/dialog/DialogHeader.astro +2 -2
- package/dist/src/components/dialog/DialogTitle.astro +2 -2
- package/dist/src/components/dialog/DialogTrigger.astro +7 -1
- package/dist/src/components/dialog/index.ts +20 -5
- package/dist/src/components/dropdown/Dropdown.astro +1 -0
- package/dist/src/components/dropdown/DropdownContent.astro +2 -1
- package/dist/src/components/dropdown/DropdownItem.astro +2 -1
- package/dist/src/components/dropdown/DropdownLabel.astro +2 -2
- package/dist/src/components/dropdown/DropdownSeparator.astro +3 -2
- package/dist/src/components/dropdown/DropdownTrigger.astro +9 -3
- package/dist/src/components/dropdown/index.ts +14 -5
- package/dist/src/components/dropzone/Dropzone.astro +7 -6
- package/dist/src/components/dropzone/DropzoneFilesList.astro +3 -2
- package/dist/src/components/dropzone/DropzoneLoadingIndicator.astro +1 -1
- package/dist/src/components/dropzone/DropzoneUploadIndicator.astro +1 -1
- package/dist/src/components/dropzone/index.ts +14 -3
- package/dist/src/components/input/Input.astro +4 -4
- package/dist/src/components/input/index.ts +4 -2
- package/dist/src/components/item/Item.astro +52 -0
- package/dist/src/components/item/ItemActions.astro +16 -0
- package/dist/src/components/item/ItemContent.astro +16 -0
- package/dist/src/components/item/ItemDescription.astro +19 -0
- package/dist/src/components/item/ItemFooter.astro +16 -0
- package/dist/src/components/item/ItemGroup.astro +16 -0
- package/dist/src/components/item/ItemHeader.astro +16 -0
- package/dist/src/components/item/ItemMedia.astro +40 -0
- package/dist/src/components/item/ItemSeparator.astro +21 -0
- package/dist/src/components/item/ItemTitle.astro +16 -0
- package/dist/src/components/item/index.ts +50 -0
- package/dist/src/components/label/Label.astro +2 -2
- package/dist/src/components/label/index.ts +4 -2
- package/dist/src/components/pagination/Pagination.astro +8 -2
- package/dist/src/components/pagination/PaginationContent.astro +2 -2
- package/dist/src/components/pagination/PaginationEllipsis.astro +7 -2
- package/dist/src/components/pagination/PaginationItem.astro +2 -2
- package/dist/src/components/pagination/PaginationLink.astro +10 -29
- package/dist/src/components/pagination/PaginationNext.astro +2 -1
- package/dist/src/components/pagination/PaginationPrevious.astro +2 -1
- package/dist/src/components/pagination/index.ts +18 -7
- package/dist/src/components/progress/Progress.astro +6 -3
- package/dist/src/components/progress/index.ts +7 -2
- package/dist/src/components/radio-group/RadioGroup.astro +2 -1
- package/dist/src/components/radio-group/RadioGroupItem.astro +17 -15
- package/dist/src/components/radio-group/index.ts +16 -3
- package/dist/src/components/select/Select.astro +1 -0
- package/dist/src/components/select/SelectContent.astro +3 -2
- package/dist/src/components/select/SelectGroup.astro +1 -1
- package/dist/src/components/select/SelectItem.astro +3 -2
- package/dist/src/components/select/SelectLabel.astro +2 -2
- package/dist/src/components/select/SelectSeparator.astro +2 -2
- package/dist/src/components/select/SelectTrigger.astro +4 -3
- package/dist/src/components/select/SelectValue.astro +2 -2
- package/dist/src/components/select/index.ts +18 -6
- package/dist/src/components/separator/Separator.astro +36 -0
- package/dist/src/components/separator/index.ts +7 -0
- package/dist/src/components/sheet/Sheet.astro +13 -0
- package/dist/src/components/sheet/SheetClose.astro +13 -0
- package/dist/src/components/sheet/SheetContent.astro +88 -0
- package/dist/src/components/sheet/SheetDescription.astro +16 -0
- package/dist/src/components/sheet/SheetFooter.astro +16 -0
- package/dist/src/components/sheet/SheetHeader.astro +16 -0
- package/dist/src/components/sheet/SheetTitle.astro +16 -0
- package/dist/src/components/sheet/SheetTrigger.astro +13 -0
- package/dist/src/components/sheet/index.ts +41 -0
- package/dist/src/components/skeleton/Skeleton.astro +3 -3
- package/dist/src/components/skeleton/index.ts +6 -2
- package/dist/src/components/spinner/Spinner.astro +21 -0
- package/dist/src/components/spinner/index.ts +7 -0
- package/dist/src/components/switch/Switch.astro +16 -13
- package/dist/src/components/switch/index.ts +8 -2
- package/dist/src/components/table/Table.astro +3 -3
- package/dist/src/components/table/TableBody.astro +2 -2
- package/dist/src/components/table/TableCaption.astro +2 -2
- package/dist/src/components/table/TableCell.astro +2 -2
- package/dist/src/components/table/TableFoot.astro +2 -2
- package/dist/src/components/table/TableHead.astro +2 -2
- package/dist/src/components/table/TableHeader.astro +2 -2
- package/dist/src/components/table/TableRow.astro +2 -2
- package/dist/src/components/table/index.ts +30 -9
- package/dist/src/components/tabs/Tabs.astro +2 -1
- package/dist/src/components/tabs/TabsContent.astro +4 -1
- package/dist/src/components/tabs/TabsList.astro +9 -3
- package/dist/src/components/tabs/TabsTrigger.astro +6 -3
- package/dist/src/components/tabs/index.ts +12 -5
- package/dist/src/components/textarea/Textarea.astro +4 -4
- package/dist/src/components/textarea/index.ts +6 -2
- package/dist/src/components/tooltip/Tooltip.astro +2 -1
- package/dist/src/components/tooltip/TooltipContent.astro +21 -5
- package/dist/src/components/tooltip/TooltipTrigger.astro +1 -1
- package/dist/src/components/tooltip/index.ts +8 -3
- package/package.json +1 -1
|
@@ -4,13 +4,13 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"th"> & VariantProps<typeof tableHead>;
|
|
6
6
|
|
|
7
|
-
const tableHead = tv({
|
|
7
|
+
export 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
|
-
<th data-table-head class={tableHead({ class: className })} {...rest} role="columnheader">
|
|
14
|
+
<th data-slot="table-head" class={tableHead({ class: className })} {...rest} role="columnheader">
|
|
15
15
|
<slot />
|
|
16
16
|
</th>
|
|
@@ -4,13 +4,13 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"thead"> & VariantProps<typeof tableHeader>;
|
|
6
6
|
|
|
7
|
-
const tableHeader = tv({
|
|
7
|
+
export 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
|
-
<thead data-table-header class={tableHeader({ class: className })} {...rest}>
|
|
14
|
+
<thead data-slot="table-header" class={tableHeader({ class: className })} {...rest}>
|
|
15
15
|
<slot />
|
|
16
16
|
</thead>
|
|
@@ -4,13 +4,13 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"tr"> & VariantProps<typeof tableRow>;
|
|
6
6
|
|
|
7
|
-
const tableRow = tv({
|
|
7
|
+
export 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
|
-
<tr data-table-row class={tableRow({ class: className })} {...rest} role="row">
|
|
14
|
+
<tr data-slot="table-row" class={tableRow({ class: className })} {...rest} role="row">
|
|
15
15
|
<slot />
|
|
16
16
|
</tr>
|
|
@@ -1,13 +1,34 @@
|
|
|
1
|
-
import Table from "./Table.astro";
|
|
2
|
-
import TableBody from "./TableBody.astro";
|
|
3
|
-
import TableCaption from "./TableCaption.astro";
|
|
4
|
-
import TableCell from "./TableCell.astro";
|
|
5
|
-
import TableFoot from "./TableFoot.astro";
|
|
6
|
-
import TableHead from "./TableHead.astro";
|
|
7
|
-
import TableHeader from "./TableHeader.astro";
|
|
8
|
-
import TableRow from "./TableRow.astro";
|
|
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
9
|
|
|
10
|
-
|
|
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
|
+
};
|
|
11
32
|
|
|
12
33
|
export default {
|
|
13
34
|
Root: Table,
|
|
@@ -7,7 +7,7 @@ interface Props extends HTMLAttributes<"div"> {
|
|
|
7
7
|
syncKey?: string;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const tabs = tv({ base: "starwind-tabs" });
|
|
10
|
+
export const tabs = tv({ base: "starwind-tabs" });
|
|
11
11
|
|
|
12
12
|
const { defaultValue, syncKey, class: className, ...rest } = Astro.props;
|
|
13
13
|
---
|
|
@@ -16,6 +16,7 @@ const { defaultValue, syncKey, class: className, ...rest } = Astro.props;
|
|
|
16
16
|
class={tabs({ class: className })}
|
|
17
17
|
data-default-value={defaultValue}
|
|
18
18
|
data-sync-key={syncKey}
|
|
19
|
+
data-slot="tabs"
|
|
19
20
|
{...rest}
|
|
20
21
|
>
|
|
21
22
|
<slot />
|
|
@@ -6,13 +6,16 @@ interface Props extends Omit<HTMLAttributes<"div">, "id" | "role" | "tabindex" |
|
|
|
6
6
|
value: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
const tabsContent = tv({
|
|
9
|
+
export const tabsContent = tv({
|
|
10
|
+
base: "mt-2 focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
11
|
+
});
|
|
10
12
|
|
|
11
13
|
const { value, class: className, ...rest } = Astro.props;
|
|
12
14
|
---
|
|
13
15
|
|
|
14
16
|
<div
|
|
15
17
|
class={tabsContent({ class: className })}
|
|
18
|
+
data-slot="tabs-content"
|
|
16
19
|
data-tabs-content
|
|
17
20
|
data-value={value}
|
|
18
21
|
data-state="inactive"
|
|
@@ -4,13 +4,19 @@ import { tv } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = Omit<HTMLAttributes<"div">, "role">;
|
|
6
6
|
|
|
7
|
-
const tabsList = tv({
|
|
8
|
-
base: "bg-muted text-muted-foreground inline-flex w-
|
|
7
|
+
export const tabsList = tv({
|
|
8
|
+
base: "bg-muted text-muted-foreground inline-flex w-fit items-center justify-center rounded-md p-1",
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const { class: className, ...rest } = Astro.props;
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
<div
|
|
14
|
+
<div
|
|
15
|
+
class={tabsList({ class: className })}
|
|
16
|
+
data-slot="tabs-list"
|
|
17
|
+
data-tabs-list
|
|
18
|
+
role="tablist"
|
|
19
|
+
{...rest}
|
|
20
|
+
>
|
|
15
21
|
<slot />
|
|
16
22
|
</div>
|
|
@@ -6,11 +6,13 @@ interface Props extends Omit<HTMLAttributes<"button">, "type" | "id" | "role"> {
|
|
|
6
6
|
value: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
const tabsTrigger = tv({
|
|
9
|
+
export const tabsTrigger = tv({
|
|
10
10
|
base: [
|
|
11
|
-
"
|
|
11
|
+
"inline-flex grow items-center justify-center gap-2 rounded-sm border border-transparent px-3 py-1.5 font-medium whitespace-nowrap transition-[color,box-shadow]",
|
|
12
12
|
"data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
13
|
-
"
|
|
13
|
+
"dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:text-muted-foreground",
|
|
14
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
15
|
+
"focus-visible:border-outline focus-visible:ring-outline/50 focus-visible:outline-outline focus-visible:ring-3 focus-visible:outline-1",
|
|
14
16
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
15
17
|
],
|
|
16
18
|
});
|
|
@@ -20,6 +22,7 @@ const { value, class: className, ...rest } = Astro.props;
|
|
|
20
22
|
|
|
21
23
|
<button
|
|
22
24
|
class={tabsTrigger({ class: className })}
|
|
25
|
+
data-slot="tabs-trigger"
|
|
23
26
|
data-tabs-trigger
|
|
24
27
|
data-value={value}
|
|
25
28
|
data-state="inactive"
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import Tabs from "./Tabs.astro";
|
|
2
|
-
import TabsContent from "./TabsContent.astro";
|
|
3
|
-
import TabsList from "./TabsList.astro";
|
|
4
|
-
import TabsTrigger from "./TabsTrigger.astro";
|
|
1
|
+
import Tabs, { tabs } from "./Tabs.astro";
|
|
2
|
+
import TabsContent, { tabsContent } from "./TabsContent.astro";
|
|
3
|
+
import TabsList, { tabsList } from "./TabsList.astro";
|
|
4
|
+
import TabsTrigger, { tabsTrigger } from "./TabsTrigger.astro";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const TabsVariants = {
|
|
7
|
+
tabs,
|
|
8
|
+
tabsContent,
|
|
9
|
+
tabsList,
|
|
10
|
+
tabsTrigger,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger, TabsVariants };
|
|
7
14
|
|
|
8
15
|
export default {
|
|
9
16
|
Root: Tabs,
|
|
@@ -4,10 +4,10 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"textarea"> & VariantProps<typeof textarea>;
|
|
6
6
|
|
|
7
|
-
const textarea = tv({
|
|
7
|
+
export const textarea = tv({
|
|
8
8
|
base: [
|
|
9
|
-
"border-input bg-
|
|
10
|
-
"focus:
|
|
9
|
+
"border-input dark:bg-input/30 text-foreground ring-offset-background min-h-10 w-full rounded-md border bg-transparent shadow-xs",
|
|
10
|
+
"focus-visible:border-outline focus-visible:ring-outline/50 transition-[color,box-shadow] focus-visible:ring-3",
|
|
11
11
|
"file:text-foreground file:border-0 file:bg-transparent file:text-sm file:font-medium",
|
|
12
12
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
13
13
|
"peer placeholder:text-muted-foreground",
|
|
@@ -25,4 +25,4 @@ const textarea = tv({
|
|
|
25
25
|
const { size, class: className, ...rest } = Astro.props;
|
|
26
26
|
---
|
|
27
27
|
|
|
28
|
-
<textarea class={textarea({ size, class: className })} {...rest}></textarea>
|
|
28
|
+
<textarea class={textarea({ size, class: className })} data-slot="textarea" {...rest}></textarea>
|
|
@@ -17,7 +17,7 @@ type Props = HTMLAttributes<"div"> & {
|
|
|
17
17
|
disableHoverableContent?: boolean;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const tooltip = tv({ base: "starwind-tooltip relative inline-block" });
|
|
20
|
+
export const tooltip = tv({ base: "starwind-tooltip relative inline-block" });
|
|
21
21
|
|
|
22
22
|
const {
|
|
23
23
|
openDelay = 200,
|
|
@@ -29,6 +29,7 @@ const {
|
|
|
29
29
|
|
|
30
30
|
<div
|
|
31
31
|
class={tooltip({ class: className })}
|
|
32
|
+
data-slot="tooltip"
|
|
32
33
|
data-state="closed"
|
|
33
34
|
data-open-delay={openDelay}
|
|
34
35
|
data-close-delay={closeDelay}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
+
import CaretUp from "@tabler/icons/filled/caret-up.svg";
|
|
2
3
|
import type { HTMLAttributes } from "astro/types";
|
|
3
4
|
import { tv } from "tailwind-variants";
|
|
4
5
|
|
|
@@ -15,7 +16,7 @@ type Props = HTMLAttributes<"div"> & {
|
|
|
15
16
|
align?: "start" | "center" | "end";
|
|
16
17
|
/**
|
|
17
18
|
* Offset distance in pixels
|
|
18
|
-
* @default
|
|
19
|
+
* @default 8
|
|
19
20
|
*/
|
|
20
21
|
sideOffset?: number;
|
|
21
22
|
/**
|
|
@@ -30,11 +31,11 @@ type Props = HTMLAttributes<"div"> & {
|
|
|
30
31
|
animationDuration?: number;
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
const tooltipContent = tv({
|
|
34
|
+
export const tooltipContent = tv({
|
|
34
35
|
base: [
|
|
35
36
|
"starwind-tooltip-content",
|
|
36
|
-
"absolute z-50 hidden px-3 py-1.5 whitespace-nowrap shadow-
|
|
37
|
-
"bg-
|
|
37
|
+
"absolute z-50 hidden px-3 py-1.5 whitespace-nowrap shadow-xs will-change-transform",
|
|
38
|
+
"bg-foreground text-background rounded-md",
|
|
38
39
|
"animate-in fade-in zoom-in-95",
|
|
39
40
|
"data-[state=closed]:animate-out data-[state=closed]:fill-mode-forwards fade-out zoom-out-95",
|
|
40
41
|
],
|
|
@@ -72,10 +73,23 @@ const tooltipContent = tv({
|
|
|
72
73
|
],
|
|
73
74
|
});
|
|
74
75
|
|
|
76
|
+
export const tooltipCaret = tv({
|
|
77
|
+
base: ["text-foreground absolute z-50 size-4"],
|
|
78
|
+
variants: {
|
|
79
|
+
side: {
|
|
80
|
+
top: "bottom-0 left-1/2 -translate-x-1/2 translate-y-[calc(50%+1px)] rotate-180",
|
|
81
|
+
bottom: "top-0 left-1/2 -translate-x-1/2 -translate-y-[calc(50%+1px)]",
|
|
82
|
+
left: "top-1/2 right-0 translate-x-[calc(50%+1px)] -translate-y-1/2 rotate-90",
|
|
83
|
+
right: "top-1/2 left-0 -translate-x-[calc(50%+1px)] -translate-y-1/2 -rotate-90",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
defaultVariants: { side: "top" },
|
|
87
|
+
});
|
|
88
|
+
|
|
75
89
|
const {
|
|
76
90
|
side = "top",
|
|
77
91
|
align = "center",
|
|
78
|
-
sideOffset =
|
|
92
|
+
sideOffset = 8,
|
|
79
93
|
avoidCollisions = true,
|
|
80
94
|
animationDuration = 150,
|
|
81
95
|
class: className,
|
|
@@ -84,6 +98,7 @@ const {
|
|
|
84
98
|
|
|
85
99
|
<div
|
|
86
100
|
class={tooltipContent({ side, align, class: className })}
|
|
101
|
+
data-slot="tooltip-content"
|
|
87
102
|
data-state="closed"
|
|
88
103
|
data-side={side}
|
|
89
104
|
data-align={align}
|
|
@@ -95,4 +110,5 @@ const {
|
|
|
95
110
|
}}
|
|
96
111
|
>
|
|
97
112
|
<slot> My tooltip! </slot>
|
|
113
|
+
<CaretUp class={tooltipCaret({ side })} />
|
|
98
114
|
</div>
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import Tooltip from "./Tooltip.astro";
|
|
2
|
-
import TooltipContent from "./TooltipContent.astro";
|
|
1
|
+
import Tooltip, { tooltip } from "./Tooltip.astro";
|
|
2
|
+
import TooltipContent, { tooltipContent } from "./TooltipContent.astro";
|
|
3
3
|
import TooltipTrigger from "./TooltipTrigger.astro";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const TooltipVariants = {
|
|
6
|
+
tooltip,
|
|
7
|
+
tooltipContent,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { Tooltip, TooltipContent, TooltipTrigger, TooltipVariants };
|
|
6
11
|
|
|
7
12
|
export default {
|
|
8
13
|
Root: Tooltip,
|