@starwind-ui/core 1.6.2 → 1.7.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.
Files changed (101) hide show
  1. package/dist/index.js +8 -4
  2. package/dist/index.js.map +1 -1
  3. package/dist/src/components/accordion/Accordion.astro +224 -224
  4. package/dist/src/components/accordion/AccordionContent.astro +13 -13
  5. package/dist/src/components/accordion/AccordionItem.astro +6 -6
  6. package/dist/src/components/accordion/AccordionTrigger.astro +13 -13
  7. package/dist/src/components/accordion/index.ts +4 -4
  8. package/dist/src/components/alert/Alert.astro +15 -15
  9. package/dist/src/components/alert/AlertDescription.astro +1 -1
  10. package/dist/src/components/alert/AlertTitle.astro +2 -2
  11. package/dist/src/components/alert/index.ts +3 -3
  12. package/dist/src/components/avatar/Avatar.astro +16 -16
  13. package/dist/src/components/avatar/AvatarFallback.astro +3 -3
  14. package/dist/src/components/avatar/AvatarImage.astro +12 -12
  15. package/dist/src/components/avatar/index.ts +4 -4
  16. package/dist/src/components/badge/Badge.astro +33 -33
  17. package/dist/src/components/breadcrumb/Breadcrumb.astro +1 -1
  18. package/dist/src/components/breadcrumb/BreadcrumbEllipsis.astro +6 -6
  19. package/dist/src/components/breadcrumb/BreadcrumbItem.astro +1 -1
  20. package/dist/src/components/breadcrumb/BreadcrumbLink.astro +8 -8
  21. package/dist/src/components/breadcrumb/BreadcrumbList.astro +2 -2
  22. package/dist/src/components/breadcrumb/BreadcrumbPage.astro +6 -6
  23. package/dist/src/components/breadcrumb/BreadcrumbSeparator.astro +7 -7
  24. package/dist/src/components/breadcrumb/index.ts +14 -14
  25. package/dist/src/components/button/Button.astro +38 -38
  26. package/dist/src/components/card/Card.astro +1 -1
  27. package/dist/src/components/card/CardContent.astro +1 -1
  28. package/dist/src/components/card/CardDescription.astro +1 -1
  29. package/dist/src/components/card/CardFooter.astro +1 -1
  30. package/dist/src/components/card/CardHeader.astro +1 -1
  31. package/dist/src/components/card/CardTitle.astro +1 -1
  32. package/dist/src/components/card/index.ts +7 -7
  33. package/dist/src/components/checkbox/Checkbox.astro +89 -89
  34. package/dist/src/components/dialog/Dialog.astro +237 -178
  35. package/dist/src/components/dialog/DialogClose.astro +14 -14
  36. package/dist/src/components/dialog/DialogContent.astro +32 -32
  37. package/dist/src/components/dialog/DialogDescription.astro +1 -1
  38. package/dist/src/components/dialog/DialogFooter.astro +1 -1
  39. package/dist/src/components/dialog/DialogHeader.astro +1 -1
  40. package/dist/src/components/dialog/DialogTitle.astro +6 -6
  41. package/dist/src/components/dialog/DialogTrigger.astro +26 -20
  42. package/dist/src/components/dialog/index.ts +16 -16
  43. package/dist/src/components/dropdown/Dropdown.astro +359 -359
  44. package/dist/src/components/dropdown/DropdownContent.astro +63 -63
  45. package/dist/src/components/dropdown/DropdownItem.astro +31 -31
  46. package/dist/src/components/dropdown/DropdownLabel.astro +14 -14
  47. package/dist/src/components/dropdown/DropdownSeparator.astro +5 -5
  48. package/dist/src/components/dropdown/DropdownTrigger.astro +26 -26
  49. package/dist/src/components/dropdown/index.ts +12 -12
  50. package/dist/src/components/dropzone/Dropzone.astro +232 -0
  51. package/dist/src/components/dropzone/DropzoneFilesList.astro +25 -0
  52. package/dist/src/components/dropzone/DropzoneLoadingIndicator.astro +10 -0
  53. package/dist/src/components/dropzone/DropzoneUploadIndicator.astro +10 -0
  54. package/dist/src/components/dropzone/index.ts +13 -0
  55. package/dist/src/components/input/Input.astro +12 -12
  56. package/dist/src/components/label/Label.astro +8 -8
  57. package/dist/src/components/pagination/Pagination.astro +1 -1
  58. package/dist/src/components/pagination/PaginationContent.astro +3 -3
  59. package/dist/src/components/pagination/PaginationEllipsis.astro +2 -2
  60. package/dist/src/components/pagination/PaginationItem.astro +3 -3
  61. package/dist/src/components/pagination/PaginationLink.astro +27 -27
  62. package/dist/src/components/pagination/PaginationNext.astro +7 -6
  63. package/dist/src/components/pagination/PaginationPrevious.astro +7 -6
  64. package/dist/src/components/pagination/index.ts +14 -14
  65. package/dist/src/components/progress/Progress.astro +151 -0
  66. package/dist/src/components/progress/index.ts +5 -0
  67. package/dist/src/components/radio-group/RadioGroup.astro +156 -0
  68. package/dist/src/components/radio-group/RadioGroupItem.astro +125 -0
  69. package/dist/src/components/radio-group/RadioGroupTypes.ts +6 -0
  70. package/dist/src/components/radio-group/index.ts +10 -0
  71. package/dist/src/components/select/Select.astro +515 -475
  72. package/dist/src/components/select/SelectContent.astro +62 -62
  73. package/dist/src/components/select/SelectItem.astro +27 -27
  74. package/dist/src/components/select/SelectLabel.astro +1 -1
  75. package/dist/src/components/select/SelectTrigger.astro +28 -28
  76. package/dist/src/components/select/SelectTypes.ts +11 -5
  77. package/dist/src/components/select/SelectValue.astro +5 -5
  78. package/dist/src/components/select/index.ts +16 -16
  79. package/dist/src/components/skeleton/Skeleton.astro +14 -0
  80. package/dist/src/components/skeleton/index.ts +5 -0
  81. package/dist/src/components/switch/Switch.astro +150 -150
  82. package/dist/src/components/switch/SwitchTypes.ts +4 -4
  83. package/dist/src/components/table/Table.astro +5 -5
  84. package/dist/src/components/table/TableBody.astro +3 -3
  85. package/dist/src/components/table/TableCaption.astro +3 -3
  86. package/dist/src/components/table/TableCell.astro +3 -3
  87. package/dist/src/components/table/TableFoot.astro +3 -3
  88. package/dist/src/components/table/TableHead.astro +3 -3
  89. package/dist/src/components/table/TableHeader.astro +3 -3
  90. package/dist/src/components/table/TableRow.astro +3 -3
  91. package/dist/src/components/table/index.ts +8 -8
  92. package/dist/src/components/tabs/Tabs.astro +250 -250
  93. package/dist/src/components/tabs/TabsContent.astro +10 -10
  94. package/dist/src/components/tabs/TabsList.astro +2 -2
  95. package/dist/src/components/tabs/TabsTrigger.astro +15 -15
  96. package/dist/src/components/tabs/index.ts +4 -4
  97. package/dist/src/components/textarea/Textarea.astro +16 -16
  98. package/dist/src/components/tooltip/Tooltip.astro +217 -217
  99. package/dist/src/components/tooltip/TooltipContent.astro +81 -81
  100. package/dist/src/components/tooltip/index.ts +3 -3
  101. package/package.json +6 -6
