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.
Files changed (182) hide show
  1. package/dist/registry.json +1 -1
  2. package/package.json +2 -4
  3. package/config/tailwind-preset.js +0 -106
  4. package/src/atoms/AccordionAtom.tsx +0 -44
  5. package/src/atoms/AlertAtom.tsx +0 -48
  6. package/src/atoms/AlertDialogAtom.tsx +0 -66
  7. package/src/atoms/AspectRatioAtom.tsx +0 -27
  8. package/src/atoms/AvatarAtom.tsx +0 -21
  9. package/src/atoms/BadgeAtom.tsx +0 -35
  10. package/src/atoms/BreadcrumbAtom.tsx +0 -36
  11. package/src/atoms/ButtonAtom.tsx +0 -65
  12. package/src/atoms/CalendarAtom.tsx +0 -24
  13. package/src/atoms/CardAtom.tsx +0 -66
  14. package/src/atoms/CarouselAtom.tsx +0 -40
  15. package/src/atoms/ChartAtom.tsx +0 -192
  16. package/src/atoms/CheckboxAtom.tsx +0 -33
  17. package/src/atoms/CollapsibleAtom.tsx +0 -44
  18. package/src/atoms/CommandAtom.tsx +0 -46
  19. package/src/atoms/ContextMenuAtom.tsx +0 -49
  20. package/src/atoms/DialogAtom.tsx +0 -68
  21. package/src/atoms/DrawerAtom.tsx +0 -49
  22. package/src/atoms/DropdownMenuAtom.tsx +0 -49
  23. package/src/atoms/FormInputAtom.tsx +0 -101
  24. package/src/atoms/FormSelectAtom.tsx +0 -110
  25. package/src/atoms/FormTextareaAtom.tsx +0 -93
  26. package/src/atoms/InputAtom.tsx +0 -216
  27. package/src/atoms/InputOTPAtom.tsx +0 -49
  28. package/src/atoms/KbdAtom.tsx +0 -25
  29. package/src/atoms/LabelAtom.tsx +0 -23
  30. package/src/atoms/LayoutAtom.tsx +0 -45
  31. package/src/atoms/PaginationAtom.tsx +0 -49
  32. package/src/atoms/PopoverAtom.tsx +0 -40
  33. package/src/atoms/ProgressAtom.tsx +0 -15
  34. package/src/atoms/RadioGroupAtom.tsx +0 -31
  35. package/src/atoms/RatingAtom.tsx +0 -37
  36. package/src/atoms/ResizableAtom.tsx +0 -51
  37. package/src/atoms/ScrollAreaAtom.tsx +0 -31
  38. package/src/atoms/SeparatorAtom.tsx +0 -16
  39. package/src/atoms/SheetAtom.tsx +0 -72
  40. package/src/atoms/SkeletonAtom.tsx +0 -22
  41. package/src/atoms/SliderAtom.tsx +0 -32
  42. package/src/atoms/SpinnerAtom.tsx +0 -26
  43. package/src/atoms/SwitchAtom.tsx +0 -32
  44. package/src/atoms/TableAtom.tsx +0 -60
  45. package/src/atoms/TabsAtom.tsx +0 -40
  46. package/src/atoms/TextAtom.tsx +0 -36
  47. package/src/atoms/TextareaAtom.tsx +0 -42
  48. package/src/atoms/TimelineAtom.tsx +0 -77
  49. package/src/atoms/ToggleAtom.tsx +0 -36
  50. package/src/atoms/TooltipAtom.tsx +0 -39
  51. package/src/atoms/VideoAtom.tsx +0 -34
  52. package/src/atoms/index.ts +0 -49
  53. package/src/components/index.ts +0 -178
  54. package/src/components/ui/accordion.tsx +0 -56
  55. package/src/components/ui/alert-dialog.tsx +0 -139
  56. package/src/components/ui/alert.tsx +0 -59
  57. package/src/components/ui/aspect-ratio.tsx +0 -5
  58. package/src/components/ui/avatar.tsx +0 -50
  59. package/src/components/ui/badge.tsx +0 -36
  60. package/src/components/ui/breadcrumb.tsx +0 -115
  61. package/src/components/ui/button-group.tsx +0 -83
  62. package/src/components/ui/button.tsx +0 -56
  63. package/src/components/ui/calendar.tsx +0 -213
  64. package/src/components/ui/card.tsx +0 -79
  65. package/src/components/ui/carousel.tsx +0 -260
  66. package/src/components/ui/chart.tsx +0 -367
  67. package/src/components/ui/checkbox.tsx +0 -28
  68. package/src/components/ui/collapsible.tsx +0 -11
  69. package/src/components/ui/command.tsx +0 -153
  70. package/src/components/ui/context-menu.tsx +0 -198
  71. package/src/components/ui/dialog.tsx +0 -122
  72. package/src/components/ui/drawer.tsx +0 -116
  73. package/src/components/ui/dropdown-menu.tsx +0 -200
  74. package/src/components/ui/empty.tsx +0 -104
  75. package/src/components/ui/field.tsx +0 -244
  76. package/src/components/ui/form.tsx +0 -176
  77. package/src/components/ui/hover-card.tsx +0 -27
  78. package/src/components/ui/index.ts +0 -54
  79. package/src/components/ui/input-group.tsx +0 -168
  80. package/src/components/ui/input-otp.tsx +0 -69
  81. package/src/components/ui/input.tsx +0 -22
  82. package/src/components/ui/item.tsx +0 -193
  83. package/src/components/ui/kbd.tsx +0 -28
  84. package/src/components/ui/label.tsx +0 -26
  85. package/src/components/ui/menubar.tsx +0 -254
  86. package/src/components/ui/navigation-menu.tsx +0 -128
  87. package/src/components/ui/pagination.tsx +0 -117
  88. package/src/components/ui/popover.tsx +0 -29
  89. package/src/components/ui/progress.tsx +0 -28
  90. package/src/components/ui/radio-group.tsx +0 -42
  91. package/src/components/ui/resizable.tsx +0 -44
  92. package/src/components/ui/scroll-area.tsx +0 -46
  93. package/src/components/ui/select.tsx +0 -160
  94. package/src/components/ui/separator.tsx +0 -29
  95. package/src/components/ui/sheet.tsx +0 -140
  96. package/src/components/ui/sidebar.tsx +0 -771
  97. package/src/components/ui/skeleton.tsx +0 -15
  98. package/src/components/ui/slider.tsx +0 -26
  99. package/src/components/ui/sonner.tsx +0 -45
  100. package/src/components/ui/spinner.tsx +0 -16
  101. package/src/components/ui/switch.tsx +0 -27
  102. package/src/components/ui/table.tsx +0 -117
  103. package/src/components/ui/tabs.tsx +0 -53
  104. package/src/components/ui/textarea.tsx +0 -22
  105. package/src/components/ui/toggle-group.tsx +0 -61
  106. package/src/components/ui/toggle.tsx +0 -43
  107. package/src/components/ui/tooltip.tsx +0 -30
  108. package/src/hooks/use-mobile.tsx +0 -19
  109. package/src/index.ts +0 -24
  110. package/src/lib/countries.ts +0 -203
  111. package/src/lib/index.ts +0 -2
  112. package/src/lib/utils.ts +0 -15
  113. package/src/lib/validators/index.ts +0 -1
  114. package/src/lib/validators/theme.ts +0 -148
  115. package/src/molecules/creator-discovery/AudienceDemographicsCard/AudienceDemographicsCard.tsx +0 -44
  116. package/src/molecules/creator-discovery/AudienceDemographicsCard/index.ts +0 -1
  117. package/src/molecules/creator-discovery/AudienceMetricCard/AudienceMetricCard.tsx +0 -50
  118. package/src/molecules/creator-discovery/AudienceMetricCard/index.ts +0 -1
  119. package/src/molecules/creator-discovery/BrandAffinityGroup/BrandAffinityGroup.tsx +0 -36
  120. package/src/molecules/creator-discovery/BrandAffinityGroup/index.ts +0 -1
  121. package/src/molecules/creator-discovery/CampaignSeedCard/CampaignSeedCard.tsx +0 -123
  122. package/src/molecules/creator-discovery/CampaignSeedCard/CampaignSeedCard.types.ts +0 -13
  123. package/src/molecules/creator-discovery/CampaignSeedCard/index.ts +0 -2
  124. package/src/molecules/creator-discovery/ContentPreviewGallery/ContentPreviewGallery.tsx +0 -41
  125. package/src/molecules/creator-discovery/ContentPreviewGallery/index.ts +0 -1
  126. package/src/molecules/creator-discovery/CreatorActionHeader/CreatorActionHeader.tsx +0 -77
  127. package/src/molecules/creator-discovery/CreatorActionHeader/index.ts +0 -1
  128. package/src/molecules/creator-discovery/CreatorGridCard/CreatorGridCard.tsx +0 -104
  129. package/src/molecules/creator-discovery/CreatorGridCard/index.ts +0 -1
  130. package/src/molecules/creator-discovery/CreatorProfileSummary/CreatorProfileSummary.tsx +0 -65
  131. package/src/molecules/creator-discovery/CreatorProfileSummary/index.ts +0 -1
  132. package/src/molecules/creator-discovery/GrowthChartCard/GrowthChartCard.tsx +0 -58
  133. package/src/molecules/creator-discovery/GrowthChartCard/index.ts +0 -1
  134. package/src/molecules/creator-discovery/MCQCard/MCQCard.tsx +0 -165
  135. package/src/molecules/creator-discovery/MCQCard/MCQCard.types.ts +0 -71
  136. package/src/molecules/creator-discovery/MCQCard/index.ts +0 -2
  137. package/src/molecules/creator-discovery/PlatformIconGroup/PlatformIconGroup.tsx +0 -72
  138. package/src/molecules/creator-discovery/PlatformIconGroup/index.ts +0 -1
  139. package/src/molecules/creator-discovery/SearchSpecCard/CustomFieldRenderers.tsx +0 -334
  140. package/src/molecules/creator-discovery/SearchSpecCard/SearchSpecCard.tsx +0 -111
  141. package/src/molecules/creator-discovery/SearchSpecCard/SearchSpecCard.types.ts +0 -18
  142. package/src/molecules/creator-discovery/SearchSpecCard/index.ts +0 -3
  143. package/src/molecules/creator-discovery/TopPostsGrid/TopPostsGrid.tsx +0 -49
  144. package/src/molecules/creator-discovery/TopPostsGrid/index.ts +0 -1
  145. package/src/molecules/creator-discovery/index.ts +0 -13
  146. package/src/molecules/generic/ActionButton/ActionButton.tsx +0 -137
  147. package/src/molecules/generic/ActionButton/ActionButton.types.ts +0 -68
  148. package/src/molecules/generic/ActionButton/index.ts +0 -2
  149. package/src/molecules/generic/DataGrid/DataGrid.tsx +0 -102
  150. package/src/molecules/generic/DataGrid/index.ts +0 -1
  151. package/src/molecules/generic/EditableField/EditableField.tsx +0 -229
  152. package/src/molecules/generic/EditableField/EditableField.types.ts +0 -73
  153. package/src/molecules/generic/EditableField/index.ts +0 -2
  154. package/src/molecules/generic/EmptyState/EmptyState.tsx +0 -61
  155. package/src/molecules/generic/EmptyState/index.ts +0 -1
  156. package/src/molecules/generic/FileUpload/FileUpload.tsx +0 -62
  157. package/src/molecules/generic/FileUpload/index.ts +0 -1
  158. package/src/molecules/generic/FilterBar/FilterBar.tsx +0 -54
  159. package/src/molecules/generic/FilterBar/index.ts +0 -1
  160. package/src/molecules/generic/FormCard/FormCard.tsx +0 -136
  161. package/src/molecules/generic/FormCard/FormCard.types.ts +0 -93
  162. package/src/molecules/generic/FormCard/index.ts +0 -2
  163. package/src/molecules/generic/LoadingOverlay/LoadingOverlay.tsx +0 -39
  164. package/src/molecules/generic/LoadingOverlay/index.ts +0 -1
  165. package/src/molecules/generic/NotificationList/NotificationList.tsx +0 -80
  166. package/src/molecules/generic/NotificationList/index.ts +0 -1
  167. package/src/molecules/generic/StatsGrid/StatsGrid.tsx +0 -80
  168. package/src/molecules/generic/StatsGrid/index.ts +0 -1
  169. package/src/molecules/generic/StepWizard/StepWizard.tsx +0 -67
  170. package/src/molecules/generic/StepWizard/index.ts +0 -1
  171. package/src/molecules/generic/TagCloud/TagCloud.tsx +0 -32
  172. package/src/molecules/generic/TagCloud/index.ts +0 -1
  173. package/src/molecules/generic/index.ts +0 -12
  174. package/src/molecules/index.ts +0 -2
  175. package/src/render/PXEngineRenderer.tsx +0 -458
  176. package/src/render/index.ts +0 -1
  177. package/src/styles/globals.css +0 -146
  178. package/src/types/atoms.ts +0 -450
  179. package/src/types/common.ts +0 -116
  180. package/src/types/index.ts +0 -3
  181. package/src/types/molecules.ts +0 -279
  182. package/src/types/schema.ts +0 -12
