@starwind-ui/core 0.1.1 → 1.1.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.
Files changed (51) hide show
  1. package/dist/index.js +16 -16
  2. package/dist/index.js.map +1 -1
  3. package/dist/src/components/accordion/Accordion.astro +6 -6
  4. package/dist/src/components/accordion/AccordionContent.astro +11 -7
  5. package/dist/src/components/accordion/AccordionItem.astro +6 -10
  6. package/dist/src/components/accordion/AccordionTrigger.astro +12 -9
  7. package/dist/src/components/alert/Alert.astro +20 -28
  8. package/dist/src/components/alert/AlertDescription.astro +6 -1
  9. package/dist/src/components/alert/AlertTitle.astro +6 -7
  10. package/dist/src/components/avatar/Avatar.astro +26 -23
  11. package/dist/src/components/avatar/AvatarFallback.astro +7 -6
  12. package/dist/src/components/avatar/AvatarImage.astro +9 -12
  13. package/dist/src/components/badge/Badge.astro +85 -33
  14. package/dist/src/components/button/Button.astro +40 -50
  15. package/dist/src/components/card/Card.astro +6 -4
  16. package/dist/src/components/card/CardContent.astro +6 -1
  17. package/dist/src/components/card/CardDescription.astro +6 -1
  18. package/dist/src/components/card/CardFooter.astro +6 -1
  19. package/dist/src/components/card/CardHeader.astro +6 -1
  20. package/dist/src/components/card/CardTitle.astro +6 -1
  21. package/dist/src/components/checkbox/Checkbox.astro +100 -54
  22. package/dist/src/components/dialog/DialogContent.astro +30 -18
  23. package/dist/src/components/dialog/DialogDescription.astro +6 -1
  24. package/dist/src/components/dialog/DialogFooter.astro +6 -1
  25. package/dist/src/components/dialog/DialogHeader.astro +6 -1
  26. package/dist/src/components/dialog/DialogTitle.astro +6 -1
  27. package/dist/src/components/input/Input.astro +19 -13
  28. package/dist/src/components/label/Label.astro +19 -13
  29. package/dist/src/components/pagination/Pagination.astro +6 -1
  30. package/dist/src/components/pagination/PaginationContent.astro +6 -1
  31. package/dist/src/components/pagination/PaginationEllipsis.astro +6 -1
  32. package/dist/src/components/pagination/PaginationItem.astro +6 -1
  33. package/dist/src/components/pagination/PaginationLink.astro +28 -32
  34. package/dist/src/components/pagination/PaginationNext.astro +7 -4
  35. package/dist/src/components/pagination/PaginationPrevious.astro +7 -4
  36. package/dist/src/components/select/Select.astro +1 -1
  37. package/dist/src/components/select/SelectContent.astro +26 -11
  38. package/dist/src/components/select/SelectItem.astro +16 -9
  39. package/dist/src/components/select/SelectLabel.astro +6 -1
  40. package/dist/src/components/select/SelectSeparator.astro +6 -1
  41. package/dist/src/components/select/SelectTrigger.astro +11 -8
  42. package/dist/src/components/select/SelectValue.astro +7 -2
  43. package/dist/src/components/switch/Switch.astro +57 -37
  44. package/dist/src/components/tabs/Tabs.astro +6 -1
  45. package/dist/src/components/tabs/TabsContent.astro +6 -1
  46. package/dist/src/components/tabs/TabsList.astro +6 -4
  47. package/dist/src/components/tabs/TabsTrigger.astro +11 -7
  48. package/dist/src/components/textarea/Textarea.astro +19 -12
  49. package/dist/src/components/tooltip/Tooltip.astro +6 -1
  50. package/dist/src/components/tooltip/TooltipContent.astro +75 -22
  51. package/package.json +1 -1
@@ -1,21 +1,25 @@
1
1
  ---
2
2
  import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
3
4
 
4
5
  interface Props extends Omit<HTMLAttributes<"button">, "type" | "id" | "role"> {
5
6
  value: string;
6
7
  }
