@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
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as _$react from "react";
|
|
2
|
+
import { ComponentProps, ComponentType, JSX, ReactNode } from "react";
|
|
3
|
+
import * as _$_radix_ui_react_context0 from "@radix-ui/react-context";
|
|
4
|
+
import { Scope } from "@radix-ui/react-context";
|
|
5
|
+
import * as RechartsPrimitive from "recharts";
|
|
6
|
+
import { TooltipContentProps, TooltipProps } from "recharts";
|
|
7
|
+
import { NameType, Payload, ValueType } from "recharts/types/component/DefaultTooltipContent";
|
|
8
|
+
|
|
9
|
+
//#region src/components/chart.d.ts
|
|
10
|
+
type ExtractProps<T> = T extends ((props: infer P) => ReactNode) ? P : never;
|
|
11
|
+
type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
12
|
+
declare const THEMES: {
|
|
13
|
+
readonly dark: ".dark";
|
|
14
|
+
readonly light: "";
|
|
15
|
+
};
|
|
16
|
+
type ChartConfig = Record<string, {
|
|
17
|
+
label?: ReactNode;
|
|
18
|
+
icon?: ComponentType;
|
|
19
|
+
} & ({
|
|
20
|
+
color?: never;
|
|
21
|
+
theme: Record<keyof typeof THEMES, string>;
|
|
22
|
+
} | {
|
|
23
|
+
color?: string;
|
|
24
|
+
theme?: never;
|
|
25
|
+
})>;
|
|
26
|
+
type ScopedProps<P> = P & {
|
|
27
|
+
__scopeChart?: Scope;
|
|
28
|
+
};
|
|
29
|
+
declare const createChartScope: _$_radix_ui_react_context0.CreateScope;
|
|
30
|
+
interface ChartContainerProps extends ComponentProps<"div"> {
|
|
31
|
+
children: ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
32
|
+
config: ChartConfig;
|
|
33
|
+
}
|
|
34
|
+
declare function ChartContainer({
|
|
35
|
+
__scopeChart,
|
|
36
|
+
children,
|
|
37
|
+
className,
|
|
38
|
+
config,
|
|
39
|
+
id,
|
|
40
|
+
...props
|
|
41
|
+
}: ScopedProps<ChartContainerProps>): JSX.Element;
|
|
42
|
+
interface ChartStyleProps {
|
|
43
|
+
config: ChartConfig;
|
|
44
|
+
id: string;
|
|
45
|
+
}
|
|
46
|
+
declare function ChartStyle({
|
|
47
|
+
config,
|
|
48
|
+
id
|
|
49
|
+
}: ChartStyleProps): ReactNode;
|
|
50
|
+
type ChartTooltipProps<TValue extends ValueType, TName extends NameType> = TooltipProps<TValue, TName>;
|
|
51
|
+
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
52
|
+
type ChartTooltipContentProps<TValue extends ValueType, TName extends NameType> = Omit<MakeOptional<TooltipContentProps<TValue, TName>, "accessibilityLayer" | "active" | "activeIndex" | "coordinate" | "payload">, "payload"> & {
|
|
53
|
+
hideIndicator?: boolean;
|
|
54
|
+
hideLabel?: boolean;
|
|
55
|
+
indicator?: "dashed" | "dot" | "line";
|
|
56
|
+
labelKey?: string;
|
|
57
|
+
nameKey?: string;
|
|
58
|
+
color?: string | undefined;
|
|
59
|
+
className?: string | undefined;
|
|
60
|
+
payload?: Payload<TValue, TName>[];
|
|
61
|
+
};
|
|
62
|
+
declare function ChartTooltipContent<TValue extends ValueType, TName extends NameType>({
|
|
63
|
+
__scopeChart,
|
|
64
|
+
active,
|
|
65
|
+
className,
|
|
66
|
+
color,
|
|
67
|
+
formatter,
|
|
68
|
+
hideIndicator,
|
|
69
|
+
hideLabel,
|
|
70
|
+
indicator,
|
|
71
|
+
label,
|
|
72
|
+
labelClassName,
|
|
73
|
+
labelFormatter,
|
|
74
|
+
labelKey,
|
|
75
|
+
nameKey,
|
|
76
|
+
payload
|
|
77
|
+
}: ScopedProps<ChartTooltipContentProps<TValue, TName>>): ReactNode;
|
|
78
|
+
type ChartLegendProps = ComponentProps<typeof RechartsPrimitive.Legend>;
|
|
79
|
+
declare const ChartLegend: _$react.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
|
|
80
|
+
type ChartLegendContentProps = ComponentProps<"div"> & ExtractProps<RechartsPrimitive.LegendProps["content"]> & {
|
|
81
|
+
hideIcon?: boolean;
|
|
82
|
+
nameKey?: string;
|
|
83
|
+
};
|
|
84
|
+
declare function ChartLegendContent({
|
|
85
|
+
__scopeChart,
|
|
86
|
+
className,
|
|
87
|
+
hideIcon,
|
|
88
|
+
nameKey,
|
|
89
|
+
payload,
|
|
90
|
+
verticalAlign
|
|
91
|
+
}: ScopedProps<ChartLegendContentProps>): ReactNode;
|
|
92
|
+
//#endregion
|
|
93
|
+
export { type ChartConfig, ChartContainer, type ChartContainerProps, ChartLegend, ChartLegendContent, type ChartLegendContentProps, type ChartLegendProps, ChartStyle, type ChartStyleProps, ChartTooltip, ChartTooltipContent, type ChartTooltipContentProps, type ChartTooltipProps, createChartScope };
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/utils.mjs";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useId, useMemo } from "react";
|
|
5
|
+
import { createContextScope } from "@radix-ui/react-context";
|
|
6
|
+
import * as RechartsPrimitive from "recharts";
|
|
7
|
+
//#region src/components/chart.tsx
|
|
8
|
+
const THEMES = {
|
|
9
|
+
dark: ".dark",
|
|
10
|
+
light: ""
|
|
11
|
+
};
|
|
12
|
+
const CHART_PROVIDER_NAME = "ChartProvider";
|
|
13
|
+
const [createChartContext, createChartScope] = createContextScope(CHART_PROVIDER_NAME);
|
|
14
|
+
const [ChartContextProvider, useChartContext] = createChartContext(CHART_PROVIDER_NAME);
|
|
15
|
+
function ChartContainer({ __scopeChart, children, className, config, id, ...props }) {
|
|
16
|
+
const uniqueId = useId();
|
|
17
|
+
const chartId = `chart-${id ?? uniqueId}`;
|
|
18
|
+
return /* @__PURE__ */ jsx(ChartContextProvider, {
|
|
19
|
+
config,
|
|
20
|
+
scope: __scopeChart,
|
|
21
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
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),
|
|
23
|
+
"data-chart": chartId,
|
|
24
|
+
"data-slot": "chart",
|
|
25
|
+
...props,
|
|
26
|
+
children: [/* @__PURE__ */ jsx(ChartStyle, {
|
|
27
|
+
config,
|
|
28
|
+
id: chartId
|
|
29
|
+
}), /* @__PURE__ */ jsx(RechartsPrimitive.ResponsiveContainer, { children })]
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function ChartStyle({ config, id }) {
|
|
34
|
+
const colorConfig = Object.entries(config).filter(([, itemConfig]) => itemConfig.theme ?? itemConfig.color);
|
|
35
|
+
if (colorConfig.length === 0) return null;
|
|
36
|
+
return /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: generateChartStyles(id, colorConfig) } });
|
|
37
|
+
}
|
|
38
|
+
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
39
|
+
const CHART_TOOLTIP_CONTENT_NAME = "ChartTooltipContent";
|
|
40
|
+
function ChartTooltipContent({ __scopeChart, active, className, color, formatter, hideIndicator = false, hideLabel = false, indicator = "dot", label, labelClassName, labelFormatter, labelKey, nameKey, payload = [] }) {
|
|
41
|
+
const { config } = useChartContext(CHART_TOOLTIP_CONTENT_NAME, __scopeChart);
|
|
42
|
+
const tooltipLabel = useMemo(() => {
|
|
43
|
+
if (hideLabel || payload.length === 0) return null;
|
|
44
|
+
const item = payload[0];
|
|
45
|
+
if (item === void 0) return null;
|
|
46
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, safeToString(labelKey ?? item.dataKey ?? item.name ?? "value"));
|
|
47
|
+
const configEntry = typeof label === "string" && label in config ? config[label] : void 0;
|
|
48
|
+
const value = !labelKey && typeof label === "string" ? configEntry !== void 0 ? configEntry.label ?? label : label : itemConfig?.label;
|
|
49
|
+
if (labelFormatter) return /* @__PURE__ */ jsx("div", {
|
|
50
|
+
className: cn("font-medium", labelClassName),
|
|
51
|
+
children: labelFormatter(value, payload)
|
|
52
|
+
});
|
|
53
|
+
if (!value) return null;
|
|
54
|
+
return /* @__PURE__ */ jsx("div", {
|
|
55
|
+
className: cn("font-medium", labelClassName),
|
|
56
|
+
children: value
|
|
57
|
+
});
|
|
58
|
+
}, [
|
|
59
|
+
label,
|
|
60
|
+
labelFormatter,
|
|
61
|
+
payload,
|
|
62
|
+
hideLabel,
|
|
63
|
+
labelClassName,
|
|
64
|
+
config,
|
|
65
|
+
labelKey
|
|
66
|
+
]);
|
|
67
|
+
if (!active || payload.length === 0) return null;
|
|
68
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
69
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
70
|
+
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),
|
|
71
|
+
children: [nestLabel ? null : tooltipLabel, /* @__PURE__ */ jsx("div", {
|
|
72
|
+
className: "grid gap-1.5",
|
|
73
|
+
children: payload.map((item, index) => {
|
|
74
|
+
const key = safeToString(nameKey ?? item.name ?? item.dataKey ?? "value");
|
|
75
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
76
|
+
const indicatorColor = color ?? (isRecord(item.payload) && "fill" in item.payload && typeof item.payload.fill === "string" ? item.payload.fill : void 0) ?? item.color;
|
|
77
|
+
return /* @__PURE__ */ jsx("div", {
|
|
78
|
+
className: cn("flex w-full flex-wrap items-stretch gap-2", "[&>svg]:size-2.5 [&>svg]:text-muted-foreground", indicator === "dot" && "items-center"),
|
|
79
|
+
children: formatter && item.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, [item]) : /* @__PURE__ */ jsxs(Fragment, { children: [itemConfig?.icon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsx("div", {
|
|
80
|
+
className: cn("shrink-0", "rounded-xs border-(--color-border)", "bg-(--color-bg)", {
|
|
81
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
82
|
+
"my-0.5": nestLabel && indicator === "dashed",
|
|
83
|
+
"border-1.5 w-0 border-dashed bg-transparent": indicator === "dashed",
|
|
84
|
+
"w-1": indicator === "line"
|
|
85
|
+
}),
|
|
86
|
+
style: {
|
|
87
|
+
"--color-bg": indicatorColor,
|
|
88
|
+
"--color-border": indicatorColor
|
|
89
|
+
}
|
|
90
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
91
|
+
className: cn("flex flex-1 justify-between", "leading-none", nestLabel ? "items-end" : "items-center"),
|
|
92
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
93
|
+
className: "grid gap-1.5",
|
|
94
|
+
children: [nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsx("span", {
|
|
95
|
+
className: "text-muted-foreground",
|
|
96
|
+
children: itemConfig?.label ?? item.name
|
|
97
|
+
})]
|
|
98
|
+
}), item.value != null && /* @__PURE__ */ jsx("span", {
|
|
99
|
+
className: cn("font-mono font-medium text-foreground", "tabular-nums"),
|
|
100
|
+
children: typeof item.value === "number" ? item.value.toLocaleString() : safeToString(item.value)
|
|
101
|
+
})]
|
|
102
|
+
})] })
|
|
103
|
+
}, key);
|
|
104
|
+
})
|
|
105
|
+
})]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
const ChartLegend = RechartsPrimitive.Legend;
|
|
109
|
+
const CHART_LEGEND_CONTENT_NAME = "ChartLegendContent";
|
|
110
|
+
function ChartLegendContent({ __scopeChart, className, hideIcon = false, nameKey, payload, verticalAlign = "bottom" }) {
|
|
111
|
+
const { config } = useChartContext(CHART_LEGEND_CONTENT_NAME, __scopeChart);
|
|
112
|
+
if (!payload?.length) return null;
|
|
113
|
+
return /* @__PURE__ */ jsx("div", {
|
|
114
|
+
className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className),
|
|
115
|
+
children: payload.map((item) => {
|
|
116
|
+
let key = "value";
|
|
117
|
+
if (nameKey) key = nameKey;
|
|
118
|
+
else if (item.dataKey != null) key = safeToString(item.dataKey);
|
|
119
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
120
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
121
|
+
className: cn("flex items-center gap-1.5", "[&>svg]:size-3 [&>svg]:text-muted-foreground"),
|
|
122
|
+
children: [itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx("div", {
|
|
123
|
+
className: cn("size-2 shrink-0", "rounded-md"),
|
|
124
|
+
style: { backgroundColor: item.color }
|
|
125
|
+
}), itemConfig?.label]
|
|
126
|
+
}, nameKey ? safeToString(itemConfig?.color ?? "") : safeToString(item.value ?? ""));
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Type guard to check if an unknown value is a record with string keys
|
|
132
|
+
*/
|
|
133
|
+
function isRecord(value) {
|
|
134
|
+
return typeof value === "object" && value !== null;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Safely gets a string value from a record by key
|
|
138
|
+
*/
|
|
139
|
+
function getStringValue(record, key) {
|
|
140
|
+
if (key in record) {
|
|
141
|
+
const value = record[key];
|
|
142
|
+
return typeof value === "string" ? value : void 0;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Safely converts a value to string without type coercion
|
|
147
|
+
*/
|
|
148
|
+
function safeToString(value) {
|
|
149
|
+
if (typeof value === "string") return value;
|
|
150
|
+
if (typeof value === "number") return value.toString();
|
|
151
|
+
if (value === null || value === void 0) return "";
|
|
152
|
+
if (typeof value === "boolean") return value.toString();
|
|
153
|
+
if (typeof value === "bigint") return value.toString();
|
|
154
|
+
if (typeof value === "symbol") return value.toString();
|
|
155
|
+
return "";
|
|
156
|
+
}
|
|
157
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
158
|
+
if (!isRecord(payload)) return;
|
|
159
|
+
const payloadPayload = isRecord(payload.payload) ? payload.payload : void 0;
|
|
160
|
+
let configLabelKey = key;
|
|
161
|
+
const payloadValue = getStringValue(payload, key);
|
|
162
|
+
if (payloadValue) configLabelKey = payloadValue;
|
|
163
|
+
else if (payloadPayload) {
|
|
164
|
+
const nestedValue = getStringValue(payloadPayload, key);
|
|
165
|
+
if (nestedValue) configLabelKey = nestedValue;
|
|
166
|
+
}
|
|
167
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Generates CSS custom property for a specific theme and config item
|
|
171
|
+
*/
|
|
172
|
+
function generateCssVariable(key, itemConfig, theme) {
|
|
173
|
+
const color = itemConfig.theme?.[theme] ?? itemConfig.color;
|
|
174
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Generates CSS rules for a specific theme
|
|
178
|
+
*/
|
|
179
|
+
function generateThemeStyles(theme, prefix, id, colorConfig) {
|
|
180
|
+
return `${prefix} [data-chart=${id}] {\n${colorConfig.map(([key, itemConfig]) => generateCssVariable(key, itemConfig, theme)).filter(Boolean).join("\n")}\n}`;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Generates complete CSS styles for all themes
|
|
184
|
+
*/
|
|
185
|
+
function generateChartStyles(id, colorConfig) {
|
|
186
|
+
return Object.entries(THEMES).map(([theme, prefix]) => generateThemeStyles(theme, prefix, id, colorConfig)).join("\n\n");
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, createChartScope };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CheckboxGroup, CheckboxGroupItem } from "../primitives/checkbox-group.mjs";
|
|
2
|
+
import { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/checkbox-cards.d.ts
|
|
5
|
+
type CheckboxCardsProps = ComponentProps<typeof CheckboxGroup>;
|
|
6
|
+
declare function CheckboxCards(props: CheckboxCardsProps): JSX.Element;
|
|
7
|
+
interface CheckboxCardsItemProps extends ComponentProps<typeof CheckboxGroupItem> {
|
|
8
|
+
checkboxClassName?: string;
|
|
9
|
+
}
|
|
10
|
+
declare function CheckboxCardsItem({
|
|
11
|
+
checkboxClassName,
|
|
12
|
+
children,
|
|
13
|
+
className,
|
|
14
|
+
...props
|
|
15
|
+
}: CheckboxCardsItemProps): JSX.Element;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { CheckboxCards, CheckboxCardsItem, type CheckboxCardsItemProps, type CheckboxCardsProps };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/utils.mjs";
|
|
3
|
+
import { Label } from "./label.mjs";
|
|
4
|
+
import { CheckboxGroup, CheckboxGroupIndicator, CheckboxGroupItem } from "../primitives/checkbox-group.mjs";
|
|
5
|
+
import { CheckIcon } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/checkbox-cards.tsx
|
|
8
|
+
function CheckboxCards(props) {
|
|
9
|
+
return /* @__PURE__ */ jsx(CheckboxGroup, {
|
|
10
|
+
"data-slot": "checkbox-cards",
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function CheckboxCardsItem({ checkboxClassName, children, className, ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsxs(Label, {
|
|
16
|
+
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),
|
|
17
|
+
"data-slot": "checkbox-card",
|
|
18
|
+
children: [/* @__PURE__ */ jsx(CheckboxGroupItem, {
|
|
19
|
+
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),
|
|
20
|
+
"data-slot": "checkbox-card-item",
|
|
21
|
+
...props,
|
|
22
|
+
children: /* @__PURE__ */ jsx(CheckboxGroupIndicator, {
|
|
23
|
+
"data-slot": "checkbox-card-indicator",
|
|
24
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
|
|
25
|
+
})
|
|
26
|
+
}), children]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { CheckboxCards, CheckboxCardsItem };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CheckboxGroup as CheckboxGroup$1, CheckboxGroupItem as CheckboxGroupItem$1 } from "../primitives/checkbox-group.mjs";
|
|
2
|
+
import { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/checkbox-group.d.ts
|
|
5
|
+
type CheckboxGroupProps = ComponentProps<typeof CheckboxGroup$1>;
|
|
6
|
+
declare function CheckboxGroup({
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}: CheckboxGroupProps): JSX.Element;
|
|
10
|
+
type CheckboxGroupItemProps = ComponentProps<typeof CheckboxGroupItem$1>;
|
|
11
|
+
declare function CheckboxGroupItem({
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}: CheckboxGroupItemProps): JSX.Element;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { CheckboxGroup, CheckboxGroupItem, type CheckboxGroupItemProps, type CheckboxGroupProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/utils.mjs";
|
|
3
|
+
import { CheckboxGroup as CheckboxGroup$1, CheckboxGroupIndicator, CheckboxGroupItem as CheckboxGroupItem$1 } from "../primitives/checkbox-group.mjs";
|
|
4
|
+
import { CheckIcon } from "lucide-react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/checkbox-group.tsx
|
|
7
|
+
function CheckboxGroup({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(CheckboxGroup$1, {
|
|
9
|
+
className: cn("grid gap-2", className),
|
|
10
|
+
"data-slot": "checkbox-group",
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function CheckboxGroupItem({ className, ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx(CheckboxGroupItem$1, {
|
|
16
|
+
className: cn("peer flex size-4 shrink-0 items-center justify-center", "rounded-sm border border-input shadow-xs outline-hidden", "text-primary-foreground", "transition", "hover:not-disabled:not-aria-checked:border-ring/60", "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50", "disabled:opacity-50", "aria-checked:border-primary aria-checked:bg-primary", "focus-visible:aria-checked:ring-primary/20", "aria-invalid:border-destructive aria-invalid:ring-destructive/20", "hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60", "aria-checked:aria-invalid:bg-destructive", "dark:bg-input/30", "dark:focus-visible:aria-checked:ring-primary/40", "dark:aria-invalid:ring-destructive/40", className),
|
|
17
|
+
"data-slot": "checkbox-group-item",
|
|
18
|
+
...props,
|
|
19
|
+
children: /* @__PURE__ */ jsx(CheckboxGroupIndicator, {
|
|
20
|
+
className: cn("flex items-center justify-center text-current", "transition-none"),
|
|
21
|
+
"data-slot": "checkbox-group-indicator",
|
|
22
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { CheckboxGroup, CheckboxGroupItem };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentProps, JSX } from "react";
|
|
2
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
3
|
+
|
|
4
|
+
//#region src/components/checkbox.d.ts
|
|
5
|
+
type CheckboxProps = ComponentProps<typeof CheckboxPrimitive.Root>;
|
|
6
|
+
declare function Checkbox({
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}: CheckboxProps): JSX.Element;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Checkbox, type CheckboxProps };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/utils.mjs";
|
|
3
|
+
import { CheckIcon } from "lucide-react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
6
|
+
//#region src/components/checkbox.tsx
|
|
7
|
+
function Checkbox({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(CheckboxPrimitive.Root, {
|
|
9
|
+
className: cn("peer flex size-4 shrink-0 items-center justify-center", "rounded-sm border border-input shadow-xs outline-hidden", "text-primary-foreground", "transition", "hover:not-disabled:not-aria-checked:border-ring/60", "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50", "disabled:opacity-50", "aria-checked:border-primary aria-checked:bg-primary", "aria-checked:focus-visible:ring-primary/20", "aria-invalid:border-destructive aria-invalid:ring-destructive/20", "hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60", "aria-checked:aria-invalid:bg-destructive", "dark:bg-input/30", "dark:aria-checked:focus-visible:ring-primary/40", "dark:aria-invalid:ring-destructive/40", className),
|
|
10
|
+
"data-slot": "checkbox",
|
|
11
|
+
...props,
|
|
12
|
+
children: /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, {
|
|
13
|
+
className: cn("flex items-center justify-center text-current", "transition-none"),
|
|
14
|
+
"data-slot": "checkbox-indicator",
|
|
15
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Checkbox };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentProps, JSX } from "react";
|
|
2
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
3
|
+
|
|
4
|
+
//#region src/components/collapsible.d.ts
|
|
5
|
+
type CollapsibleProps = ComponentProps<typeof CollapsiblePrimitive.Root>;
|
|
6
|
+
declare function Collapsible({
|
|
7
|
+
...props
|
|
8
|
+
}: CollapsibleProps): JSX.Element;
|
|
9
|
+
type CollapsibleTriggerProps = ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>;
|
|
10
|
+
declare function CollapsibleTrigger({
|
|
11
|
+
...props
|
|
12
|
+
}: CollapsibleTriggerProps): JSX.Element;
|
|
13
|
+
type CollapsibleContentProps = ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>;
|
|
14
|
+
declare function CollapsibleContent({
|
|
15
|
+
...props
|
|
16
|
+
}: CollapsibleContentProps): JSX.Element;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Collapsible, CollapsibleContent, type CollapsibleContentProps, type CollapsibleProps, CollapsibleTrigger, type CollapsibleTriggerProps };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
4
|
+
//#region src/components/collapsible.tsx
|
|
5
|
+
function Collapsible({ ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(CollapsiblePrimitive.Root, {
|
|
7
|
+
"data-slot": "collapsible",
|
|
8
|
+
...props
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function CollapsibleTrigger({ ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(CollapsiblePrimitive.CollapsibleTrigger, {
|
|
13
|
+
"data-slot": "collapsible-trigger",
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function CollapsibleContent({ ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx(CollapsiblePrimitive.CollapsibleContent, {
|
|
19
|
+
"data-slot": "collapsible-content",
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Dialog } from "./dialog.mjs";
|
|
2
|
+
import { ComponentProps, JSX } from "react";
|
|
3
|
+
import { Command as Command$1 } from "cmdk";
|
|
4
|
+
|
|
5
|
+
//#region src/components/command.d.ts
|
|
6
|
+
type CommandProps = ComponentProps<typeof Command$1>;
|
|
7
|
+
declare function Command({
|
|
8
|
+
className,
|
|
9
|
+
...props
|
|
10
|
+
}: CommandProps): JSX.Element;
|
|
11
|
+
type CommandDialogProps = ComponentProps<typeof Dialog>;
|
|
12
|
+
declare function CommandDialog({
|
|
13
|
+
children,
|
|
14
|
+
...props
|
|
15
|
+
}: CommandDialogProps): JSX.Element;
|
|
16
|
+
type CommandInputProps = ComponentProps<typeof Command$1.Input>;
|
|
17
|
+
declare function CommandInput({
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}: CommandInputProps): JSX.Element;
|
|
21
|
+
type CommandListProps = ComponentProps<typeof Command$1.List>;
|
|
22
|
+
declare function CommandList({
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}: CommandListProps): JSX.Element;
|
|
26
|
+
type CommandEmptyProps = ComponentProps<typeof Command$1.Empty>;
|
|
27
|
+
declare function CommandEmpty({
|
|
28
|
+
className,
|
|
29
|
+
...props
|
|
30
|
+
}: CommandEmptyProps): JSX.Element;
|
|
31
|
+
type CommandGroupProps = ComponentProps<typeof Command$1.Group>;
|
|
32
|
+
declare function CommandGroup({
|
|
33
|
+
className,
|
|
34
|
+
...props
|
|
35
|
+
}: CommandGroupProps): JSX.Element;
|
|
36
|
+
type CommandSeparatorProps = ComponentProps<typeof Command$1.Separator>;
|
|
37
|
+
declare function CommandSeparator({
|
|
38
|
+
className,
|
|
39
|
+
...props
|
|
40
|
+
}: CommandSeparatorProps): JSX.Element;
|
|
41
|
+
type CommandItemProps = ComponentProps<typeof Command$1.Item>;
|
|
42
|
+
declare function CommandItem({
|
|
43
|
+
className,
|
|
44
|
+
...props
|
|
45
|
+
}: CommandItemProps): JSX.Element;
|
|
46
|
+
type CommandLoadingProps = ComponentProps<typeof Command$1.Loading>;
|
|
47
|
+
declare function CommandLoading({
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}: CommandLoadingProps): JSX.Element;
|
|
51
|
+
type CommandShortcutProps = ComponentProps<"span">;
|
|
52
|
+
declare function CommandShortcut({
|
|
53
|
+
className,
|
|
54
|
+
...props
|
|
55
|
+
}: CommandShortcutProps): JSX.Element;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { Command, CommandDialog, type CommandDialogProps, CommandEmpty, type CommandEmptyProps, CommandGroup, type CommandGroupProps, CommandInput, type CommandInputProps, CommandItem, type CommandItemProps, CommandList, type CommandListProps, CommandLoading, type CommandLoadingProps, type CommandProps, CommandSeparator, type CommandSeparatorProps, CommandShortcut, type CommandShortcutProps };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/utils.mjs";
|
|
3
|
+
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "./dialog.mjs";
|
|
4
|
+
import { SearchIcon } from "lucide-react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
|
|
7
|
+
import { Command as Command$1 } from "cmdk";
|
|
8
|
+
//#region src/components/command.tsx
|
|
9
|
+
function Command({ className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Command$1, {
|
|
11
|
+
className: cn("flex flex-col overflow-hidden", "rounded-[inherit]", "bg-popover text-popover-foreground outline-hidden", className),
|
|
12
|
+
"data-slot": "command",
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function CommandDialog({ children, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
18
|
+
"data-slot": "command-dialog",
|
|
19
|
+
...props,
|
|
20
|
+
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
21
|
+
className: cn("rounded-t-lg", "sm:rounded-lg"),
|
|
22
|
+
"data-slot": "command-dialog-content",
|
|
23
|
+
children: [/* @__PURE__ */ jsxs(VisuallyHidden, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Search command" }), /* @__PURE__ */ jsx(DialogDescription, { children: "Use the search bar to find and select the desired command." })] }), /* @__PURE__ */ jsx(Command, {
|
|
24
|
+
className: cn("[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground", "[&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0", "[&_[cmdk-input]]:h-12"),
|
|
25
|
+
children
|
|
26
|
+
})]
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function CommandInput({ className, ...props }) {
|
|
31
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
32
|
+
"cmdk-input-wrapper": true,
|
|
33
|
+
className: cn("flex items-center gap-2", "px-3", "border-b"),
|
|
34
|
+
"data-slot": "command-input-wrapper",
|
|
35
|
+
children: [/* @__PURE__ */ jsx(SearchIcon, { className: cn("size-4 shrink-0", "opacity-50") }), /* @__PURE__ */ jsx(Command$1.Input, {
|
|
36
|
+
className: cn("flex h-10 w-full", "text-base", "outline-hidden", "placeholder:text-muted-foreground", "disabled:opacity-50", "md:text-sm", className),
|
|
37
|
+
"data-slot": "command-input",
|
|
38
|
+
...props
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function CommandList({ className, ...props }) {
|
|
43
|
+
return /* @__PURE__ */ jsx(Command$1.List, {
|
|
44
|
+
className: cn("max-h-75 overflow-x-hidden overflow-y-auto", className),
|
|
45
|
+
"data-slot": "command-list",
|
|
46
|
+
...props
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function CommandEmpty({ className, ...props }) {
|
|
50
|
+
return /* @__PURE__ */ jsx(Command$1.Empty, {
|
|
51
|
+
className: cn("py-6", "text-center text-sm", className),
|
|
52
|
+
"data-slot": "command-empty",
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function CommandGroup({ className, ...props }) {
|
|
57
|
+
return /* @__PURE__ */ jsx(Command$1.Group, {
|
|
58
|
+
className: cn("overflow-hidden p-1 text-foreground", "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground", className),
|
|
59
|
+
"data-slot": "command-group",
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function CommandSeparator({ className, ...props }) {
|
|
64
|
+
return /* @__PURE__ */ jsx(Command$1.Separator, {
|
|
65
|
+
className: cn("-mx-1 h-px", "bg-border", className),
|
|
66
|
+
"data-slot": "command-separator",
|
|
67
|
+
...props
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function CommandItem({ className, ...props }) {
|
|
71
|
+
return /* @__PURE__ */ jsx(Command$1.Item, {
|
|
72
|
+
className: cn("group/command-item relative flex items-center gap-x-2", "px-2 py-1.5", "rounded-sm outline-hidden", "text-sm", "cursor-default select-none", "aria-disabled:opacity-50", "aria-selected:bg-accent aria-selected:text-accent-foreground", "[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "[&_svg:not([class*='text-'])]:text-muted-foreground", className),
|
|
73
|
+
"data-slot": "command-item",
|
|
74
|
+
...props
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function CommandLoading({ className, ...props }) {
|
|
78
|
+
return /* @__PURE__ */ jsx(Command$1.Loading, {
|
|
79
|
+
className: cn("flex justify-center", "p-2", className),
|
|
80
|
+
"data-slot": "command-loading",
|
|
81
|
+
...props
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function CommandShortcut({ className, ...props }) {
|
|
85
|
+
return /* @__PURE__ */ jsx("span", {
|
|
86
|
+
className: cn("ml-auto", "text-xs tracking-widest text-muted-foreground", className),
|
|
87
|
+
"data-slot": "command-shortcut",
|
|
88
|
+
...props
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut };
|