@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
package/dist/index.js CHANGED
@@ -7,97 +7,97 @@ var registry_default = [
7
7
  {
8
8
  name: "accordion",
9
9
  type: "component",
10
- version: "1.0.0",
10
+ version: "1.1.0",
11
11
  dependencies: []
12
12
  },
13
13
  {
14
14
  name: "alert",
15
15
  type: "component",
16
- version: "1.0.0",
16
+ version: "1.1.0",
17
17
  dependencies: []
18
18
  },
19
19
  {
20
20
  name: "avatar",
21
21
  type: "component",
22
- version: "1.0.0",
22
+ version: "1.1.0",
23
23
  dependencies: []
24
24
  },
25
25
  {
26
26
  name: "badge",
27
27
  type: "component",
28
- version: "1.0.0",
28
+ version: "1.1.0",
29
29
  dependencies: []
30
30
  },
31
31
  {
32
32
  name: "button",
33
33
  type: "component",
34
- version: "1.0.0",
34
+ version: "2.0.0",
35
35
  dependencies: []
36
36
  },
37
37
  {
38
38
  name: "card",
39
39
  type: "component",
40
- version: "1.0.0",
40
+ version: "1.1.0",
41
41
  dependencies: []
42
42
  },
43
43
  {
44
44
  name: "checkbox",
45
45
  type: "component",
46
- version: "1.0.0",
46
+ version: "1.1.0",
47
47
  dependencies: []
48
48
  },
49
49
  {
50
50
  name: "dialog",
51
51
  type: "component",
52
- version: "1.0.0",
52
+ version: "1.1.0",
53
53
  dependencies: []
54
54
  },
55
55
  {
56
56
  name: "input",
57
57
  type: "component",
58
- version: "1.0.0",
58
+ version: "1.1.0",
59
59
  dependencies: []
60
60
  },
61
61
  {
62
62
  name: "label",
63
63
  type: "component",
64
- version: "1.0.0",
64
+ version: "1.1.0",
65
65
  dependencies: []
66
66
  },
67
67
  {
68
68
  name: "pagination",
69
69
  type: "component",
70
- version: "1.0.0",
70
+ version: "2.0.0",
71
71
  dependencies: []
72
72
  },
73
73
  {
74
74
  name: "select",
75
75
  type: "component",
76
- version: "1.0.0",
76
+ version: "1.1.0",
77
77
  dependencies: []
78
78
  },
79
79
  {
80
80
  name: "switch",
81
81
  type: "component",
82
- version: "1.0.0",
82
+ version: "1.1.0",
83
83
  dependencies: []
84
84
  },
85
85
  {
86
86
  name: "tabs",
87
87
  type: "component",
88
- version: "1.0.0",
88
+ version: "1.1.0",
89
89
  dependencies: []
90
90
  },
91
91
  {
92
92
  name: "textarea",
93
93
  type: "component",
94
- version: "1.0.0",
94
+ version: "1.1.0",
95
95
  dependencies: []
96
96
  },
97
97
  {
98
98
  name: "tooltip",
99
99
  type: "component",
100
- version: "1.0.0",
100
+ version: "1.1.0",
101
101
  dependencies: []
102
102
  }
103
103
  ];
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/registry.json"],"sourcesContent":["import { join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport componentRegistry from \"./registry.json\" assert { type: \"json\" };\n\n/**\n * Component metadata interface describing a Starwind UI component\n */\nexport interface ComponentMeta {\n\tname: string;\n\tversion: string;\n\ttype: \"component\";\n\tdependencies: string[];\n}\n\n/**\n * Registry interface containing all available components\n */\nexport interface Registry {\n\tcomponents: ComponentMeta[];\n}\n\nconst __dirname = fileURLToPath(new URL(\".\", import.meta.url));\n\n/**\n * Get the absolute path to a component file\n * @param {string} componentName - The name of the component\n * @param {string} fileName - The name of the file within the component\n * @returns {string} The absolute path to the component file\n */\nexport const getComponentPath = (componentName: string, fileName: string): string => {\n\t// In production (when installed as a dependency), the components will be in dist/src/components\n\t// In development, they will be in src/components\n\tconst componentsDir = __dirname.includes(\"dist\") ? \"src/components\" : \"src/components\";\n\treturn join(__dirname, componentsDir, componentName, fileName);\n};\n\n/**\n * Map of all components and their metadata from registry\n */\nexport const registry = componentRegistry as ComponentMeta[];\n","[\n\t{\n\t\t\"name\": \"accordion\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"alert\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"avatar\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"badge\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"button\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"card\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"checkbox\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"dialog\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"input\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"label\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"pagination\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"select\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"switch\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"tabs\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"textarea\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"tooltip\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.0.0\",\n\t\t\"dependencies\": []\n\t}\n]\n"],"mappings":";AAAA,SAAS,YAAY;AACrB,SAAS,qBAAqB;;;ACD9B;AAAA,EACC;AAAA,IACC,MAAQ;AAAA,IACR,MAAQ;AAAA,IACR,SAAW;AAAA,IACX,cAAgB,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,IACC,MAAQ;AAAA,IACR,MAAQ;AAAA,IACR,SAAW;AAAA,IACX,cAAgB,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,IACC,MAAQ;AAAA,IACR,MAAQ;AAAA,IACR,SAAW;AAAA,IACX,cAAgB,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,IACC,MAAQ;AAAA,IACR,MAAQ;AAAA,IACR,SAAW;AAAA,IACX,cAAgB,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,IACC,MAAQ;AAAA,IACR,MAAQ;AAAA,IACR,SAAW;AAAA,IACX,cAAgB,C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,QAAM,gBAAgB,UAAU,SAAS,MAAM,IAAI,mBAAmB;AACtE,SAAO,KAAK,WAAW,eAAe,eAAe,QAAQ;AAC9D;AAKO,IAAM,WAAW;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/registry.json"],"sourcesContent":["import { join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport componentRegistry from \"./registry.json\" assert { type: \"json\" };\n\n/**\n * Component metadata interface describing a Starwind UI component\n */\nexport interface ComponentMeta {\n\tname: string;\n\tversion: string;\n\ttype: \"component\";\n\tdependencies: string[];\n}\n\n/**\n * Registry interface containing all available components\n */\nexport interface Registry {\n\tcomponents: ComponentMeta[];\n}\n\nconst __dirname = fileURLToPath(new URL(\".\", import.meta.url));\n\n/**\n * Get the absolute path to a component file\n * @param {string} componentName - The name of the component\n * @param {string} fileName - The name of the file within the component\n * @returns {string} The absolute path to the component file\n */\nexport const getComponentPath = (componentName: string, fileName: string): string => {\n\t// In production (when installed as a dependency), the components will be in dist/src/components\n\t// In development, they will be in src/components\n\tconst componentsDir = __dirname.includes(\"dist\") ? \"src/components\" : \"src/components\";\n\treturn join(__dirname, componentsDir, componentName, fileName);\n};\n\n/**\n * Map of all components and their metadata from registry\n */\nexport const registry = componentRegistry as ComponentMeta[];\n","[\n\t{\n\t\t\"name\": \"accordion\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.1.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"alert\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.1.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"avatar\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.1.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"badge\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.1.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"button\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"2.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"card\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.1.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"checkbox\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.1.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"dialog\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.1.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"input\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.1.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"label\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.1.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"pagination\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"2.0.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"select\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.1.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"switch\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.1.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"tabs\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.1.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"textarea\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.1.0\",\n\t\t\"dependencies\": []\n\t},\n\t{\n\t\t\"name\": \"tooltip\",\n\t\t\"type\": \"component\",\n\t\t\"version\": \"1.1.0\",\n\t\t\"dependencies\": []\n\t}\n]\n"],"mappings":";AAAA,SAAS,YAAY;AACrB,SAAS,qBAAqB;;;ACD9B;AAAA,EACC;AAAA,IACC,MAAQ;AAAA,IACR,MAAQ;AAAA,IACR,SAAW;AAAA,IACX,cAAgB,CAAC;AAAA,EAClB;A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IACR,MAAQ;AAAA,IACR,SAAW;AAAA,IACX,cAAgB,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,IACC,MAAQ;AAAA,IACR,MAAQ;AAAA,IACR,SAAW;AAAA,IACX,cAAgB,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,IACC,MAAQ;AAAA,IACR,MAAQ;AAAA,IACR,SAAW;AAAA,IACX,cAAgB,CAAC;AAAA,EAClB;AACD;;;AD5EA,IAAM,YAAY,cAAc,IAAI,IAAI,KAAK,YAAY,GAAG,CAAC;AAQtD,IAAM,mBAAmB,CAAC,eAAuB,aAA6B;AAGpF,QAAM,gBAAgB,UAAU,SAAS,MAAM,IAAI,mBAAmB;AACtE,SAAO,KAAK,WAAW,eAAe,eAAe,QAAQ;AAC9D;AAKO,IAAM,WAAW;","names":[]}
@@ -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
  /**
@@ -12,15 +13,14 @@ type Props = HTMLAttributes<"div"> & {
12
13
  defaultValue?: string;
13
14
  };
14
15
 
16
+ const accordion = tv({
17
+ base: "starwind-accordion",
18
+ });
19
+
15
20
  const { type = "single", defaultValue, class: className, ...rest } = Astro.props;
16
21
  ---
17
22
 
18
- <div
19
- class:list={["starwind-accordion", className]}
20
- data-type={type}
21
- data-value={defaultValue}
22
- {...rest}
23
- >
23
+ <div class={accordion({ class: className })} data-type={type} data-value={defaultValue} {...rest}>
24
24
  <slot />
25
25
  </div>
26
26
 
@@ -4,20 +4,24 @@
4
4
  * It is later removed in the Accordion.astro script
5
5
  */