@@ -1,192 +0,0 @@
1
- import React from "react";
2
- import {
3
- ChartContainer,
4
- ChartTooltip,
5
- ChartTooltipContent,
6
- ChartLegend,
7
- ChartLegendContent,
8
- type ChartConfig,
9
- } from "@/components/ui/chart";
10
- import {
11
- Bar,
12
- BarChart,
13
- Line,
14
- LineChart,
15
- Area,
16
- AreaChart,
17
- Pie,
18
- PieChart,
19
- Radar,
20
- RadarChart,
21
- RadialBar,
22
- RadialBarChart,
23
- XAxis,
24
- CartesianGrid,
25
- PolarGrid,
26
- PolarAngleAxis,
27
- } from "recharts";
28
- import { ChartAtomType } from "../types/atoms";
29
- import { cn } from "@/lib/utils";
30
-
31
- /**
32
- * ChartAtom
33
- * A versatile chart component wrapping Shadcn Chart primitives and Recharts.
34
- */
35
- export const ChartAtom: React.FC<ChartAtomType> = ({
36
- chartType,
37
- data,
38
- config,
39
- XAxisKey,
40
- YAxisKey,
41
- showTooltip = true,
42
- showLegend = true,
43
- stacked = false,
44
- className,
45
- style,
46
- }) => {
47
- const renderChart = () => {
48
- switch (chartType) {
49
- case "bar":
50
- return (
51
- <BarChart data={data}>
52
- <CartesianGrid vertical={false} />
53
- <XAxis
54
- dataKey={XAxisKey}
55
- tickLine={false}
56
- tickMargin={10}
57
- axisLine={false}
58
- tickFormatter={(value) => value.toString().slice(0, 3)}
59
- />
60
- {showTooltip && (
61
- <ChartTooltip content={<ChartTooltipContent hideLabel />} />
62
- )}
63
- {showLegend && <ChartLegend content={<ChartLegendContent />} />}
64
- {Object.keys(config).map((key) => (
65
- <Bar
66
- key={key}
67
- dataKey={key}
68
- fill={`var(--color-${key})`}
69
- radius={8}
70
- stackId={stacked ? "a" : undefined}
71
- />
72
- ))}
73
- </BarChart>
74
- );
75
- case "line":
76
- return (
77
- <LineChart data={data}>
78
- <CartesianGrid vertical={false} />
79
- <XAxis
80
- dataKey={XAxisKey}
81
- tickLine={false}
82
- axisLine={false}
83
- tickMargin={8}
84
- tickFormatter={(value) => value.toString().slice(0, 3)}
85
- />
86
- {showTooltip && (
87
- <ChartTooltip content={<ChartTooltipContent hideLabel />} />
88
- )}
89
- {Object.keys(config).map((key) => (
90
- <Line
91
- key={key}
92
- dataKey={key}
93
- type="natural"
94
- stroke={`var(--color-${key})`}
95
- strokeWidth={2}
96
- dot={false}
97
- />
98
- ))}
99
- </LineChart>
100
- );
101
- case "area":
102
- return (
103
- <AreaChart data={data}>
104
- <CartesianGrid vertical={false} />
105
- <XAxis
106
- dataKey={XAxisKey}
107
- tickLine={false}
108
- axisLine={false}
109
- tickMargin={8}
110
- tickFormatter={(value) => value.toString().slice(0, 3)}
111
- />
112
- {showTooltip && (
113
- <ChartTooltip content={<ChartTooltipContent hideLabel />} />
114
- )}
115
- {Object.keys(config).map((key) => (
116
- <Area
117
- key={key}
118
- dataKey={key}
119
- type="natural"
120
- fill={`var(--color-${key})`}
121
- fillOpacity={0.4}
122
- stroke={`var(--color-${key})`}
123
- stackId={stacked ? "a" : undefined}
124
- />
125
- ))}
126
- </AreaChart>
127
- );
128
- case "pie":
129
- return (
130
- <PieChart>
131
- {showTooltip && (
132
- <ChartTooltip content={<ChartTooltipContent hideLabel />} />
133
- )}
134
- <Pie
135
- data={data}
136
- dataKey={YAxisKey || "value"}
137
- nameKey={XAxisKey || "name"}
138
- innerRadius={60}
139
- strokeWidth={5}
140
- />
141
- </PieChart>
142
- );
143
- case "radar":
144
- return (
145
- <RadarChart data={data}>
146
- {showTooltip && (
147
- <ChartTooltip cursor={false} content={<ChartTooltipContent />} />
148
- )}
149
- <PolarGrid />
150
- <PolarAngleAxis dataKey={XAxisKey} />
151
- {Object.keys(config).map((key) => (
152
- <Radar
153
- key={key}
154
- dataKey={key}
155
- fill={`var(--color-${key})`}
156
- fillOpacity={0.6}
157
- />
158
- ))}
159
- </RadarChart>
160
- );
161
- case "radial":
162
- return (
163
- <RadialBarChart
164
- data={data}
165
- innerRadius={30}
166
- outerRadius={110}
167
- barSize={10}
168
- >
169
- {showTooltip && (
170
- <ChartTooltip
171
- cursor={false}
172
- content={<ChartTooltipContent hideLabel nameKey={XAxisKey} />}
173
- />
174
- )}
175
- <RadialBar dataKey={YAxisKey || "value"} background />
176
- </RadialBarChart>
177
- );
178
- default:
179
- return null;
180
- }
181
- };
182
-
183
- return (
184
- <ChartContainer
185
- config={config as ChartConfig}
186
- className={cn("min-h-[200px] w-full", className)}
187
- style={style}
188
- >
189
- {renderChart() as React.ReactElement}
190
- </ChartContainer>
191
- );
192
- };
@@ -1,33 +0,0 @@
1
- import React from "react";
2
- import { Checkbox } from "@/components/ui/checkbox";
3
- import { CheckboxAtomType } from "../types/atoms";
4
- import { Label } from "@/components/ui/label";
5
- import { cn } from "@/lib/utils";
6
-
7
- /**
8
- * CheckboxAtom
9
- * Wraps shadcn Checkbox with label support
10
- */
11
- export const CheckboxAtom: React.FC<
12
- CheckboxAtomType & { onCheckedChange?: (checked: boolean) => void }
13
- > = ({ id, label, checked, disabled, className, onCheckedChange }) => {
14
- return (
15
- <div className={cn("flex items-center space-x-2", className)}>
16
- <Checkbox
17
- id={id}
18
- checked={checked}
19
- disabled={disabled}
20
- onCheckedChange={onCheckedChange}
21
- className="rounded border-purple-300 text-purple-600 focus:ring-purple-500"
22
- />
23
- {label && (
24
- <Label
25
- htmlFor={id}
26
- className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer"
27
- >
28
- {label}
29
- </Label>
30
- )}
31
- </div>
32
- );
33
- };
@@ -1,44 +0,0 @@
1
- import React from "react";
2
- import {
3
- Collapsible,
4
- CollapsibleContent,
5
- CollapsibleTrigger,
6
- } from "@/components/ui/collapsible";
7
- import { CollapsibleAtomType, UIComponent } from "../types/schema";
8
- import { cn } from "@/lib/utils";
9
-
10
- interface Props extends CollapsibleAtomType {
11
- renderComponent: (component: UIComponent) => React.ReactNode;
12
- }
13
-
14
- export const CollapsibleAtom: React.FC<Props> = ({
15
- trigger,
16
- content,
17
- defaultOpen = false,
18
- className,
19
- renderComponent,
20
- }) => {
21
- return (
22
- <Collapsible
23
- defaultOpen={defaultOpen}
24
- className={cn("w-full space-y-2", className)}
25
- >
26
- <CollapsibleTrigger asChild>
27
- <div className="flex items-center justify-between space-x-4 px-4 py-2 bg-gray-50 rounded-lg cursor-pointer hover:bg-gray-100 transition-colors">
28
- {trigger.map((child) => (
29
- <React.Fragment key={child.id}>
30
- {renderComponent(child)}
31
- </React.Fragment>
32
- ))}
33
- </div>
34
- </CollapsibleTrigger>
35
- <CollapsibleContent className="space-y-2">
36
- {content.map((child) => (
37
- <React.Fragment key={child.id}>
38
- {renderComponent(child)}
39
- </React.Fragment>
40
- ))}
41
- </CollapsibleContent>
42
- </Collapsible>
43
- );
44
- };
@@ -1,46 +0,0 @@
1
- import React from "react";
2
- import {
3
- Command,
4
- CommandEmpty,
5
- CommandGroup,
6
- CommandInput,
7
- CommandItem,
8
- CommandList,
9
- CommandSeparator,
10
- } from "@/components/ui/command";
11
- import { CommandAtomType } from "../types/schema";
12
- import { cn } from "@/lib/utils";
13
-
14
- export const CommandAtom: React.FC<CommandAtomType> = ({
15
- placeholder = "Search...",
16
- groups,
17
- className,
18
- }) => {
19
- return (
20
- <div
21
- className={cn(
22
- "rounded-2xl border border-gray-100 shadow-lg overflow-hidden bg-white max-w-[400px]",
23
- className,
24
- )}
25
- >
26
- <Command>
27
- <CommandInput placeholder={placeholder} />
28
- <CommandList>
29
- <CommandEmpty>No results found.</CommandEmpty>
30
- {groups.map((group, i) => (
31
- <React.Fragment key={i}>
32
- <CommandGroup heading={group.heading}>
33
- {group.items.map((item, j) => (
34
- <CommandItem key={j} value={item.value}>
35
- <span>{item.label}</span>
36
- </CommandItem>
37
- ))}
38
- </CommandGroup>
39
- {i < groups.length - 1 && <CommandSeparator />}
40
- </React.Fragment>
41
- ))}
42
- </CommandList>
43
- </Command>
44
- </div>
45
- );
46
- };
@@ -1,49 +0,0 @@
1
- import React from "react";
2
- import {
3
- ContextMenu,
4
- ContextMenuContent,
5
- ContextMenuItem,
6
- ContextMenuTrigger,
7
- } from "@/components/ui/context-menu";
8
- import { ContextMenuAtomType } from "../types/atoms";
9
- import { cn } from "@/lib/utils";
10
- import * as Icons from "lucide-react";
11
-
12
- /**
13
- * ContextMenuAtom
14
- * Wraps shadcn ContextMenu
15
- */
16
- export const ContextMenuAtom: React.FC<
17
- ContextMenuAtomType & { onAction?: (action: string) => void }
18
- > = ({ trigger, items, className, onAction }) => {
19
- return (
20
- <ContextMenu>
21
- <ContextMenuTrigger asChild>{trigger}</ContextMenuTrigger>
22
- <ContextMenuContent
23
- className={cn(
24
- "w-64 bg-white/80 backdrop-blur-md border-purple-100",
25
- className,
26
- )}
27
- >
28
- {items.map((item) => {
29
- const Icon = item.icon ? (Icons as any)[item.icon] : null;
30
- return (
31
- <ContextMenuItem
32
- key={item.value}
33
- disabled={item.disabled}
34
- onClick={() => item.action && onAction?.(item.action)}
35
- className={cn(
36
- "flex items-center gap-2 cursor-pointer focus:bg-purple-50",
37
- item.isDestructive &&
38
- "text-red-600 focus:text-red-700 focus:bg-red-50",
39
- )}
40
- >
41
- {Icon && <Icon className="w-4 h-4" />}
42
- <span>{item.label}</span>
43
- </ContextMenuItem>
44
- );
45
- })}
46
- </ContextMenuContent>
47
- </ContextMenu>
48
- );
49
- };
@@ -1,68 +0,0 @@
1
- import React from "react";
2
- import {
3
- Dialog,
4
- DialogContent,
5
- DialogDescription,
6
- DialogHeader,
7
- DialogTitle,
8
- DialogTrigger,
9
- DialogFooter,
10
- } from "@/components/ui/dialog";
11
- import { DialogAtomType, UIComponent } from "../types/schema";
12
- import { cn } from "@/lib/utils";
13
-
14
- interface Props extends DialogAtomType {
15
- renderComponent: (component: UIComponent) => React.ReactNode;
16
- }
17
-
18
- export const DialogAtom: React.FC<Props> = ({
19
- title,
20
- description,
21
- trigger,
22
- children,
23
- footer,
24
- className,
25
- renderComponent,
26
- }) => {
27
- return (
28
- <Dialog>
29
- <DialogTrigger asChild>
30
- <div className={cn("inline-block cursor-pointer", className)}>
31
- {trigger.map((child) => (
32
- <React.Fragment key={child.id}>
33
- {renderComponent(child)}
34
- </React.Fragment>
35
- ))}
36
- </div>
37
- </DialogTrigger>
38
- <DialogContent className="sm:max-w-[425px] rounded-3xl p-6 bg-white/95 backdrop-blur-md shadow-3xl border-gray-100">
39
- <DialogHeader>
40
- <DialogTitle className="text-xl font-bold bg-gradient-to-r from-purple600 to-indigo-600 bg-clip-text text-transparent">
41
- {title}
42
- </DialogTitle>
43
- {description && (
44
- <DialogDescription className="text-gray-500 font-medium pt-1">
45
- {description}
46
- </DialogDescription>
47
- )}
48
- </DialogHeader>
49
- <div className="py-4">
50
- {children.map((child) => (
51
- <React.Fragment key={child.id}>
52
- {renderComponent(child)}
53
- </React.Fragment>
54
- ))}
55
- </div>
56
- {footer && (
57
- <DialogFooter className="pt-2">
58
- {footer.map((child) => (
59
- <React.Fragment key={child.id}>
60
- {renderComponent(child)}
61
- </React.Fragment>
62
- ))}
63
- </DialogFooter>
64
- )}
65
- </DialogContent>
66
- </Dialog>
67
- );
68
- };
@@ -1,49 +0,0 @@
1
- import React from "react";
2
- import {
3
- Drawer,
4
- DrawerContent,
5
- DrawerDescription,
6
- DrawerHeader,
7
- DrawerTitle,
8
- DrawerTrigger,
9
- } from "@/components/ui/drawer";
10
- import { DrawerAtomType } from "../types/atoms";
11
- import { cn } from "@/lib/utils";
12
-
13
- /**
14
- * DrawerAtom
15
- * Wraps shadcn Drawer for mobile-first views
16
- */
17
- export const DrawerAtom: React.FC<DrawerAtomType> = ({
18
- title,
19
- description,
20
- trigger,
21
- children,
22
- className,
23
- }) => {
24
- return (
25
- <Drawer>
26
- <DrawerTrigger asChild>{trigger}</DrawerTrigger>
27
- <DrawerContent
28
- className={cn(
29
- "bg-white/95 backdrop-blur-xl border-t border-purple-100",
30
- className,
31
- )}
32
- >
33
- <div className="mx-auto w-full max-w-sm">
34
- {(title || description) && (
35
- <DrawerHeader>
36
- {title && (
37
- <DrawerTitle className="text-purple-900">{title}</DrawerTitle>
38
- )}
39
- {description && (
40
- <DrawerDescription>{description}</DrawerDescription>
41
- )}
42
- </DrawerHeader>
43
- )}
44
- <div className="p-4 pb-8">{children}</div>
45
- </div>
46
- </DrawerContent>
47
- </Drawer>
48
- );
49
- };
@@ -1,49 +0,0 @@
1
- import React from "react";
2
- import {
3
- DropdownMenu,
4
- DropdownMenuContent,
5
- DropdownMenuItem,
6
- DropdownMenuTrigger,
7
- } from "@/components/ui/dropdown-menu";
8
- import { DropdownMenuAtomType } from "../types/atoms";
9
- import { cn } from "@/lib/utils";
10
- import * as Icons from "lucide-react";
11
-
12
- /**
13
- * DropdownMenuAtom
14
- * Wraps shadcn DropdownMenu
15
- */
16
- export const DropdownMenuAtom: React.FC<
17
- DropdownMenuAtomType & { onAction?: (action: string) => void }
18
- > = ({ trigger, items, className, onAction }) => {
19
- return (
20
- <DropdownMenu>
21
- <DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger>
22
- <DropdownMenuContent
23
- className={cn(
24
- "w-56 bg-white/80 backdrop-blur-md border-purple-100",
25
- className,
26
- )}
27
- >
28
- {items.map((item) => {
29
- const Icon = item.icon ? (Icons as any)[item.icon] : null;
30
- return (
31
- <DropdownMenuItem
32
- key={item.value}
33
- disabled={item.disabled}
34
- onClick={() => item.action && onAction?.(item.action)}
35
- className={cn(
36
- "flex items-center gap-2 cursor-pointer focus:bg-purple-50",
37
- item.isDestructive &&
38
- "text-red-600 focus:text-red-700 focus:bg-red-50",
39
- )}
40
- >
41
- {Icon && <Icon className="w-4 h-4" />}
42
- <span>{item.label}</span>
43
- </DropdownMenuItem>
44
- );
45
- })}
46
- </DropdownMenuContent>
47
- </DropdownMenu>
48
- );
49
- };
@@ -1,101 +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 { Input } from "@/components/ui/input";
12
- import { useForm } from "react-hook-form";
13
- import { cn } from "@/lib/utils";
14
-
15
- export interface FormInputAtomType {
16
- type: "FormInput";
17
- name: string;
18
- label?: string;
19
- placeholder?: string;
20
- description?: string;
21
- defaultValue?: string;
22
- required?: boolean;
23
- inputType?:
24
- | "text"
25
- | "email"
26
- | "password"
27
- | "number"
28
- | "tel"
29
- | "url"
30
- | "date"
31
- | "time";
32
- className?: string;
33
- id?: string;
34
- }
35
-
36
- interface FormInputAtomProps extends Omit<FormInputAtomType, "type"> {
37
- renderComponent?: any;
38
- children?: any;
39
- }
40
-
41
- /**
42
- * FormInputAtom
43
- *
44
- * Self-contained form input component that properly wraps FormField, FormItem, FormLabel, and FormControl.
45
- * This component provides the necessary React Context for form components to work correctly.
46
- *
47
- * Features:
48
- * - Handles all form context requirements internally
49
- * - Supports various input types (text, email, password, etc.)
50
- * - Includes validation support through react-hook-form
51
- * - Schema-safe for dynamic rendering via PXEngineRenderer
52
- */
53
- export const FormInputAtom: React.FC<FormInputAtomProps> = ({
54
- name,
55
- label,
56
- placeholder,
57
- description,
58
- defaultValue = "",
59
- required = false,
60
- inputType = "text",
61
- className,
62
- id,
63
- }) => {
64
- // Safe fallback for name to prevent RHF crash
65
- const fieldName =
66
- name || id || `input-${Math.random().toString(36).substring(2, 9)}`;
67
-
68
- // Create a local form context for this field
69
- const form = useForm({
70
- defaultValues: {
71
- [fieldName]: defaultValue,
72
- },
73
- });
74
-
75
- return (
76
- <Form {...form}>
77
- <FormField
78
- control={form.control}
79
- name={fieldName}
80
- rules={{
81
- required: required ? `${label || name} is required` : undefined,
82
- }}
83
- render={({ field }) => (
84
- <FormItem className={cn("w-full", className)}>
85
- {label && <FormLabel>{label}</FormLabel>}
86
- <FormControl>
87
- <Input
88
- type={inputType}
89
- placeholder={placeholder}
90
- id={id || `form-input-${name}`}
91
- {...field}
92
- />
93
- </FormControl>
94
- {description && <FormDescription>{description}</FormDescription>}
95
- <FormMessage />
96
- </FormItem>
97
- )}
98
- />
99
- </Form>
100
- );
101
- };