@codefast/ui 0.3.13-canary.3 → 0.3.13-canary.4
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/CHANGELOG.md +19 -0
- package/dist/components/accordion.d.mts +37 -0
- package/dist/components/accordion.mjs +53 -0
- package/dist/components/alert-dialog.d.mts +74 -0
- package/dist/components/alert-dialog.mjs +92 -0
- package/dist/components/alert.d.mts +30 -0
- package/dist/components/alert.mjs +49 -0
- package/dist/components/aspect-ratio.d.mts +10 -0
- package/dist/components/aspect-ratio.mjs +12 -0
- package/dist/components/avatar.d.mts +21 -0
- package/dist/components/avatar.mjs +28 -0
- package/dist/components/badge.d.mts +24 -0
- package/dist/components/badge.mjs +56 -0
- package/dist/components/breadcrumb.d.mts +44 -0
- package/dist/components/breadcrumb.mjs +67 -0
- package/dist/components/button-group.d.mts +34 -0
- package/dist/components/button-group.mjs +53 -0
- package/dist/components/button.d.mts +38 -0
- package/dist/components/button.mjs +99 -0
- package/dist/components/calendar.d.mts +27 -0
- package/dist/components/calendar.mjs +114 -0
- package/dist/components/card.d.mts +41 -0
- package/dist/components/card.mjs +55 -0
- package/dist/components/carousel.d.mts +68 -0
- package/dist/components/carousel.mjs +135 -0
- package/dist/components/chart.d.mts +93 -0
- package/dist/components/chart.mjs +189 -0
- package/dist/components/checkbox-cards.d.mts +17 -0
- package/dist/components/checkbox-cards.mjs +30 -0
- package/dist/components/checkbox-group.d.mts +16 -0
- package/dist/components/checkbox-group.mjs +27 -0
- package/dist/components/checkbox.d.mts +11 -0
- package/dist/components/checkbox.mjs +20 -0
- package/dist/components/collapsible.d.mts +18 -0
- package/dist/components/collapsible.mjs +24 -0
- package/dist/components/command.d.mts +57 -0
- package/dist/components/command.mjs +92 -0
- package/dist/components/context-menu.d.mts +91 -0
- package/dist/components/context-menu.mjs +122 -0
- package/dist/components/dialog.d.mts +65 -0
- package/dist/components/dialog.mjs +93 -0
- package/dist/components/drawer.d.mts +65 -0
- package/dist/components/drawer.mjs +78 -0
- package/dist/components/dropdown-menu.d.mts +92 -0
- package/dist/components/dropdown-menu.mjs +129 -0
- package/dist/components/empty.d.mts +44 -0
- package/dist/components/empty.mjs +64 -0
- package/dist/components/field.d.mts +79 -0
- package/dist/components/field.mjs +132 -0
- package/dist/components/form.d.mts +48 -0
- package/dist/components/form.mjs +92 -0
- package/dist/components/hover-card.d.mts +26 -0
- package/dist/components/hover-card.mjs +35 -0
- package/dist/components/input-group.d.mts +61 -0
- package/dist/components/input-group.mjs +142 -0
- package/dist/components/input-number.d.mts +28 -0
- package/dist/components/input-number.mjs +61 -0
- package/dist/components/input-otp.d.mts +29 -0
- package/dist/components/input-otp.mjs +48 -0
- package/dist/components/input-password.d.mts +13 -0
- package/dist/components/input-password.mjs +38 -0
- package/dist/components/input-search.d.mts +20 -0
- package/dist/components/input-search.mjs +50 -0
- package/dist/components/input.d.mts +11 -0
- package/dist/components/input.mjs +14 -0
- package/dist/components/item.d.mts +82 -0
- package/dist/components/item.mjs +137 -0
- package/dist/components/kbd.d.mts +15 -0
- package/dist/components/kbd.mjs +19 -0
- package/dist/components/label.d.mts +11 -0
- package/dist/components/label.mjs +14 -0
- package/dist/components/menubar.d.mts +100 -0
- package/dist/components/menubar.mjs +133 -0
- package/dist/components/native-select.d.mts +19 -0
- package/dist/components/native-select.mjs +34 -0
- package/dist/components/navigation-menu.d.mts +44 -0
- package/dist/components/navigation-menu.mjs +79 -0
- package/dist/components/pagination.d.mts +46 -0
- package/dist/components/pagination.mjs +71 -0
- package/dist/components/popover.d.mts +30 -0
- package/dist/components/popover.mjs +41 -0
- package/dist/components/progress-circle.d.mts +124 -0
- package/dist/components/progress-circle.mjs +120 -0
- package/dist/components/progress.d.mts +12 -0
- package/dist/components/progress.mjs +19 -0
- package/dist/components/{radio-cards.d.ts → radio-cards.d.mts} +10 -5
- package/dist/components/radio-cards.mjs +29 -0
- package/dist/components/radio-group.d.mts +16 -0
- package/dist/components/radio-group.mjs +25 -0
- package/dist/components/radio.d.mts +14 -0
- package/dist/components/radio.mjs +16 -0
- package/dist/components/resizable.d.mts +23 -0
- package/dist/components/resizable.mjs +32 -0
- package/dist/components/scroll-area.d.mts +40 -0
- package/dist/components/scroll-area.mjs +101 -0
- package/dist/components/select.d.mts +62 -0
- package/dist/components/select.mjs +101 -0
- package/dist/components/separator.d.mts +32 -0
- package/dist/components/separator.mjs +45 -0
- package/dist/components/sheet.d.mts +75 -0
- package/dist/components/sheet.mjs +134 -0
- package/dist/components/sidebar.d.mts +195 -0
- package/dist/components/sidebar.mjs +375 -0
- package/dist/components/skeleton.d.mts +10 -0
- package/dist/components/skeleton.mjs +12 -0
- package/dist/components/slider.d.mts +15 -0
- package/dist/components/slider.mjs +40 -0
- package/dist/components/sonner.d.mts +10 -0
- package/dist/components/sonner.mjs +21 -0
- package/dist/components/spinner.d.mts +14 -0
- package/dist/components/spinner.mjs +40 -0
- package/dist/components/switch.d.mts +11 -0
- package/dist/components/switch.mjs +18 -0
- package/dist/components/table.d.mts +45 -0
- package/dist/components/table.mjs +65 -0
- package/dist/components/tabs.d.mts +26 -0
- package/dist/components/tabs.mjs +35 -0
- package/dist/components/textarea.d.mts +10 -0
- package/dist/components/textarea.mjs +12 -0
- package/dist/components/toggle-group.d.mts +30 -0
- package/dist/components/toggle-group.mjs +53 -0
- package/dist/components/toggle.d.mts +28 -0
- package/dist/components/toggle.mjs +53 -0
- package/dist/components/tooltip.d.mts +30 -0
- package/dist/components/tooltip.mjs +42 -0
- package/dist/hooks/{use-animated-value.d.ts → use-animated-value.d.mts} +4 -2
- package/dist/hooks/use-animated-value.mjs +62 -0
- package/dist/hooks/{use-copy-to-clipboard.d.ts → use-copy-to-clipboard.d.mts} +11 -6
- package/dist/hooks/use-copy-to-clipboard.mjs +43 -0
- package/dist/hooks/{use-is-mobile.d.ts → use-is-mobile.d.mts} +4 -2
- package/dist/hooks/use-is-mobile.mjs +26 -0
- package/dist/hooks/{use-media-query.d.ts → use-media-query.d.mts} +4 -2
- package/dist/hooks/use-media-query.mjs +50 -0
- package/dist/hooks/{use-mutation-observer.d.ts → use-mutation-observer.d.mts} +6 -3
- package/dist/hooks/use-mutation-observer.mjs +41 -0
- package/dist/hooks/use-pagination.d.mts +44 -0
- package/dist/hooks/use-pagination.mjs +107 -0
- package/dist/index.d.mts +69 -0
- package/dist/index.mjs +69 -0
- package/dist/lib/utils.d.mts +13 -0
- package/dist/lib/utils.mjs +10 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +6 -0
- package/dist/primitives/checkbox-group.d.mts +144 -0
- package/dist/primitives/checkbox-group.mjs +126 -0
- package/dist/primitives/input-number.d.mts +73 -0
- package/dist/primitives/input-number.mjs +514 -0
- package/dist/primitives/input.d.mts +72 -0
- package/dist/primitives/input.mjs +75 -0
- package/dist/primitives/progress-circle.d.mts +146 -0
- package/dist/primitives/progress-circle.mjs +178 -0
- package/package.json +164 -170
- package/dist/components/accordion.d.ts +0 -19
- package/dist/components/accordion.d.ts.map +0 -1
- package/dist/components/accordion.js +0 -26
- package/dist/components/alert-dialog.d.ts +0 -39
- package/dist/components/alert-dialog.d.ts.map +0 -1
- package/dist/components/alert-dialog.js +0 -39
- package/dist/components/alert.d.ts +0 -19
- package/dist/components/alert.d.ts.map +0 -1
- package/dist/components/alert.js +0 -41
- package/dist/components/aspect-ratio.d.ts +0 -7
- package/dist/components/aspect-ratio.d.ts.map +0 -1
- package/dist/components/aspect-ratio.js +0 -10
- package/dist/components/avatar.d.ts +0 -11
- package/dist/components/avatar.d.ts.map +0 -1
- package/dist/components/avatar.js +0 -17
- package/dist/components/badge.d.ts +0 -18
- package/dist/components/badge.d.ts.map +0 -1
- package/dist/components/badge.js +0 -59
- package/dist/components/breadcrumb.d.ts +0 -22
- package/dist/components/breadcrumb.d.ts.map +0 -1
- package/dist/components/breadcrumb.js +0 -31
- package/dist/components/button-group.d.ts +0 -20
- package/dist/components/button-group.d.ts.map +0 -1
- package/dist/components/button-group.js +0 -48
- package/dist/components/button.d.ts +0 -29
- package/dist/components/button.d.ts.map +0 -1
- package/dist/components/button.js +0 -92
- package/dist/components/calendar.d.ts +0 -13
- package/dist/components/calendar.d.ts.map +0 -1
- package/dist/components/calendar.js +0 -104
- package/dist/components/card.d.ts +0 -18
- package/dist/components/card.d.ts.map +0 -1
- package/dist/components/card.js +0 -27
- package/dist/components/carousel.d.ts +0 -38
- package/dist/components/carousel.d.ts.map +0 -1
- package/dist/components/carousel.js +0 -103
- package/dist/components/chart.d.ts +0 -58
- package/dist/components/chart.d.ts.map +0 -1
- package/dist/components/chart.js +0 -198
- package/dist/components/checkbox-cards.d.ts +0 -11
- package/dist/components/checkbox-cards.d.ts.map +0 -1
- package/dist/components/checkbox-cards.js +0 -16
- package/dist/components/checkbox-group.d.ts +0 -9
- package/dist/components/checkbox-group.d.ts.map +0 -1
- package/dist/components/checkbox-group.js +0 -15
- package/dist/components/checkbox.d.ts +0 -7
- package/dist/components/checkbox.d.ts.map +0 -1
- package/dist/components/checkbox.js +0 -12
- package/dist/components/collapsible.d.ts +0 -11
- package/dist/components/collapsible.d.ts.map +0 -1
- package/dist/components/collapsible.js +0 -16
- package/dist/components/command.d.ts +0 -26
- package/dist/components/command.d.ts.map +0 -1
- package/dist/components/command.js +0 -41
- package/dist/components/context-menu.d.ts +0 -42
- package/dist/components/context-menu.d.ts.map +0 -1
- package/dist/components/context-menu.js +0 -54
- package/dist/components/dialog.d.ts +0 -35
- package/dist/components/dialog.d.ts.map +0 -1
- package/dist/components/dialog.js +0 -41
- package/dist/components/drawer.d.ts +0 -34
- package/dist/components/drawer.d.ts.map +0 -1
- package/dist/components/drawer.js +0 -36
- package/dist/components/dropdown-menu.d.ts +0 -42
- package/dist/components/dropdown-menu.d.ts.map +0 -1
- package/dist/components/dropdown-menu.js +0 -54
- package/dist/components/empty.d.ts +0 -23
- package/dist/components/empty.d.ts.map +0 -1
- package/dist/components/empty.js +0 -47
- package/dist/components/field.d.ts +0 -42
- package/dist/components/field.d.ts.map +0 -1
- package/dist/components/field.js +0 -85
- package/dist/components/form.d.ts +0 -27
- package/dist/components/form.d.ts.map +0 -1
- package/dist/components/form.js +0 -76
- package/dist/components/hover-card.d.ts +0 -13
- package/dist/components/hover-card.d.ts.map +0 -1
- package/dist/components/hover-card.js +0 -20
- package/dist/components/input-group.d.ts +0 -37
- package/dist/components/input-group.d.ts.map +0 -1
- package/dist/components/input-group.js +0 -127
- package/dist/components/input-number.d.ts +0 -8
- package/dist/components/input-number.d.ts.map +0 -1
- package/dist/components/input-number.js +0 -20
- package/dist/components/input-otp.d.ts +0 -16
- package/dist/components/input-otp.d.ts.map +0 -1
- package/dist/components/input-otp.js +0 -25
- package/dist/components/input-password.d.ts +0 -7
- package/dist/components/input-password.d.ts.map +0 -1
- package/dist/components/input-password.js +0 -17
- package/dist/components/input-search.d.ts +0 -11
- package/dist/components/input-search.d.ts.map +0 -1
- package/dist/components/input-search.js +0 -22
- package/dist/components/input.d.ts +0 -6
- package/dist/components/input.d.ts.map +0 -1
- package/dist/components/input.js +0 -10
- package/dist/components/item.d.ts +0 -46
- package/dist/components/item.d.ts.map +0 -1
- package/dist/components/item.js +0 -94
- package/dist/components/kbd.d.ts +0 -8
- package/dist/components/kbd.d.ts.map +0 -1
- package/dist/components/kbd.js +0 -12
- package/dist/components/label.d.ts +0 -7
- package/dist/components/label.d.ts.map +0 -1
- package/dist/components/label.js +0 -11
- package/dist/components/menubar.d.ts +0 -44
- package/dist/components/menubar.d.ts.map +0 -1
- package/dist/components/menubar.js +0 -57
- package/dist/components/native-select.d.ts +0 -10
- package/dist/components/native-select.d.ts.map +0 -1
- package/dist/components/native-select.js +0 -16
- package/dist/components/navigation-menu.d.ts +0 -21
- package/dist/components/navigation-menu.d.ts.map +0 -1
- package/dist/components/navigation-menu.js +0 -43
- package/dist/components/pagination.d.ts +0 -26
- package/dist/components/pagination.d.ts.map +0 -1
- package/dist/components/pagination.js +0 -29
- package/dist/components/popover.d.ts +0 -15
- package/dist/components/popover.d.ts.map +0 -1
- package/dist/components/popover.js +0 -23
- package/dist/components/progress-circle.d.ts +0 -107
- package/dist/components/progress-circle.d.ts.map +0 -1
- package/dist/components/progress-circle.js +0 -83
- package/dist/components/progress.d.ts +0 -7
- package/dist/components/progress.d.ts.map +0 -1
- package/dist/components/progress.js +0 -13
- package/dist/components/radio-cards.d.ts.map +0 -1
- package/dist/components/radio-cards.js +0 -15
- package/dist/components/radio-group.d.ts +0 -9
- package/dist/components/radio-group.d.ts.map +0 -1
- package/dist/components/radio-group.js +0 -14
- package/dist/components/radio.d.ts +0 -8
- package/dist/components/radio.d.ts.map +0 -1
- package/dist/components/radio.js +0 -11
- package/dist/components/resizable.d.ts +0 -13
- package/dist/components/resizable.d.ts.map +0 -1
- package/dist/components/resizable.js +0 -18
- package/dist/components/scroll-area.d.ts +0 -28
- package/dist/components/scroll-area.d.ts.map +0 -1
- package/dist/components/scroll-area.js +0 -77
- package/dist/components/select.d.ts +0 -29
- package/dist/components/select.d.ts.map +0 -1
- package/dist/components/select.js +0 -49
- package/dist/components/separator.d.ts +0 -23
- package/dist/components/separator.d.ts.map +0 -1
- package/dist/components/separator.js +0 -36
- package/dist/components/sheet.d.ts +0 -43
- package/dist/components/sheet.d.ts.map +0 -1
- package/dist/components/sheet.js +0 -90
- package/dist/components/sidebar.d.ts +0 -102
- package/dist/components/sidebar.d.ts.map +0 -1
- package/dist/components/sidebar.js +0 -241
- package/dist/components/skeleton.d.ts +0 -6
- package/dist/components/skeleton.d.ts.map +0 -1
- package/dist/components/skeleton.js +0 -9
- package/dist/components/slider.d.ts +0 -7
- package/dist/components/slider.d.ts.map +0 -1
- package/dist/components/slider.js +0 -18
- package/dist/components/sonner.d.ts +0 -8
- package/dist/components/sonner.d.ts.map +0 -1
- package/dist/components/sonner.js +0 -18
- package/dist/components/spinner.d.ts +0 -8
- package/dist/components/spinner.d.ts.map +0 -1
- package/dist/components/spinner.js +0 -27
- package/dist/components/switch.d.ts +0 -7
- package/dist/components/switch.d.ts.map +0 -1
- package/dist/components/switch.js +0 -11
- package/dist/components/table.d.ts +0 -20
- package/dist/components/table.d.ts.map +0 -1
- package/dist/components/table.js +0 -30
- package/dist/components/tabs.d.ts +0 -13
- package/dist/components/tabs.d.ts.map +0 -1
- package/dist/components/tabs.js +0 -20
- package/dist/components/textarea.d.ts +0 -6
- package/dist/components/textarea.d.ts.map +0 -1
- package/dist/components/textarea.js +0 -9
- package/dist/components/toggle-group.d.ts +0 -16
- package/dist/components/toggle-group.d.ts.map +0 -1
- package/dist/components/toggle-group.js +0 -35
- package/dist/components/toggle.d.ts +0 -21
- package/dist/components/toggle.d.ts.map +0 -1
- package/dist/components/toggle.js +0 -49
- package/dist/components/tooltip.d.ts +0 -15
- package/dist/components/tooltip.d.ts.map +0 -1
- package/dist/components/tooltip.js +0 -23
- package/dist/hooks/use-animated-value.d.ts.map +0 -1
- package/dist/hooks/use-animated-value.js +0 -71
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +0 -1
- package/dist/hooks/use-copy-to-clipboard.js +0 -46
- package/dist/hooks/use-is-mobile.d.ts.map +0 -1
- package/dist/hooks/use-is-mobile.js +0 -23
- package/dist/hooks/use-media-query.d.ts.map +0 -1
- package/dist/hooks/use-media-query.js +0 -53
- package/dist/hooks/use-mutation-observer.d.ts.map +0 -1
- package/dist/hooks/use-mutation-observer.js +0 -40
- package/dist/hooks/use-pagination.d.ts +0 -37
- package/dist/hooks/use-pagination.d.ts.map +0 -1
- package/dist/hooks/use-pagination.js +0 -107
- package/dist/index.d.ts +0 -131
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -68
- package/dist/lib/utils.d.ts +0 -10
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/utils.js +0 -10
- package/dist/primitives/checkbox-group.d.ts +0 -123
- package/dist/primitives/checkbox-group.d.ts.map +0 -1
- package/dist/primitives/checkbox-group.js +0 -112
- package/dist/primitives/input-number.d.ts +0 -63
- package/dist/primitives/input-number.d.ts.map +0 -1
- package/dist/primitives/input-number.js +0 -458
- package/dist/primitives/input.d.ts +0 -67
- package/dist/primitives/input.d.ts.map +0 -1
- package/dist/primitives/input.js +0 -76
- package/dist/primitives/progress-circle.d.ts +0 -116
- package/dist/primitives/progress-circle.d.ts.map +0 -1
- package/dist/primitives/progress-circle.js +0 -163
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "#lib/utils";
|
|
4
|
-
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
5
|
-
import { useEffect, useRef } from "react";
|
|
6
|
-
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
7
|
-
import { Button, buttonVariants } from "#components/button";
|
|
8
|
-
function Calendar({ buttonVariant = "ghost", captionLayout = "label", className, classNames, components, formatters, showOutsideDays = true, ...props }) {
|
|
9
|
-
const defaultClassNames = getDefaultClassNames();
|
|
10
|
-
return (_jsx(DayPicker, { captionLayout: captionLayout, className: cn("group/calendar", "p-3", "bg-background", "in-data-[slot=card-content]:bg-transparent", "in-data-[slot=popover-content]:bg-transparent", "rtl:**:[.rdp-button_next>svg]:rotate-180", "rtl:**:[.rdp-button_previous>svg]:rotate-180", "[--cell-size:--spacing(8)]", className), classNames: {
|
|
11
|
-
button_next: buttonVariants({
|
|
12
|
-
variant: buttonVariant,
|
|
13
|
-
className: [
|
|
14
|
-
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
15
|
-
defaultClassNames.button_next,
|
|
16
|
-
],
|
|
17
|
-
}),
|
|
18
|
-
button_previous: buttonVariants({
|
|
19
|
-
variant: buttonVariant,
|
|
20
|
-
className: [
|
|
21
|
-
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
22
|
-
defaultClassNames.button_previous,
|
|
23
|
-
],
|
|
24
|
-
}),
|
|
25
|
-
caption_label: cn("font-medium", "select-none", captionLayout === "label"
|
|
26
|
-
? "text-sm"
|
|
27
|
-
: "flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground", defaultClassNames.caption_label),
|
|
28
|
-
day: cn("group/day relative", "aspect-square h-full w-full p-0 text-center", "select-none", "[&:last-child[data-selected=true]_button]:rounded-r-md", props.showWeekNumber
|
|
29
|
-
? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md"
|
|
30
|
-
: "[&:first-child[data-selected=true]_button]:rounded-l-md", defaultClassNames.day),
|
|
31
|
-
disabled: cn("opacity-50", "text-muted-foreground", defaultClassNames.disabled),
|
|
32
|
-
dropdown: cn("absolute inset-0", "bg-popover", "opacity-0", defaultClassNames.dropdown),
|
|
33
|
-
dropdown_root: cn("relative", "rounded-md border border-input shadow-xs", "has-focus:border-ring has-focus:ring-3 has-focus:ring-ring/50", defaultClassNames.dropdown_root),
|
|
34
|
-
dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5", "text-sm font-medium", defaultClassNames.dropdowns),
|
|
35
|
-
hidden: cn("invisible", defaultClassNames.hidden),
|
|
36
|
-
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
37
|
-
month_caption: cn("flex h-(--cell-size) w-full items-center justify-center", "px-(--cell-size)", defaultClassNames.month_caption),
|
|
38
|
-
months: cn("relative flex flex-col gap-4", "md:flex-row", defaultClassNames.months),
|
|
39
|
-
nav: cn("absolute flex w-full items-center justify-between gap-1", "inset-x-0 top-0", defaultClassNames.nav),
|
|
40
|
-
outside: cn("text-muted-foreground", "aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
41
|
-
range_end: cn("rounded-r-md", "bg-accent", defaultClassNames.range_end),
|
|
42
|
-
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
43
|
-
range_start: cn("rounded-l-md", "bg-accent", defaultClassNames.range_start),
|
|
44
|
-
root: cn("w-fit", defaultClassNames.root),
|
|
45
|
-
table: "w-full border-collapse",
|
|
46
|
-
today: cn("rounded-md", "bg-accent text-accent-foreground", "data-selected:rounded-none", defaultClassNames.today),
|
|
47
|
-
week: cn("flex w-full", "mt-2", defaultClassNames.week),
|
|
48
|
-
week_number: cn("text-[0.8rem] text-muted-foreground", "select-none", defaultClassNames.week_number),
|
|
49
|
-
week_number_header: cn("w-(--cell-size)", "select-none", defaultClassNames.week_number_header),
|
|
50
|
-
weekday: cn("flex-1", "rounded-md", "text-[0.8rem] font-normal text-muted-foreground", "select-none", defaultClassNames.weekday),
|
|
51
|
-
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
52
|
-
...classNames,
|
|
53
|
-
}, components: {
|
|
54
|
-
Chevron: CalendarChevron,
|
|
55
|
-
DayButton: CalendarDayButton,
|
|
56
|
-
Root: CalendarRoot,
|
|
57
|
-
WeekNumber: CalendarWeekNumber,
|
|
58
|
-
...components,
|
|
59
|
-
}, formatters: {
|
|
60
|
-
formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
|
|
61
|
-
...formatters,
|
|
62
|
-
}, showOutsideDays: showOutsideDays, ...props }));
|
|
63
|
-
}
|
|
64
|
-
/* -----------------------------------------------------------------------------
|
|
65
|
-
* Component: CalendarChevron (internal)
|
|
66
|
-
* -------------------------------------------------------------------------- */
|
|
67
|
-
function CalendarChevron({ className, orientation, ...props }) {
|
|
68
|
-
if (orientation === "left") {
|
|
69
|
-
return _jsx(ChevronLeftIcon, { className: cn("size-4", className), ...props });
|
|
70
|
-
}
|
|
71
|
-
if (orientation === "right") {
|
|
72
|
-
return _jsx(ChevronRightIcon, { className: cn("size-4", className), ...props });
|
|
73
|
-
}
|
|
74
|
-
return _jsx(ChevronDownIcon, { className: cn("size-4", className), ...props });
|
|
75
|
-
}
|
|
76
|
-
/* -----------------------------------------------------------------------------
|
|
77
|
-
* Component: CalendarRoot (internal)
|
|
78
|
-
* -------------------------------------------------------------------------- */
|
|
79
|
-
function CalendarRoot({ className, rootRef, ...props }) {
|
|
80
|
-
return _jsx("div", { ref: rootRef, className: cn(className), "data-slot": "calendar", ...props });
|
|
81
|
-
}
|
|
82
|
-
/* -----------------------------------------------------------------------------
|
|
83
|
-
* Component: CalendarWeekNumber (internal)
|
|
84
|
-
* -------------------------------------------------------------------------- */
|
|
85
|
-
function CalendarWeekNumber({ children, ...props }) {
|
|
86
|
-
return (_jsx("td", { ...props, children: _jsx("div", { className: cn("flex size-(--cell-size) items-center justify-center", "text-center"), children: children }) }));
|
|
87
|
-
}
|
|
88
|
-
function CalendarDayButton({ className, day, modifiers, ...props }) {
|
|
89
|
-
const defaultClassNames = getDefaultClassNames();
|
|
90
|
-
const ref = useRef(null);
|
|
91
|
-
useEffect(() => {
|
|
92
|
-
if (modifiers.focused) {
|
|
93
|
-
ref.current?.focus();
|
|
94
|
-
}
|
|
95
|
-
}, [modifiers.focused]);
|
|
96
|
-
return (_jsx(Button, { ref: ref, className: cn("flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal", "group-data-focused/day:relative group-data-focused/day:z-10 group-data-focused/day:border-ring group-data-focused/day:ring-3 group-data-focused/day:ring-ring/50", "data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground", "data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground", "data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground", "data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground", "dark:hover:text-accent-foreground", "[&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className), "data-day": day.date.toLocaleDateString(), "data-range-end": modifiers.range_end, "data-range-middle": modifiers.range_middle, "data-range-start": modifiers.range_start, "data-selected-single": modifiers.selected &&
|
|
97
|
-
!modifiers.range_start &&
|
|
98
|
-
!modifiers.range_end &&
|
|
99
|
-
!modifiers.range_middle, size: "icon", variant: "ghost", ...props }));
|
|
100
|
-
}
|
|
101
|
-
/* -----------------------------------------------------------------------------
|
|
102
|
-
* Exports
|
|
103
|
-
* -------------------------------------------------------------------------- */
|
|
104
|
-
export { Calendar, CalendarDayButton };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps, JSX } from "react";
|
|
2
|
-
type CardProps = ComponentProps<"div">;
|
|
3
|
-
declare function Card({ className, ...props }: CardProps): JSX.Element;
|
|
4
|
-
type CardHeaderProps = ComponentProps<"div">;
|
|
5
|
-
declare function CardHeader({ className, ...props }: CardHeaderProps): JSX.Element;
|
|
6
|
-
type CardTitleProps = ComponentProps<"div">;
|
|
7
|
-
declare function CardTitle({ children, className, ...props }: CardTitleProps): JSX.Element;
|
|
8
|
-
type CardDescriptionProps = ComponentProps<"div">;
|
|
9
|
-
declare function CardDescription({ className, ...props }: CardDescriptionProps): JSX.Element;
|
|
10
|
-
type CardContentProps = ComponentProps<"div">;
|
|
11
|
-
declare function CardContent({ className, ...props }: CardContentProps): JSX.Element;
|
|
12
|
-
type CardFooterProps = ComponentProps<"div">;
|
|
13
|
-
declare function CardFooter({ className, ...props }: CardFooterProps): JSX.Element;
|
|
14
|
-
type CardActionProps = ComponentProps<"div">;
|
|
15
|
-
declare function CardAction({ className, ...props }: CardActionProps): JSX.Element;
|
|
16
|
-
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
17
|
-
export type { CardActionProps, CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardProps, CardTitleProps, };
|
|
18
|
-
//# sourceMappingURL=card.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/components/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAQjD,KAAK,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAEvC,iBAAS,IAAI,CAAC,E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ACf,eAAe,EACf,SAAS,EACT,cAAc,GACf,CAAC"}
|
package/dist/components/card.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from "#lib/utils";
|
|
3
|
-
function Card({ className, ...props }) {
|
|
4
|
-
return (_jsx("div", { className: cn("flex flex-col gap-6 overflow-auto py-6", "rounded-xl border", "bg-card text-card-foreground shadow-sm", className), "data-slot": "card", ...props }));
|
|
5
|
-
}
|
|
6
|
-
function CardHeader({ className, ...props }) {
|
|
7
|
-
return (_jsx("div", { className: cn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5", "px-6", "has-[data-slot=card-action]:grid-cols-[1fr_auto]", "[.border-b]:pb-6", className), "data-slot": "card-header", ...props }));
|
|
8
|
-
}
|
|
9
|
-
function CardTitle({ children, className, ...props }) {
|
|
10
|
-
return (_jsx("div", { className: cn("leading-none font-semibold", className), "data-slot": "card-title", ...props, children: children }));
|
|
11
|
-
}
|
|
12
|
-
function CardDescription({ className, ...props }) {
|
|
13
|
-
return (_jsx("div", { className: cn("text-sm text-muted-foreground", className), "data-slot": "card-description", ...props }));
|
|
14
|
-
}
|
|
15
|
-
function CardContent({ className, ...props }) {
|
|
16
|
-
return _jsx("div", { className: cn("px-6", className), "data-slot": "card-content", ...props });
|
|
17
|
-
}
|
|
18
|
-
function CardFooter({ className, ...props }) {
|
|
19
|
-
return (_jsx("div", { className: cn("flex items-center", "px-6", "[.border-t]:pt-6", className), "data-slot": "card-footer", ...props }));
|
|
20
|
-
}
|
|
21
|
-
function CardAction({ className, ...props }) {
|
|
22
|
-
return (_jsx("div", { className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className), "data-slot": "card-action", ...props }));
|
|
23
|
-
}
|
|
24
|
-
/* -----------------------------------------------------------------------------
|
|
25
|
-
* Exports
|
|
26
|
-
* -------------------------------------------------------------------------- */
|
|
27
|
-
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { Scope } from "@radix-ui/react-context";
|
|
2
|
-
import type { UseEmblaCarouselType } from "embla-carousel-react";
|
|
3
|
-
import type { ComponentProps, JSX } from "react";
|
|
4
|
-
import useEmblaCarousel from "embla-carousel-react";
|
|
5
|
-
import { Button } from "#components/button";
|
|
6
|
-
type ScopedProps<P> = P & {
|
|
7
|
-
__scopeCarousel?: Scope;
|
|
8
|
-
};
|
|
9
|
-
declare const createCarouselScope: import("@radix-ui/react-context").CreateScope;
|
|
10
|
-
type CarouselApi = UseEmblaCarouselType[1];
|
|
11
|
-
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
12
|
-
type CarouselOptions = UseCarouselParameters[0];
|
|
13
|
-
type CarouselPlugin = UseCarouselParameters[1];
|
|
14
|
-
interface BaseCarouselProps {
|
|
15
|
-
opts?: CarouselOptions;
|
|
16
|
-
orientation?: "horizontal" | "vertical";
|
|
17
|
-
plugins?: CarouselPlugin;
|
|
18
|
-
setApi?: (api: CarouselApi) => void;
|
|
19
|
-
}
|
|
20
|
-
interface CarouselProps extends BaseCarouselProps, ComponentProps<"div"> {
|
|
21
|
-
}
|
|
22
|
-
declare function Carousel({ __scopeCarousel, children, className, opts, orientation, plugins, setApi, ...props }: ScopedProps<CarouselProps>): JSX.Element;
|
|
23
|
-
interface CarouselContentProps extends ComponentProps<"div"> {
|
|
24
|
-
classNames?: {
|
|
25
|
-
content?: string;
|
|
26
|
-
wrapper?: string;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
declare function CarouselContent({ __scopeCarousel, className, classNames, ...props }: ScopedProps<CarouselContentProps>): JSX.Element;
|
|
30
|
-
type CarouselItemProps = ComponentProps<"div">;
|
|
31
|
-
declare function CarouselItem({ __scopeCarousel, className, ...props }: ScopedProps<CarouselItemProps>): JSX.Element;
|
|
32
|
-
type CarouselPreviousProps = ComponentProps<typeof Button>;
|
|
33
|
-
declare function CarouselPrevious({ __scopeCarousel, className, size, variant, ...props }: ScopedProps<CarouselPreviousProps>): JSX.Element;
|
|
34
|
-
type CarouselNextProps = ComponentProps<typeof Button>;
|
|
35
|
-
declare function CarouselNext({ __scopeCarousel, className, size, variant, ...props }: ScopedProps<CarouselNextProps>): JSX.Element;
|
|
36
|
-
export type { CarouselApi, CarouselContentProps, CarouselItemProps, CarouselNextProps, CarouselPreviousProps, CarouselProps, };
|
|
37
|
-
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, createCarouselScope, };
|
|
38
|
-
//# sourceMappingURL=carousel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../src/components/carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAiB,MAAM,OAAO,CAAC;AAIhE,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AAIpD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAQ5C,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,eAAe,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAEtD,QAAA,MAA8B,mBAAmB,+CAAqC,CAAC;AAEvF,KAAK,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACjE,KAAK,eAAe,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAChD,KAAK,cAAc,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAE/C,UAAU,iBAAiB;IACzB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,WAAW,CAAC,EAAE,YAA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T,IAAa,EACb,OAAmB,EACnB,GAAG,KAAK,EACT,EAAE,WAAW,CAAC,iBAAiB,CAAC,GAAG,GAAG,CAAC,OAAO,CA6B9C;AAMD,YAAY,EACV,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,GACd,CAAC;AACF,OAAO,EACL,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,GACpB,CAAC"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "#lib/utils";
|
|
4
|
-
import { createContextScope } from "@radix-ui/react-context";
|
|
5
|
-
import useEmblaCarousel from "embla-carousel-react";
|
|
6
|
-
import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";
|
|
7
|
-
import { useCallback, useEffect, useState } from "react";
|
|
8
|
-
import { Button } from "#components/button";
|
|
9
|
-
/* -----------------------------------------------------------------------------
|
|
10
|
-
* Context: Carousel
|
|
11
|
-
* -------------------------------------------------------------------------- */
|
|
12
|
-
const CAROUSEL_NAME = "Carousel";
|
|
13
|
-
const [createCarouselContext, createCarouselScope] = createContextScope(CAROUSEL_NAME);
|
|
14
|
-
const [CarouselContextProvider, useCarouselContext] = createCarouselContext(CAROUSEL_NAME);
|
|
15
|
-
function Carousel({ __scopeCarousel, children, className, opts, orientation, plugins, setApi, ...props }) {
|
|
16
|
-
const [carouselRef, api] = useEmblaCarousel({
|
|
17
|
-
...opts,
|
|
18
|
-
axis: orientation === "vertical" ? "y" : "x",
|
|
19
|
-
}, plugins);
|
|
20
|
-
const [canScrollPrevious, setCanScrollPrevious] = useState(false);
|
|
21
|
-
const [canScrollNext, setCanScrollNext] = useState(false);
|
|
22
|
-
const onSelect = useCallback((carouselApi) => {
|
|
23
|
-
if (!carouselApi) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
setCanScrollPrevious(carouselApi.canScrollPrev());
|
|
27
|
-
setCanScrollNext(carouselApi.canScrollNext());
|
|
28
|
-
}, []);
|
|
29
|
-
const scrollPrevious = useCallback(() => {
|
|
30
|
-
api?.scrollPrev();
|
|
31
|
-
}, [api]);
|
|
32
|
-
const scrollNext = useCallback(() => {
|
|
33
|
-
api?.scrollNext();
|
|
34
|
-
}, [api]);
|
|
35
|
-
const handleKeyDown = useCallback((event) => {
|
|
36
|
-
if (event.key === "ArrowLeft") {
|
|
37
|
-
event.preventDefault();
|
|
38
|
-
scrollPrevious();
|
|
39
|
-
}
|
|
40
|
-
else if (event.key === "ArrowRight") {
|
|
41
|
-
event.preventDefault();
|
|
42
|
-
scrollNext();
|
|
43
|
-
}
|
|
44
|
-
}, [scrollPrevious, scrollNext]);
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
if (!api || !setApi) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
setApi(api);
|
|
50
|
-
}, [api, setApi]);
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (!api) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
// Defer onSelect to avoid synchronous setState in effect
|
|
56
|
-
queueMicrotask(() => {
|
|
57
|
-
onSelect(api);
|
|
58
|
-
});
|
|
59
|
-
api.on("reInit", onSelect);
|
|
60
|
-
api.on("select", onSelect);
|
|
61
|
-
return () => {
|
|
62
|
-
api.off("select", onSelect);
|
|
63
|
-
};
|
|
64
|
-
}, [api, onSelect]);
|
|
65
|
-
return (_jsx(CarouselContextProvider, { api: api, canScrollNext: canScrollNext, canScrollPrev: canScrollPrevious, carouselRef: carouselRef, opts: opts, orientation: orientation ?? (opts?.axis === "y" ? "vertical" : "horizontal"), scope: __scopeCarousel, scrollNext: scrollNext, scrollPrev: scrollPrevious, children: _jsx("div", { className: cn("relative", className), "data-slot": "carousel", onKeyDownCapture: handleKeyDown, ...props, children: children }) }));
|
|
66
|
-
}
|
|
67
|
-
/* -----------------------------------------------------------------------------
|
|
68
|
-
* Component: CarouselContent
|
|
69
|
-
* -------------------------------------------------------------------------- */
|
|
70
|
-
const CAROUSEL_CONTENT_NAME = "CarouselContent";
|
|
71
|
-
function CarouselContent({ __scopeCarousel, className, classNames, ...props }) {
|
|
72
|
-
const { carouselRef, orientation } = useCarouselContext(CAROUSEL_CONTENT_NAME, __scopeCarousel);
|
|
73
|
-
return (_jsx("div", { ref: carouselRef, className: cn("overflow-hidden", classNames?.wrapper), "data-slot": "carousel-content", children: _jsx("div", { className: cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", classNames?.content, className), ...props }) }));
|
|
74
|
-
}
|
|
75
|
-
/* -----------------------------------------------------------------------------
|
|
76
|
-
* Component: CarouselItem
|
|
77
|
-
* -------------------------------------------------------------------------- */
|
|
78
|
-
const CAROUSEL_ITEM_NAME = "CarouselItem";
|
|
79
|
-
function CarouselItem({ __scopeCarousel, className, ...props }) {
|
|
80
|
-
const { orientation } = useCarouselContext(CAROUSEL_ITEM_NAME, __scopeCarousel);
|
|
81
|
-
return (_jsx("div", { "aria-roledescription": "slide", className: cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className), "data-slot": "carousel-item", role: "group", ...props }));
|
|
82
|
-
}
|
|
83
|
-
/* -----------------------------------------------------------------------------
|
|
84
|
-
* Component: CarouselPrevious
|
|
85
|
-
* -------------------------------------------------------------------------- */
|
|
86
|
-
const CAROUSEL_PREVIOUS_NAME = "CarouselPrevious";
|
|
87
|
-
function CarouselPrevious({ __scopeCarousel, className, size = "icon", variant = "outline", ...props }) {
|
|
88
|
-
const { canScrollPrev, orientation, scrollPrev } = useCarouselContext(CAROUSEL_PREVIOUS_NAME, __scopeCarousel);
|
|
89
|
-
return (_jsxs(Button, { "aria-label": "Previous slide", className: cn("absolute", "size-8", "shadow-none", orientation === "horizontal"
|
|
90
|
-
? "top-1/2 -left-12 -translate-y-1/2"
|
|
91
|
-
: "-top-12 left-1/2 -translate-x-1/2 rotate-90", className), "data-slot": "carousel-previous", disabled: !canScrollPrev, size: size, variant: variant, onClick: scrollPrev, ...props, children: [_jsx(ArrowLeftIcon, {}), _jsx("span", { className: "sr-only", children: "Previous slide" })] }));
|
|
92
|
-
}
|
|
93
|
-
/* -----------------------------------------------------------------------------
|
|
94
|
-
* Component: CarouselNext
|
|
95
|
-
* -------------------------------------------------------------------------- */
|
|
96
|
-
const CAROUSEL_NEXT_NAME = "CarouselNext";
|
|
97
|
-
function CarouselNext({ __scopeCarousel, className, size = "icon", variant = "outline", ...props }) {
|
|
98
|
-
const { canScrollNext, orientation, scrollNext } = useCarouselContext(CAROUSEL_NEXT_NAME, __scopeCarousel);
|
|
99
|
-
return (_jsxs(Button, { "aria-label": "Next slide", className: cn("absolute", "size-8", "shadow-none", orientation === "horizontal"
|
|
100
|
-
? "top-1/2 -right-12 -translate-y-1/2"
|
|
101
|
-
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className), "data-slot": "carousel-next", disabled: !canScrollNext, size: size, variant: variant, onClick: scrollNext, ...props, children: [_jsx(ArrowRightIcon, {}), _jsx("span", { className: "sr-only", children: "Next slide" })] }));
|
|
102
|
-
}
|
|
103
|
-
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, createCarouselScope, };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { Scope } from "@radix-ui/react-context";
|
|
2
|
-
import type { ComponentProps, ComponentType, JSX, ReactNode } from "react";
|
|
3
|
-
import type { NameType, Payload, ValueType } from "recharts/types/component/DefaultTooltipContent";
|
|
4
|
-
import type { TooltipContentProps, TooltipProps } from "recharts";
|
|
5
|
-
import * as RechartsPrimitive from "recharts";
|
|
6
|
-
type ExtractProps<T> = T extends (props: infer P) => ReactNode ? P : never;
|
|
7
|
-
type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
8
|
-
declare const THEMES: {
|
|
9
|
-
readonly dark: ".dark";
|
|
10
|
-
readonly light: "";
|
|
11
|
-
};
|
|
12
|
-
type ChartConfig = Record<string, {
|
|
13
|
-
label?: ReactNode;
|
|
14
|
-
icon?: ComponentType;
|
|
15
|
-
} & ({
|
|
16
|
-
color?: never;
|
|
17
|
-
theme: Record<keyof typeof THEMES, string>;
|
|
18
|
-
} | {
|
|
19
|
-
color?: string;
|
|
20
|
-
theme?: never;
|
|
21
|
-
})>;
|
|
22
|
-
type ScopedProps<P> = P & {
|
|
23
|
-
__scopeChart?: Scope;
|
|
24
|
-
};
|
|
25
|
-
declare const createChartScope: import("@radix-ui/react-context").CreateScope;
|
|
26
|
-
interface ChartContainerProps extends ComponentProps<"div"> {
|
|
27
|
-
children: ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
28
|
-
config: ChartConfig;
|
|
29
|
-
}
|
|
30
|
-
declare function ChartContainer({ __scopeChart, children, className, config, id, ...props }: ScopedProps<ChartContainerProps>): JSX.Element;
|
|
31
|
-
interface ChartStyleProps {
|
|
32
|
-
config: ChartConfig;
|
|
33
|
-
id: string;
|
|
34
|
-
}
|
|
35
|
-
declare function ChartStyle({ config, id }: ChartStyleProps): ReactNode;
|
|
36
|
-
type ChartTooltipProps<TValue extends ValueType, TName extends NameType> = TooltipProps<TValue, TName>;
|
|
37
|
-
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
38
|
-
type ChartTooltipContentProps<TValue extends ValueType, TName extends NameType> = Omit<MakeOptional<TooltipContentProps<TValue, TName>, "accessibilityLayer" | "active" | "activeIndex" | "coordinate" | "payload">, "payload"> & {
|
|
39
|
-
hideIndicator?: boolean;
|
|
40
|
-
hideLabel?: boolean;
|
|
41
|
-
indicator?: "dashed" | "dot" | "line";
|
|
42
|
-
labelKey?: string;
|
|
43
|
-
nameKey?: string;
|
|
44
|
-
color?: string | undefined;
|
|
45
|
-
className?: string | undefined;
|
|
46
|
-
payload?: Payload<TValue, TName>[];
|
|
47
|
-
};
|
|
48
|
-
declare function ChartTooltipContent<TValue extends ValueType, TName extends NameType>({ __scopeChart, active, className, color, formatter, hideIndicator, hideLabel, indicator, label, labelClassName, labelFormatter, labelKey, nameKey, payload }: ScopedProps<ChartTooltipContentProps<TValue, TName>>): ReactNode;
|
|
49
|
-
type ChartLegendProps = ComponentProps<typeof RechartsPrimitive.Legend>;
|
|
50
|
-
declare const ChartLegend: import("react").MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
|
|
51
|
-
type ChartLegendContentProps = ComponentProps<"div"> & ExtractProps<RechartsPrimitive.LegendProps["content"]> & {
|
|
52
|
-
hideIcon?: boolean;
|
|
53
|
-
nameKey?: string;
|
|
54
|
-
};
|
|
55
|
-
declare function ChartLegendContent({ __scopeChart, className, hideIcon, nameKey, payload, verticalAlign }: ScopedProps<ChartLegendContentProps>): ReactNode;
|
|
56
|
-
export type { ChartConfig, ChartContainerProps, ChartLegendContentProps, ChartLegendProps, ChartStyleProps, ChartTooltipContentProps, ChartTooltipProps, };
|
|
57
|
-
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, createChartScope, };
|
|
58
|
-
//# sourceMappingURL=chart.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../src/components/chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAiB,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1F,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AACnG,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKlE,OAAO,KAAK,iBAAiB,MAAM,UAAU,CAAC;AAM9C,KAAK,YAAY,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lE;AAMD,KAAK,gBAAgB,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAExE,QAAA,MAAM,WAAW,gHAA2B,CAAC;AAQ7C,KAAK,uBAAuB,GAAG,cAAc,CAAC,KAAK,CAAC,GAClD,YAAY,CAAC,iBAAiB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,GAAG;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEJ,iBAAS,kBAAkB,CAAC,EAC1B,YAAY,EACZ,SAAS,EACT,QAAgB,EAChB,OAAO,EACP,OAAO,EACP,aAAwB,EACzB,EAAE,WAAW,CAAC,uBAAuB,CAAC,GAAG,SAAS,CAkDlD;AAkID,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,iBAAiB,GAClB,CAAC;AAEF,OAAO,EACL,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,GACjB,CAAC"}
|
package/dist/components/chart.js
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "#lib/utils";
|
|
4
|
-
import { createContextScope } from "@radix-ui/react-context";
|
|
5
|
-
import { useId, useMemo } from "react";
|
|
6
|
-
import * as RechartsPrimitive from "recharts";
|
|
7
|
-
/* -----------------------------------------------------------------------------
|
|
8
|
-
* Chart Configuration and Theme Constants
|
|
9
|
-
* --------------------------------------------------------------------------- */
|
|
10
|
-
const THEMES = { dark: ".dark", light: "" };
|
|
11
|
-
/* -----------------------------------------------------------------------------
|
|
12
|
-
* Context: ChartProvider
|
|
13
|
-
* --------------------------------------------------------------------------- */
|
|
14
|
-
const CHART_PROVIDER_NAME = "ChartProvider";
|
|
15
|
-
const [createChartContext, createChartScope] = createContextScope(CHART_PROVIDER_NAME);
|
|
16
|
-
const [ChartContextProvider, useChartContext] = createChartContext(CHART_PROVIDER_NAME);
|
|
17
|
-
function ChartContainer({ __scopeChart, children, className, config, id, ...props }) {
|
|
18
|
-
const uniqueId = useId();
|
|
19
|
-
const chartId = `chart-${id ?? uniqueId}`;
|
|
20
|
-
return (_jsx(ChartContextProvider, { config: config, scope: __scopeChart, children: _jsxs("div", { className: cn("flex aspect-video justify-center text-xs", "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", "[&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50", "[&_.recharts-curve.recharts-tooltip-cursor]:stroke-border", "[&_.recharts-dot[stroke='#fff']]:stroke-transparent", "[&_.recharts-layer]:outline-hidden", "[&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border", "[&_.recharts-radial-bar-background-sector]:fill-muted", "[&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted", "[&_.recharts-reference-line_[stroke='#ccc']]:stroke-border", "[&_.recharts-sector]:outline-hidden", "[&_.recharts-sector[stroke='#fff']]:stroke-transparent", "[&_.recharts-surface]:outline-hidden", className), "data-chart": chartId, "data-slot": "chart", ...props, children: [_jsx(ChartStyle, { config: config, id: chartId }), _jsx(RechartsPrimitive.ResponsiveContainer, { children: children })] }) }));
|
|
21
|
-
}
|
|
22
|
-
function ChartStyle({ config, id }) {
|
|
23
|
-
const colorConfig = Object.entries(config).filter(([, itemConfig]) => itemConfig.theme ?? itemConfig.color);
|
|
24
|
-
if (colorConfig.length === 0) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
return (_jsx("style", { dangerouslySetInnerHTML: {
|
|
28
|
-
__html: generateChartStyles(id, colorConfig),
|
|
29
|
-
} }));
|
|
30
|
-
}
|
|
31
|
-
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
32
|
-
/* -----------------------------------------------------------------------------
|
|
33
|
-
* Component: ChartTooltipContent
|
|
34
|
-
* -------------------------------------------------------------------------- */
|
|
35
|
-
const CHART_TOOLTIP_CONTENT_NAME = "ChartTooltipContent";
|
|
36
|
-
function ChartTooltipContent({ __scopeChart, active, className, color, formatter, hideIndicator = false, hideLabel = false, indicator = "dot", label, labelClassName, labelFormatter, labelKey, nameKey, payload = [], }) {
|
|
37
|
-
const { config } = useChartContext(CHART_TOOLTIP_CONTENT_NAME, __scopeChart);
|
|
38
|
-
const tooltipLabel = useMemo(() => {
|
|
39
|
-
if (hideLabel || payload.length === 0) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
const [item] = payload;
|
|
43
|
-
const key = safeToString(labelKey ?? item.dataKey ?? item.name ?? "value");
|
|
44
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
45
|
-
const value = !labelKey && typeof label === "string"
|
|
46
|
-
? label in config
|
|
47
|
-
? (config[label].label ?? label)
|
|
48
|
-
: label
|
|
49
|
-
: itemConfig?.label;
|
|
50
|
-
if (labelFormatter) {
|
|
51
|
-
return (_jsx("div", { className: cn("font-medium", labelClassName), children: labelFormatter(value, payload) }));
|
|
52
|
-
}
|
|
53
|
-
if (!value) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
return _jsx("div", { className: cn("font-medium", labelClassName), children: value });
|
|
57
|
-
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
|
58
|
-
if (!active || payload.length === 0) {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
62
|
-
return (_jsxs("div", { className: cn("grid min-w-[8rem] items-start gap-1.5 px-2.5 py-1.5", "rounded-lg border border-border/50", "bg-background text-xs shadow-xl", className), children: [nestLabel ? null : tooltipLabel, _jsx("div", { className: "grid gap-1.5", children: payload.map((item, index) => {
|
|
63
|
-
const key = safeToString(nameKey ?? item.name ?? item.dataKey ?? "value");
|
|
64
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
65
|
-
const indicatorColor = color ??
|
|
66
|
-
(isRecord(item.payload) &&
|
|
67
|
-
"fill" in item.payload &&
|
|
68
|
-
typeof item.payload.fill === "string"
|
|
69
|
-
? item.payload.fill
|
|
70
|
-
: undefined) ??
|
|
71
|
-
item.color;
|
|
72
|
-
return (_jsx("div", { className: cn("flex w-full flex-wrap items-stretch gap-2", "[&>svg]:size-2.5 [&>svg]:text-muted-foreground", indicator === "dot" && "items-center"), children: formatter && item.value !== undefined && item.name ? (formatter(item.value, item.name, item, index, [item])) : (_jsxs(_Fragment, { children: [itemConfig?.icon ? (_jsx(itemConfig.icon, {})) : (!hideIndicator && (_jsx("div", { className: cn("shrink-0", "rounded-xs border-(--color-border)", "bg-(--color-bg)", {
|
|
73
|
-
"h-2.5 w-2.5": indicator === "dot",
|
|
74
|
-
"my-0.5": nestLabel && indicator === "dashed",
|
|
75
|
-
"border-1.5 w-0 border-dashed bg-transparent": indicator === "dashed",
|
|
76
|
-
"w-1": indicator === "line",
|
|
77
|
-
}), style: {
|
|
78
|
-
"--color-bg": indicatorColor,
|
|
79
|
-
"--color-border": indicatorColor,
|
|
80
|
-
} }))), _jsxs("div", { className: cn("flex flex-1 justify-between", "leading-none", nestLabel ? "items-end" : "items-center"), children: [_jsxs("div", { className: "grid gap-1.5", children: [nestLabel ? tooltipLabel : null, _jsx("span", { className: "text-muted-foreground", children: itemConfig?.label ?? item.name })] }), item.value != null && (_jsx("span", { className: cn("font-mono font-medium text-foreground", "tabular-nums"), children: typeof item.value === "number"
|
|
81
|
-
? item.value.toLocaleString()
|
|
82
|
-
: safeToString(item.value) }))] })] })) }, key));
|
|
83
|
-
}) })] }));
|
|
84
|
-
}
|
|
85
|
-
const ChartLegend = RechartsPrimitive.Legend;
|
|
86
|
-
/* -----------------------------------------------------------------------------
|
|
87
|
-
* Component: ChartLegendContent
|
|
88
|
-
* -------------------------------------------------------------------------- */
|
|
89
|
-
const CHART_LEGEND_CONTENT_NAME = "ChartLegendContent";
|
|
90
|
-
function ChartLegendContent({ __scopeChart, className, hideIcon = false, nameKey, payload, verticalAlign = "bottom", }) {
|
|
91
|
-
const { config } = useChartContext(CHART_LEGEND_CONTENT_NAME, __scopeChart);
|
|
92
|
-
if (!payload?.length) {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
return (_jsx("div", { className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className), children: payload.map((item) => {
|
|
96
|
-
let key = "value";
|
|
97
|
-
if (nameKey) {
|
|
98
|
-
key = nameKey;
|
|
99
|
-
}
|
|
100
|
-
else if (item.dataKey != null) {
|
|
101
|
-
key = safeToString(item.dataKey);
|
|
102
|
-
}
|
|
103
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
104
|
-
return (_jsxs("div", { className: cn("flex items-center gap-1.5", "[&>svg]:size-3 [&>svg]:text-muted-foreground"), children: [itemConfig?.icon && !hideIcon ? (_jsx(itemConfig.icon, {})) : (_jsx("div", { className: cn("size-2 shrink-0", "rounded-md"), style: {
|
|
105
|
-
backgroundColor: item.color,
|
|
106
|
-
} })), itemConfig?.label] }, nameKey ? safeToString(itemConfig?.color ?? "") : safeToString(item.value ?? "")));
|
|
107
|
-
}) }));
|
|
108
|
-
}
|
|
109
|
-
/* -----------------------------------------------------------------------------
|
|
110
|
-
* Helpers
|
|
111
|
-
* -------------------------------------------------------------------------- */
|
|
112
|
-
/**
|
|
113
|
-
* Type guard to check if an unknown value is a record with string keys
|
|
114
|
-
*/
|
|
115
|
-
function isRecord(value) {
|
|
116
|
-
return typeof value === "object" && value !== null;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Safely gets a string value from a record by key
|
|
120
|
-
*/
|
|
121
|
-
function getStringValue(record, key) {
|
|
122
|
-
if (key in record) {
|
|
123
|
-
const value = record[key];
|
|
124
|
-
return typeof value === "string" ? value : undefined;
|
|
125
|
-
}
|
|
126
|
-
return undefined;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Safely converts a value to string without type coercion
|
|
130
|
-
*/
|
|
131
|
-
function safeToString(value) {
|
|
132
|
-
if (typeof value === "string") {
|
|
133
|
-
return value;
|
|
134
|
-
}
|
|
135
|
-
if (typeof value === "number") {
|
|
136
|
-
return value.toString();
|
|
137
|
-
}
|
|
138
|
-
if (value === null || value === undefined) {
|
|
139
|
-
return "";
|
|
140
|
-
}
|
|
141
|
-
if (typeof value === "boolean") {
|
|
142
|
-
return value.toString();
|
|
143
|
-
}
|
|
144
|
-
if (typeof value === "bigint") {
|
|
145
|
-
return value.toString();
|
|
146
|
-
}
|
|
147
|
-
if (typeof value === "symbol") {
|
|
148
|
-
return value.toString();
|
|
149
|
-
}
|
|
150
|
-
// For objects, arrays, functions, and other complex types, return empty string to avoid [object Object]
|
|
151
|
-
return "";
|
|
152
|
-
}
|
|
153
|
-
function getPayloadConfigFromPayload(config, payload, key) {
|
|
154
|
-
if (!isRecord(payload)) {
|
|
155
|
-
return undefined;
|
|
156
|
-
}
|
|
157
|
-
const payloadPayload = isRecord(payload.payload) ? payload.payload : undefined;
|
|
158
|
-
let configLabelKey = key;
|
|
159
|
-
// Try to get the config key from the payload first
|
|
160
|
-
const payloadValue = getStringValue(payload, key);
|
|
161
|
-
if (payloadValue) {
|
|
162
|
-
configLabelKey = payloadValue;
|
|
163
|
-
}
|
|
164
|
-
else if (payloadPayload) {
|
|
165
|
-
// If not found in the payload, try the nested payload
|
|
166
|
-
const nestedValue = getStringValue(payloadPayload, key);
|
|
167
|
-
if (nestedValue) {
|
|
168
|
-
configLabelKey = nestedValue;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Generates CSS custom property for a specific theme and config item
|
|
175
|
-
*/
|
|
176
|
-
function generateCssVariable(key, itemConfig, theme) {
|
|
177
|
-
const color = itemConfig.theme?.[theme] ?? itemConfig.color;
|
|
178
|
-
return color ? ` --color-${key}: ${color};` : null;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Generates CSS rules for a specific theme
|
|
182
|
-
*/
|
|
183
|
-
function generateThemeStyles(theme, prefix, id, colorConfig) {
|
|
184
|
-
const cssVariables = colorConfig
|
|
185
|
-
.map(([key, itemConfig]) => generateCssVariable(key, itemConfig, theme))
|
|
186
|
-
.filter(Boolean)
|
|
187
|
-
.join("\n");
|
|
188
|
-
return `${prefix} [data-chart=${id}] {\n${cssVariables}\n}`;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Generates complete CSS styles for all themes
|
|
192
|
-
*/
|
|
193
|
-
function generateChartStyles(id, colorConfig) {
|
|
194
|
-
return Object.entries(THEMES)
|
|
195
|
-
.map(([theme, prefix]) => generateThemeStyles(theme, prefix, id, colorConfig))
|
|
196
|
-
.join("\n\n");
|
|
197
|
-
}
|
|
198
|
-
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, createChartScope, };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps, JSX } from "react";
|
|
2
|
-
import * as CheckboxGroupPrimitive from "#primitives/checkbox-group";
|
|
3
|
-
type CheckboxCardsProps = ComponentProps<typeof CheckboxGroupPrimitive.Root>;
|
|
4
|
-
declare function CheckboxCards(props: CheckboxCardsProps): JSX.Element;
|
|
5
|
-
interface CheckboxCardsItemProps extends ComponentProps<typeof CheckboxGroupPrimitive.Item> {
|
|
6
|
-
checkboxClassName?: string;
|
|
7
|
-
}
|
|
8
|
-
declare function CheckboxCardsItem({ checkboxClassName, children, className, ...props }: CheckboxCardsItemProps): JSX.Element;
|
|
9
|
-
export { CheckboxCards, CheckboxCardsItem };
|
|
10
|
-
export type { CheckboxCardsItemProps, CheckboxCardsProps };
|
|
11
|
-
//# sourceMappingURL=checkbox-cards.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-cards.d.ts","sourceRoot":"","sources":["../../src/components/checkbox-cards.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAMjD,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC;AAMrE,KAAK,kBAAkB,GAAG,cAAc,CAAC,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AAE7E,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAE7D;AAMD,UAAU,sBAAuB,SAAQ,cAAc,CAAC,OAAO,sBAAsB,CAAC,IAAI,CAAC;IACzF,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,iBAAS,iBAAiB,CAAC,EACzB,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,sBAAsB,GAAG,GAAG,CAAC,OAAO,CAuCtC;AAMD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC;AAC5C,YAAY,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "#lib/utils";
|
|
4
|
-
import { CheckIcon } from "lucide-react";
|
|
5
|
-
import { Label } from "#components/label";
|
|
6
|
-
import * as CheckboxGroupPrimitive from "#primitives/checkbox-group";
|
|
7
|
-
function CheckboxCards(props) {
|
|
8
|
-
return _jsx(CheckboxGroupPrimitive.Root, { "data-slot": "checkbox-cards", ...props });
|
|
9
|
-
}
|
|
10
|
-
function CheckboxCardsItem({ checkboxClassName, children, className, ...props }) {
|
|
11
|
-
return (_jsxs(Label, { className: cn("flex items-start gap-3", "p-3", "rounded-lg border border-input", "transition", "hover:not-has-disabled:not-has-aria-checked:bg-secondary", "has-focus-visible:border-ring", "has-disabled:opacity-50", "has-aria-checked:border-primary has-aria-checked:bg-primary/10", className), "data-slot": "checkbox-card", children: [_jsx(CheckboxGroupPrimitive.Item, { className: cn("peer flex size-4 shrink-0", "rounded-sm border border-input shadow-xs outline-hidden", "text-primary-foreground", "transition", "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50", "aria-checked:border-primary aria-checked:bg-primary", "focus-visible:aria-checked:ring-primary/20", "dark:bg-input/30", "dark:focus-visible:aria-checked:ring-primary/40", checkboxClassName), "data-slot": "checkbox-card-item", ...props, children: _jsx(CheckboxGroupPrimitive.CheckboxGroupIndicator, { "data-slot": "checkbox-card-indicator", children: _jsx(CheckIcon, { className: "size-3.5" }) }) }), children] }));
|
|
12
|
-
}
|
|
13
|
-
/* -----------------------------------------------------------------------------
|
|
14
|
-
* Exports
|
|
15
|
-
* -------------------------------------------------------------------------- */
|
|
16
|
-
export { CheckboxCards, CheckboxCardsItem };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps, JSX } from "react";
|
|
2
|
-
import * as CheckboxGroupPrimitive from "#primitives/checkbox-group";
|
|
3
|
-
type CheckboxGroupProps = ComponentProps<typeof CheckboxGroupPrimitive.Root>;
|
|
4
|
-
declare function CheckboxGroup({ className, ...props }: CheckboxGroupProps): JSX.Element;
|
|
5
|
-
type CheckboxGroupItemProps = ComponentProps<typeof CheckboxGroupPrimitive.Item>;
|
|
6
|
-
declare function CheckboxGroupItem({ className, ...props }: CheckboxGroupItemProps): JSX.Element;
|
|
7
|
-
export { CheckboxGroup, CheckboxGroupItem };
|
|
8
|
-
export type { CheckboxGroupItemProps, CheckboxGroupProps };
|
|
9
|
-
//# sourceMappingURL=checkbox-group.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-group.d.ts","sourceRoot":"","sources":["../../src/components/checkbox-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAKjD,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC;AAMrE,KAAK,kBAAkB,GAAG,cAAc,CAAC,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AAE7E,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAQ/E;AAMD,KAAK,sBAAsB,GAAG,cAAc,CAAC,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AAEjF,iBAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,GAAG,GAAG,CAAC,OAAO,CAgCvF;AAMD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC;AAC5C,YAAY,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,CAAC"}
|