6
6
  import type { HTMLAttributes } from "astro/types";
7
+ import { tv } from "tailwind-variants";
7
8
 
8
9
  type Props = HTMLAttributes<"div">;
9
10
 
10
- const { class: className, ...rest } = Astro.props;
11
- ---
12
-
13
- <div
14
- class:list={[
11
+ const accordionContent = tv({
12
+ base: [
15
13
  "starwind-accordion-content",
16
14
  "transform-gpu overflow-hidden",
17
15
  "data-[state=closed]:animate-accordion-up data-[state=closed]:h-0",
18
16
  "data-[state=open]:animate-accordion-down",
19
- className,
20
- ]}
17
+ ],
18
+ });
19
+
20
+ const { class: className, ...rest } = Astro.props;
21
+ ---
22
+
23
+ <div
24
+ class={accordionContent({ class: className })}
21
25
  data-state="closed"
22
26
  style="animation: none;"
23
27
  {...rest}
@@ -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
  /**
@@ -8,18 +9,13 @@ type Props = HTMLAttributes<"div"> & {
8
9
  value: string;
9
10
  };
10
11
 
12
+ const accordionItem = tv({
13
+ base: "starwind-accordion-item border-x border-b first:rounded-t-lg first:border-t last:rounded-b-lg",
14
+ });
15
+
11
16
  const { value, class: className, ...rest } = Astro.props;
12
17
  ---
13
18
 
14
- <div
15
- class:list={[
16
- "starwind-accordion-item",
17
- "border-x border-b first:rounded-t-lg first:border-t last:rounded-b-lg",
18
- className,
19
- ]}
20
- data-value={value}
21
- data-state="closed"
22
- {...rest}
23
- >
19
+ <div class={accordionItem({ class: className })} data-value={value} data-state="closed" {...rest}>
24
20
  <slot />
25
21
  </div>
@@ -1,23 +1,26 @@
1
1
  ---
2
2
  import ChevronDown from "@tabler/icons/outline/chevron-down.svg";
3
-
4
3
  import type { HTMLAttributes } from "astro/types";
4
+ import { tv } from "tailwind-variants";
5
5
 
6
6
  type Props = HTMLAttributes<"button">;
7
7
 
8
- const { class: className, ...rest } = Astro.props;
9
- ---
10
-
11
- <button
12
- type="button"
13
- class:list={[
8
+ const accordionTrigger = tv({
9
+ base: [
14
10
  "starwind-accordion-trigger",
15
11
  "flex w-full items-center justify-between gap-4 rounded-md px-5 py-4",
16
12
  "starwind-transition-colors hover:text-muted-foreground text-left font-medium",
17
13
  "[&[data-state=open]>svg]:rotate-180",
18
14
  "focus-visible:outline-outline focus-visible:outline-2 focus-visible:outline-offset-0",
19
- className,
20
- ]}
15
+ ],
16
+ });
17
+
18
+ const { class: className, ...rest } = Astro.props;
19
+ ---
20
+
21
+ <button
22
+ type="button"
23
+ class={accordionTrigger({ class: className })}
21
24
  aria-expanded="false"
22
25
  {...rest}
23
26
  >
@@ -1,5 +1,24 @@
1
1
  ---
2
2
  import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ const alert = tv({
6
+ base: "text-foreground relative w-full rounded-lg border p-4",
7
+ variants: {
8
+ variant: {
9
+ default: "bg-background [&>h5>svg]:text-foreground",
10
+ primary: "border-primary bg-primary/7 [&>h5>svg]:text-primary",
11
+ secondary: "border-secondary bg-secondary/7 [&>h5>svg]:text-secondary",
12
+ info: "border-info bg-info/7 [&>h5>svg]:text-info",
13
+ success: "border-success bg-success/7 [&>h5>svg]:text-success",
14
+ warning: "border-warning bg-warning/7 [&>h5>svg]:text-warning",
15
+ error: "border-error bg-error/7 [&>h5>svg]:text-error",
16
+ }
17
+ },
18
+ defaultVariants: {
19
+ variant: "default"
20
+ }
21
+ });
3
22
 
4
23
  type Props = HTMLAttributes<"div"> & {
5
24
  /**
@@ -12,33 +31,6 @@ type Props = HTMLAttributes<"div"> & {
12
31
  const { variant = "default", class: className, ...rest } = Astro.props;
13
32
  ---
14
33
 
15
- <div
16
- class:list={[
17
- "text-foreground relative w-full rounded-lg border p-4",
18
- {
19
- "bg-background [&>h5>svg]:text-foreground": variant === "default",
20
- },
21
- {
22
- "border-primary bg-primary/7 [&>h5>svg]:text-primary": variant === "primary",
23
- },
24
- {
25
- "border-secondary bg-secondary/7 [&>h5>svg]:text-secondary": variant === "secondary",
26
- },
27
- {
28
- "border-info bg-info/7 [&>h5>svg]:text-info": variant === "info",
29
- },
30
- {
31
- "border-success bg-success/7 [&>h5>svg]:text-success": variant === "success",
32
- },
33
- {
34
- "border-warning bg-warning/7 [&>h5>svg]:text-warning": variant === "warning",
35
- },
36
- {
37
- "border-error bg-error/7 [&>h5>svg]:text-error": variant === "error",
38
- },
39
- className,
40
- ]}
41
- {...rest}
42
- >
34
+ <div class={alert({ variant, class: className })} {...rest}>
43
35
  <slot />
44
36
  </div>
@@ -1,11 +1,16 @@
1
1
  ---
2
2
  import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ const alertDescription = tv({
6
+ base: "[&_p]:leading-relaxed",
7
+ });
3
8
 
4
9
  type Props = HTMLAttributes<"div">;
5
10
 
6
11
  const { class: className, ...rest } = Astro.props;
7
12
  ---
8
13
 
9
- <div class:list={["[&_p]:leading-relaxed", className]} {...rest}>
14
+ <div class={alertDescription({ class: className })} {...rest}>
10
15
  <slot />
11
16
  </div>
@@ -1,17 +1,16 @@
1
1
  ---
2
2
  import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ const alertTitle = tv({
6
+ base: "mb-2 flex items-center gap-2 text-lg leading-none font-medium tracking-tight",
7
+ });
3
8
 
4
9
  type Props = HTMLAttributes<"div">;
5
10
 
6
11
  const { class: className, ...rest } = Astro.props;
7
12
  ---
8
13
 
9
- <h5
10
- class:list={[
11
- "mb-2 flex items-center gap-2 text-lg leading-none font-medium tracking-tight",
12
- className,
13
- ]}
14
- {...rest}
15
- >
14
+ <h5 class={alertTitle({ class: className })} {...rest}>
16
15
  <slot />
17
16
  </h5>
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import type { HTMLAttributes } from "astro/types";
3
+ import { tv, type VariantProps } from "tailwind-variants";
3
4
 
4
5
  interface Props extends HTMLAttributes<"div"> {
5
6
  /**
@@ -14,31 +15,33 @@ interface Props extends HTMLAttributes<"div"> {
14
15
  size?: "sm" | "md" | "lg";
15
16
  }
16
17
 
17
- const { variant = "default", size = "md", class: className, ...rest } = Astro.props;
18
+ const avatar = tv({
19
+ base: "text-foreground bg-muted relative overflow-hidden rounded-full border-2",
20
+ variants: {
21
+ variant: {
22
+ default: "border-border",
23
+ primary: "border-primary",
24
+ secondary: "border-secondary",
25
+ info: "border-info",
26
+ success: "border-success",
27
+ warning: "border-warning",
28
+ error: "border-error",
29
+ },
30
+ size: {
31
+ sm: "h-8 w-8 text-xs",
32
+ md: "h-10 w-10 text-sm",
33
+ lg: "h-12 w-12 text-base",
34
+ },
35
+ },
36
+ defaultVariants: {
37
+ variant: "default",
38
+ size: "md",
39
+ },
40
+ });
18
41
 
19
- const sizeClasses = {
20
- sm: "h-8 w-8 text-xs",
21
- md: "h-10 w-10 text-sm",
22
- lg: "h-12 w-12 text-base",
23
- }[size];
42
+ const { variant, size, class: className, ...rest } = Astro.props;
24
43
  ---
25
44
 
26
- <figure
27
- class:list={[
28
- "text-foreground bg-muted relative overflow-hidden rounded-full border-2",
29
- {
30
- "border-border": variant === "default",
31
- "border-primary": variant === "primary",
32
- "border-secondary": variant === "secondary",
33
- "border-info": variant === "info",
34
- "border-success": variant === "success",
35
- "border-warning": variant === "warning",
36
- "border-error": variant === "error",
37
- },
38
- sizeClasses,
39
- className,
40
- ]}
41
- {...rest}
42
- >
45
+ <figure class={avatar({ variant, size, class: className })} {...rest}>
43
46
  <slot />
44
47
  </figure>
@@ -1,4 +1,10 @@
1
1
  ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const avatarFallback = tv({
5
+ base: "absolute inset-0.5 flex items-center justify-center rounded-full font-medium",
6
+ });
7
+
2
8
  interface Props {
3
9
  class?: string;
4
10
  }
@@ -6,11 +12,6 @@ interface Props {
6
12
  const { class: className } = Astro.props;
7
13
  ---
8
14
 
9
- <div
10
- class:list={[
11
- "absolute inset-0.5 flex items-center justify-center rounded-full font-medium",
12
- className,
13
- ]}
14
- >
15
+ <div class={avatarFallback({ class: className })}>
15
16
  <slot />
16
17
  </div>
@@ -1,8 +1,14 @@
1
1
  ---
2
2
  import { Image } from "astro:assets";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ const avatarImage = tv({
6
+ base: "relative z-1 h-full w-full object-cover",
7
+ });
3
8
 
4
9
  type BaseProps = {
5
10
  alt: string;
11
+ class?: string;
6
12
  };
7
13
 
8
14
  type WithSrc = BaseProps & {
@@ -17,7 +23,7 @@ type WithImage = BaseProps & {
17
23
 
18
24
  type Props = WithSrc | WithImage;
19
25
 
20
- const { src, image, alt } = Astro.props;
26
+ const { src, image, alt, class: className } = Astro.props;
21
27
 
22
28
  if (!src && !image) {
23
29
  throw new Error("Either 'src' or 'image' is required for an avatar image.");
@@ -29,20 +35,11 @@ if (!src && !image) {
29
35
  <img
30
36
  src={src}
31
37
  alt={alt}
32
- class="relative z-1 h-full w-full rounded-full object-cover"
38
+ class={avatarImage({ class: className })}
33
39
  width={64}
34
40
  height={64}
35
41
  onerror="this.style.display='none'"
36
42
  />
37
43
  )
38
44
  }
39
- {
40
- image && (
41
- <Image
42
- src={image}
43
- alt={alt}
44
- class="relative z-1 h-full w-full rounded-full object-cover"
45
- width={64}
46
- />
47
- )
48
- }
45
+ {image && <Image src={image} alt={alt} class={avatarImage({ class: className })} width={64} />}
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import type { HTMLAttributes } from "astro/types";
3
+ import { tv, type VariantProps } from "tailwind-variants";
3
4
 
4
5
  interface Props extends HTMLAttributes<"div">, Omit<HTMLAttributes<"a">, "type"> {
5
6
  /**
@@ -21,44 +22,95 @@ interface Props extends HTMLAttributes<"div">, Omit<HTMLAttributes<"a">, "type">
21
22
  * @default "md"
22
23
  */