7
8
 
8
- const { value, class: className, ...rest } = Astro.props;
9
- ---
10
-
11
- <button
12
- class:list={[
9
+ const tabsTrigger = tv({
10
+ base: [
13
11
  "starwind-transition-colors inline-flex grow items-center justify-center rounded-sm px-3 py-1.5 font-medium whitespace-nowrap",
14
12
  "data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
15
13
  "focus-visible:outline-outline focus-visible:outline-2 focus-visible:outline-offset-2",
16
14
  "disabled:pointer-events-none disabled:opacity-50",
17
- className,
18
- ]}
15
+ ],
16
+ });
17
+
18
+ const { value, class: className, ...rest } = Astro.props;
19
+ ---
20
+
21
+ <button
22
+ class={tabsTrigger({ class: className })}
19
23
  data-tabs-trigger
20
24
  data-value={value}
21
25
  data-state="inactive"
@@ -1,25 +1,32 @@
1
1
  ---
2
2
  import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
3
4
 
4
5
  type Props = HTMLAttributes<"textarea"> & {
5
6
  size?: "sm" | "md" | "lg";
6
7
  };
7
8
 
8
- const { size = "md", class: className, ...rest } = Astro.props;
9
- ---
10
-
11
- <textarea
12
- class:list={[
9
+ const textarea = tv({
10
+ base: [
13
11
  "border-input bg-background text-foreground ring-offset-background min-h-10 w-full rounded-md border",
14
12
  "focus:outline-outline focus:ring-0 focus:outline-2 focus:outline-offset-2",
15
13
  "file:text-foreground file:border-0 file:bg-transparent file:text-sm file:font-medium",
16
14
  "disabled:cursor-not-allowed disabled:opacity-50",
17
15
  "peer placeholder:text-muted-foreground",
18
- {
19
- "min-h-9 px-2 py-1 text-sm": size === "sm",
20
- "min-h-10 px-3 py-2 text-base": size === "md",
21
- "min-h-12 px-4 py-3 text-lg": size === "lg",
16
+ ],
17
+ variants: {
18
+ size: {
19
+ sm: "min-h-9 px-2 py-1 text-sm",
20
+ md: "min-h-10 px-3 py-2 text-base",
21
+ lg: "min-h-12 px-4 py-3 text-lg",
22
22
  },
23
- className,
24
- ]}
25
- {...rest}></textarea>
23
+ },
24
+ defaultVariants: {
25
+ size: "md",
26
+ },
27
+ });
28
+
29
+ const { size = "md", class: className, ...rest } = Astro.props;
30
+ ---
31
+
32
+ <textarea class={textarea({ size, class: className })} {...rest}></textarea>
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
3
4
 
4
5
  type Props = HTMLAttributes<"div"> & {
5
6
  /**
@@ -16,6 +17,10 @@ type Props = HTMLAttributes<"div"> & {
16
17
  disableHoverableContent?: boolean;
17
18
  };
18
19
 
20
+ const tooltip = tv({
21
+ base: "starwind-tooltip relative inline-block",
22
+ });
23
+
19
24
  const {
20
25
  openDelay = 200,
21
26
  closeDelay = 200,
@@ -25,7 +30,7 @@ const {
25
30
  ---
26
31
 
27
32
  <div
28
- class:list={["starwind-tooltip relative inline-block", className]}
33
+ class={tooltip({ class: className })}
29
34
  data-state="closed"
30
35
  data-open-delay={openDelay}
31
36
  data-close-delay={closeDelay}
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
3
4
 
4
5
  type Props = HTMLAttributes<"div"> & {
5
6
  /**
@@ -29,6 +30,79 @@ type Props = HTMLAttributes<"div"> & {
29
30
  animationDuration?: number;
30
31
  };
31
32
 
33
+ const tooltipContent = tv({
34
+ base: [
35
+ "starwind-tooltip-content",
36
+ "absolute z-50 hidden px-3 py-1.5 whitespace-nowrap shadow-sm",
37
+ "bg-popover text-popover-foreground rounded-md border",
38
+ "animate-in fade-in-0 zoom-in-95",
39
+ "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
40
+ ],
41
+ variants: {
42
+ side: {
43
+ left: "slide-in-from-right-2 right-(--tooltip-offset)",
44
+ right: "slide-in-from-left-2 left-(--tooltip-offset)",
45
+ bottom: "slide-in-from-top-2 top-(--tooltip-offset)",
46
+ top: "slide-in-from-bottom-2 bottom-(--tooltip-offset)",
47
+ },
48
+ align: {
49
+ center: "",
50
+ start: "",
51
+ end: "",
52
+ },
53
+ sideAlign: {
54
+ "top-center": "left-[50%] translate-x-[-50%]",
55
+ "bottom-center": "left-[50%] translate-x-[-50%]",
56
+ "left-center": "top-[50%] translate-y-[-50%]",
57
+ "right-center": "top-[50%] translate-y-[-50%]",
58
+ "top-start": "left-0",
59
+ "bottom-start": "left-0",
60
+ "top-end": "right-0",
61
+ "bottom-end": "right-0",
62
+ "left-start": "top-0",
63
+ "right-start": "top-0",
64
+ "left-end": "bottom-0",
65
+ "right-end": "bottom-0",
66
+ },
67
+ },
68
+ defaultVariants: {
69
+ side: "top",
70
+ align: "center",
71
+ },
72
+ compoundVariants: [
73
+ {
74
+ side: ["top", "bottom"],
75
+ align: "center",
76
+ class: "left-[50%] translate-x-[-50%]",
77
+ },
78
+ {
79
+ side: ["left", "right"],
80
+ align: "center",
81
+ class: "top-[50%] translate-y-[-50%]",
82
+ },
83
+ {
84
+ side: ["top", "bottom"],
85
+ align: "start",
86
+ class: "left-0",
87
+ },
88
+ {
89
+ side: ["top", "bottom"],
90
+ align: "end",
91
+ class: "right-0",
92
+ },
93
+ {
94
+ side: ["left", "right"],
95
+ align: "start",
96
+ class: "top-0",
97
+ },
98
+ {
99
+ side: ["left", "right"],
100
+ align: "end",
101
+ class: "bottom-0",
102
+ },
103
+ ],
104
+ });
105
+
32
106
  const {
33
107
  side = "top",
34
108
  align = "center",
@@ -40,28 +114,7 @@ const {
40
114
  ---
41
115
 
42
116
  <div
43
- class:list={[
44
- "starwind-tooltip-content",
45
- "absolute z-50 hidden px-3 py-1.5 whitespace-nowrap shadow-sm",
46
- "bg-popover text-popover-foreground rounded-md border",
47
- "animate-in fade-in-0 zoom-in-95",
48
- "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
49
- {
50
- "slide-in-from-right-2 right-(--tooltip-offset)": side === "left",
51
- "slide-in-from-left-2 left-(--tooltip-offset)": side === "right",
52
- "slide-in-from-top-2 top-(--tooltip-offset)": side === "bottom",
53
- "slide-in-from-bottom-2 bottom-(--tooltip-offset)": side === "top",
54
- },
55
- {
56
- "left-[50%] translate-x-[-50%]": align === "center" && (side === "top" || side === "bottom"),
57
- "top-[50%] translate-y-[-50%]": align === "center" && (side === "left" || side === "right"),
58
- "left-0": align === "start" && (side === "top" || side === "bottom"),
59
- "right-0": align === "end" && (side === "top" || side === "bottom"),
60
- "top-0": align === "start" && (side === "left" || side === "right"),
61
- "bottom-0": align === "end" && (side === "left" || side === "right"),
62
- },
63
- className,
64
- ]}
117
+ class={tooltipContent({ side, align, class: className })}
65
118
  data-state="closed"
66
119
  data-side={side}
67
120
  data-align={align}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starwind-ui/core",
3
- "version": "0.1.1",
3
+ "version": "1.1.0",
4
4
  "description": "Starwind UI core components and registry",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",