@epa-datos/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +98 -0
- package/dist/components/epa/conversion-funnel.d.ts +17 -0
- package/dist/components/epa/conversion-funnel.js +52 -0
- package/dist/components/epa/date-range-picker.d.ts +42 -0
- package/dist/components/epa/date-range-picker.js +184 -0
- package/dist/components/epa/heatmap.d.ts +25 -0
- package/dist/components/epa/heatmap.js +79 -0
- package/dist/components/epa/metric-card-group.d.ts +41 -0
- package/dist/components/epa/metric-card-group.js +47 -0
- package/dist/components/ui/accordion.d.ts +6 -0
- package/dist/components/ui/accordion.js +17 -0
- package/dist/components/ui/alert-dialog.d.ts +18 -0
- package/dist/components/ui/alert-dialog.js +42 -0
- package/dist/components/ui/alert.d.ts +10 -0
- package/dist/components/ui/alert.js +30 -0
- package/dist/components/ui/aspect-ratio.d.ts +4 -0
- package/dist/components/ui/aspect-ratio.js +8 -0
- package/dist/components/ui/attachment.d.ts +23 -0
- package/dist/components/ui/attachment.js +68 -0
- package/dist/components/ui/avatar.d.ts +11 -0
- package/dist/components/ui/avatar.js +23 -0
- package/dist/components/ui/badge.d.ts +7 -0
- package/dist/components/ui/badge.js +36 -0
- package/dist/components/ui/breadcrumb.d.ts +10 -0
- package/dist/components/ui/breadcrumb.js +36 -0
- package/dist/components/ui/bubble.d.ts +16 -0
- package/dist/components/ui/bubble.js +59 -0
- package/dist/components/ui/button-group.d.ts +10 -0
- package/dist/components/ui/button-group.js +36 -0
- package/dist/components/ui/button.d.ts +8 -0
- package/dist/components/ui/button.js +34 -0
- package/dist/components/ui/calendar.d.ts +10 -0
- package/dist/components/ui/calendar.js +76 -0
- package/dist/components/ui/card.d.ts +12 -0
- package/dist/components/ui/card.js +33 -0
- package/dist/components/ui/carousel.d.ts +28 -0
- package/dist/components/ui/carousel.js +91 -0
- package/dist/components/ui/chart.d.ts +44 -0
- package/dist/components/ui/chart.js +132 -0
- package/dist/components/ui/checkbox.d.ts +3 -0
- package/dist/components/ui/checkbox.js +9 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/collapsible.js +13 -0
- package/dist/components/ui/combobox.d.ts +24 -0
- package/dist/components/ui/combobox.js +58 -0
- package/dist/components/ui/command.d.ts +19 -0
- package/dist/components/ui/command.js +35 -0
- package/dist/components/ui/context-menu.d.ts +29 -0
- package/dist/components/ui/context-menu.js +51 -0
- package/dist/components/ui/dialog.d.ts +17 -0
- package/dist/components/ui/dialog.js +37 -0
- package/dist/components/ui/direction.d.ts +1 -0
- package/dist/components/ui/direction.js +2 -0
- package/dist/components/ui/drawer.d.ts +16 -0
- package/dist/components/ui/drawer.js +75 -0
- package/dist/components/ui/dropdown-menu.d.ts +29 -0
- package/dist/components/ui/dropdown-menu.js +51 -0
- package/dist/components/ui/empty.d.ts +11 -0
- package/dist/components/ui/empty.js +33 -0
- package/dist/components/ui/field.d.ts +24 -0
- package/dist/components/ui/field.js +68 -0
- package/dist/components/ui/hover-card.d.ts +5 -0
- package/dist/components/ui/hover-card.js +14 -0
- package/dist/components/ui/input-group.d.ts +18 -0
- package/dist/components/ui/input-group.js +57 -0
- package/dist/components/ui/input-otp.d.ts +11 -0
- package/dist/components/ui/input-otp.js +21 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +7 -0
- package/dist/components/ui/item.d.ts +22 -0
- package/dist/components/ui/item.js +78 -0
- package/dist/components/ui/kbd.d.ts +3 -0
- package/dist/components/ui/kbd.js +9 -0
- package/dist/components/ui/label.d.ts +3 -0
- package/dist/components/ui/label.js +7 -0
- package/dist/components/ui/marker.d.ts +10 -0
- package/dist/components/ui/marker.js +34 -0
- package/dist/components/ui/menubar.d.ts +29 -0
- package/dist/components/ui/menubar.js +56 -0
- package/dist/components/ui/message-scroller.d.ts +10 -0
- package/dist/components/ui/message-scroller.js +25 -0
- package/dist/components/ui/message.d.ts +10 -0
- package/dist/components/ui/message.js +21 -0
- package/dist/components/ui/native-select.d.ts +8 -0
- package/dist/components/ui/native-select.js +13 -0
- package/dist/components/ui/navigation-menu.d.ts +11 -0
- package/dist/components/ui/navigation-menu.js +31 -0
- package/dist/components/ui/pagination.d.ts +17 -0
- package/dist/components/ui/pagination.js +26 -0
- package/dist/components/ui/popover.d.ts +9 -0
- package/dist/components/ui/popover.js +23 -0
- package/dist/components/ui/progress.d.ts +7 -0
- package/dist/components/ui/progress.js +20 -0
- package/dist/components/ui/questionnaire.d.ts +19 -0
- package/dist/components/ui/questionnaire.js +52 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/radio-group.js +12 -0
- package/dist/components/ui/resizable.d.ts +7 -0
- package/dist/components/ui/resizable.js +14 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.js +11 -0
- package/dist/components/ui/select.d.ts +15 -0
- package/dist/components/ui/select.js +34 -0
- package/dist/components/ui/separator.d.ts +3 -0
- package/dist/components/ui/separator.js +8 -0
- package/dist/components/ui/sheet.d.ts +14 -0
- package/dist/components/ui/sheet.js +37 -0
- package/dist/components/ui/sidebar.d.ts +63 -0
- package/dist/components/ui/sidebar.js +256 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/skeleton.js +6 -0
- package/dist/components/ui/slider.d.ts +3 -0
- package/dist/components/ui/slider.js +12 -0
- package/dist/components/ui/spinner.d.ts +2 -0
- package/dist/components/ui/spinner.js +7 -0
- package/dist/components/ui/switch.d.ts +5 -0
- package/dist/components/ui/switch.js +8 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +28 -0
- package/dist/components/ui/tabs.d.ts +10 -0
- package/dist/components/ui/tabs.js +29 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/textarea.js +6 -0
- package/dist/components/ui/toast.d.ts +16 -0
- package/dist/components/ui/toast.js +66 -0
- package/dist/components/ui/toggle-group.d.ts +11 -0
- package/dist/components/ui/toggle-group.js +24 -0
- package/dist/components/ui/toggle.d.ts +8 -0
- package/dist/components/ui/toggle.js +26 -0
- package/dist/components/ui/tooltip.d.ts +6 -0
- package/dist/components/ui/tooltip.js +17 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +5 -0
- package/dist/styles/tokens.css +200 -0
- package/package.json +100 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { DayPicker, getDefaultClassNames, } from "react-day-picker";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { Button, buttonVariants } from "../../components/ui/button.js";
|
|
7
|
+
import { ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon } from "lucide-react";
|
|
8
|
+
function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", locale, formatters, components, ...props }) {
|
|
9
|
+
const defaultClassNames = getDefaultClassNames();
|
|
10
|
+
return (_jsx(DayPicker, { showOutsideDays: showOutsideDays, className: cn("group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent", String.raw `rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw `rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className), captionLayout: captionLayout, locale: locale, formatters: {
|
|
11
|
+
formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
|
|
12
|
+
...formatters,
|
|
13
|
+
}, classNames: {
|
|
14
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
15
|
+
months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
|
|
16
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
17
|
+
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
|
|
18
|
+
button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous),
|
|
19
|
+
button_next: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next),
|
|
20
|
+
month_caption: cn("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", defaultClassNames.month_caption),
|
|
21
|
+
dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
|
|
22
|
+
dropdown_root: cn("relative rounded-(--cell-radius)", defaultClassNames.dropdown_root),
|
|
23
|
+
dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
|
|
24
|
+
caption_label: cn("font-medium select-none", captionLayout === "label"
|
|
25
|
+
? "text-sm"
|
|
26
|
+
: "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground", defaultClassNames.caption_label),
|
|
27
|
+
month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
|
|
28
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
29
|
+
weekday: cn("flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none", defaultClassNames.weekday),
|
|
30
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
31
|
+
week_number_header: cn("w-(--cell-size) select-none", defaultClassNames.week_number_header),
|
|
32
|
+
week_number: cn("text-[0.8rem] text-muted-foreground select-none", defaultClassNames.week_number),
|
|
33
|
+
day: cn("group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)", props.showWeekNumber
|
|
34
|
+
? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)"
|
|
35
|
+
: "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)", defaultClassNames.day),
|
|
36
|
+
range_start: cn("relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted", defaultClassNames.range_start),
|
|
37
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
38
|
+
range_end: cn("relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted", defaultClassNames.range_end),
|
|
39
|
+
today: cn("rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none", defaultClassNames.today),
|
|
40
|
+
outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
41
|
+
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
42
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
43
|
+
...classNames,
|
|
44
|
+
}, components: {
|
|
45
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
46
|
+
return (_jsx("div", { "data-slot": "calendar", ref: rootRef, className: cn(className), ...props }));
|
|
47
|
+
},
|
|
48
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
49
|
+
if (orientation === "left") {
|
|
50
|
+
return (_jsx(ChevronLeftIcon, { className: cn("size-4", className), ...props }));
|
|
51
|
+
}
|
|
52
|
+
if (orientation === "right") {
|
|
53
|
+
return (_jsx(ChevronRightIcon, { className: cn("size-4", className), ...props }));
|
|
54
|
+
}
|
|
55
|
+
return (_jsx(ChevronDownIcon, { className: cn("size-4", className), ...props }));
|
|
56
|
+
},
|
|
57
|
+
DayButton: ({ ...props }) => (_jsx(CalendarDayButton, { locale: locale, ...props })),
|
|
58
|
+
WeekNumber: ({ children, ...props }) => {
|
|
59
|
+
return (_jsx("td", { ...props, children: _jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children: children }) }));
|
|
60
|
+
},
|
|
61
|
+
...components,
|
|
62
|
+
}, ...props }));
|
|
63
|
+
}
|
|
64
|
+
function CalendarDayButton({ className, day, modifiers, locale, ...props }) {
|
|
65
|
+
const defaultClassNames = getDefaultClassNames();
|
|
66
|
+
const ref = React.useRef(null);
|
|
67
|
+
React.useEffect(() => {
|
|
68
|
+
if (modifiers.focused)
|
|
69
|
+
ref.current?.focus();
|
|
70
|
+
}, [modifiers.focused]);
|
|
71
|
+
return (_jsx(Button, { variant: "ghost", size: "icon", "data-day": day.date.toLocaleDateString(locale?.code), "data-selected-single": modifiers.selected &&
|
|
72
|
+
!modifiers.range_start &&
|
|
73
|
+
!modifiers.range_end &&
|
|
74
|
+
!modifiers.range_middle, "data-range-start": modifiers.range_start, "data-range-end": modifiers.range_end, "data-range-middle": modifiers.range_middle, className: cn("relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) 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-foreground [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className), ...props }));
|
|
75
|
+
}
|
|
76
|
+
export { Calendar, CalendarDayButton };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
declare function Card({ className, size, render, ...props }: useRender.ComponentProps<"div"> & {
|
|
4
|
+
size?: "default" | "sm";
|
|
5
|
+
}): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
6
|
+
declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
7
|
+
declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
8
|
+
declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
9
|
+
declare function CardAction({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
10
|
+
declare function CardContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
11
|
+
declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
12
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
function Card({ className, size = "default", render, ...props }) {
|
|
6
|
+
return useRender({
|
|
7
|
+
defaultTagName: "div",
|
|
8
|
+
render,
|
|
9
|
+
props: mergeProps({
|
|
10
|
+
className: cn("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl", className),
|
|
11
|
+
}, props),
|
|
12
|
+
state: { slot: "card", size },
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function CardHeader({ className, ...props }) {
|
|
16
|
+
return (_jsx("div", { "data-slot": "card-header", className: cn("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[minmax(0,1fr)_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)", className), ...props }));
|
|
17
|
+
}
|
|
18
|
+
function CardTitle({ className, ...props }) {
|
|
19
|
+
return (_jsx("div", { "data-slot": "card-title", className: cn("font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm", className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
function CardDescription({ className, ...props }) {
|
|
22
|
+
return (_jsx("div", { "data-slot": "card-description", className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
23
|
+
}
|
|
24
|
+
function CardAction({ className, ...props }) {
|
|
25
|
+
return (_jsx("div", { "data-slot": "card-action", className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
function CardContent({ className, ...props }) {
|
|
28
|
+
return (_jsx("div", { "data-slot": "card-content", className: cn("px-(--card-spacing)", className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
function CardFooter({ className, ...props }) {
|
|
31
|
+
return (_jsx("div", { "data-slot": "card-footer", className: cn("flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)", className), ...props }));
|
|
32
|
+
}
|
|
33
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
|
|
3
|
+
import { Button } from "../../components/ui/button.js";
|
|
4
|
+
type CarouselApi = UseEmblaCarouselType[1];
|
|
5
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
6
|
+
type CarouselOptions = UseCarouselParameters[0];
|
|
7
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
|
8
|
+
type CarouselProps = {
|
|
9
|
+
opts?: CarouselOptions;
|
|
10
|
+
plugins?: CarouselPlugin;
|
|
11
|
+
orientation?: "horizontal" | "vertical";
|
|
12
|
+
setApi?: (api: CarouselApi) => void;
|
|
13
|
+
};
|
|
14
|
+
type CarouselContextProps = {
|
|
15
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
16
|
+
api: ReturnType<typeof useEmblaCarousel>[1];
|
|
17
|
+
scrollPrev: () => void;
|
|
18
|
+
scrollNext: () => void;
|
|
19
|
+
canScrollPrev: boolean;
|
|
20
|
+
canScrollNext: boolean;
|
|
21
|
+
} & CarouselProps;
|
|
22
|
+
declare function useCarousel(): CarouselContextProps;
|
|
23
|
+
declare function Carousel({ orientation, opts, setApi, plugins, className, children, ...props }: React.ComponentProps<"div"> & CarouselProps): React.JSX.Element;
|
|
24
|
+
declare function CarouselContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
25
|
+
declare function CarouselItem({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
26
|
+
declare function CarouselPrevious({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
27
|
+
declare function CarouselNext({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
28
|
+
export { type CarouselApi, Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, useCarousel, };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import useEmblaCarousel from "embla-carousel-react";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { Button } from "../../components/ui/button.js";
|
|
7
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
8
|
+
const CarouselContext = React.createContext(null);
|
|
9
|
+
function useCarousel() {
|
|
10
|
+
const context = React.useContext(CarouselContext);
|
|
11
|
+
if (!context) {
|
|
12
|
+
throw new Error("useCarousel must be used within a <Carousel />");
|
|
13
|
+
}
|
|
14
|
+
return context;
|
|
15
|
+
}
|
|
16
|
+
function Carousel({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }) {
|
|
17
|
+
const [carouselRef, api] = useEmblaCarousel({
|
|
18
|
+
...opts,
|
|
19
|
+
axis: orientation === "horizontal" ? "x" : "y",
|
|
20
|
+
}, plugins);
|
|
21
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
22
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
23
|
+
const onSelect = React.useCallback((api) => {
|
|
24
|
+
if (!api)
|
|
25
|
+
return;
|
|
26
|
+
setCanScrollPrev(api.canScrollPrev());
|
|
27
|
+
setCanScrollNext(api.canScrollNext());
|
|
28
|
+
}, []);
|
|
29
|
+
const scrollPrev = React.useCallback(() => {
|
|
30
|
+
api?.scrollPrev();
|
|
31
|
+
}, [api]);
|
|
32
|
+
const scrollNext = React.useCallback(() => {
|
|
33
|
+
api?.scrollNext();
|
|
34
|
+
}, [api]);
|
|
35
|
+
const handleKeyDown = React.useCallback((event) => {
|
|
36
|
+
if (event.key === "ArrowLeft") {
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
scrollPrev();
|
|
39
|
+
}
|
|
40
|
+
else if (event.key === "ArrowRight") {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
scrollNext();
|
|
43
|
+
}
|
|
44
|
+
}, [scrollPrev, scrollNext]);
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
if (!api || !setApi)
|
|
47
|
+
return;
|
|
48
|
+
setApi(api);
|
|
49
|
+
}, [api, setApi]);
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
if (!api)
|
|
52
|
+
return;
|
|
53
|
+
onSelect(api);
|
|
54
|
+
api.on("reInit", onSelect);
|
|
55
|
+
api.on("select", onSelect);
|
|
56
|
+
return () => {
|
|
57
|
+
api?.off("select", onSelect);
|
|
58
|
+
};
|
|
59
|
+
}, [api, onSelect]);
|
|
60
|
+
return (_jsx(CarouselContext.Provider, { value: {
|
|
61
|
+
carouselRef,
|
|
62
|
+
api: api,
|
|
63
|
+
opts,
|
|
64
|
+
orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
65
|
+
scrollPrev,
|
|
66
|
+
scrollNext,
|
|
67
|
+
canScrollPrev,
|
|
68
|
+
canScrollNext,
|
|
69
|
+
}, children: _jsx("div", { onKeyDownCapture: handleKeyDown, className: cn("relative", className), role: "region", "aria-roledescription": "carousel", "data-slot": "carousel", ...props, children: children }) }));
|
|
70
|
+
}
|
|
71
|
+
function CarouselContent({ className, ...props }) {
|
|
72
|
+
const { carouselRef, orientation } = useCarousel();
|
|
73
|
+
return (_jsx("div", { ref: carouselRef, className: "overflow-hidden", "data-slot": "carousel-content", children: _jsx("div", { className: cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className), ...props }) }));
|
|
74
|
+
}
|
|
75
|
+
function CarouselItem({ className, ...props }) {
|
|
76
|
+
const { orientation } = useCarousel();
|
|
77
|
+
return (_jsx("div", { role: "group", "aria-roledescription": "slide", "data-slot": "carousel-item", className: cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className), ...props }));
|
|
78
|
+
}
|
|
79
|
+
function CarouselPrevious({ className, variant = "outline", size = "icon-sm", ...props }) {
|
|
80
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
81
|
+
return (_jsxs(Button, { "data-slot": "carousel-previous", variant: variant, size: size, className: cn("absolute touch-manipulation rounded-full", orientation === "horizontal"
|
|
82
|
+
? "inset-y-0 -left-12 my-auto"
|
|
83
|
+
: "-top-12 left-1/2 -translate-x-1/2 rotate-90", className), disabled: !canScrollPrev, onClick: scrollPrev, ...props, children: [_jsx(ChevronLeftIcon, {}), _jsx("span", { className: "sr-only", children: "Previous slide" })] }));
|
|
84
|
+
}
|
|
85
|
+
function CarouselNext({ className, variant = "outline", size = "icon-sm", ...props }) {
|
|
86
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
87
|
+
return (_jsxs(Button, { "data-slot": "carousel-next", variant: variant, size: size, className: cn("absolute touch-manipulation rounded-full", orientation === "horizontal"
|
|
88
|
+
? "inset-y-0 -right-12 my-auto"
|
|
89
|
+
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className), disabled: !canScrollNext, onClick: scrollNext, ...props, children: [_jsx(ChevronRightIcon, {}), _jsx("span", { className: "sr-only", children: "Next slide" })] }));
|
|
90
|
+
}
|
|
91
|
+
export { Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, useCarousel, };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as RechartsPrimitive from "recharts";
|
|
3
|
+
import type { TooltipValueType } from "recharts";
|
|
4
|
+
declare const THEMES: {
|
|
5
|
+
readonly light: "";
|
|
6
|
+
readonly dark: ".dark";
|
|
7
|
+
};
|
|
8
|
+
type TooltipNameType = number | string;
|
|
9
|
+
export type ChartConfig = Record<string, {
|
|
10
|
+
label?: React.ReactNode;
|
|
11
|
+
icon?: React.ComponentType;
|
|
12
|
+
} & ({
|
|
13
|
+
color?: string;
|
|
14
|
+
theme?: never;
|
|
15
|
+
} | {
|
|
16
|
+
color?: never;
|
|
17
|
+
theme: Record<keyof typeof THEMES, string>;
|
|
18
|
+
})>;
|
|
19
|
+
declare function ChartContainer({ id, className, children, config, initialDimension, ...props }: React.ComponentProps<"div"> & {
|
|
20
|
+
config: ChartConfig;
|
|
21
|
+
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
22
|
+
initialDimension?: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
};
|
|
26
|
+
}): React.JSX.Element;
|
|
27
|
+
declare const ChartStyle: ({ id, config }: {
|
|
28
|
+
id: string;
|
|
29
|
+
config: ChartConfig;
|
|
30
|
+
}) => React.JSX.Element | null;
|
|
31
|
+
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
32
|
+
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> & React.ComponentProps<"div"> & {
|
|
33
|
+
hideLabel?: boolean;
|
|
34
|
+
hideIndicator?: boolean;
|
|
35
|
+
indicator?: "line" | "dot" | "dashed";
|
|
36
|
+
nameKey?: string;
|
|
37
|
+
labelKey?: string;
|
|
38
|
+
} & Omit<RechartsPrimitive.DefaultTooltipContentProps<TooltipValueType, TooltipNameType>, "accessibilityLayer">): React.JSX.Element | null;
|
|
39
|
+
declare const ChartLegend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
|
|
40
|
+
declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: React.ComponentProps<"div"> & {
|
|
41
|
+
hideIcon?: boolean;
|
|
42
|
+
nameKey?: string;
|
|
43
|
+
} & RechartsPrimitive.DefaultLegendContentProps): React.JSX.Element | null;
|
|
44
|
+
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as RechartsPrimitive from "recharts";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
// Format: { THEME_NAME: CSS_SELECTOR }
|
|
7
|
+
const THEMES = { light: "", dark: ".dark" };
|
|
8
|
+
const INITIAL_DIMENSION = { width: 320, height: 200 };
|
|
9
|
+
const ChartContext = React.createContext(null);
|
|
10
|
+
function useChart() {
|
|
11
|
+
const context = React.useContext(ChartContext);
|
|
12
|
+
if (!context) {
|
|
13
|
+
throw new Error("useChart must be used within a <ChartContainer />");
|
|
14
|
+
}
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
|
+
function ChartContainer({ id, className, children, config, initialDimension = INITIAL_DIMENSION, ...props }) {
|
|
18
|
+
const uniqueId = React.useId();
|
|
19
|
+
const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
|
|
20
|
+
return (_jsx(ChartContext.Provider, { value: { config }, children: _jsxs("div", { "data-slot": "chart", "data-chart": chartId, 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), ...props, children: [_jsx(ChartStyle, { id: chartId, config: config }), _jsx(RechartsPrimitive.ResponsiveContainer, { initialDimension: initialDimension, children: children })] }) }));
|
|
21
|
+
}
|
|
22
|
+
const ChartStyle = ({ id, config }) => {
|
|
23
|
+
const colorConfig = Object.entries(config).filter(([, config]) => config.theme ?? config.color);
|
|
24
|
+
if (!colorConfig.length) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return (_jsx("style", { dangerouslySetInnerHTML: {
|
|
28
|
+
__html: Object.entries(THEMES)
|
|
29
|
+
.map(([theme, prefix]) => `
|
|
30
|
+
${prefix} [data-chart=${id}] {
|
|
31
|
+
${colorConfig
|
|
32
|
+
.map(([key, itemConfig]) => {
|
|
33
|
+
const color = itemConfig.theme?.[theme] ??
|
|
34
|
+
itemConfig.color;
|
|
35
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
36
|
+
})
|
|
37
|
+
.join("\n")}
|
|
38
|
+
}
|
|
39
|
+
`)
|
|
40
|
+
.join("\n"),
|
|
41
|
+
} }));
|
|
42
|
+
};
|
|
43
|
+
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
44
|
+
function ChartTooltipContent({ active, payload, className, indicator = "dot", hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }) {
|
|
45
|
+
const { config } = useChart();
|
|
46
|
+
const tooltipLabel = React.useMemo(() => {
|
|
47
|
+
if (hideLabel || !payload?.length) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const [item] = payload;
|
|
51
|
+
const key = `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`;
|
|
52
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
53
|
+
const value = !labelKey && typeof label === "string"
|
|
54
|
+
? (config[label]?.label ?? label)
|
|
55
|
+
: itemConfig?.label;
|
|
56
|
+
if (labelFormatter) {
|
|
57
|
+
return (_jsx("div", { className: cn("font-medium", labelClassName), children: labelFormatter(value, payload) }));
|
|
58
|
+
}
|
|
59
|
+
if (!value) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return _jsx("div", { className: cn("font-medium", labelClassName), children: value });
|
|
63
|
+
}, [
|
|
64
|
+
label,
|
|
65
|
+
labelFormatter,
|
|
66
|
+
payload,
|
|
67
|
+
hideLabel,
|
|
68
|
+
labelClassName,
|
|
69
|
+
config,
|
|
70
|
+
labelKey,
|
|
71
|
+
]);
|
|
72
|
+
if (!active || !payload?.length) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
76
|
+
return (_jsxs("div", { className: cn("grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", className), children: [!nestLabel ? tooltipLabel : null, _jsx("div", { className: "grid gap-1.5", children: payload
|
|
77
|
+
.filter((item) => item.type !== "none")
|
|
78
|
+
.map((item, index) => {
|
|
79
|
+
const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`;
|
|
80
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
81
|
+
const indicatorColor = color ?? item.payload?.fill ?? item.color;
|
|
82
|
+
return (_jsx("div", { className: cn("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-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.payload)) : (_jsxs(_Fragment, { children: [itemConfig?.icon ? (_jsx(itemConfig.icon, {})) : (!hideIndicator && (_jsx("div", { className: cn("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
|
|
83
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
84
|
+
"w-1": indicator === "line",
|
|
85
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
86
|
+
"my-0.5": nestLabel && indicator === "dashed",
|
|
87
|
+
}), style: {
|
|
88
|
+
"--color-bg": indicatorColor,
|
|
89
|
+
"--color-border": indicatorColor,
|
|
90
|
+
} }))), _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: "font-mono font-medium text-foreground tabular-nums", children: typeof item.value === "number"
|
|
91
|
+
? item.value.toLocaleString()
|
|
92
|
+
: String(item.value) }))] })] })) }, index));
|
|
93
|
+
}) })] }));
|
|
94
|
+
}
|
|
95
|
+
const ChartLegend = RechartsPrimitive.Legend;
|
|
96
|
+
function ChartLegendContent({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey, }) {
|
|
97
|
+
const { config } = useChart();
|
|
98
|
+
if (!payload?.length) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
return (_jsx("div", { className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className), children: payload
|
|
102
|
+
.filter((item) => item.type !== "none")
|
|
103
|
+
.map((item, index) => {
|
|
104
|
+
const key = `${nameKey ?? item.dataKey ?? "value"}`;
|
|
105
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
106
|
+
return (_jsxs("div", { className: cn("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"), children: [itemConfig?.icon && !hideIcon ? (_jsx(itemConfig.icon, {})) : (_jsx("div", { className: "h-2 w-2 shrink-0 rounded-[2px]", style: {
|
|
107
|
+
backgroundColor: item.color,
|
|
108
|
+
} })), itemConfig?.label] }, index));
|
|
109
|
+
}) }));
|
|
110
|
+
}
|
|
111
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
112
|
+
if (typeof payload !== "object" || payload === null) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
const payloadPayload = "payload" in payload &&
|
|
116
|
+
typeof payload.payload === "object" &&
|
|
117
|
+
payload.payload !== null
|
|
118
|
+
? payload.payload
|
|
119
|
+
: undefined;
|
|
120
|
+
let configLabelKey = key;
|
|
121
|
+
if (key in payload &&
|
|
122
|
+
typeof payload[key] === "string") {
|
|
123
|
+
configLabelKey = payload[key];
|
|
124
|
+
}
|
|
125
|
+
else if (payloadPayload &&
|
|
126
|
+
key in payloadPayload &&
|
|
127
|
+
typeof payloadPayload[key] === "string") {
|
|
128
|
+
configLabelKey = payloadPayload[key];
|
|
129
|
+
}
|
|
130
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
131
|
+
}
|
|
132
|
+
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { CheckIcon } from "lucide-react";
|
|
6
|
+
function Checkbox({ className, ...props }) {
|
|
7
|
+
return (_jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", className: cn("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary", className), ...props, children: _jsx(CheckboxPrimitive.Indicator, { "data-slot": "checkbox-indicator", className: "grid place-content-center text-current transition-none [&>svg]:size-3.5", children: _jsx(CheckIcon, {}) }) }));
|
|
8
|
+
}
|
|
9
|
+
export { Checkbox };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
|
|
2
|
+
declare function Collapsible({ ...props }: CollapsiblePrimitive.Root.Props): import("react").JSX.Element;
|
|
3
|
+
declare function CollapsibleTrigger({ ...props }: CollapsiblePrimitive.Trigger.Props): import("react").JSX.Element;
|
|
4
|
+
declare function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props): import("react").JSX.Element;
|
|
5
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
|
|
4
|
+
function Collapsible({ ...props }) {
|
|
5
|
+
return _jsx(CollapsiblePrimitive.Root, { "data-slot": "collapsible", ...props });
|
|
6
|
+
}
|
|
7
|
+
function CollapsibleTrigger({ ...props }) {
|
|
8
|
+
return (_jsx(CollapsiblePrimitive.Trigger, { "data-slot": "collapsible-trigger", ...props }));
|
|
9
|
+
}
|
|
10
|
+
function CollapsibleContent({ ...props }) {
|
|
11
|
+
return (_jsx(CollapsiblePrimitive.Panel, { "data-slot": "collapsible-content", ...props }));
|
|
12
|
+
}
|
|
13
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Combobox as ComboboxPrimitive } from "@base-ui/react";
|
|
3
|
+
declare const Combobox: typeof ComboboxPrimitive.Root;
|
|
4
|
+
declare function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props): React.JSX.Element;
|
|
5
|
+
declare function ComboboxTrigger({ className, children, ...props }: ComboboxPrimitive.Trigger.Props): React.JSX.Element;
|
|
6
|
+
declare function ComboboxInput({ className, children, disabled, showTrigger, showClear, ...props }: ComboboxPrimitive.Input.Props & {
|
|
7
|
+
showTrigger?: boolean;
|
|
8
|
+
showClear?: boolean;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
declare function ComboboxContent({ className, side, sideOffset, align, alignOffset, anchor, ...props }: ComboboxPrimitive.Popup.Props & Pick<ComboboxPrimitive.Positioner.Props, "side" | "align" | "sideOffset" | "alignOffset" | "anchor">): React.JSX.Element;
|
|
11
|
+
declare function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props): React.JSX.Element;
|
|
12
|
+
declare function ComboboxItem({ className, children, ...props }: ComboboxPrimitive.Item.Props): React.JSX.Element;
|
|
13
|
+
declare function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props): React.JSX.Element;
|
|
14
|
+
declare function ComboboxLabel({ className, ...props }: ComboboxPrimitive.GroupLabel.Props): React.JSX.Element;
|
|
15
|
+
declare function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props): React.JSX.Element;
|
|
16
|
+
declare function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props): React.JSX.Element;
|
|
17
|
+
declare function ComboboxSeparator({ className, ...props }: ComboboxPrimitive.Separator.Props): React.JSX.Element;
|
|
18
|
+
declare function ComboboxChips({ className, ...props }: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props): React.JSX.Element;
|
|
19
|
+
declare function ComboboxChip({ className, children, showRemove, ...props }: ComboboxPrimitive.Chip.Props & {
|
|
20
|
+
showRemove?: boolean;
|
|
21
|
+
}): React.JSX.Element;
|
|
22
|
+
declare function ComboboxChipsInput({ className, ...props }: ComboboxPrimitive.Input.Props): React.JSX.Element;
|
|
23
|
+
declare function useComboboxAnchor(): React.RefObject<HTMLDivElement | null>;
|
|
24
|
+
export { Combobox, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxGroup, ComboboxLabel, ComboboxCollection, ComboboxEmpty, ComboboxSeparator, ComboboxChips, ComboboxChip, ComboboxChipsInput, ComboboxTrigger, ComboboxValue, useComboboxAnchor, };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Combobox as ComboboxPrimitive } from "@base-ui/react";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { Button } from "../../components/ui/button.js";
|
|
7
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, } from "../../components/ui/input-group.js";
|
|
8
|
+
import { ChevronDownIcon, XIcon, CheckIcon } from "lucide-react";
|
|
9
|
+
const Combobox = ComboboxPrimitive.Root;
|
|
10
|
+
function ComboboxValue({ ...props }) {
|
|
11
|
+
return _jsx(ComboboxPrimitive.Value, { "data-slot": "combobox-value", ...props });
|
|
12
|
+
}
|
|
13
|
+
function ComboboxTrigger({ className, children, ...props }) {
|
|
14
|
+
return (_jsxs(ComboboxPrimitive.Trigger, { "data-slot": "combobox-trigger", className: cn("[&_svg:not([class*='size-'])]:size-4", className), ...props, children: [children, _jsx(ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" })] }));
|
|
15
|
+
}
|
|
16
|
+
function ComboboxClear({ className, ...props }) {
|
|
17
|
+
return (_jsx(ComboboxPrimitive.Clear, { "data-slot": "combobox-clear", render: _jsx(InputGroupButton, { variant: "ghost", size: "icon-xs" }), className: cn(className), ...props, children: _jsx(XIcon, { className: "pointer-events-none" }) }));
|
|
18
|
+
}
|
|
19
|
+
function ComboboxInput({ className, children, disabled = false, showTrigger = true, showClear = false, ...props }) {
|
|
20
|
+
return (_jsxs(InputGroup, { className: cn("w-auto", className), children: [_jsx(ComboboxPrimitive.Input, { render: _jsx(InputGroupInput, { disabled: disabled }), ...props }), _jsxs(InputGroupAddon, { align: "inline-end", children: [showTrigger && (_jsx(InputGroupButton, { size: "icon-xs", variant: "ghost", render: _jsx(ComboboxTrigger, {}), "data-slot": "input-group-button", className: "group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent", disabled: disabled })), showClear && _jsx(ComboboxClear, { disabled: disabled })] }), children] }));
|
|
21
|
+
}
|
|
22
|
+
function ComboboxContent({ className, side = "bottom", sideOffset = 6, align = "start", alignOffset = 0, anchor, ...props }) {
|
|
23
|
+
return (_jsx(ComboboxPrimitive.Portal, { children: _jsx(ComboboxPrimitive.Positioner, { side: side, sideOffset: sideOffset, align: align, alignOffset: alignOffset, anchor: anchor, className: "isolate z-50", children: _jsx(ComboboxPrimitive.Popup, { "data-slot": "combobox-content", "data-chips": !!anchor, className: cn("group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className), ...props }) }) }));
|
|
24
|
+
}
|
|
25
|
+
function ComboboxList({ className, ...props }) {
|
|
26
|
+
return (_jsx(ComboboxPrimitive.List, { "data-slot": "combobox-list", className: cn("no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0", className), ...props }));
|
|
27
|
+
}
|
|
28
|
+
function ComboboxItem({ className, children, ...props }) {
|
|
29
|
+
return (_jsxs(ComboboxPrimitive.Item, { "data-slot": "combobox-item", className: cn("relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: [children, _jsx(ComboboxPrimitive.ItemIndicator, { render: _jsx("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center" }), children: _jsx(CheckIcon, { className: "pointer-events-none" }) })] }));
|
|
30
|
+
}
|
|
31
|
+
function ComboboxGroup({ className, ...props }) {
|
|
32
|
+
return (_jsx(ComboboxPrimitive.Group, { "data-slot": "combobox-group", className: cn(className), ...props }));
|
|
33
|
+
}
|
|
34
|
+
function ComboboxLabel({ className, ...props }) {
|
|
35
|
+
return (_jsx(ComboboxPrimitive.GroupLabel, { "data-slot": "combobox-label", className: cn("px-2 py-1.5 text-xs text-muted-foreground", className), ...props }));
|
|
36
|
+
}
|
|
37
|
+
function ComboboxCollection({ ...props }) {
|
|
38
|
+
return (_jsx(ComboboxPrimitive.Collection, { "data-slot": "combobox-collection", ...props }));
|
|
39
|
+
}
|
|
40
|
+
function ComboboxEmpty({ className, ...props }) {
|
|
41
|
+
return (_jsx(ComboboxPrimitive.Empty, { "data-slot": "combobox-empty", className: cn("hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex", className), ...props }));
|
|
42
|
+
}
|
|
43
|
+
function ComboboxSeparator({ className, ...props }) {
|
|
44
|
+
return (_jsx(ComboboxPrimitive.Separator, { "data-slot": "combobox-separator", className: cn("-mx-1 my-1 h-px bg-border", className), ...props }));
|
|
45
|
+
}
|
|
46
|
+
function ComboboxChips({ className, ...props }) {
|
|
47
|
+
return (_jsx(ComboboxPrimitive.Chips, { "data-slot": "combobox-chips", className: cn("flex min-h-8 flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40", className), ...props }));
|
|
48
|
+
}
|
|
49
|
+
function ComboboxChip({ className, children, showRemove = true, ...props }) {
|
|
50
|
+
return (_jsxs(ComboboxPrimitive.Chip, { "data-slot": "combobox-chip", className: cn("flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0", className), ...props, children: [children, showRemove && (_jsx(ComboboxPrimitive.ChipRemove, { render: _jsx(Button, { variant: "ghost", size: "icon-xs" }), className: "-ml-1 opacity-50 hover:opacity-100", "data-slot": "combobox-chip-remove", children: _jsx(XIcon, { className: "pointer-events-none" }) }))] }));
|
|
51
|
+
}
|
|
52
|
+
function ComboboxChipsInput({ className, ...props }) {
|
|
53
|
+
return (_jsx(ComboboxPrimitive.Input, { "data-slot": "combobox-chip-input", className: cn("min-w-16 flex-1 outline-none", className), ...props }));
|
|
54
|
+
}
|
|
55
|
+
function useComboboxAnchor() {
|
|
56
|
+
return React.useRef(null);
|
|
57
|
+
}
|
|
58
|
+
export { Combobox, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxGroup, ComboboxLabel, ComboboxCollection, ComboboxEmpty, ComboboxSeparator, ComboboxChips, ComboboxChip, ComboboxChipsInput, ComboboxTrigger, ComboboxValue, useComboboxAnchor, };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
3
|
+
import { Dialog } from "../../components/ui/dialog.js";
|
|
4
|
+
declare function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>): React.JSX.Element;
|
|
5
|
+
declare function CommandDialog({ title, description, children, className, showCloseButton, ...props }: Omit<React.ComponentProps<typeof Dialog>, "children"> & {
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
showCloseButton?: boolean;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
declare function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>): React.JSX.Element;
|
|
13
|
+
declare function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>): React.JSX.Element;
|
|
14
|
+
declare function CommandEmpty({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>): React.JSX.Element;
|
|
15
|
+
declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>): React.JSX.Element;
|
|
16
|
+
declare function CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>): React.JSX.Element;
|
|
17
|
+
declare function CommandItem({ className, children, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>): React.JSX.Element;
|
|
18
|
+
declare function CommandShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
19
|
+
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "../../components/ui/dialog.js";
|
|
6
|
+
import { InputGroup, InputGroupAddon, } from "../../components/ui/input-group.js";
|
|
7
|
+
import { SearchIcon, CheckIcon } from "lucide-react";
|
|
8
|
+
function Command({ className, ...props }) {
|
|
9
|
+
return (_jsx(CommandPrimitive, { "data-slot": "command", className: cn("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground", className), ...props }));
|
|
10
|
+
}
|
|
11
|
+
function CommandDialog({ title = "Command Palette", description = "Search for a command to run...", children, className, showCloseButton = false, ...props }) {
|
|
12
|
+
return (_jsxs(Dialog, { ...props, children: [_jsxs(DialogHeader, { className: "sr-only", children: [_jsx(DialogTitle, { children: title }), _jsx(DialogDescription, { children: description })] }), _jsx(DialogContent, { className: cn("top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0", className), showCloseButton: showCloseButton, children: children })] }));
|
|
13
|
+
}
|
|
14
|
+
function CommandInput({ className, ...props }) {
|
|
15
|
+
return (_jsx("div", { "data-slot": "command-input-wrapper", className: "p-1 pb-0", children: _jsxs(InputGroup, { className: "h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!", children: [_jsx(CommandPrimitive.Input, { "data-slot": "command-input", className: cn("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className), ...props }), _jsx(InputGroupAddon, { children: _jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }) })] }) }));
|
|
16
|
+
}
|
|
17
|
+
function CommandList({ className, ...props }) {
|
|
18
|
+
return (_jsx(CommandPrimitive.List, { "data-slot": "command-list", className: cn("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none", className), ...props }));
|
|
19
|
+
}
|
|
20
|
+
function CommandEmpty({ className, ...props }) {
|
|
21
|
+
return (_jsx(CommandPrimitive.Empty, { "data-slot": "command-empty", className: cn("py-6 text-center text-sm", className), ...props }));
|
|
22
|
+
}
|
|
23
|
+
function CommandGroup({ className, ...props }) {
|
|
24
|
+
return (_jsx(CommandPrimitive.Group, { "data-slot": "command-group", 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), ...props }));
|
|
25
|
+
}
|
|
26
|
+
function CommandSeparator({ className, ...props }) {
|
|
27
|
+
return (_jsx(CommandPrimitive.Separator, { "data-slot": "command-separator", className: cn("-mx-1 h-px bg-border", className), ...props }));
|
|
28
|
+
}
|
|
29
|
+
function CommandItem({ className, children, ...props }) {
|
|
30
|
+
return (_jsxs(CommandPrimitive.Item, { "data-slot": "command-item", className: cn("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground", className), ...props, children: [children, _jsx(CheckIcon, { className: "ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" })] }));
|
|
31
|
+
}
|
|
32
|
+
function CommandShortcut({ className, ...props }) {
|
|
33
|
+
return (_jsx("span", { "data-slot": "command-shortcut", className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground", className), ...props }));
|
|
34
|
+
}
|
|
35
|
+
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
|