pxengine 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +175 -0
- package/config/tailwind-preset.js +106 -0
- package/dist/index.d.mts +1259 -0
- package/dist/index.d.ts +1259 -0
- package/dist/index.js +5175 -0
- package/dist/index.mjs +4929 -0
- package/package.json +94 -0
- package/src/atoms/AccordionAtom.tsx +44 -0
- package/src/atoms/AlertAtom.tsx +46 -0
- package/src/atoms/AlertDialogAtom.tsx +66 -0
- package/src/atoms/AspectRatioAtom.tsx +27 -0
- package/src/atoms/AvatarAtom.tsx +20 -0
- package/src/atoms/BadgeAtom.tsx +25 -0
- package/src/atoms/BreadcrumbAtom.tsx +36 -0
- package/src/atoms/ButtonAtom.tsx +63 -0
- package/src/atoms/CalendarAtom.tsx +24 -0
- package/src/atoms/CardAtom.tsx +64 -0
- package/src/atoms/CarouselAtom.tsx +40 -0
- package/src/atoms/CollapsibleAtom.tsx +44 -0
- package/src/atoms/CommandAtom.tsx +46 -0
- package/src/atoms/DialogAtom.tsx +68 -0
- package/src/atoms/InputAtom.tsx +162 -0
- package/src/atoms/LayoutAtom.tsx +43 -0
- package/src/atoms/PaginationAtom.tsx +49 -0
- package/src/atoms/PopoverAtom.tsx +40 -0
- package/src/atoms/ProgressAtom.tsx +15 -0
- package/src/atoms/ScrollAreaAtom.tsx +31 -0
- package/src/atoms/SeparatorAtom.tsx +16 -0
- package/src/atoms/SheetAtom.tsx +72 -0
- package/src/atoms/SkeletonAtom.tsx +22 -0
- package/src/atoms/SpinnerAtom.tsx +26 -0
- package/src/atoms/TableAtom.tsx +58 -0
- package/src/atoms/TabsAtom.tsx +40 -0
- package/src/atoms/TextAtom.tsx +35 -0
- package/src/atoms/TooltipAtom.tsx +39 -0
- package/src/atoms/index.ts +28 -0
- package/src/components/index.ts +178 -0
- package/src/components/ui/accordion.tsx +56 -0
- package/src/components/ui/alert-dialog.tsx +139 -0
- package/src/components/ui/alert.tsx +59 -0
- package/src/components/ui/aspect-ratio.tsx +5 -0
- package/src/components/ui/avatar.tsx +50 -0
- package/src/components/ui/badge.tsx +36 -0
- package/src/components/ui/breadcrumb.tsx +115 -0
- package/src/components/ui/button-group.tsx +83 -0
- package/src/components/ui/button.tsx +56 -0
- package/src/components/ui/calendar.tsx +213 -0
- package/src/components/ui/card.tsx +79 -0
- package/src/components/ui/carousel.tsx +260 -0
- package/src/components/ui/chart.tsx +367 -0
- package/src/components/ui/checkbox.tsx +28 -0
- package/src/components/ui/collapsible.tsx +11 -0
- package/src/components/ui/command.tsx +153 -0
- package/src/components/ui/context-menu.tsx +198 -0
- package/src/components/ui/dialog.tsx +122 -0
- package/src/components/ui/drawer.tsx +116 -0
- package/src/components/ui/dropdown-menu.tsx +200 -0
- package/src/components/ui/empty.tsx +104 -0
- package/src/components/ui/field.tsx +244 -0
- package/src/components/ui/form.tsx +176 -0
- package/src/components/ui/hover-card.tsx +27 -0
- package/src/components/ui/input-group.tsx +168 -0
- package/src/components/ui/input-otp.tsx +69 -0
- package/src/components/ui/input.tsx +22 -0
- package/src/components/ui/item.tsx +193 -0
- package/src/components/ui/kbd.tsx +28 -0
- package/src/components/ui/label.tsx +26 -0
- package/src/components/ui/menubar.tsx +254 -0
- package/src/components/ui/navigation-menu.tsx +128 -0
- package/src/components/ui/pagination.tsx +117 -0
- package/src/components/ui/popover.tsx +29 -0
- package/src/components/ui/progress.tsx +28 -0
- package/src/components/ui/radio-group.tsx +42 -0
- package/src/components/ui/resizable.tsx +45 -0
- package/src/components/ui/scroll-area.tsx +46 -0
- package/src/components/ui/select.tsx +160 -0
- package/src/components/ui/separator.tsx +29 -0
- package/src/components/ui/sheet.tsx +140 -0
- package/src/components/ui/sidebar.tsx +771 -0
- package/src/components/ui/skeleton.tsx +15 -0
- package/src/components/ui/slider.tsx +26 -0
- package/src/components/ui/sonner.tsx +45 -0
- package/src/components/ui/spinner.tsx +16 -0
- package/src/components/ui/switch.tsx +27 -0
- package/src/components/ui/table.tsx +117 -0
- package/src/components/ui/tabs.tsx +53 -0
- package/src/components/ui/textarea.tsx +22 -0
- package/src/components/ui/toggle-group.tsx +61 -0
- package/src/components/ui/toggle.tsx +43 -0
- package/src/components/ui/tooltip.tsx +30 -0
- package/src/hooks/use-mobile.tsx +19 -0
- package/src/index.ts +24 -0
- package/src/lib/countries.ts +203 -0
- package/src/lib/index.ts +2 -0
- package/src/lib/utils.ts +15 -0
- package/src/lib/validators/index.ts +1 -0
- package/src/lib/validators/theme.ts +148 -0
- package/src/molecules/creator-discovery/CampaignSeedCard/CampaignSeedCard.tsx +123 -0
- package/src/molecules/creator-discovery/CampaignSeedCard/CampaignSeedCard.types.ts +13 -0
- package/src/molecules/creator-discovery/CampaignSeedCard/index.ts +2 -0
- package/src/molecules/creator-discovery/MCQCard/MCQCard.tsx +165 -0
- package/src/molecules/creator-discovery/MCQCard/MCQCard.types.ts +71 -0
- package/src/molecules/creator-discovery/MCQCard/index.ts +2 -0
- package/src/molecules/creator-discovery/SearchSpecCard/CustomFieldRenderers.tsx +334 -0
- package/src/molecules/creator-discovery/SearchSpecCard/SearchSpecCard.tsx +111 -0
- package/src/molecules/creator-discovery/SearchSpecCard/SearchSpecCard.types.ts +18 -0
- package/src/molecules/creator-discovery/SearchSpecCard/index.ts +3 -0
- package/src/molecules/creator-discovery/index.ts +3 -0
- package/src/molecules/generic/ActionButton/ActionButton.tsx +137 -0
- package/src/molecules/generic/ActionButton/ActionButton.types.ts +68 -0
- package/src/molecules/generic/ActionButton/index.ts +2 -0
- package/src/molecules/generic/EditableField/EditableField.tsx +229 -0
- package/src/molecules/generic/EditableField/EditableField.types.ts +73 -0
- package/src/molecules/generic/EditableField/index.ts +2 -0
- package/src/molecules/generic/FormCard/FormCard.tsx +136 -0
- package/src/molecules/generic/FormCard/FormCard.types.ts +93 -0
- package/src/molecules/generic/FormCard/index.ts +2 -0
- package/src/molecules/generic/index.ts +3 -0
- package/src/molecules/index.ts +2 -0
- package/src/render/PXEngineRenderer.tsx +272 -0
- package/src/render/index.ts +1 -0
- package/src/styles/globals.css +146 -0
- package/src/types/atoms.ts +294 -0
- package/src/types/common.ts +116 -0
- package/src/types/index.ts +3 -0
- package/src/types/molecules.ts +54 -0
- package/src/types/schema.ts +12 -0
package/README.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# @pxengine-ui
|
|
2
|
+
|
|
3
|
+
> **Shadcn-based UI component library for agent-driven interfaces**
|
|
4
|
+
|
|
5
|
+
A standalone UI component library built on top of shadcn/ui, designed specifically for agent-driven user interfaces. Components follow Atomic Design principles and are distributed via copy-paste (shadcn-style).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
`@pxengine-ui` is a component library that:
|
|
12
|
+
|
|
13
|
+
- **Builds on shadcn/ui** - Uses shadcn components as atoms (base layer)
|
|
14
|
+
- **Follows Atomic Design** - Atoms (shadcn) → Molecules → Organisms
|
|
15
|
+
- **Agent-First** - Designed for schema-driven, agent-generated UIs
|
|
16
|
+
- **Copy-Paste Distribution** - Like shadcn, components are copied into your project
|
|
17
|
+
- **TypeScript-First** - Full type safety across the stack
|
|
18
|
+
- **Theme-Aware** - Inherits from your existing theme system
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Documentation
|
|
23
|
+
|
|
24
|
+
- **[Architecture](./docs/architecture.md)** - System design, folder structure, design decisions
|
|
25
|
+
- **[Conventions](./docs/conventions.md)** - Naming, coding standards, best practices
|
|
26
|
+
- **[Getting Started](./docs/getting-started.md)** - Setup and usage guide
|
|
27
|
+
- **[Component Catalog](./docs/component-catalog.md)** - Visual reference for all components
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Structure
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
@pxengine-ui/
|
|
35
|
+
├── docs/ # Documentation
|
|
36
|
+
├── src/
|
|
37
|
+
│ ├── atoms/ # Shadcn components (base layer)
|
|
38
|
+
│ ├── molecules/ # Composed components
|
|
39
|
+
│ │ ├── creator-discovery/ # Domain-specific
|
|
40
|
+
│ │ └── generic/ # Reusable
|
|
41
|
+
│ ├── lib/ # Utilities
|
|
42
|
+
│ ├── types/ # Shared types
|
|
43
|
+
│ └── index.ts
|
|
44
|
+
├── config/ # Tailwind preset, tsconfig
|
|
45
|
+
└── package.json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Component Hierarchy
|
|
51
|
+
|
|
52
|
+
### **Atoms** (Shadcn Components)
|
|
53
|
+
|
|
54
|
+
Base UI primitives from shadcn/ui:
|
|
55
|
+
|
|
56
|
+
- Button, Input, Label, Checkbox, Select, Slider, Card, etc.
|
|
57
|
+
- Fully accessible (Radix UI primitives)
|
|
58
|
+
- Styled with Tailwind CSS
|
|
59
|
+
|
|
60
|
+
### **Molecules** (Composed Components)
|
|
61
|
+
|
|
62
|
+
Built by combining atoms:
|
|
63
|
+
|
|
64
|
+
- **Creator Discovery**: CampaignSeedCard, SearchSpecCard, MCQRenderer
|
|
65
|
+
- **Generic**: EditableField, FormCard, ActionButton
|
|
66
|
+
|
|
67
|
+
### **Organisms** (Complex Sections)
|
|
68
|
+
|
|
69
|
+
Full UI sections (future):
|
|
70
|
+
|
|
71
|
+
- CreatorSearchWorkflow, CampaignBuilder, etc.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Quick Start
|
|
76
|
+
|
|
77
|
+
### 1. Install Dependencies
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
cd @pxengine-ui
|
|
81
|
+
npm install
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 2. Copy a Component
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Copy shadcn button atom
|
|
88
|
+
npx shadcn-ui@latest add button
|
|
89
|
+
|
|
90
|
+
# Copy a molecule (future CLI)
|
|
91
|
+
npx pxengine-ui add campaign-seed-card
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 3. Use in Your App
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { CampaignSeedCard } from "@/components/pxengine-ui/molecules/CampaignSeedCard";
|
|
98
|
+
|
|
99
|
+
<CampaignSeedCard
|
|
100
|
+
data={campaignSeed}
|
|
101
|
+
sessionId="abc123"
|
|
102
|
+
onProceed={() => handleProceed()}
|
|
103
|
+
/>;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Distribution Strategy
|
|
109
|
+
|
|
110
|
+
**Shadcn-Style Copy-Paste**:
|
|
111
|
+
|
|
112
|
+
1. Components live in `@pxengine-ui/src/`
|
|
113
|
+
2. Copy components into `client/components/pxengine-ui/` when needed
|
|
114
|
+
3. Modify copied components freely
|
|
115
|
+
4. Library serves as source of truth for updates
|
|
116
|
+
|
|
117
|
+
**Benefits**:
|
|
118
|
+
|
|
119
|
+
- Full ownership and customization
|
|
120
|
+
- No version conflicts
|
|
121
|
+
- Tree-shaking (only copy what you need)
|
|
122
|
+
- Easy to debug
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Theme System
|
|
127
|
+
|
|
128
|
+
The library inherits your existing theme:
|
|
129
|
+
|
|
130
|
+
- Uses CSS variables from client
|
|
131
|
+
- Tailwind preset extends client config
|
|
132
|
+
- Dark mode support via `class` strategy
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Component Examples
|
|
137
|
+
|
|
138
|
+
### CampaignSeedCard
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
<CampaignSeedCard
|
|
142
|
+
data={{
|
|
143
|
+
brand: "Nike",
|
|
144
|
+
objective: "Brand Awareness",
|
|
145
|
+
budget_hint: { min: 50000, max: 100000 },
|
|
146
|
+
}}
|
|
147
|
+
sessionId="abc123"
|
|
148
|
+
onProceed={() => handleProceed()}
|
|
149
|
+
isLatestMessage={true}
|
|
150
|
+
/>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### EditableField
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
<EditableField
|
|
157
|
+
label="Brand Name"
|
|
158
|
+
value={brandName}
|
|
159
|
+
type="text"
|
|
160
|
+
isEditing={isEditing}
|
|
161
|
+
onSave={(newValue) => handleSave(newValue)}
|
|
162
|
+
/>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Tech Stack
|
|
168
|
+
|
|
169
|
+
- **React** 18+ with TypeScript
|
|
170
|
+
- **Shadcn/ui** for base components (atoms)
|
|
171
|
+
- **Radix UI** for accessibility primitives
|
|
172
|
+
- **Tailwind CSS** for styling
|
|
173
|
+
- **Framer Motion** for animations (optional)
|
|
174
|
+
|
|
175
|
+
---
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @pxengine/ui Tailwind Preset
|
|
3
|
+
*
|
|
4
|
+
* This file allows consumers of the @pxengine/ui library to easily inherit
|
|
5
|
+
* the custom theme, colors, and animations required for the components.
|
|
6
|
+
*
|
|
7
|
+
* Usage in tailwind.config.js:
|
|
8
|
+
* presets: [require("@pxengine/ui/config/tailwind-preset")]
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
theme: {
|
|
13
|
+
container: {
|
|
14
|
+
center: true,
|
|
15
|
+
padding: "2rem",
|
|
16
|
+
screens: {
|
|
17
|
+
"2xl": "1400px",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
extend: {
|
|
21
|
+
fontFamily: {
|
|
22
|
+
sans: ["Inter", "system-ui", "sans-serif"],
|
|
23
|
+
noto: ["Noto Sans", "system-ui", "sans-serif"],
|
|
24
|
+
grotesk: ["Space Grotesk", "system-ui", "sans-serif"],
|
|
25
|
+
roboto: ["Roboto", "system-ui", "sans-serif"],
|
|
26
|
+
},
|
|
27
|
+
colors: {
|
|
28
|
+
border: "hsl(var(--border))",
|
|
29
|
+
input: "hsl(var(--input))",
|
|
30
|
+
ring: "hsl(var(--ring))",
|
|
31
|
+
background: "hsl(var(--background))",
|
|
32
|
+
foreground: "hsl(var(--foreground))",
|
|
33
|
+
primary: {
|
|
34
|
+
DEFAULT: "hsl(var(--primary))",
|
|
35
|
+
foreground: "hsl(var(--primary-foreground))",
|
|
36
|
+
},
|
|
37
|
+
secondary: {
|
|
38
|
+
DEFAULT: "hsl(var(--secondary))",
|
|
39
|
+
foreground: "hsl(var(--secondary-foreground))",
|
|
40
|
+
},
|
|
41
|
+
destructive: {
|
|
42
|
+
DEFAULT: "hsl(var(--destructive))",
|
|
43
|
+
foreground: "hsl(var(--destructive-foreground))",
|
|
44
|
+
},
|
|
45
|
+
muted: {
|
|
46
|
+
DEFAULT: "hsl(var(--muted))",
|
|
47
|
+
foreground: "hsl(var(--muted-foreground))",
|
|
48
|
+
},
|
|
49
|
+
accent: {
|
|
50
|
+
DEFAULT: "hsl(var(--accent))",
|
|
51
|
+
foreground: "hsl(var(--accent-foreground))",
|
|
52
|
+
},
|
|
53
|
+
popover: {
|
|
54
|
+
DEFAULT: "hsl(var(--popover))",
|
|
55
|
+
foreground: "hsl(var(--popover-foreground))",
|
|
56
|
+
},
|
|
57
|
+
card: {
|
|
58
|
+
DEFAULT: "hsl(var(--card))",
|
|
59
|
+
foreground: "hsl(var(--card-foreground))",
|
|
60
|
+
},
|
|
61
|
+
// Custom PXEngine colors
|
|
62
|
+
gray25: "var(--gray25)",
|
|
63
|
+
gray50: "var(--gray50)",
|
|
64
|
+
gray100: "var(--gray100)",
|
|
65
|
+
gray200: "var(--gray200)",
|
|
66
|
+
gray300: "var(--gray300)",
|
|
67
|
+
gray400: "var(--gray400)",
|
|
68
|
+
gray500: "var(--gray500)",
|
|
69
|
+
gray600: "var(--gray600)",
|
|
70
|
+
gray700: "var(--gray700)",
|
|
71
|
+
gray800: "var(--gray800)",
|
|
72
|
+
gray900: "var(--gray900)",
|
|
73
|
+
purple100: "var(--purple100)",
|
|
74
|
+
purple200: "var(--purple200)",
|
|
75
|
+
purple500: "var(--purple500)",
|
|
76
|
+
purpleText: "var(--purple-text)",
|
|
77
|
+
purple50: "var(--purple50)",
|
|
78
|
+
purple20: "var(--purple20)",
|
|
79
|
+
purpleBorder: "var(--purple-border)",
|
|
80
|
+
purpleLight: "var(--purpleLight)",
|
|
81
|
+
purpleText1: "var(--purple-text-1)",
|
|
82
|
+
purpleText2: "var(--purple-text-2)",
|
|
83
|
+
},
|
|
84
|
+
borderRadius: {
|
|
85
|
+
lg: "var(--radius)",
|
|
86
|
+
md: "calc(var(--radius) - 2px)",
|
|
87
|
+
sm: "calc(var(--radius) - 4px)",
|
|
88
|
+
},
|
|
89
|
+
keyframes: {
|
|
90
|
+
"accordion-down": {
|
|
91
|
+
from: { height: "0" },
|
|
92
|
+
to: { height: "var(--radix-accordion-content-height)" },
|
|
93
|
+
},
|
|
94
|
+
"accordion-up": {
|
|
95
|
+
from: { height: "var(--radix-accordion-content-height)" },
|
|
96
|
+
to: { height: "0" },
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
animation: {
|
|
100
|
+
"accordion-down": "accordion-down 0.2s ease-out",
|
|
101
|
+
"accordion-up": "accordion-up 0.2s ease-out",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
plugins: [require("tailwindcss-animate")],
|
|
106
|
+
};
|