@@ -3,80 +3,80 @@ import type { HTMLAttributes } from "astro/types";
3
3
  import { tv } from "tailwind-variants";
4
4
 
5
5
  type Props = HTMLAttributes<"div"> & {
6
- /**
7
- * Side of the tooltip
8
- * @default bottom
9
- */
10
- side?: "top" | "bottom";
11
- /**
12
- * Alignment of the dropdown
13
- * @default start
14
- */
15
- align?: "start" | "center" | "end";
16
- /**
17
- * Offset distance in pixels
18
- * @default 4
19
- */
20
- sideOffset?: number;
21
- /**
22
- * Open and close animation duration in milliseconds
23
- * @default 150
24
- */
25
- animationDuration?: number;
6
+ /**
7
+ * Side of the tooltip
8
+ * @default bottom
9
+ */
10
+ side?: "top" | "bottom";
11
+ /**
12
+ * Alignment of the dropdown
13
+ * @default start
14
+ */
15
+ align?: "start" | "center" | "end";
16
+ /**
17
+ * Offset distance in pixels
18
+ * @default 4
19
+ */
20
+ sideOffset?: number;
21
+ /**
22
+ * Open and close animation duration in milliseconds
23
+ * @default 150
24
+ */
25
+ animationDuration?: number;
26
26
  };
