@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,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
4
|
+
import type { HTMLAttributes } from "astro/types";
|
|
5
|
+
|
|
6
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
class: className = "",
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as Props;
|
|
14
|
+
|
|
15
|
+
const descriptionVariants = cva("");
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<div
|
|
19
|
+
{...rest}
|
|
20
|
+
data-slot="card-description"
|
|
21
|
+
class={cn(
|
|
22
|
+
"text-muted-foreground text-sm group-data-[size=large]/card:group-data-[orientation=vertical]/card:text-base group-data-[variant=overlay]/card:text-primary-foreground",
|
|
23
|
+
descriptionVariants(),
|
|
24
|
+
className,
|
|
25
|
+
)}
|
|
26
|
+
>
|
|
27
|
+
<slot />
|
|
28
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
4
|
+
import type { HTMLAttributes } from "astro/types";
|
|
5
|
+
|
|
6
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
class: className = "",
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as Props;
|
|
14
|
+
|
|
15
|
+
const footerVariants = cva("flex items-center justify-between");
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<div
|
|
19
|
+
{...rest}
|
|
20
|
+
data-slot="card-footer"
|
|
21
|
+
class={cn("gap-6 p-6 group-data-[orientation=horizontal]/card:hidden", footerVariants(), className)}
|
|
22
|
+
>
|
|
23
|
+
<slot />
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
4
|
+
import type { HTMLAttributes } from "astro/types";
|
|
5
|
+
|
|
6
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
class: className = "",
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as Props;
|
|
14
|
+
|
|
15
|
+
const headerVariants = cva(
|
|
16
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start has-data-[slot=card-action]:grid-cols-[1fr_auto]",
|
|
17
|
+
);
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
<div
|
|
21
|
+
{...rest}
|
|
22
|
+
data-slot="card-header"
|
|
23
|
+
class={cn(
|
|
24
|
+
"gap-1.5 px-6 pt-6 pb-0 group-data-[size=large]/card:pt-8 group-data-[variant=overlay]/card:relative group-data-[variant=overlay]/card:z-10 group-data-[variant=overlay]/card:px-0 group-data-[variant=overlay]/card:pt-0 group-data-[variant=overlay]/card:pb-0",
|
|
25
|
+
headerVariants(),
|
|
26
|
+
className,
|
|
27
|
+
)}
|
|
28
|
+
>
|
|
29
|
+
<slot />
|
|
30
|
+
</div>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
4
|
+
import type { HTMLAttributes } from "astro/types";
|
|
5
|
+
|
|
6
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
class: className = "",
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as Props;
|
|
14
|
+
|
|
15
|
+
const mediaVariants = cva(
|
|
16
|
+
"relative z-0 overflow-hidden pt-2 px-2 [&_img]:size-full [&_img]:rounded-md [&_img]:object-cover group-data-[orientation=horizontal]/card:w-2/5 group-data-[orientation=horizontal]/card:self-stretch group-data-[orientation=horizontal]/card:p-0",
|
|
17
|
+
);
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
<div
|
|
21
|
+
{...rest}
|
|
22
|
+
data-slot="card-media"
|
|
23
|
+
class={cn("", mediaVariants(), className)}
|
|
24
|
+
>
|
|
25
|
+
<slot />
|
|
26
|
+
</div>
|
|
27
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
type CardOverlayVariant = "default" | "glass";
|
|
6
|
+
|
|
7
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
8
|
+
variant?: CardOverlayVariant;
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
class: className = "",
|
|
14
|
+
variant = "default",
|
|
15
|
+
...rest
|
|
16
|
+
} = Astro.props as Props;
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
<div
|
|
20
|
+
{...rest}
|
|
21
|
+
data-slot="card-overlay"
|
|
22
|
+
class={cn("",
|
|
23
|
+
"inset-0 absolute z-10 opacity-0 p-6 group-hover/card:opacity-100 transition-opacity duration-300 ease-out",
|
|
24
|
+
variant === "glass"
|
|
25
|
+
? "bg-primary/70 backdrop-blur-sm text-primary-foreground"
|
|
26
|
+
: "bg-primary text-primary-foreground",
|
|
27
|
+
className,
|
|
28
|
+
)}
|
|
29
|
+
>
|
|
30
|
+
<slot />
|
|
31
|
+
</div>
|
|
32
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
4
|
+
import type { HTMLAttributes } from "astro/types";
|
|
5
|
+
|
|
6
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { class: className = "", ...rest } = Astro.props as Props;
|
|
11
|
+
|
|
12
|
+
const titleVariants = cva("font-heading text-balance");
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<div
|
|
16
|
+
{...rest}
|
|
17
|
+
data-slot="card-title"
|
|
18
|
+
class={cn("text-xl leading-6 font-semibold group-data-[orientation=horizontal]/card:text-base", titleVariants(), className)}
|
|
19
|
+
>
|
|
20
|
+
<slot />
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as Card } from "./Card.astro";
|
|
2
|
+
export { default as CardMedia } from "./CardMedia.astro";
|
|
3
|
+
export { default as CardHeader } from "./CardHeader.astro";
|
|
4
|
+
export { default as CardTitle } from "./CardTitle.astro";
|
|
5
|
+
export { default as CardDescription } from "./CardDescription.astro";
|
|
6
|
+
export { default as CardAction } from "./CardAction.astro";
|
|
7
|
+
export { default as CardContent } from "./CardContent.astro";
|
|
8
|
+
export { default as CardFooter } from "./CardFooter.astro";
|
|
9
|
+
export { default as CardOverlay } from "./CardOverlay.astro";
|
|
10
|
+
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* @component Carousel
|
|
4
|
+
* @title Carousel
|
|
5
|
+
* @description A CSS scroll-snap carousel using only Tailwind classes (no JS).
|
|
6
|
+
*
|
|
7
|
+
* @preview
|
|
8
|
+
*
|
|
9
|
+
* <!-- Horizontal images with center snapping -->
|
|
10
|
+
* <Carousel class="gap-4 p-2" align="center">
|
|
11
|
+
* <CarouselSlide><img src="https://images.unsplash.com/photo-1759332978018-a6efdacf4d11?ixlib=rb-4.1.0&auto=format&fit=crop&q=80&w=1290" alt="Example" class="w-64 h-96 object-cover rounded-lg" /></CarouselSlide>
|
|
12
|
+
* <CarouselSlide><img src="https://plus.unsplash.com/premium_photo-1760541740387-e0af5182d805?ixlib=rb-4.1.0&auto=format&fit=crop&q=80&w=1335" alt="Example" class="w-64 h-96 object-cover rounded-lg" /></CarouselSlide>
|
|
13
|
+
* <CarouselSlide><img src="https://images.unsplash.com/photo-1760659391924-86d657118008?ixlib=rb-4.1.0&auto=format&fit=crop&q=80&w=2340" alt="Example" class="w-120 h-96 object-cover rounded-lg" /></CarouselSlide>
|
|
14
|
+
* </Carousel>
|
|
15
|
+
*
|
|
16
|
+
* @usage
|
|
17
|
+
*
|
|
18
|
+
* ```astro nocollapse
|
|
19
|
+
* ---
|
|
20
|
+
* import { Carousel, CarouselSlide } from '@bejamas/ui/components/carousel';
|
|
21
|
+
* ---
|
|
22
|
+
*
|
|
23
|
+
* <Carousel>
|
|
24
|
+
* <CarouselSlide><div class="w-72 bg-muted rounded-xl p-6">Item 1</div></CarouselSlide>
|
|
25
|
+
* <CarouselSlide><div class="w-72 bg-muted rounded-xl p-6">Item 2</div></CarouselSlide>
|
|
26
|
+
* <CarouselSlide><div class="w-72 bg-muted rounded-xl p-6">Item 3</div></CarouselSlide>
|
|
27
|
+
* </Carousel>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @props
|
|
31
|
+
* - axis?: "x" | "y" — Scroll direction. Default: "x".
|
|
32
|
+
* - snapType?: "mandatory" | "proximity" — Scroll-snap behavior. Default: "mandatory".
|
|
33
|
+
* - align?: "start" | "center" | "end" — Child snap alignment. Default: "start".
|
|
34
|
+
* - fade?: boolean — Add edge fade via CSS mask on the scroll axis. Default: false.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
import type { HTMLAttributes } from "astro/types";
|
|
38
|
+
import { cva } from "class-variance-authority";
|
|
39
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
40
|
+
|
|
41
|
+
type Axis = "x" | "y";
|
|
42
|
+
type SnapType = "mandatory" | "proximity";
|
|
43
|
+
type Align = "start" | "center" | "end";
|
|
44
|
+
|
|
45
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
46
|
+
axis?: Axis;
|
|
47
|
+
snapType?: SnapType;
|
|
48
|
+
align?: Align;
|
|
49
|
+
fade?: boolean;
|
|
50
|
+
class?: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const {
|
|
54
|
+
axis = "x",
|
|
55
|
+
snapType = "mandatory",
|
|
56
|
+
align = "start",
|
|
57
|
+
fade = false,
|
|
58
|
+
class: className = "",
|
|
59
|
+
...rest
|
|
60
|
+
} = Astro.props as Props;
|
|
61
|
+
|
|
62
|
+
const carouselVariants = cva(
|
|
63
|
+
"relative w-full overflow-auto scroll-smooth [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
|
|
64
|
+
{
|
|
65
|
+
variants: {
|
|
66
|
+
axis: {
|
|
67
|
+
x: "flex flex-row snap-x",
|
|
68
|
+
y: "flex flex-col snap-y",
|
|
69
|
+
},
|
|
70
|
+
snapType: {
|
|
71
|
+
mandatory: "snap-mandatory",
|
|
72
|
+
proximity: "snap-proximity",
|
|
73
|
+
},
|
|
74
|
+
align: {
|
|
75
|
+
start:
|
|
76
|
+
"[&>[data-slot=carousel-slide]]:snap-start [&>[data-slot=carousel-slide]]:shrink-0",
|
|
77
|
+
center:
|
|
78
|
+
"[&>[data-slot=carousel-slide]]:snap-center [&>[data-slot=carousel-slide]]:shrink-0",
|
|
79
|
+
end: "[&>[data-slot=carousel-slide]]:snap-end [&>[data-slot=carousel-slide]]:shrink-0",
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
defaultVariants: {
|
|
83
|
+
axis: "x",
|
|
84
|
+
snapType: "mandatory",
|
|
85
|
+
align: "start",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const defaultFadeX = "mask-x-from-80% mask-x-to-95%";
|
|
91
|
+
const defaultFadeY = "mask-y-from-80% mask-y-to-95%";
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
<div
|
|
95
|
+
{...rest}
|
|
96
|
+
data-slot="carousel"
|
|
97
|
+
class={cn("",
|
|
98
|
+
carouselVariants({ axis, snapType, align }),
|
|
99
|
+
fade && axis === "x" && defaultFadeX,
|
|
100
|
+
fade && axis === "y" && defaultFadeY,
|
|
101
|
+
className,
|
|
102
|
+
)}
|
|
103
|
+
>
|
|
104
|
+
<slot />
|
|
105
|
+
</div>
|
|
106
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
class: className = "",
|
|
11
|
+
...rest
|
|
12
|
+
} = Astro.props as Props;
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<div
|
|
16
|
+
{...rest}
|
|
17
|
+
data-slot="carousel-slide"
|
|
18
|
+
class={cn("", "shrink-0", className)}
|
|
19
|
+
>
|
|
20
|
+
<slot />
|
|
21
|
+
</div>
|
|
22
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the `Checkbox` component will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## 2026-09-09 — Figma alignment (ClickLearn Lightning Design Library, node `46-976`)
|
|
6
|
+
|
|
7
|
+
Checkbox had never been touched by a Figma-alignment pass and was still the original Bejamas import. This pass added the missing Size and Indeterminate variants documented in Figma, fixed a real disabled-state visual mismatch, and cleaned up dead/inconsistent code found along the way.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `size?: "default" | "lg"` — `default` is the existing 16px box (unchanged), `lg` is a new 20px box, matching Figma's two size variants (Figma's own variant was named "Small"; per your call it's being renamed to "Default" in Figma to match this prop, rather than the other way around).
|
|
12
|
+
- `indeterminate?: boolean` — shows a dash icon (matching Figma's Indeterminate type) instead of the checkmark. Since `.indeterminate` is a DOM-only property with no HTML attribute equivalent, this is implemented as a `data-indeterminate` marker plus a small inline `<script>` that sets the real native property on load — everything else (styling, showing/hiding the dash) reacts to the standard CSS `:indeterminate` pseudo-class, so it behaves like a genuine indeterminate checkbox (e.g. clicking it clears indeterminate per native browser behavior), not just a visual approximation.
|
|
13
|
+
- New `checkboxVariants`/`indicatorVariants` (via `cva`) replacing the old single flat class string, to support the two sizes cleanly.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Disabled state: was `disabled:opacity-50` (uniformly fading everything, including a checked box's blue to a washed-out blue). Figma specifies the box background becomes `bg-muted` (light gray) when disabled — fixed to match, with the indicator icon separately switching to `peer-disabled:text-muted-foreground` so a disabled+checked box reads as gray, not faded blue.
|
|
18
|
+
- `focus-visible:ring-[3px]` (arbitrary value) → `focus-visible:ring-3` (standard Tailwind scale utility, same 3px result, consistent with every other component's focus ring).
|
|
19
|
+
- Removed dead `data-checked:*` utility classes (`data-checked:bg-primary`, etc.) — nothing in this component has ever set a `data-checked` attribute (no JS at all besides the new indeterminate script), so these were inert leftovers from a different origin.
|
|
20
|
+
- Fixed the component's own JSDoc `@preview` block, which used `defaultChecked` (not a real prop — this is a static-rendered Astro component, there's no client state) instead of the native `checked` attribute the storybook docs page and all real usage already correctly use.
|
|
21
|
+
- Updated `@figmaUrl` from the old Bejamas file to the ClickLearn Lightning Design Library link.
|
|
22
|
+
|
|
23
|
+
### Notes
|
|
24
|
+
|
|
25
|
+
- Figma's "Checkbox Combo" (checkbox + label + description) is already fully covered by the existing `Field`/`FieldContent`/`FieldLabel`/`FieldDescription` components — no new component was added for it.
|
|
26
|
+
- Figma also showed a Hover state — excluded per your call; not necessary, and being removed from Figma too.
|
|
27
|
+
- The component's own wrapping `<label>` + `<slot/>`, used alongside a sibling `<Label for="id">` in all existing examples, was left as-is — both work correctly (`for` targets by id regardless of DOM nesting), not a bug.
|
|
28
|
+
- All values are token-based (`--primary`, `--muted`, `--border`, `--input`, `--ring`, `--destructive`, `--radius-sm` from `globals.css`) — no hardcoded arbitrary values.
|
|
29
|
+
|
|
30
|
+
## 2026-09-09 — Docs: checkbox/label/description alignment + token colors
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- "With description" demo (`checkbox.astro` docs page and `Checkbox.astro`'s own JSDoc `@preview`): migrated from a hand-rolled `<div class="grid gap-2">` + plain `Label` to `Field`/`FieldContent`/`FieldLabel`/`FieldDescription`. The plain `Label` renders at `leading-none` (14px line-height for `text-sm`) — *shorter* than the 16px checkbox itself — so `items-start` always left the checkbox visibly overhanging the label. `FieldLabel` uses `leading-snug` (19.25px) and, combined with the `Field` alignment fix (see `field`'s changelog), now centers the checkbox against the label to within a sub-pixel difference. Verified live via `getBoundingClientRect()`, not just visually.
|
|
35
|
+
- "Selectable card" demo: same root cause (a hand-rolled `leading-none` title paragraph). Since this demo needs to stay a single clickable `<Label>` card (not `Field`, which isn't a label and wouldn't preserve click-anywhere-on-card behavior), fixed it directly: title paragraph `leading-none` → `leading-5` (20px — see the later entry below for why this specific value, and why it changed from an initial `leading-snug` guess).
|
|
36
|
+
- "Selectable card" colors: replaced hardcoded Tailwind palette colors (`border-blue-600`, `bg-blue-50`, `dark:border-blue-900`, `dark:bg-blue-950`) with token-based equivalents (`border-primary/30`, `bg-primary/5`, `dark:border-primary/20`, `dark:bg-primary/10` — matching the exact opacity convention `FieldLabel` already uses for its own `has-data-checked` state). Also removed the now-redundant `checked:border-blue-600 checked:bg-blue-600 ...` override on the `Checkbox` instance itself — unnecessary since the component's own default checked state is already `bg-primary`/`border-primary`.
|
|
37
|
+
|
|
38
|
+
Note: this entry originally also added `class="mt-px"` directly on the `Checkbox` instance as the alignment nudge. That was wrong and got fixed in the next entry below — see that entry for why and what replaced it.
|
|
39
|
+
|
|
40
|
+
## 2026-09-09 — Fixed checkbox/icon desync, disabled-label reflection, and icon stroke geometry
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
- **Checkbox+icon desync bug**, introduced by the previous entry's `class="mt-px"` fix: that class landed on the `<input>` only (`Checkbox`'s public `class` prop merges onto the input element), while the checkmark/dash icon is a separately-positioned `absolute inset-0` overlay on a *different* wrapping `<span>` that never moved. Net effect: the box border shifted 1px down to align with the label, but the icon inside it stayed put — looking like the checkmark was "pushed upward" inside the box, and the checkbox still didn't read as properly centered overall.
|
|
45
|
+
- Fixed by adding `data-slot="checkbox"` to the component's outermost `<label>`, so the nudge can target the whole box+icon unit atomically instead of the input alone. Updated `Field.astro`'s alignment selector (`horizontal`/`responsive` variants) to match `[data-slot=checkbox]` (and `RadioGroupItem`'s existing `[data-slot=radio-group-item]`) instead of a bare `input[type=checkbox]` — see `field`'s changelog for the full detail.
|
|
46
|
+
- "Selectable card" (not `Field`-based) updated the same way: `[&_[data-slot=checkbox]]:mt-px` added directly to the card's own `Label` class, replacing the `class="mt-px"` on `Checkbox` itself.
|
|
47
|
+
- Verified live: box and icon now move as one unit (0.00px delta between them), and the whole checkbox centers against its label to within ~0.6px in both "With description" and "Selectable card".
|
|
48
|
+
- **Disabled label not dimming**: `Label`'s own `peer-disabled:opacity-50` can't reach a disabled `Checkbox`'s native input, because `Checkbox` wraps its input in its own `<label>`+`<span>` — the input isn't a true CSS sibling of an externally-paired `<Label for="...">`, so `peer-*` (which relies on the `~` sibling combinator) never matches across that nesting gap. This is a structural limitation of pairing `Checkbox` with a sibling `Label`, not something fixable inside `Checkbox` itself. Reflected correctly in the "Disabled" storybook demo using `:has()` instead (which reaches into any descendant depth): wrapped the row in `group`, added `group-has-disabled:opacity-50` to the `Label`. Mirrored in `Checkbox.astro`'s own JSDoc preview.
|
|
49
|
+
- **Icon stroke didn't match Figma**: the checkmark/dash were a single 24×24-viewBox icon with `stroke-width="2"`, scaled down via `size-3`/`size-4` for display — at the default 12px display size this rendered a ~1px visual stroke. Figma's actual assets use a viewBox matching the icon's own native display size (12×12 for the default/small icon, 16×16 for large) with `stroke-width="1.5"` in both — i.e. Figma keeps the stroke a constant 1.5px regardless of size, not scaled proportionally. Replaced the single scaled icon with per-size `viewBox`/path data taken directly from Figma's exported assets (`stroke-width="1.5"` in both cases), so the rendered stroke now matches exactly at both sizes (verified: 1.5px computed at both `size-3` and `size-4` display).
|
|
50
|
+
|
|
51
|
+
## 2026-09-09 — Alignment nudge corrected: 1px guess → Figma's actual 2px offset
|
|
52
|
+
|
|
53
|
+
The `mt-px` (1px) alignment nudge from the previous entry was derived by measurement/approximation, not sourced from Figma directly. Checked Figma's actual "Checkbox Combo" node: it wraps the checkbox in `p-0.5` (2px padding on all sides) inside an `items-start` row, with the label at an explicit `leading-[20px]` — i.e. a plain 2px top offset, not a computed value.
|
|
54
|
+
|
|
55
|
+
### Changed
|
|
56
|
+
|
|
57
|
+
- "Selectable card": `[&_[data-slot=checkbox]]:mt-px` → `mt-0.5` (2px), and the title paragraph `leading-snug` (19.25px, a guess) → `leading-5` (20px, Figma's actual value). With these exact values, centering is now **0.000px** off (verified live), not just "close."
|
|
58
|
+
- `Field`'s alignment selector (see `field`'s changelog): `mt-px` → `mt-0.5` for the same reason. Since `FieldLabel` itself still uses `leading-snug` rather than Figma's literal `leading-[20px]`, the "With description" demo (which uses `Field`) has a ~0.375px residual — imperceptible, and not worth changing `FieldLabel`'s shared typography (used by many other components) over.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* @component Checkbox
|
|
4
|
+
* @title Checkbox
|
|
5
|
+
* @description An accessible control for toggling between checked and unchecked states. Built on native HTML checkbox.
|
|
6
|
+
* @figmaUrl https://www.figma.com/design/qXkzdqZ3QPQqgckU3AwIAH/ClickLearn-Lightning-Design-Library?node-id=46-976
|
|
7
|
+
*
|
|
8
|
+
* @preview
|
|
9
|
+
*
|
|
10
|
+
* <div class="flex flex-col gap-6 not-content">
|
|
11
|
+
* <div class="flex items-center gap-3">
|
|
12
|
+
* <Checkbox id="terms" />
|
|
13
|
+
* <Label for="terms">Accept terms and conditions</Label>
|
|
14
|
+
* </div>
|
|
15
|
+
*
|
|
16
|
+
* <Field orientation="horizontal" class="max-w-sm">
|
|
17
|
+
* <Checkbox id="terms-2" checked />
|
|
18
|
+
* <FieldContent>
|
|
19
|
+
* <FieldLabel for="terms-2">Accept terms and conditions</FieldLabel>
|
|
20
|
+
* <FieldDescription>
|
|
21
|
+
* By clicking this checkbox, you agree to the terms and conditions.
|
|
22
|
+
* </FieldDescription>
|
|
23
|
+
* </FieldContent>
|
|
24
|
+
* </Field>
|
|
25
|
+
*
|
|
26
|
+
* <div class="group flex items-center gap-3">
|
|
27
|
+
* <Checkbox id="toggle" disabled />
|
|
28
|
+
* <Label for="toggle" class="group-has-disabled:opacity-50">Enable notifications</Label>
|
|
29
|
+
* </div>
|
|
30
|
+
*
|
|
31
|
+
* <Label
|
|
32
|
+
* class="hover:bg-accent/5 border-border flex items-start gap-3 rounded-lg border p-3 has-[:checked]:border-primary/30 has-[:checked]:bg-primary/5 dark:has-[:checked]:border-primary/20 dark:has-[:checked]:bg-primary/10 [&_[data-slot=checkbox]]:mt-0.5"
|
|
33
|
+
* >
|
|
34
|
+
* <Checkbox id="toggle-2" checked />
|
|
35
|
+
* <div class="grid gap-1.5 font-normal">
|
|
36
|
+
* <p class="text-sm leading-5 font-medium">Enable notifications</p>
|
|
37
|
+
* <p class="text-muted-foreground text-sm">
|
|
38
|
+
* You can enable or disable notifications at any time.
|
|
39
|
+
* </p>
|
|
40
|
+
* </div>
|
|
41
|
+
* </Label>
|
|
42
|
+
* </div>
|
|
43
|
+
*
|
|
44
|
+
* @usage
|
|
45
|
+
*
|
|
46
|
+
* ```astro nocollapse
|
|
47
|
+
* ---
|
|
48
|
+
* import { Checkbox } from '@bejamas/ui/components/checkbox';
|
|
49
|
+
* import { Label } from '@bejamas/ui/components/label';
|
|
50
|
+
* ---
|
|
51
|
+
*
|
|
52
|
+
* <div class="flex items-center gap-3">
|
|
53
|
+
* <Checkbox id="terms" />
|
|
54
|
+
* <Label for="terms">Accept terms and conditions</Label>
|
|
55
|
+
* </div>
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @examples
|
|
59
|
+
*
|
|
60
|
+
* ### Sizes
|
|
61
|
+
*
|
|
62
|
+
* <div class="flex items-center gap-6">
|
|
63
|
+
* <Checkbox id="size-default" checked />
|
|
64
|
+
* <Checkbox id="size-lg" size="lg" checked />
|
|
65
|
+
* </div>
|
|
66
|
+
*
|
|
67
|
+
* ### Indeterminate
|
|
68
|
+
*
|
|
69
|
+
* <Checkbox id="indeterminate-example" indeterminate />
|
|
70
|
+
*/
|
|
71
|
+
import { cva } from "class-variance-authority";
|
|
72
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
73
|
+
import type { HTMLAttributes } from "astro/types";
|
|
74
|
+
|
|
75
|
+
interface Props extends HTMLAttributes<"input"> {
|
|
76
|
+
class?: string;
|
|
77
|
+
id?: string;
|
|
78
|
+
name?: string;
|
|
79
|
+
size?: "default" | "lg";
|
|
80
|
+
indeterminate?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const {
|
|
84
|
+
class: className = "",
|
|
85
|
+
id = "",
|
|
86
|
+
name = id,
|
|
87
|
+
size = "default",
|
|
88
|
+
indeterminate = false,
|
|
89
|
+
...props
|
|
90
|
+
} = Astro.props as Props;
|
|
91
|
+
|
|
92
|
+
const checkboxVariants = cva(
|
|
93
|
+
"peer appearance-none shrink-0 rounded-sm border border-input shadow-xs outline-none transition-colors checked:bg-primary checked:border-primary indeterminate:bg-primary indeterminate:border-primary dark:bg-input/30 dark:checked:bg-primary dark:checked:border-primary dark:indeterminate:bg-primary dark:indeterminate:border-primary focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:border-ring aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:checked:border-primary disabled:cursor-not-allowed disabled:bg-muted disabled:border-input group-has-disabled/field:opacity-50 relative after:absolute after:-inset-x-3 after:-inset-y-2",
|
|
94
|
+
{
|
|
95
|
+
variants: {
|
|
96
|
+
size: {
|
|
97
|
+
default: "size-4",
|
|
98
|
+
lg: "size-5",
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
defaultVariants: {
|
|
102
|
+
size: "default",
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const indicatorVariants = cva(
|
|
108
|
+
"pointer-events-none absolute inset-0 grid place-content-center transition-opacity peer-disabled:text-muted-foreground text-primary-foreground",
|
|
109
|
+
{
|
|
110
|
+
variants: {
|
|
111
|
+
size: {
|
|
112
|
+
default: "[&>svg]:size-3",
|
|
113
|
+
lg: "[&>svg]:size-4",
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
defaultVariants: {
|
|
117
|
+
size: "default",
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
// Icon geometry matches Figma exactly per size (viewBox = native px, stroke-width 1.5)
|
|
123
|
+
// rather than scaling a single 24px icon, which rendered the stroke ~33% thinner than Figma.
|
|
124
|
+
const iconViewBox = size === "lg" ? "0 0 16 16" : "0 0 12 12";
|
|
125
|
+
const checkPath = size === "lg" ? "M13.3333 4L6 11.3333L2.66667 8" : "M10 3L4.5 8.5L2 6";
|
|
126
|
+
const dashPath = size === "lg" ? "M3.33333 8H12.6667" : "M2.5 6H9.5";
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
<label data-slot="checkbox" class="inline-flex items-center gap-2 cursor-pointer">
|
|
130
|
+
<span class="relative inline-flex items-center justify-center">
|
|
131
|
+
<input
|
|
132
|
+
id={id}
|
|
133
|
+
name={name}
|
|
134
|
+
type="checkbox"
|
|
135
|
+
data-indeterminate={indeterminate ? "" : undefined}
|
|
136
|
+
class={cn(checkboxVariants({ size }), className)}
|
|
137
|
+
{...props}
|
|
138
|
+
/>
|
|
139
|
+
<span
|
|
140
|
+
data-slot="checkbox-indicator"
|
|
141
|
+
class={cn(indicatorVariants({ size }), "opacity-0 peer-checked:opacity-100 peer-indeterminate:opacity-0")}
|
|
142
|
+
>
|
|
143
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox={iconViewBox}><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d={checkPath}/></svg>
|
|
144
|
+
</span>
|
|
145
|
+
<span
|
|
146
|
+
data-slot="checkbox-indeterminate-indicator"
|
|
147
|
+
class={cn(indicatorVariants({ size }), "opacity-0 peer-indeterminate:opacity-100")}
|
|
148
|
+
>
|
|
149
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox={iconViewBox}><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d={dashPath}/></svg>
|
|
150
|
+
</span>
|
|
151
|
+
</span>
|
|
152
|
+
<slot />
|
|
153
|
+
</label>
|
|
154
|
+
|
|
155
|
+
<script>
|
|
156
|
+
document.querySelectorAll("input[data-indeterminate]").forEach((el) => {
|
|
157
|
+
(el as HTMLInputElement).indeterminate = true;
|
|
158
|
+
});
|
|
159
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Checkbox } from "./Checkbox.astro";
|