@kissflow/create-app 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 +9 -0
- package/bin/index.js +80 -0
- package/package.json +47 -0
- package/scaffolders/app/index.js +49 -0
- package/scaffolders/app/template/_CLAUDE.md +104 -0
- package/scaffolders/app/template/_README.md +54 -0
- package/scaffolders/app/template/_env.example +10 -0
- package/scaffolders/app/template/_gitignore +6 -0
- package/scaffolders/app/template/_package.json +55 -0
- package/scaffolders/app/template/_prettierrc +6 -0
- package/scaffolders/app/template/agents/design-guidelines.md +172 -0
- package/scaffolders/app/template/agents/kissflow-sdk.md +257 -0
- package/scaffolders/app/template/agents/theming.md +61 -0
- package/scaffolders/app/template/cert/localhost.crt +18 -0
- package/scaffolders/app/template/cert/localhost.key +28 -0
- package/scaffolders/app/template/components.json +21 -0
- package/scaffolders/app/template/index.html +12 -0
- package/scaffolders/app/template/jsconfig.json +8 -0
- package/scaffolders/app/template/lib/kf-schema.json +7 -0
- package/scaffolders/app/template/scripts/zip.js +54 -0
- package/scaffolders/app/template/src/components/app-shell.jsx +208 -0
- package/scaffolders/app/template/src/components/fields/AggregationField.jsx +42 -0
- package/scaffolders/app/template/src/components/fields/AttachmentField.jsx +175 -0
- package/scaffolders/app/template/src/components/fields/BooleanField.jsx +47 -0
- package/scaffolders/app/template/src/components/fields/CheckboxField.jsx +79 -0
- package/scaffolders/app/template/src/components/fields/ChecklistField.jsx +190 -0
- package/scaffolders/app/template/src/components/fields/CurrencyField.jsx +183 -0
- package/scaffolders/app/template/src/components/fields/DateField.jsx +65 -0
- package/scaffolders/app/template/src/components/fields/DateTimeField.jsx +186 -0
- package/scaffolders/app/template/src/components/fields/EmailField.jsx +30 -0
- package/scaffolders/app/template/src/components/fields/FieldError.jsx +11 -0
- package/scaffolders/app/template/src/components/fields/FieldLabel.jsx +14 -0
- package/scaffolders/app/template/src/components/fields/GeolocationField.jsx +99 -0
- package/scaffolders/app/template/src/components/fields/ImageField.jsx +149 -0
- package/scaffolders/app/template/src/components/fields/LookupField.jsx +256 -0
- package/scaffolders/app/template/src/components/fields/MultiSelectField.jsx +152 -0
- package/scaffolders/app/template/src/components/fields/MultiUserSelectField.jsx +153 -0
- package/scaffolders/app/template/src/components/fields/NumberField.jsx +30 -0
- package/scaffolders/app/template/src/components/fields/RadioField.jsx +78 -0
- package/scaffolders/app/template/src/components/fields/RatingField.jsx +64 -0
- package/scaffolders/app/template/src/components/fields/ScannerField.jsx +62 -0
- package/scaffolders/app/template/src/components/fields/SelectField.jsx +74 -0
- package/scaffolders/app/template/src/components/fields/SequenceNumberField.jsx +22 -0
- package/scaffolders/app/template/src/components/fields/SignatureField.jsx +344 -0
- package/scaffolders/app/template/src/components/fields/SliderField.jsx +39 -0
- package/scaffolders/app/template/src/components/fields/SmartAttachmentField.jsx +188 -0
- package/scaffolders/app/template/src/components/fields/TextField.jsx +30 -0
- package/scaffolders/app/template/src/components/fields/TextareaField.jsx +30 -0
- package/scaffolders/app/template/src/components/fields/UserSelectField.jsx +76 -0
- package/scaffolders/app/template/src/components/fields/index.js +87 -0
- package/scaffolders/app/template/src/components/fields/useGeolocationPicker.js +42 -0
- package/scaffolders/app/template/src/components/fields/useScanner.js +43 -0
- package/scaffolders/app/template/src/components/form/FormAction.jsx +86 -0
- package/scaffolders/app/template/src/components/form/FormBody.jsx +163 -0
- package/scaffolders/app/template/src/components/form/FormHeader.jsx +65 -0
- package/scaffolders/app/template/src/components/form/ProcessActions.jsx +270 -0
- package/scaffolders/app/template/src/components/form/index.jsx +119 -0
- package/scaffolders/app/template/src/components/form/shared.jsx +213 -0
- package/scaffolders/app/template/src/components/tablefields/TableAggregationField.jsx +14 -0
- package/scaffolders/app/template/src/components/tablefields/TableAttachmentField.jsx +53 -0
- package/scaffolders/app/template/src/components/tablefields/TableBooleanField.jsx +26 -0
- package/scaffolders/app/template/src/components/tablefields/TableCheckboxField.jsx +6 -0
- package/scaffolders/app/template/src/components/tablefields/TableChecklistField.jsx +48 -0
- package/scaffolders/app/template/src/components/tablefields/TableCurrencyField.jsx +140 -0
- package/scaffolders/app/template/src/components/tablefields/TableDateField.jsx +49 -0
- package/scaffolders/app/template/src/components/tablefields/TableDateTimeField.jsx +170 -0
- package/scaffolders/app/template/src/components/tablefields/TableGeolocationField.jsx +69 -0
- package/scaffolders/app/template/src/components/tablefields/TableImageField.jsx +78 -0
- package/scaffolders/app/template/src/components/tablefields/TableLookupField.jsx +165 -0
- package/scaffolders/app/template/src/components/tablefields/TableMultiSelectField.jsx +111 -0
- package/scaffolders/app/template/src/components/tablefields/TableMultiUserSelectField.jsx +109 -0
- package/scaffolders/app/template/src/components/tablefields/TableNumberField.jsx +33 -0
- package/scaffolders/app/template/src/components/tablefields/TableRatingField.jsx +45 -0
- package/scaffolders/app/template/src/components/tablefields/TableScannerField.jsx +67 -0
- package/scaffolders/app/template/src/components/tablefields/TableSelectField.jsx +47 -0
- package/scaffolders/app/template/src/components/tablefields/TableSequenceNumberField.jsx +7 -0
- package/scaffolders/app/template/src/components/tablefields/TableSignatureField.jsx +59 -0
- package/scaffolders/app/template/src/components/tablefields/TableSliderField.jsx +26 -0
- package/scaffolders/app/template/src/components/tablefields/TableTextField.jsx +28 -0
- package/scaffolders/app/template/src/components/tablefields/TableUserSelectField.jsx +51 -0
- package/scaffolders/app/template/src/components/tablefields/index.js +71 -0
- package/scaffolders/app/template/src/components/tablefields/useTableFieldOptions.js +33 -0
- package/scaffolders/app/template/src/components/ui/accordion.jsx +51 -0
- package/scaffolders/app/template/src/components/ui/avatar.jsx +92 -0
- package/scaffolders/app/template/src/components/ui/badge.jsx +40 -0
- package/scaffolders/app/template/src/components/ui/button.jsx +61 -0
- package/scaffolders/app/template/src/components/ui/calendar.jsx +207 -0
- package/scaffolders/app/template/src/components/ui/card.jsx +92 -0
- package/scaffolders/app/template/src/components/ui/chart.jsx +323 -0
- package/scaffolders/app/template/src/components/ui/checkbox.jsx +27 -0
- package/scaffolders/app/template/src/components/ui/command.jsx +154 -0
- package/scaffolders/app/template/src/components/ui/dialog.jsx +122 -0
- package/scaffolders/app/template/src/components/ui/dropdown-menu.jsx +200 -0
- package/scaffolders/app/template/src/components/ui/input.jsx +21 -0
- package/scaffolders/app/template/src/components/ui/label.jsx +19 -0
- package/scaffolders/app/template/src/components/ui/popover.jsx +40 -0
- package/scaffolders/app/template/src/components/ui/progress.jsx +25 -0
- package/scaffolders/app/template/src/components/ui/radio-group.jsx +37 -0
- package/scaffolders/app/template/src/components/ui/scroll-area.jsx +48 -0
- package/scaffolders/app/template/src/components/ui/select.jsx +156 -0
- package/scaffolders/app/template/src/components/ui/separator.jsx +26 -0
- package/scaffolders/app/template/src/components/ui/sheet.jsx +123 -0
- package/scaffolders/app/template/src/components/ui/skeleton.jsx +13 -0
- package/scaffolders/app/template/src/components/ui/slider.jsx +61 -0
- package/scaffolders/app/template/src/components/ui/sonner.jsx +60 -0
- package/scaffolders/app/template/src/components/ui/switch.jsx +26 -0
- package/scaffolders/app/template/src/components/ui/table.jsx +111 -0
- package/scaffolders/app/template/src/components/ui/tabs.jsx +74 -0
- package/scaffolders/app/template/src/components/ui/textarea.jsx +18 -0
- package/scaffolders/app/template/src/components/ui/tooltip.jsx +43 -0
- package/scaffolders/app/template/src/hooks/useForm.js +841 -0
- package/scaffolders/app/template/src/index.css +143 -0
- package/scaffolders/app/template/src/lib/utils.js +6 -0
- package/scaffolders/app/template/src/main.jsx +18 -0
- package/scaffolders/app/template/src/pages/index.jsx +244 -0
- package/scaffolders/app/template/src/themes.css +153 -0
- package/scaffolders/app/template/src/themes.js +32 -0
- package/scaffolders/app/template/vite-kf-live.js +117 -0
- package/scaffolders/app/template/vite.config.js +56 -0
- package/scaffolders/constants.js +25 -0
- package/scaffolders/helpers.js +12 -0
- package/scaffolders/utils.js +109 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Separator as SeparatorPrimitive } from "radix-ui";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
function Separator({
|
|
7
|
+
className,
|
|
8
|
+
orientation = "horizontal",
|
|
9
|
+
decorative = true,
|
|
10
|
+
...props
|
|
11
|
+
}) {
|
|
12
|
+
return (
|
|
13
|
+
<SeparatorPrimitive.Root
|
|
14
|
+
data-slot="separator"
|
|
15
|
+
decorative={decorative}
|
|
16
|
+
orientation={orientation}
|
|
17
|
+
className={cn(
|
|
18
|
+
"shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Separator };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { XIcon } from "lucide-react";
|
|
3
|
+
import { Dialog as SheetPrimitive } from "radix-ui";
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
function Sheet({ ...props }) {
|
|
8
|
+
return <SheetPrimitive.Root data-slot="sheet" {...props} />;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function SheetTrigger({ ...props }) {
|
|
12
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function SheetClose({ ...props }) {
|
|
16
|
+
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function SheetPortal({ ...props }) {
|
|
20
|
+
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function SheetOverlay({ className, ...props }) {
|
|
24
|
+
return (
|
|
25
|
+
<SheetPrimitive.Overlay
|
|
26
|
+
data-slot="sheet-overlay"
|
|
27
|
+
className={cn(
|
|
28
|
+
"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
29
|
+
className
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function SheetContent({
|
|
37
|
+
className,
|
|
38
|
+
children,
|
|
39
|
+
side = "right",
|
|
40
|
+
showCloseButton = true,
|
|
41
|
+
...props
|
|
42
|
+
}) {
|
|
43
|
+
return (
|
|
44
|
+
<SheetPortal>
|
|
45
|
+
<SheetOverlay />
|
|
46
|
+
<SheetPrimitive.Content
|
|
47
|
+
data-slot="sheet-content"
|
|
48
|
+
className={cn(
|
|
49
|
+
"fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500",
|
|
50
|
+
side === "right" &&
|
|
51
|
+
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
52
|
+
side === "left" &&
|
|
53
|
+
"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
54
|
+
side === "top" &&
|
|
55
|
+
"inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
56
|
+
side === "bottom" &&
|
|
57
|
+
"inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
58
|
+
className
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
62
|
+
{children}
|
|
63
|
+
{showCloseButton && (
|
|
64
|
+
<SheetPrimitive.Close className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary">
|
|
65
|
+
<XIcon className="size-4" />
|
|
66
|
+
<span className="sr-only">Close</span>
|
|
67
|
+
</SheetPrimitive.Close>
|
|
68
|
+
)}
|
|
69
|
+
</SheetPrimitive.Content>
|
|
70
|
+
</SheetPortal>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function SheetHeader({ className, ...props }) {
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
data-slot="sheet-header"
|
|
78
|
+
className={cn("flex flex-col gap-1.5 p-4", className)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function SheetFooter({ className, ...props }) {
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
data-slot="sheet-footer"
|
|
88
|
+
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function SheetTitle({ className, ...props }) {
|
|
95
|
+
return (
|
|
96
|
+
<SheetPrimitive.Title
|
|
97
|
+
data-slot="sheet-title"
|
|
98
|
+
className={cn("font-semibold text-foreground", className)}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function SheetDescription({ className, ...props }) {
|
|
105
|
+
return (
|
|
106
|
+
<SheetPrimitive.Description
|
|
107
|
+
data-slot="sheet-description"
|
|
108
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
109
|
+
{...props}
|
|
110
|
+
/>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export {
|
|
115
|
+
Sheet,
|
|
116
|
+
SheetTrigger,
|
|
117
|
+
SheetClose,
|
|
118
|
+
SheetContent,
|
|
119
|
+
SheetHeader,
|
|
120
|
+
SheetFooter,
|
|
121
|
+
SheetTitle,
|
|
122
|
+
SheetDescription
|
|
123
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SliderPrimitive from "@radix-ui/react-slider";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
function Slider({
|
|
7
|
+
className,
|
|
8
|
+
defaultValue,
|
|
9
|
+
value,
|
|
10
|
+
min = 0,
|
|
11
|
+
max = 100,
|
|
12
|
+
...props
|
|
13
|
+
}) {
|
|
14
|
+
const _values = React.useMemo(
|
|
15
|
+
() =>
|
|
16
|
+
Array.isArray(value)
|
|
17
|
+
? value
|
|
18
|
+
: Array.isArray(defaultValue)
|
|
19
|
+
? defaultValue
|
|
20
|
+
: [min, max],
|
|
21
|
+
[value, defaultValue, min, max]
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<SliderPrimitive.Root
|
|
26
|
+
data-slot="slider"
|
|
27
|
+
defaultValue={defaultValue}
|
|
28
|
+
value={value}
|
|
29
|
+
min={min}
|
|
30
|
+
max={max}
|
|
31
|
+
className={cn(
|
|
32
|
+
"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
33
|
+
className
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
>
|
|
37
|
+
<SliderPrimitive.Track
|
|
38
|
+
data-slot="slider-track"
|
|
39
|
+
className={cn(
|
|
40
|
+
"bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
41
|
+
)}
|
|
42
|
+
>
|
|
43
|
+
<SliderPrimitive.Range
|
|
44
|
+
data-slot="slider-range"
|
|
45
|
+
className={cn(
|
|
46
|
+
"bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
|
|
47
|
+
)}
|
|
48
|
+
/>
|
|
49
|
+
</SliderPrimitive.Track>
|
|
50
|
+
{Array.from({ length: _values.length }, (_, index) => (
|
|
51
|
+
<SliderPrimitive.Thumb
|
|
52
|
+
data-slot="slider-thumb"
|
|
53
|
+
key={index}
|
|
54
|
+
className="border-primary ring-ring/50 block size-4 shrink-0 cursor-grab rounded-full border bg-background shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden active:cursor-grabbing disabled:pointer-events-none disabled:opacity-50"
|
|
55
|
+
/>
|
|
56
|
+
))}
|
|
57
|
+
</SliderPrimitive.Root>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { Slider };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
CircleCheckIcon,
|
|
4
|
+
InfoIcon,
|
|
5
|
+
Loader2Icon,
|
|
6
|
+
OctagonXIcon,
|
|
7
|
+
TriangleAlertIcon
|
|
8
|
+
} from "lucide-react";
|
|
9
|
+
import { Toaster as Sonner } from "sonner";
|
|
10
|
+
|
|
11
|
+
// Mirrors the app's own dark-mode toggle - the `dark` class app-shell.jsx's
|
|
12
|
+
// useDarkMode() sets on <html> - instead of next-themes, which this app
|
|
13
|
+
// never wraps a ThemeProvider around (so its useTheme() never reflected the
|
|
14
|
+
// real theme).
|
|
15
|
+
function useDocumentTheme() {
|
|
16
|
+
const [theme, setTheme] = useState(() =>
|
|
17
|
+
document.documentElement.classList.contains("dark") ? "dark" : "light"
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
useEffect(function watchDarkClass() {
|
|
21
|
+
const root = document.documentElement;
|
|
22
|
+
const observer = new MutationObserver(() => {
|
|
23
|
+
setTheme(root.classList.contains("dark") ? "dark" : "light");
|
|
24
|
+
});
|
|
25
|
+
observer.observe(root, {
|
|
26
|
+
attributes: true,
|
|
27
|
+
attributeFilter: ["class"]
|
|
28
|
+
});
|
|
29
|
+
return () => observer.disconnect();
|
|
30
|
+
}, []);
|
|
31
|
+
|
|
32
|
+
return theme;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const Toaster = ({ ...props }) => {
|
|
36
|
+
const theme = useDocumentTheme();
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Sonner
|
|
40
|
+
theme={theme}
|
|
41
|
+
className="toaster group"
|
|
42
|
+
icons={{
|
|
43
|
+
success: <CircleCheckIcon className="size-4" />,
|
|
44
|
+
info: <InfoIcon className="size-4" />,
|
|
45
|
+
warning: <TriangleAlertIcon className="size-4" />,
|
|
46
|
+
error: <OctagonXIcon className="size-4" />,
|
|
47
|
+
loading: <Loader2Icon className="size-4 animate-spin" />
|
|
48
|
+
}}
|
|
49
|
+
style={{
|
|
50
|
+
"--normal-bg": "var(--popover)",
|
|
51
|
+
"--normal-text": "var(--popover-foreground)",
|
|
52
|
+
"--normal-border": "var(--border)",
|
|
53
|
+
"--border-radius": "var(--radius)"
|
|
54
|
+
}}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { Toaster };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
function Switch({ className, ...props }) {
|
|
7
|
+
return (
|
|
8
|
+
<SwitchPrimitive.Root
|
|
9
|
+
data-slot="switch"
|
|
10
|
+
className={cn(
|
|
11
|
+
"peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
12
|
+
className
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
<SwitchPrimitive.Thumb
|
|
17
|
+
data-slot="switch-thumb"
|
|
18
|
+
className={cn(
|
|
19
|
+
"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
|
|
20
|
+
)}
|
|
21
|
+
/>
|
|
22
|
+
</SwitchPrimitive.Root>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Switch };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/utils";
|
|
4
|
+
|
|
5
|
+
function Table({ className, ...props }) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
data-slot="table-container"
|
|
9
|
+
className="relative w-full overflow-x-auto"
|
|
10
|
+
>
|
|
11
|
+
<table
|
|
12
|
+
data-slot="table"
|
|
13
|
+
className={cn("w-full caption-bottom text-sm", className)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function TableHeader({ className, ...props }) {
|
|
21
|
+
return (
|
|
22
|
+
<thead
|
|
23
|
+
data-slot="table-header"
|
|
24
|
+
className={cn("[&_tr]:border-b", className)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function TableBody({ className, ...props }) {
|
|
31
|
+
return (
|
|
32
|
+
<tbody
|
|
33
|
+
data-slot="table-body"
|
|
34
|
+
className={cn("[&_tr:last-child]:border-0", className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function TableFooter({ className, ...props }) {
|
|
41
|
+
return (
|
|
42
|
+
<tfoot
|
|
43
|
+
data-slot="table-footer"
|
|
44
|
+
className={cn(
|
|
45
|
+
"bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
|
|
46
|
+
className
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function TableRow({ className, ...props }) {
|
|
54
|
+
return (
|
|
55
|
+
<tr
|
|
56
|
+
data-slot="table-row"
|
|
57
|
+
className={cn(
|
|
58
|
+
"hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
|
|
59
|
+
className
|
|
60
|
+
)}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function TableHead({ className, ...props }) {
|
|
67
|
+
return (
|
|
68
|
+
<th
|
|
69
|
+
data-slot="table-head"
|
|
70
|
+
className={cn(
|
|
71
|
+
"text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
72
|
+
className
|
|
73
|
+
)}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function TableCell({ className, ...props }) {
|
|
80
|
+
return (
|
|
81
|
+
<td
|
|
82
|
+
data-slot="table-cell"
|
|
83
|
+
className={cn(
|
|
84
|
+
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
85
|
+
className
|
|
86
|
+
)}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function TableCaption({ className, ...props }) {
|
|
93
|
+
return (
|
|
94
|
+
<caption
|
|
95
|
+
data-slot="table-caption"
|
|
96
|
+
className={cn("text-muted-foreground mt-4 text-sm", className)}
|
|
97
|
+
{...props}
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export {
|
|
103
|
+
Table,
|
|
104
|
+
TableHeader,
|
|
105
|
+
TableBody,
|
|
106
|
+
TableFooter,
|
|
107
|
+
TableHead,
|
|
108
|
+
TableRow,
|
|
109
|
+
TableCell,
|
|
110
|
+
TableCaption
|
|
111
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
function Tabs({ className, orientation = "horizontal", ...props }) {
|
|
8
|
+
return (
|
|
9
|
+
<TabsPrimitive.Root
|
|
10
|
+
data-slot="tabs"
|
|
11
|
+
data-orientation={orientation}
|
|
12
|
+
orientation={orientation}
|
|
13
|
+
className={cn(
|
|
14
|
+
"group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const tabsListVariants = cva(
|
|
23
|
+
"group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none",
|
|
24
|
+
{
|
|
25
|
+
variants: {
|
|
26
|
+
variant: {
|
|
27
|
+
default: "bg-muted",
|
|
28
|
+
line: "gap-1 bg-transparent"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
variant: "default"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
function TabsList({ className, variant = "default", ...props }) {
|
|
38
|
+
return (
|
|
39
|
+
<TabsPrimitive.List
|
|
40
|
+
data-slot="tabs-list"
|
|
41
|
+
data-variant={variant}
|
|
42
|
+
className={cn(tabsListVariants({ variant }), className)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function TabsTrigger({ className, ...props }) {
|
|
49
|
+
return (
|
|
50
|
+
<TabsPrimitive.Trigger
|
|
51
|
+
data-slot="tabs-trigger"
|
|
52
|
+
className={cn(
|
|
53
|
+
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
54
|
+
"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent",
|
|
55
|
+
"data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground",
|
|
56
|
+
"after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",
|
|
57
|
+
className
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function TabsContent({ className, ...props }) {
|
|
65
|
+
return (
|
|
66
|
+
<TabsPrimitive.Content
|
|
67
|
+
data-slot="tabs-content"
|
|
68
|
+
className={cn("flex-1 outline-none", className)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/utils";
|
|
4
|
+
|
|
5
|
+
function Textarea({ className, ...props }) {
|
|
6
|
+
return (
|
|
7
|
+
<textarea
|
|
8
|
+
data-slot="textarea"
|
|
9
|
+
className={cn(
|
|
10
|
+
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
11
|
+
className
|
|
12
|
+
)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { Textarea };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
function TooltipProvider({ delayDuration = 0, ...props }) {
|
|
7
|
+
return (
|
|
8
|
+
<TooltipPrimitive.Provider
|
|
9
|
+
data-slot="tooltip-provider"
|
|
10
|
+
delayDuration={delayDuration}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function Tooltip({ ...props }) {
|
|
17
|
+
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function TooltipTrigger({ ...props }) {
|
|
21
|
+
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function TooltipContent({ className, sideOffset = 0, children, ...props }) {
|
|
25
|
+
return (
|
|
26
|
+
<TooltipPrimitive.Portal>
|
|
27
|
+
<TooltipPrimitive.Content
|
|
28
|
+
data-slot="tooltip-content"
|
|
29
|
+
sideOffset={sideOffset}
|
|
30
|
+
className={cn(
|
|
31
|
+
"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
32
|
+
className
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
|
|
38
|
+
</TooltipPrimitive.Content>
|
|
39
|
+
</TooltipPrimitive.Portal>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|