pxengine 0.1.11 → 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.
Files changed (186) hide show
  1. package/dist/index.cjs +205 -120
  2. package/dist/index.d.cts +1 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +205 -120
  5. package/dist/registry.json +1200 -288
  6. package/package.json +9 -4
  7. package/config/tailwind-preset.js +0 -106
  8. package/src/atoms/AccordionAtom.tsx +0 -44
  9. package/src/atoms/AlertAtom.tsx +0 -46
  10. package/src/atoms/AlertDialogAtom.tsx +0 -66
  11. package/src/atoms/AspectRatioAtom.tsx +0 -27
  12. package/src/atoms/AvatarAtom.tsx +0 -20
  13. package/src/atoms/BadgeAtom.tsx +0 -33
  14. package/src/atoms/BreadcrumbAtom.tsx +0 -36
  15. package/src/atoms/ButtonAtom.tsx +0 -63
  16. package/src/atoms/CalendarAtom.tsx +0 -24
  17. package/src/atoms/CardAtom.tsx +0 -64
  18. package/src/atoms/CarouselAtom.tsx +0 -40
  19. package/src/atoms/ChartAtom.tsx +0 -190
  20. package/src/atoms/CheckboxAtom.tsx +0 -33
  21. package/src/atoms/CollapsibleAtom.tsx +0 -44
  22. package/src/atoms/CommandAtom.tsx +0 -46
  23. package/src/atoms/ContextMenuAtom.tsx +0 -49
  24. package/src/atoms/DialogAtom.tsx +0 -68
  25. package/src/atoms/DrawerAtom.tsx +0 -49
  26. package/src/atoms/DropdownMenuAtom.tsx +0 -49
  27. package/src/atoms/FormInputAtom.tsx +0 -101
  28. package/src/atoms/FormSelectAtom.tsx +0 -110
  29. package/src/atoms/FormTextareaAtom.tsx +0 -93
  30. package/src/atoms/InputAtom.tsx +0 -188
  31. package/src/atoms/InputOTPAtom.tsx +0 -49
  32. package/src/atoms/KbdAtom.tsx +0 -25
  33. package/src/atoms/LabelAtom.tsx +0 -23
  34. package/src/atoms/LayoutAtom.tsx +0 -45
  35. package/src/atoms/PaginationAtom.tsx +0 -49
  36. package/src/atoms/PopoverAtom.tsx +0 -40
  37. package/src/atoms/ProgressAtom.tsx +0 -15
  38. package/src/atoms/RadioGroupAtom.tsx +0 -31
  39. package/src/atoms/RatingAtom.tsx +0 -37
  40. package/src/atoms/ResizableAtom.tsx +0 -51
  41. package/src/atoms/ScrollAreaAtom.tsx +0 -31
  42. package/src/atoms/SeparatorAtom.tsx +0 -16
  43. package/src/atoms/SheetAtom.tsx +0 -72
  44. package/src/atoms/SkeletonAtom.tsx +0 -22
  45. package/src/atoms/SliderAtom.tsx +0 -32
  46. package/src/atoms/SpinnerAtom.tsx +0 -26
  47. package/src/atoms/SwitchAtom.tsx +0 -32
  48. package/src/atoms/TableAtom.tsx +0 -58
  49. package/src/atoms/TabsAtom.tsx +0 -40
  50. package/src/atoms/TextAtom.tsx +0 -35
  51. package/src/atoms/TextareaAtom.tsx +0 -42
  52. package/src/atoms/TimelineAtom.tsx +0 -77
  53. package/src/atoms/ToggleAtom.tsx +0 -36
  54. package/src/atoms/TooltipAtom.tsx +0 -39
  55. package/src/atoms/VideoAtom.tsx +0 -34
  56. package/src/atoms/index.ts +0 -49
  57. package/src/components/index.ts +0 -178
  58. package/src/components/ui/accordion.tsx +0 -56
  59. package/src/components/ui/alert-dialog.tsx +0 -139
  60. package/src/components/ui/alert.tsx +0 -59
  61. package/src/components/ui/aspect-ratio.tsx +0 -5
  62. package/src/components/ui/avatar.tsx +0 -50
  63. package/src/components/ui/badge.tsx +0 -36
  64. package/src/components/ui/breadcrumb.tsx +0 -115
  65. package/src/components/ui/button-group.tsx +0 -83
  66. package/src/components/ui/button.tsx +0 -56
  67. package/src/components/ui/calendar.tsx +0 -213
  68. package/src/components/ui/card.tsx +0 -79
  69. package/src/components/ui/carousel.tsx +0 -260
  70. package/src/components/ui/chart.tsx +0 -367
  71. package/src/components/ui/checkbox.tsx +0 -28
  72. package/src/components/ui/collapsible.tsx +0 -11
  73. package/src/components/ui/command.tsx +0 -153
  74. package/src/components/ui/context-menu.tsx +0 -198
  75. package/src/components/ui/dialog.tsx +0 -122
  76. package/src/components/ui/drawer.tsx +0 -116
  77. package/src/components/ui/dropdown-menu.tsx +0 -200
  78. package/src/components/ui/empty.tsx +0 -104
  79. package/src/components/ui/field.tsx +0 -244
  80. package/src/components/ui/form.tsx +0 -176
  81. package/src/components/ui/hover-card.tsx +0 -27
  82. package/src/components/ui/index.ts +0 -54
  83. package/src/components/ui/input-group.tsx +0 -168
  84. package/src/components/ui/input-otp.tsx +0 -69
  85. package/src/components/ui/input.tsx +0 -22
  86. package/src/components/ui/item.tsx +0 -193
  87. package/src/components/ui/kbd.tsx +0 -28
  88. package/src/components/ui/label.tsx +0 -26
  89. package/src/components/ui/menubar.tsx +0 -254
  90. package/src/components/ui/navigation-menu.tsx +0 -128
  91. package/src/components/ui/pagination.tsx +0 -117
  92. package/src/components/ui/popover.tsx +0 -29
  93. package/src/components/ui/progress.tsx +0 -28
  94. package/src/components/ui/radio-group.tsx +0 -42
  95. package/src/components/ui/resizable.tsx +0 -44
  96. package/src/components/ui/scroll-area.tsx +0 -46
  97. package/src/components/ui/select.tsx +0 -160
  98. package/src/components/ui/separator.tsx +0 -29
  99. package/src/components/ui/sheet.tsx +0 -140
  100. package/src/components/ui/sidebar.tsx +0 -771
  101. package/src/components/ui/skeleton.tsx +0 -15
  102. package/src/components/ui/slider.tsx +0 -26
  103. package/src/components/ui/sonner.tsx +0 -45
  104. package/src/components/ui/spinner.tsx +0 -16
  105. package/src/components/ui/switch.tsx +0 -27
  106. package/src/components/ui/table.tsx +0 -117
  107. package/src/components/ui/tabs.tsx +0 -53
  108. package/src/components/ui/textarea.tsx +0 -22
  109. package/src/components/ui/toggle-group.tsx +0 -61
  110. package/src/components/ui/toggle.tsx +0 -43
  111. package/src/components/ui/tooltip.tsx +0 -30
  112. package/src/hooks/use-mobile.tsx +0 -19
  113. package/src/index.ts +0 -24
  114. package/src/lib/countries.ts +0 -203
  115. package/src/lib/index.ts +0 -2
  116. package/src/lib/utils.ts +0 -15
  117. package/src/lib/validators/index.ts +0 -1
  118. package/src/lib/validators/theme.ts +0 -148
  119. package/src/molecules/creator-discovery/AudienceDemographicsCard/AudienceDemographicsCard.tsx +0 -44
  120. package/src/molecules/creator-discovery/AudienceDemographicsCard/index.ts +0 -1
  121. package/src/molecules/creator-discovery/AudienceMetricCard/AudienceMetricCard.tsx +0 -50
  122. package/src/molecules/creator-discovery/AudienceMetricCard/index.ts +0 -1
  123. package/src/molecules/creator-discovery/BrandAffinityGroup/BrandAffinityGroup.tsx +0 -36
  124. package/src/molecules/creator-discovery/BrandAffinityGroup/index.ts +0 -1
  125. package/src/molecules/creator-discovery/CampaignSeedCard/CampaignSeedCard.tsx +0 -123
  126. package/src/molecules/creator-discovery/CampaignSeedCard/CampaignSeedCard.types.ts +0 -13
  127. package/src/molecules/creator-discovery/CampaignSeedCard/index.ts +0 -2
  128. package/src/molecules/creator-discovery/ContentPreviewGallery/ContentPreviewGallery.tsx +0 -41
  129. package/src/molecules/creator-discovery/ContentPreviewGallery/index.ts +0 -1
  130. package/src/molecules/creator-discovery/CreatorActionHeader/CreatorActionHeader.tsx +0 -77
  131. package/src/molecules/creator-discovery/CreatorActionHeader/index.ts +0 -1
  132. package/src/molecules/creator-discovery/CreatorGridCard/CreatorGridCard.tsx +0 -104
  133. package/src/molecules/creator-discovery/CreatorGridCard/index.ts +0 -1
  134. package/src/molecules/creator-discovery/CreatorProfileSummary/CreatorProfileSummary.tsx +0 -65
  135. package/src/molecules/creator-discovery/CreatorProfileSummary/index.ts +0 -1
  136. package/src/molecules/creator-discovery/GrowthChartCard/GrowthChartCard.tsx +0 -58
  137. package/src/molecules/creator-discovery/GrowthChartCard/index.ts +0 -1
  138. package/src/molecules/creator-discovery/MCQCard/MCQCard.tsx +0 -165
  139. package/src/molecules/creator-discovery/MCQCard/MCQCard.types.ts +0 -71
  140. package/src/molecules/creator-discovery/MCQCard/index.ts +0 -2
  141. package/src/molecules/creator-discovery/PlatformIconGroup/PlatformIconGroup.tsx +0 -72
  142. package/src/molecules/creator-discovery/PlatformIconGroup/index.ts +0 -1
  143. package/src/molecules/creator-discovery/SearchSpecCard/CustomFieldRenderers.tsx +0 -334
  144. package/src/molecules/creator-discovery/SearchSpecCard/SearchSpecCard.tsx +0 -111
  145. package/src/molecules/creator-discovery/SearchSpecCard/SearchSpecCard.types.ts +0 -18
  146. package/src/molecules/creator-discovery/SearchSpecCard/index.ts +0 -3
  147. package/src/molecules/creator-discovery/TopPostsGrid/TopPostsGrid.tsx +0 -49
  148. package/src/molecules/creator-discovery/TopPostsGrid/index.ts +0 -1
  149. package/src/molecules/creator-discovery/index.ts +0 -13
  150. package/src/molecules/generic/ActionButton/ActionButton.tsx +0 -137
  151. package/src/molecules/generic/ActionButton/ActionButton.types.ts +0 -68
  152. package/src/molecules/generic/ActionButton/index.ts +0 -2
  153. package/src/molecules/generic/DataGrid/DataGrid.tsx +0 -102
  154. package/src/molecules/generic/DataGrid/index.ts +0 -1
  155. package/src/molecules/generic/EditableField/EditableField.tsx +0 -229
  156. package/src/molecules/generic/EditableField/EditableField.types.ts +0 -73
  157. package/src/molecules/generic/EditableField/index.ts +0 -2
  158. package/src/molecules/generic/EmptyState/EmptyState.tsx +0 -61
  159. package/src/molecules/generic/EmptyState/index.ts +0 -1
  160. package/src/molecules/generic/FileUpload/FileUpload.tsx +0 -62
  161. package/src/molecules/generic/FileUpload/index.ts +0 -1
  162. package/src/molecules/generic/FilterBar/FilterBar.tsx +0 -54
  163. package/src/molecules/generic/FilterBar/index.ts +0 -1
  164. package/src/molecules/generic/FormCard/FormCard.tsx +0 -136
  165. package/src/molecules/generic/FormCard/FormCard.types.ts +0 -93
  166. package/src/molecules/generic/FormCard/index.ts +0 -2
  167. package/src/molecules/generic/LoadingOverlay/LoadingOverlay.tsx +0 -39
  168. package/src/molecules/generic/LoadingOverlay/index.ts +0 -1
  169. package/src/molecules/generic/NotificationList/NotificationList.tsx +0 -80
  170. package/src/molecules/generic/NotificationList/index.ts +0 -1
  171. package/src/molecules/generic/StatsGrid/StatsGrid.tsx +0 -80
  172. package/src/molecules/generic/StatsGrid/index.ts +0 -1
  173. package/src/molecules/generic/StepWizard/StepWizard.tsx +0 -67
  174. package/src/molecules/generic/StepWizard/index.ts +0 -1
  175. package/src/molecules/generic/TagCloud/TagCloud.tsx +0 -32
  176. package/src/molecules/generic/TagCloud/index.ts +0 -1
  177. package/src/molecules/generic/index.ts +0 -12
  178. package/src/molecules/index.ts +0 -2
  179. package/src/render/PXEngineRenderer.tsx +0 -416
  180. package/src/render/index.ts +0 -1
  181. package/src/styles/globals.css +0 -146
  182. package/src/types/atoms.ts +0 -449
  183. package/src/types/common.ts +0 -116
  184. package/src/types/index.ts +0 -3
  185. package/src/types/molecules.ts +0 -279
  186. 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
