@aaas-pro/library 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -2
- package/dist/components/address-picker.d.ts +18 -0
- package/dist/components/address-picker.js +46 -0
- package/dist/components/card-date-filter.d.ts +12 -0
- package/dist/components/card-date-filter.js +95 -0
- package/dist/components/date-time-picker.d.ts +12 -0
- package/dist/components/date-time-picker.js +96 -0
- package/dist/components/detail-dialog.d.ts +48 -0
- package/dist/components/detail-dialog.js +97 -0
- package/dist/components/document-links.d.ts +13 -0
- package/dist/components/document-links.js +19 -0
- package/dist/components/draft-row-actions.d.ts +14 -0
- package/dist/components/draft-row-actions.js +70 -0
- package/dist/components/error-boundary.d.ts +14 -0
- package/dist/components/error-boundary.js +35 -0
- package/dist/components/glow-card.d.ts +13 -0
- package/dist/components/glow-card.js +48 -0
- package/dist/components/org-picker.d.ts +17 -0
- package/dist/components/org-picker.js +56 -0
- package/dist/components/overflow-row-actions.d.ts +29 -0
- package/dist/components/overflow-row-actions.js +135 -0
- package/dist/components/page-header.d.ts +21 -0
- package/dist/components/page-header.js +21 -0
- package/dist/components/permission-button.d.ts +4 -0
- package/dist/components/permission-button.js +17 -0
- package/dist/components/permission-context.d.ts +12 -0
- package/dist/components/permission-context.js +17 -0
- package/dist/components/person-picker.d.ts +20 -0
- package/dist/components/person-picker.js +38 -0
- package/dist/components/process-flow-bar.d.ts +15 -0
- package/dist/components/process-flow-bar.js +19 -0
- package/dist/components/product-picker.d.ts +19 -0
- package/dist/components/product-picker.js +155 -0
- package/dist/components/ref-doc-picker.d.ts +24 -0
- package/dist/components/ref-doc-picker.js +139 -0
- package/dist/components/scroll-to-top.d.ts +1 -0
- package/dist/components/scroll-to-top.js +20 -0
- package/dist/components/state-view.d.ts +26 -0
- package/dist/components/state-view.js +75 -0
- package/dist/components/theme-switcher.d.ts +27 -0
- package/dist/components/theme-switcher.js +77 -0
- package/dist/components/time-filter.d.ts +7 -0
- package/dist/components/time-filter.js +65 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/accordion.js +64 -0
- package/dist/components/ui/alert-dialog.d.ts +15 -0
- package/dist/components/ui/alert-dialog.js +160 -0
- package/dist/components/ui/alert.d.ts +12 -0
- package/dist/components/ui/alert.js +66 -0
- package/dist/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/components/ui/aspect-ratio.js +10 -0
- package/dist/components/ui/avatar.d.ts +6 -0
- package/dist/components/ui/avatar.js +53 -0
- package/dist/components/ui/badge.d.ts +12 -0
- package/dist/components/ui/badge.js +44 -0
- package/dist/components/ui/breadcrumb.d.ts +11 -0
- package/dist/components/ui/breadcrumb.js +103 -0
- package/dist/components/ui/button-group.d.ts +14 -0
- package/dist/components/ui/button-group.js +76 -0
- package/dist/components/ui/button.d.ts +20 -0
- package/dist/components/ui/button.js +93 -0
- package/dist/components/ui/calendar.d.ts +73 -0
- package/dist/components/ui/calendar.js +103 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/card.js +90 -0
- package/dist/components/ui/carousel.d.ts +14 -0
- package/dist/components/ui/carousel.js +200 -0
- package/dist/components/ui/chart.d.ts +43 -0
- package/dist/components/ui/chart.js +252 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +31 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/collapsible.js +34 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/command.js +170 -0
- package/dist/components/ui/context-menu.d.ts +26 -0
- package/dist/components/ui/context-menu.js +237 -0
- package/dist/components/ui/dialog.d.ts +17 -0
- package/dist/components/ui/dialog.js +139 -0
- package/dist/components/ui/drawer.d.ts +13 -0
- package/dist/components/ui/drawer.js +129 -0
- package/dist/components/ui/dropdown-menu.d.ts +26 -0
- package/dist/components/ui/dropdown-menu.js +245 -0
- package/dist/components/ui/empty.d.ts +14 -0
- package/dist/components/ui/empty.js +102 -0
- package/dist/components/ui/field.d.ts +27 -0
- package/dist/components/ui/field.js +229 -0
- package/dist/components/ui/form.d.ts +26 -0
- package/dist/components/ui/form.js +118 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/hover-card.js +39 -0
- package/dist/components/ui/input-group.d.ts +22 -0
- package/dist/components/ui/input-group.js +156 -0
- package/dist/components/ui/input-otp.d.ts +11 -0
- package/dist/components/ui/input-otp.js +66 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +21 -0
- package/dist/components/ui/item.d.ts +29 -0
- package/dist/components/ui/item.js +187 -0
- package/dist/components/ui/kbd.d.ts +3 -0
- package/dist/components/ui/kbd.js +31 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/label.js +22 -0
- package/dist/components/ui/menubar.d.ts +26 -0
- package/dist/components/ui/menubar.js +252 -0
- package/dist/components/ui/navigation-menu.d.ts +17 -0
- package/dist/components/ui/navigation-menu.js +170 -0
- package/dist/components/ui/pagination.d.ts +13 -0
- package/dist/components/ui/pagination.js +118 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.js +47 -0
- package/dist/components/ui/progress.d.ts +4 -0
- package/dist/components/ui/progress.js +34 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/radio-group.js +45 -0
- package/dist/components/ui/resizable.d.ts +7 -0
- package/dist/components/ui/resizable.js +49 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.js +60 -0
- package/dist/components/ui/select.d.ts +17 -0
- package/dist/components/ui/select.js +215 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +26 -0
- package/dist/components/ui/sheet.d.ts +13 -0
- package/dist/components/ui/sheet.js +127 -0
- package/dist/components/ui/sidebar.d.ts +72 -0
- package/dist/components/ui/sidebar.js +656 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/skeleton.js +15 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/slider.js +63 -0
- package/dist/components/ui/sonner.d.ts +4 -0
- package/dist/components/ui/sonner.js +34 -0
- package/dist/components/ui/spinner.d.ts +2 -0
- package/dist/components/ui/spinner.js +17 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/switch.js +31 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +114 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/tabs.js +67 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/textarea.js +18 -0
- package/dist/components/ui/toggle-group.d.ts +9 -0
- package/dist/components/ui/toggle-group.js +68 -0
- package/dist/components/ui/toggle.d.ts +12 -0
- package/dist/components/ui/toggle.js +43 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +56 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +18 -0
- package/dist/icons/index.d.ts +57 -0
- package/dist/icons/index.js +115 -0
- package/dist/icons/paths.d.ts +556 -0
- package/dist/icons/paths.js +231 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +399 -0
- package/dist/internal/selection-base.d.ts +37 -0
- package/dist/internal/selection-base.js +40 -0
- package/dist/lib/class-names.d.ts +6 -0
- package/dist/lib/class-names.js +159 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.js +7 -0
- package/dist/lib/variants.d.ts +21 -0
- package/dist/lib/variants.js +21 -0
- package/dist/primitives/accordion.d.ts +29 -0
- package/dist/primitives/accordion.js +49 -0
- package/dist/primitives/alert-dialog.d.ts +10 -0
- package/dist/primitives/alert-dialog.js +22 -0
- package/dist/primitives/aspect-ratio.d.ts +4 -0
- package/dist/primitives/aspect-ratio.js +7 -0
- package/dist/primitives/avatar.d.ts +8 -0
- package/dist/primitives/avatar.js +45 -0
- package/dist/primitives/carousel.d.ts +22 -0
- package/dist/primitives/carousel.js +78 -0
- package/dist/primitives/chart.d.ts +71 -0
- package/dist/primitives/chart.js +125 -0
- package/dist/primitives/checkbox.d.ts +13 -0
- package/dist/primitives/checkbox.js +24 -0
- package/dist/primitives/collapsible.d.ts +14 -0
- package/dist/primitives/collapsible.js +29 -0
- package/dist/primitives/command.d.ts +43 -0
- package/dist/primitives/command.js +98 -0
- package/dist/primitives/context-menu.d.ts +24 -0
- package/dist/primitives/context-menu.js +19 -0
- package/dist/primitives/core.d.ts +25 -0
- package/dist/primitives/core.js +89 -0
- package/dist/primitives/dialog.d.ts +7 -0
- package/dist/primitives/dialog.js +15 -0
- package/dist/primitives/drawer.d.ts +30 -0
- package/dist/primitives/drawer.js +39 -0
- package/dist/primitives/dropdown-menu.d.ts +24 -0
- package/dist/primitives/dropdown-menu.js +19 -0
- package/dist/primitives/form.d.ts +154 -0
- package/dist/primitives/form.js +139 -0
- package/dist/primitives/hover-card.d.ts +4 -0
- package/dist/primitives/hover-card.js +8 -0
- package/dist/primitives/input-otp.d.ts +21 -0
- package/dist/primitives/input-otp.js +78 -0
- package/dist/primitives/label.d.ts +2 -0
- package/dist/primitives/label.js +7 -0
- package/dist/primitives/layer.d.ts +84 -0
- package/dist/primitives/layer.js +300 -0
- package/dist/primitives/menu.d.ts +56 -0
- package/dist/primitives/menu.js +126 -0
- package/dist/primitives/menubar.d.ts +91 -0
- package/dist/primitives/menubar.js +44 -0
- package/dist/primitives/navigation-menu.d.ts +32 -0
- package/dist/primitives/navigation-menu.js +121 -0
- package/dist/primitives/popover.d.ts +4 -0
- package/dist/primitives/popover.js +12 -0
- package/dist/primitives/progress.d.ts +7 -0
- package/dist/primitives/progress.js +13 -0
- package/dist/primitives/radio-group.d.ts +18 -0
- package/dist/primitives/radio-group.js +36 -0
- package/dist/primitives/resizable.d.ts +19 -0
- package/dist/primitives/resizable.js +91 -0
- package/dist/primitives/scroll-area.d.ts +12 -0
- package/dist/primitives/scroll-area.js +26 -0
- package/dist/primitives/select.d.ts +42 -0
- package/dist/primitives/select.js +167 -0
- package/dist/primitives/separator.d.ts +5 -0
- package/dist/primitives/separator.js +7 -0
- package/dist/primitives/slider.d.ts +25 -0
- package/dist/primitives/slider.js +98 -0
- package/dist/primitives/slot.d.ts +1 -0
- package/dist/primitives/slot.js +4 -0
- package/dist/primitives/switch.d.ts +11 -0
- package/dist/primitives/switch.js +22 -0
- package/dist/primitives/tabs.d.ts +23 -0
- package/dist/primitives/tabs.js +38 -0
- package/dist/primitives/toast.d.ts +55 -0
- package/dist/primitives/toast.js +86 -0
- package/dist/primitives/toggle-group.d.ts +24 -0
- package/dist/primitives/toggle-group.js +33 -0
- package/dist/primitives/toggle.d.ts +7 -0
- package/dist/primitives/toggle.js +13 -0
- package/dist/primitives/tooltip.d.ts +7 -0
- package/dist/primitives/tooltip.js +10 -0
- package/dist/style-entry.d.ts +1 -0
- package/dist/style-entry.js +1 -0
- package/dist/styles.css +7016 -0
- package/dist/styles.js +1 -0
- package/dist/theme/index.d.ts +110 -0
- package/dist/theme/index.js +199 -0
- package/licenses/Lucide.txt +15 -0
- package/package.json +67 -4
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import useCarouselEngine from "../../primitives/carousel.js";
|
|
4
|
+
import { ArrowRight, ArrowLeft } from "../../icons/index.js";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
const CarouselContext = React.createContext(null);
|
|
8
|
+
function useCarousel() {
|
|
9
|
+
const context = React.useContext(CarouselContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error("useCarousel must be used within a <Carousel />");
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
function Carousel({
|
|
16
|
+
orientation = "horizontal",
|
|
17
|
+
opts,
|
|
18
|
+
setApi,
|
|
19
|
+
className,
|
|
20
|
+
children,
|
|
21
|
+
...props
|
|
22
|
+
}) {
|
|
23
|
+
const [carouselRef, api] = useCarouselEngine(
|
|
24
|
+
{
|
|
25
|
+
...opts,
|
|
26
|
+
axis: orientation === "horizontal" ? "x" : "y"
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
30
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
31
|
+
const onSelect = React.useCallback((api2) => {
|
|
32
|
+
if (!api2) return;
|
|
33
|
+
setCanScrollPrev(api2.canScrollPrev());
|
|
34
|
+
setCanScrollNext(api2.canScrollNext());
|
|
35
|
+
}, []);
|
|
36
|
+
const scrollPrev = React.useCallback(() => {
|
|
37
|
+
api?.scrollPrev();
|
|
38
|
+
}, [api]);
|
|
39
|
+
const scrollNext = React.useCallback(() => {
|
|
40
|
+
api?.scrollNext();
|
|
41
|
+
}, [api]);
|
|
42
|
+
const handleKeyDown = React.useCallback(
|
|
43
|
+
(event) => {
|
|
44
|
+
if (event.target.matches("input,textarea,select,[contenteditable=true]")) return;
|
|
45
|
+
if (event.key === (orientation === "vertical" ? "ArrowUp" : "ArrowLeft")) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
scrollPrev();
|
|
48
|
+
} else if (event.key === (orientation === "vertical" ? "ArrowDown" : "ArrowRight")) {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
scrollNext();
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
[scrollPrev, scrollNext, orientation]
|
|
54
|
+
);
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
if (!api || !setApi) return;
|
|
57
|
+
setApi(api);
|
|
58
|
+
}, [api, setApi]);
|
|
59
|
+
React.useEffect(() => {
|
|
60
|
+
if (!api) return;
|
|
61
|
+
onSelect(api);
|
|
62
|
+
api.on("reInit", onSelect);
|
|
63
|
+
api.on("select", onSelect);
|
|
64
|
+
return () => {
|
|
65
|
+
api?.off("select", onSelect);
|
|
66
|
+
api?.off("reInit", onSelect);
|
|
67
|
+
};
|
|
68
|
+
}, [api, onSelect]);
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
70
|
+
CarouselContext.Provider,
|
|
71
|
+
{
|
|
72
|
+
value: {
|
|
73
|
+
carouselRef,
|
|
74
|
+
api,
|
|
75
|
+
opts,
|
|
76
|
+
orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
77
|
+
scrollPrev,
|
|
78
|
+
scrollNext,
|
|
79
|
+
canScrollPrev,
|
|
80
|
+
canScrollNext
|
|
81
|
+
},
|
|
82
|
+
children: /* @__PURE__ */ jsx(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
onKeyDownCapture: handleKeyDown,
|
|
86
|
+
className: cn("relative", className),
|
|
87
|
+
role: "region",
|
|
88
|
+
"aria-roledescription": "carousel",
|
|
89
|
+
"data-slot": "carousel",
|
|
90
|
+
...props,
|
|
91
|
+
children
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
function CarouselContent({ className, ...props }) {
|
|
98
|
+
const { carouselRef, orientation } = useCarousel();
|
|
99
|
+
return /* @__PURE__ */ jsx(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
ref: carouselRef,
|
|
103
|
+
className: "overflow-auto [scrollbar-width:none]",
|
|
104
|
+
style: { scrollSnapType: `${orientation === "horizontal" ? "x" : "y"} mandatory`, maxHeight: orientation === "vertical" ? 320 : void 0 },
|
|
105
|
+
"data-slot": "carousel-content",
|
|
106
|
+
children: /* @__PURE__ */ jsx(
|
|
107
|
+
"div",
|
|
108
|
+
{
|
|
109
|
+
className: cn(
|
|
110
|
+
"flex",
|
|
111
|
+
orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
|
|
112
|
+
className
|
|
113
|
+
),
|
|
114
|
+
...props
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
function CarouselItem({ className, ...props }) {
|
|
121
|
+
const { orientation } = useCarousel();
|
|
122
|
+
return /* @__PURE__ */ jsx(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
role: "group",
|
|
126
|
+
"aria-roledescription": "slide",
|
|
127
|
+
style: { scrollSnapAlign: "start" },
|
|
128
|
+
"data-slot": "carousel-item",
|
|
129
|
+
className: cn(
|
|
130
|
+
"min-w-0 shrink-0 grow-0 basis-full",
|
|
131
|
+
orientation === "horizontal" ? "pl-4" : "pt-4",
|
|
132
|
+
className
|
|
133
|
+
),
|
|
134
|
+
...props
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
function CarouselPrevious({
|
|
139
|
+
className,
|
|
140
|
+
variant = "outline",
|
|
141
|
+
size = "icon",
|
|
142
|
+
...props
|
|
143
|
+
}) {
|
|
144
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
145
|
+
return /* @__PURE__ */ jsxs(
|
|
146
|
+
Button,
|
|
147
|
+
{
|
|
148
|
+
"data-slot": "carousel-previous",
|
|
149
|
+
variant,
|
|
150
|
+
size,
|
|
151
|
+
className: cn(
|
|
152
|
+
"absolute size-8 rounded-full",
|
|
153
|
+
orientation === "horizontal" ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
154
|
+
className
|
|
155
|
+
),
|
|
156
|
+
disabled: !canScrollPrev,
|
|
157
|
+
onClick: scrollPrev,
|
|
158
|
+
...props,
|
|
159
|
+
children: [
|
|
160
|
+
/* @__PURE__ */ jsx(ArrowLeft, {}),
|
|
161
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Previous slide" })
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
function CarouselNext({
|
|
167
|
+
className,
|
|
168
|
+
variant = "outline",
|
|
169
|
+
size = "icon",
|
|
170
|
+
...props
|
|
171
|
+
}) {
|
|
172
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
173
|
+
return /* @__PURE__ */ jsxs(
|
|
174
|
+
Button,
|
|
175
|
+
{
|
|
176
|
+
"data-slot": "carousel-next",
|
|
177
|
+
variant,
|
|
178
|
+
size,
|
|
179
|
+
className: cn(
|
|
180
|
+
"absolute size-8 rounded-full",
|
|
181
|
+
orientation === "horizontal" ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
182
|
+
className
|
|
183
|
+
),
|
|
184
|
+
disabled: !canScrollNext,
|
|
185
|
+
onClick: scrollNext,
|
|
186
|
+
...props,
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ jsx(ArrowRight, {}),
|
|
189
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Next slide" })
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
export {
|
|
195
|
+
Carousel,
|
|
196
|
+
CarouselContent,
|
|
197
|
+
CarouselItem,
|
|
198
|
+
CarouselNext,
|
|
199
|
+
CarouselPrevious
|
|
200
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ChartPrimitive from "../../primitives/chart";
|
|
3
|
+
declare const THEMES: {
|
|
4
|
+
readonly light: "";
|
|
5
|
+
readonly dark: ".dark";
|
|
6
|
+
};
|
|
7
|
+
export type ChartConfig = {
|
|
8
|
+
[k in string]: {
|
|
9
|
+
label?: React.ReactNode;
|
|
10
|
+
icon?: React.ComponentType;
|
|
11
|
+
} & ({
|
|
12
|
+
color?: string;
|
|
13
|
+
theme?: never;
|
|
14
|
+
} | {
|
|
15
|
+
color?: never;
|
|
16
|
+
theme: Record<keyof typeof THEMES, string>;
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
declare function ChartContainer({ id, className, children, config, ...props }: React.ComponentProps<"div"> & {
|
|
20
|
+
config: ChartConfig;
|
|
21
|
+
children: React.ComponentProps<typeof ChartPrimitive.ResponsiveContainer>["children"];
|
|
22
|
+
}): React.JSX.Element;
|
|
23
|
+
declare const ChartStyle: ({ id, config }: {
|
|
24
|
+
id: string;
|
|
25
|
+
config: ChartConfig;
|
|
26
|
+
}) => React.JSX.Element | null;
|
|
27
|
+
declare const ChartTooltip: typeof ChartPrimitive.Tooltip;
|
|
28
|
+
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: React.ComponentProps<typeof ChartPrimitive.Tooltip> & React.ComponentProps<"div"> & {
|
|
29
|
+
hideLabel?: boolean;
|
|
30
|
+
hideIndicator?: boolean;
|
|
31
|
+
indicator?: "line" | "dot" | "dashed";
|
|
32
|
+
nameKey?: string;
|
|
33
|
+
labelKey?: string;
|
|
34
|
+
labelClassName?: string;
|
|
35
|
+
}): React.JSX.Element | null;
|
|
36
|
+
declare const ChartLegend: typeof ChartPrimitive.Legend;
|
|
37
|
+
declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: React.ComponentProps<"div"> & Pick<ChartPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
|
38
|
+
hideIcon?: boolean;
|
|
39
|
+
nameKey?: string;
|
|
40
|
+
}): React.JSX.Element | null;
|
|
41
|
+
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, };
|
|
42
|
+
export { BarChart, LineChart, AreaChart, Bar, Line, Area, XAxis, YAxis, CartesianGrid } from "../../primitives/chart";
|
|
43
|
+
export type { ChartProps, SeriesProps, ChartPayload, AxisProps } from "../../primitives/chart";
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Legend, Tooltip, ResponsiveContainer } from "../../primitives/chart.js";
|
|
4
|
+
import { Area, AreaChart, Bar, BarChart, CartesianGrid, Line, LineChart, XAxis, YAxis } from "../../primitives/chart.js";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
const THEMES = { light: "", dark: ".dark" };
|
|
7
|
+
const ChartContext = React.createContext(null);
|
|
8
|
+
function useChart() {
|
|
9
|
+
const context = React.useContext(ChartContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error("useChart must be used within a <ChartContainer />");
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
function ChartContainer({
|
|
16
|
+
id,
|
|
17
|
+
className,
|
|
18
|
+
children,
|
|
19
|
+
config,
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
const uniqueId = React.useId();
|
|
23
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
24
|
+
return /* @__PURE__ */ jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxs(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
"data-slot": "chart",
|
|
28
|
+
"data-chart": chartId,
|
|
29
|
+
className: cn(
|
|
30
|
+
"flex aspect-video min-w-0 justify-center text-xs",
|
|
31
|
+
className
|
|
32
|
+
),
|
|
33
|
+
...props,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx(ChartStyle, { id: chartId, config }),
|
|
36
|
+
/* @__PURE__ */ jsx(ResponsiveContainer, { children })
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
) });
|
|
40
|
+
}
|
|
41
|
+
const ChartStyle = ({ id, config }) => {
|
|
42
|
+
const colorConfig = Object.entries(config).filter(
|
|
43
|
+
([, config2]) => config2.theme || config2.color
|
|
44
|
+
);
|
|
45
|
+
if (!colorConfig.length) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
"style",
|
|
50
|
+
{
|
|
51
|
+
dangerouslySetInnerHTML: {
|
|
52
|
+
__html: Object.entries(THEMES).map(
|
|
53
|
+
([theme, prefix]) => `
|
|
54
|
+
${prefix} [data-chart=${id}] {
|
|
55
|
+
${colorConfig.map(([key, itemConfig]) => {
|
|
56
|
+
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
57
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
58
|
+
}).join("\n")}
|
|
59
|
+
}
|
|
60
|
+
`
|
|
61
|
+
).join("\n")
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
const ChartTooltip = Tooltip;
|
|
67
|
+
function ChartTooltipContent({
|
|
68
|
+
active,
|
|
69
|
+
payload,
|
|
70
|
+
className,
|
|
71
|
+
indicator = "dot",
|
|
72
|
+
hideLabel = false,
|
|
73
|
+
hideIndicator = false,
|
|
74
|
+
label,
|
|
75
|
+
labelFormatter,
|
|
76
|
+
labelClassName,
|
|
77
|
+
formatter,
|
|
78
|
+
color,
|
|
79
|
+
nameKey,
|
|
80
|
+
labelKey
|
|
81
|
+
}) {
|
|
82
|
+
const { config } = useChart();
|
|
83
|
+
const tooltipLabel = React.useMemo(() => {
|
|
84
|
+
if (hideLabel || !payload?.length) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const [item] = payload;
|
|
88
|
+
const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
|
|
89
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
90
|
+
const value = !labelKey && typeof label === "string" ? config[label]?.label || label : itemConfig?.label;
|
|
91
|
+
if (labelFormatter) {
|
|
92
|
+
return /* @__PURE__ */ jsx("div", { className: cn("font-medium", labelClassName), children: labelFormatter(value, payload) });
|
|
93
|
+
}
|
|
94
|
+
if (!value) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
return /* @__PURE__ */ jsx("div", { className: cn("font-medium", labelClassName), children: value });
|
|
98
|
+
}, [
|
|
99
|
+
label,
|
|
100
|
+
labelFormatter,
|
|
101
|
+
payload,
|
|
102
|
+
hideLabel,
|
|
103
|
+
labelClassName,
|
|
104
|
+
config,
|
|
105
|
+
labelKey
|
|
106
|
+
]);
|
|
107
|
+
if (!active || !payload?.length) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
111
|
+
return /* @__PURE__ */ jsxs(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
className: cn(
|
|
115
|
+
"border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
|
|
116
|
+
className
|
|
117
|
+
),
|
|
118
|
+
children: [
|
|
119
|
+
!nestLabel ? tooltipLabel : null,
|
|
120
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-1.5", children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
121
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
122
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
123
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
|
124
|
+
return /* @__PURE__ */ jsx(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
className: cn(
|
|
128
|
+
"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
|
|
129
|
+
indicator === "dot" && "items-center"
|
|
130
|
+
),
|
|
131
|
+
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
132
|
+
itemConfig?.icon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsx(
|
|
133
|
+
"div",
|
|
134
|
+
{
|
|
135
|
+
className: cn(
|
|
136
|
+
"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
|
|
137
|
+
{
|
|
138
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
139
|
+
"w-1": indicator === "line",
|
|
140
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
141
|
+
"my-0.5": nestLabel && indicator === "dashed"
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
style: {
|
|
145
|
+
"--color-bg": indicatorColor,
|
|
146
|
+
"--color-border": indicatorColor
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ jsxs(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
className: cn(
|
|
154
|
+
"flex flex-1 justify-between leading-none",
|
|
155
|
+
nestLabel ? "items-end" : "items-center"
|
|
156
|
+
),
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-1.5", children: [
|
|
159
|
+
nestLabel ? tooltipLabel : null,
|
|
160
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: itemConfig?.label || item.name })
|
|
161
|
+
] }),
|
|
162
|
+
item.value !== void 0 && /* @__PURE__ */ jsx("span", { className: "text-foreground font-mono font-medium tabular-nums", children: item.value.toLocaleString() })
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
] })
|
|
167
|
+
},
|
|
168
|
+
item.dataKey
|
|
169
|
+
);
|
|
170
|
+
}) })
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
const ChartLegend = Legend;
|
|
176
|
+
function ChartLegendContent({
|
|
177
|
+
className,
|
|
178
|
+
hideIcon = false,
|
|
179
|
+
payload,
|
|
180
|
+
verticalAlign = "bottom",
|
|
181
|
+
nameKey
|
|
182
|
+
}) {
|
|
183
|
+
const { config } = useChart();
|
|
184
|
+
if (!payload?.length) {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
return /* @__PURE__ */ jsx(
|
|
188
|
+
"div",
|
|
189
|
+
{
|
|
190
|
+
className: cn(
|
|
191
|
+
"flex items-center justify-center gap-4",
|
|
192
|
+
verticalAlign === "top" ? "pb-3" : "pt-3",
|
|
193
|
+
className
|
|
194
|
+
),
|
|
195
|
+
children: payload.filter((item) => item.type !== "none").map((item) => {
|
|
196
|
+
const key = `${nameKey || item.dataKey || "value"}`;
|
|
197
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
198
|
+
return /* @__PURE__ */ jsxs(
|
|
199
|
+
"div",
|
|
200
|
+
{
|
|
201
|
+
className: cn(
|
|
202
|
+
"[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"
|
|
203
|
+
),
|
|
204
|
+
children: [
|
|
205
|
+
itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx(
|
|
206
|
+
"div",
|
|
207
|
+
{
|
|
208
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
209
|
+
style: {
|
|
210
|
+
backgroundColor: item.color
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
itemConfig?.label
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
item.value
|
|
218
|
+
);
|
|
219
|
+
})
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
224
|
+
if (typeof payload !== "object" || payload === null) {
|
|
225
|
+
return void 0;
|
|
226
|
+
}
|
|
227
|
+
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
228
|
+
let configLabelKey = key;
|
|
229
|
+
if (key in payload && typeof payload[key] === "string") {
|
|
230
|
+
configLabelKey = payload[key];
|
|
231
|
+
} else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
|
|
232
|
+
configLabelKey = payloadPayload[key];
|
|
233
|
+
}
|
|
234
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
235
|
+
}
|
|
236
|
+
export {
|
|
237
|
+
Area,
|
|
238
|
+
AreaChart,
|
|
239
|
+
Bar,
|
|
240
|
+
BarChart,
|
|
241
|
+
CartesianGrid,
|
|
242
|
+
ChartContainer,
|
|
243
|
+
ChartLegend,
|
|
244
|
+
ChartLegendContent,
|
|
245
|
+
ChartStyle,
|
|
246
|
+
ChartTooltip,
|
|
247
|
+
ChartTooltipContent,
|
|
248
|
+
Line,
|
|
249
|
+
LineChart,
|
|
250
|
+
XAxis,
|
|
251
|
+
YAxis
|
|
252
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Root, Indicator } from "../../primitives/checkbox.js";
|
|
3
|
+
import { CheckIcon } from "../../icons/index.js";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
function Checkbox({
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
Root,
|
|
11
|
+
{
|
|
12
|
+
"data-slot": "checkbox",
|
|
13
|
+
className: cn(
|
|
14
|
+
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/15 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
15
|
+
className
|
|
16
|
+
),
|
|
17
|
+
...props,
|
|
18
|
+
children: /* @__PURE__ */ jsx(
|
|
19
|
+
Indicator,
|
|
20
|
+
{
|
|
21
|
+
"data-slot": "checkbox-indicator",
|
|
22
|
+
className: "grid place-content-center text-current transition-none",
|
|
23
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
Checkbox
|
|
31
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as CollapsiblePrimitive from "../../primitives/collapsible";
|
|
2
|
+
declare function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>): import("react").JSX.Element;
|
|
3
|
+
declare function CollapsibleTrigger({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>): import("react").JSX.Element;
|
|
4
|
+
declare function CollapsibleContent({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>): import("react").JSX.Element;
|
|
5
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Root, CollapsibleContent as Content, CollapsibleTrigger as Trigger } from "../../primitives/collapsible.js";
|
|
3
|
+
function Collapsible({
|
|
4
|
+
...props
|
|
5
|
+
}) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Root, { "data-slot": "collapsible", ...props });
|
|
7
|
+
}
|
|
8
|
+
function CollapsibleTrigger({
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
Trigger,
|
|
13
|
+
{
|
|
14
|
+
"data-slot": "collapsible-trigger",
|
|
15
|
+
...props
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
function CollapsibleContent({
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
Content,
|
|
24
|
+
{
|
|
25
|
+
"data-slot": "collapsible-content",
|
|
26
|
+
...props
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
Collapsible,
|
|
32
|
+
CollapsibleContent,
|
|
33
|
+
CollapsibleTrigger
|
|
34
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Command as CommandPrimitive } from "../../primitives/command";
|
|
3
|
+
import { Dialog } from "./dialog";
|
|
4
|
+
declare function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>): React.JSX.Element;
|
|
5
|
+
declare function CommandDialog({ title, description, children, className, showCloseButton, ...props }: React.ComponentProps<typeof Dialog> & {
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
showCloseButton?: boolean;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
declare function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>): React.JSX.Element;
|
|
12
|
+
declare function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>): React.JSX.Element;
|
|
13
|
+
declare function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>): React.JSX.Element;
|
|
14
|
+
declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>): React.JSX.Element;
|
|
15
|
+
declare function CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>): React.JSX.Element;
|
|
16
|
+
declare function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>): React.JSX.Element;
|
|
17
|
+
declare function CommandShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
18
|
+
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
|