@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,226 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* @component DropdownMenu
|
|
4
|
+
* @title Dropdown Menu
|
|
5
|
+
* @description Action and selection menus with runtime-owned open, highlight, and committed selection state.
|
|
6
|
+
*@figmaUrl https://www.figma.com/design/qXkzdqZ3QPQqgckU3AwIAH/ClickLearn-Lightning-Design-Library?node-id=2329-6521
|
|
7
|
+
*
|
|
8
|
+
* @preview
|
|
9
|
+
* <DropdownMenu defaultValue="pro">
|
|
10
|
+
* <DropdownMenuTrigger variant="outline">Open</DropdownMenuTrigger>
|
|
11
|
+
* <DropdownMenuContent align="start">
|
|
12
|
+
* <DropdownMenuLabel>Plans</DropdownMenuLabel>
|
|
13
|
+
* <DropdownMenuGroup>
|
|
14
|
+
* <DropdownMenuRadioItem value="starter">Starter</DropdownMenuRadioItem>
|
|
15
|
+
* <DropdownMenuRadioItem value="pro">Pro</DropdownMenuRadioItem>
|
|
16
|
+
* </DropdownMenuGroup>
|
|
17
|
+
* </DropdownMenuContent>
|
|
18
|
+
* </DropdownMenu>
|
|
19
|
+
*
|
|
20
|
+
* @usage
|
|
21
|
+
*
|
|
22
|
+
* ```astro nocollapse
|
|
23
|
+
* ---
|
|
24
|
+
* import {
|
|
25
|
+
* DropdownMenu,
|
|
26
|
+
* DropdownMenuTrigger,
|
|
27
|
+
* DropdownMenuContent,
|
|
28
|
+
* DropdownMenuItem,
|
|
29
|
+
* DropdownMenuRadioItem,
|
|
30
|
+
* } from '@bejamas/ui/components/dropdown-menu';
|
|
31
|
+
* ---
|
|
32
|
+
*
|
|
33
|
+
* <DropdownMenu>
|
|
34
|
+
* <DropdownMenuTrigger variant="outline">Menu</DropdownMenuTrigger>
|
|
35
|
+
* <DropdownMenuContent>
|
|
36
|
+
* <DropdownMenuItem>Item 1</DropdownMenuItem>
|
|
37
|
+
* </DropdownMenuContent>
|
|
38
|
+
* </DropdownMenu>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @api
|
|
42
|
+
*
|
|
43
|
+
* ### Events
|
|
44
|
+
*
|
|
45
|
+
* The dropdown menu emits custom events that you can listen to:
|
|
46
|
+
*
|
|
47
|
+
* | Event | Detail | Description |
|
|
48
|
+
* |-------|--------|-------------|
|
|
49
|
+
* | `dropdown-menu:open-change` | `{ open, previousOpen, source, reason }` | Fired on real open-state changes |
|
|
50
|
+
* | `dropdown-menu:change` | same detail | Deprecated alias for `dropdown-menu:open-change` |
|
|
51
|
+
* | `dropdown-menu:highlight-change` | `{ value, previousValue, item, previousItem, source }` | Fired when highlight changes |
|
|
52
|
+
* | `dropdown-menu:select` | `{ value, item, itemType, source, checked? }` | Cancelable user activation event fired before commit |
|
|
53
|
+
* | `dropdown-menu:value-change` | `{ value, previousValue, item, previousItem, source }` | Fired when radio selection commits |
|
|
54
|
+
* | `dropdown-menu:values-change` | `{ values, previousValues, changedValue, checked, item, source }` | Fired when checkbox selection commits |
|
|
55
|
+
*
|
|
56
|
+
* ```astro nocollapse
|
|
57
|
+
* <DropdownMenu id="my-dropdown" defaultValue="edit">
|
|
58
|
+
* <DropdownMenuTrigger>Menu</DropdownMenuTrigger>
|
|
59
|
+
* <DropdownMenuContent>
|
|
60
|
+
* <DropdownMenuRadioItem value="edit">Edit</DropdownMenuRadioItem>
|
|
61
|
+
* <DropdownMenuRadioItem value="delete">Delete</DropdownMenuRadioItem>
|
|
62
|
+
* </DropdownMenuContent>
|
|
63
|
+
* </DropdownMenu>
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* ```js nocollapse
|
|
67
|
+
* const dropdown = document.getElementById('my-dropdown');
|
|
68
|
+
*
|
|
69
|
+
* dropdown.addEventListener('dropdown-menu:open-change', (e) => {
|
|
70
|
+
* console.log('Is open:', e.detail.open);
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* dropdown.addEventListener('dropdown-menu:value-change', (e) => {
|
|
74
|
+
* console.log('Selected:', e.detail.value);
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* ### Programmatic Control
|
|
79
|
+
*
|
|
80
|
+
* You can control the dropdown menu programmatically by dispatching a `dropdown-menu:set` event:
|
|
81
|
+
*
|
|
82
|
+
* ```js nocollapse
|
|
83
|
+
* const dropdown = document.getElementById('my-dropdown');
|
|
84
|
+
*
|
|
85
|
+
* // Open the dropdown menu
|
|
86
|
+
* dropdown.dispatchEvent(new CustomEvent('dropdown-menu:set', {
|
|
87
|
+
* detail: { open: true }
|
|
88
|
+
* }));
|
|
89
|
+
*
|
|
90
|
+
* // Commit radio selection
|
|
91
|
+
* dropdown.dispatchEvent(new CustomEvent('dropdown-menu:set', {
|
|
92
|
+
* detail: { value: 'delete', source: 'restore' }
|
|
93
|
+
* }));
|
|
94
|
+
*
|
|
95
|
+
* // Commit checkbox selection
|
|
96
|
+
* dropdown.dispatchEvent(new CustomEvent('dropdown-menu:set', {
|
|
97
|
+
* detail: { values: ['email', 'push'], source: 'restore' }
|
|
98
|
+
* }));
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* ### Structural Wrappers
|
|
102
|
+
*
|
|
103
|
+
* `DropdownMenuPortal` and `DropdownMenuRadioGroup` are available for low-level authored markup.
|
|
104
|
+
* Most consumers should keep using `DropdownMenuContent` directly.
|
|
105
|
+
*
|
|
106
|
+
* ### Data Attributes
|
|
107
|
+
*
|
|
108
|
+
* The dropdown menu sets these data attributes that you can use for styling or querying state:
|
|
109
|
+
*
|
|
110
|
+
* | Attribute | Element | Description |
|
|
111
|
+
* |-----------|---------|-------------|
|
|
112
|
+
* | `data-state` | dropdown-menu, dropdown-menu-content | Current state (`open` or `closed`) |
|
|
113
|
+
* | `data-value` | dropdown-menu | Current committed radio value |
|
|
114
|
+
* | `data-variant` | dropdown-menu-item | Visual variant (`default` or `destructive`) |
|
|
115
|
+
* | `data-side` | dropdown-menu-content | Computed position (`top`, `right`, `bottom`, or `left`) |
|
|
116
|
+
* | `data-align` | dropdown-menu-content | Alignment (`start`, `center`, or `end`) |
|
|
117
|
+
* | `data-highlighted` | menu items | Present when item is focused |
|
|
118
|
+
* | `data-checked` | radio and checkbox items | Present when item is committed as checked |
|
|
119
|
+
* | `data-disabled` | menu items | Present when item is disabled |
|
|
120
|
+
*
|
|
121
|
+
* @examples
|
|
122
|
+
*
|
|
123
|
+
* ### Action Menu
|
|
124
|
+
*
|
|
125
|
+
* <DropdownMenu>
|
|
126
|
+
* <Button variant="outline" data-slot="dropdown-menu-trigger" class="">Account</Button>
|
|
127
|
+
* <DropdownMenuContent>
|
|
128
|
+
* <DropdownMenuLabel>Actions</DropdownMenuLabel>
|
|
129
|
+
* <DropdownMenuGroup>
|
|
130
|
+
* <DropdownMenuItem>Edit</DropdownMenuItem>
|
|
131
|
+
* <DropdownMenuItem>Duplicate</DropdownMenuItem>
|
|
132
|
+
* </DropdownMenuGroup>
|
|
133
|
+
* <DropdownMenuSeparator />
|
|
134
|
+
* <DropdownMenuItem>Delete</DropdownMenuItem>
|
|
135
|
+
* </DropdownMenuContent>
|
|
136
|
+
* </DropdownMenu>
|
|
137
|
+
*
|
|
138
|
+
* ### Single Select
|
|
139
|
+
*
|
|
140
|
+
* <DropdownMenu defaultValue="pro">
|
|
141
|
+
* <Button variant="outline" data-slot="dropdown-menu-trigger" class="">Plan</Button>
|
|
142
|
+
* <DropdownMenuContent>
|
|
143
|
+
* <DropdownMenuRadioItem value="starter">Starter</DropdownMenuRadioItem>
|
|
144
|
+
* <DropdownMenuRadioItem value="pro">Pro</DropdownMenuRadioItem>
|
|
145
|
+
* <DropdownMenuRadioItem value="team">Team</DropdownMenuRadioItem>
|
|
146
|
+
* </DropdownMenuContent>
|
|
147
|
+
* </DropdownMenu>
|
|
148
|
+
*
|
|
149
|
+
* ### Multi Select
|
|
150
|
+
*
|
|
151
|
+
* <DropdownMenu defaultValues={["email", "push"]} closeOnSelect={false}>
|
|
152
|
+
* <Button variant="outline" data-slot="dropdown-menu-trigger" class="">Notifications</Button>
|
|
153
|
+
* <DropdownMenuContent>
|
|
154
|
+
* <DropdownMenuCheckboxItem value="email">Email</DropdownMenuCheckboxItem>
|
|
155
|
+
* <DropdownMenuCheckboxItem value="sms">SMS</DropdownMenuCheckboxItem>
|
|
156
|
+
* <DropdownMenuCheckboxItem value="push">Push</DropdownMenuCheckboxItem>
|
|
157
|
+
* </DropdownMenuContent>
|
|
158
|
+
* </DropdownMenu>
|
|
159
|
+
*/
|
|
160
|
+
|
|
161
|
+
import type { HTMLAttributes } from "astro/types";
|
|
162
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
163
|
+
|
|
164
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
165
|
+
defaultOpen?: boolean;
|
|
166
|
+
defaultValue?: string | null;
|
|
167
|
+
defaultValues?: string[];
|
|
168
|
+
closeOnClickOutside?: boolean;
|
|
169
|
+
closeOnEscape?: boolean;
|
|
170
|
+
closeOnSelect?: boolean;
|
|
171
|
+
lockScroll?: boolean;
|
|
172
|
+
highlightItemOnHover?: boolean;
|
|
173
|
+
class?: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const {
|
|
177
|
+
defaultOpen,
|
|
178
|
+
defaultValue,
|
|
179
|
+
defaultValues,
|
|
180
|
+
closeOnClickOutside,
|
|
181
|
+
closeOnEscape,
|
|
182
|
+
closeOnSelect,
|
|
183
|
+
lockScroll,
|
|
184
|
+
highlightItemOnHover,
|
|
185
|
+
class: className = "",
|
|
186
|
+
...rest
|
|
187
|
+
} = Astro.props as Props;
|
|
188
|
+
|
|
189
|
+
const hasProp = (name: keyof Props) =>
|
|
190
|
+
Object.prototype.hasOwnProperty.call(Astro.props, name);
|
|
191
|
+
const defaultValuesJson =
|
|
192
|
+
defaultValues !== undefined ? JSON.stringify(defaultValues) : undefined;
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
<div
|
|
196
|
+
{...rest}
|
|
197
|
+
data-slot="dropdown-menu"
|
|
198
|
+
data-default-open={hasProp("defaultOpen") ? String(!!defaultOpen) : undefined}
|
|
199
|
+
data-default-value={defaultValue ?? undefined}
|
|
200
|
+
data-default-values={defaultValuesJson}
|
|
201
|
+
data-close-on-click-outside={
|
|
202
|
+
hasProp("closeOnClickOutside") ? String(!!closeOnClickOutside) : undefined
|
|
203
|
+
}
|
|
204
|
+
data-close-on-escape={
|
|
205
|
+
hasProp("closeOnEscape") ? String(!!closeOnEscape) : undefined
|
|
206
|
+
}
|
|
207
|
+
data-close-on-select={
|
|
208
|
+
hasProp("closeOnSelect") ? String(!!closeOnSelect) : undefined
|
|
209
|
+
}
|
|
210
|
+
data-lock-scroll={hasProp("lockScroll") ? String(!!lockScroll) : undefined}
|
|
211
|
+
data-highlight-item-on-hover={
|
|
212
|
+
hasProp("highlightItemOnHover")
|
|
213
|
+
? String(!!highlightItemOnHover)
|
|
214
|
+
: undefined
|
|
215
|
+
}
|
|
216
|
+
class={cn("", "group/dropdown-menu relative inline-block", className)}
|
|
217
|
+
>
|
|
218
|
+
<slot />
|
|
219
|
+
</div>
|
|
220
|
+
|
|
221
|
+
<script>
|
|
222
|
+
import { createDropdownMenu } from "@data-slot/dropdown-menu";
|
|
223
|
+
document
|
|
224
|
+
.querySelectorAll('[data-slot="dropdown-menu"]')
|
|
225
|
+
.forEach((el) => createDropdownMenu(el));
|
|
226
|
+
</script>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* @component DropdownMenuCheckboxItem
|
|
4
|
+
* @title Dropdown Menu Checkbox Item
|
|
5
|
+
* @description A real, interactive `menuitemcheckbox` row — checked state is tracked by the DropdownMenu runtime, not by this component.
|
|
6
|
+
* @figmaUrl https://www.figma.com/design/qXkzdqZ3QPQqgckU3AwIAH/ClickLearn-Lightning-Design-Library?node-id=7392-10142
|
|
7
|
+
*
|
|
8
|
+
* @usage
|
|
9
|
+
*
|
|
10
|
+
* ```astro nocollapse
|
|
11
|
+
* ---
|
|
12
|
+
* import { DropdownMenuCheckboxItem } from '@bejamas/ui/components/dropdown-menu';
|
|
13
|
+
* ---
|
|
14
|
+
*
|
|
15
|
+
* <DropdownMenuCheckboxItem value="email">Email</DropdownMenuCheckboxItem>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* For a purely decorative checkbox glyph on a plain, non-interactive row, use `DropdownMenuItem`'s
|
|
19
|
+
* own `showCheckbox`/`checked` props instead — this component is for real, runtime-managed selection.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import type { HTMLAttributes } from "astro/types";
|
|
23
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
24
|
+
import { itemVariants } from "./dropdown-menu-item-variants";
|
|
25
|
+
import DropdownMenuItemContent from "./DropdownMenuItemContent.astro";
|
|
26
|
+
|
|
27
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
inset?: boolean;
|
|
30
|
+
value: string;
|
|
31
|
+
defaultChecked?: boolean;
|
|
32
|
+
leadingIcon?: boolean;
|
|
33
|
+
avatar?: boolean;
|
|
34
|
+
showBadge?: boolean;
|
|
35
|
+
showSubmenuIcon?: boolean;
|
|
36
|
+
supportiveText?: boolean;
|
|
37
|
+
class?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const hasLeadingIconSlot = Astro.slots.has("leading-icon");
|
|
41
|
+
const hasAvatarSlot = Astro.slots.has("avatar");
|
|
42
|
+
const hasBadgeSlot = Astro.slots.has("badge");
|
|
43
|
+
const hasSupportiveTextSlot = Astro.slots.has("supportive-text");
|
|
44
|
+
|
|
45
|
+
const {
|
|
46
|
+
disabled = false,
|
|
47
|
+
inset = false,
|
|
48
|
+
value,
|
|
49
|
+
defaultChecked = false,
|
|
50
|
+
leadingIcon = hasLeadingIconSlot,
|
|
51
|
+
avatar = hasAvatarSlot,
|
|
52
|
+
showBadge = hasBadgeSlot,
|
|
53
|
+
showSubmenuIcon = false,
|
|
54
|
+
supportiveText = hasSupportiveTextSlot,
|
|
55
|
+
class: className = "",
|
|
56
|
+
...rest
|
|
57
|
+
} = Astro.props as Props;
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
<div
|
|
61
|
+
{...rest}
|
|
62
|
+
role="menuitemcheckbox"
|
|
63
|
+
tabindex={disabled ? -1 : 0}
|
|
64
|
+
data-slot="dropdown-menu-checkbox-item"
|
|
65
|
+
data-value={value}
|
|
66
|
+
data-disabled={disabled ? "" : undefined}
|
|
67
|
+
data-inset={inset ? "" : undefined}
|
|
68
|
+
data-default-checked={defaultChecked ? "" : undefined}
|
|
69
|
+
class={cn(itemVariants({ variant: "default" }), className)}
|
|
70
|
+
>
|
|
71
|
+
<DropdownMenuItemContent
|
|
72
|
+
hasLeadingControl
|
|
73
|
+
leadingIcon={leadingIcon}
|
|
74
|
+
avatar={avatar}
|
|
75
|
+
showBadge={showBadge}
|
|
76
|
+
showSubmenuIcon={showSubmenuIcon}
|
|
77
|
+
supportiveText={supportiveText}
|
|
78
|
+
>
|
|
79
|
+
<span
|
|
80
|
+
slot="leading-control"
|
|
81
|
+
data-slot="dropdown-menu-checkbox-item-indicator"
|
|
82
|
+
class="border-input group-data-checked/dropdown-menu-item:border-primary group-data-checked/dropdown-menu-item:bg-primary relative flex size-5 shrink-0 items-center justify-center rounded-sm border transition-colors"
|
|
83
|
+
aria-hidden="true"
|
|
84
|
+
>
|
|
85
|
+
<svg
|
|
86
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
87
|
+
viewBox="0 0 24 24"
|
|
88
|
+
class="text-primary-foreground size-3.5 opacity-0 transition-opacity group-data-checked/dropdown-menu-item:opacity-100"
|
|
89
|
+
>
|
|
90
|
+
<path
|
|
91
|
+
fill="none"
|
|
92
|
+
stroke="currentColor"
|
|
93
|
+
stroke-linecap="round"
|
|
94
|
+
stroke-linejoin="round"
|
|
95
|
+
stroke-width="2"
|
|
96
|
+
d="M20 6L9 17l-5-5"
|
|
97
|
+
/>
|
|
98
|
+
</svg>
|
|
99
|
+
</span>
|
|
100
|
+
<slot />
|
|
101
|
+
<Fragment slot="supportive-text">
|
|
102
|
+
<slot name="supportive-text" />
|
|
103
|
+
</Fragment>
|
|
104
|
+
<Fragment slot="leading-icon">
|
|
105
|
+
<slot name="leading-icon" />
|
|
106
|
+
</Fragment>
|
|
107
|
+
<Fragment slot="avatar">
|
|
108
|
+
<slot name="avatar" />
|
|
109
|
+
</Fragment>
|
|
110
|
+
<Fragment slot="badge">
|
|
111
|
+
<slot name="badge" />
|
|
112
|
+
</Fragment>
|
|
113
|
+
</DropdownMenuItemContent>
|
|
114
|
+
</div>
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
align?: "start" | "center" | "end";
|
|
7
|
+
alignOffset?: number;
|
|
8
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
9
|
+
sideOffset?: number;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
align = "start",
|
|
15
|
+
alignOffset = 0,
|
|
16
|
+
side = "bottom",
|
|
17
|
+
sideOffset = 4,
|
|
18
|
+
class: className = "",
|
|
19
|
+
...rest
|
|
20
|
+
} = Astro.props as Props;
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<div data-slot="dropdown-menu-portal">
|
|
24
|
+
<div data-slot="dropdown-menu-positioner" class="isolate z-50 outline-none">
|
|
25
|
+
<div
|
|
26
|
+
{...rest}
|
|
27
|
+
hidden
|
|
28
|
+
data-slot="dropdown-menu-content"
|
|
29
|
+
data-align={align}
|
|
30
|
+
data-align-offset={alignOffset}
|
|
31
|
+
data-side={side}
|
|
32
|
+
data-side-offset={sideOffset}
|
|
33
|
+
class={cn(
|
|
34
|
+
"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 border-border bg-popover text-popover-foreground flex min-w-32 flex-col gap-1.5 rounded-lg border p-2 shadow-[0.3px_2px_4px_-2.2px_#1F003B05,0.5px_3.2px_3px_-1.4px_#1F003B08,0.7px_4px_2.5px_-1.8px_#1F003B0F] duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 z-50 max-h-[var(--available-height)] w-[var(--anchor-width)] origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-[state=closed]:overflow-hidden no-scrollbar overscroll-none",
|
|
35
|
+
"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",
|
|
36
|
+
className,
|
|
37
|
+
)}
|
|
38
|
+
>
|
|
39
|
+
<slot />
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
role="group"
|
|
15
|
+
data-slot="dropdown-menu-group"
|
|
16
|
+
class={cn("", "", className)}
|
|
17
|
+
>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* @component DropdownMenuItem
|
|
4
|
+
* @title Dropdown Menu Item
|
|
5
|
+
* @description A selectable row inside a DropdownMenuContent, with optional leading icon/avatar/checkbox/radio and trailing badge/submenu affordance.
|
|
6
|
+
* @figmaUrl https://www.figma.com/design/qXkzdqZ3QPQqgckU3AwIAH/ClickLearn-Lightning-Design-Library?node-id=7392-10142
|
|
7
|
+
*
|
|
8
|
+
* @preview
|
|
9
|
+
*
|
|
10
|
+
* <DropdownMenu defaultOpen>
|
|
11
|
+
* <DropdownMenuTrigger variant="outline">Menu</DropdownMenuTrigger>
|
|
12
|
+
* <DropdownMenuContent class="static block" align="start">
|
|
13
|
+
* <DropdownMenuItem leadingIcon>
|
|
14
|
+
* <UserIcon slot="leading-icon" />
|
|
15
|
+
* Profile
|
|
16
|
+
* </DropdownMenuItem>
|
|
17
|
+
* <DropdownMenuItem supportiveText>
|
|
18
|
+
* Export
|
|
19
|
+
* <span slot="supportive-text">as CSV</span>
|
|
20
|
+
* </DropdownMenuItem>
|
|
21
|
+
* <DropdownMenuItem variant="destructive">Delete</DropdownMenuItem>
|
|
22
|
+
* </DropdownMenuContent>
|
|
23
|
+
* </DropdownMenu>
|
|
24
|
+
*
|
|
25
|
+
* @usage
|
|
26
|
+
*
|
|
27
|
+
* ```astro nocollapse
|
|
28
|
+
* ---
|
|
29
|
+
* import { DropdownMenuItem } from '@bejamas/ui/components/dropdown-menu';
|
|
30
|
+
* ---
|
|
31
|
+
*
|
|
32
|
+
* <DropdownMenuItem>Edit</DropdownMenuItem>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @examples
|
|
36
|
+
*
|
|
37
|
+
* ### With leading icon
|
|
38
|
+
*
|
|
39
|
+
* <DropdownMenuItem leadingIcon>
|
|
40
|
+
* <UserIcon slot="leading-icon" />
|
|
41
|
+
* Profile
|
|
42
|
+
* </DropdownMenuItem>
|
|
43
|
+
*
|
|
44
|
+
* ### With avatar
|
|
45
|
+
*
|
|
46
|
+
* Pass an `<Avatar size="sm">` (24px) into the `avatar` slot — it already matches Figma's item avatar size, no extra sizing needed.
|
|
47
|
+
*
|
|
48
|
+
* <DropdownMenuItem avatar>
|
|
49
|
+
* <Avatar size="sm" slot="avatar">
|
|
50
|
+
* <AvatarImage src="https://github.com/thomkrupa.png" alt="Thom Krupa" />
|
|
51
|
+
* <AvatarFallback>TK</AvatarFallback>
|
|
52
|
+
* </Avatar>
|
|
53
|
+
* Thom Krupa
|
|
54
|
+
* </DropdownMenuItem>
|
|
55
|
+
*
|
|
56
|
+
* ### With supportive text
|
|
57
|
+
*
|
|
58
|
+
* <DropdownMenuItem supportiveText>
|
|
59
|
+
* Export
|
|
60
|
+
* <span slot="supportive-text">as CSV</span>
|
|
61
|
+
* </DropdownMenuItem>
|
|
62
|
+
*
|
|
63
|
+
* ### With badge
|
|
64
|
+
*
|
|
65
|
+
* Pass a `<Badge size="sm">` into the `badge` slot.
|
|
66
|
+
*
|
|
67
|
+
* <DropdownMenuItem showBadge>
|
|
68
|
+
* Notifications
|
|
69
|
+
* <Badge size="sm" slot="badge">3</Badge>
|
|
70
|
+
* </DropdownMenuItem>
|
|
71
|
+
*
|
|
72
|
+
* ### With checkbox / radio (presentational only)
|
|
73
|
+
*
|
|
74
|
+
* `showCheckbox`/`showRadio` on `DropdownMenuItem` are decorative — they draw the glyph but do not
|
|
75
|
+
* manage checked/selected state or emit events. For a real, interactive `menuitemcheckbox`/`menuitemradio`
|
|
76
|
+
* row, use `DropdownMenuCheckboxItem`/`DropdownMenuRadioItem` instead.
|
|
77
|
+
*
|
|
78
|
+
* <DropdownMenuItem showCheckbox checked>Show hidden files</DropdownMenuItem>
|
|
79
|
+
* <DropdownMenuItem showRadio checked>Compact view</DropdownMenuItem>
|
|
80
|
+
*
|
|
81
|
+
* ### Submenu affordance
|
|
82
|
+
*
|
|
83
|
+
* `showSubmenuIcon` is cosmetic only in this release — it doesn't open a nested menu (no submenu infrastructure exists yet).
|
|
84
|
+
*
|
|
85
|
+
* <DropdownMenuItem showSubmenuIcon>More tools</DropdownMenuItem>
|
|
86
|
+
*
|
|
87
|
+
* ### Category
|
|
88
|
+
*
|
|
89
|
+
* Non-interactive section label. Pair with `DropdownMenuSeparator` if you want a divider below it.
|
|
90
|
+
*
|
|
91
|
+
* <DropdownMenuItem variant="category">Recent</DropdownMenuItem>
|
|
92
|
+
*
|
|
93
|
+
* ### Destructive
|
|
94
|
+
*
|
|
95
|
+
* <DropdownMenuItem variant="destructive">Delete</DropdownMenuItem>
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
import type { HTMLAttributes } from "astro/types";
|
|
99
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
100
|
+
import { itemVariants, type ItemVariant } from "./dropdown-menu-item-variants";
|
|
101
|
+
import DropdownMenuItemContent from "./DropdownMenuItemContent.astro";
|
|
102
|
+
|
|
103
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
inset?: boolean;
|
|
106
|
+
value?: string;
|
|
107
|
+
variant?: ItemVariant;
|
|
108
|
+
checked?: boolean;
|
|
109
|
+
showCheckbox?: boolean;
|
|
110
|
+
showRadio?: boolean;
|
|
111
|
+
leadingIcon?: boolean;
|
|
112
|
+
avatar?: boolean;
|
|
113
|
+
showBadge?: boolean;
|
|
114
|
+
showSubmenuIcon?: boolean;
|
|
115
|
+
supportiveText?: boolean;
|
|
116
|
+
class?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const hasLeadingIconSlot = Astro.slots.has("leading-icon");
|
|
120
|
+
const hasAvatarSlot = Astro.slots.has("avatar");
|
|
121
|
+
const hasBadgeSlot = Astro.slots.has("badge");
|
|
122
|
+
const hasSupportiveTextSlot = Astro.slots.has("supportive-text");
|
|
123
|
+
|
|
124
|
+
const {
|
|
125
|
+
disabled = false,
|
|
126
|
+
inset = false,
|
|
127
|
+
value,
|
|
128
|
+
variant = "default",
|
|
129
|
+
checked = false,
|
|
130
|
+
showCheckbox = false,
|
|
131
|
+
showRadio = false,
|
|
132
|
+
leadingIcon = hasLeadingIconSlot,
|
|
133
|
+
avatar = hasAvatarSlot,
|
|
134
|
+
showBadge = hasBadgeSlot,
|
|
135
|
+
showSubmenuIcon = false,
|
|
136
|
+
supportiveText = hasSupportiveTextSlot,
|
|
137
|
+
class: className = "",
|
|
138
|
+
...rest
|
|
139
|
+
} = Astro.props as Props;
|
|
140
|
+
|
|
141
|
+
const isCategory = variant === "category";
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
<div
|
|
145
|
+
{...rest}
|
|
146
|
+
role={isCategory ? "presentation" : "menuitem"}
|
|
147
|
+
tabindex={isCategory || disabled ? -1 : 0}
|
|
148
|
+
data-slot="dropdown-menu-item"
|
|
149
|
+
data-value={value}
|
|
150
|
+
data-disabled={disabled ? "" : undefined}
|
|
151
|
+
data-inset={inset ? "" : undefined}
|
|
152
|
+
data-checked={checked ? "" : undefined}
|
|
153
|
+
data-variant={variant}
|
|
154
|
+
class={cn(itemVariants({ variant }), className)}
|
|
155
|
+
>
|
|
156
|
+
<DropdownMenuItemContent
|
|
157
|
+
isCategory={isCategory}
|
|
158
|
+
hasLeadingControl={showCheckbox || showRadio}
|
|
159
|
+
leadingIcon={leadingIcon}
|
|
160
|
+
avatar={avatar}
|
|
161
|
+
showBadge={showBadge}
|
|
162
|
+
showSubmenuIcon={showSubmenuIcon}
|
|
163
|
+
supportiveText={supportiveText}
|
|
164
|
+
>
|
|
165
|
+
{
|
|
166
|
+
showCheckbox && (
|
|
167
|
+
<span
|
|
168
|
+
slot="leading-control"
|
|
169
|
+
data-slot="dropdown-menu-item-checkbox"
|
|
170
|
+
class={cn(
|
|
171
|
+
"border-input relative flex size-5 shrink-0 items-center justify-center rounded-sm border transition-colors",
|
|
172
|
+
checked && "border-primary bg-primary",
|
|
173
|
+
)}
|
|
174
|
+
aria-hidden="true"
|
|
175
|
+
>
|
|
176
|
+
{checked && (
|
|
177
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="text-primary-foreground size-3.5">
|
|
178
|
+
<path
|
|
179
|
+
fill="none"
|
|
180
|
+
stroke="currentColor"
|
|
181
|
+
stroke-linecap="round"
|
|
182
|
+
stroke-linejoin="round"
|
|
183
|
+
stroke-width="2"
|
|
184
|
+
d="M20 6L9 17l-5-5"
|
|
185
|
+
/>
|
|
186
|
+
</svg>
|
|
187
|
+
)}
|
|
188
|
+
</span>
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
{
|
|
192
|
+
showRadio && (
|
|
193
|
+
<span
|
|
194
|
+
slot="leading-control"
|
|
195
|
+
data-slot="dropdown-menu-item-radio"
|
|
196
|
+
class={cn(
|
|
197
|
+
"border-input relative flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors",
|
|
198
|
+
checked && "border-primary bg-primary",
|
|
199
|
+
)}
|
|
200
|
+
aria-hidden="true"
|
|
201
|
+
>
|
|
202
|
+
{checked && <span class="bg-primary-foreground size-2 rounded-full" />}
|
|
203
|
+
</span>
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
<slot />
|
|
207
|
+
<Fragment slot="supportive-text">
|
|
208
|
+
<slot name="supportive-text" />
|
|
209
|
+
</Fragment>
|
|
210
|
+
<Fragment slot="leading-icon">
|
|
211
|
+
<slot name="leading-icon" />
|
|
212
|
+
</Fragment>
|
|
213
|
+
<Fragment slot="avatar">
|
|
214
|
+
<slot name="avatar" />
|
|
215
|
+
</Fragment>
|
|
216
|
+
<Fragment slot="badge">
|
|
217
|
+
<slot name="badge" />
|
|
218
|
+
</Fragment>
|
|
219
|
+
</DropdownMenuItemContent>
|
|
220
|
+
</div>
|