23
24
  size?: "sm" | "md" | "lg";
25
+ /**
26
+ * URL to link to when badge is clicked
27
+ */
28
+ href?: string;
24
29
  }
25
30
 
26
- const { variant = "default", size = "md", class: className, ...rest } = Astro.props;
27
-
28
- const Tag = Astro.props.href ? "a" : "div";
29
- ---
30
-
31
- <Tag
32
- class:list={[
33
- "starwind-badge starwind-transition-colors inline-flex items-center rounded-full font-semibold",
34
- "focus-visible:outline-2 focus-visible:outline-offset-2",
31
+ const badgeVariants = tv({
32
+ base: "starwind-badge starwind-transition-colors inline-flex items-center rounded-full font-semibold focus-visible:outline-2 focus-visible:outline-offset-2",
33
+ variants: {
34
+ variant: {
35
+ default: "bg-foreground text-background",
36
+ primary: "bg-primary text-primary-foreground focus-visible:outline-primary",
37
+ secondary: "bg-secondary text-secondary-foreground focus-visible:outline-secondary",
38
+ outline: "border-border focus-visible:outline-outline border",
39
+ ghost: "bg-foreground/10 text-foreground focus-visible:outline-outline",
40
+ info: "bg-info text-info-foreground focus-visible:outline-info",
41
+ success: "bg-success text-success-foreground focus-visible:outline-success",
42
+ warning: "bg-warning text-warning-foreground focus-visible:outline-warning",
43
+ error: "bg-error text-error-foreground focus-visible:outline-error",
44
+ },
45
+ size: {
46
+ sm: "px-2.5 py-0.5 text-xs",
47
+ md: "px-3 py-0.5 text-sm",
48
+ lg: "px-4 py-1 text-base",
49
+ },
50
+ isLink: {
51
+ true: "cursor-pointer",
52
+ false: "",
53
+ },
54
+ },
55
+ compoundVariants: [
56
+ {
57
+ isLink: true,
58
+ variant: "default",
59
+ className: "hover:bg-foreground/80",
60
+ },
35
61
  {
36
- "bg-foreground text-background hover:bg-foreground/80": variant === "default",
37
- "bg-primary text-primary-foreground hover:bg-primary/80 focus-visible:outline-primary":
38
- variant === "primary",
39
- "bg-secondary text-secondary-foreground hover:bg-secondary/80 focus-visible:outline-secondary":
40
- variant === "secondary",
41
- "border-border hover:border-border/80 focus-visible:outline-outline border":
42
- variant === "outline",
43
- "bg-info text-info-foreground hover:bg-info/80 focus-visible:outline-info":
44
- variant === "info",
45
- "bg-success text-success-foreground hover:bg-success/80 focus-visible:outline-success":
46
- variant === "success",
47
- "bg-warning text-warning-foreground hover:bg-warning/80 focus-visible:outline-warning":
48
- variant === "warning",
49
- "bg-error text-error-foreground hover:bg-error/80 focus-visible:outline-error":
50
- variant === "error",
51
- "bg-foreground/10 text-foreground hover:bg-foreground/7 focus-visible:outline-outline":
52
- variant === "ghost",
62
+ isLink: true,
63
+ variant: "primary",
64
+ className: "hover:bg-primary/80",
53
65
  },
54
66
  {
55
- "px-2.5 py-0.5 text-xs": size === "sm",
56
- "px-3 py-0.5 text-sm": size === "md",
57
- "px-4 py-1 text-base": size === "lg",
67
+ isLink: true,
68
+ variant: "secondary",
69
+ className: "hover:bg-secondary/80",
58
70
  },
59
- className,
60
- ]}
61
- {...rest}
62
- >
71
+ {
72
+ isLink: true,
73
+ variant: "outline",
74
+ className: "hover:border-border/80",
75
+ },
76
+ {
77
+ isLink: true,
78
+ variant: "ghost",
79
+ className: "hover:bg-foreground/7",
80
+ },
81
+ {
82
+ isLink: true,
83
+ variant: "info",
84
+ className: "hover:bg-info/80",
85
+ },
86
+ {
87
+ isLink: true,
88
+ variant: "success",
89
+ className: "hover:bg-success/80",
90
+ },
91
+ {
92
+ isLink: true,
93
+ variant: "warning",
94
+ className: "hover:bg-warning/80",
95
+ },
96
+ {
97
+ isLink: true,
98
+ variant: "error",
99
+ className: "hover:bg-error/80",
100
+ },
101
+ ],
102
+ defaultVariants: {
103
+ variant: "default",
104
+ size: "md",
105
+ isLink: false,
106
+ },
107
+ });
108
+
109
+ const { variant = "default", size = "md", class: className, href, ...rest } = Astro.props;
110
+ const isLink = !!href;
111
+ const Tag = isLink ? "a" : "div";
112
+ ---
113
+
114
+ <Tag class={badgeVariants({ variant, size, isLink, class: className })} href={href} {...rest}>
63
115
  <slot />
64
116
  </Tag>