27
27
 
28
28
  const selectContent = tv({
29
- base: [
30
- "starwind-select-content",
31
- "bg-popover text-popover-foreground absolute z-50 min-w-[8rem] rounded-md border shadow-md",
32
- "data-[state=open]:animate-in fade-in zoom-in-95 overflow-hidden will-change-transform",
33
- "data-[state=closed]:animate-out data-[state=closed]:fill-mode-forwards fade-out zoom-out-95",
34
- ],
35
- variants: {
36
- side: {
37
- bottom: "slide-in-from-top-2 slide-out-to-top-2 top-full",
38
- top: "slide-in-from-bottom-2 slide-out-to-bottom-2 bottom-full",
39
- },
40
- align: {
41
- start: "slide-in-from-left-1 slide-out-to-left-1 left-0",
42
- center: "left-1/2 -translate-x-1/2",
43
- end: "slide-in-from-right-1 slide-out-to-right-1 right-0",
44
- },
45
- },
46
- defaultVariants: { side: "bottom", align: "start" },
29
+ base: [
30
+ "starwind-select-content",
31
+ "bg-popover text-popover-foreground absolute z-50 min-w-[8rem] rounded-md border shadow-md",
32
+ "data-[state=open]:animate-in fade-in zoom-in-95 overflow-hidden will-change-transform",
33
+ "data-[state=closed]:animate-out data-[state=closed]:fill-mode-forwards fade-out zoom-out-95",
34
+ ],
35
+ variants: {
36
+ side: {
37
+ bottom: "slide-in-from-top-2 slide-out-to-top-2 top-full",
38
+ top: "slide-in-from-bottom-2 slide-out-to-bottom-2 bottom-full",
39
+ },
40
+ align: {
41
+ start: "slide-in-from-left-1 slide-out-to-left-1 left-0",
42
+ center: "left-1/2 -translate-x-1/2",
43
+ end: "slide-in-from-right-1 slide-out-to-right-1 right-0",
44
+ },
45
+ },
46
+ defaultVariants: { side: "bottom", align: "start" },
47
47
  });
48
48
 
49
49
  const selectContentInner = tv({
50
- base: "max-h-96 w-full min-w-(--select-trigger-width) overflow-y-auto p-1",
50
+ base: "max-h-96 w-full min-w-(--select-trigger-width) overflow-y-auto p-1",
51
51
  });
52
52
 
53
53
  const {
54
- class: className,
55
- side = "bottom",
56
- align = "start",
57
- sideOffset = 4,
58
- animationDuration = 150,
59
- ...rest
54
+ class: className,
55
+ side = "bottom",
56
+ align = "start",
57
+ sideOffset = 4,
58
+ animationDuration = 150,
59
+ ...rest
60
60
  } = Astro.props;
61
61
  ---
62
62
 
63
63
  <div
64
- class={selectContent({ side, align, class: className })}
65
- role="listbox"
66
- data-side={side}
67
- data-align={align}
68
- data-state="closed"
69
- tabindex="-1"
70
- style={{
71
- // hide the content initially. Script will remove this
72
- display: "none",
73
- animationDuration: `${animationDuration}ms`,
74
- marginTop: side === "bottom" ? `${sideOffset}px` : undefined,
75
- marginBottom: side === "top" ? `${sideOffset}px` : undefined,
76
- }}
77
- {...rest}
64
+ class={selectContent({ side, align, class: className })}
65
+ role="listbox"
66
+ data-side={side}
67
+ data-align={align}
68
+ data-state="closed"
69
+ tabindex="-1"
70
+ style={{
71
+ // hide the content initially. Script will remove this
72
+ display: "none",
73
+ animationDuration: `${animationDuration}ms`,
74
+ marginTop: side === "bottom" ? `${sideOffset}px` : undefined,
75
+ marginBottom: side === "top" ? `${sideOffset}px` : undefined,
76
+ }}
77
+ {...rest}
78
78
  >
