@datenlotse/jsonjoy-builder 0.4.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.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +203 -0
  3. package/dist/components/SchemaEditor/AddFieldButton.js +312 -0
  4. package/dist/components/SchemaEditor/JsonSchemaEditor.js +166 -0
  5. package/dist/components/SchemaEditor/JsonSchemaVisualizer.js +96 -0
  6. package/dist/components/SchemaEditor/SchemaField.js +104 -0
  7. package/dist/components/SchemaEditor/SchemaFieldList.js +84 -0
  8. package/dist/components/SchemaEditor/SchemaPropertyEditor.js +249 -0
  9. package/dist/components/SchemaEditor/SchemaTypeSelector.js +55 -0
  10. package/dist/components/SchemaEditor/SchemaVisualEditor.js +77 -0
  11. package/dist/components/SchemaEditor/TypeDropdown.js +72 -0
  12. package/dist/components/SchemaEditor/TypeEditor.js +71 -0
  13. package/dist/components/SchemaEditor/types/ArrayEditor.js +173 -0
  14. package/dist/components/SchemaEditor/types/BooleanEditor.js +107 -0
  15. package/dist/components/SchemaEditor/types/NumberEditor.js +583 -0
  16. package/dist/components/SchemaEditor/types/ObjectEditor.js +90 -0
  17. package/dist/components/SchemaEditor/types/StringEditor.js +542 -0
  18. package/dist/components/features/JsonValidator.js +239 -0
  19. package/dist/components/features/SchemaInferencer.js +107 -0
  20. package/dist/components/ui/badge.js +25 -0
  21. package/dist/components/ui/button.js +41 -0
  22. package/dist/components/ui/dialog.js +73 -0
  23. package/dist/components/ui/input.js +11 -0
  24. package/dist/components/ui/label.js +13 -0
  25. package/dist/components/ui/select.js +90 -0
  26. package/dist/components/ui/switch.js +14 -0
  27. package/dist/components/ui/tabs.js +24 -0
  28. package/dist/components/ui/tooltip.js +15 -0
  29. package/dist/hooks/use-monaco-theme.js +197 -0
  30. package/dist/hooks/use-translation.js +14 -0
  31. package/dist/i18n/locales/de.js +143 -0
  32. package/dist/i18n/locales/en.js +143 -0
  33. package/dist/i18n/locales/es.js +143 -0
  34. package/dist/i18n/locales/fr.js +143 -0
  35. package/dist/i18n/locales/ru.js +143 -0
  36. package/dist/i18n/locales/uk.js +143 -0
  37. package/dist/i18n/locales/zh.js +143 -0
  38. package/dist/i18n/translation-context.js +4 -0
  39. package/dist/i18n/translation-keys.js +0 -0
  40. package/dist/index.css +3830 -0
  41. package/dist/index.d.ts +995 -0
  42. package/dist/index.js +10 -0
  43. package/dist/lib/schema-inference.js +266 -0
  44. package/dist/lib/schemaCompile.js +113 -0
  45. package/dist/lib/schemaEditor.js +167 -0
  46. package/dist/lib/utils.js +40 -0
  47. package/dist/types/jsonSchema.js +98 -0
  48. package/dist/types/validation.js +215 -0
  49. package/dist/utils/jsonValidator.js +162 -0
  50. package/package.json +112 -0
