@cl-light-ds/ui 0.1.0 → 0.2.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.
- package/README.md +45 -45
- package/package.json +1 -1
- package/src/components/accordion/Accordion.astro +248 -248
- package/src/components/accordion/AccordionContent.astro +26 -26
- package/src/components/accordion/AccordionItem.astro +36 -36
- package/src/components/accordion/AccordionTrigger.astro +118 -118
- package/src/components/alert/Alert.astro +167 -167
- package/src/components/alert/AlertDescription.astro +24 -24
- package/src/components/alert/AlertTitle.astro +24 -24
- package/src/components/avatar/Avatar.astro +197 -197
- package/src/components/avatar/AvatarBadge.astro +44 -44
- package/src/components/avatar/AvatarFallback.astro +26 -26
- package/src/components/avatar/AvatarGroup.astro +26 -26
- package/src/components/avatar/AvatarGroupCount.astro +30 -30
- package/src/components/avatar/AvatarImage.astro +46 -46
- package/src/components/badge/Badge.astro +167 -167
- package/src/components/breadcrumb/Breadcrumb.astro +76 -76
- package/src/components/breadcrumb/BreadcrumbItem.astro +32 -32
- package/src/components/breadcrumb/BreadcrumbList.astro +26 -26
- package/src/components/breadcrumb/BreadcrumbSeparator.astro +26 -26
- package/src/components/button/Button.astro +233 -233
- package/src/components/button-group/ButtonGroup.astro +130 -130
- package/src/components/button-group/ButtonGroupSeparator.astro +30 -30
- package/src/components/button-group/ButtonGroupText.astro +21 -21
- package/src/components/card/Card.astro +182 -182
- package/src/components/card/CardAction.astro +26 -26
- package/src/components/card/CardContent.astro +28 -28
- package/src/components/card/CardDescription.astro +28 -28
- package/src/components/card/CardFooter.astro +24 -24
- package/src/components/card/CardHeader.astro +30 -30
- package/src/components/card/CardMedia.astro +27 -27
- package/src/components/card/CardOverlay.astro +32 -32
- package/src/components/card/CardTitle.astro +21 -21
- package/src/components/carousel/Carousel.astro +106 -106
- package/src/components/carousel/CarouselSlide.astro +22 -22
- package/src/components/checkbox/Checkbox.astro +159 -159
- package/src/components/collapsible/Collapsible.astro +202 -202
- package/src/components/collapsible/CollapsibleContent.astro +36 -36
- package/src/components/collapsible/CollapsibleTrigger.astro +34 -34
- package/src/components/combobox/Combobox.astro +365 -365
- package/src/components/combobox/ComboboxContent.astro +37 -37
- package/src/components/combobox/ComboboxEmpty.astro +18 -18
- package/src/components/combobox/ComboboxGroup.astro +19 -19
- package/src/components/combobox/ComboboxInput.astro +74 -74
- package/src/components/combobox/ComboboxItem.astro +39 -39
- package/src/components/combobox/ComboboxLabel.astro +18 -18
- package/src/components/combobox/ComboboxList.astro +21 -21
- package/src/components/combobox/ComboboxSeparator.astro +17 -17
- package/src/components/combobox/ComboboxTrigger.astro +30 -30
- package/src/components/combobox/ComboboxValue.astro +22 -22
- package/src/components/date/Date.astro +137 -137
- package/src/components/dialog/Dialog.astro +196 -196
- package/src/components/dialog/DialogClose.astro +23 -23
- package/src/components/dialog/DialogContent.astro +42 -42
- package/src/components/dialog/DialogDescription.astro +18 -18
- package/src/components/dialog/DialogFooter.astro +18 -18
- package/src/components/dialog/DialogHeader.astro +18 -18
- package/src/components/dialog/DialogOverlay.astro +19 -19
- package/src/components/dialog/DialogTitle.astro +18 -18
- package/src/components/dialog/DialogTrigger.astro +37 -37
- package/src/components/dropdown-menu/DropdownMenu.astro +226 -226
- package/src/components/dropdown-menu/DropdownMenuCheckboxItem.astro +114 -114
- package/src/components/dropdown-menu/DropdownMenuContent.astro +42 -42
- package/src/components/dropdown-menu/DropdownMenuGroup.astro +19 -19
- package/src/components/dropdown-menu/DropdownMenuItem.astro +220 -220
- package/src/components/dropdown-menu/DropdownMenuLabel.astro +20 -20
- package/src/components/dropdown-menu/DropdownMenuRadioItem.astro +101 -101
- package/src/components/dropdown-menu/DropdownMenuSeparator.astro +18 -18
- package/src/components/dropdown-menu/DropdownMenuShortcut.astro +18 -18
- package/src/components/dropdown-menu/DropdownMenuTrigger.astro +49 -49
- package/src/components/field/Field.astro +664 -664
- package/src/components/field/FieldContent.astro +20 -20
- package/src/components/field/FieldDescription.astro +22 -22
- package/src/components/field/FieldError.astro +51 -51
- package/src/components/field/FieldGroup.astro +20 -20
- package/src/components/field/FieldLabel.astro +22 -22
- package/src/components/field/FieldLegend.astro +23 -23
- package/src/components/field/FieldSeparator.astro +30 -30
- package/src/components/field/FieldSet.astro +20 -20
- package/src/components/field/FieldTitle.astro +20 -20
- package/src/components/hover-card/HoverCard.astro +235 -235
- package/src/components/hover-card/HoverCardContent.astro +54 -54
- package/src/components/hover-card/HoverCardTrigger.astro +38 -38
- package/src/components/input/Input.astro +130 -130
- package/src/components/input-group/InputGroup.astro +135 -135
- package/src/components/input-group/InputGroupAddon.astro +49 -49
- package/src/components/input-group/InputGroupButton.astro +58 -58
- package/src/components/input-group/InputGroupInput.astro +18 -18
- package/src/components/input-group/InputGroupText.astro +21 -21
- package/src/components/input-group/InputGroupTextarea.astro +17 -17
- package/src/components/item/Item.astro +122 -122
- package/src/components/item/ItemActions.astro +21 -21
- package/src/components/item/ItemContent.astro +25 -25
- package/src/components/item/ItemDescription.astro +25 -25
- package/src/components/item/ItemFooter.astro +24 -24
- package/src/components/item/ItemGroup.astro +24 -24
- package/src/components/item/ItemHeader.astro +24 -24
- package/src/components/item/ItemMedia.astro +47 -47
- package/src/components/item/ItemSeparator.astro +21 -21
- package/src/components/item/ItemTitle.astro +25 -25
- package/src/components/kbd/Kbd.astro +145 -145
- package/src/components/kbd/KbdGroup.astro +55 -55
- package/src/components/label/Label.astro +97 -97
- package/src/components/link-group/LinkGroup.astro +67 -67
- package/src/components/link-group/LinkGroupItem.astro +32 -32
- package/src/components/link-group/LinkGroupList.astro +25 -25
- package/src/components/link-group/LinkGroupTitle.astro +22 -22
- package/src/components/marquee/Marquee.astro +119 -119
- package/src/components/native-select/NativeSelect.astro +125 -125
- package/src/components/native-select/NativeSelectOptGroup.astro +14 -14
- package/src/components/navigation-menu/NavigationMenu.astro +414 -414
- package/src/components/navigation-menu/NavigationMenuContent.astro +37 -37
- package/src/components/navigation-menu/NavigationMenuIndicator.astro +24 -24
- package/src/components/navigation-menu/NavigationMenuItem.astro +22 -22
- package/src/components/navigation-menu/NavigationMenuLink.astro +18 -18
- package/src/components/navigation-menu/NavigationMenuList.astro +21 -21
- package/src/components/navigation-menu/NavigationMenuPositioner.astro +44 -44
- package/src/components/navigation-menu/NavigationMenuTrigger.astro +30 -30
- package/src/components/navigation-menu/NavigationMenuViewport.astro +19 -19
- package/src/components/popover/CHANGELOG.md +17 -2
- package/src/components/popover/Popover.astro +211 -210
- package/src/components/popover/PopoverClose.astro +18 -18
- package/src/components/popover/PopoverContent.astro +50 -49
- package/src/components/popover/PopoverDescription.astro +18 -18
- package/src/components/popover/PopoverHeader.astro +18 -18
- package/src/components/popover/PopoverTitle.astro +18 -18
- package/src/components/popover/PopoverTrigger.astro +35 -29
- package/src/components/radio-group/CHANGELOG.md +23 -1
- package/src/components/radio-group/RadioGroup.astro +81 -81
- package/src/components/radio-group/RadioGroupItem.astro +51 -42
- package/src/components/select/Select.astro +373 -373
- package/src/components/select/SelectContent.astro +91 -91
- package/src/components/select/SelectGroup.astro +19 -19
- package/src/components/select/SelectItem.astro +48 -48
- package/src/components/select/SelectLabel.astro +18 -18
- package/src/components/select/SelectSeparator.astro +17 -17
- package/src/components/select/SelectTrigger.astro +34 -34
- package/src/components/select/SelectValue.astro +22 -22
- package/src/components/separator/Separator.astro +60 -60
- package/src/components/skeleton/Skeleton.astro +121 -121
- package/src/components/slider/Slider.astro +198 -198
- package/src/components/spinner/CHANGELOG.md +14 -1
- package/src/components/spinner/Spinner.astro +135 -134
- package/src/components/sticky-surface/StickySurface.astro +152 -152
- package/src/components/switch/CHANGELOG.md +20 -0
- package/src/components/switch/Switch.astro +106 -106
- package/src/components/table/CHANGELOG.md +21 -2
- package/src/components/table/Table.astro +251 -250
- package/src/components/table/TableBody.astro +18 -18
- package/src/components/table/TableCaption.astro +17 -17
- package/src/components/table/TableCell.astro +21 -21
- package/src/components/table/TableFooter.astro +21 -21
- package/src/components/table/TableHead.astro +21 -21
- package/src/components/table/TableHeader.astro +17 -17
- package/src/components/table/TableRow.astro +21 -21
- package/src/components/tabs/Tabs.astro +306 -306
- package/src/components/tabs/TabsContent.astro +47 -47
- package/src/components/tabs/TabsList.astro +69 -69
- package/src/components/tabs/TabsTrigger.astro +40 -40
- package/src/components/textarea/CHANGELOG.md +18 -1
- package/src/components/textarea/Textarea.astro +58 -36
- package/src/components/toggle/CHANGELOG.md +19 -1
- package/src/components/toggle/Toggle.astro +150 -138
- package/src/components/toggle-group/CHANGELOG.md +14 -1
- package/src/components/toggle-group/ToggleGroup.astro +236 -224
- package/src/components/toggle-group/ToggleGroupItem.astro +48 -48
- package/src/components/tooltip/CHANGELOG.md +19 -2
- package/src/components/tooltip/Tooltip.astro +357 -331
- package/src/components/tooltip/TooltipContent.astro +85 -60
- package/src/components/tooltip/TooltipTrigger.astro +34 -34
- package/src/lib/toggle-shared.ts +3 -2
|
@@ -1,306 +1,306 @@
|
|
|
1
|
-
---
|
|
2
|
-
/**
|
|
3
|
-
* @component Tabs
|
|
4
|
-
* @title Tabs
|
|
5
|
-
* @description Organize content into tabbed panels, rendering one panel at a time.
|
|
6
|
-
* @figmaUrl https://www.figma.com/design/koxai7zw5vIuBzuVxe5T2l/bejamas-ui?node-id=2523-6067&t=YFStJ3V8fXEO8QD8-4
|
|
7
|
-
*
|
|
8
|
-
* @preview
|
|
9
|
-
*
|
|
10
|
-
* <Tabs defaultValue="overview" class="w-full max-w-[400px]">
|
|
11
|
-
* <TabsList>
|
|
12
|
-
* <TabsTrigger value="overview">Overview</TabsTrigger>
|
|
13
|
-
* <TabsTrigger value="analytics">Analytics</TabsTrigger>
|
|
14
|
-
* <TabsTrigger value="reports">Reports</TabsTrigger>
|
|
15
|
-
* <TabsTrigger value="settings">Settings</TabsTrigger>
|
|
16
|
-
* </TabsList>
|
|
17
|
-
* <TabsContent value="overview">
|
|
18
|
-
* <Card>
|
|
19
|
-
* <CardHeader>
|
|
20
|
-
* <CardTitle>Overview</CardTitle>
|
|
21
|
-
* <CardDescription>
|
|
22
|
-
* View key metrics and recent activity across active projects.
|
|
23
|
-
* </CardDescription>
|
|
24
|
-
* </CardHeader>
|
|
25
|
-
* <CardContent class="text-sm text-muted-foreground">
|
|
26
|
-
* You have 12 active projects and 3 pending tasks.
|
|
27
|
-
* </CardContent>
|
|
28
|
-
* </Card>
|
|
29
|
-
* </TabsContent>
|
|
30
|
-
* <TabsContent value="analytics">
|
|
31
|
-
* <Card>
|
|
32
|
-
* <CardHeader>
|
|
33
|
-
* <CardTitle>Analytics</CardTitle>
|
|
34
|
-
* <CardDescription>
|
|
35
|
-
* Track engagement trends and performance over time.
|
|
36
|
-
* </CardDescription>
|
|
37
|
-
* </CardHeader>
|
|
38
|
-
* <CardContent class="text-sm text-muted-foreground">
|
|
39
|
-
* Page views are up 25% compared to last month.
|
|
40
|
-
* </CardContent>
|
|
41
|
-
* </Card>
|
|
42
|
-
* </TabsContent>
|
|
43
|
-
* <TabsContent value="reports">
|
|
44
|
-
* <Card>
|
|
45
|
-
* <CardHeader>
|
|
46
|
-
* <CardTitle>Reports</CardTitle>
|
|
47
|
-
* <CardDescription>
|
|
48
|
-
* Generate detailed exports for sharing and analysis.
|
|
49
|
-
* </CardDescription>
|
|
50
|
-
* </CardHeader>
|
|
51
|
-
* <CardContent class="text-sm text-muted-foreground">
|
|
52
|
-
* You have 5 reports ready to export.
|
|
53
|
-
* </CardContent>
|
|
54
|
-
* </Card>
|
|
55
|
-
* </TabsContent>
|
|
56
|
-
* <TabsContent value="settings">
|
|
57
|
-
* <Card>
|
|
58
|
-
* <CardHeader>
|
|
59
|
-
* <CardTitle>Settings</CardTitle>
|
|
60
|
-
* <CardDescription>
|
|
61
|
-
* Manage account preferences and personalization options.
|
|
62
|
-
* </CardDescription>
|
|
63
|
-
* </CardHeader>
|
|
64
|
-
* <CardContent class="text-sm text-muted-foreground">
|
|
65
|
-
* Configure notifications, security, and themes.
|
|
66
|
-
* </CardContent>
|
|
67
|
-
* </Card>
|
|
68
|
-
* </TabsContent>
|
|
69
|
-
* </Tabs>
|
|
70
|
-
*
|
|
71
|
-
* @usage
|
|
72
|
-
*
|
|
73
|
-
* ```astro nocollapse
|
|
74
|
-
* ---
|
|
75
|
-
* import { Tabs, TabsList, TabsTrigger, TabsContent } from '@bejamas/ui/components/tabs';
|
|
76
|
-
* ---
|
|
77
|
-
*
|
|
78
|
-
* <Tabs defaultValue="overview">
|
|
79
|
-
* <TabsList>
|
|
80
|
-
* <TabsTrigger value="overview">Overview</TabsTrigger>
|
|
81
|
-
* <TabsTrigger value="analytics">Analytics</TabsTrigger>
|
|
82
|
-
* </TabsList>
|
|
83
|
-
* <TabsContent value="overview">Overview content...</TabsContent>
|
|
84
|
-
* <TabsContent value="analytics">Analytics content...</TabsContent>
|
|
85
|
-
* </Tabs>
|
|
86
|
-
*
|
|
87
|
-
* ```
|
|
88
|
-
*
|
|
89
|
-
* @examples
|
|
90
|
-
*
|
|
91
|
-
* ### Line Animated
|
|
92
|
-
*
|
|
93
|
-
* <Tabs defaultValue="overview">
|
|
94
|
-
* <TabsList variant="line-animated" class="mb-4">
|
|
95
|
-
* <TabsTrigger value="overview">Overview</TabsTrigger>
|
|
96
|
-
* <TabsTrigger value="analytics">Analytics</TabsTrigger>
|
|
97
|
-
* <TabsTrigger value="reports">Reports</TabsTrigger>
|
|
98
|
-
* </TabsList>
|
|
99
|
-
* <TabsContent value="overview">Line variant content.</TabsContent>
|
|
100
|
-
* <TabsContent value="analytics">Analytics content.</TabsContent>
|
|
101
|
-
* <TabsContent value="reports">Reports content.</TabsContent>
|
|
102
|
-
* </Tabs>
|
|
103
|
-
*
|
|
104
|
-
* ### Vertical
|
|
105
|
-
*
|
|
106
|
-
* <Tabs defaultValue="profile" orientation="vertical" class="w-full max-w-xl">
|
|
107
|
-
* <TabsList class="min-w-40">
|
|
108
|
-
* <TabsTrigger value="profile" class="justify-start px-3">Profile</TabsTrigger>
|
|
109
|
-
* <TabsTrigger value="billing" class="justify-start px-3">Billing</TabsTrigger>
|
|
110
|
-
* <TabsTrigger value="notifications" class="justify-start px-3">Notifications</TabsTrigger>
|
|
111
|
-
* </TabsList>
|
|
112
|
-
* <TabsContent value="profile" class="rounded-lg border p-4">
|
|
113
|
-
* Profile settings content.
|
|
114
|
-
* </TabsContent>
|
|
115
|
-
* <TabsContent value="billing" class="rounded-lg border p-4">
|
|
116
|
-
* Billing settings content.
|
|
117
|
-
* </TabsContent>
|
|
118
|
-
* <TabsContent value="notifications" class="rounded-lg border p-4">
|
|
119
|
-
* Notifications settings content.
|
|
120
|
-
* </TabsContent>
|
|
121
|
-
* </Tabs>
|
|
122
|
-
*
|
|
123
|
-
* ### Disabled
|
|
124
|
-
*
|
|
125
|
-
* <Tabs defaultValue="active">
|
|
126
|
-
* <TabsList>
|
|
127
|
-
* <TabsTrigger value="active">Active</TabsTrigger>
|
|
128
|
-
* <TabsTrigger value="disabled" disabled>Disabled</TabsTrigger>
|
|
129
|
-
* <TabsTrigger value="secondary">Secondary</TabsTrigger>
|
|
130
|
-
* </TabsList>
|
|
131
|
-
* <TabsContent value="active">Active tab content.</TabsContent>
|
|
132
|
-
* <TabsContent value="disabled">Disabled tab content.</TabsContent>
|
|
133
|
-
* <TabsContent value="secondary">Secondary tab content.</TabsContent>
|
|
134
|
-
* </Tabs>
|
|
135
|
-
*
|
|
136
|
-
* ### Overflow
|
|
137
|
-
*
|
|
138
|
-
* <Tabs defaultValue="monday">
|
|
139
|
-
* <TabsList class="w-full max-w-[20rem] justify-start overflow-x-auto whitespace-nowrap">
|
|
140
|
-
* <TabsTrigger value="monday" class="shrink-0">Monday</TabsTrigger>
|
|
141
|
-
* <TabsTrigger value="tuesday" class="shrink-0">Tuesday</TabsTrigger>
|
|
142
|
-
* <TabsTrigger value="wednesday" class="shrink-0">Wednesday</TabsTrigger>
|
|
143
|
-
* <TabsTrigger value="thursday" class="shrink-0">Thursday</TabsTrigger>
|
|
144
|
-
* <TabsTrigger value="friday" class="shrink-0">Friday</TabsTrigger>
|
|
145
|
-
* <TabsTrigger value="saturday" class="shrink-0">Saturday</TabsTrigger>
|
|
146
|
-
* <TabsTrigger value="sunday" class="shrink-0">Sunday</TabsTrigger>
|
|
147
|
-
* </TabsList>
|
|
148
|
-
* <TabsContent value="monday">Monday content.</TabsContent>
|
|
149
|
-
* <TabsContent value="tuesday">Tuesday content.</TabsContent>
|
|
150
|
-
* <TabsContent value="wednesday">Wednesday content.</TabsContent>
|
|
151
|
-
* <TabsContent value="thursday">Thursday content.</TabsContent>
|
|
152
|
-
* <TabsContent value="friday">Friday content.</TabsContent>
|
|
153
|
-
* <TabsContent value="saturday">Saturday content.</TabsContent>
|
|
154
|
-
* <TabsContent value="sunday">Sunday content.</TabsContent>
|
|
155
|
-
* </Tabs>
|
|
156
|
-
*
|
|
157
|
-
* ### Direction Animation
|
|
158
|
-
*
|
|
159
|
-
* <Tabs defaultValue="overview">
|
|
160
|
-
* <TabsList>
|
|
161
|
-
* <TabsTrigger value="overview">Overview</TabsTrigger>
|
|
162
|
-
* <TabsTrigger value="analytics">Analytics</TabsTrigger>
|
|
163
|
-
* <TabsTrigger value="reports">Reports</TabsTrigger>
|
|
164
|
-
* </TabsList>
|
|
165
|
-
* <TabsContent value="overview" animation="direction">Direction-aware overview.</TabsContent>
|
|
166
|
-
* <TabsContent value="analytics" animation="direction">Direction-aware analytics.</TabsContent>
|
|
167
|
-
* <TabsContent value="reports" animation="direction">Direction-aware reports.</TabsContent>
|
|
168
|
-
* </Tabs>
|
|
169
|
-
*
|
|
170
|
-
* ### Sizes
|
|
171
|
-
*
|
|
172
|
-
* <div class="space-y-4">
|
|
173
|
-
* <Tabs defaultValue="sm-account">
|
|
174
|
-
* <TabsList size="sm">
|
|
175
|
-
* <TabsTrigger value="sm-account" class="text-xs px-2">Account</TabsTrigger>
|
|
176
|
-
* <TabsTrigger value="sm-password" class="text-xs px-2">Password</TabsTrigger>
|
|
177
|
-
* </TabsList>
|
|
178
|
-
* </Tabs>
|
|
179
|
-
*
|
|
180
|
-
* <Tabs defaultValue="md-account">
|
|
181
|
-
* <TabsList size="default">
|
|
182
|
-
* <TabsTrigger value="md-account">Account</TabsTrigger>
|
|
183
|
-
* <TabsTrigger value="md-password">Password</TabsTrigger>
|
|
184
|
-
* </TabsList>
|
|
185
|
-
* </Tabs>
|
|
186
|
-
*
|
|
187
|
-
* <Tabs defaultValue="lg-account">
|
|
188
|
-
* <TabsList size="lg">
|
|
189
|
-
* <TabsTrigger value="lg-account" class="text-base px-4">Account</TabsTrigger>
|
|
190
|
-
* <TabsTrigger value="lg-password" class="text-base px-4">Password</TabsTrigger>
|
|
191
|
-
* </TabsList>
|
|
192
|
-
* </Tabs>
|
|
193
|
-
* </div>
|
|
194
|
-
*
|
|
195
|
-
* @api
|
|
196
|
-
*
|
|
197
|
-
* ### Events
|
|
198
|
-
*
|
|
199
|
-
* The tabs component emits custom events that you can listen to:
|
|
200
|
-
*
|
|
201
|
-
* | Event | Detail | Description |
|
|
202
|
-
* |-------|--------|-------------|
|
|
203
|
-
* | `tabs:change` | `{ value: string }` | Fired when the selected tab changes |
|
|
204
|
-
*
|
|
205
|
-
* ```astro nocollapse console
|
|
206
|
-
* <Tabs id="my-tabs" defaultValue="tab1">
|
|
207
|
-
* <TabsList>
|
|
208
|
-
* <TabsTrigger value="tab1">Tab 1</TabsTrigger>
|
|
209
|
-
* <TabsTrigger value="tab2">Tab 2</TabsTrigger>
|
|
210
|
-
* </TabsList>
|
|
211
|
-
* <TabsContent value="tab1">Content 1</TabsContent>
|
|
212
|
-
* <TabsContent value="tab2">Content 2</TabsContent>
|
|
213
|
-
* </Tabs>
|
|
214
|
-
* ```
|
|
215
|
-
*
|
|
216
|
-
* ```js nocollapse
|
|
217
|
-
* const tabs = document.getElementById('my-tabs');
|
|
218
|
-
*
|
|
219
|
-
* tabs.addEventListener('tabs:change', (e) => {
|
|
220
|
-
* console.log('Selected tab:', e.detail.value);
|
|
221
|
-
* });
|
|
222
|
-
* ```
|
|
223
|
-
*
|
|
224
|
-
* ### Programmatic Control
|
|
225
|
-
*
|
|
226
|
-
* You can control the tabs programmatically by dispatching a `tabs:set` event:
|
|
227
|
-
*
|
|
228
|
-
* ```js nocollapse
|
|
229
|
-
* const tabs = document.getElementById('my-tabs');
|
|
230
|
-
*
|
|
231
|
-
* // Select a tab
|
|
232
|
-
* tabs.dispatchEvent(new CustomEvent('tabs:set', {
|
|
233
|
-
* detail: { value: 'tab2' }
|
|
234
|
-
* }));
|
|
235
|
-
* ```
|
|
236
|
-
*
|
|
237
|
-
* ### Variants
|
|
238
|
-
*
|
|
239
|
-
* | Prop | Element | Values | Default |
|
|
240
|
-
* |------|---------|--------|---------|
|
|
241
|
-
* | `variant` | tabs-list | `indicator`, `default`, `line`, `line-animated` | `indicator` |
|
|
242
|
-
* | `size` | tabs-list | `sm`, `default`, `lg` | `default` |
|
|
243
|
-
* | `animation` | tabs-content | `none`, `fade`, `slide`, `direction` | `none` |
|
|
244
|
-
*
|
|
245
|
-
* ### Data Attributes
|
|
246
|
-
*
|
|
247
|
-
* The tabs component sets these data attributes that you can use for styling or querying state:
|
|
248
|
-
*
|
|
249
|
-
* | Attribute | Element | Description |
|
|
250
|
-
* |-----------|---------|-------------|
|
|
251
|
-
* | `data-orientation` | tabs | Current orientation (`horizontal` or `vertical`) |
|
|
252
|
-
* | `data-variant` | tabs-list | Current list variant (`indicator`, `default`, `line`, or `line-animated`) |
|
|
253
|
-
* | `data-activation-direction` | tabs-content | Last activation direction after tab change (`left`, `right`, `up`, or `down`, not set on initial mount) |
|
|
254
|
-
* | `data-state` | tabs-trigger | Current state (`active` or `inactive`) |
|
|
255
|
-
*
|
|
256
|
-
* ### CSS Variables
|
|
257
|
-
*
|
|
258
|
-
* The tabs indicator exposes CSS variables for animation:
|
|
259
|
-
*
|
|
260
|
-
* | Variable | Element | Description |
|
|
261
|
-
* |----------|---------|-------------|
|
|
262
|
-
* | `--active-tab-left` | tabs-indicator | Left position of active tab |
|
|
263
|
-
* | `--active-tab-width` | tabs-indicator | Width of active tab |
|
|
264
|
-
* | `--active-tab-top` | tabs-indicator | Top position of active tab |
|
|
265
|
-
* | `--active-tab-height` | tabs-indicator | Height of active tab |
|
|
266
|
-
*/
|
|
267
|
-
|
|
268
|
-
import type { HTMLAttributes } from "astro/types";
|
|
269
|
-
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
270
|
-
|
|
271
|
-
interface Props extends HTMLAttributes<"div"> {
|
|
272
|
-
class?: string;
|
|
273
|
-
orientation?: "horizontal" | "vertical";
|
|
274
|
-
defaultValue?: string;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
const {
|
|
278
|
-
class: className = "",
|
|
279
|
-
orientation = "horizontal",
|
|
280
|
-
defaultValue,
|
|
281
|
-
...rest
|
|
282
|
-
} = Astro.props as Props;
|
|
283
|
-
---
|
|
284
|
-
|
|
285
|
-
<div
|
|
286
|
-
{...rest}
|
|
287
|
-
data-slot="tabs"
|
|
288
|
-
data-orientation={orientation}
|
|
289
|
-
data-default-value={defaultValue}
|
|
290
|
-
data-horizontal={orientation === "horizontal" ? "true" : undefined}
|
|
291
|
-
data-vertical={orientation === "vertical" ? "true" : undefined}
|
|
292
|
-
class={cn(
|
|
293
|
-
"gap-2",
|
|
294
|
-
"group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",
|
|
295
|
-
className,
|
|
296
|
-
)}
|
|
297
|
-
>
|
|
298
|
-
<slot />
|
|
299
|
-
</div>
|
|
300
|
-
|
|
301
|
-
<script>
|
|
302
|
-
import { createTabs } from "@data-slot/tabs";
|
|
303
|
-
document
|
|
304
|
-
.querySelectorAll('[data-slot="tabs"]')
|
|
305
|
-
.forEach((el) => createTabs(el));
|
|
306
|
-
</script>
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* @component Tabs
|
|
4
|
+
* @title Tabs
|
|
5
|
+
* @description Organize content into tabbed panels, rendering one panel at a time.
|
|
6
|
+
* @figmaUrl https://www.figma.com/design/koxai7zw5vIuBzuVxe5T2l/bejamas-ui?node-id=2523-6067&t=YFStJ3V8fXEO8QD8-4
|
|
7
|
+
*
|
|
8
|
+
* @preview
|
|
9
|
+
*
|
|
10
|
+
* <Tabs defaultValue="overview" class="w-full max-w-[400px]">
|
|
11
|
+
* <TabsList>
|
|
12
|
+
* <TabsTrigger value="overview">Overview</TabsTrigger>
|
|
13
|
+
* <TabsTrigger value="analytics">Analytics</TabsTrigger>
|
|
14
|
+
* <TabsTrigger value="reports">Reports</TabsTrigger>
|
|
15
|
+
* <TabsTrigger value="settings">Settings</TabsTrigger>
|
|
16
|
+
* </TabsList>
|
|
17
|
+
* <TabsContent value="overview">
|
|
18
|
+
* <Card>
|
|
19
|
+
* <CardHeader>
|
|
20
|
+
* <CardTitle>Overview</CardTitle>
|
|
21
|
+
* <CardDescription>
|
|
22
|
+
* View key metrics and recent activity across active projects.
|
|
23
|
+
* </CardDescription>
|
|
24
|
+
* </CardHeader>
|
|
25
|
+
* <CardContent class="text-sm text-muted-foreground">
|
|
26
|
+
* You have 12 active projects and 3 pending tasks.
|
|
27
|
+
* </CardContent>
|
|
28
|
+
* </Card>
|
|
29
|
+
* </TabsContent>
|
|
30
|
+
* <TabsContent value="analytics">
|
|
31
|
+
* <Card>
|
|
32
|
+
* <CardHeader>
|
|
33
|
+
* <CardTitle>Analytics</CardTitle>
|
|
34
|
+
* <CardDescription>
|
|
35
|
+
* Track engagement trends and performance over time.
|
|
36
|
+
* </CardDescription>
|
|
37
|
+
* </CardHeader>
|
|
38
|
+
* <CardContent class="text-sm text-muted-foreground">
|
|
39
|
+
* Page views are up 25% compared to last month.
|
|
40
|
+
* </CardContent>
|
|
41
|
+
* </Card>
|
|
42
|
+
* </TabsContent>
|
|
43
|
+
* <TabsContent value="reports">
|
|
44
|
+
* <Card>
|
|
45
|
+
* <CardHeader>
|
|
46
|
+
* <CardTitle>Reports</CardTitle>
|
|
47
|
+
* <CardDescription>
|
|
48
|
+
* Generate detailed exports for sharing and analysis.
|
|
49
|
+
* </CardDescription>
|
|
50
|
+
* </CardHeader>
|
|
51
|
+
* <CardContent class="text-sm text-muted-foreground">
|
|
52
|
+
* You have 5 reports ready to export.
|
|
53
|
+
* </CardContent>
|
|
54
|
+
* </Card>
|
|
55
|
+
* </TabsContent>
|
|
56
|
+
* <TabsContent value="settings">
|
|
57
|
+
* <Card>
|
|
58
|
+
* <CardHeader>
|
|
59
|
+
* <CardTitle>Settings</CardTitle>
|
|
60
|
+
* <CardDescription>
|
|
61
|
+
* Manage account preferences and personalization options.
|
|
62
|
+
* </CardDescription>
|
|
63
|
+
* </CardHeader>
|
|
64
|
+
* <CardContent class="text-sm text-muted-foreground">
|
|
65
|
+
* Configure notifications, security, and themes.
|
|
66
|
+
* </CardContent>
|
|
67
|
+
* </Card>
|
|
68
|
+
* </TabsContent>
|
|
69
|
+
* </Tabs>
|
|
70
|
+
*
|
|
71
|
+
* @usage
|
|
72
|
+
*
|
|
73
|
+
* ```astro nocollapse
|
|
74
|
+
* ---
|
|
75
|
+
* import { Tabs, TabsList, TabsTrigger, TabsContent } from '@bejamas/ui/components/tabs';
|
|
76
|
+
* ---
|
|
77
|
+
*
|
|
78
|
+
* <Tabs defaultValue="overview">
|
|
79
|
+
* <TabsList>
|
|
80
|
+
* <TabsTrigger value="overview">Overview</TabsTrigger>
|
|
81
|
+
* <TabsTrigger value="analytics">Analytics</TabsTrigger>
|
|
82
|
+
* </TabsList>
|
|
83
|
+
* <TabsContent value="overview">Overview content...</TabsContent>
|
|
84
|
+
* <TabsContent value="analytics">Analytics content...</TabsContent>
|
|
85
|
+
* </Tabs>
|
|
86
|
+
*
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* @examples
|
|
90
|
+
*
|
|
91
|
+
* ### Line Animated
|
|
92
|
+
*
|
|
93
|
+
* <Tabs defaultValue="overview">
|
|
94
|
+
* <TabsList variant="line-animated" class="mb-4">
|
|
95
|
+
* <TabsTrigger value="overview">Overview</TabsTrigger>
|
|
96
|
+
* <TabsTrigger value="analytics">Analytics</TabsTrigger>
|
|
97
|
+
* <TabsTrigger value="reports">Reports</TabsTrigger>
|
|
98
|
+
* </TabsList>
|
|
99
|
+
* <TabsContent value="overview">Line variant content.</TabsContent>
|
|
100
|
+
* <TabsContent value="analytics">Analytics content.</TabsContent>
|
|
101
|
+
* <TabsContent value="reports">Reports content.</TabsContent>
|
|
102
|
+
* </Tabs>
|
|
103
|
+
*
|
|
104
|
+
* ### Vertical
|
|
105
|
+
*
|
|
106
|
+
* <Tabs defaultValue="profile" orientation="vertical" class="w-full max-w-xl">
|
|
107
|
+
* <TabsList class="min-w-40">
|
|
108
|
+
* <TabsTrigger value="profile" class="justify-start px-3">Profile</TabsTrigger>
|
|
109
|
+
* <TabsTrigger value="billing" class="justify-start px-3">Billing</TabsTrigger>
|
|
110
|
+
* <TabsTrigger value="notifications" class="justify-start px-3">Notifications</TabsTrigger>
|
|
111
|
+
* </TabsList>
|
|
112
|
+
* <TabsContent value="profile" class="rounded-lg border p-4">
|
|
113
|
+
* Profile settings content.
|
|
114
|
+
* </TabsContent>
|
|
115
|
+
* <TabsContent value="billing" class="rounded-lg border p-4">
|
|
116
|
+
* Billing settings content.
|
|
117
|
+
* </TabsContent>
|
|
118
|
+
* <TabsContent value="notifications" class="rounded-lg border p-4">
|
|
119
|
+
* Notifications settings content.
|
|
120
|
+
* </TabsContent>
|
|
121
|
+
* </Tabs>
|
|
122
|
+
*
|
|
123
|
+
* ### Disabled
|
|
124
|
+
*
|
|
125
|
+
* <Tabs defaultValue="active">
|
|
126
|
+
* <TabsList>
|
|
127
|
+
* <TabsTrigger value="active">Active</TabsTrigger>
|
|
128
|
+
* <TabsTrigger value="disabled" disabled>Disabled</TabsTrigger>
|
|
129
|
+
* <TabsTrigger value="secondary">Secondary</TabsTrigger>
|
|
130
|
+
* </TabsList>
|
|
131
|
+
* <TabsContent value="active">Active tab content.</TabsContent>
|
|
132
|
+
* <TabsContent value="disabled">Disabled tab content.</TabsContent>
|
|
133
|
+
* <TabsContent value="secondary">Secondary tab content.</TabsContent>
|
|
134
|
+
* </Tabs>
|
|
135
|
+
*
|
|
136
|
+
* ### Overflow
|
|
137
|
+
*
|
|
138
|
+
* <Tabs defaultValue="monday">
|
|
139
|
+
* <TabsList class="w-full max-w-[20rem] justify-start overflow-x-auto whitespace-nowrap">
|
|
140
|
+
* <TabsTrigger value="monday" class="shrink-0">Monday</TabsTrigger>
|
|
141
|
+
* <TabsTrigger value="tuesday" class="shrink-0">Tuesday</TabsTrigger>
|
|
142
|
+
* <TabsTrigger value="wednesday" class="shrink-0">Wednesday</TabsTrigger>
|
|
143
|
+
* <TabsTrigger value="thursday" class="shrink-0">Thursday</TabsTrigger>
|
|
144
|
+
* <TabsTrigger value="friday" class="shrink-0">Friday</TabsTrigger>
|
|
145
|
+
* <TabsTrigger value="saturday" class="shrink-0">Saturday</TabsTrigger>
|
|
146
|
+
* <TabsTrigger value="sunday" class="shrink-0">Sunday</TabsTrigger>
|
|
147
|
+
* </TabsList>
|
|
148
|
+
* <TabsContent value="monday">Monday content.</TabsContent>
|
|
149
|
+
* <TabsContent value="tuesday">Tuesday content.</TabsContent>
|
|
150
|
+
* <TabsContent value="wednesday">Wednesday content.</TabsContent>
|
|
151
|
+
* <TabsContent value="thursday">Thursday content.</TabsContent>
|
|
152
|
+
* <TabsContent value="friday">Friday content.</TabsContent>
|
|
153
|
+
* <TabsContent value="saturday">Saturday content.</TabsContent>
|
|
154
|
+
* <TabsContent value="sunday">Sunday content.</TabsContent>
|
|
155
|
+
* </Tabs>
|
|
156
|
+
*
|
|
157
|
+
* ### Direction Animation
|
|
158
|
+
*
|
|
159
|
+
* <Tabs defaultValue="overview">
|
|
160
|
+
* <TabsList>
|
|
161
|
+
* <TabsTrigger value="overview">Overview</TabsTrigger>
|
|
162
|
+
* <TabsTrigger value="analytics">Analytics</TabsTrigger>
|
|
163
|
+
* <TabsTrigger value="reports">Reports</TabsTrigger>
|
|
164
|
+
* </TabsList>
|
|
165
|
+
* <TabsContent value="overview" animation="direction">Direction-aware overview.</TabsContent>
|
|
166
|
+
* <TabsContent value="analytics" animation="direction">Direction-aware analytics.</TabsContent>
|
|
167
|
+
* <TabsContent value="reports" animation="direction">Direction-aware reports.</TabsContent>
|
|
168
|
+
* </Tabs>
|
|
169
|
+
*
|
|
170
|
+
* ### Sizes
|
|
171
|
+
*
|
|
172
|
+
* <div class="space-y-4">
|
|
173
|
+
* <Tabs defaultValue="sm-account">
|
|
174
|
+
* <TabsList size="sm">
|
|
175
|
+
* <TabsTrigger value="sm-account" class="text-xs px-2">Account</TabsTrigger>
|
|
176
|
+
* <TabsTrigger value="sm-password" class="text-xs px-2">Password</TabsTrigger>
|
|
177
|
+
* </TabsList>
|
|
178
|
+
* </Tabs>
|
|
179
|
+
*
|
|
180
|
+
* <Tabs defaultValue="md-account">
|
|
181
|
+
* <TabsList size="default">
|
|
182
|
+
* <TabsTrigger value="md-account">Account</TabsTrigger>
|
|
183
|
+
* <TabsTrigger value="md-password">Password</TabsTrigger>
|
|
184
|
+
* </TabsList>
|
|
185
|
+
* </Tabs>
|
|
186
|
+
*
|
|
187
|
+
* <Tabs defaultValue="lg-account">
|
|
188
|
+
* <TabsList size="lg">
|
|
189
|
+
* <TabsTrigger value="lg-account" class="text-base px-4">Account</TabsTrigger>
|
|
190
|
+
* <TabsTrigger value="lg-password" class="text-base px-4">Password</TabsTrigger>
|
|
191
|
+
* </TabsList>
|
|
192
|
+
* </Tabs>
|
|
193
|
+
* </div>
|
|
194
|
+
*
|
|
195
|
+
* @api
|
|
196
|
+
*
|
|
197
|
+
* ### Events
|
|
198
|
+
*
|
|
199
|
+
* The tabs component emits custom events that you can listen to:
|
|
200
|
+
*
|
|
201
|
+
* | Event | Detail | Description |
|
|
202
|
+
* |-------|--------|-------------|
|
|
203
|
+
* | `tabs:change` | `{ value: string }` | Fired when the selected tab changes |
|
|
204
|
+
*
|
|
205
|
+
* ```astro nocollapse console
|
|
206
|
+
* <Tabs id="my-tabs" defaultValue="tab1">
|
|
207
|
+
* <TabsList>
|
|
208
|
+
* <TabsTrigger value="tab1">Tab 1</TabsTrigger>
|
|
209
|
+
* <TabsTrigger value="tab2">Tab 2</TabsTrigger>
|
|
210
|
+
* </TabsList>
|
|
211
|
+
* <TabsContent value="tab1">Content 1</TabsContent>
|
|
212
|
+
* <TabsContent value="tab2">Content 2</TabsContent>
|
|
213
|
+
* </Tabs>
|
|
214
|
+
* ```
|
|
215
|
+
*
|
|
216
|
+
* ```js nocollapse
|
|
217
|
+
* const tabs = document.getElementById('my-tabs');
|
|
218
|
+
*
|
|
219
|
+
* tabs.addEventListener('tabs:change', (e) => {
|
|
220
|
+
* console.log('Selected tab:', e.detail.value);
|
|
221
|
+
* });
|
|
222
|
+
* ```
|
|
223
|
+
*
|
|
224
|
+
* ### Programmatic Control
|
|
225
|
+
*
|
|
226
|
+
* You can control the tabs programmatically by dispatching a `tabs:set` event:
|
|
227
|
+
*
|
|
228
|
+
* ```js nocollapse
|
|
229
|
+
* const tabs = document.getElementById('my-tabs');
|
|
230
|
+
*
|
|
231
|
+
* // Select a tab
|
|
232
|
+
* tabs.dispatchEvent(new CustomEvent('tabs:set', {
|
|
233
|
+
* detail: { value: 'tab2' }
|
|
234
|
+
* }));
|
|
235
|
+
* ```
|
|
236
|
+
*
|
|
237
|
+
* ### Variants
|
|
238
|
+
*
|
|
239
|
+
* | Prop | Element | Values | Default |
|
|
240
|
+
* |------|---------|--------|---------|
|
|
241
|
+
* | `variant` | tabs-list | `indicator`, `default`, `line`, `line-animated` | `indicator` |
|
|
242
|
+
* | `size` | tabs-list | `sm`, `default`, `lg` | `default` |
|
|
243
|
+
* | `animation` | tabs-content | `none`, `fade`, `slide`, `direction` | `none` |
|
|
244
|
+
*
|
|
245
|
+
* ### Data Attributes
|
|
246
|
+
*
|
|
247
|
+
* The tabs component sets these data attributes that you can use for styling or querying state:
|
|
248
|
+
*
|
|
249
|
+
* | Attribute | Element | Description |
|
|
250
|
+
* |-----------|---------|-------------|
|
|
251
|
+
* | `data-orientation` | tabs | Current orientation (`horizontal` or `vertical`) |
|
|
252
|
+
* | `data-variant` | tabs-list | Current list variant (`indicator`, `default`, `line`, or `line-animated`) |
|
|
253
|
+
* | `data-activation-direction` | tabs-content | Last activation direction after tab change (`left`, `right`, `up`, or `down`, not set on initial mount) |
|
|
254
|
+
* | `data-state` | tabs-trigger | Current state (`active` or `inactive`) |
|
|
255
|
+
*
|
|
256
|
+
* ### CSS Variables
|
|
257
|
+
*
|
|
258
|
+
* The tabs indicator exposes CSS variables for animation:
|
|
259
|
+
*
|
|
260
|
+
* | Variable | Element | Description |
|
|
261
|
+
* |----------|---------|-------------|
|
|
262
|
+
* | `--active-tab-left` | tabs-indicator | Left position of active tab |
|
|
263
|
+
* | `--active-tab-width` | tabs-indicator | Width of active tab |
|
|
264
|
+
* | `--active-tab-top` | tabs-indicator | Top position of active tab |
|
|
265
|
+
* | `--active-tab-height` | tabs-indicator | Height of active tab |
|
|
266
|
+
*/
|
|
267
|
+
|
|
268
|
+
import type { HTMLAttributes } from "astro/types";
|
|
269
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
270
|
+
|
|
271
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
272
|
+
class?: string;
|
|
273
|
+
orientation?: "horizontal" | "vertical";
|
|
274
|
+
defaultValue?: string;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const {
|
|
278
|
+
class: className = "",
|
|
279
|
+
orientation = "horizontal",
|
|
280
|
+
defaultValue,
|
|
281
|
+
...rest
|
|
282
|
+
} = Astro.props as Props;
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
<div
|
|
286
|
+
{...rest}
|
|
287
|
+
data-slot="tabs"
|
|
288
|
+
data-orientation={orientation}
|
|
289
|
+
data-default-value={defaultValue}
|
|
290
|
+
data-horizontal={orientation === "horizontal" ? "true" : undefined}
|
|
291
|
+
data-vertical={orientation === "vertical" ? "true" : undefined}
|
|
292
|
+
class={cn(
|
|
293
|
+
"gap-2",
|
|
294
|
+
"group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",
|
|
295
|
+
className,
|
|
296
|
+
)}
|
|
297
|
+
>
|
|
298
|
+
<slot />
|
|
299
|
+
</div>
|
|
300
|
+
|
|
301
|
+
<script>
|
|
302
|
+
import { createTabs } from "@data-slot/tabs";
|
|
303
|
+
document
|
|
304
|
+
.querySelectorAll('[data-slot="tabs"]')
|
|
305
|
+
.forEach((el) => createTabs(el));
|
|
306
|
+
</script>
|