@starwind-ui/core 1.11.2 → 1.12.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 (158) hide show
  1. package/package.json +1 -1
  2. package/dist/index.d.ts +0 -28
  3. package/dist/index.js +0 -74
  4. package/dist/index.js.map +0 -1
  5. package/dist/src/components/accordion/Accordion.astro +0 -247
  6. package/dist/src/components/accordion/AccordionContent.astro +0 -33
  7. package/dist/src/components/accordion/AccordionItem.astro +0 -27
  8. package/dist/src/components/accordion/AccordionTrigger.astro +0 -32
  9. package/dist/src/components/accordion/index.ts +0 -15
  10. package/dist/src/components/alert/Alert.astro +0 -31
  11. package/dist/src/components/alert/AlertDescription.astro +0 -14
  12. package/dist/src/components/alert/AlertTitle.astro +0 -16
  13. package/dist/src/components/alert/index.ts +0 -13
  14. package/dist/src/components/alert-dialog/AlertDialog.astro +0 -273
  15. package/dist/src/components/alert-dialog/AlertDialogAction.astro +0 -44
  16. package/dist/src/components/alert-dialog/AlertDialogCancel.astro +0 -45
  17. package/dist/src/components/alert-dialog/AlertDialogContent.astro +0 -52
  18. package/dist/src/components/alert-dialog/AlertDialogDescription.astro +0 -18
  19. package/dist/src/components/alert-dialog/AlertDialogFooter.astro +0 -16
  20. package/dist/src/components/alert-dialog/AlertDialogHeader.astro +0 -14
  21. package/dist/src/components/alert-dialog/AlertDialogTitle.astro +0 -20
  22. package/dist/src/components/alert-dialog/AlertDialogTrigger.astro +0 -47
  23. package/dist/src/components/alert-dialog/index.ts +0 -46
  24. package/dist/src/components/aspect-ratio/AspectRatio.astro +0 -32
  25. package/dist/src/components/aspect-ratio/index.ts +0 -7
  26. package/dist/src/components/avatar/Avatar.astro +0 -29
  27. package/dist/src/components/avatar/AvatarFallback.astro +0 -18
  28. package/dist/src/components/avatar/AvatarImage.astro +0 -49
  29. package/dist/src/components/avatar/index.ts +0 -13
  30. package/dist/src/components/badge/Badge.astro +0 -51
  31. package/dist/src/components/badge/index.ts +0 -7
  32. package/dist/src/components/breadcrumb/Breadcrumb.astro +0 -11
  33. package/dist/src/components/breadcrumb/BreadcrumbEllipsis.astro +0 -28
  34. package/dist/src/components/breadcrumb/BreadcrumbItem.astro +0 -14
  35. package/dist/src/components/breadcrumb/BreadcrumbLink.astro +0 -22
  36. package/dist/src/components/breadcrumb/BreadcrumbList.astro +0 -16
  37. package/dist/src/components/breadcrumb/BreadcrumbPage.astro +0 -21
  38. package/dist/src/components/breadcrumb/BreadcrumbSeparator.astro +0 -23
  39. package/dist/src/components/breadcrumb/index.ts +0 -37
  40. package/dist/src/components/button/Button.astro +0 -53
  41. package/dist/src/components/button/index.ts +0 -7
  42. package/dist/src/components/card/Card.astro +0 -14
  43. package/dist/src/components/card/CardContent.astro +0 -14
  44. package/dist/src/components/card/CardDescription.astro +0 -14
  45. package/dist/src/components/card/CardFooter.astro +0 -14
  46. package/dist/src/components/card/CardHeader.astro +0 -14
  47. package/dist/src/components/card/CardTitle.astro +0 -14
  48. package/dist/src/components/card/index.ts +0 -26
  49. package/dist/src/components/carousel/Carousel.astro +0 -55
  50. package/dist/src/components/carousel/CarouselContent.astro +0 -26
  51. package/dist/src/components/carousel/CarouselItem.astro +0 -26
  52. package/dist/src/components/carousel/CarouselNext.astro +0 -37
  53. package/dist/src/components/carousel/CarouselPrevious.astro +0 -37
  54. package/dist/src/components/carousel/carousel-script.ts +0 -191
  55. package/dist/src/components/carousel/index.ts +0 -32
  56. package/dist/src/components/checkbox/Checkbox.astro +0 -127
  57. package/dist/src/components/checkbox/index.ts +0 -7
  58. package/dist/src/components/dialog/Dialog.astro +0 -263
  59. package/dist/src/components/dialog/DialogClose.astro +0 -35
  60. package/dist/src/components/dialog/DialogContent.astro +0 -67
  61. package/dist/src/components/dialog/DialogDescription.astro +0 -14
  62. package/dist/src/components/dialog/DialogFooter.astro +0 -14
  63. package/dist/src/components/dialog/DialogHeader.astro +0 -14
  64. package/dist/src/components/dialog/DialogTitle.astro +0 -20
  65. package/dist/src/components/dialog/DialogTrigger.astro +0 -47
  66. package/dist/src/components/dialog/index.ts +0 -45
  67. package/dist/src/components/dropdown/Dropdown.astro +0 -375
  68. package/dist/src/components/dropdown/DropdownContent.astro +0 -81
  69. package/dist/src/components/dropdown/DropdownItem.astro +0 -48
  70. package/dist/src/components/dropdown/DropdownLabel.astro +0 -29
  71. package/dist/src/components/dropdown/DropdownSeparator.astro +0 -21
  72. package/dist/src/components/dropdown/DropdownTrigger.astro +0 -52
  73. package/dist/src/components/dropdown/index.ts +0 -33
  74. package/dist/src/components/dropzone/Dropzone.astro +0 -233
  75. package/dist/src/components/dropzone/DropzoneFilesList.astro +0 -26
  76. package/dist/src/components/dropzone/DropzoneLoadingIndicator.astro +0 -10
  77. package/dist/src/components/dropzone/DropzoneUploadIndicator.astro +0 -10
  78. package/dist/src/components/dropzone/index.ts +0 -24
  79. package/dist/src/components/input/Input.astro +0 -24
  80. package/dist/src/components/input/index.ts +0 -7
  81. package/dist/src/components/item/Item.astro +0 -52
  82. package/dist/src/components/item/ItemActions.astro +0 -16
  83. package/dist/src/components/item/ItemContent.astro +0 -16
  84. package/dist/src/components/item/ItemDescription.astro +0 -19
  85. package/dist/src/components/item/ItemFooter.astro +0 -16
  86. package/dist/src/components/item/ItemGroup.astro +0 -16
  87. package/dist/src/components/item/ItemHeader.astro +0 -16
  88. package/dist/src/components/item/ItemMedia.astro +0 -40
  89. package/dist/src/components/item/ItemSeparator.astro +0 -21
  90. package/dist/src/components/item/ItemTitle.astro +0 -16
  91. package/dist/src/components/item/index.ts +0 -50
  92. package/dist/src/components/kbd/Kbd.astro +0 -21
  93. package/dist/src/components/kbd/KbdGroup.astro +0 -16
  94. package/dist/src/components/kbd/index.ts +0 -11
  95. package/dist/src/components/label/Label.astro +0 -22
  96. package/dist/src/components/label/index.ts +0 -7
  97. package/dist/src/components/pagination/Pagination.astro +0 -20
  98. package/dist/src/components/pagination/PaginationContent.astro +0 -16
  99. package/dist/src/components/pagination/PaginationEllipsis.astro +0 -25
  100. package/dist/src/components/pagination/PaginationItem.astro +0 -16
  101. package/dist/src/components/pagination/PaginationLink.astro +0 -24
  102. package/dist/src/components/pagination/PaginationNext.astro +0 -26
  103. package/dist/src/components/pagination/PaginationPrevious.astro +0 -26
  104. package/dist/src/components/pagination/index.ts +0 -38
  105. package/dist/src/components/progress/Progress.astro +0 -154
  106. package/dist/src/components/progress/index.ts +0 -10
  107. package/dist/src/components/radio-group/RadioGroup.astro +0 -157
  108. package/dist/src/components/radio-group/RadioGroupItem.astro +0 -129
  109. package/dist/src/components/radio-group/RadioGroupTypes.ts +0 -6
  110. package/dist/src/components/radio-group/index.ts +0 -23
  111. package/dist/src/components/select/Select.astro +0 -534
  112. package/dist/src/components/select/SelectContent.astro +0 -83
  113. package/dist/src/components/select/SelectGroup.astro +0 -9
  114. package/dist/src/components/select/SelectItem.astro +0 -49
  115. package/dist/src/components/select/SelectLabel.astro +0 -14
  116. package/dist/src/components/select/SelectSeparator.astro +0 -12
  117. package/dist/src/components/select/SelectTrigger.astro +0 -48
  118. package/dist/src/components/select/SelectTypes.ts +0 -13
  119. package/dist/src/components/select/SelectValue.astro +0 -19
  120. package/dist/src/components/select/index.ts +0 -45
  121. package/dist/src/components/separator/Separator.astro +0 -36
  122. package/dist/src/components/separator/index.ts +0 -7
  123. package/dist/src/components/sheet/Sheet.astro +0 -13
  124. package/dist/src/components/sheet/SheetClose.astro +0 -13
  125. package/dist/src/components/sheet/SheetContent.astro +0 -92
  126. package/dist/src/components/sheet/SheetDescription.astro +0 -16
  127. package/dist/src/components/sheet/SheetFooter.astro +0 -16
  128. package/dist/src/components/sheet/SheetHeader.astro +0 -16
  129. package/dist/src/components/sheet/SheetTitle.astro +0 -16
  130. package/dist/src/components/sheet/SheetTrigger.astro +0 -13
  131. package/dist/src/components/sheet/index.ts +0 -41
  132. package/dist/src/components/skeleton/Skeleton.astro +0 -14
  133. package/dist/src/components/skeleton/index.ts +0 -9
  134. package/dist/src/components/spinner/Spinner.astro +0 -21
  135. package/dist/src/components/spinner/index.ts +0 -7
  136. package/dist/src/components/switch/Switch.astro +0 -191
  137. package/dist/src/components/switch/SwitchTypes.ts +0 -6
  138. package/dist/src/components/switch/index.ts +0 -12
  139. package/dist/src/components/table/Table.astro +0 -18
  140. package/dist/src/components/table/TableBody.astro +0 -16
  141. package/dist/src/components/table/TableCaption.astro +0 -16
  142. package/dist/src/components/table/TableCell.astro +0 -16
  143. package/dist/src/components/table/TableFoot.astro +0 -16
  144. package/dist/src/components/table/TableHead.astro +0 -16
  145. package/dist/src/components/table/TableHeader.astro +0 -16
  146. package/dist/src/components/table/TableRow.astro +0 -16
  147. package/dist/src/components/table/index.ts +0 -42
  148. package/dist/src/components/tabs/Tabs.astro +0 -269
  149. package/dist/src/components/tabs/TabsContent.astro +0 -28
  150. package/dist/src/components/tabs/TabsList.astro +0 -22
  151. package/dist/src/components/tabs/TabsTrigger.astro +0 -34
  152. package/dist/src/components/tabs/index.ts +0 -20
  153. package/dist/src/components/textarea/Textarea.astro +0 -28
  154. package/dist/src/components/textarea/index.ts +0 -9
  155. package/dist/src/components/tooltip/Tooltip.astro +0 -237
  156. package/dist/src/components/tooltip/TooltipContent.astro +0 -114
  157. package/dist/src/components/tooltip/TooltipTrigger.astro +0 -10
  158. package/dist/src/components/tooltip/index.ts +0 -16
