pxengine 0.1.12 → 0.1.13
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/dist/registry.json +1 -1
- package/package.json +2 -4
- package/config/tailwind-preset.js +0 -106
- package/src/atoms/AccordionAtom.tsx +0 -44
- package/src/atoms/AlertAtom.tsx +0 -48
- package/src/atoms/AlertDialogAtom.tsx +0 -66
- package/src/atoms/AspectRatioAtom.tsx +0 -27
- package/src/atoms/AvatarAtom.tsx +0 -21
- package/src/atoms/BadgeAtom.tsx +0 -35
- package/src/atoms/BreadcrumbAtom.tsx +0 -36
- package/src/atoms/ButtonAtom.tsx +0 -65
- package/src/atoms/CalendarAtom.tsx +0 -24
- package/src/atoms/CardAtom.tsx +0 -66
- package/src/atoms/CarouselAtom.tsx +0 -40
- package/src/atoms/ChartAtom.tsx +0 -192
- package/src/atoms/CheckboxAtom.tsx +0 -33
- package/src/atoms/CollapsibleAtom.tsx +0 -44
- package/src/atoms/CommandAtom.tsx +0 -46
- package/src/atoms/ContextMenuAtom.tsx +0 -49
- package/src/atoms/DialogAtom.tsx +0 -68
- package/src/atoms/DrawerAtom.tsx +0 -49
- package/src/atoms/DropdownMenuAtom.tsx +0 -49
- package/src/atoms/FormInputAtom.tsx +0 -101
- package/src/atoms/FormSelectAtom.tsx +0 -110
- package/src/atoms/FormTextareaAtom.tsx +0 -93
- package/src/atoms/InputAtom.tsx +0 -216
- package/src/atoms/InputOTPAtom.tsx +0 -49
- package/src/atoms/KbdAtom.tsx +0 -25
- package/src/atoms/LabelAtom.tsx +0 -23
- package/src/atoms/LayoutAtom.tsx +0 -45
- package/src/atoms/PaginationAtom.tsx +0 -49
- package/src/atoms/PopoverAtom.tsx +0 -40
- package/src/atoms/ProgressAtom.tsx +0 -15
- package/src/atoms/RadioGroupAtom.tsx +0 -31
- package/src/atoms/RatingAtom.tsx +0 -37
- package/src/atoms/ResizableAtom.tsx +0 -51
- package/src/atoms/ScrollAreaAtom.tsx +0 -31
- package/src/atoms/SeparatorAtom.tsx +0 -16
- package/src/atoms/SheetAtom.tsx +0 -72
- package/src/atoms/SkeletonAtom.tsx +0 -22
- package/src/atoms/SliderAtom.tsx +0 -32
- package/src/atoms/SpinnerAtom.tsx +0 -26
- package/src/atoms/SwitchAtom.tsx +0 -32
- package/src/atoms/TableAtom.tsx +0 -60
- package/src/atoms/TabsAtom.tsx +0 -40
- package/src/atoms/TextAtom.tsx +0 -36
- package/src/atoms/TextareaAtom.tsx +0 -42
- package/src/atoms/TimelineAtom.tsx +0 -77
- package/src/atoms/ToggleAtom.tsx +0 -36
- package/src/atoms/TooltipAtom.tsx +0 -39
- package/src/atoms/VideoAtom.tsx +0 -34
- package/src/atoms/index.ts +0 -49
- package/src/components/index.ts +0 -178
- package/src/components/ui/accordion.tsx +0 -56
- package/src/components/ui/alert-dialog.tsx +0 -139
- package/src/components/ui/alert.tsx +0 -59
- package/src/components/ui/aspect-ratio.tsx +0 -5
- package/src/components/ui/avatar.tsx +0 -50
- package/src/components/ui/badge.tsx +0 -36
- package/src/components/ui/breadcrumb.tsx +0 -115
- package/src/components/ui/button-group.tsx +0 -83
- package/src/components/ui/button.tsx +0 -56
- package/src/components/ui/calendar.tsx +0 -213
- package/src/components/ui/card.tsx +0 -79
- package/src/components/ui/carousel.tsx +0 -260
- package/src/components/ui/chart.tsx +0 -367
- package/src/components/ui/checkbox.tsx +0 -28
- package/src/components/ui/collapsible.tsx +0 -11
- package/src/components/ui/command.tsx +0 -153
- package/src/components/ui/context-menu.tsx +0 -198
- package/src/components/ui/dialog.tsx +0 -122
- package/src/components/ui/drawer.tsx +0 -116
- package/src/components/ui/dropdown-menu.tsx +0 -200
- package/src/components/ui/empty.tsx +0 -104
- package/src/components/ui/field.tsx +0 -244
- package/src/components/ui/form.tsx +0 -176
- package/src/components/ui/hover-card.tsx +0 -27
- package/src/components/ui/index.ts +0 -54
- package/src/components/ui/input-group.tsx +0 -168
- package/src/components/ui/input-otp.tsx +0 -69
- package/src/components/ui/input.tsx +0 -22
- package/src/components/ui/item.tsx +0 -193
- package/src/components/ui/kbd.tsx +0 -28
- package/src/components/ui/label.tsx +0 -26
- package/src/components/ui/menubar.tsx +0 -254
- package/src/components/ui/navigation-menu.tsx +0 -128
- package/src/components/ui/pagination.tsx +0 -117
- package/src/components/ui/popover.tsx +0 -29
- package/src/components/ui/progress.tsx +0 -28
- package/src/components/ui/radio-group.tsx +0 -42
- package/src/components/ui/resizable.tsx +0 -44
- package/src/components/ui/scroll-area.tsx +0 -46
- package/src/components/ui/select.tsx +0 -160
- package/src/components/ui/separator.tsx +0 -29
- package/src/components/ui/sheet.tsx +0 -140
- package/src/components/ui/sidebar.tsx +0 -771
- package/src/components/ui/skeleton.tsx +0 -15
- package/src/components/ui/slider.tsx +0 -26
- package/src/components/ui/sonner.tsx +0 -45
- package/src/components/ui/spinner.tsx +0 -16
- package/src/components/ui/switch.tsx +0 -27
- package/src/components/ui/table.tsx +0 -117
- package/src/components/ui/tabs.tsx +0 -53
- package/src/components/ui/textarea.tsx +0 -22
- package/src/components/ui/toggle-group.tsx +0 -61
- package/src/components/ui/toggle.tsx +0 -43
- package/src/components/ui/tooltip.tsx +0 -30
- package/src/hooks/use-mobile.tsx +0 -19
- package/src/index.ts +0 -24
- package/src/lib/countries.ts +0 -203
- package/src/lib/index.ts +0 -2
- package/src/lib/utils.ts +0 -15
- package/src/lib/validators/index.ts +0 -1
- package/src/lib/validators/theme.ts +0 -148
- package/src/molecules/creator-discovery/AudienceDemographicsCard/AudienceDemographicsCard.tsx +0 -44
- package/src/molecules/creator-discovery/AudienceDemographicsCard/index.ts +0 -1
- package/src/molecules/creator-discovery/AudienceMetricCard/AudienceMetricCard.tsx +0 -50
- package/src/molecules/creator-discovery/AudienceMetricCard/index.ts +0 -1
- package/src/molecules/creator-discovery/BrandAffinityGroup/BrandAffinityGroup.tsx +0 -36
- package/src/molecules/creator-discovery/BrandAffinityGroup/index.ts +0 -1
- package/src/molecules/creator-discovery/CampaignSeedCard/CampaignSeedCard.tsx +0 -123
- package/src/molecules/creator-discovery/CampaignSeedCard/CampaignSeedCard.types.ts +0 -13
- package/src/molecules/creator-discovery/CampaignSeedCard/index.ts +0 -2
- package/src/molecules/creator-discovery/ContentPreviewGallery/ContentPreviewGallery.tsx +0 -41
- package/src/molecules/creator-discovery/ContentPreviewGallery/index.ts +0 -1
- package/src/molecules/creator-discovery/CreatorActionHeader/CreatorActionHeader.tsx +0 -77
- package/src/molecules/creator-discovery/CreatorActionHeader/index.ts +0 -1
- package/src/molecules/creator-discovery/CreatorGridCard/CreatorGridCard.tsx +0 -104
- package/src/molecules/creator-discovery/CreatorGridCard/index.ts +0 -1
- package/src/molecules/creator-discovery/CreatorProfileSummary/CreatorProfileSummary.tsx +0 -65
- package/src/molecules/creator-discovery/CreatorProfileSummary/index.ts +0 -1
- package/src/molecules/creator-discovery/GrowthChartCard/GrowthChartCard.tsx +0 -58
- package/src/molecules/creator-discovery/GrowthChartCard/index.ts +0 -1
- package/src/molecules/creator-discovery/MCQCard/MCQCard.tsx +0 -165
- package/src/molecules/creator-discovery/MCQCard/MCQCard.types.ts +0 -71
- package/src/molecules/creator-discovery/MCQCard/index.ts +0 -2
- package/src/molecules/creator-discovery/PlatformIconGroup/PlatformIconGroup.tsx +0 -72
- package/src/molecules/creator-discovery/PlatformIconGroup/index.ts +0 -1
- package/src/molecules/creator-discovery/SearchSpecCard/CustomFieldRenderers.tsx +0 -334
- package/src/molecules/creator-discovery/SearchSpecCard/SearchSpecCard.tsx +0 -111
- package/src/molecules/creator-discovery/SearchSpecCard/SearchSpecCard.types.ts +0 -18
- package/src/molecules/creator-discovery/SearchSpecCard/index.ts +0 -3
- package/src/molecules/creator-discovery/TopPostsGrid/TopPostsGrid.tsx +0 -49
- package/src/molecules/creator-discovery/TopPostsGrid/index.ts +0 -1
- package/src/molecules/creator-discovery/index.ts +0 -13
- package/src/molecules/generic/ActionButton/ActionButton.tsx +0 -137
- package/src/molecules/generic/ActionButton/ActionButton.types.ts +0 -68
- package/src/molecules/generic/ActionButton/index.ts +0 -2
- package/src/molecules/generic/DataGrid/DataGrid.tsx +0 -102
- package/src/molecules/generic/DataGrid/index.ts +0 -1
- package/src/molecules/generic/EditableField/EditableField.tsx +0 -229
- package/src/molecules/generic/EditableField/EditableField.types.ts +0 -73
- package/src/molecules/generic/EditableField/index.ts +0 -2
- package/src/molecules/generic/EmptyState/EmptyState.tsx +0 -61
- package/src/molecules/generic/EmptyState/index.ts +0 -1
- package/src/molecules/generic/FileUpload/FileUpload.tsx +0 -62
- package/src/molecules/generic/FileUpload/index.ts +0 -1
- package/src/molecules/generic/FilterBar/FilterBar.tsx +0 -54
- package/src/molecules/generic/FilterBar/index.ts +0 -1
- package/src/molecules/generic/FormCard/FormCard.tsx +0 -136
- package/src/molecules/generic/FormCard/FormCard.types.ts +0 -93
- package/src/molecules/generic/FormCard/index.ts +0 -2
- package/src/molecules/generic/LoadingOverlay/LoadingOverlay.tsx +0 -39
- package/src/molecules/generic/LoadingOverlay/index.ts +0 -1
- package/src/molecules/generic/NotificationList/NotificationList.tsx +0 -80
- package/src/molecules/generic/NotificationList/index.ts +0 -1
- package/src/molecules/generic/StatsGrid/StatsGrid.tsx +0 -80
- package/src/molecules/generic/StatsGrid/index.ts +0 -1
- package/src/molecules/generic/StepWizard/StepWizard.tsx +0 -67
- package/src/molecules/generic/StepWizard/index.ts +0 -1
- package/src/molecules/generic/TagCloud/TagCloud.tsx +0 -32
- package/src/molecules/generic/TagCloud/index.ts +0 -1
- package/src/molecules/generic/index.ts +0 -12
- package/src/molecules/index.ts +0 -2
- package/src/render/PXEngineRenderer.tsx +0 -458
- package/src/render/index.ts +0 -1
- package/src/styles/globals.css +0 -146
- package/src/types/atoms.ts +0 -450
- package/src/types/common.ts +0 -116
- package/src/types/index.ts +0 -3
- package/src/types/molecules.ts +0 -279
- package/src/types/schema.ts +0 -12
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
Form,
|
|
4
|
-
FormField,
|
|
5
|
-
FormItem,
|
|
6
|
-
FormLabel,
|
|
7
|
-
FormControl,
|
|
8
|
-
FormDescription,
|
|
9
|
-
FormMessage,
|
|
10
|
-
} from "@/components/ui/form";
|
|
11
|
-
import {
|
|
12
|
-
Select,
|
|
13
|
-
SelectContent,
|
|
14
|
-
SelectItem,
|
|
15
|
-
SelectTrigger,
|
|
16
|
-
SelectValue,
|
|
17
|
-
} from "@/components/ui/select";
|
|
18
|
-
import { useForm } from "react-hook-form";
|
|
19
|
-
import { cn } from "@/lib/utils";
|
|
20
|
-
|
|
21
|
-
export interface SelectOption {
|
|
22
|
-
value: string;
|
|
23
|
-
label: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface FormSelectAtomType {
|
|
27
|
-
type: "FormSelect";
|
|
28
|
-
name: string;
|
|
29
|
-
label?: string;
|
|
30
|
-
placeholder?: string;
|
|
31
|
-
description?: string;
|
|
32
|
-
defaultValue?: string;
|
|
33
|
-
required?: boolean;
|
|
34
|
-
options: SelectOption[];
|
|
35
|
-
className?: string;
|
|
36
|
-
id?: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
interface FormSelectAtomProps extends Omit<FormSelectAtomType, "type"> {
|
|
40
|
-
renderComponent?: any;
|
|
41
|
-
children?: any;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* FormSelectAtom
|
|
46
|
-
*
|
|
47
|
-
* Self-contained form select component that properly wraps FormField, FormItem, FormLabel, FormControl, and Select.
|
|
48
|
-
* This component provides the necessary React Context for both form and select components to work correctly.
|
|
49
|
-
*
|
|
50
|
-
* Features:
|
|
51
|
-
* - Handles all form and select context requirements internally
|
|
52
|
-
* - Supports dynamic options list
|
|
53
|
-
* - Includes validation support through react-hook-form
|
|
54
|
-
* - Schema-safe for dynamic rendering via PXEngineRenderer
|
|
55
|
-
*/
|
|
56
|
-
export const FormSelectAtom: React.FC<FormSelectAtomProps> = ({
|
|
57
|
-
name,
|
|
58
|
-
label,
|
|
59
|
-
placeholder = "Select an option",
|
|
60
|
-
description,
|
|
61
|
-
defaultValue = "",
|
|
62
|
-
required = false,
|
|
63
|
-
options = [],
|
|
64
|
-
className,
|
|
65
|
-
id,
|
|
66
|
-
}) => {
|
|
67
|
-
// Safe fallback for name to prevent RHF crash
|
|
68
|
-
const fieldName =
|
|
69
|
-
name || id || `select-${Math.random().toString(36).substring(2, 9)}`;
|
|
70
|
-
|
|
71
|
-
// Create a local form context for this field
|
|
72
|
-
const form = useForm({
|
|
73
|
-
defaultValues: {
|
|
74
|
-
[fieldName]: defaultValue,
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<Form {...form}>
|
|
80
|
-
<FormField
|
|
81
|
-
control={form.control}
|
|
82
|
-
name={fieldName}
|
|
83
|
-
rules={{
|
|
84
|
-
required: required ? `${label || name} is required` : undefined,
|
|
85
|
-
}}
|
|
86
|
-
render={({ field }) => (
|
|
87
|
-
<FormItem className={cn("w-full", className)}>
|
|
88
|
-
{label && <FormLabel>{label}</FormLabel>}
|
|
89
|
-
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
|
90
|
-
<FormControl>
|
|
91
|
-
<SelectTrigger id={id || `form-select-${fieldName}`}>
|
|
92
|
-
<SelectValue placeholder={placeholder} />
|
|
93
|
-
</SelectTrigger>
|
|
94
|
-
</FormControl>
|
|
95
|
-
<SelectContent>
|
|
96
|
-
{options.map((option) => (
|
|
97
|
-
<SelectItem key={option.value} value={option.value}>
|
|
98
|
-
{option.label}
|
|
99
|
-
</SelectItem>
|
|
100
|
-
))}
|
|
101
|
-
</SelectContent>
|
|
102
|
-
</Select>
|
|
103
|
-
{description && <FormDescription>{description}</FormDescription>}
|
|
104
|
-
<FormMessage />
|
|
105
|
-
</FormItem>
|
|
106
|
-
)}
|
|
107
|
-
/>
|
|
108
|
-
</Form>
|
|
109
|
-
);
|
|
110
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
Form,
|
|
4
|
-
FormField,
|
|
5
|
-
FormItem,
|
|
6
|
-
FormLabel,
|
|
7
|
-
FormControl,
|
|
8
|
-
FormDescription,
|
|
9
|
-
FormMessage,
|
|
10
|
-
} from "@/components/ui/form";
|
|
11
|
-
import { Textarea } from "@/components/ui/textarea";
|
|
12
|
-
import { useForm } from "react-hook-form";
|
|
13
|
-
import { cn } from "@/lib/utils";
|
|
14
|
-
|
|
15
|
-
export interface FormTextareaAtomType {
|
|
16
|
-
type: "FormTextarea";
|
|
17
|
-
name: string;
|
|
18
|
-
label?: string;
|
|
19
|
-
placeholder?: string;
|
|
20
|
-
description?: string;
|
|
21
|
-
defaultValue?: string;
|
|
22
|
-
required?: boolean;
|
|
23
|
-
rows?: number;
|
|
24
|
-
className?: string;
|
|
25
|
-
id?: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface FormTextareaAtomProps extends Omit<FormTextareaAtomType, "type"> {
|
|
29
|
-
renderComponent?: any;
|
|
30
|
-
children?: any;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* FormTextareaAtom
|
|
35
|
-
*
|
|
36
|
-
* Self-contained form textarea component that properly wraps FormField, FormItem, FormLabel, and FormControl.
|
|
37
|
-
* This component provides the necessary React Context for form components to work correctly.
|
|
38
|
-
*
|
|
39
|
-
* Features:
|
|
40
|
-
* - Handles all form context requirements internally
|
|
41
|
-
* - Supports configurable rows
|
|
42
|
-
* - Includes validation support through react-hook-form
|
|
43
|
-
* - Schema-safe for dynamic rendering via PXEngineRenderer
|
|
44
|
-
*/
|
|
45
|
-
export const FormTextareaAtom: React.FC<FormTextareaAtomProps> = ({
|
|
46
|
-
name,
|
|
47
|
-
label,
|
|
48
|
-
placeholder,
|
|
49
|
-
description,
|
|
50
|
-
defaultValue = "",
|
|
51
|
-
required = false,
|
|
52
|
-
rows = 3,
|
|
53
|
-
className,
|
|
54
|
-
id,
|
|
55
|
-
}) => {
|
|
56
|
-
// Safe fallback for name to prevent RHF crash
|
|
57
|
-
const fieldName =
|
|
58
|
-
name || id || `textarea-${Math.random().toString(36).substring(2, 9)}`;
|
|
59
|
-
|
|
60
|
-
// Create a local form context for this field
|
|
61
|
-
const form = useForm({
|
|
62
|
-
defaultValues: {
|
|
63
|
-
[fieldName]: defaultValue,
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<Form {...form}>
|
|
69
|
-
<FormField
|
|
70
|
-
control={form.control}
|
|
71
|
-
name={fieldName}
|
|
72
|
-
rules={{
|
|
73
|
-
required: required ? `${label || name} is required` : undefined,
|
|
74
|
-
}}
|
|
75
|
-
render={({ field }) => (
|
|
76
|
-
<FormItem className={cn("w-full", className)}>
|
|
77
|
-
{label && <FormLabel>{label}</FormLabel>}
|
|
78
|
-
<FormControl>
|
|
79
|
-
<Textarea
|
|
80
|
-
placeholder={placeholder}
|
|
81
|
-
rows={rows}
|
|
82
|
-
id={id || `form-textarea-${fieldName}`}
|
|
83
|
-
{...field}
|
|
84
|
-
/>
|
|
85
|
-
</FormControl>
|
|
86
|
-
{description && <FormDescription>{description}</FormDescription>}
|
|
87
|
-
<FormMessage />
|
|
88
|
-
</FormItem>
|
|
89
|
-
)}
|
|
90
|
-
/>
|
|
91
|
-
</Form>
|
|
92
|
-
);
|
|
93
|
-
};
|
package/src/atoms/InputAtom.tsx
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Input } from "@/components/ui/input";
|
|
3
|
-
import { Textarea } from "@/components/ui/textarea";
|
|
4
|
-
import { Label } from "@/components/ui/label";
|
|
5
|
-
import { Checkbox } from "@/components/ui/checkbox";
|
|
6
|
-
import { Switch } from "@/components/ui/switch";
|
|
7
|
-
import {
|
|
8
|
-
Select,
|
|
9
|
-
SelectContent,
|
|
10
|
-
SelectItem,
|
|
11
|
-
SelectTrigger,
|
|
12
|
-
SelectValue,
|
|
13
|
-
} from "@/components/ui/select";
|
|
14
|
-
import { Slider } from "@/components/ui/slider";
|
|
15
|
-
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
|
16
|
-
import {
|
|
17
|
-
InputOTP,
|
|
18
|
-
InputOTPGroup,
|
|
19
|
-
InputOTPSlot,
|
|
20
|
-
} from "@/components/ui/input-otp";
|
|
21
|
-
import { InputAtomType } from "../types/schema";
|
|
22
|
-
import { cn } from "@/lib/utils";
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* InputAtom
|
|
26
|
-
* A multi-purpose input wrapper that switches based on inputType in schema
|
|
27
|
-
*/
|
|
28
|
-
export const InputAtom: React.FC<InputAtomType> = ({
|
|
29
|
-
inputType,
|
|
30
|
-
label,
|
|
31
|
-
placeholder,
|
|
32
|
-
defaultValue,
|
|
33
|
-
required,
|
|
34
|
-
disabled,
|
|
35
|
-
options,
|
|
36
|
-
config,
|
|
37
|
-
className,
|
|
38
|
-
style,
|
|
39
|
-
}) => {
|
|
40
|
-
const containerClass = cn("flex flex-col gap-2 w-full", className);
|
|
41
|
-
|
|
42
|
-
const renderLabel = () => {
|
|
43
|
-
if (!label) return null;
|
|
44
|
-
return (
|
|
45
|
-
<Label className="text-sm font-semibold text-foreground/80 pl-0.5">
|
|
46
|
-
{label} {required && <span className="text-destructive">*</span>}
|
|
47
|
-
</Label>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const renderInput = () => {
|
|
52
|
-
const commonProps = {
|
|
53
|
-
placeholder,
|
|
54
|
-
value: defaultValue,
|
|
55
|
-
disabled,
|
|
56
|
-
required,
|
|
57
|
-
readOnly: true,
|
|
58
|
-
className: cn(
|
|
59
|
-
"rounded-xl border-border bg-background focus:ring-primary shadow-sm",
|
|
60
|
-
className,
|
|
61
|
-
),
|
|
62
|
-
style,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
switch (inputType) {
|
|
66
|
-
case "textarea":
|
|
67
|
-
return <Textarea {...commonProps} rows={config?.rows || 3} />;
|
|
68
|
-
case "select":
|
|
69
|
-
return (
|
|
70
|
-
<Select value={defaultValue} disabled={disabled}>
|
|
71
|
-
<SelectTrigger
|
|
72
|
-
className={cn(
|
|
73
|
-
"rounded-xl border-border bg-background shadow-sm",
|
|
74
|
-
className,
|
|
75
|
-
)}
|
|
76
|
-
style={style}
|
|
77
|
-
>
|
|
78
|
-
<SelectValue placeholder={placeholder || "Select option"} />
|
|
79
|
-
</SelectTrigger>
|
|
80
|
-
<SelectContent className="rounded-xl border-border shadow-xl">
|
|
81
|
-
{options?.map((opt) => (
|
|
82
|
-
<SelectItem key={opt.value} value={opt.value}>
|
|
83
|
-
{opt.label}
|
|
84
|
-
</SelectItem>
|
|
85
|
-
))}
|
|
86
|
-
</SelectContent>
|
|
87
|
-
</Select>
|
|
88
|
-
);
|
|
89
|
-
case "slider":
|
|
90
|
-
return (
|
|
91
|
-
<div className="pt-2 pb-1" style={style}>
|
|
92
|
-
<Slider
|
|
93
|
-
value={[defaultValue || config?.min || 0]}
|
|
94
|
-
max={config?.max || 100}
|
|
95
|
-
min={config?.min || 0}
|
|
96
|
-
step={config?.step || 1}
|
|
97
|
-
disabled={disabled}
|
|
98
|
-
className={cn("py-4", className)}
|
|
99
|
-
/>
|
|
100
|
-
</div>
|
|
101
|
-
);
|
|
102
|
-
case "checkbox":
|
|
103
|
-
return (
|
|
104
|
-
<div
|
|
105
|
-
className={cn(
|
|
106
|
-
"flex items-center space-x-3 py-1.5 px-0.5 group cursor-pointer",
|
|
107
|
-
className,
|
|
108
|
-
)}
|
|
109
|
-
style={style}
|
|
110
|
-
>
|
|
111
|
-
<Checkbox
|
|
112
|
-
id={label}
|
|
113
|
-
checked={defaultValue}
|
|
114
|
-
disabled={disabled}
|
|
115
|
-
className="rounded-[6px] border-border data-[state=checked]:bg-primary shadow-sm"
|
|
116
|
-
/>
|
|
117
|
-
<label
|
|
118
|
-
htmlFor={label}
|
|
119
|
-
className="text-sm font-medium leading-none cursor-pointer text-foreground/90 group-hover:text-foreground transition-colors"
|
|
120
|
-
>
|
|
121
|
-
{label}
|
|
122
|
-
</label>
|
|
123
|
-
</div>
|
|
124
|
-
);
|
|
125
|
-
case "switch":
|
|
126
|
-
return (
|
|
127
|
-
<div
|
|
128
|
-
className={cn(
|
|
129
|
-
"flex items-center justify-between py-1.5 px-0.5",
|
|
130
|
-
className,
|
|
131
|
-
)}
|
|
132
|
-
style={style}
|
|
133
|
-
>
|
|
134
|
-
<Label
|
|
135
|
-
htmlFor={label}
|
|
136
|
-
className="cursor-pointer text-foreground/90"
|
|
137
|
-
>
|
|
138
|
-
{label}
|
|
139
|
-
</Label>
|
|
140
|
-
<Switch
|
|
141
|
-
id={label}
|
|
142
|
-
checked={defaultValue}
|
|
143
|
-
disabled={disabled}
|
|
144
|
-
className="data-[state=checked]:bg-primary shadow-sm"
|
|
145
|
-
/>
|
|
146
|
-
</div>
|
|
147
|
-
);
|
|
148
|
-
case "radio":
|
|
149
|
-
return (
|
|
150
|
-
<RadioGroup
|
|
151
|
-
value={defaultValue}
|
|
152
|
-
disabled={disabled}
|
|
153
|
-
className={cn("gap-2.5", className)}
|
|
154
|
-
style={style}
|
|
155
|
-
>
|
|
156
|
-
{options?.map((opt) => (
|
|
157
|
-
<div key={opt.value} className="flex items-center space-x-3">
|
|
158
|
-
<RadioGroupItem
|
|
159
|
-
value={opt.value}
|
|
160
|
-
id={`${label}-${opt.value}`}
|
|
161
|
-
className="border-border text-primary shadow-sm"
|
|
162
|
-
/>
|
|
163
|
-
<Label
|
|
164
|
-
htmlFor={`${label}-${opt.value}`}
|
|
165
|
-
className="cursor-pointer text-foreground/80 font-medium"
|
|
166
|
-
>
|
|
167
|
-
{opt.label}
|
|
168
|
-
</Label>
|
|
169
|
-
</div>
|
|
170
|
-
))}
|
|
171
|
-
</RadioGroup>
|
|
172
|
-
);
|
|
173
|
-
case "otp":
|
|
174
|
-
return (
|
|
175
|
-
<div
|
|
176
|
-
className={cn("flex justify-center py-2", className)}
|
|
177
|
-
style={style}
|
|
178
|
-
>
|
|
179
|
-
<InputOTP
|
|
180
|
-
maxLength={config?.maxLength || 6}
|
|
181
|
-
disabled={disabled}
|
|
182
|
-
value={defaultValue}
|
|
183
|
-
>
|
|
184
|
-
<InputOTPGroup className="gap-2">
|
|
185
|
-
{Array.from({ length: config?.maxLength || 6 }).map((_, i) => (
|
|
186
|
-
<InputOTPSlot
|
|
187
|
-
key={i}
|
|
188
|
-
index={i}
|
|
189
|
-
className="rounded-xl border border-border bg-background shadow-sm"
|
|
190
|
-
/>
|
|
191
|
-
))}
|
|
192
|
-
</InputOTPGroup>
|
|
193
|
-
</InputOTP>
|
|
194
|
-
</div>
|
|
195
|
-
);
|
|
196
|
-
default:
|
|
197
|
-
return (
|
|
198
|
-
<Input
|
|
199
|
-
{...commonProps}
|
|
200
|
-
type={inputType}
|
|
201
|
-
className={cn(
|
|
202
|
-
"rounded-xl border-border bg-background focus:ring-primary shadow-sm h-11",
|
|
203
|
-
className,
|
|
204
|
-
)}
|
|
205
|
-
/>
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
return (
|
|
211
|
-
<div className={containerClass} style={style}>
|
|
212
|
-
{inputType !== "checkbox" && inputType !== "switch" && renderLabel()}
|
|
213
|
-
{renderInput()}
|
|
214
|
-
</div>
|
|
215
|
-
);
|
|
216
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
InputOTP,
|
|
4
|
-
InputOTPGroup,
|
|
5
|
-
InputOTPSeparator,
|
|
6
|
-
InputOTPSlot,
|
|
7
|
-
} from "@/components/ui/input-otp";
|
|
8
|
-
import { InputOTPAtomType } from "../types/atoms";
|
|
9
|
-
import { cn } from "@/lib/utils";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* InputOTPAtom
|
|
13
|
-
* Wraps shadcn InputOTP for code verification
|
|
14
|
-
*/
|
|
15
|
-
export const InputOTPAtom: React.FC<
|
|
16
|
-
InputOTPAtomType & { onChange?: (val: string) => void }
|
|
17
|
-
> = ({ length, className, onChange }) => {
|
|
18
|
-
// Create slots based on length, split by optional separator if length > 4
|
|
19
|
-
const half = Math.floor(length / 2);
|
|
20
|
-
const slots = Array.from({ length }, (_, i) => i);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<InputOTP
|
|
24
|
-
maxLength={length}
|
|
25
|
-
onChange={onChange}
|
|
26
|
-
className={cn("gap-2", className)}
|
|
27
|
-
>
|
|
28
|
-
<InputOTPGroup>
|
|
29
|
-
{slots.slice(0, half).map((i) => (
|
|
30
|
-
<InputOTPSlot
|
|
31
|
-
key={i}
|
|
32
|
-
index={i}
|
|
33
|
-
className="border-purple-200 focus:ring-purple-500"
|
|
34
|
-
/>
|
|
35
|
-
))}
|
|
36
|
-
</InputOTPGroup>
|
|
37
|
-
{length > 4 && <InputOTPSeparator />}
|
|
38
|
-
<InputOTPGroup>
|
|
39
|
-
{slots.slice(half).map((i) => (
|
|
40
|
-
<InputOTPSlot
|
|
41
|
-
key={i}
|
|
42
|
-
index={i}
|
|
43
|
-
className="border-purple-200 focus:ring-purple-500"
|
|
44
|
-
/>
|
|
45
|
-
))}
|
|
46
|
-
</InputOTPGroup>
|
|
47
|
-
</InputOTP>
|
|
48
|
-
);
|
|
49
|
-
};
|
package/src/atoms/KbdAtom.tsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { KbdAtomType } from "../types/atoms";
|
|
3
|
-
import { cn } from "@/lib/utils";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* KbdAtom
|
|
7
|
-
* Visual representation of a keyboard shortcut
|
|
8
|
-
*/
|
|
9
|
-
export const KbdAtom: React.FC<KbdAtomType> = ({ keys, className }) => {
|
|
10
|
-
return (
|
|
11
|
-
<kbd
|
|
12
|
-
className={cn(
|
|
13
|
-
"pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100",
|
|
14
|
-
className,
|
|
15
|
-
)}
|
|
16
|
-
>
|
|
17
|
-
{keys.map((key, i) => (
|
|
18
|
-
<React.Fragment key={i}>
|
|
19
|
-
<span className="text-xs">{key}</span>
|
|
20
|
-
{i < keys.length - 1 && <span>+</span>}
|
|
21
|
-
</React.Fragment>
|
|
22
|
-
))}
|
|
23
|
-
</kbd>
|
|
24
|
-
);
|
|
25
|
-
};
|
package/src/atoms/LabelAtom.tsx
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Label } from "@/components/ui/label";
|
|
3
|
-
import { LabelAtomType } from "../types/atoms";
|
|
4
|
-
import { cn } from "@/lib/utils";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* LabelAtom
|
|
8
|
-
* Wraps shadcn Label
|
|
9
|
-
*/
|
|
10
|
-
export const LabelAtom: React.FC<LabelAtomType> = ({
|
|
11
|
-
content,
|
|
12
|
-
htmlFor,
|
|
13
|
-
className,
|
|
14
|
-
}) => {
|
|
15
|
-
return (
|
|
16
|
-
<Label
|
|
17
|
-
htmlFor={htmlFor}
|
|
18
|
-
className={cn("text-sm font-semibold text-gray-700", className)}
|
|
19
|
-
>
|
|
20
|
-
{content}
|
|
21
|
-
</Label>
|
|
22
|
-
);
|
|
23
|
-
};
|
package/src/atoms/LayoutAtom.tsx
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { LayoutAtomType, UIComponent } from "../types/schema";
|
|
3
|
-
import { cn } from "@/lib/utils";
|
|
4
|
-
|
|
5
|
-
interface Props extends LayoutAtomType {
|
|
6
|
-
renderComponent: (component: UIComponent, index?: number) => React.ReactNode;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* LayoutAtom
|
|
11
|
-
* Standardized container with flex/grid support from schema
|
|
12
|
-
*/
|
|
13
|
-
export const LayoutAtom: React.FC<Props> = ({
|
|
14
|
-
direction,
|
|
15
|
-
gap = "md",
|
|
16
|
-
children,
|
|
17
|
-
className,
|
|
18
|
-
renderComponent,
|
|
19
|
-
}) => {
|
|
20
|
-
const gapMap: Record<string, string> = {
|
|
21
|
-
none: "gap-0",
|
|
22
|
-
sm: "gap-2",
|
|
23
|
-
md: "gap-4",
|
|
24
|
-
lg: "gap-8",
|
|
25
|
-
xl: "gap-12",
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const classes = cn(
|
|
29
|
-
"flex",
|
|
30
|
-
direction === "vertical" ? "flex-col" : "flex-row flex-wrap",
|
|
31
|
-
direction === "grid" && "grid grid-cols-1 md:grid-cols-2",
|
|
32
|
-
gapMap[gap],
|
|
33
|
-
className,
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<div className={classes}>
|
|
38
|
-
{children.map((child, index) => (
|
|
39
|
-
<React.Fragment key={child.id || `layout-item-${index}`}>
|
|
40
|
-
{renderComponent(child, index)}
|
|
41
|
-
</React.Fragment>
|
|
42
|
-
))}
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
Pagination,
|
|
4
|
-
PaginationContent,
|
|
5
|
-
PaginationEllipsis,
|
|
6
|
-
PaginationItem,
|
|
7
|
-
PaginationLink,
|
|
8
|
-
PaginationNext,
|
|
9
|
-
PaginationPrevious,
|
|
10
|
-
} from "@/components/ui/pagination";
|
|
11
|
-
import { PaginationAtomType } from "../types/schema";
|
|
12
|
-
|
|
13
|
-
export const PaginationAtom: React.FC<PaginationAtomType> = ({
|
|
14
|
-
currentPage,
|
|
15
|
-
totalPages,
|
|
16
|
-
hasNext = true,
|
|
17
|
-
hasPrev = true,
|
|
18
|
-
className,
|
|
19
|
-
}) => {
|
|
20
|
-
return (
|
|
21
|
-
<Pagination className={className}>
|
|
22
|
-
<PaginationContent>
|
|
23
|
-
{hasPrev && (
|
|
24
|
-
<PaginationItem>
|
|
25
|
-
<PaginationPrevious href="#" />
|
|
26
|
-
</PaginationItem>
|
|
27
|
-
)}
|
|
28
|
-
|
|
29
|
-
<PaginationItem>
|
|
30
|
-
<PaginationLink href="#" isActive>
|
|
31
|
-
{currentPage}
|
|
32
|
-
</PaginationLink>
|
|
33
|
-
</PaginationItem>
|
|
34
|
-
|
|
35
|
-
{totalPages > currentPage && (
|
|
36
|
-
<PaginationItem>
|
|
37
|
-
<PaginationEllipsis />
|
|
38
|
-
</PaginationItem>
|
|
39
|
-
)}
|
|
40
|
-
|
|
41
|
-
{hasNext && (
|
|
42
|
-
<PaginationItem>
|
|
43
|
-
<PaginationNext href="#" />
|
|
44
|
-
</PaginationItem>
|
|
45
|
-
)}
|
|
46
|
-
</PaginationContent>
|
|
47
|
-
</Pagination>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
Popover,
|
|
4
|
-
PopoverContent,
|
|
5
|
-
PopoverTrigger,
|
|
6
|
-
} from "@/components/ui/popover";
|
|
7
|
-
import { PopoverAtomType, UIComponent } from "../types/schema";
|
|
8
|
-
import { cn } from "@/lib/utils";
|
|
9
|
-
|
|
10
|
-
interface Props extends PopoverAtomType {
|
|
11
|
-
renderComponent: (component: UIComponent) => React.ReactNode;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const PopoverAtom: React.FC<Props> = ({
|
|
15
|
-
trigger,
|
|
16
|
-
content,
|
|
17
|
-
className,
|
|
18
|
-
renderComponent,
|
|
19
|
-
}) => {
|
|
20
|
-
return (
|
|
21
|
-
<Popover>
|
|
22
|
-
<PopoverTrigger asChild>
|
|
23
|
-
<div className={cn("inline-block cursor-pointer", className)}>
|
|
24
|
-
{trigger.map((child) => (
|
|
25
|
-
<React.Fragment key={child.id}>
|
|
26
|
-
{renderComponent(child)}
|
|
27
|
-
</React.Fragment>
|
|
28
|
-
))}
|
|
29
|
-
</div>
|
|
30
|
-
</PopoverTrigger>
|
|
31
|
-
<PopoverContent className="w-80 rounded-2xl shadow-2xl border-gray-100 p-4 bg-white/95 backdrop-blur-sm">
|
|
32
|
-
{content.map((child) => (
|
|
33
|
-
<React.Fragment key={child.id}>
|
|
34
|
-
{renderComponent(child)}
|
|
35
|
-
</React.Fragment>
|
|
36
|
-
))}
|
|
37
|
-
</PopoverContent>
|
|
38
|
-
</Popover>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Progress } from "@/components/ui/progress";
|
|
3
|
-
import { ProgressAtomType } from "../types/schema";
|
|
4
|
-
import { cn } from "@/lib/utils";
|
|
5
|
-
|
|
6
|
-
export const ProgressAtom: React.FC<ProgressAtomType> = ({
|
|
7
|
-
value,
|
|
8
|
-
className,
|
|
9
|
-
}) => {
|
|
10
|
-
return (
|
|
11
|
-
<div className={cn("w-full py-2", className)}>
|
|
12
|
-
<Progress value={value} className="h-2 bg-gray-100" />
|
|
13
|
-
</div>
|
|
14
|
-
);
|
|
15
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
|
3
|
-
import { Label } from "@/components/ui/label";
|
|
4
|
-
import { RadioGroupAtomType } from "../types/atoms";
|
|
5
|
-
import { cn } from "@/lib/utils";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* RadioGroupAtom
|
|
9
|
-
* Wraps shadcn RadioGroup
|
|
10
|
-
*/
|
|
11
|
-
export const RadioGroupAtom: React.FC<
|
|
12
|
-
RadioGroupAtomType & { onValueChange?: (value: string) => void }
|
|
13
|
-
> = ({ options, defaultValue, disabled, className, onValueChange }) => {
|
|
14
|
-
return (
|
|
15
|
-
<RadioGroup
|
|
16
|
-
defaultValue={defaultValue}
|
|
17
|
-
disabled={disabled}
|
|
18
|
-
onValueChange={onValueChange}
|
|
19
|
-
className={cn("grid gap-2", className)}
|
|
20
|
-
>
|
|
21
|
-
{options.map((option) => (
|
|
22
|
-
<div key={option.value} className="flex items-center space-x-2">
|
|
23
|
-
<RadioGroupItem value={option.value} id={option.value} />
|
|
24
|
-
<Label htmlFor={option.value} className="cursor-pointer">
|
|
25
|
-
{option.label}
|
|
26
|
-
</Label>
|
|
27
|
-
</div>
|
|
28
|
-
))}
|
|
29
|
-
</RadioGroup>
|
|
30
|
-
);
|
|
31
|
-
};
|