@@ -0,0 +1,239 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import react from "@monaco-editor/react";
3
+ import { AlertCircle, Check, Loader2 } from "lucide-react";
4
+ import { useCallback, useEffect, useRef, useState } from "react";
5
+ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "../ui/dialog.js";
6
+ import { useMonacoTheme } from "../../hooks/use-monaco-theme.js";
7
+ import { formatTranslation, useTranslation } from "../../hooks/use-translation.js";
8
+ import { validateJson } from "../../utils/jsonValidator.js";
9
+ function JsonValidator({ open, onOpenChange, schema }) {
10
+ const t = useTranslation();
11
+ const [jsonInput, setJsonInput] = useState("");
12
+ const [validationResult, setValidationResult] = useState(null);
13
+ const editorRef = useRef(null);
14
+ const debounceTimerRef = useRef(null);
15
+ const monacoRef = useRef(null);
16
+ const schemaMonacoRef = useRef(null);
17
+ const { currentTheme, defineMonacoThemes, configureJsonDefaults, defaultEditorOptions } = useMonacoTheme();
18
+ const validateJsonAgainstSchema = useCallback(()=>{
19
+ if (!jsonInput.trim()) return void setValidationResult(null);
20
+ const result = validateJson(jsonInput, schema);
21
+ setValidationResult(result);
22
+ }, [
23
+ jsonInput,
24
+ schema
25
+ ]);
26
+ useEffect(()=>{
27
+ if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
28
+ debounceTimerRef.current = setTimeout(()=>{
29
+ validateJsonAgainstSchema();
30
+ }, 500);
31
+ return ()=>{
32
+ if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
33
+ };
34
+ }, [
35
+ validateJsonAgainstSchema
36
+ ]);
37
+ const handleJsonEditorBeforeMount = (monaco)=>{
38
+ monacoRef.current = monaco;
39
+ defineMonacoThemes(monaco);
40
+ configureJsonDefaults(monaco, schema);
41
+ };
42
+ const handleSchemaEditorBeforeMount = (monaco)=>{
43
+ schemaMonacoRef.current = monaco;
44
+ defineMonacoThemes(monaco);
45
+ };
46
+ const handleEditorDidMount = (editor)=>{
47
+ editorRef.current = editor;
48
+ editor.focus();
49
+ };
50
+ const handleEditorChange = (value)=>{
51
+ setJsonInput(value || "");
52
+ };
53
+ const goToError = (line, column)=>{
54
+ if (editorRef.current) {
55
+ editorRef.current.revealLineInCenter(line);
56
+ editorRef.current.setPosition({
57
+ lineNumber: line,
58
+ column: column
59
+ });
60
+ editorRef.current.focus();
61
+ }
62
+ };
63
+ const editorOptions = {
64
+ ...defaultEditorOptions,
65
+ readOnly: false
66
+ };
67
+ const schemaViewerOptions = {
68
+ ...defaultEditorOptions,
69
+ readOnly: true
70
+ };
71
+ return /*#__PURE__*/ jsx(Dialog, {
72
+ open: open,
73
+ onOpenChange: onOpenChange,
74
+ children: /*#__PURE__*/ jsxs(DialogContent, {
75
+ className: "sm:max-w-5xl max-h-[700px] flex flex-col jsonjoy",
76
+ children: [
77
+ /*#__PURE__*/ jsxs(DialogHeader, {
78
+ children: [
79
+ /*#__PURE__*/ jsx(DialogTitle, {
80
+ children: t.validatorTitle
81
+ }),
82
+ /*#__PURE__*/ jsx(DialogDescription, {
83
+ children: t.validatorDescription
84
+ })
85
+ ]
86
+ }),
87
+ /*#__PURE__*/ jsxs("div", {
88
+ className: "flex-1 flex flex-col md:flex-row gap-4 py-4 overflow-hidden h-[600px]",
89
+ children: [
90
+ /*#__PURE__*/ jsxs("div", {
91
+ className: "flex-1 flex flex-col h-full",
92
+ children: [
93
+ /*#__PURE__*/ jsx("div", {
94
+ className: "text-sm font-medium mb-2",
95
+ children: t.validatorContent
96
+ }),
97
+ /*#__PURE__*/ jsx("div", {
98
+ className: "border rounded-md flex-1 h-full",
99
+ children: /*#__PURE__*/ jsx(react, {
100
+ height: "600px",
101
+ defaultLanguage: "json",
102
+ value: jsonInput,
103
+ onChange: handleEditorChange,
104
+ beforeMount: handleJsonEditorBeforeMount,
105
+ onMount: handleEditorDidMount,
106
+ loading: /*#__PURE__*/ jsx("div", {
107
+ className: "flex items-center justify-center h-full w-full bg-secondary/30",
108
+ children: /*#__PURE__*/ jsx(Loader2, {
109
+ className: "h-6 w-6 animate-spin"
110
+ })
111
+ }),
112
+ options: editorOptions,
113
+ theme: currentTheme
114
+ })
115
+ })
116
+ ]
117
+ }),
118
+ /*#__PURE__*/ jsxs("div", {
119
+ className: "flex-1 flex flex-col h-full",
120
+ children: [
121
+ /*#__PURE__*/ jsx("div", {
122
+ className: "text-sm font-medium mb-2",
123
+ children: t.validatorCurrentSchema
124
+ }),
125
+ /*#__PURE__*/ jsx("div", {
126
+ className: "border rounded-md flex-1 h-full",
127
+ children: /*#__PURE__*/ jsx(react, {
128
+ height: "600px",
129
+ defaultLanguage: "json",
130
+ value: JSON.stringify(schema, null, 2),
131
+ beforeMount: handleSchemaEditorBeforeMount,
132
+ loading: /*#__PURE__*/ jsx("div", {
133
+ className: "flex items-center justify-center h-full w-full bg-secondary/30",
134
+ children: /*#__PURE__*/ jsx(Loader2, {
135
+ className: "h-6 w-6 animate-spin"
136
+ })
137
+ }),
138
+ options: schemaViewerOptions,
139
+ theme: currentTheme
140
+ })
141
+ })
142
+ ]
143
+ })
144
+ ]
145
+ }),
146
+ validationResult && /*#__PURE__*/ jsxs("div", {
147
+ className: `rounded-md p-4 ${validationResult.valid ? "bg-green-50 border border-green-200" : "bg-red-50 border border-red-200"} transition-all duration-300 ease-in-out`,
148
+ children: [
149
+ /*#__PURE__*/ jsx("div", {
150
+ className: "flex items-center",
151
+ children: validationResult.valid ? /*#__PURE__*/ jsxs(Fragment, {
152
+ children: [
153
+ /*#__PURE__*/ jsx(Check, {
154
+ className: "h-5 w-5 text-green-500 mr-2"
155
+ }),
156
+ /*#__PURE__*/ jsx("p", {
157
+ className: "text-green-700 font-medium",
158
+ children: t.validatorValid
159
+ })
160
+ ]
161
+ }) : /*#__PURE__*/ jsxs(Fragment, {
162
+ children: [
163
+ /*#__PURE__*/ jsx(AlertCircle, {
164
+ className: "h-5 w-5 text-red-500 mr-2"
165
+ }),
166
+ /*#__PURE__*/ jsx("p", {
167
+ className: "text-red-700 font-medium",
168
+ children: 1 === validationResult.errors.length ? "/" === validationResult.errors[0].path ? t.validatorErrorInvalidSyntax : t.validatorErrorSchemaValidation : formatTranslation(t.validatorErrorCount, {
169
+ count: validationResult.errors.length
170
+ })
171
+ })
172
+ ]
173
+ })
174
+ }),
175
+ !validationResult.valid && validationResult.errors && validationResult.errors.length > 0 && /*#__PURE__*/ jsxs("div", {
176
+ className: "mt-3 max-h-[200px] overflow-y-auto",
177
+ children: [
178
+ validationResult.errors[0] && /*#__PURE__*/ jsxs("div", {
179
+ className: "flex items-center justify-between mb-2",
180
+ children: [
181
+ /*#__PURE__*/ jsx("span", {
182
+ className: "text-sm font-medium text-red-700",
183
+ children: "/" === validationResult.errors[0].path ? t.validatorErrorPathRoot : validationResult.errors[0].path
184
+ }),
185
+ validationResult.errors[0].line && /*#__PURE__*/ jsx("span", {
186
+ className: "text-xs bg-gray-100 px-2 py-1 rounded text-gray-600",
187
+ children: validationResult.errors[0].column ? formatTranslation(t.validatorErrorLocationLineAndColumn, {
188
+ line: validationResult.errors[0].line,
189
+ column: validationResult.errors[0].column
190
+ }) : formatTranslation(t.validatorErrorLocationLineOnly, {
191
+ line: validationResult.errors[0].line
192
+ })
193
+ })
194
+ ]
195
+ }),
196
+ /*#__PURE__*/ jsx("ul", {
197
+ className: "space-y-2",
198
+ children: validationResult.errors.map((error, index)=>/*#__PURE__*/ jsx("button", {
199
+ type: "button",
200
+ className: "w-full text-left bg-white border border-red-100 rounded-md p-3 shadow-xs hover:shadow-md transition-shadow duration-200 cursor-pointer",
201
+ onClick: ()=>error.line && error.column && goToError(error.line, error.column),
202
+ children: /*#__PURE__*/ jsxs("div", {
203
+ className: "flex items-start justify-between",
204
+ children: [
205
+ /*#__PURE__*/ jsxs("div", {
206
+ className: "flex-1",
207
+ children: [
208
+ /*#__PURE__*/ jsx("p", {
209
+ className: "text-sm font-medium text-red-700",
210
+ children: "/" === error.path ? t.validatorErrorPathRoot : error.path
211
+ }),
212
+ /*#__PURE__*/ jsx("p", {
213
+ className: "text-sm text-gray-600 mt-1",
214
+ children: error.message
215
+ })
216
+ ]
217
+ }),
218
+ error.line && /*#__PURE__*/ jsx("div", {
219
+ className: "text-xs bg-gray-100 px-2 py-1 rounded text-gray-600",
220
+ children: error.column ? formatTranslation(t.validatorErrorLocationLineAndColumn, {
221
+ line: error.line,
222
+ column: error.column
223
+ }) : formatTranslation(t.validatorErrorLocationLineOnly, {
224
+ line: error.line
225
+ })
226
+ })
227
+ ]
228
+ })
229
+ }, `error-${error.path}-${index}`))
230
+ })
231
+ ]
232
+ })
233
+ ]
234
+ })
235
+ ]
236
+ })
237
+ });
238
+ }
239
+ export { JsonValidator };
@@ -0,0 +1,107 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import react from "@monaco-editor/react";
3
+ import { Loader2 } from "lucide-react";
4
+ import { useRef, useState } from "react";
5
+ import { Button } from "../ui/button.js";
6
+ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "../ui/dialog.js";
7
+ import { useMonacoTheme } from "../../hooks/use-monaco-theme.js";
8
+ import { useTranslation } from "../../hooks/use-translation.js";
9
+ import { createSchemaFromJson } from "../../lib/schema-inference.js";
10
+ function SchemaInferencer({ open, onOpenChange, onSchemaInferred }) {
11
+ const t = useTranslation();
12
+ const [jsonInput, setJsonInput] = useState("");
13
+ const [error, setError] = useState(null);
14
+ const editorRef = useRef(null);
15
+ const { currentTheme, defineMonacoThemes, configureJsonDefaults, defaultEditorOptions } = useMonacoTheme();
16
+ const handleBeforeMount = (monaco)=>{
17
+ defineMonacoThemes(monaco);
18
+ configureJsonDefaults(monaco);
19
+ };
20
+ const handleEditorDidMount = (editor)=>{
21
+ editorRef.current = editor;
22
+ editor.focus();
23
+ };
24
+ const handleEditorChange = (value)=>{
25
+ setJsonInput(value || "");
26
+ };
27
+ const inferSchemaFromJson = ()=>{
28
+ try {
29
+ const jsonObject = JSON.parse(jsonInput);
30
+ setError(null);
31
+ const inferredSchema = createSchemaFromJson(jsonObject);
32
+ onSchemaInferred(inferredSchema);
33
+ onOpenChange(false);
34
+ } catch (error) {
35
+ console.error("Invalid JSON input:", error);
36
+ setError(t.inferrerErrorInvalidJson);
37
+ }
38
+ };
39
+ const handleClose = ()=>{
40
+ setJsonInput("");
41
+ setError(null);
42
+ onOpenChange(false);
43
+ };
44
+ return /*#__PURE__*/ jsx(Dialog, {
45
+ open: open,
46
+ onOpenChange: onOpenChange,
47
+ children: /*#__PURE__*/ jsxs(DialogContent, {
48
+ className: "sm:max-w-4xl max-h-[90vh] flex flex-col jsonjoy",
49
+ children: [
50
+ /*#__PURE__*/ jsxs(DialogHeader, {
51
+ children: [
52
+ /*#__PURE__*/ jsx(DialogTitle, {
53
+ children: t.inferrerTitle
54
+ }),
55
+ /*#__PURE__*/ jsx(DialogDescription, {
56
+ children: t.inferrerDescription
57
+ })
58
+ ]
59
+ }),
60
+ /*#__PURE__*/ jsxs("div", {
61
+ className: "flex-1 min-h-0 py-4 flex flex-col",
62
+ children: [
63
+ /*#__PURE__*/ jsx("div", {
64
+ className: "border rounded-md flex-1 overflow-hidden h-full",
65
+ children: /*#__PURE__*/ jsx(react, {
66
+ height: "450px",
67
+ defaultLanguage: "json",
68
+ value: jsonInput,
69
+ onChange: handleEditorChange,
70
+ beforeMount: handleBeforeMount,
71
+ onMount: handleEditorDidMount,
72
+ options: defaultEditorOptions,
73
+ theme: currentTheme,
74
+ loading: /*#__PURE__*/ jsx("div", {
75
+ className: "flex items-center justify-center h-full w-full bg-secondary/30",
76
+ children: /*#__PURE__*/ jsx(Loader2, {
77
+ className: "h-6 w-6 animate-spin"
78
+ })
79
+ })
80
+ })
81
+ }),
82
+ error && /*#__PURE__*/ jsx("p", {
83
+ className: "text-sm text-destructive mt-2",
84
+ children: error
85
+ })
86
+ ]
87
+ }),
88
+ /*#__PURE__*/ jsxs(DialogFooter, {
89
+ children: [
90
+ /*#__PURE__*/ jsx(Button, {
91
+ type: "button",
92
+ variant: "outline",
93
+ onClick: handleClose,
94
+ children: t.inferrerCancel
95
+ }),
96
+ /*#__PURE__*/ jsx(Button, {
97
+ type: "button",
98
+ onClick: inferSchemaFromJson,
99
+ children: t.inferrerGenerate
100
+ })
101
+ ]
102
+ })
103
+ ]
104
+ })
105
+ });
106
+ }
107
+ export { SchemaInferencer };
@@ -0,0 +1,25 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
3
+ import { cn } from "../../lib/utils.js";
4
+ const badgeVariants = cva("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2", {
5
+ variants: {
6
+ variant: {
7
+ default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
8
+ secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
9
+ destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
10
+ outline: "text-foreground"
11
+ }
12
+ },
13
+ defaultVariants: {
14
+ variant: "default"
15
+ }
16
+ });
17
+ function Badge({ className, variant, ...props }) {
18
+ return /*#__PURE__*/ jsx("div", {
19
+ className: cn(badgeVariants({
20
+ variant
21
+ }), className),
22
+ ...props
23
+ });
24
+ }
25
+ export { Badge, badgeVariants };
@@ -0,0 +1,41 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { cva } from "class-variance-authority";
4
+ import { forwardRef } from "react";
5
+ import { cn } from "../../lib/utils.js";
6
+ const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
7
+ variants: {
8
+ variant: {
9
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
10
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
11
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
12
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
13
+ ghost: "hover:bg-accent hover:text-accent-foreground",
14
+ link: "text-primary underline-offset-4 hover:underline"
15
+ },
16
+ size: {
17
+ default: "h-10 px-4 py-2",
18
+ sm: "h-9 rounded-md px-3",
19
+ lg: "h-11 rounded-md px-8",
20
+ icon: "h-10 w-10"
21
+ }
22
+ },
23
+ defaultVariants: {
24
+ variant: "default",
25
+ size: "default"
26
+ }
27
+ });
28
+ const Button = /*#__PURE__*/ forwardRef(({ className, variant, size, asChild = false, ...props }, ref)=>{
29
+ const Comp = asChild ? Slot : "button";
30
+ return /*#__PURE__*/ jsx(Comp, {
31
+ className: cn(buttonVariants({
32
+ variant,
33
+ size,
34
+ className
35
+ })),
36
+ ref: ref,
37
+ ...props
38
+ });
39
+ });
40
+ Button.displayName = "Button";
41
+ export { Button, buttonVariants };
@@ -0,0 +1,73 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Close, Content, Description, Overlay, Portal, Root, Title, Trigger } from "@radix-ui/react-dialog";
3
+ import { X } from "lucide-react";
4
+ import { forwardRef, useId } from "react";
5
+ import { cn } from "../../lib/utils.js";
6
+ const Dialog = Root;
7
+ const DialogTrigger = Trigger;
8
+ const DialogPortal = Portal;
9
+ const DialogClose = Close;
10
+ const DialogOverlay = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Overlay, {
11
+ ref: ref,
12
+ className: cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 jsonjoy", className),
13
+ ...props
14
+ }));
15
+ DialogOverlay.displayName = Overlay.displayName;
16
+ const DialogContent = /*#__PURE__*/ forwardRef(({ className, children, ...props }, ref)=>{
17
+ const dialogDescriptionId = useId();
18
+ return /*#__PURE__*/ jsxs(DialogPortal, {
19
+ children: [
20
+ /*#__PURE__*/ jsx(DialogOverlay, {}),
21
+ /*#__PURE__*/ jsxs(Content, {
22
+ ref: ref,
23
+ className: cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg", className),
24
+ "aria-describedby": dialogDescriptionId,
25
+ ...props,
26
+ children: [
27
+ children,
28
+ /*#__PURE__*/ jsx(Description, {
29
+ id: dialogDescriptionId,
30
+ className: "sr-only",
31
+ children: "Dialog content"
32
+ }),
33
+ /*#__PURE__*/ jsxs(Close, {
34
+ className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
35
+ children: [
36
+ /*#__PURE__*/ jsx(X, {
37
+ className: "h-4 w-4"
38
+ }),
39
+ /*#__PURE__*/ jsx("span", {
40
+ className: "sr-only",
41
+ children: "Close"
42
+ })
43
+ ]
44
+ })
45
+ ]
46
+ })
47
+ ]
48
+ });
49
+ });
50
+ DialogContent.displayName = Content.displayName;
51
+ const DialogHeader = ({ className, ...props })=>/*#__PURE__*/ jsx("div", {
52
+ className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className),
53
+ ...props
54
+ });
55
+ DialogHeader.displayName = "DialogHeader";
56
+ const DialogFooter = ({ className, ...props })=>/*#__PURE__*/ jsx("div", {
57
+ className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
58
+ ...props
59
+ });
60
+ DialogFooter.displayName = "DialogFooter";
61
+ const DialogTitle = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Title, {
62
+ ref: ref,
63
+ className: cn("text-lg font-semibold leading-none tracking-tight", className),
64
+ ...props
65
+ }));
66
+ DialogTitle.displayName = Title.displayName;
67
+ const DialogDescription = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Description, {
68
+ ref: ref,
69
+ className: cn("text-sm text-muted-foreground", className),
70
+ ...props
71
+ }));
72
+ DialogDescription.displayName = Description.displayName;
73
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
@@ -0,0 +1,11 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { cn } from "../../lib/utils.js";
4
+ const Input = /*#__PURE__*/ forwardRef(({ className, type, ...props }, ref)=>/*#__PURE__*/ jsx("input", {
5
+ type: type,
6
+ className: cn("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", className),
7
+ ref: ref,
8
+ ...props
9
+ }));
10
+ Input.displayName = "Input";
11
+ export { Input };
@@ -0,0 +1,13 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Root } from "@radix-ui/react-label";
3
+ import { cva } from "class-variance-authority";
4
+ import { forwardRef } from "react";
5
+ import { cn } from "../../lib/utils.js";
6
+ const labelVariants = cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
7
+ const Label = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Root, {
8
+ ref: ref,
9
+ className: cn(labelVariants(), className),
10
+ ...props
11
+ }));
12
+ Label.displayName = Root.displayName;
13
+ export { Label };
@@ -0,0 +1,90 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Content, Group, Icon, Item, ItemIndicator, ItemText, Label, Portal, Root, ScrollDownButton, ScrollUpButton, Separator, Trigger, Value, Viewport } from "@radix-ui/react-select";
3
+ import { Check, ChevronDown, ChevronUp } from "lucide-react";
4
+ import { forwardRef } from "react";
5
+ import { cn } from "../../lib/utils.js";
6
+ const Select = Root;
7
+ const SelectGroup = Group;
8
+ const SelectValue = Value;
9
+ const SelectTrigger = /*#__PURE__*/ forwardRef(({ className, children, ...props }, ref)=>/*#__PURE__*/ jsxs(Trigger, {
10
+ ref: ref,
11
+ className: cn("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className),
12
+ ...props,
13
+ children: [
14
+ children,
15
+ /*#__PURE__*/ jsx(Icon, {
16
+ asChild: true,
17
+ children: /*#__PURE__*/ jsx(ChevronDown, {
18
+ className: "h-4 w-4 opacity-50"
19
+ })
20
+ })
21
+ ]
22
+ }));
23
+ SelectTrigger.displayName = Trigger.displayName;
24
+ const SelectScrollUpButton = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ScrollUpButton, {
25
+ ref: ref,
26
+ className: cn("flex cursor-default items-center justify-center py-1", className),
27
+ ...props,
28
+ children: /*#__PURE__*/ jsx(ChevronUp, {
29
+ className: "h-4 w-4"
30
+ })
31
+ }));
32
+ SelectScrollUpButton.displayName = ScrollUpButton.displayName;
33
+ const SelectScrollDownButton = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ScrollDownButton, {
34
+ ref: ref,
35
+ className: cn("flex cursor-default items-center justify-center py-1", className),
36
+ ...props,
37
+ children: /*#__PURE__*/ jsx(ChevronDown, {
38
+ className: "h-4 w-4"
39
+ })
40
+ }));
41
+ SelectScrollDownButton.displayName = ScrollDownButton.displayName;
42
+ const SelectContent = /*#__PURE__*/ forwardRef(({ className, children, position = "popper", ...props }, ref)=>/*#__PURE__*/ jsx(Portal, {
43
+ children: /*#__PURE__*/ jsxs(Content, {
44
+ ref: ref,
45
+ className: cn("relative z-50 max-h-96 min-w-32 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]: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", "popper" === position && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className, "jsonjoy"),
46
+ position: position,
47
+ ...props,
48
+ children: [
49
+ /*#__PURE__*/ jsx(SelectScrollUpButton, {}),
50
+ /*#__PURE__*/ jsx(Viewport, {
51
+ className: cn("p-1", "popper" === position && "h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)"),
52
+ children: children
53
+ }),
54
+ /*#__PURE__*/ jsx(SelectScrollDownButton, {})
55
+ ]
56
+ })
57
+ }));
58
+ SelectContent.displayName = Content.displayName;
59
+ const SelectLabel = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Label, {
60
+ ref: ref,
61
+ className: cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className),
62
+ ...props
63
+ }));
64
+ SelectLabel.displayName = Label.displayName;
65
+ const SelectItem = /*#__PURE__*/ forwardRef(({ className, children, ...props }, ref)=>/*#__PURE__*/ jsxs(Item, {
66
+ ref: ref,
67
+ className: cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50", className),
68
+ ...props,
69
+ children: [
70
+ /*#__PURE__*/ jsx("span", {
71
+ className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
72
+ children: /*#__PURE__*/ jsx(ItemIndicator, {
73
+ children: /*#__PURE__*/ jsx(Check, {
74
+ className: "h-4 w-4"
75
+ })
76
+ })
77
+ }),
78
+ /*#__PURE__*/ jsx(ItemText, {
79
+ children: children
80
+ })
81
+ ]
82
+ }));
83
+ SelectItem.displayName = Item.displayName;
84
+ const SelectSeparator = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Separator, {
85
+ ref: ref,
86
+ className: cn("-mx-1 my-1 h-px bg-muted", className),
87
+ ...props
88
+ }));
89
+ SelectSeparator.displayName = Separator.displayName;
90
+ export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue };
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Root, Thumb } from "@radix-ui/react-switch";
3
+ import { forwardRef } from "react";
4
+ import { cn } from "../../lib/utils.js";
5
+ const Switch = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Root, {
6
+ className: cn("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", className),
7
+ ...props,
8
+ ref: ref,
9
+ children: /*#__PURE__*/ jsx(Thumb, {
10
+ className: cn("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")
11
+ })
12
+ }));
13
+ Switch.displayName = Root.displayName;
14
+ export { Switch };
@@ -0,0 +1,24 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Content, List, Root, Trigger } from "@radix-ui/react-tabs";
3
+ import { forwardRef } from "react";
4
+ import { cn } from "../../lib/utils.js";
5
+ const Tabs = Root;
6
+ const TabsList = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(List, {
7
+ ref: ref,
8
+ className: cn("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground", className),
9
+ ...props
10
+ }));
11
+ TabsList.displayName = List.displayName;
12
+ const TabsTrigger = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Trigger, {
13
+ ref: ref,
14
+ className: cn("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs", className),
15
+ ...props
16
+ }));
17
+ TabsTrigger.displayName = Trigger.displayName;
18
+ const TabsContent = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Content, {
19
+ ref: ref,
20
+ className: cn("mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", className),
21
+ ...props
22
+ }));
23
+ TabsContent.displayName = Content.displayName;
24
+ export { Tabs, TabsContent, TabsList, TabsTrigger };