- };
@@ -1,188 +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
- }) => {
39
- const containerClass = cn("flex flex-col gap-2 w-full", className);
40
-
41
- const renderLabel = () => {
42
- if (!label) return null;
43
- return (
44
- <Label className="text-sm font-semibold text-foreground/80 pl-0.5">
45
- {label} {required && <span className="text-destructive">*</span>}
46
- </Label>
47
- );
48
- };
49
-
50
- const renderInput = () => {
51
- switch (inputType) {
52
- case "textarea":
53
- return (
54
- <Textarea
55
- className="rounded-xl border-border bg-background focus:ring-primary shadow-sm"
56
- placeholder={placeholder}
57
- defaultValue={defaultValue}
58
- disabled={disabled}
59
- rows={config?.rows || 3}
60
- />
61
- );
62
- case "select":
63
- return (
64
- <Select defaultValue={defaultValue} disabled={disabled}>
65
- <SelectTrigger className="rounded-xl border-border bg-background shadow-sm">
66
- <SelectValue placeholder={placeholder || "Select option"} />
67
- </SelectTrigger>
68
- <SelectContent className="rounded-xl border-border shadow-xl">
69
- {options?.map((opt) => (
70
- <SelectItem key={opt.value} value={opt.value}>
71
- {opt.label}
72
- </SelectItem>
73
- ))}
74
- </SelectContent>
75
- </Select>
76
- );
77
- case "slider":
78
- return (
79
- <div className="pt-2 pb-1">
80
- <Slider
81
- defaultValue={[defaultValue || config?.min || 0]}
82
- max={config?.max || 100}
83
- min={config?.min || 0}
84
- step={config?.step || 1}
85
- disabled={disabled}
86
- className="py-4"
87
- />
88
- </div>
89
- );
90
- case "checkbox":
91
- return (
92
- <div className="flex items-center space-x-3 py-1.5 px-0.5 group cursor-pointer">
93
- <Checkbox
94
- id={label}
95
- defaultChecked={defaultValue}
96
- disabled={disabled}
97
- className="rounded-[6px] border-border data-[state=checked]:bg-primary shadow-sm"
98
- />
99
- <label
100
- htmlFor={label}
101
- className="text-sm font-medium leading-none cursor-pointer text-foreground/90 group-hover:text-foreground transition-colors"
102
- >
103
- {label}
104
- </label>
105
- </div>
106
- );
107
- case "switch":
108
- return (
109
- <div className="flex items-center justify-between py-1.5 px-0.5">
110
- <Label
111
- htmlFor={label}
112
- className="cursor-pointer text-foreground/90"
113
- >
114
- {label}
115
- </Label>
116
- <Switch
117
- id={label}
118
- defaultChecked={defaultValue}
119
- disabled={disabled}
120
- className="data-[state=checked]:bg-primary shadow-sm"
121
- />
122
- </div>
123
- );
124
- case "radio":
125
- return (
126
- <RadioGroup
127
- defaultValue={defaultValue}
128
- disabled={disabled}
129
- className="gap-2.5"
130
- >
131
- {options?.map((opt) => (
132
- <div key={opt.value} className="flex items-center space-x-3">
133
- <RadioGroupItem
134
- value={opt.value}
135
- id={`${label}-${opt.value}`}
136
- className="border-border text-primary shadow-sm"
137
- />
138
- <Label
139
- htmlFor={`${label}-${opt.value}`}
140
- className="cursor-pointer text-foreground/80 font-medium"
141
- >
142
- {opt.label}
143
- </Label>
144
- </div>
145
- ))}
146
- </RadioGroup>
147
- );
148
- case "otp":
149
- return (
150
- <div className="flex justify-center py-2">
151
- <InputOTP
152
- maxLength={config?.maxLength || 6}
153
- disabled={disabled}
154
- defaultValue={defaultValue}
155
- >
156
- <InputOTPGroup className="gap-2">
157
- {Array.from({ length: config?.maxLength || 6 }).map((_, i) => (
158
- <InputOTPSlot
159
- key={i}
160
- index={i}
161
- className="rounded-xl border border-border bg-background shadow-sm"
162
- />
163
- ))}
164
- </InputOTPGroup>
165
- </InputOTP>
166
- </div>
167
- );
168
- default:
169
- return (
170
- <Input
171
- type={inputType}
172
- placeholder={placeholder}
173
- defaultValue={defaultValue}
174
- disabled={disabled}
175
- required={required}
176
- className="rounded-xl border-border bg-background focus:ring-primary shadow-sm h-11"
177
- />
178
- );
179
- }
180
- };
181
-
182
- return (
183
- <div className={containerClass}>
184
- {inputType !== "checkbox" && inputType !== "switch" && renderLabel()}
185
- {renderInput()}
186
- </div>
187
- );
188
- };
@@ -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
- };
@@ -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
- };
@@ -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
- };
@@ -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
- };