@starwind-ui/core 1.15.0 → 1.15.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.
- package/package.json +1 -1
- package/dist/index.d.ts +0 -28
- package/dist/index.js +0 -108
- package/dist/index.js.map +0 -1
- package/dist/src/components/accordion/Accordion.astro +0 -254
- package/dist/src/components/accordion/AccordionContent.astro +0 -33
- package/dist/src/components/accordion/AccordionItem.astro +0 -27
- package/dist/src/components/accordion/AccordionTrigger.astro +0 -32
- package/dist/src/components/accordion/index.ts +0 -15
- package/dist/src/components/alert/Alert.astro +0 -31
- package/dist/src/components/alert/AlertDescription.astro +0 -14
- package/dist/src/components/alert/AlertTitle.astro +0 -16
- package/dist/src/components/alert/index.ts +0 -13
- package/dist/src/components/alert-dialog/AlertDialog.astro +0 -275
- package/dist/src/components/alert-dialog/AlertDialogAction.astro +0 -44
- package/dist/src/components/alert-dialog/AlertDialogCancel.astro +0 -45
- package/dist/src/components/alert-dialog/AlertDialogContent.astro +0 -52
- package/dist/src/components/alert-dialog/AlertDialogDescription.astro +0 -18
- package/dist/src/components/alert-dialog/AlertDialogFooter.astro +0 -16
- package/dist/src/components/alert-dialog/AlertDialogHeader.astro +0 -14
- package/dist/src/components/alert-dialog/AlertDialogTitle.astro +0 -20
- package/dist/src/components/alert-dialog/AlertDialogTrigger.astro +0 -47
- package/dist/src/components/alert-dialog/index.ts +0 -46
- package/dist/src/components/aspect-ratio/AspectRatio.astro +0 -32
- package/dist/src/components/aspect-ratio/index.ts +0 -7
- package/dist/src/components/avatar/Avatar.astro +0 -29
- package/dist/src/components/avatar/AvatarFallback.astro +0 -18
- package/dist/src/components/avatar/AvatarImage.astro +0 -49
- package/dist/src/components/avatar/index.ts +0 -13
- package/dist/src/components/badge/Badge.astro +0 -55
- package/dist/src/components/badge/index.ts +0 -7
- package/dist/src/components/breadcrumb/Breadcrumb.astro +0 -11
- package/dist/src/components/breadcrumb/BreadcrumbEllipsis.astro +0 -28
- package/dist/src/components/breadcrumb/BreadcrumbItem.astro +0 -14
- package/dist/src/components/breadcrumb/BreadcrumbLink.astro +0 -22
- package/dist/src/components/breadcrumb/BreadcrumbList.astro +0 -16
- package/dist/src/components/breadcrumb/BreadcrumbPage.astro +0 -21
- package/dist/src/components/breadcrumb/BreadcrumbSeparator.astro +0 -23
- package/dist/src/components/breadcrumb/index.ts +0 -37
- package/dist/src/components/button/Button.astro +0 -55
- package/dist/src/components/button/index.ts +0 -7
- package/dist/src/components/button-group/ButtonGroup.astro +0 -62
- package/dist/src/components/button-group/ButtonGroupSeparator.astro +0 -27
- package/dist/src/components/button-group/ButtonGroupText.astro +0 -19
- package/dist/src/components/button-group/index.ts +0 -17
- package/dist/src/components/card/Card.astro +0 -14
- package/dist/src/components/card/CardContent.astro +0 -14
- package/dist/src/components/card/CardDescription.astro +0 -14
- package/dist/src/components/card/CardFooter.astro +0 -14
- package/dist/src/components/card/CardHeader.astro +0 -14
- package/dist/src/components/card/CardTitle.astro +0 -14
- package/dist/src/components/card/index.ts +0 -26
- package/dist/src/components/carousel/Carousel.astro +0 -55
- package/dist/src/components/carousel/CarouselContent.astro +0 -26
- package/dist/src/components/carousel/CarouselItem.astro +0 -26
- package/dist/src/components/carousel/CarouselNext.astro +0 -37
- package/dist/src/components/carousel/CarouselPrevious.astro +0 -37
- package/dist/src/components/carousel/carousel-script.ts +0 -191
- package/dist/src/components/carousel/index.ts +0 -32
- package/dist/src/components/checkbox/Checkbox.astro +0 -128
- package/dist/src/components/checkbox/index.ts +0 -7
- package/dist/src/components/collapsible/Collapsible.astro +0 -161
- package/dist/src/components/collapsible/CollapsibleContent.astro +0 -22
- package/dist/src/components/collapsible/CollapsibleTrigger.astro +0 -44
- package/dist/src/components/collapsible/index.ts +0 -13
- package/dist/src/components/dialog/Dialog.astro +0 -389
- package/dist/src/components/dialog/DialogClose.astro +0 -35
- package/dist/src/components/dialog/DialogContent.astro +0 -78
- package/dist/src/components/dialog/DialogDescription.astro +0 -14
- package/dist/src/components/dialog/DialogFooter.astro +0 -14
- package/dist/src/components/dialog/DialogHeader.astro +0 -14
- package/dist/src/components/dialog/DialogTitle.astro +0 -22
- package/dist/src/components/dialog/DialogTrigger.astro +0 -47
- package/dist/src/components/dialog/index.ts +0 -45
- package/dist/src/components/dropdown/Dropdown.astro +0 -377
- package/dist/src/components/dropdown/DropdownContent.astro +0 -81
- package/dist/src/components/dropdown/DropdownItem.astro +0 -48
- package/dist/src/components/dropdown/DropdownLabel.astro +0 -29
- package/dist/src/components/dropdown/DropdownSeparator.astro +0 -21
- package/dist/src/components/dropdown/DropdownTrigger.astro +0 -52
- package/dist/src/components/dropdown/index.ts +0 -33
- package/dist/src/components/dropzone/Dropzone.astro +0 -236
- package/dist/src/components/dropzone/DropzoneFilesList.astro +0 -26
- package/dist/src/components/dropzone/DropzoneLoadingIndicator.astro +0 -10
- package/dist/src/components/dropzone/DropzoneUploadIndicator.astro +0 -10
- package/dist/src/components/dropzone/index.ts +0 -24
- package/dist/src/components/image/Image.astro +0 -24
- package/dist/src/components/image/index.ts +0 -9
- package/dist/src/components/input/Input.astro +0 -25
- package/dist/src/components/input/index.ts +0 -7
- package/dist/src/components/input-otp/InputOtp.astro +0 -319
- package/dist/src/components/input-otp/InputOtpGroup.astro +0 -16
- package/dist/src/components/input-otp/InputOtpSeparator.astro +0 -25
- package/dist/src/components/input-otp/InputOtpSlot.astro +0 -48
- package/dist/src/components/input-otp/InputOtpTypes.ts +0 -6
- package/dist/src/components/input-otp/index.ts +0 -33
- package/dist/src/components/item/Item.astro +0 -52
- package/dist/src/components/item/ItemActions.astro +0 -16
- package/dist/src/components/item/ItemContent.astro +0 -16
- package/dist/src/components/item/ItemDescription.astro +0 -19
- package/dist/src/components/item/ItemFooter.astro +0 -16
- package/dist/src/components/item/ItemGroup.astro +0 -16
- package/dist/src/components/item/ItemHeader.astro +0 -16
- package/dist/src/components/item/ItemMedia.astro +0 -40
- package/dist/src/components/item/ItemSeparator.astro +0 -21
- package/dist/src/components/item/ItemTitle.astro +0 -16
- package/dist/src/components/item/index.ts +0 -50
- package/dist/src/components/kbd/Kbd.astro +0 -21
- package/dist/src/components/kbd/KbdGroup.astro +0 -16
- package/dist/src/components/kbd/index.ts +0 -11
- package/dist/src/components/label/Label.astro +0 -22
- package/dist/src/components/label/index.ts +0 -7
- package/dist/src/components/pagination/Pagination.astro +0 -20
- package/dist/src/components/pagination/PaginationContent.astro +0 -16
- package/dist/src/components/pagination/PaginationEllipsis.astro +0 -35
- package/dist/src/components/pagination/PaginationItem.astro +0 -16
- package/dist/src/components/pagination/PaginationLink.astro +0 -24
- package/dist/src/components/pagination/PaginationNext.astro +0 -30
- package/dist/src/components/pagination/PaginationPrevious.astro +0 -30
- package/dist/src/components/pagination/index.ts +0 -38
- package/dist/src/components/progress/Progress.astro +0 -155
- package/dist/src/components/progress/index.ts +0 -10
- package/dist/src/components/prose/Prose.astro +0 -617
- package/dist/src/components/prose/index.ts +0 -9
- package/dist/src/components/radio-group/RadioGroup.astro +0 -162
- package/dist/src/components/radio-group/RadioGroupItem.astro +0 -129
- package/dist/src/components/radio-group/RadioGroupTypes.ts +0 -6
- package/dist/src/components/radio-group/index.ts +0 -23
- package/dist/src/components/select/Select.astro +0 -751
- package/dist/src/components/select/SelectContent.astro +0 -94
- package/dist/src/components/select/SelectGroup.astro +0 -9
- package/dist/src/components/select/SelectItem.astro +0 -51
- package/dist/src/components/select/SelectLabel.astro +0 -14
- package/dist/src/components/select/SelectSearch.astro +0 -49
- package/dist/src/components/select/SelectSeparator.astro +0 -12
- package/dist/src/components/select/SelectTrigger.astro +0 -54
- package/dist/src/components/select/SelectTypes.ts +0 -13
- package/dist/src/components/select/SelectValue.astro +0 -19
- package/dist/src/components/select/index.ts +0 -49
- package/dist/src/components/separator/Separator.astro +0 -36
- package/dist/src/components/separator/index.ts +0 -7
- package/dist/src/components/sheet/Sheet.astro +0 -13
- package/dist/src/components/sheet/SheetClose.astro +0 -13
- package/dist/src/components/sheet/SheetContent.astro +0 -92
- package/dist/src/components/sheet/SheetDescription.astro +0 -16
- package/dist/src/components/sheet/SheetFooter.astro +0 -16
- package/dist/src/components/sheet/SheetHeader.astro +0 -16
- package/dist/src/components/sheet/SheetTitle.astro +0 -16
- package/dist/src/components/sheet/SheetTrigger.astro +0 -13
- package/dist/src/components/sheet/index.ts +0 -41
- package/dist/src/components/sidebar/Sidebar.astro +0 -213
- package/dist/src/components/sidebar/SidebarContent.astro +0 -24
- package/dist/src/components/sidebar/SidebarFooter.astro +0 -21
- package/dist/src/components/sidebar/SidebarGroup.astro +0 -21
- package/dist/src/components/sidebar/SidebarGroupContent.astro +0 -21
- package/dist/src/components/sidebar/SidebarGroupLabel.astro +0 -52
- package/dist/src/components/sidebar/SidebarHeader.astro +0 -21
- package/dist/src/components/sidebar/SidebarInput.astro +0 -22
- package/dist/src/components/sidebar/SidebarInset.astro +0 -21
- package/dist/src/components/sidebar/SidebarMenu.astro +0 -21
- package/dist/src/components/sidebar/SidebarMenuAction.astro +0 -59
- package/dist/src/components/sidebar/SidebarMenuBadge.astro +0 -30
- package/dist/src/components/sidebar/SidebarMenuButton.astro +0 -129
- package/dist/src/components/sidebar/SidebarMenuItem.astro +0 -21
- package/dist/src/components/sidebar/SidebarMenuSkeleton.astro +0 -40
- package/dist/src/components/sidebar/SidebarMenuSub.astro +0 -24
- package/dist/src/components/sidebar/SidebarMenuSubButton.astro +0 -49
- package/dist/src/components/sidebar/SidebarMenuSubItem.astro +0 -16
- package/dist/src/components/sidebar/SidebarProvider.astro +0 -213
- package/dist/src/components/sidebar/SidebarRail.astro +0 -71
- package/dist/src/components/sidebar/SidebarSeparator.astro +0 -22
- package/dist/src/components/sidebar/SidebarTrigger.astro +0 -66
- package/dist/src/components/sidebar/index.ts +0 -103
- package/dist/src/components/skeleton/Skeleton.astro +0 -14
- package/dist/src/components/skeleton/index.ts +0 -9
- package/dist/src/components/slider/Slider.astro +0 -411
- package/dist/src/components/slider/index.ts +0 -9
- package/dist/src/components/spinner/Spinner.astro +0 -21
- package/dist/src/components/spinner/index.ts +0 -7
- package/dist/src/components/switch/Switch.astro +0 -192
- package/dist/src/components/switch/SwitchTypes.ts +0 -6
- package/dist/src/components/switch/index.ts +0 -12
- package/dist/src/components/table/Table.astro +0 -18
- package/dist/src/components/table/TableBody.astro +0 -16
- package/dist/src/components/table/TableCaption.astro +0 -16
- package/dist/src/components/table/TableCell.astro +0 -16
- package/dist/src/components/table/TableFoot.astro +0 -16
- package/dist/src/components/table/TableHead.astro +0 -16
- package/dist/src/components/table/TableHeader.astro +0 -16
- package/dist/src/components/table/TableRow.astro +0 -16
- package/dist/src/components/table/index.ts +0 -42
- package/dist/src/components/tabs/Tabs.astro +0 -271
- package/dist/src/components/tabs/TabsContent.astro +0 -28
- package/dist/src/components/tabs/TabsList.astro +0 -22
- package/dist/src/components/tabs/TabsTrigger.astro +0 -34
- package/dist/src/components/tabs/index.ts +0 -20
- package/dist/src/components/textarea/Textarea.astro +0 -29
- package/dist/src/components/textarea/index.ts +0 -9
- package/dist/src/components/theme-toggle/ThemeToggle.astro +0 -208
- package/dist/src/components/theme-toggle/index.ts +0 -7
- package/dist/src/components/toast/ToastDescription.astro +0 -21
- package/dist/src/components/toast/ToastItem.astro +0 -54
- package/dist/src/components/toast/ToastTemplate.astro +0 -25
- package/dist/src/components/toast/ToastTitle.astro +0 -57
- package/dist/src/components/toast/Toaster.astro +0 -982
- package/dist/src/components/toast/index.ts +0 -29
- package/dist/src/components/toast/toast-manager.ts +0 -216
- package/dist/src/components/toggle/Toggle.astro +0 -174
- package/dist/src/components/toggle/ToggleTypes.ts +0 -14
- package/dist/src/components/toggle/index.ts +0 -8
- package/dist/src/components/tooltip/Tooltip.astro +0 -282
- package/dist/src/components/tooltip/TooltipContent.astro +0 -89
- package/dist/src/components/tooltip/TooltipTrigger.astro +0 -10
- package/dist/src/components/tooltip/index.ts +0 -16
- package/dist/src/components/video/Video.astro +0 -120
- package/dist/src/components/video/index.ts +0 -9
|
@@ -1,162 +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
|
-
let radioGroupCounter = 0;
|
|
144
|
-
|
|
145
|
-
const setupRadioGroups = () => {
|
|
146
|
-
document
|
|
147
|
-
.querySelectorAll<HTMLFieldSetElement>(".starwind-radio-group")
|
|
148
|
-
.forEach((radioGroup) => {
|
|
149
|
-
if (!radioGroupInstances.has(radioGroup)) {
|
|
150
|
-
radioGroupInstances.set(
|
|
151
|
-
radioGroup,
|
|
152
|
-
new RadioGroupHandler(radioGroup, radioGroupCounter++),
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
// Initialize on page load and after Astro view transitions
|
|
159
|
-
setupRadioGroups();
|
|
160
|
-
document.addEventListener("astro:after-swap", setupRadioGroups);
|
|
161
|
-
document.addEventListener("starwind:init", setupRadioGroups);
|
|
162
|
-
</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
|
-
"outline-none peer-focus-visible:ring-3",
|
|
58
|
-
"absolute inset-0 rounded-full border shadow-xs",
|
|
59
|
-
"transition-[color,box-shadow] peer-checked:[&>svg]:opacity-100",
|
|
60
|
-
"peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
61
|
-
"peer-aria-invalid:border-error peer-focus-visible:peer-aria-invalid:ring-error/40",
|
|
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,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
|
-
};
|