@@ -1,157 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- type Props = HTMLAttributes<"fieldset"> & {
6
- /**
7
- * Value for the radio group
8
- */
9
- value?: string;
10
- /**
11
- * Default value for the radio group
12
- */
13
- defaultValue?: string;
14
- /**
15
- * Legend for the radio group
16
- */
17
- legend?: string;
18
- /**
19
- * Whether the radio group is disabled
20
- */
21
- disabled?: boolean;
22
- /**
23
- * Orientation of the radio group
24
- */
25
- orientation?: "horizontal" | "vertical";
26
- };
27
-
28
- export const radioGroup = tv({
29
- base: "starwind-radio-group disabled:cursor-not-allowed disabled:opacity-70",
30
- variants: {
31
- orientation: {
32
- vertical: "grid gap-3",
33
- horizontal: "flex flex-row items-center gap-3",
34
- },
35
- },
36
- defaultVariants: {
37
- orientation: "vertical",
38
- },
39
- });
40
-
41
- const {
42
- class: className,
43
- value,
44
- defaultValue,
45
- legend,
46
- disabled = false,
47
- orientation = "vertical",
48
- ...rest
49
- } = Astro.props;
50
- ---
51
-
52
- <fieldset
53
- class:list={[radioGroup({ orientation, class: className })]}
54
- data-value={value || defaultValue}
55
- disabled={disabled}
56
- data-slot="radio-group"
57
- {...rest}
58
- >
59
- {legend && <legend class="sr-only">{legend}</legend>}
60
- <slot />
61
- </fieldset>
62
-
63
- <script>
64
- import type { RadioGroupChangeEvent } from "./RadioGroupTypes";
65
-
66
- class RadioGroupHandler {
67
- private radioGroup: HTMLFieldSetElement;
68
- private radioInputs: NodeListOf<HTMLInputElement> | undefined;
69
- private radioGroupId: string | undefined;
70
-
71
- constructor(radioGroup: HTMLFieldSetElement, idx: number) {
72
- this.radioGroup = radioGroup;
73
- this.radioGroupId = radioGroup.id || `starwind-radio-group-${idx}`;
74
- this.radioInputs = radioGroup.querySelectorAll<HTMLInputElement>('input[type="radio"]');
75
- this.init();
76
- }
77
-
78
- private init() {
79
- // Initialize checked state based on data-value
80
- this.syncWithDataValue();
81
-
82
- // Setup event listeners
83
- this.setupEvents();
84
- }
85
-
86
- private syncWithDataValue() {
87
- const initialValue = this.radioGroup.dataset.value;
88
- if (!initialValue || !this.radioInputs) return;
89
-
90
- // Find the radio input with the matching value and check it
91
- this.radioInputs.forEach((input) => {
92
- if (input.value === initialValue) {
93
- input.checked = true;
94
- } else {
95
- input.checked = false;
96
- }
97
- });
98
- }
99
-
100
- private setupEvents() {
101
- // Listen for changes to update the fieldset's data-value attribute
102
- this.radioGroup.addEventListener("change", this.handleChange.bind(this));
103
- }
104
-
105
- private handleChange(e: Event) {
106
- const target = e.target as HTMLInputElement;
107
- // console.log("target", target);
108
- if (target.type !== "radio") return;
109
-
110
- // Update the data-value attribute
111
- this.radioGroup.dataset.value = target.value;
112
-
113
- // Ensure all other radio buttons in the group are unchecked
114
- if (this.radioInputs) {
115
- this.radioInputs.forEach((radio) => {
116
- if (radio !== target) {
117
- radio.checked = false;
118
- }
119
- });
120
- }
121
-
122
- // Explicitly mark the clicked radio as checked
123
- target.checked = true;
124
-
125
- // Dispatch custom event for external listeners
126
- this.dispatchChangeEvent(target.value);
127
- }
128
-
129
- private dispatchChangeEvent(value: string) {
130
- const event = new CustomEvent<RadioGroupChangeEvent["detail"]>("starwind:value-change", {
131
- bubbles: true,
132
- detail: {
133
- value: value,
134
- radioGroupId: this.radioGroupId,
135
- },
136
- });
137
- this.radioGroup.dispatchEvent(event);
138
- }
139
- }
140
-
141
- // Store instances in a WeakMap to avoid memory leaks
142
- const radioGroupInstances = new WeakMap<HTMLElement, RadioGroupHandler>();
143
-
144
- const setupRadioGroups = () => {
145
- document
146
- .querySelectorAll<HTMLFieldSetElement>(".starwind-radio-group")
147
- .forEach((radioGroup, idx) => {
148
- if (!radioGroupInstances.has(radioGroup)) {
149
- radioGroupInstances.set(radioGroup, new RadioGroupHandler(radioGroup, idx));
150
- }
151
- });
152
- };
153
-
154
- // Initialize on page load and after Astro view transitions
155
- setupRadioGroups();
156
- document.addEventListener("astro:after-swap", setupRadioGroups);
157
- </script>
@@ -1,129 +0,0 @@
1
- ---
2
- import CircleFilled from "@tabler/icons/filled/circle.svg";
3
- import type { HTMLAttributes } from "astro/types";
4
- import { tv, type VariantProps } from "tailwind-variants";
5
-
6
- type Props = HTMLAttributes<"input"> &
7
- VariantProps<typeof radioWrapper> &
8
- VariantProps<typeof radioControl> & {
9
- /**
10
- * Value of the radio item
11
- */
12
- value: string;
13
- /**
14
- * Whether the radio is disabled
15
- */
16
- disabled?: boolean;
17
- /**
18
- * Optional ID for the radio item
19
- */
20
- id?: string;
21
- /**
22
- * Name to group radio inputs
23
- */
24
- name?: string;
25
- /**
26
- * Whether the radio is checked (only for initial state)
27
- */
28
- checked?: boolean;
29
- };
30
-
31
- export const radioWrapper = tv({
32
- base: "relative isolate flex shrink-0",
33
- variants: {
34
- size: {
35
- sm: "size-4",
36
- md: "size-5",
37
- lg: "size-6",
38
- },
39
- },
40
- defaultVariants: {
41
- size: "md",
42
- },
43
- });
44
-
45
- export const radioItem = tv({
46
- base: [
47
- "starwind-radio-item peer z-10 h-full w-full",
48
- "absolute inset-0 cursor-pointer opacity-0 outline-none focus:outline-none focus-visible:outline-none",
49
- "disabled:cursor-not-allowed",
50
- ],
51
- });
52
-
53
- export const radioControl = tv({
54
- base: [
55
- "starwind-radio-control",
56
- "border-input bg-background dark:bg-input/30",
57
- "peer-focus-visible:outline-2 peer-focus-visible:outline-offset-1 peer-focus-visible:transition-none",
58
- "outline-none peer-focus-visible:ring-3",
59
- "absolute inset-0 rounded-full border shadow-xs",
60
- "transition-all peer-checked:[&>svg]:opacity-100",
61
- "peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
62
- "flex items-center justify-center",
63
- ],
64
- variants: {
65
- variant: {
66
- default:
67
- "peer-checked:border-foreground [&>svg]:fill-foreground peer-focus-visible:ring-outline/50",
68
- primary:
69
- "peer-checked:border-primary [&>svg]:fill-primary peer-focus-visible:ring-primary/50",
70
- secondary:
71
- "peer-checked:border-secondary [&>svg]:fill-secondary peer-focus-visible:ring-secondary/50",
72
- info: "peer-checked:border-info [&>svg]:fill-info peer-focus-visible:ring-info/50",
73
- success:
74
- "peer-checked:border-success [&>svg]:fill-success peer-focus-visible:ring-success/50",
75
- warning:
76
- "peer-checked:border-warning [&>svg]:fill-warning peer-focus-visible:ring-warning/50",
77
- error: "peer-checked:border-error [&>svg]:fill-error peer-focus-visible:ring-error/50",
78
- },
79
- },
80
- defaultVariants: {
81
- variant: "primary",
82
- },
83
- });
84
-
85
- export const radioIndicator = tv({
86
- base: ["starwind-radio-indicator", "opacity-0 transition-opacity"],
87
- variants: {
88
- size: {
89
- sm: "size-2",
90
- md: "size-3",
91
- lg: "size-4",
92
- },
93
- },
94
- defaultVariants: {
95
- size: "md",
96
- },
97
- });
98
-
99
- const {
100
- value,
101
- name,
102
- disabled = false,
103
- checked = false,
104
- id,
105
- class: className,
106
- size = "md",
107
- variant = "default",
108
- ...rest
109
- } = Astro.props;
110
- ---
111
-
112
- <div class={radioWrapper({ size })} data-slot="radio-group-item-wrapper">
113
- <input
114
- type="radio"
115
- class={radioItem()}
116
- name={name}
117
- id={id}
118
- value={value}
119
- checked={checked}
120
- disabled={disabled}
121
- data-slot="radio-group-item"
122
- {...rest}
123
- />
124
- <span class={radioControl({ variant, class: className })} data-slot="radio-group-item-control">
125
- <slot name="icon">
126
- <CircleFilled class={radioIndicator({ size })} />
127
- </slot>
128
- </span>
129
- </div>
@@ -1,6 +0,0 @@
1
- export interface RadioGroupChangeEvent extends CustomEvent {
2
- detail: {
3
- value: string;
4
- radioGroupId?: string;
5
- };
6
- }
@@ -1,23 +0,0 @@
1
- import RadioGroup, { radioGroup } from "./RadioGroup.astro";
2
- import RadioGroupItem, {
3
- radioControl,
4
- radioIndicator,
5
- radioItem,
6
- radioWrapper,
7
- } from "./RadioGroupItem.astro";
8
- import type { RadioGroupChangeEvent } from "./RadioGroupTypes";
9
-
10
- const RadioGroupVariants = {
11
- radioGroup,
12
- radioWrapper,
13
- radioItem,
14
- radioControl,
15
- radioIndicator,
16
- };
17
-
18
- export { RadioGroup, type RadioGroupChangeEvent, RadioGroupItem, RadioGroupVariants };
19
-
20
- export default {
21
- Root: RadioGroup,
22
- Item: RadioGroupItem,
23
- };