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,33 +2,37 @@
|
|
2
2
|
description: "Displays rich content in a portal, triggered by a button." %>
|
3
3
|
|
4
4
|
<% content_for :preview, flush: true do %>
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<% end %>
|
9
|
-
<%= popover_content do %>
|
10
|
-
<div class="grid gap-4">
|
11
|
-
<div class="space-y-2">
|
12
|
-
<h4 class="font-medium leading-none">Dimensions</h4>
|
13
|
-
<p class="text-sm text-muted-foreground">Set the dimensions for the layer.</p>
|
14
|
-
</div>
|
15
|
-
<div class="grid gap-2">
|
16
|
-
<div class="grid grid-cols-3 items-center gap-4">
|
17
|
-
<label
|
18
|
-
class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
19
|
-
for="width">Width</label><input
|
20
|
-
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"
|
21
|
-
id="width"
|
22
|
-
value="100%">
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
</div>
|
26
|
-
<% end %>
|
27
|
-
<% end %>
|
5
|
+
<div class="w-full flex justify-center">
|
6
|
+
<%= render_code_preview('popover') %>
|
7
|
+
</div>
|
28
8
|
<% end %>
|
29
9
|
|
30
10
|
<% content_for :code, flush: true do %>
|
31
|
-
|
11
|
+
<div class="w-full flex justify-center">
|
12
|
+
<%= code_partial("popover/preview", :erb) %>
|
13
|
+
</div>
|
32
14
|
<% end %>
|
33
15
|
|
34
16
|
<%= render_preview %>
|
17
|
+
|
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 popover
|
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("popover/usage", :erb) %>
|
25
|
+
|
26
|
+
<%= render_usage("popover") %>
|
27
|
+
|
28
|
+
<% content_for :examples, flush: true do %>
|
29
|
+
<div class="w-full flex justify-center">
|
30
|
+
<%= render "examples/components/popover/code/form" %>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
33
|
+
|
34
|
+
<% content_for :code, flush: true do %>
|
35
|
+
<%= code_partial("popover/form", :erb) %>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
<%= render_example %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Progress component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/progress_helper.rb") %></li>
|
5
|
+
<li><%= code("app/views/components/ui/_progress.html.erb") %></li>
|
6
|
+
</ul>
|
7
|
+
|
8
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
9
|
+
The method <%= code("render_progress") %> defined in <%= code("app/helpers/components/progress_helper.rb") %> accepts one keyword arguments for the percentage of the progress bar.</p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_progress value: 37 %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_progress value: %>
|
@@ -2,11 +2,21 @@
|
|
2
2
|
description: "Displays an indicator showing the completion progress of a task, typically displayed as a progress bar." %>
|
3
3
|
|
4
4
|
<% content_for :preview, flush: true do %>
|
5
|
-
<%=
|
5
|
+
<%= render_code_preview('progress') %>
|
6
6
|
<% end %>
|
7
7
|
|
8
8
|
<% content_for :code, flush: true do %>
|
9
|
-
|
9
|
+
<%= code_partial("progress/preview", :erb) %>
|
10
10
|
<% end %>
|
11
11
|
|
12
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 progress
|
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("progress/usage", :erb) %>
|
21
|
+
|
22
|
+
<%= render_usage("progress") %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Seperator component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/seperator_helper.rb") %></li>
|
5
|
+
<li><%= code("app/views/components/ui/_seperator.html.erb") %></li>
|
6
|
+
</ul>
|
7
|
+
|
8
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
9
|
+
<%= code("render_seperator") %> will render a seperator.
|
10
|
+
<p>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<div>
|
2
|
+
<div class="space-y-1">
|
3
|
+
<h4 class="text-sm font-medium leading-none">Shadcn on Rails</h4>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<%= render_separator class: "my-4" %>
|
7
|
+
|
8
|
+
<div class="flex h-5 items-center space-x-4 text-sm">
|
9
|
+
<div>Blog</div>
|
10
|
+
<div
|
11
|
+
data-orientation="vertical"
|
12
|
+
role="none"
|
13
|
+
class="shrink-0 bg-border h-full w-[1px]"></div>
|
14
|
+
<div>Docs</div>
|
15
|
+
<div
|
16
|
+
data-orientation="vertical"
|
17
|
+
role="none"
|
18
|
+
class="shrink-0 bg-border h-full w-[1px]"></div>
|
19
|
+
<div>Source</div>
|
20
|
+
</div>
|
21
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_separator class: "my-4" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_separator %>
|
@@ -1,33 +1,40 @@
|
|
1
1
|
<!--prettier-ignore-->
|
2
2
|
|
3
3
|
<%= render "layouts/documentation/component_header",
|
4
|
-
title: "
|
4
|
+
title: "Separator",
|
5
5
|
description: "Visually or semantically separates content." %>
|
6
6
|
<%= content_for :preview, flush: true do %>
|
7
|
-
<div>
|
8
|
-
|
9
|
-
<h4 class="text-sm font-medium leading-none">Radix Primitives</h4>
|
10
|
-
<p class="text-sm text-muted-foreground">An open-source UI component library.</p>
|
11
|
-
</div>
|
12
|
-
<%= render_separator class: "my-4" %>
|
13
|
-
<div class="flex h-5 items-center space-x-4 text-sm">
|
14
|
-
<div>Blog</div>
|
15
|
-
<div
|
16
|
-
data-orientation="vertical"
|
17
|
-
role="none"
|
18
|
-
class="shrink-0 bg-border h-full w-[1px]"></div>
|
19
|
-
<div>Docs</div>
|
20
|
-
<div
|
21
|
-
data-orientation="vertical"
|
22
|
-
role="none"
|
23
|
-
class="shrink-0 bg-border h-full w-[1px]"></div>
|
24
|
-
<div>Source</div>
|
7
|
+
<div class="w-full flex justify-center">
|
8
|
+
<%= render_code_preview('separator') %>
|
25
9
|
</div>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<% content_for :code, flush: true do %>
|
13
|
+
<div class="w-full flex justify-center">
|
14
|
+
<%= code_partial("separator/preview", :erb) %>
|
26
15
|
</div>
|
27
16
|
<% end %>
|
28
17
|
|
29
18
|
<%= render_preview %>
|
30
19
|
|
31
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 separator
|
23
|
+
<% end %>
|
32
24
|
|
33
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"><a href="/docs/components/dialog#usage">Usage</a></h2>
|
26
|
+
<%= code_partial("separator/usage", :erb) %>
|
27
|
+
|
28
|
+
<%= render_usage("separator") %>
|
29
|
+
|
30
|
+
<% content_for :examples, flush: true do %>
|
31
|
+
<div class="w-full flex justify-center">
|
32
|
+
<%= render "examples/components/separator/code/fancy" %>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<% content_for :code, flush: true do %>
|
37
|
+
<%= code_partial("separator/fancy", :erb) %>
|
38
|
+
<% end %>
|
39
|
+
|
40
|
+
<%= render_example %>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Sheet component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/sheet_helper.rb") %></li>
|
5
|
+
<li><%= code("app/views/components/ui/_sheet.html.erb") %></li>
|
6
|
+
<li><%= code("app/javascript/controllers//ui/sheet_controller.js") %></li>
|
7
|
+
</ul>
|
8
|
+
|
9
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
10
|
+
The <%= code("render_sheet") %> method accepts a <%= code("direction") %> optional keyword for the direction for the sheet, left (default) or right.
|
11
|
+
|
12
|
+
The <%= code("render_sheet") %> method also accepts a block where you call the <%= code("sheet_trigger") %> and pass it a block that will be the trigger for the sheet and
|
13
|
+
a <%= code("sheet_content") %> method that accepts a block for the content of a sheet.
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
17
|
+
If you have to define a sheet whose trigger cannot be within the same elements of the sheet content, you can interact with the sheet controller directly.
|
18
|
+
</p>
|
19
|
+
|
20
|
+
<% content_for :examples, flush: true do %>
|
21
|
+
<button
|
22
|
+
type="button"
|
23
|
+
data-state="closed"
|
24
|
+
data-controller="ui--sheet"
|
25
|
+
data-action="click->ui--sheet#toggleOutlet"
|
26
|
+
data--ui-sheet-outlet="#sidebar_sheet">Open Mobile Menu</button>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<% content_for :code, flush: true do %>
|
30
|
+
<div class="w-full flex justify-center">
|
31
|
+
<%= code_partial("sheet/mobile_menu", :erb) %>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
34
|
+
|
35
|
+
<%= render_example %>
|
36
|
+
|
37
|
+
In the above example the "Open Mobile Menu" button is triggering the sheet whose element matches <%= code("#sidebar_sheet") %>. It does this by calling
|
38
|
+
<%= code("click->ui--sheet#toggleOutlet") %>, the <%= code("toggleOutlet") %> method in the sheet controller. The #sidebar_sheet element can be anywhere.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<button
|
2
|
+
type="button"
|
3
|
+
data-state="closed"
|
4
|
+
data-controller="ui--sheet"
|
5
|
+
data-action="click->ui--sheet#toggleOutlet"
|
6
|
+
data--ui-sheet-outlet="#sidebar_sheet">
|
7
|
+
Open Mobile Menu
|
8
|
+
</button>
|
9
|
+
|
10
|
+
|
11
|
+
<%= render_sheet id: "sidebar_sheet", direction: "left" do %>
|
12
|
+
<div class=" h-full">
|
13
|
+
<%= sheet_content do %>
|
14
|
+
<!-- Mobile Menu -->
|
15
|
+
<% end %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= render_sheet direction: "right" do %>
|
2
|
+
<%= sheet_trigger do %>
|
3
|
+
<%= render_button("Open Sidebar", variant: :outline) %>
|
4
|
+
<% end %>
|
5
|
+
<%= sheet_content do %>
|
6
|
+
<h2 class="mt-10 scroll-m-20 border-b pb-2 text-3xl
|
7
|
+
font-semibold tracking-tight transition-colors first:mt-0">
|
8
|
+
The King's Plan
|
9
|
+
</h2>
|
10
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
11
|
+
The king thought long and hard, and finally came up with
|
12
|
+
<a href="#" class="font-medium text-primary underline underline-offset-4">
|
13
|
+
a brilliant plan
|
14
|
+
</a>:
|
15
|
+
he would tax the jokes in the kingdom.
|
16
|
+
</p>
|
17
|
+
<blockquote class="mt-6 border-l-2 pl-6 italic">
|
18
|
+
"After all," he said, "everyone enjoys a good joke,
|
19
|
+
so it's only fair that they should pay for the privilege."
|
20
|
+
</blockquote>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
@@ -3,17 +3,24 @@
|
|
3
3
|
|
4
4
|
<% content_for :preview, flush: true do %>
|
5
5
|
<div class="w-full flex justify-center">
|
6
|
-
<%=
|
7
|
-
<%= sheet_trigger do %>
|
8
|
-
<%= render_button("Open Sidebar", variant: :outline) %>
|
9
|
-
<% end %>
|
10
|
-
<%= sheet_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('sheet') %>
|
16
7
|
</div>
|
17
8
|
<% end %>
|
18
9
|
|
10
|
+
<% content_for :code, flush: true do %>
|
11
|
+
<div class="w-full flex justify-center">
|
12
|
+
<%= code_partial("sheet/preview", :erb) %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
19
16
|
<%= render_preview %>
|
17
|
+
|
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 sheet
|
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("sheet/usage", :erb) %>
|
25
|
+
|
26
|
+
<%= render_usage("sheet") %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Skeleton component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/skeleton_helper.rb") %></li>
|
5
|
+
<li><%= code("app/views/components/ui/_skeleton.html.erb") %></li>
|
6
|
+
</ul>
|
7
|
+
|
8
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
9
|
+
<%= code("render_skeleton") %> will output the skeleton component.</p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_skeleton %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_skeleton %>
|
@@ -2,11 +2,25 @@
|
|
2
2
|
description: "Use to show a placeholder while content is loading." %>
|
3
3
|
|
4
4
|
<% content_for :preview, flush: true do %>
|
5
|
-
|
5
|
+
<div class="w-full flex justify-center">
|
6
|
+
<%= render_code_preview('skeleton') %>
|
7
|
+
</div>
|
6
8
|
<% end %>
|
7
9
|
|
8
10
|
<% content_for :code, flush: true do %>
|
9
|
-
|
11
|
+
<div class="w-full flex justify-center">
|
12
|
+
<%= code_partial("skeleton/preview", :erb) %>
|
13
|
+
</div>
|
10
14
|
<% end %>
|
11
15
|
|
12
16
|
<%= render_preview %>
|
17
|
+
|
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 skeleton
|
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("skeleton/usage", :erb) %>
|
25
|
+
|
26
|
+
<%= render_usage("skeleton") %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Slider component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/slider_helper.rb") %></li>
|
5
|
+
<li><%= code("app/javascript/controllers/ui/slider_controller.js") %></li>
|
6
|
+
<li><%= code("app/views/components/ui/_slider.html.erb") %></li>
|
7
|
+
</ul>
|
8
|
+
|
9
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
10
|
+
<%= code("render_slider") %> accepts one keyword argument for the <%= code("name") %> of the slider element. It optionally accepts a <%= code("value") %> keyword for the starting value of the slider.
|
11
|
+
The javascript controller is responsible for maintaining the state and visual of the slider from the underlying range input.</p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_slider name: %>
|
@@ -2,11 +2,25 @@
|
|
2
2
|
description: "An input where the user selects a value from within a given range." %>
|
3
3
|
|
4
4
|
<% content_for :preview, flush: true do %>
|
5
|
-
|
5
|
+
<div class="w-full flex justify-center">
|
6
|
+
<%= render_code_preview('slider') %>
|
7
|
+
</div>
|
6
8
|
<% end %>
|
7
9
|
|
8
10
|
<% content_for :code, flush: true do %>
|
9
|
-
|
11
|
+
<div class="w-full flex justify-center">
|
12
|
+
<%= code_partial("slider/preview", :erb) %>
|
13
|
+
</div>
|
10
14
|
<% end %>
|
11
15
|
|
12
16
|
<%= render_preview %>
|
17
|
+
|
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 slider
|
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("slider/usage", :erb) %>
|
25
|
+
|
26
|
+
<%= render_usage("slider") %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Textarea component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/textarea_helper.rb") %></li>
|
5
|
+
<li><%= code("app/views/components/ui/_textarea.html.erb") %></li>
|
6
|
+
</ul>
|
7
|
+
|
8
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
9
|
+
<%= code("render_textarea") %> accepts one keyword argument for the <%= code("name") %> of the textarea element.</p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_textarea name: "sample_textarea" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_textarea name: %>
|
@@ -2,11 +2,25 @@
|
|
2
2
|
description: "Displays a form textarea or a component that looks like a textarea." %>
|
3
3
|
|
4
4
|
<% content_for :preview, flush: true do %>
|
5
|
-
|
5
|
+
<div class="w-full flex justify-center">
|
6
|
+
<%= render_code_preview('textarea') %>
|
7
|
+
</div>
|
6
8
|
<% end %>
|
7
9
|
|
8
10
|
<% content_for :code, flush: true do %>
|
9
|
-
|
11
|
+
<div class="w-full flex justify-center">
|
12
|
+
<%= code_partial("textarea/preview", :erb) %>
|
13
|
+
</div>
|
10
14
|
<% end %>
|
11
15
|
|
12
16
|
<%= render_preview %>
|
17
|
+
|
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 textarea
|
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("textarea/usage", :erb) %>
|
25
|
+
|
26
|
+
<%= render_usage("textarea") %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Toast component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/toast_helper.rb") %></li>
|
5
|
+
<li><%= code("app/javascript/controllers/ui/toast_controller.js") %></li>
|
6
|
+
<li><%= code("app/views/components/ui/_toast.html.erb") %></li>
|
7
|
+
</ul>
|
8
|
+
|
9
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
10
|
+
<%= code("render_toast") %> accepts two keyword arguments, one for the <%= code("header") %> and the second for the <%= code("description") %>
|
11
|
+
or body of the toast. An optional 3rd argument can be provided for an <%= code("action") %> element like a button.</p>
|
@@ -3,13 +3,21 @@
|
|
3
3
|
|
4
4
|
<% content_for :preview, flush: true do %>
|
5
5
|
<%= render_button "Trigger Toast", variant: "outline", data: {controller: "ui--toast", action: "ui--toast#test"} %>
|
6
|
-
<%=
|
7
|
-
description: "Friday, February 10, 2023 at 5:57 PM",
|
8
|
-
action: render_button("Undo", variant: :outline) %>
|
6
|
+
<%= render_code_preview('toast') %>
|
9
7
|
<% end %>
|
10
8
|
|
11
9
|
<% content_for :code, flush: true do %>
|
12
|
-
|
10
|
+
<%= code_partial("toast/preview", :erb) %>
|
13
11
|
<% end %>
|
14
12
|
|
15
13
|
<%= render_preview %>
|
14
|
+
|
15
|
+
<h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
|
16
|
+
<%= code_sample(language: "sh") do %>
|
17
|
+
rails generate shadcn-ui toast
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<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>
|
21
|
+
<%= code_partial("toast/usage", :erb) %>
|
22
|
+
|
23
|
+
<%= render_usage("toast") %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Toggle component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/toggle_helper.rb") %></li>
|
5
|
+
<li><%= code("app/javascript/controllers/ui/toggle_controller.js") %></li>
|
6
|
+
<li><%= code("app/views/components/ui/_toggle.html.erb") %></li>
|
7
|
+
</ul>
|
8
|
+
|
9
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
10
|
+
<%= code("render_toggle") %> an argument for the content for the button that will become a toggle.</p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_toggle "𝐁" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_toggle 'content' %>
|
@@ -2,11 +2,25 @@
|
|
2
2
|
description: "A two-state button that can be either on or off." %>
|
3
3
|
|
4
4
|
<% content_for :preview, flush: true do %>
|
5
|
-
|
5
|
+
<div class="w-full flex justify-center">
|
6
|
+
<%= render_code_preview('toggle') %>
|
7
|
+
</div>
|
6
8
|
<% end %>
|
7
9
|
|
8
10
|
<% content_for :code, flush: true do %>
|
9
|
-
|
11
|
+
<div class="w-full flex justify-center">
|
12
|
+
<%= code_partial("toggle/preview", :erb) %>
|
13
|
+
</div>
|
10
14
|
<% end %>
|
11
15
|
|
12
16
|
<%= render_preview %>
|
17
|
+
|
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 toggle
|
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("toggle/usage", :erb) %>
|
25
|
+
|
26
|
+
<%= render_usage("toggle") %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Tooltip component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/tooltip_helper.rb") %></li>
|
5
|
+
<li><%= code("app/javascript/controllers/ui/tooltip_controller.js") %></li>
|
6
|
+
<li><%= code("app/views/components/ui/_tooltip.html.erb") %></li>
|
7
|
+
</ul>
|
8
|
+
|
9
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
10
|
+
<%= code("render_tooltip") %> accepts a block that contains calls to <%= code("tooltip_trigger") %> and <%= code("tooltip_content") %> each accepting a block for their respective content.
|
11
|
+
The <%= code("tooltip_trigger") %> is the element that upon hovering over, will reveal the <%= code("tooltip_content") %>.
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render_tooltip do %>
|
2
|
+
<%= tooltip_trigger do %>
|
3
|
+
<%= render_button "Hover", variant: :outline %>
|
4
|
+
<% end %>
|
5
|
+
<%= tooltip_content do %>
|
6
|
+
<div class="grid gap-2">
|
7
|
+
<div class="space-y-2">
|
8
|
+
<p class="text-sm text-muted-foreground">More will be revealed.</p>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|