@cl-light-ds/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/package.json +59 -0
- package/src/components/accordion/Accordion.astro +248 -0
- package/src/components/accordion/AccordionContent.astro +26 -0
- package/src/components/accordion/AccordionItem.astro +36 -0
- package/src/components/accordion/AccordionTrigger.astro +118 -0
- package/src/components/accordion/CHANGELOG.md +41 -0
- package/src/components/accordion/index.ts +4 -0
- package/src/components/alert/Alert.astro +167 -0
- package/src/components/alert/AlertDescription.astro +24 -0
- package/src/components/alert/AlertTitle.astro +24 -0
- package/src/components/alert/CHANGELOG.md +5 -0
- package/src/components/alert/index.ts +4 -0
- package/src/components/avatar/Avatar.astro +197 -0
- package/src/components/avatar/AvatarBadge.astro +44 -0
- package/src/components/avatar/AvatarFallback.astro +26 -0
- package/src/components/avatar/AvatarGroup.astro +26 -0
- package/src/components/avatar/AvatarGroupCount.astro +30 -0
- package/src/components/avatar/AvatarImage.astro +46 -0
- package/src/components/avatar/CHANGELOG.md +44 -0
- package/src/components/avatar/index.ts +6 -0
- package/src/components/badge/Badge.astro +167 -0
- package/src/components/badge/CHANGELOG.md +49 -0
- package/src/components/badge/index.ts +2 -0
- package/src/components/breadcrumb/Breadcrumb.astro +76 -0
- package/src/components/breadcrumb/BreadcrumbItem.astro +32 -0
- package/src/components/breadcrumb/BreadcrumbList.astro +26 -0
- package/src/components/breadcrumb/BreadcrumbSeparator.astro +26 -0
- package/src/components/breadcrumb/CHANGELOG.md +24 -0
- package/src/components/breadcrumb/index.ts +5 -0
- package/src/components/button/Button.astro +233 -0
- package/src/components/button/CHANGELOG.md +41 -0
- package/src/components/button/index.ts +2 -0
- package/src/components/button-group/ButtonGroup.astro +130 -0
- package/src/components/button-group/ButtonGroupSeparator.astro +30 -0
- package/src/components/button-group/ButtonGroupText.astro +21 -0
- package/src/components/button-group/CHANGELOG.md +34 -0
- package/src/components/button-group/index.ts +3 -0
- package/src/components/card/CHANGELOG.md +119 -0
- package/src/components/card/Card.astro +182 -0
- package/src/components/card/CardAction.astro +26 -0
- package/src/components/card/CardContent.astro +28 -0
- package/src/components/card/CardDescription.astro +28 -0
- package/src/components/card/CardFooter.astro +24 -0
- package/src/components/card/CardHeader.astro +30 -0
- package/src/components/card/CardMedia.astro +27 -0
- package/src/components/card/CardOverlay.astro +32 -0
- package/src/components/card/CardTitle.astro +21 -0
- package/src/components/card/index.ts +10 -0
- package/src/components/carousel/CHANGELOG.md +5 -0
- package/src/components/carousel/Carousel.astro +106 -0
- package/src/components/carousel/CarouselSlide.astro +22 -0
- package/src/components/carousel/index.ts +3 -0
- package/src/components/checkbox/CHANGELOG.md +58 -0
- package/src/components/checkbox/Checkbox.astro +159 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/collapsible/CHANGELOG.md +5 -0
- package/src/components/collapsible/Collapsible.astro +202 -0
- package/src/components/collapsible/CollapsibleContent.astro +36 -0
- package/src/components/collapsible/CollapsibleTrigger.astro +34 -0
- package/src/components/collapsible/index.ts +4 -0
- package/src/components/combobox/CHANGELOG.md +27 -0
- package/src/components/combobox/Combobox.astro +365 -0
- package/src/components/combobox/ComboboxContent.astro +37 -0
- package/src/components/combobox/ComboboxEmpty.astro +18 -0
- package/src/components/combobox/ComboboxGroup.astro +19 -0
- package/src/components/combobox/ComboboxInput.astro +74 -0
- package/src/components/combobox/ComboboxItem.astro +39 -0
- package/src/components/combobox/ComboboxLabel.astro +18 -0
- package/src/components/combobox/ComboboxList.astro +21 -0
- package/src/components/combobox/ComboboxSeparator.astro +17 -0
- package/src/components/combobox/ComboboxTrigger.astro +30 -0
- package/src/components/combobox/ComboboxValue.astro +22 -0
- package/src/components/combobox/index.ts +11 -0
- package/src/components/date/CHANGELOG.md +18 -0
- package/src/components/date/Date.astro +137 -0
- package/src/components/date/index.ts +2 -0
- package/src/components/dialog/CHANGELOG.md +39 -0
- package/src/components/dialog/Dialog.astro +196 -0
- package/src/components/dialog/DialogClose.astro +23 -0
- package/src/components/dialog/DialogContent.astro +42 -0
- package/src/components/dialog/DialogDescription.astro +18 -0
- package/src/components/dialog/DialogFooter.astro +18 -0
- package/src/components/dialog/DialogHeader.astro +18 -0
- package/src/components/dialog/DialogOverlay.astro +19 -0
- package/src/components/dialog/DialogTitle.astro +18 -0
- package/src/components/dialog/DialogTrigger.astro +37 -0
- package/src/components/dialog/index.ts +9 -0
- package/src/components/dropdown-menu/CHANGELOG.md +194 -0
- package/src/components/dropdown-menu/DropdownMenu.astro +226 -0
- package/src/components/dropdown-menu/DropdownMenuCheckboxItem.astro +114 -0
- package/src/components/dropdown-menu/DropdownMenuContent.astro +42 -0
- package/src/components/dropdown-menu/DropdownMenuGroup.astro +19 -0
- package/src/components/dropdown-menu/DropdownMenuItem.astro +220 -0
- package/src/components/dropdown-menu/DropdownMenuItemContent.astro +79 -0
- package/src/components/dropdown-menu/DropdownMenuLabel.astro +20 -0
- package/src/components/dropdown-menu/DropdownMenuPortal.astro +13 -0
- package/src/components/dropdown-menu/DropdownMenuRadioGroup.astro +13 -0
- package/src/components/dropdown-menu/DropdownMenuRadioItem.astro +101 -0
- package/src/components/dropdown-menu/DropdownMenuSeparator.astro +18 -0
- package/src/components/dropdown-menu/DropdownMenuShortcut.astro +18 -0
- package/src/components/dropdown-menu/DropdownMenuTrigger.astro +49 -0
- package/src/components/dropdown-menu/dropdown-menu-item-variants.ts +24 -0
- package/src/components/dropdown-menu/index.ts +12 -0
- package/src/components/field/CHANGELOG.md +33 -0
- package/src/components/field/Field.astro +664 -0
- package/src/components/field/FieldContent.astro +20 -0
- package/src/components/field/FieldDescription.astro +22 -0
- package/src/components/field/FieldError.astro +51 -0
- package/src/components/field/FieldGroup.astro +20 -0
- package/src/components/field/FieldLabel.astro +22 -0
- package/src/components/field/FieldLegend.astro +23 -0
- package/src/components/field/FieldSeparator.astro +30 -0
- package/src/components/field/FieldSet.astro +20 -0
- package/src/components/field/FieldTitle.astro +20 -0
- package/src/components/field/index.ts +10 -0
- package/src/components/hover-card/CHANGELOG.md +20 -0
- package/src/components/hover-card/HoverCard.astro +235 -0
- package/src/components/hover-card/HoverCardContent.astro +54 -0
- package/src/components/hover-card/HoverCardTrigger.astro +38 -0
- package/src/components/hover-card/index.ts +3 -0
- package/src/components/input/CHANGELOG.md +29 -0
- package/src/components/input/Input.astro +130 -0
- package/src/components/input/index.ts +2 -0
- package/src/components/input-group/CHANGELOG.md +49 -0
- package/src/components/input-group/InputGroup.astro +135 -0
- package/src/components/input-group/InputGroupAddon.astro +49 -0
- package/src/components/input-group/InputGroupButton.astro +58 -0
- package/src/components/input-group/InputGroupInput.astro +18 -0
- package/src/components/input-group/InputGroupText.astro +21 -0
- package/src/components/input-group/InputGroupTextarea.astro +17 -0
- package/src/components/input-group/controlClasses.ts +2 -0
- package/src/components/input-group/index.ts +6 -0
- package/src/components/item/CHANGELOG.md +27 -0
- package/src/components/item/Item.astro +122 -0
- package/src/components/item/ItemActions.astro +21 -0
- package/src/components/item/ItemContent.astro +25 -0
- package/src/components/item/ItemDescription.astro +25 -0
- package/src/components/item/ItemFooter.astro +24 -0
- package/src/components/item/ItemGroup.astro +24 -0
- package/src/components/item/ItemHeader.astro +24 -0
- package/src/components/item/ItemMedia.astro +47 -0
- package/src/components/item/ItemSeparator.astro +21 -0
- package/src/components/item/ItemTitle.astro +25 -0
- package/src/components/item/index.ts +10 -0
- package/src/components/kbd/CHANGELOG.md +5 -0
- package/src/components/kbd/Kbd.astro +145 -0
- package/src/components/kbd/KbdGroup.astro +55 -0
- package/src/components/kbd/index.ts +2 -0
- package/src/components/label/CHANGELOG.md +28 -0
- package/src/components/label/Label.astro +97 -0
- package/src/components/label/index.ts +2 -0
- package/src/components/link-group/CHANGELOG.md +75 -0
- package/src/components/link-group/LinkGroup.astro +67 -0
- package/src/components/link-group/LinkGroupItem.astro +32 -0
- package/src/components/link-group/LinkGroupList.astro +25 -0
- package/src/components/link-group/LinkGroupTitle.astro +22 -0
- package/src/components/link-group/index.ts +5 -0
- package/src/components/link-group/link-group-list-variants.ts +15 -0
- package/src/components/marquee/CHANGELOG.md +5 -0
- package/src/components/marquee/Marquee.astro +119 -0
- package/src/components/marquee/index.ts +2 -0
- package/src/components/native-select/CHANGELOG.md +5 -0
- package/src/components/native-select/NativeSelect.astro +125 -0
- package/src/components/native-select/NativeSelectOptGroup.astro +14 -0
- package/src/components/native-select/NativeSelectOption.astro +9 -0
- package/src/components/native-select/index.ts +3 -0
- package/src/components/navigation-menu/CHANGELOG.md +63 -0
- package/src/components/navigation-menu/NavigationMenu.astro +414 -0
- package/src/components/navigation-menu/NavigationMenuContent.astro +37 -0
- package/src/components/navigation-menu/NavigationMenuIndicator.astro +24 -0
- package/src/components/navigation-menu/NavigationMenuItem.astro +22 -0
- package/src/components/navigation-menu/NavigationMenuLink.astro +18 -0
- package/src/components/navigation-menu/NavigationMenuList.astro +21 -0
- package/src/components/navigation-menu/NavigationMenuPositioner.astro +44 -0
- package/src/components/navigation-menu/NavigationMenuTrigger.astro +30 -0
- package/src/components/navigation-menu/NavigationMenuViewport.astro +19 -0
- package/src/components/navigation-menu/index.ts +10 -0
- package/src/components/popover/CHANGELOG.md +5 -0
- package/src/components/popover/Popover.astro +210 -0
- package/src/components/popover/PopoverClose.astro +18 -0
- package/src/components/popover/PopoverContent.astro +49 -0
- package/src/components/popover/PopoverDescription.astro +18 -0
- package/src/components/popover/PopoverHeader.astro +18 -0
- package/src/components/popover/PopoverTitle.astro +18 -0
- package/src/components/popover/PopoverTrigger.astro +29 -0
- package/src/components/popover/index.ts +7 -0
- package/src/components/radio-group/CHANGELOG.md +9 -0
- package/src/components/radio-group/RadioGroup.astro +81 -0
- package/src/components/radio-group/RadioGroupItem.astro +42 -0
- package/src/components/radio-group/index.ts +3 -0
- package/src/components/select/CHANGELOG.md +39 -0
- package/src/components/select/Select.astro +373 -0
- package/src/components/select/SelectContent.astro +91 -0
- package/src/components/select/SelectGroup.astro +19 -0
- package/src/components/select/SelectItem.astro +48 -0
- package/src/components/select/SelectLabel.astro +18 -0
- package/src/components/select/SelectSeparator.astro +17 -0
- package/src/components/select/SelectTrigger.astro +34 -0
- package/src/components/select/SelectValue.astro +22 -0
- package/src/components/select/index.ts +8 -0
- package/src/components/separator/CHANGELOG.md +5 -0
- package/src/components/separator/Separator.astro +60 -0
- package/src/components/separator/index.ts +2 -0
- package/src/components/skeleton/CHANGELOG.md +5 -0
- package/src/components/skeleton/Skeleton.astro +121 -0
- package/src/components/skeleton/index.ts +1 -0
- package/src/components/slider/CHANGELOG.md +5 -0
- package/src/components/slider/Slider.astro +198 -0
- package/src/components/slider/index.ts +1 -0
- package/src/components/spinner/CHANGELOG.md +5 -0
- package/src/components/spinner/Spinner.astro +134 -0
- package/src/components/spinner/index.ts +1 -0
- package/src/components/sticky-surface/CHANGELOG.md +5 -0
- package/src/components/sticky-surface/StickySurface.astro +152 -0
- package/src/components/sticky-surface/index.ts +2 -0
- package/src/components/switch/CHANGELOG.md +9 -0
- package/src/components/switch/Switch.astro +106 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/table/CHANGELOG.md +5 -0
- package/src/components/table/Table.astro +250 -0
- package/src/components/table/TableBody.astro +18 -0
- package/src/components/table/TableCaption.astro +17 -0
- package/src/components/table/TableCell.astro +21 -0
- package/src/components/table/TableFooter.astro +21 -0
- package/src/components/table/TableHead.astro +21 -0
- package/src/components/table/TableHeader.astro +17 -0
- package/src/components/table/TableRow.astro +21 -0
- package/src/components/table/index.ts +9 -0
- package/src/components/tabs/CHANGELOG.md +5 -0
- package/src/components/tabs/Tabs.astro +306 -0
- package/src/components/tabs/TabsContent.astro +47 -0
- package/src/components/tabs/TabsList.astro +69 -0
- package/src/components/tabs/TabsTrigger.astro +40 -0
- package/src/components/tabs/index.ts +6 -0
- package/src/components/textarea/CHANGELOG.md +5 -0
- package/src/components/textarea/Textarea.astro +36 -0
- package/src/components/textarea/index.ts +2 -0
- package/src/components/toggle/CHANGELOG.md +5 -0
- package/src/components/toggle/Toggle.astro +138 -0
- package/src/components/toggle/index.ts +1 -0
- package/src/components/toggle-group/CHANGELOG.md +5 -0
- package/src/components/toggle-group/ToggleGroup.astro +224 -0
- package/src/components/toggle-group/ToggleGroupItem.astro +48 -0
- package/src/components/toggle-group/index.ts +2 -0
- package/src/components/tooltip/CHANGELOG.md +5 -0
- package/src/components/tooltip/Tooltip.astro +331 -0
- package/src/components/tooltip/TooltipContent.astro +60 -0
- package/src/components/tooltip/TooltipTrigger.astro +34 -0
- package/src/components/tooltip/index.ts +3 -0
- package/src/lib/toggle-group-controller.ts +113 -0
- package/src/lib/toggle-shared.ts +26 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles/globals.css +177 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* @component Popover
|
|
4
|
+
* @title Popover
|
|
5
|
+
* @description A floating panel that appears on trigger click, useful for displaying rich content like forms or additional information.
|
|
6
|
+
*
|
|
7
|
+
* @preview
|
|
8
|
+
* <Popover>
|
|
9
|
+
* <PopoverTrigger variant="outline">Open popover</PopoverTrigger>
|
|
10
|
+
* <PopoverContent>
|
|
11
|
+
* <PopoverHeader>
|
|
12
|
+
* <PopoverTitle>Dimensions</PopoverTitle>
|
|
13
|
+
* <PopoverDescription>Set the dimensions for the layer.</PopoverDescription>
|
|
14
|
+
* </PopoverHeader>
|
|
15
|
+
* <div class="grid gap-2">
|
|
16
|
+
* <div class="grid grid-cols-3 items-center gap-4">
|
|
17
|
+
* <Label>Width</Label>
|
|
18
|
+
* <Input class="col-span-2 h-8" value="100%" />
|
|
19
|
+
* </div>
|
|
20
|
+
* <div class="grid grid-cols-3 items-center gap-4">
|
|
21
|
+
* <Label>Height</Label>
|
|
22
|
+
* <Input class="col-span-2 h-8" value="25px" />
|
|
23
|
+
* </div>
|
|
24
|
+
* </div>
|
|
25
|
+
* </PopoverContent>
|
|
26
|
+
* </Popover>
|
|
27
|
+
*
|
|
28
|
+
* @usage
|
|
29
|
+
*
|
|
30
|
+
* ```astro nocollapse
|
|
31
|
+
* ---
|
|
32
|
+
* import { Popover, PopoverTrigger, PopoverContent, PopoverHeader, PopoverTitle, PopoverDescription } from '@bejamas/ui/components/popover';
|
|
33
|
+
* ---
|
|
34
|
+
*
|
|
35
|
+
* <Popover>
|
|
36
|
+
* <PopoverTrigger variant="outline">Open</PopoverTrigger>
|
|
37
|
+
* <PopoverContent>
|
|
38
|
+
* <PopoverHeader>
|
|
39
|
+
* <PopoverTitle>Title</PopoverTitle>
|
|
40
|
+
* <PopoverDescription>Description text.</PopoverDescription>
|
|
41
|
+
* </PopoverHeader>
|
|
42
|
+
* <p>Popover body content.</p>
|
|
43
|
+
* </PopoverContent>
|
|
44
|
+
* </Popover>
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @api
|
|
48
|
+
*
|
|
49
|
+
* ### Events
|
|
50
|
+
*
|
|
51
|
+
* The popover emits custom events that you can listen to:
|
|
52
|
+
*
|
|
53
|
+
* | Event | Detail | Description |
|
|
54
|
+
* |-------|--------|-------------|
|
|
55
|
+
* | `popover:change` | `{ open: boolean }` | Fired when the popover opens or closes |
|
|
56
|
+
*
|
|
57
|
+
* ```astro nocollapse console
|
|
58
|
+
* <Popover id="my-popover">
|
|
59
|
+
* <PopoverTrigger variant="outline">Open</PopoverTrigger>
|
|
60
|
+
* <PopoverContent>
|
|
61
|
+
* <p>Content</p>
|
|
62
|
+
* </PopoverContent>
|
|
63
|
+
* </Popover>
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* ```js nocollapse
|
|
67
|
+
* const popover = document.getElementById('my-popover');
|
|
68
|
+
*
|
|
69
|
+
* popover.addEventListener('popover:change', (e) => {
|
|
70
|
+
* console.log('Is open:', e.detail.open);
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* ### Programmatic Control
|
|
75
|
+
*
|
|
76
|
+
* You can control the popover programmatically by dispatching a `popover:set` event:
|
|
77
|
+
*
|
|
78
|
+
* ```js nocollapse
|
|
79
|
+
* const popover = document.getElementById('my-popover');
|
|
80
|
+
*
|
|
81
|
+
* // Open the popover
|
|
82
|
+
* popover.dispatchEvent(new CustomEvent('popover:set', {
|
|
83
|
+
* detail: { open: true }
|
|
84
|
+
* }));
|
|
85
|
+
*
|
|
86
|
+
* // Close the popover
|
|
87
|
+
* popover.dispatchEvent(new CustomEvent('popover:set', {
|
|
88
|
+
* detail: { open: false }
|
|
89
|
+
* }));
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* ### Data Attributes
|
|
93
|
+
*
|
|
94
|
+
* The popover sets these data attributes that you can use for styling or querying state:
|
|
95
|
+
*
|
|
96
|
+
* | Attribute | Element | Description |
|
|
97
|
+
* |-----------|---------|-------------|
|
|
98
|
+
* | `data-state` | popover, popover-content | Current state (`open` or `closed`) |
|
|
99
|
+
* | `data-side` | popover, popover-content | Position relative to trigger (`top`, `bottom`, `left`, `right`) |
|
|
100
|
+
* | `data-align` | popover, popover-content | Alignment (`start`, `center`, or `end`) |
|
|
101
|
+
*
|
|
102
|
+
* @examples
|
|
103
|
+
*
|
|
104
|
+
* ### Basic
|
|
105
|
+
*
|
|
106
|
+
* <Popover>
|
|
107
|
+
* <PopoverTrigger variant="outline">Open popover</PopoverTrigger>
|
|
108
|
+
* <PopoverContent>
|
|
109
|
+
* <PopoverHeader>
|
|
110
|
+
* <PopoverTitle>Popover Title</PopoverTitle>
|
|
111
|
+
* <PopoverDescription>This is a simple popover.</PopoverDescription>
|
|
112
|
+
* </PopoverHeader>
|
|
113
|
+
* </PopoverContent>
|
|
114
|
+
* </Popover>
|
|
115
|
+
*
|
|
116
|
+
* ### Side Variants
|
|
117
|
+
*
|
|
118
|
+
* <div class="flex gap-4 items-center justify-center py-8">
|
|
119
|
+
* <Popover>
|
|
120
|
+
* <PopoverTrigger variant="outline">Left</PopoverTrigger>
|
|
121
|
+
* <PopoverContent side="left">
|
|
122
|
+
* <p>Popover on the left</p>
|
|
123
|
+
* </PopoverContent>
|
|
124
|
+
* </Popover>
|
|
125
|
+
* <Popover>
|
|
126
|
+
* <PopoverTrigger variant="outline">Top</PopoverTrigger>
|
|
127
|
+
* <PopoverContent side="top">
|
|
128
|
+
* <p>Popover on top</p>
|
|
129
|
+
* </PopoverContent>
|
|
130
|
+
* </Popover>
|
|
131
|
+
* <Popover>
|
|
132
|
+
* <PopoverTrigger variant="outline">Bottom</PopoverTrigger>
|
|
133
|
+
* <PopoverContent side="bottom">
|
|
134
|
+
* <p>Popover on bottom</p>
|
|
135
|
+
* </PopoverContent>
|
|
136
|
+
* </Popover>
|
|
137
|
+
* <Popover>
|
|
138
|
+
* <PopoverTrigger variant="outline">Right</PopoverTrigger>
|
|
139
|
+
* <PopoverContent side="right">
|
|
140
|
+
* <p>Popover on the right</p>
|
|
141
|
+
* </PopoverContent>
|
|
142
|
+
* </Popover>
|
|
143
|
+
* </div>
|
|
144
|
+
*
|
|
145
|
+
* ### Alignment Variants
|
|
146
|
+
*
|
|
147
|
+
* <div class="flex gap-8">
|
|
148
|
+
* <Popover>
|
|
149
|
+
* <PopoverTrigger variant="outline">Start</PopoverTrigger>
|
|
150
|
+
* <PopoverContent side="bottom" align="start">
|
|
151
|
+
* <p>Start-aligned content</p>
|
|
152
|
+
* </PopoverContent>
|
|
153
|
+
* </Popover>
|
|
154
|
+
* <Popover>
|
|
155
|
+
* <PopoverTrigger variant="outline">Center</PopoverTrigger>
|
|
156
|
+
* <PopoverContent side="bottom" align="center">
|
|
157
|
+
* <p>Center-aligned content</p>
|
|
158
|
+
* </PopoverContent>
|
|
159
|
+
* </Popover>
|
|
160
|
+
* <Popover>
|
|
161
|
+
* <PopoverTrigger variant="outline">End</PopoverTrigger>
|
|
162
|
+
* <PopoverContent side="bottom" align="end">
|
|
163
|
+
* <p>End-aligned content</p>
|
|
164
|
+
* </PopoverContent>
|
|
165
|
+
* </Popover>
|
|
166
|
+
* </div>
|
|
167
|
+
*
|
|
168
|
+
* ### With Form
|
|
169
|
+
*
|
|
170
|
+
* <Popover>
|
|
171
|
+
* <PopoverTrigger variant="outline">Open form</PopoverTrigger>
|
|
172
|
+
* <PopoverContent>
|
|
173
|
+
* <PopoverHeader>
|
|
174
|
+
* <PopoverTitle>Dimensions</PopoverTitle>
|
|
175
|
+
* <PopoverDescription>Set the dimensions for the layer.</PopoverDescription>
|
|
176
|
+
* </PopoverHeader>
|
|
177
|
+
* <div class="grid gap-2">
|
|
178
|
+
* <div class="grid grid-cols-3 items-center gap-4">
|
|
179
|
+
* <Label>Width</Label>
|
|
180
|
+
* <Input class="col-span-2 h-8" value="100%" />
|
|
181
|
+
* </div>
|
|
182
|
+
* <div class="grid grid-cols-3 items-center gap-4">
|
|
183
|
+
* <Label>Height</Label>
|
|
184
|
+
* <Input class="col-span-2 h-8" value="25px" />
|
|
185
|
+
* </div>
|
|
186
|
+
* </div>
|
|
187
|
+
* </PopoverContent>
|
|
188
|
+
* </Popover>
|
|
189
|
+
*/
|
|
190
|
+
|
|
191
|
+
import type { HTMLAttributes } from "astro/types";
|
|
192
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
193
|
+
|
|
194
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
195
|
+
class?: string;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const { class: className = "", ...rest } = Astro.props as Props;
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
<div {...rest} data-slot="popover" class={cn("", "inline-block", className)}>
|
|
202
|
+
<slot />
|
|
203
|
+
</div>
|
|
204
|
+
|
|
205
|
+
<script>
|
|
206
|
+
import { createPopover } from "@data-slot/popover";
|
|
207
|
+
document
|
|
208
|
+
.querySelectorAll('[data-slot="popover"]')
|
|
209
|
+
.forEach((el) => createPopover(el));
|
|
210
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"button"> {
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { class: className = "", ...rest } = Astro.props as Props;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<button
|
|
13
|
+
{...rest}
|
|
14
|
+
data-slot="popover-close"
|
|
15
|
+
class={cn("", className)}
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</button>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
|
|
6
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
7
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
8
|
+
align?: "start" | "center" | "end";
|
|
9
|
+
alignOffset?: number;
|
|
10
|
+
sideOffset?: number;
|
|
11
|
+
class?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
side = "bottom",
|
|
16
|
+
align = "center",
|
|
17
|
+
sideOffset = 6,
|
|
18
|
+
alignOffset = 0,
|
|
19
|
+
class: className = "",
|
|
20
|
+
...rest
|
|
21
|
+
} = Astro.props as Props;
|
|
22
|
+
|
|
23
|
+
const contentVariants = cva([
|
|
24
|
+
"z-50 duration-150 ease transition-discrete outline-hidden flex flex-col",
|
|
25
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
26
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
27
|
+
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
28
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2",
|
|
29
|
+
"origin-(--transform-origin) [--tw-animation-fill-mode:both]",
|
|
30
|
+
]);
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<div
|
|
34
|
+
{...rest}
|
|
35
|
+
hidden
|
|
36
|
+
data-slot="popover-content"
|
|
37
|
+
data-align={align}
|
|
38
|
+
data-align-offset={alignOffset}
|
|
39
|
+
data-side={side}
|
|
40
|
+
data-side-offset={sideOffset}
|
|
41
|
+
style={`--side-offset: ${sideOffset}px`}
|
|
42
|
+
class={cn(
|
|
43
|
+
"bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 flex flex-col gap-4 rounded-md p-4 text-sm shadow-md ring-1 duration-100 rounded-lg data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2",
|
|
44
|
+
contentVariants(),
|
|
45
|
+
className,
|
|
46
|
+
)}
|
|
47
|
+
>
|
|
48
|
+
<slot />
|
|
49
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"p"> {
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { class: className = "", ...rest } = Astro.props as Props;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<p
|
|
13
|
+
{...rest}
|
|
14
|
+
data-slot="popover-description"
|
|
15
|
+
class={cn("text-muted-foreground", className)}
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</p>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { class: className = "", ...rest } = Astro.props as Props;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
{...rest}
|
|
14
|
+
data-slot="popover-header"
|
|
15
|
+
class={cn("flex flex-col gap-1 text-sm", className)}
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { class: className = "", ...rest } = Astro.props as Props;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
{...rest}
|
|
14
|
+
data-slot="popover-title"
|
|
15
|
+
class={cn("font-medium", className)}
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
3
|
+
import { Button } from "../button";
|
|
4
|
+
import type { Props as ButtonProps } from "../button/Button.astro";
|
|
5
|
+
|
|
6
|
+
type Props = ButtonProps & {
|
|
7
|
+
class?: string;
|
|
8
|
+
/** Radix-like: render wrapper so the child can be the interactive element */
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const { class: className = "", asChild = false, ...rest } = Astro.props as Props;
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
{
|
|
16
|
+
asChild ? (
|
|
17
|
+
<div data-slot="popover-trigger" data-as-child class={cn("", "inline-flex items-center", className)}>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
20
|
+
) : (
|
|
21
|
+
<Button
|
|
22
|
+
data-slot="popover-trigger"
|
|
23
|
+
class={cn("", "inline-flex items-center", className)}
|
|
24
|
+
{...rest as any}
|
|
25
|
+
>
|
|
26
|
+
<slot />
|
|
27
|
+
</Button>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as Popover } from "./Popover.astro";
|
|
2
|
+
export { default as PopoverClose } from "./PopoverClose.astro";
|
|
3
|
+
export { default as PopoverContent } from "./PopoverContent.astro";
|
|
4
|
+
export { default as PopoverDescription } from "./PopoverDescription.astro";
|
|
5
|
+
export { default as PopoverHeader } from "./PopoverHeader.astro";
|
|
6
|
+
export { default as PopoverTitle } from "./PopoverTitle.astro";
|
|
7
|
+
export { default as PopoverTrigger } from "./PopoverTrigger.astro";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the `RadioGroup` component will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## Unreleased
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Restored interactivity: `@data-slot/radio-group` (already the correct import in `RadioGroup.astro`) was never added as a dependency and was aliased to a no-op stub so builds wouldn't crash, leaving RadioGroup fully static. Added the real package as a dependency and removed the stub alias.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* @component RadioGroup
|
|
4
|
+
* @title Radio Group
|
|
5
|
+
* @description A group of options where users can select exactly one choice.
|
|
6
|
+
* @figmaUrl https://www.figma.com/design/koxai7zw5vIuBzuVxe5T2l/bejamas-ui?node-id=2549-18817&t=YFStJ3V8fXEO8QD8-4
|
|
7
|
+
*
|
|
8
|
+
* @preview
|
|
9
|
+
*
|
|
10
|
+
* <RadioGroup name="plan" defaultValue="free">
|
|
11
|
+
* <div class="flex items-center gap-2">
|
|
12
|
+
* <RadioGroupItem value="free" id="free" />
|
|
13
|
+
* <Label for="free">Free</Label>
|
|
14
|
+
* </div>
|
|
15
|
+
* <div class="flex items-center gap-2">
|
|
16
|
+
* <RadioGroupItem value="pro" id="pro" />
|
|
17
|
+
* <Label for="pro">Pro</Label>
|
|
18
|
+
* </div>
|
|
19
|
+
* </RadioGroup>
|
|
20
|
+
*
|
|
21
|
+
* @usage
|
|
22
|
+
*
|
|
23
|
+
* ```astro nocollapse
|
|
24
|
+
* ---
|
|
25
|
+
* import { RadioGroup, RadioGroupItem } from '@bejamas/ui/components/radio-group';
|
|
26
|
+
* import { Label } from '@bejamas/ui/components/label';
|
|
27
|
+
* ---
|
|
28
|
+
*
|
|
29
|
+
* <RadioGroup name="plan" defaultValue="free">
|
|
30
|
+
* <div class="flex items-center gap-2">
|
|
31
|
+
* <RadioGroupItem value="free" id="free" />
|
|
32
|
+
* <Label for="free">Free</Label>
|
|
33
|
+
* </div>
|
|
34
|
+
* </RadioGroup>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
import type { HTMLAttributes } from "astro/types";
|
|
38
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
39
|
+
|
|
40
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
41
|
+
class?: string;
|
|
42
|
+
defaultValue?: string;
|
|
43
|
+
name?: string;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
readOnly?: boolean;
|
|
46
|
+
required?: boolean;
|
|
47
|
+
"aria-label"?: string;
|
|
48
|
+
"aria-labelledby"?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const {
|
|
52
|
+
class: className = "",
|
|
53
|
+
defaultValue,
|
|
54
|
+
name,
|
|
55
|
+
disabled = false,
|
|
56
|
+
readOnly = false,
|
|
57
|
+
required = false,
|
|
58
|
+
...rest
|
|
59
|
+
} = Astro.props as Props;
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
<div
|
|
63
|
+
{...rest}
|
|
64
|
+
data-slot="radio-group"
|
|
65
|
+
data-default-value={defaultValue}
|
|
66
|
+
data-name={name}
|
|
67
|
+
data-disabled={disabled ? "true" : undefined}
|
|
68
|
+
data-read-only={readOnly ? "true" : undefined}
|
|
69
|
+
data-required={required ? "true" : undefined}
|
|
70
|
+
class={cn("grid gap-3", className)}
|
|
71
|
+
>
|
|
72
|
+
<slot />
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<script>
|
|
76
|
+
import { createRadioGroup } from "@data-slot/radio-group";
|
|
77
|
+
|
|
78
|
+
document
|
|
79
|
+
.querySelectorAll('[data-slot="radio-group"]')
|
|
80
|
+
.forEach((el) => createRadioGroup(el));
|
|
81
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"span"> {
|
|
6
|
+
value: string;
|
|
7
|
+
class?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
id?: string;
|
|
10
|
+
"aria-invalid"?: boolean | "true" | "false";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
class: className = "",
|
|
15
|
+
id = "",
|
|
16
|
+
value,
|
|
17
|
+
disabled = false,
|
|
18
|
+
"aria-invalid": ariaInvalid,
|
|
19
|
+
...rest
|
|
20
|
+
} = Astro.props as Props;
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<span
|
|
24
|
+
{...rest}
|
|
25
|
+
id={id}
|
|
26
|
+
data-slot="radio-group-item"
|
|
27
|
+
data-value={value}
|
|
28
|
+
data-disabled={disabled ? "true" : undefined}
|
|
29
|
+
aria-invalid={ariaInvalid}
|
|
30
|
+
class={cn(
|
|
31
|
+
"border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 dark:aria-invalid:border-destructive/50 flex size-4 rounded-full focus-visible:ring-3 aria-invalid:ring-3 group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
32
|
+
className,
|
|
33
|
+
)}
|
|
34
|
+
>
|
|
35
|
+
<span
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
data-slot="radio-group-indicator"
|
|
38
|
+
class="flex size-4 items-center justify-center data-unchecked:hidden"
|
|
39
|
+
>
|
|
40
|
+
<span class="bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"></span>
|
|
41
|
+
</span>
|
|
42
|
+
</span>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the `Select` component will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## Date 14th Sep 2026
|
|
6
|
+
## Figma alignment (node 2329-7946) + props audit
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
|
|
10
|
+
- `SelectTrigger`: vertical padding was `py-2` (8px); Figma specifies `py-1` (4px) on all sizes.
|
|
11
|
+
- `SelectTrigger`: `size="lg"` had no explicit height at all (`h-9`/`h-8` were defined, `h-10` for `lg` was missing) — the Large variant silently fell back to whatever height its padding produced instead of Figma's 40px. Added `data-[size=lg]:h-10`.
|
|
12
|
+
- `SelectTrigger`: focus-visible style used the plain-form-field pattern (`ring-ring/50`, opacity-blended). Figma's focus state is a solid `border-ring` + 2px `chart-1` shadow — the same "interactive control" pattern already used by `Button`, `Card`, and `DropdownMenuItem`. Switched to `focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-chart-1`.
|
|
13
|
+
- `SelectTrigger`: disabled state relied only on `opacity-50`. Figma shows an explicit muted background/text. Added `disabled:bg-muted disabled:text-muted-foreground`, matching `Input`'s existing disabled convention.
|
|
14
|
+
- `SelectTrigger`: removed a stray `-mr-0.75` negative margin on the chevron icon (not present in Figma) and dropped a few classes that `cn()`/tailwind-merge were already silently overriding (`rounded-md`, `pr-2`, `pl-2.5`).
|
|
15
|
+
- `SelectItem`: `rounded-sm` → `rounded-lg` and `text-xs` → `text-sm`, matching Figma's 8px item radius and 14px item text — `ComboboxItem` already used the correct values, `SelectItem` had drifted from it.
|
|
16
|
+
- `SelectContent`: the viewport had no padding at all unless items were wrapped in a `SelectGroup` (which carries its own `p-1`). A plain, ungrouped item list — the common case — sat flush against the popover's rounded corners. Added `p-1 gap-1` to the viewport so grouped and ungrouped content both get consistent spacing.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **`size` now actually propagates.** `Select`, `SelectTrigger`, and `SelectContent` each declared an independent `size` prop, but nothing ever synced them — `data-size` on the `Select` wrapper was purely decorative (confirmed by tracing `@data-slot/select`'s compiled runtime, which syncs `disabled` and `defaultValue` from the wrapper but never touched `size`). Setting `size="lg"` only on `<Select>` — the one place a consumer would naturally expect to control it — had zero visual effect. `Select`'s mount script now mirrors its `data-size` onto its `SelectTrigger` descendant at runtime, so `size` set on `<Select>` is authoritative; `SelectTrigger`'s own `size` prop is still available for standalone use outside a `Select` wrapper.
|
|
21
|
+
- Removed the unused `size` prop from `SelectContent` — nothing in its class list ever branched on it, and Figma doesn't vary dropdown-item sizing by Select size either. A prop with no effect is worse than no prop for a team that needs to know which controls actually do something.
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- `Select`'s JSDoc now documents every sub-component's props in an `@api` table (mirroring `Field`'s format), and calls out which state is auto-synced from `<Select>` (`disabled`, `defaultValue`, and now `size`) versus what must be set per sub-component.
|
|
26
|
+
- Added a "With Label" example to `Select`'s JSDoc and to its Storybook page. `Select` has no label prop by design — label pairing stays composition-only via `Label`/`FieldLabel`, the same convention `Input` already uses (also already documented as the recommended pairing in `Field`'s own docs).
|
|
27
|
+
|
|
28
|
+
### Not changed (checked, no gap found)
|
|
29
|
+
|
|
30
|
+
- `border-input` resolves to the same `zinc-200` as `--border` — already matches Figma.
|
|
31
|
+
- The trigger's Hover state is visually identical to Default in light mode in Figma — matches the component's existing dark-mode-only hover classes.
|
|
32
|
+
- Figma renders item hover text as `accent-foreground`; the code uses `foreground`. Left as-is since `ComboboxItem` makes the same choice — a consistent system-wide simplification, not a `Select`-specific bug.
|
|
33
|
+
- `disabled` on `<Select>` already correctly disables `SelectTrigger` at runtime (unlike `size`) — no fix needed, just now documented explicitly.
|
|
34
|
+
|
|
35
|
+
## Unreleased
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- Restored interactivity: the component's `<script>` was importing its runtime behavior from `@repo/lib/select`, a module that never existed in this repo — it was aliased to a no-op stub so builds wouldn't crash, leaving Select fully static. Fixed the import to point at `@data-slot/select` (the real published package the component's API already matched) and added it as a dependency. Select now opens/closes, supports keyboard navigation, and fires `select:change` / `select:open-change` as designed.
|