79
- <div class={selectContentInner()}>
80
- <slot />
81
- </div>
79
+ <div class={selectContentInner()}>
80
+ <slot />
81
+ </div>
82
82
  </div>
@@ -4,23 +4,23 @@ import type { HTMLAttributes } from "astro/types";
4
4
  import { tv } from "tailwind-variants";
5
5
 
6
6
  type Props = HTMLAttributes<"div"> & {
7
- /**
8
- * The value associated with this select item
9
- */
10
- value: string;
11
- /**
12
- * Whether this select item is disabled and cannot be selected
13
- */
14
- disabled?: boolean;
7
+ /**
8
+ * The value associated with this select item
9
+ */
10
+ value: string;
11
+ /**
12
+ * Whether this select item is disabled and cannot be selected
13
+ */
14
+ disabled?: boolean;
15
15
  };
16
16
 
17
17
  const selectItem = tv({
18
- base: [
19
- "relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 outline-none select-none",
20
- "focus:bg-accent focus:text-accent-foreground",
21
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
22
- "not-aria-selected:[&_svg]:hidden aria-selected:[&_svg]:flex",
23
- ],
18
+ base: [
19
+ "relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 outline-none select-none",
20
+ "focus:bg-accent focus:text-accent-foreground",
21
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
22
+ "not-aria-selected:[&_svg]:hidden aria-selected:[&_svg]:flex",
23
+ ],
24
24
  });
25
25
 
26
26
  const selectItemIcon = tv({ base: "absolute left-2 size-3.5 items-center justify-center" });
@@ -29,18 +29,18 @@ const { class: className, value, disabled, ...rest } = Astro.props;
29
29
  ---
30
30
 
31
31
  <div
32
- class={selectItem({ class: className })}
33
- data-value={value}
34
- data-disabled={disabled}
35
- aria-selected="false"
36
- role="option"
37
- tabindex="0"
38
- {...rest}
32
+ class={selectItem({ class: className })}
33
+ data-value={value}
34
+ data-disabled={disabled}
35
+ aria-selected="false"
36
+ role="option"
37
+ tabindex="0"
38
+ {...rest}
39
39
  >
40
- <span class={selectItemIcon()}>
41
- <Check class="size-4" />
42
- </span>
43
- <span>
44
- <slot />
45
- </span>
40
+ <span class={selectItemIcon()}>
41
+ <Check class="size-4" />
42
+ </span>
43
+ <span>
44
+ <slot />
45
+ </span>
46
46
  </div>
@@ -10,5 +10,5 @@ const { class: className, ...rest } = Astro.props;
10
10
  ---
11
11
 
12
12
  <div class={selectLabel({ class: className })} {...rest}>
13
- <slot />
13
+ <slot />
14
14
  </div>
@@ -4,42 +4,42 @@ import type { HTMLAttributes } from "astro/types";
4
4
  import { tv } from "tailwind-variants";
5
5
 
6
6
  type Props = Omit<HTMLAttributes<"button">, "role" | "type"> & {
7
- /**
8
- * The content to be rendered inside the select trigger
9
- */
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
- children: any;
12
- /**
13
- * Whether the select field is required in a form context
14
- */
15
- required?: boolean;
7
+ /**
8
+ * The content to be rendered inside the select trigger
9
+ */
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ children: any;
12
+ /**
13
+ * Whether the select field is required in a form context
14
+ */
15
+ required?: boolean;
16
16
  };
17
17
 
18
18
  const selectTrigger = tv({
19
- base: [
20
- "starwind-select-trigger",
21
- "border-input bg-background text-foreground ring-offset-background flex h-11 items-center justify-between rounded-md border px-3 py-2",
22
- "focus:outline-outline focus:outline-2 focus:outline-offset-2",
23
- "disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
24
- ],
19
+ base: [
20
+ "starwind-select-trigger",
21
+ "border-input bg-background text-foreground ring-offset-background flex h-11 items-center justify-between rounded-md border px-3 py-2",
22
+ "focus:outline-outline focus:outline-2 focus:outline-offset-2",
23
+ "disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
24
+ ],
25
25
  });
26
26
 
