shadcn-ui 0.0.2 → 0.0.4
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 +4 -4
- data/.env +1 -0
- data/Rakefile +6 -3
- data/app/assets/stylesheets/{application.scss → application.css} +0 -27
- data/app/assets/stylesheets/application.tailwind.css +32 -160
- data/app/assets/stylesheets/shadcn.css +216 -0
- data/app/helpers/components/accordion_helper.rb +14 -1
- data/app/helpers/components/alert_helper.rb +4 -2
- data/app/helpers/components/button_helper.rb +2 -1
- data/app/helpers/components/card_helper.rb +1 -1
- data/app/helpers/components/checkbox_helper.rb +2 -2
- data/app/helpers/components/collapsible_helper.rb +8 -0
- data/app/helpers/components/input_helper.rb +1 -1
- data/app/helpers/components/sheet_helper.rb +9 -0
- data/app/helpers/components/slider_helper.rb +1 -1
- data/app/helpers/components_helper.rb +11 -0
- data/app/helpers/examples_helper.rb +7 -3
- data/app/javascript/controllers/highlight_controller.js +0 -1
- data/app/javascript/controllers/ui/popover_controller.js +6 -2
- data/app/views/application/index.html.erb +625 -17
- data/app/views/components/ui/_accordion.html.erb +2 -2
- data/app/views/components/ui/_alert.html.erb +15 -3
- data/app/views/components/ui/_card.html.erb +7 -1
- data/app/views/components/ui/_checkbox.html.erb +2 -1
- data/app/views/components/ui/_collapsible.html.erb +2 -6
- data/app/views/components/ui/_filter.html.erb +2 -1
- data/app/views/components/ui/_sheet.html.erb +1 -1
- data/app/views/documentation/generators.html.md +21 -0
- data/app/views/documentation/helpers.html.md +54 -0
- data/app/views/documentation/index.html.md +22 -0
- data/app/views/documentation/installation.html.md +130 -2
- data/app/views/documentation/javascript.html.md +8 -0
- data/app/views/examples/components/accordion/_usage.html.erb +15 -0
- data/app/views/examples/components/accordion/code/_block.html.erb +8 -0
- data/app/views/examples/components/accordion/code/_description.html.erb +7 -0
- data/app/views/examples/components/accordion/code/_preview.erb +3 -0
- data/app/views/examples/components/accordion/code/_usage.erb +16 -0
- data/app/views/examples/components/accordion.html.erb +37 -3
- data/app/views/examples/components/alert/_usage.html.erb +10 -0
- data/app/views/examples/components/alert/code/_attention.erb +3 -0
- data/app/views/examples/components/alert/code/_destructive.erb +2 -0
- data/app/views/examples/components/alert/code/_info.erb +3 -0
- data/app/views/examples/components/alert/code/_no_icon.erb +3 -0
- data/app/views/examples/components/alert/code/_preview.erb +2 -0
- data/app/views/examples/components/alert/code/_success.erb +3 -0
- data/app/views/examples/components/alert/code/_usage.erb +1 -0
- data/app/views/examples/components/alert-dialog/code/_preview.erb +6 -0
- data/app/views/examples/components/alert-dialog/code/_usage.erb +0 -0
- data/app/views/examples/components/alert-dialog.html.erb +8 -11
- data/app/views/examples/components/alert.html.erb +90 -8
- data/app/views/examples/components/badge/_usage.html.erb +10 -0
- data/app/views/examples/components/badge/code/_preview.erb +5 -0
- data/app/views/examples/components/badge/code/_usage.erb +1 -0
- data/app/views/examples/components/badge.html.erb +12 -17
- data/app/views/examples/components/button/_usage.html.erb +19 -0
- data/app/views/examples/components/button/code/_preview.erb +13 -0
- data/app/views/examples/components/button/code/_usage.erb +6 -0
- data/app/views/examples/components/button.html.erb +12 -20
- data/app/views/examples/components/card/_usage.html.erb +21 -0
- data/app/views/examples/components/card/code/_form.erb +72 -0
- data/app/views/examples/components/card/code/_notifications.erb +61 -0
- data/app/views/examples/components/card/code/_preview.erb +6 -0
- data/app/views/examples/components/card/code/_usage.erb +3 -0
- data/app/views/examples/components/card.html.erb +31 -143
- data/app/views/examples/components/checkbox/_usage.html.erb +9 -0
- data/app/views/examples/components/checkbox/code/_preview.erb +2 -0
- data/app/views/examples/components/checkbox/code/_usage.erb +1 -0
- data/app/views/examples/components/checkbox.html.erb +15 -1
- data/app/views/examples/components/collapsible/_usage.html.erb +16 -0
- data/app/views/examples/components/collapsible/code/_preview.erb +9 -0
- data/app/views/examples/components/collapsible/code/_usage.erb +7 -0
- data/app/views/examples/components/collapsible.html.erb +12 -10
- data/app/views/examples/components/dialog.html.erb +6 -15
- data/app/views/examples/components/dropdown-menu/_usage.html.erb +19 -0
- data/app/views/examples/components/dropdown-menu/code/_preview.erb +19 -0
- data/app/views/examples/components/dropdown-menu/code/_usage.erb +13 -0
- data/app/views/examples/components/dropdown-menu.html.erb +29 -15
- data/app/views/examples/components/filter/_usage.html.erb +14 -0
- data/app/views/examples/components/filter/code/_icon.html.erb +7 -0
- data/app/views/examples/components/filter/code/_preview.erb +3 -0
- data/app/views/examples/components/filter/code/_usage.erb +5 -0
- data/app/views/examples/components/filter.html.erb +27 -7
- data/app/views/examples/components/hover-card/_usage.html.erb +15 -0
- data/app/views/examples/components/hover-card/code/_preview.erb +13 -0
- data/app/views/examples/components/hover-card/code/_usage.erb +6 -0
- data/app/views/examples/components/hover-card.html.erb +12 -14
- data/app/views/examples/components/input/_usage.html.erb +10 -0
- data/app/views/examples/components/input/code/_borderless.erb +3 -0
- data/app/views/examples/components/input/code/_preview.erb +1 -0
- data/app/views/examples/components/input/code/_usage.erb +1 -0
- data/app/views/examples/components/input.html.erb +17 -3
- data/app/views/examples/components/label/_usage.html.erb +9 -0
- data/app/views/examples/components/label/code/_preview.erb +5 -0
- data/app/views/examples/components/label/code/_usage.erb +1 -0
- data/app/views/examples/components/label.html.erb +14 -5
- data/app/views/examples/components/popover/_usage.html.erb +12 -0
- data/app/views/examples/components/popover/code/_form.erb +23 -0
- data/app/views/examples/components/popover/code/_preview.erb +13 -0
- data/app/views/examples/components/popover/code/_usage.erb +7 -0
- data/app/views/examples/components/popover.html.erb +28 -24
- data/app/views/examples/components/progress/_usage.erb +9 -0
- data/app/views/examples/components/progress/code/_preview.erb +1 -0
- data/app/views/examples/components/progress/code/_usage.erb +1 -0
- data/app/views/examples/components/progress.html.erb +12 -2
- data/app/views/examples/components/separator/_usage.html.erb +10 -0
- data/app/views/examples/components/separator/code/_fancy.erb +21 -0
- data/app/views/examples/components/separator/code/_preview.erb +1 -0
- data/app/views/examples/components/separator/code/_usage.erb +1 -0
- data/app/views/examples/components/separator.html.erb +26 -19
- data/app/views/examples/components/sheet/_usage.html.erb +38 -0
- data/app/views/examples/components/sheet/code/_mobile_menu.erb +17 -0
- data/app/views/examples/components/sheet/code/_preview.erb +22 -0
- data/app/views/examples/components/sheet/code/_usage.erb +7 -0
- data/app/views/examples/components/sheet.html.erb +17 -10
- data/app/views/examples/components/skeleton/_usage.html.erb +9 -0
- data/app/views/examples/components/skeleton/code/_preview.erb +1 -0
- data/app/views/examples/components/skeleton/code/_usage.erb +1 -0
- data/app/views/examples/components/skeleton.html.erb +16 -2
- data/app/views/examples/components/slider/_usage.html.erb +11 -0
- data/app/views/examples/components/slider/code/_preview.erb +3 -0
- data/app/views/examples/components/slider/code/_usage.erb +1 -0
- data/app/views/examples/components/slider.html.erb +16 -2
- data/app/views/examples/components/textarea/_usage.html.erb +9 -0
- data/app/views/examples/components/textarea/code/_preview.erb +1 -0
- data/app/views/examples/components/textarea/code/_usage.erb +1 -0
- data/app/views/examples/components/textarea.html.erb +16 -2
- data/app/views/examples/components/toast/_usage.html.erb +11 -0
- data/app/views/examples/components/toast/code/_preview.erb +3 -0
- data/app/views/examples/components/toast/code/_usage.erb +2 -0
- data/app/views/examples/components/toast.html.erb +12 -4
- data/app/views/examples/components/toggle/_usage.html.erb +10 -0
- data/app/views/examples/components/toggle/code/_preview.erb +1 -0
- data/app/views/examples/components/toggle/code/_usage.erb +1 -0
- data/app/views/examples/components/toggle.html.erb +16 -2
- data/app/views/examples/components/tooltip/_usage.html.erb +11 -0
- data/app/views/examples/components/tooltip/code/_preview.erb +12 -0
- data/app/views/examples/components/tooltip/code/_usage.erb +7 -0
- data/app/views/examples/components/tooltip.html.erb +16 -13
- data/app/views/layouts/shared/_components.html.erb +44 -41
- data/config/environments/production.rb +4 -4
- data/config/shadcn.tailwind.js +98 -0
- data/config/tailwind.config.js +13 -74
- data/lib/components.json +7 -3
- data/lib/generators/shadcn-ui_generator.rb +201 -0
- data/lib/shadcn-ui/version.rb +1 -1
- data/package-lock.json +90 -3
- data/package.json +4 -0
- metadata +97 -9
- data/lib/generators/shadcn_ui_generator.rb +0 -81
- /data/app/assets/stylesheets/{lambda.light.scss → lambda.light.css} +0 -0
- /data/app/views/examples/components/dialog/code/{form.erb → _form.erb} +0 -0
- /data/app/views/examples/components/dialog/code/{notifications.erb → _notifications.erb} +0 -0
- /data/app/views/examples/components/dialog/code/{preview.erb → _preview.erb} +0 -0
- /data/app/views/examples/components/dialog/code/{usage.erb → _usage.erb} +0 -0
@@ -2,7 +2,21 @@
|
|
2
2
|
description: "A control that allows the user to toggle between checked and not checked." %>
|
3
3
|
|
4
4
|
<%= content_for :preview, flush: true do %>
|
5
|
-
<%=
|
5
|
+
<%= render_code_preview('checkbox') %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<% content_for :code, flush: true do %>
|
9
|
+
<%= code_partial("checkbox/preview", :erb) %>
|
6
10
|
<% end %>
|
7
11
|
|
8
12
|
<%= render_preview %>
|
13
|
+
|
14
|
+
<h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
|
15
|
+
<%= code_sample(language: "sh") do %>
|
16
|
+
rails generate shadcn-ui checkbox
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<h2 class="font-heading mt-12 scroll-m-20 border-b pb-2 mb-2 text-2xl font-semibold tracking-tight first:mt-0" id="usage">Usage</h2>
|
20
|
+
<%= code_partial("checkbox/usage", :erb) %>
|
21
|
+
|
22
|
+
<%= render_usage("checkbox") %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Collapsible component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/collapsible_helper.rb") %></li>
|
5
|
+
<li><%= code("app/views/components/ui/_collapsible.html.erb") %></li>
|
6
|
+
<li><%= code("app/javascript/controllers/ui/collapsible_controller.js") %></li>
|
7
|
+
</ul>
|
8
|
+
|
9
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
10
|
+
Collapsible introduces the <%= code("render_collapsible") %> method that accepts an argument
|
11
|
+
<%= code("trigger:") %> which is the text you want to show that will trigger the collapsible menu and
|
12
|
+
a block. Within the block of collapsible, you can call <%= code("collapsible_preview") %> to
|
13
|
+
define an element that is visible from the collapsible menu via a block. Similarly, you can call
|
14
|
+
<%= code("collapsible_body") %> and pass it a block for the elements that are hidden that will be
|
15
|
+
made visible when the trigger is pressed.
|
16
|
+
</p>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= render_collapsible trigger: "@peduarte starred 3 repositories" do %>
|
2
|
+
<% collapsible_preview do %>
|
3
|
+
<div class="rounded-md border px-4 py-3 font-mono text-sm">@radix-ui/primitives</div>
|
4
|
+
<% end %>
|
5
|
+
<% collapsible_body do %>
|
6
|
+
<div class="rounded-md border px-4 py-3 font-mono text-sm">@radix-ui/colors</div>
|
7
|
+
<div class="rounded-md border px-4 py-3 font-mono text-sm">@stitches/react</div>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
@@ -5,20 +5,22 @@
|
|
5
5
|
|
6
6
|
<%= content_for :preview, flush: true do %>
|
7
7
|
<div class="w-full flex justify-center">
|
8
|
-
<%=
|
9
|
-
<% content_for :preview do %>
|
10
|
-
<div class="rounded-md border px-4 py-3 font-mono text-sm">@radix-ui/primitives</div>
|
11
|
-
<% end %>
|
12
|
-
<% content_for :body do %>
|
13
|
-
<div class="rounded-md border px-4 py-3 font-mono text-sm">@radix-ui/colors</div>
|
14
|
-
<div class="rounded-md border px-4 py-3 font-mono text-sm">@stitches/react</div>
|
15
|
-
<% end %>
|
16
|
-
<% end %>
|
8
|
+
<%= render_code_preview('collapsible') %>
|
17
9
|
</div>
|
18
10
|
<% end %>
|
19
11
|
|
12
|
+
<% content_for :code, flush: true do %>
|
13
|
+
<%= code_partial("collapsible/preview", :erb) %>
|
14
|
+
<% end %>
|
15
|
+
|
20
16
|
<%= render_preview %>
|
21
17
|
|
22
18
|
<h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
|
19
|
+
<%= code_sample(language: "sh") do %>
|
20
|
+
rails generate shadcn-ui collapsible
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<h2 class="font-heading mt-12 scroll-m-20 border-b pb-2 mb-2 text-2xl font-semibold tracking-tight first:mt-0" id="usage">Usage</h2>
|
24
|
+
<%= code_partial("collapsible/usage", :erb) %>
|
23
25
|
|
24
|
-
|
26
|
+
<%= render_usage("collapsible") %>
|
@@ -3,21 +3,12 @@
|
|
3
3
|
|
4
4
|
<% content_for :preview, flush: true do %>
|
5
5
|
<div class="w-full flex justify-center">
|
6
|
-
<%=
|
7
|
-
<%= dialog_trigger do %>
|
8
|
-
<%= render_button("Open Typography", variant: :outline) %>
|
9
|
-
<% end %>
|
10
|
-
<%= dialog_content do %>
|
11
|
-
<h2 class="mt-10 scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight transition-colors first:mt-0">The King's Plan</h2>
|
12
|
-
<p class="leading-7 [&:not(:first-child)]:mt-6">The king thought long and hard, and finally came up with <a href="#" class="font-medium text-primary underline underline-offset-4">a brilliant plan</a>: he would tax the jokes in the kingdom.</p>
|
13
|
-
<blockquote class="mt-6 border-l-2 pl-6 italic">"After all," he said, "everyone enjoys a good joke, so it's only fair that they should pay for the privilege."</blockquote>
|
14
|
-
<% end %>
|
15
|
-
<% end %>
|
6
|
+
<%= render_code_preview('dialog') %>
|
16
7
|
</div>
|
17
8
|
<% end %>
|
18
9
|
|
19
10
|
<% content_for :code, flush: true do %>
|
20
|
-
<%= code_partial("dialog/
|
11
|
+
<%= code_partial("dialog/preview", :erb) %>
|
21
12
|
<% end %>
|
22
13
|
|
23
14
|
<%= render_preview %>
|
@@ -25,12 +16,12 @@
|
|
25
16
|
<h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
|
26
17
|
|
27
18
|
<%= code_sample(language: "sh") do %>
|
28
|
-
rails generate
|
19
|
+
rails generate shadcn_ui dialog
|
29
20
|
<% end %>
|
30
21
|
|
31
22
|
<h2 class="font-heading mt-12 scroll-m-20 border-b pb-2 mb-2 text-2xl font-semibold tracking-tight first:mt-0" id="usage"><a href="/docs/components/dialog#usage">Usage</a></h2>
|
32
23
|
|
33
|
-
<%= code_partial("dialog/
|
24
|
+
<%= code_partial("dialog/usage", :erb) %>
|
34
25
|
|
35
26
|
<%= render_usage("dialog") %>
|
36
27
|
|
@@ -81,7 +72,7 @@ rails generate shadcn-ui dialog
|
|
81
72
|
<% end %>
|
82
73
|
|
83
74
|
<% content_for :code, flush: true do %>
|
84
|
-
<%= code_partial("dialog/
|
75
|
+
<%= code_partial("dialog/notifications", :erb) %>
|
85
76
|
<% end %>
|
86
77
|
|
87
78
|
<%= render_example %>
|
@@ -139,7 +130,7 @@ rails generate shadcn-ui dialog
|
|
139
130
|
<% end %>
|
140
131
|
|
141
132
|
<% content_for :code, flush: true do %>
|
142
|
-
<%= code_partial("dialog/
|
133
|
+
<%= code_partial("dialog/form", :erb) %>
|
143
134
|
<% end %>
|
144
135
|
|
145
136
|
<%= render_example %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Dropdown Menu component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/dropdown_menu_helper.rb") %></li>
|
5
|
+
<li><%= code("app/views/components/ui/_dropdown_menu.html.erb") %></li>
|
6
|
+
<li><%= code("app/javascript/controllers/ui/dropdown-menu_controller.js") %></li>
|
7
|
+
</ul>
|
8
|
+
|
9
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
10
|
+
The method <%= code("render_dropdown_menu") %> defined in <%= code("app/helpers/components/dropdown_menu_helper.rb") %>
|
11
|
+
accepts a block for the two inner components, <%= code("dropdown_menu_trigger") %> and <%= code("dropdown_menu_content") %>. Each of those accepts a block for their respective content.</p>
|
12
|
+
|
13
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
14
|
+
Within the <%= code("dropdown_menu_content") %> block, you can use the following methods:</p>
|
15
|
+
|
16
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
17
|
+
<li><%= code("dropdown_menu_label") %> - accepts an argument for the label section of the dropdown menu. This is optional.</li>
|
18
|
+
<li><%= code("dropdown_menu_item") %> - an arbitrary amount of these can be used for each menu item you want to include. This method either accepts a string or a block for the content you want.</li>
|
19
|
+
</ul>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% render_dropdown_menu do %>
|
2
|
+
<%= dropdown_menu_trigger do %>
|
3
|
+
<%= render_button "Open Dropdown", variant: :outline %>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<%= dropdown_menu_content do %>
|
7
|
+
<%= dropdown_menu_label "My Account" %>
|
8
|
+
<%= render_separator class: "my-1" %>
|
9
|
+
<%= dropdown_menu_item "Profile" %>
|
10
|
+
<%= dropdown_menu_item do %>
|
11
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2 h-4 w-4">
|
12
|
+
<rect width="20" height="14" x="2" y="5" rx="2"></rect><line x1="2" x2="22" y1="10" y2="10"></line>
|
13
|
+
</svg>
|
14
|
+
<span>Billing</span>
|
15
|
+
<span class="ml-auto text-xs tracking-widest opacity-60">⌘B</span>
|
16
|
+
<% end %>
|
17
|
+
<%= dropdown_menu_item "Settings" %>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% render_dropdown_menu do %>
|
2
|
+
<%= dropdown_menu_trigger do %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%= dropdown_menu_content do %>
|
6
|
+
<%= dropdown_menu_label %>
|
7
|
+
|
8
|
+
<%= dropdown_menu_item %>
|
9
|
+
<%= dropdown_menu_item do %>
|
10
|
+
<% end %>
|
11
|
+
<%= dropdown_menu_item %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
@@ -3,24 +3,38 @@
|
|
3
3
|
|
4
4
|
<%= content_for :preview, flush: true do %>
|
5
5
|
<% render_dropdown_menu do %>
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
<%= dropdown_menu_trigger do %>
|
7
|
+
<%= render_button "Open Dropdown", variant: :outline %>
|
8
|
+
<% end %>
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
<% end %>
|
21
|
-
<%= dropdown_menu_item "Settings" %>
|
10
|
+
<%= dropdown_menu_content do %>
|
11
|
+
<%= dropdown_menu_label "My Account" %>
|
12
|
+
<%= render_separator class: "my-1" %>
|
13
|
+
<%= dropdown_menu_item "Profile" %>
|
14
|
+
<%= dropdown_menu_item do %>
|
15
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2 h-4 w-4">
|
16
|
+
<rect width="20" height="14" x="2" y="5" rx="2"></rect><line x1="2" x2="22" y1="10" y2="10"></line>
|
17
|
+
</svg>
|
18
|
+
<span>Billing</span>
|
19
|
+
<span class="ml-auto text-xs tracking-widest opacity-60">⌘B</span>
|
22
20
|
<% end %>
|
21
|
+
<%= dropdown_menu_item "Settings" %>
|
23
22
|
<% end %>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<% content_for :code, flush: true do %>
|
27
|
+
<%= code_partial("dropdown-menu/preview", :erb) %>
|
24
28
|
<% end %>
|
25
29
|
|
26
30
|
<%= render_preview %>
|
31
|
+
|
32
|
+
<h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
|
33
|
+
<%= code_sample(language: "sh") do %>
|
34
|
+
rails generate shadcn-ui dropdown-menu
|
35
|
+
<% end %>
|
36
|
+
|
37
|
+
<h2 class="font-heading mt-12 scroll-m-20 border-b pb-2 mb-2 text-2xl font-semibold tracking-tight first:mt-0" id="usage">Usage</h2>
|
38
|
+
<%= code_partial("dropdown-menu/usage", :erb) %>
|
39
|
+
|
40
|
+
<%= render_usage("dropdown-menu") %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Filter component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/filter_helper.rb") %></li>
|
5
|
+
<li><%= code("app/views/components/ui/_filter.html.erb") %></li>
|
6
|
+
<li><%= code("app/javascript/controllers/ui/filter_controller.js") %></li>
|
7
|
+
</ul>
|
8
|
+
|
9
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
10
|
+
The method <%= code("render_filter") %> method accepts one mandtory argument, an array of hashes that each have a <%= code("value") %> and name <%= code("name") %>.</p>
|
11
|
+
|
12
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">You can optionally also call <%= code("filter_icon") %> within a block passed to <%= code("render_filter") %> to render an icon to the left of the filter input.</p>
|
13
|
+
|
14
|
+
<p>This component gets used in the Combobox and Command components as well as potentially others.</p>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<% items = [{:value => "Ruby on Rails", name: "Ruby on Rails"}, {:value => "Next.js", name: "Next.js"}, {:value => "Remix.run", name: "Remix.run"}] %>
|
2
|
+
|
3
|
+
<%= render_filter items, class: "p-1" do %>
|
4
|
+
<%= filter_icon do %>
|
5
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2 h-4 w-4 shrink-0 opacity-50 ml-2"><circle cx="11" cy="11" r="8"></circle><line x1="21" x2="16.65" y1="21" y2="16.65"></line></svg>
|
6
|
+
<% end %>
|
7
|
+
<% end %>
|
@@ -5,21 +5,41 @@
|
|
5
5
|
<%= render_component_header title: "Filter",
|
6
6
|
description: "Displays a list that is filterable via the included input." %>
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
<%=
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
<%= content_for :preview, flush: true do %>
|
9
|
+
<div class="w-full flex justify-center">
|
10
|
+
<%= render_code_preview('filter') %>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% content_for :code, flush: true do %>
|
15
|
+
<%= code_partial("filter/preview", :erb) %>
|
15
16
|
<% end %>
|
16
17
|
|
17
18
|
<%= render_preview %>
|
18
19
|
|
20
|
+
<h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
|
21
|
+
<%= code_sample(language: "sh") do %>
|
22
|
+
rails generate shadcn-ui filter
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<h2 class="font-heading mt-12 scroll-m-20 border-b pb-2 mb-2 text-2xl font-semibold tracking-tight first:mt-0" id="usage">Usage</h2>
|
26
|
+
<%= code_partial("filter/usage", :erb) %>
|
27
|
+
|
28
|
+
<%= render_usage("filter") %>
|
29
|
+
|
19
30
|
<% content_for :examples, flush: true do %>
|
20
31
|
<div class="w-full flex justify-center">
|
21
32
|
<%= render_filter items, class: "p-1" do %>
|
33
|
+
<%= filter_icon do %>
|
34
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2 h-4 w-4 shrink-0 opacity-50 ml-2"><circle cx="11" cy="11" r="8"></circle><line x1="21" x2="16.65" y1="21" y2="16.65"></line></svg>
|
35
|
+
<% end %>
|
22
36
|
<% end %>
|
37
|
+
</div>
|
38
|
+
<% end %>
|
39
|
+
|
40
|
+
<% content_for :code, flush: true do %>
|
41
|
+
<%= code_partial("filter/icon.html", :erb) %>
|
23
42
|
<% end %>
|
24
43
|
|
44
|
+
|
25
45
|
<%= render_example %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Hover Card component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/hover_card_helper.rb") %></li>
|
5
|
+
<li><%= code("app/views/components/ui/_hover_card.html.erb") %></li>
|
6
|
+
<li><%= code("app/javascript/controllers/ui/hover-card_controller.js") %></li>
|
7
|
+
</ul>
|
8
|
+
|
9
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
10
|
+
The method <%= code("render_hover_card") %> defined in <%= code("app/helpers/components/hover_card_helper.rb") %>
|
11
|
+
accepts a block for the two inner components, <%= code("hover_card_trigger") %> and <%= code("hover_card_content") %>. Each of those accepts a block for their respective content.
|
12
|
+
|
13
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
14
|
+
<%= code("app/javascript/controllers/ui/hover-card_controller.js") %> is a stimulus controller that provides
|
15
|
+
the functionality of the popover.</p>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= render_hover_card do %>
|
2
|
+
<%= hover_card_trigger do %>
|
3
|
+
<%= content_tag :span, "@rails" %>
|
4
|
+
<% end %>
|
5
|
+
<%= hover_card_content do %>
|
6
|
+
<div class="grid gap-2">
|
7
|
+
<div class="space-y-2">
|
8
|
+
<h4 class="font-medium leading-none">Ruby on Rails</h4>
|
9
|
+
<p class="text-sm text-muted-foreground">The Web framework that changed the world.</p>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
@@ -2,23 +2,21 @@
|
|
2
2
|
description: "For sighted users to preview content available behind a link." %>
|
3
3
|
|
4
4
|
<% content_for :preview, flush: true do %>
|
5
|
-
<%=
|
6
|
-
<%= hover_card_trigger do %>
|
7
|
-
<%= content_tag :span, "@rails" %>
|
8
|
-
<% end %>
|
9
|
-
<%= hover_card_content do %>
|
10
|
-
<div class="grid gap-2">
|
11
|
-
<div class="space-y-2">
|
12
|
-
<h4 class="font-medium leading-none">Ruby on Rails</h4>
|
13
|
-
<p class="text-sm text-muted-foreground">The Web framework that changed the world.</p>
|
14
|
-
</div>
|
15
|
-
</div>
|
16
|
-
<% end %>
|
17
|
-
<% end %>
|
5
|
+
<%= render_code_preview('hover-card') %>
|
18
6
|
<% end %>
|
19
7
|
|
20
8
|
<% content_for :code, flush: true do %>
|
21
|
-
|
9
|
+
<%= code_partial("hover-card/preview", :erb) %>
|
22
10
|
<% end %>
|
23
11
|
|
24
12
|
<%= render_preview %>
|
13
|
+
|
14
|
+
<h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
|
15
|
+
<%= code_sample(language: "sh") do %>
|
16
|
+
rails generate shadcn-ui hover-card
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<h2 class="font-heading mt-12 scroll-m-20 border-b pb-2 mb-2 text-2xl font-semibold tracking-tight first:mt-0" id="usage">Usage</h2>
|
20
|
+
<%= code_partial("hover-card/usage", :erb) %>
|
21
|
+
|
22
|
+
<%= render_usage("hover-card") %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Input component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/input_helper.rb") %></li>
|
5
|
+
<li><%= code("app/views/components/ui/_input.html.erb") %></li>
|
6
|
+
</ul>
|
7
|
+
|
8
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
9
|
+
<%= code("render_input") %> accepts a <%= code("name:") %> argument for the name of the text field along with optional <%= code("id:") %> and <%= code("variant:") %> (only supporting <%= code(":borderless") %> currently)
|
10
|
+
<p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_input name: "sample_input", id: "sample_input" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_input name:, id: %>
|
@@ -2,17 +2,31 @@
|
|
2
2
|
description: "Displays a form input field or a component that looks like an input field." %>
|
3
3
|
|
4
4
|
<% content_for :preview, flush: true do %>
|
5
|
-
|
5
|
+
<div class="w-full flex justify-center">
|
6
|
+
<%= render_code_preview('input') %>
|
7
|
+
</div>
|
6
8
|
<% end %>
|
7
9
|
|
8
10
|
<% content_for :code, flush: true do %>
|
9
|
-
|
11
|
+
<%= code_partial("input/preview", :erb) %>
|
10
12
|
<% end %>
|
11
13
|
|
12
14
|
<%= render_preview %>
|
13
15
|
|
16
|
+
<h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
|
17
|
+
<%= code_sample(language: "sh") do %>
|
18
|
+
rails generate shadcn-ui input
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<h2 class="font-heading mt-12 scroll-m-20 border-b pb-2 mb-2 text-2xl font-semibold tracking-tight first:mt-0" id="usage">Usage</h2>
|
22
|
+
<%= code_partial("input/usage", :erb) %>
|
23
|
+
|
14
24
|
<%= content_for :examples, flush: true do %>
|
15
|
-
<%= render_input name: "sample_input", id: "sample_input",
|
25
|
+
<%= render_input name: "sample_input", id: "sample_input", variant: :borderless %>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<% content_for :code, flush: true do %>
|
29
|
+
<%= code_partial("input/borderless", :erb) %>
|
16
30
|
<% end %>
|
17
31
|
|
18
32
|
<%= render_example %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Label component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/label_helper.rb") %></li>
|
5
|
+
<li><%= code("app/views/components/ui/_label.html.erb") %></li>
|
6
|
+
</ul>
|
7
|
+
|
8
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
9
|
+
The method <%= code("render_label") %> defined in <%= code("app/helpers/components/label_helper.rb") %> accepts two keyword arguments, <%= code("name") %> and <%= code("label") %>. The <%= code("name") %> argument is used to generate the <%= code("for") %> attributes. The <%= code("label") %> argument is used as the text for the label.</p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_label name:, label: %>
|
@@ -1,13 +1,22 @@
|
|
1
|
-
<%= render_component_header title: "
|
2
|
-
description: "Displays a
|
1
|
+
<%= render_component_header title: "Label",
|
2
|
+
description: "Displays a clickable label that will focus the associated form field." %>
|
3
3
|
|
4
4
|
<% content_for :preview, flush: true do %>
|
5
|
-
<%=
|
6
|
-
<%= render_input name: "sample_input", id: "sample_input" %>
|
5
|
+
<%= render_code_preview('label') %>
|
7
6
|
<% end %>
|
8
7
|
|
9
8
|
<% content_for :code, flush: true do %>
|
10
|
-
|
9
|
+
<%= code_partial("label/preview", :erb) %>
|
11
10
|
<% end %>
|
12
11
|
|
13
12
|
<%= render_preview %>
|
13
|
+
|
14
|
+
<h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
|
15
|
+
<%= code_sample(language: "sh") do %>
|
16
|
+
rails generate shadcn-ui label
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<h2 class="font-heading mt-12 scroll-m-20 border-b pb-2 mb-2 text-2xl font-semibold tracking-tight first:mt-0" id="usage">Usage</h2>
|
20
|
+
<%= code_partial("label/usage", :erb) %>
|
21
|
+
|
22
|
+
<%= render_usage("label") %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Popover component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/popover_helper.rb") %></li>
|
5
|
+
<li><%= code("app/views/components/ui/_popover.html.erb") %></li>
|
6
|
+
<li><%= code("app/javascript/controllers/ui/popover_controller.js") %></li>
|
7
|
+
</ul>
|
8
|
+
|
9
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
10
|
+
<%= code("render_popover") %> accepts a block where you call <%= code("popover_trigger") %>, whose block will be the element that triggers the popover and
|
11
|
+
<%= code("popover_content") %> whose block will be the content of the popover.
|
12
|
+
<p>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%= render_popover do %>
|
2
|
+
<%= popover_trigger do %>
|
3
|
+
<%= render_button "Open Popover", variant: :outline %>
|
4
|
+
<% end %>
|
5
|
+
<%= popover_content do %>
|
6
|
+
<div class="grid gap-4">
|
7
|
+
<div class="space-y-2">
|
8
|
+
<h4 class="font-medium leading-none">Dimensions</h4>
|
9
|
+
<p class="text-sm text-muted-foreground">Set the dimensions for the layer.</p>
|
10
|
+
</div>
|
11
|
+
<div class="grid gap-2">
|
12
|
+
<div class="grid grid-cols-3 items-center gap-4">
|
13
|
+
<label
|
14
|
+
class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
15
|
+
for="width">Width</label><input
|
16
|
+
class="flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 col-span-2 h-8"
|
17
|
+
id="width"
|
18
|
+
value="100%">
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= render_popover do %>
|
2
|
+
<%= popover_trigger do %>
|
3
|
+
<%= render_button "Open Popover", variant: :outline %>
|
4
|
+
<% end %>
|
5
|
+
<%= popover_content do %>
|
6
|
+
<div class="grid gap-4">
|
7
|
+
<div class="space-y-2">
|
8
|
+
<h4 class="font-medium leading-none">Heading</h4>
|
9
|
+
<p class="text-sm text-muted-foreground">Popovers stay open until you click the button or anywhere else on the document. </p>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|