shadcn-phlex 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.
- checksums.yaml +7 -0
- data/README.md +195 -0
- data/app.css +20 -0
- data/css/shadcn-source.css +3 -0
- data/css/shadcn-tailwind.css +160 -0
- data/css/themes/mauve.css +62 -0
- data/css/themes/mist.css +62 -0
- data/css/themes/neutral.css +74 -0
- data/css/themes/olive.css +62 -0
- data/css/themes/stone.css +62 -0
- data/css/themes/taupe.css +62 -0
- data/css/themes/zinc.css +62 -0
- data/js/controllers/accordion_controller.js +135 -0
- data/js/controllers/checkbox_controller.js +52 -0
- data/js/controllers/collapsible_controller.js +85 -0
- data/js/controllers/combobox_controller.js +168 -0
- data/js/controllers/command_controller.js +171 -0
- data/js/controllers/context_menu_controller.js +132 -0
- data/js/controllers/dark_mode_controller.js +106 -0
- data/js/controllers/dialog_controller.js +205 -0
- data/js/controllers/drawer_controller.js +161 -0
- data/js/controllers/dropdown_menu_controller.js +189 -0
- data/js/controllers/hover_card_controller.js +85 -0
- data/js/controllers/index.js +89 -0
- data/js/controllers/menubar_controller.js +171 -0
- data/js/controllers/navigation_menu_controller.js +160 -0
- data/js/controllers/popover_controller.js +151 -0
- data/js/controllers/radio_group_controller.js +78 -0
- data/js/controllers/scroll_area_controller.js +117 -0
- data/js/controllers/select_controller.js +198 -0
- data/js/controllers/sheet_controller.js +130 -0
- data/js/controllers/slider_controller.js +142 -0
- data/js/controllers/switch_controller.js +40 -0
- data/js/controllers/tabs_controller.js +96 -0
- data/js/controllers/toast_controller.js +206 -0
- data/js/controllers/toggle_controller.js +30 -0
- data/js/controllers/toggle_group_controller.js +73 -0
- data/js/controllers/tooltip_controller.js +146 -0
- data/lib/generators/shadcn_phlex/component_generator.rb +79 -0
- data/lib/generators/shadcn_phlex/install_generator.rb +217 -0
- data/lib/shadcn/base.rb +27 -0
- data/lib/shadcn/engine.rb +24 -0
- data/lib/shadcn/kit.rb +1158 -0
- data/lib/shadcn/themes/accent_colors.rb +106 -0
- data/lib/shadcn/themes/base_colors.rb +313 -0
- data/lib/shadcn/ui/accordion.rb +135 -0
- data/lib/shadcn/ui/alert.rb +79 -0
- data/lib/shadcn/ui/alert_dialog.rb +220 -0
- data/lib/shadcn/ui/aspect_ratio.rb +35 -0
- data/lib/shadcn/ui/avatar.rb +134 -0
- data/lib/shadcn/ui/badge.rb +48 -0
- data/lib/shadcn/ui/breadcrumb.rb +180 -0
- data/lib/shadcn/ui/button.rb +63 -0
- data/lib/shadcn/ui/button_group.rb +58 -0
- data/lib/shadcn/ui/card.rb +133 -0
- data/lib/shadcn/ui/checkbox.rb +72 -0
- data/lib/shadcn/ui/collapsible.rb +76 -0
- data/lib/shadcn/ui/combobox.rb +229 -0
- data/lib/shadcn/ui/command.rb +256 -0
- data/lib/shadcn/ui/context_menu.rb +319 -0
- data/lib/shadcn/ui/dialog.rb +226 -0
- data/lib/shadcn/ui/direction.rb +23 -0
- data/lib/shadcn/ui/drawer.rb +217 -0
- data/lib/shadcn/ui/dropdown_menu.rb +384 -0
- data/lib/shadcn/ui/empty.rb +97 -0
- data/lib/shadcn/ui/field.rb +126 -0
- data/lib/shadcn/ui/hover_card.rb +75 -0
- data/lib/shadcn/ui/input.rb +36 -0
- data/lib/shadcn/ui/input_group.rb +32 -0
- data/lib/shadcn/ui/input_otp.rb +112 -0
- data/lib/shadcn/ui/item.rb +115 -0
- data/lib/shadcn/ui/kbd.rb +45 -0
- data/lib/shadcn/ui/label.rb +28 -0
- data/lib/shadcn/ui/menubar.rb +345 -0
- data/lib/shadcn/ui/native_select.rb +31 -0
- data/lib/shadcn/ui/navigation_menu.rb +238 -0
- data/lib/shadcn/ui/pagination.rb +224 -0
- data/lib/shadcn/ui/popover.rb +147 -0
- data/lib/shadcn/ui/progress.rb +40 -0
- data/lib/shadcn/ui/radio_group.rb +92 -0
- data/lib/shadcn/ui/resizable.rb +108 -0
- data/lib/shadcn/ui/scroll_area.rb +75 -0
- data/lib/shadcn/ui/select.rb +235 -0
- data/lib/shadcn/ui/separator.rb +36 -0
- data/lib/shadcn/ui/sheet.rb +231 -0
- data/lib/shadcn/ui/sidebar.rb +420 -0
- data/lib/shadcn/ui/skeleton.rb +23 -0
- data/lib/shadcn/ui/slider.rb +72 -0
- data/lib/shadcn/ui/sonner.rb +177 -0
- data/lib/shadcn/ui/spinner.rb +58 -0
- data/lib/shadcn/ui/switch.rb +75 -0
- data/lib/shadcn/ui/table.rb +154 -0
- data/lib/shadcn/ui/tabs.rb +154 -0
- data/lib/shadcn/ui/text_field.rb +146 -0
- data/lib/shadcn/ui/textarea.rb +32 -0
- data/lib/shadcn/ui/theme_toggle.rb +74 -0
- data/lib/shadcn/ui/toggle.rb +66 -0
- data/lib/shadcn/ui/toggle_group.rb +75 -0
- data/lib/shadcn/ui/tooltip.rb +78 -0
- data/lib/shadcn/ui/typography.rb +217 -0
- data/lib/shadcn/version.rb +5 -0
- data/lib/shadcn-phlex.rb +6 -0
- data/lib/shadcn.rb +80 -0
- data/package.json +14 -0
- data/skills/shadcn-phlex/SKILL.md +190 -0
- data/skills/shadcn-phlex/evals/evals.json +90 -0
- data/skills/shadcn-phlex/references/component-catalog.md +355 -0
- data/skills/shadcn-phlex/rules/composition.md +235 -0
- data/skills/shadcn-phlex/rules/forms.md +151 -0
- data/skills/shadcn-phlex/rules/helpers.md +54 -0
- data/skills/shadcn-phlex/rules/stimulus.md +61 -0
- data/skills/shadcn-phlex/rules/styling.md +177 -0
- metadata +209 -0
data/lib/shadcn.rb
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "phlex"
|
|
4
|
+
require "class_variants"
|
|
5
|
+
require "tailwind_merge"
|
|
6
|
+
|
|
7
|
+
require_relative "shadcn/version"
|
|
8
|
+
require_relative "shadcn/base"
|
|
9
|
+
|
|
10
|
+
# UI Components
|
|
11
|
+
require_relative "shadcn/ui/accordion"
|
|
12
|
+
require_relative "shadcn/ui/alert"
|
|
13
|
+
require_relative "shadcn/ui/alert_dialog"
|
|
14
|
+
require_relative "shadcn/ui/aspect_ratio"
|
|
15
|
+
require_relative "shadcn/ui/avatar"
|
|
16
|
+
require_relative "shadcn/ui/badge"
|
|
17
|
+
require_relative "shadcn/ui/breadcrumb"
|
|
18
|
+
require_relative "shadcn/ui/button"
|
|
19
|
+
require_relative "shadcn/ui/button_group"
|
|
20
|
+
require_relative "shadcn/ui/card"
|
|
21
|
+
require_relative "shadcn/ui/checkbox"
|
|
22
|
+
require_relative "shadcn/ui/collapsible"
|
|
23
|
+
require_relative "shadcn/ui/command"
|
|
24
|
+
require_relative "shadcn/ui/combobox"
|
|
25
|
+
require_relative "shadcn/ui/context_menu"
|
|
26
|
+
require_relative "shadcn/ui/dialog"
|
|
27
|
+
require_relative "shadcn/ui/direction"
|
|
28
|
+
require_relative "shadcn/ui/drawer"
|
|
29
|
+
require_relative "shadcn/ui/dropdown_menu"
|
|
30
|
+
require_relative "shadcn/ui/empty"
|
|
31
|
+
require_relative "shadcn/ui/field"
|
|
32
|
+
require_relative "shadcn/ui/hover_card"
|
|
33
|
+
require_relative "shadcn/ui/input"
|
|
34
|
+
require_relative "shadcn/ui/input_group"
|
|
35
|
+
require_relative "shadcn/ui/input_otp"
|
|
36
|
+
require_relative "shadcn/ui/item"
|
|
37
|
+
require_relative "shadcn/ui/kbd"
|
|
38
|
+
require_relative "shadcn/ui/label"
|
|
39
|
+
require_relative "shadcn/ui/menubar"
|
|
40
|
+
require_relative "shadcn/ui/native_select"
|
|
41
|
+
require_relative "shadcn/ui/navigation_menu"
|
|
42
|
+
require_relative "shadcn/ui/pagination"
|
|
43
|
+
require_relative "shadcn/ui/popover"
|
|
44
|
+
require_relative "shadcn/ui/progress"
|
|
45
|
+
require_relative "shadcn/ui/radio_group"
|
|
46
|
+
require_relative "shadcn/ui/resizable"
|
|
47
|
+
require_relative "shadcn/ui/scroll_area"
|
|
48
|
+
require_relative "shadcn/ui/select"
|
|
49
|
+
require_relative "shadcn/ui/separator"
|
|
50
|
+
require_relative "shadcn/ui/sheet"
|
|
51
|
+
require_relative "shadcn/ui/sidebar"
|
|
52
|
+
require_relative "shadcn/ui/skeleton"
|
|
53
|
+
require_relative "shadcn/ui/slider"
|
|
54
|
+
require_relative "shadcn/ui/sonner"
|
|
55
|
+
require_relative "shadcn/ui/spinner"
|
|
56
|
+
require_relative "shadcn/ui/switch"
|
|
57
|
+
require_relative "shadcn/ui/table"
|
|
58
|
+
require_relative "shadcn/ui/tabs"
|
|
59
|
+
require_relative "shadcn/ui/textarea"
|
|
60
|
+
require_relative "shadcn/ui/toggle"
|
|
61
|
+
require_relative "shadcn/ui/toggle_group"
|
|
62
|
+
require_relative "shadcn/ui/tooltip"
|
|
63
|
+
require_relative "shadcn/ui/typography"
|
|
64
|
+
require_relative "shadcn/ui/theme_toggle"
|
|
65
|
+
require_relative "shadcn/ui/text_field"
|
|
66
|
+
|
|
67
|
+
# Kit module (short helpers)
|
|
68
|
+
require_relative "shadcn/kit"
|
|
69
|
+
|
|
70
|
+
# Theme system
|
|
71
|
+
require_relative "shadcn/themes/base_colors"
|
|
72
|
+
require_relative "shadcn/themes/accent_colors"
|
|
73
|
+
|
|
74
|
+
# Rails engine (loaded conditionally)
|
|
75
|
+
require_relative "shadcn/engine" if defined?(Rails::Engine)
|
|
76
|
+
|
|
77
|
+
module Shadcn
|
|
78
|
+
module UI
|
|
79
|
+
end
|
|
80
|
+
end
|
data/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "shadcn-phlex",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Complete shadcn/ui component library for Phlex Rails with Stimulus controllers",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "js/controllers/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./js/controllers/index.js",
|
|
9
|
+
"./controllers/*": "./js/controllers/*"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@hotwired/stimulus": "^3.2.0"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: shadcn-phlex
|
|
3
|
+
description: Build UIs with shadcn-phlex — the complete shadcn/ui component library for Phlex Rails. Provides component APIs, composition patterns, form integration, theming, Stimulus controller wiring, and best practices for building Rails views with Phlex components that match shadcn/ui exactly. Applies when working with Phlex views, shadcn-phlex components, or any project with shadcn-phlex in the Gemfile.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
license: MIT
|
|
6
|
+
compatibility: Claude Code 1.0+, Cursor, Windsurf, Cline, Copilot
|
|
7
|
+
allowed-tools: Bash(bundle *) Bash(ruby *) Read Write Edit Glob Grep
|
|
8
|
+
metadata:
|
|
9
|
+
author: shadcn-phlex
|
|
10
|
+
version: "0.1.0"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# shadcn-phlex
|
|
14
|
+
|
|
15
|
+
A complete port of shadcn/ui to Phlex for Ruby on Rails. Components are used directly from the gem or copied into the project via generators. All interactive components include Stimulus controllers that replicate Radix UI behavior.
|
|
16
|
+
|
|
17
|
+
> **IMPORTANT:** All components use `ui_*` Kit helper methods when `Shadcn::Kit` is included. Examples below use Kit helpers. Without Kit, use `render Shadcn::UI::ComponentName.new(**attrs) { block }`.
|
|
18
|
+
|
|
19
|
+
## Current Project Context
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Check installation and configuration
|
|
23
|
+
grep "shadcn-phlex" Gemfile
|
|
24
|
+
ls app/components/shadcn/ui/ 2>/dev/null || echo "Using gem directly"
|
|
25
|
+
cat app/assets/stylesheets/shadcn-theme.css 2>/dev/null
|
|
26
|
+
grep "Shadcn::Kit" app/views/application_view.rb app/components/application_component.rb 2>/dev/null
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Principles
|
|
30
|
+
|
|
31
|
+
1. **Use existing components first.** Check the component catalog below before writing custom markup. Use `Separator` not `<hr>`, `Skeleton` not manual pulse divs, `Badge` not styled spans.
|
|
32
|
+
2. **Compose, don't reinvent.** Settings page = Tabs + Card + TextField. Dashboard = Sidebar + Card + Table.
|
|
33
|
+
3. **Use built-in variants before custom classes.** `variant: :outline`, `size: :sm`, etc.
|
|
34
|
+
4. **Use semantic colors.** `bg-primary`, `text-muted-foreground` — never raw values like `bg-blue-500`.
|
|
35
|
+
5. **Kit helpers always.** `ui_button { "Click" }` not `render Shadcn::UI::Button.new { "Click" }`.
|
|
36
|
+
|
|
37
|
+
## Critical Rules
|
|
38
|
+
|
|
39
|
+
These rules are **always enforced**. Each links to a file with Incorrect/Correct code pairs.
|
|
40
|
+
|
|
41
|
+
### Styling & Tailwind → [styling.md](./rules/styling.md)
|
|
42
|
+
|
|
43
|
+
- **`class:` for layout, not styling.** Never override component colors or typography.
|
|
44
|
+
- **No `space-x-*` or `space-y-*`.** Use `flex` with `gap-*`. For vertical stacks, `div(class: "flex flex-col gap-4")`.
|
|
45
|
+
- **Use `size-*` when width and height are equal.** `size-10` not `w-10 h-10`.
|
|
46
|
+
- **Use `truncate` shorthand.** Not `overflow-hidden text-ellipsis whitespace-nowrap`.
|
|
47
|
+
- **No manual `dark:` color overrides.** Use semantic tokens (`bg-background`, `text-muted-foreground`).
|
|
48
|
+
- **Use `cn()` in custom components.** Inherit from `Shadcn::Base` to get the `cn()` helper for conditional classes.
|
|
49
|
+
- **No manual `z-index` on overlay components.** Dialog, Sheet, Popover, etc. handle their own stacking.
|
|
50
|
+
|
|
51
|
+
### Forms & Inputs → [forms.md](./rules/forms.md)
|
|
52
|
+
|
|
53
|
+
- **Use `TextField`/`TextareaField` for common fields.** One-liner instead of manual Field + Label + Input + FieldError.
|
|
54
|
+
- **Form controls need `name:` for submission.** Checkbox, Switch, Select, RadioGroup, Slider, Combobox are purely visual without it.
|
|
55
|
+
- **`Fieldset` + `FieldsetLegend` for grouping related checkboxes/radios.** Not a div with a heading.
|
|
56
|
+
- **Option sets (2–7 choices) use `ToggleGroup`.** Don't loop `Button` with manual active state.
|
|
57
|
+
- **Validation: pass `error:` to TextField** or set `aria_invalid: true` on the control + `data_disabled: true` on Field.
|
|
58
|
+
|
|
59
|
+
### Component Structure → [composition.md](./rules/composition.md)
|
|
60
|
+
|
|
61
|
+
- **Items always inside their parent.** `SelectItem` inside `SelectContent`. `DropdownMenuItem` inside `DropdownMenuContent`. `CommandItem` inside `CommandGroup`.
|
|
62
|
+
- **Dialog, Sheet, and Drawer always need a Title.** `DialogTitle`, `SheetTitle`, `DrawerTitle` required for accessibility. Use `class: "sr-only"` if visually hidden.
|
|
63
|
+
- **Use components instead of custom markup.** `Alert` for callouts, `Empty` for blank states, `Separator` instead of `hr`, `Skeleton` for loading, `Badge` not styled spans.
|
|
64
|
+
- **Button has no loading prop.** Compose with `Spinner` and `disabled:`.
|
|
65
|
+
|
|
66
|
+
### Stimulus → [stimulus.md](./rules/stimulus.md)
|
|
67
|
+
|
|
68
|
+
- **Never manually add `data-controller`, `data-action`, or `data-*-target`.** Components wire Stimulus automatically.
|
|
69
|
+
- **All 24 interactive components are pre-wired.** Just use the components.
|
|
70
|
+
|
|
71
|
+
## Component Selection
|
|
72
|
+
|
|
73
|
+
| Need | Components |
|
|
74
|
+
|------|-----------|
|
|
75
|
+
| **Button/Action** | `Button`, `ButtonGroup`, `Toggle`, `ToggleGroup` |
|
|
76
|
+
| **Form field** | `TextField` / `TextareaField` (compound), or `Field` + `Label` + `Input`/`Textarea` + `FieldError` (manual) |
|
|
77
|
+
| **Selection** | `Checkbox`, `Switch`, `RadioGroup`, `Select`, `Combobox` |
|
|
78
|
+
| **Toggle between few options** | `ToggleGroup` + `ToggleGroupItem` |
|
|
79
|
+
| **Card/Container** | `Card` + `CardHeader`/`CardTitle`/`CardContent`/`CardFooter` |
|
|
80
|
+
| **Dialog/Modal** | `Dialog` (closes on overlay click) or `AlertDialog` (does not) |
|
|
81
|
+
| **Slide panel** | `Sheet` + `SheetContent(side: :right)` |
|
|
82
|
+
| **Bottom drawer** | `Drawer` + `DrawerContent` |
|
|
83
|
+
| **Dropdown** | `DropdownMenu` + trigger + content + items |
|
|
84
|
+
| **Right-click** | `ContextMenu` + trigger + content + items |
|
|
85
|
+
| **Tabs** | `Tabs` + `TabsList` + `TabsTrigger` + `TabsContent` |
|
|
86
|
+
| **Accordion** | `Accordion` + `AccordionItem` + trigger + content |
|
|
87
|
+
| **Feedback** | `Alert`, `Badge`, `Progress`, `Skeleton`, `Spinner`, `Toaster`/`Toast` |
|
|
88
|
+
| **Tooltip** | `Tooltip` + `TooltipTrigger` + `TooltipContent` |
|
|
89
|
+
| **Popover** | `Popover` + `PopoverTrigger` + `PopoverContent` |
|
|
90
|
+
| **Hover info** | `HoverCard` + `HoverCardTrigger` + `HoverCardContent` |
|
|
91
|
+
| **Table** | `Table` + `TableHeader`/`TableBody`/`TableRow`/`TableHead`/`TableCell` |
|
|
92
|
+
| **Navigation** | `Breadcrumb`, `Pagination`, `NavigationMenu`, `Menubar`, `Sidebar` |
|
|
93
|
+
| **Data display** | `Avatar`, `Kbd`, `Empty`, `Item`, `Separator` |
|
|
94
|
+
| **Theme** | `ThemeToggle` for dark mode |
|
|
95
|
+
| **Command palette** | `Command` + `CommandDialog` + `CommandInput` + `CommandList` + `CommandGroup` + `CommandItem` |
|
|
96
|
+
| **Loading state** | Use `Skeleton` for content placeholders, `Spinner` for inline loading |
|
|
97
|
+
| **Callout/Banner** | `Alert` + `AlertTitle` + `AlertDescription` (not a custom div) |
|
|
98
|
+
| **Empty state** | `Empty` + `EmptyMedia` + `EmptyTitle` + `EmptyDescription` + `EmptyActions` |
|
|
99
|
+
| **Typography** | `TypographyH1`..`H4`, `TypographyP`, `TypographyLead`, `TypographyMuted` |
|
|
100
|
+
|
|
101
|
+
### Choosing overlays
|
|
102
|
+
|
|
103
|
+
| Situation | Component |
|
|
104
|
+
|-----------|-----------|
|
|
105
|
+
| Needs user decision, blocks interaction | `AlertDialog` |
|
|
106
|
+
| Form or content, closeable | `Dialog` |
|
|
107
|
+
| Side panel (settings, details) | `Sheet` |
|
|
108
|
+
| Mobile-friendly bottom panel | `Drawer` |
|
|
109
|
+
| Small interactive content on click | `Popover` |
|
|
110
|
+
| Rich preview on hover | `HoverCard` |
|
|
111
|
+
| Short text hint on hover | `Tooltip` |
|
|
112
|
+
|
|
113
|
+
### Choosing form controls
|
|
114
|
+
|
|
115
|
+
| Situation | Component |
|
|
116
|
+
|-----------|-----------|
|
|
117
|
+
| Simple text input | `Input` (or `TextField` compound) |
|
|
118
|
+
| Dropdown with options | `Select` |
|
|
119
|
+
| Searchable dropdown | `Combobox` |
|
|
120
|
+
| Native HTML select | `NativeSelect` |
|
|
121
|
+
| Boolean toggle (settings) | `Switch` |
|
|
122
|
+
| Boolean toggle (forms/T&C) | `Checkbox` |
|
|
123
|
+
| Single choice from few options | `RadioGroup` |
|
|
124
|
+
| Toggle between 2-5 options | `ToggleGroup` |
|
|
125
|
+
| OTP/verification code | `InputOTP` |
|
|
126
|
+
| Multi-line text | `Textarea` (or `TextareaField` compound) |
|
|
127
|
+
| Numeric range | `Slider` |
|
|
128
|
+
|
|
129
|
+
## Workflow
|
|
130
|
+
|
|
131
|
+
When asked to build UI with Phlex:
|
|
132
|
+
|
|
133
|
+
1. **Check context** — is shadcn-phlex in Gemfile? Is `Shadcn::Kit` included in the base view?
|
|
134
|
+
2. **Select components** — use the tables above to pick the right components for each need
|
|
135
|
+
3. **Compose** — build the UI using Kit helpers, nesting compound components correctly
|
|
136
|
+
4. **Wire forms** — add `name:` to all form controls, use `TextField`/`TextareaField` for common patterns
|
|
137
|
+
5. **Review** — check composition rules (titles required, items in parents, semantic colors)
|
|
138
|
+
|
|
139
|
+
## Component API Quick Reference
|
|
140
|
+
|
|
141
|
+
See [references/component-catalog.md](references/component-catalog.md) for the full API of every component.
|
|
142
|
+
|
|
143
|
+
### Most-used patterns:
|
|
144
|
+
|
|
145
|
+
```ruby
|
|
146
|
+
# Simple form
|
|
147
|
+
ui_card do
|
|
148
|
+
ui_card_header { ui_card_title { "Profile" } }
|
|
149
|
+
ui_card_content do
|
|
150
|
+
ui_text_field(label: "Name", name: "user[name]", error: @user.errors[:name]&.first)
|
|
151
|
+
ui_text_field(label: "Email", name: "user[email]", type: "email")
|
|
152
|
+
end
|
|
153
|
+
ui_card_footer do
|
|
154
|
+
ui_button { "Save" }
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Confirmation dialog
|
|
159
|
+
ui_alert_dialog do
|
|
160
|
+
ui_alert_dialog_trigger { ui_button(variant: :destructive) { "Delete" } }
|
|
161
|
+
ui_alert_dialog_content do
|
|
162
|
+
ui_alert_dialog_header do
|
|
163
|
+
ui_alert_dialog_title { "Are you sure?" }
|
|
164
|
+
ui_alert_dialog_description { "This action cannot be undone." }
|
|
165
|
+
end
|
|
166
|
+
ui_alert_dialog_footer do
|
|
167
|
+
ui_alert_dialog_cancel { "Cancel" }
|
|
168
|
+
ui_alert_dialog_action { "Delete" }
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Data table
|
|
174
|
+
ui_table do
|
|
175
|
+
ui_table_header do
|
|
176
|
+
ui_table_row do
|
|
177
|
+
ui_table_head { "Name" }
|
|
178
|
+
ui_table_head { "Email" }
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
ui_table_body do
|
|
182
|
+
@users.each do |user|
|
|
183
|
+
ui_table_row do
|
|
184
|
+
ui_table_cell { user.name }
|
|
185
|
+
ui_table_cell { user.email }
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
```
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"prompt": "Create a settings page with a name field, email field, and save button using shadcn-phlex",
|
|
4
|
+
"expected_behaviors": [
|
|
5
|
+
"Uses ui_card or ui_card_content for layout",
|
|
6
|
+
"Uses ui_text_field for form fields (not raw ui_field + ui_label + ui_input)",
|
|
7
|
+
"Includes name: parameter on form controls",
|
|
8
|
+
"Uses ui_button for the save button",
|
|
9
|
+
"Does not hardcode colors (uses semantic tokens)"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"prompt": "Add a confirmation dialog that asks 'Are you sure?' before deleting an item",
|
|
14
|
+
"expected_behaviors": [
|
|
15
|
+
"Uses ui_alert_dialog (not ui_dialog) since overlay click should not close",
|
|
16
|
+
"Includes ui_alert_dialog_trigger with a destructive button",
|
|
17
|
+
"Uses ui_alert_dialog_header with title and description",
|
|
18
|
+
"Uses ui_alert_dialog_footer with cancel and action buttons",
|
|
19
|
+
"Cancel uses ui_alert_dialog_cancel, action uses ui_alert_dialog_action"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"prompt": "Create a tabs component with Account and Password tabs",
|
|
24
|
+
"expected_behaviors": [
|
|
25
|
+
"Uses ui_tabs with an initial value",
|
|
26
|
+
"Each ui_tabs_trigger has a value: parameter",
|
|
27
|
+
"Each ui_tabs_content has a matching value: parameter",
|
|
28
|
+
"Trigger values match content values exactly"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"prompt": "Build a form with checkboxes for Terms and Marketing opt-in",
|
|
33
|
+
"expected_behaviors": [
|
|
34
|
+
"Uses ui_checkbox with name: parameter for form submission",
|
|
35
|
+
"Associates each checkbox with a label",
|
|
36
|
+
"Does not manually add data-controller or data-action attributes"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"prompt": "Create a dropdown menu with Edit, Duplicate, and Delete options",
|
|
41
|
+
"expected_behaviors": [
|
|
42
|
+
"Uses ui_dropdown_menu with trigger and content",
|
|
43
|
+
"Delete item uses variant: :destructive",
|
|
44
|
+
"Uses ui_dropdown_menu_separator between groups",
|
|
45
|
+
"Does not manually wire Stimulus controllers"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"prompt": "Add a select dropdown for choosing a country in a form",
|
|
50
|
+
"expected_behaviors": [
|
|
51
|
+
"Uses ui_select with name: parameter",
|
|
52
|
+
"Includes ui_select_trigger wrapping ui_select_value with placeholder",
|
|
53
|
+
"Uses ui_select_content wrapping ui_select_item components",
|
|
54
|
+
"Each ui_select_item has a value: parameter"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"prompt": "Create an accordion FAQ section",
|
|
59
|
+
"expected_behaviors": [
|
|
60
|
+
"Uses ui_accordion with type and collapsible options",
|
|
61
|
+
"Each item has ui_accordion_item wrapping trigger + content",
|
|
62
|
+
"Uses ui_accordion_trigger for the question",
|
|
63
|
+
"Uses ui_accordion_content for the answer"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"prompt": "Show a loading skeleton for a card",
|
|
68
|
+
"expected_behaviors": [
|
|
69
|
+
"Uses ui_card for the container",
|
|
70
|
+
"Uses ui_skeleton for placeholder elements",
|
|
71
|
+
"Applies appropriate width/height classes to skeletons"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"prompt": "Add a dark mode toggle to the navbar",
|
|
76
|
+
"expected_behaviors": [
|
|
77
|
+
"Uses ui_theme_toggle component",
|
|
78
|
+
"Does not manually implement dark mode logic"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"prompt": "Create a data table showing users with name, email, and role columns",
|
|
83
|
+
"expected_behaviors": [
|
|
84
|
+
"Uses ui_table with header and body",
|
|
85
|
+
"Uses ui_table_header, ui_table_body, ui_table_row",
|
|
86
|
+
"Uses ui_table_head for header cells, ui_table_cell for body cells",
|
|
87
|
+
"Iterates over data collection for rows"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
]
|