27
27
  const { class: className, required = false, ...rest } = Astro.props;
28
28
  ---
29
29
 
30
30
  <button
31
- class={selectTrigger({ class: className })}
32
- type="button"
33
- role="combobox"
34
- aria-label="Select field"
35
- aria-controls=""
36
- aria-expanded="false"
37
- aria-haspopup="listbox"
38
- aria-autocomplete="none"
39
- aria-required={required ? "true" : "false"}
40
- data-state="closed"
41
- {...rest}
31
+ class={selectTrigger({ class: className })}
32
+ type="button"
33
+ role="combobox"
34
+ aria-label="Select field"
35
+ aria-controls=""
36
+ aria-expanded="false"
37
+ aria-haspopup="listbox"
38
+ aria-autocomplete="none"
39
+ aria-required={required ? "true" : "false"}
40
+ data-state="closed"
41
+ {...rest}
42
42
  >
43
- <slot />
44
- <ChevronDown class="size-4 opacity-50" />
43
+ <slot />
44
+ <ChevronDown class="size-4 opacity-50" />
45
45
  </button>
@@ -1,7 +1,13 @@
1
1
  export interface SelectChangeEvent extends CustomEvent {
2
- detail: {
3
- value: string;
4
- selectId: string;
5
- label: string;
6
- };
2
+ detail: {
3
+ value: string;
4
+ selectId: string;
5
+ label: string;
6
+ };
7
+ }
8
+
9
+ export interface SelectEvent extends CustomEvent {
10
+ detail:
11
+ | { value: string; selectId: string; selectName?: string }
12
+ | { value: string; selectId?: string; selectName: string };
7
13
  }
@@ -3,10 +3,10 @@ import type { HTMLAttributes } from "astro/types";
3
3
  import { tv } from "tailwind-variants";
4
4
 
5
5
  type Props = HTMLAttributes<"span"> & {
6
- /**
7
- * The text to display when no value is selected
8
- */
9
- placeholder?: string;
6
+ /**
7
+ * The text to display when no value is selected
8
+ */
9
+ placeholder?: string;
10
10
  };
11
11
 
12
12
  const selectValue = tv({ base: "pointer-events-none" });
@@ -15,5 +15,5 @@ const { placeholder = "select", class: className, ...rest } = Astro.props;
15
15
  ---
16
16
 
17
17
  <span class={selectValue({ class: className })} {...rest}>
18
- {placeholder}
18
+ {placeholder}
19
19
  </span>
@@ -8,23 +8,23 @@ import SelectTrigger from "./SelectTrigger.astro";
8
8
  import SelectValue from "./SelectValue.astro";
9
9
 
10
10
  export {
11
- Select,
12
- SelectTrigger,
13
- SelectValue,
14
- SelectContent,
15
- SelectGroup,
16
- SelectLabel,
17
- SelectItem,
18
- SelectSeparator,
11
+ Select,
12
+ SelectContent,
13
+ SelectGroup,
14
+ SelectItem,
15
+ SelectLabel,
16
+ SelectSeparator,
17
+ SelectTrigger,
18
+ SelectValue,
19
19
  };
20
20
 
21
21
  export default {
22
- Root: Select,
23
- Trigger: SelectTrigger,
24
- Value: SelectValue,
25
- Content: SelectContent,
26
- Group: SelectGroup,
27
- Label: SelectLabel,
28
- Item: SelectItem,
29
- Separator: SelectSeparator,
22
+ Root: Select,
23
+ Trigger: SelectTrigger,
24
+ Value: SelectValue,
25
+ Content: SelectContent,
26
+ Group: SelectGroup,
27
+ Label: SelectLabel,
28
+ Item: SelectItem,
29
+ Separator: SelectSeparator,
30
30
  };
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ type Props = HTMLAttributes<"div">;
6
+
7
+ const { class: className, ...rest } = Astro.props;
8
+
9
+ const skeleton = tv({
10
+ base: "bg-accent animate-pulse rounded-md",
11
+ });
12
+ ---
13
+
14
+ <div class={skeleton({ class: className })} {...rest}></div>
@@ -0,0 +1,5 @@
1
+ import Skeleton from "./Skeleton.astro";
2
+
3
+ export { Skeleton };
4
+
5
+ export default Skeleton;