shadcn-ui 0.0.3 → 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.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/documentation_controller.rb +0 -1
  3. data/app/helpers/components/input_helper.rb +1 -1
  4. data/app/helpers/components/slider_helper.rb +1 -1
  5. data/app/helpers/examples_helper.rb +6 -1
  6. data/app/javascript/controllers/highlight_controller.js +0 -1
  7. data/app/javascript/controllers/ui/popover_controller.js +6 -2
  8. data/app/views/application/index.html.erb +625 -17
  9. data/app/views/components/ui/_card.html.erb +7 -1
  10. data/app/views/components/ui/_filter.html.erb +2 -1
  11. data/app/views/documentation/generators.html.md +20 -0
  12. data/app/views/documentation/helpers.html.md +54 -0
  13. data/app/views/documentation/javascript.html.md +8 -0
  14. data/app/views/examples/components/accordion.html.erb +5 -7
  15. data/app/views/examples/components/alert-dialog/code/_preview.erb +6 -0
  16. data/app/views/examples/components/alert-dialog/code/_usage.erb +0 -0
  17. data/app/views/examples/components/alert-dialog.html.erb +8 -11
  18. data/app/views/examples/components/alert.html.erb +9 -10
  19. data/app/views/examples/components/badge.html.erb +3 -15
  20. data/app/views/examples/components/button.html.erb +3 -25
  21. data/app/views/examples/components/card/code/{preview.erb → _preview.erb} +1 -1
  22. data/app/views/examples/components/card.html.erb +5 -9
  23. data/app/views/examples/components/checkbox/code/_preview.erb +2 -0
  24. data/app/views/examples/components/checkbox.html.erb +3 -3
  25. data/app/views/examples/components/collapsible.html.erb +3 -11
  26. data/app/views/examples/components/dialog.html.erb +5 -14
  27. data/app/views/examples/components/dropdown-menu/_usage.html.erb +19 -0
  28. data/app/views/examples/components/dropdown-menu/code/_preview.erb +19 -0
  29. data/app/views/examples/components/dropdown-menu/code/_usage.erb +13 -0
  30. data/app/views/examples/components/dropdown-menu.html.erb +29 -15
  31. data/app/views/examples/components/filter/_usage.html.erb +14 -0
  32. data/app/views/examples/components/filter/code/_icon.html.erb +7 -0
  33. data/app/views/examples/components/filter/code/_preview.erb +3 -0
  34. data/app/views/examples/components/filter/code/_usage.erb +5 -0
  35. data/app/views/examples/components/filter.html.erb +27 -7
  36. data/app/views/examples/components/hover-card/_usage.html.erb +15 -0
  37. data/app/views/examples/components/hover-card/code/_preview.erb +13 -0
  38. data/app/views/examples/components/hover-card/code/_usage.erb +6 -0
  39. data/app/views/examples/components/hover-card.html.erb +12 -14
  40. data/app/views/examples/components/input/_usage.html.erb +10 -0
  41. data/app/views/examples/components/input/code/_borderless.erb +3 -0
  42. data/app/views/examples/components/input/code/_preview.erb +1 -0
  43. data/app/views/examples/components/input/code/_usage.erb +1 -0
  44. data/app/views/examples/components/input.html.erb +17 -3
  45. data/app/views/examples/components/label/_usage.html.erb +9 -0
  46. data/app/views/examples/components/label/code/_preview.erb +5 -0
  47. data/app/views/examples/components/label/code/_usage.erb +1 -0
  48. data/app/views/examples/components/label.html.erb +14 -5
  49. data/app/views/examples/components/popover/_usage.html.erb +12 -0
  50. data/app/views/examples/components/popover/code/_form.erb +23 -0
  51. data/app/views/examples/components/popover/code/_preview.erb +13 -0
  52. data/app/views/examples/components/popover/code/_usage.erb +7 -0
  53. data/app/views/examples/components/popover.html.erb +28 -24
  54. data/app/views/examples/components/progress/_usage.erb +9 -0
  55. data/app/views/examples/components/progress/code/_preview.erb +1 -0
  56. data/app/views/examples/components/progress/code/_usage.erb +1 -0
  57. data/app/views/examples/components/progress.html.erb +12 -2
  58. data/app/views/examples/components/separator/_usage.html.erb +10 -0
  59. data/app/views/examples/components/separator/code/_fancy.erb +21 -0
  60. data/app/views/examples/components/separator/code/_preview.erb +1 -0
  61. data/app/views/examples/components/separator/code/_usage.erb +1 -0
  62. data/app/views/examples/components/separator.html.erb +26 -19
  63. data/app/views/examples/components/sheet/_usage.html.erb +38 -0
  64. data/app/views/examples/components/sheet/code/_mobile_menu.erb +17 -0
  65. data/app/views/examples/components/sheet/code/_preview.erb +22 -0
  66. data/app/views/examples/components/sheet/code/_usage.erb +7 -0
  67. data/app/views/examples/components/sheet.html.erb +17 -10
  68. data/app/views/examples/components/skeleton/_usage.html.erb +9 -0
  69. data/app/views/examples/components/skeleton/code/_preview.erb +1 -0
  70. data/app/views/examples/components/skeleton/code/_usage.erb +1 -0
  71. data/app/views/examples/components/skeleton.html.erb +16 -2
  72. data/app/views/examples/components/slider/_usage.html.erb +11 -0
  73. data/app/views/examples/components/slider/code/_preview.erb +3 -0
  74. data/app/views/examples/components/slider/code/_usage.erb +1 -0
  75. data/app/views/examples/components/slider.html.erb +16 -2
  76. data/app/views/examples/components/textarea/_usage.html.erb +9 -0
  77. data/app/views/examples/components/textarea/code/_preview.erb +1 -0
  78. data/app/views/examples/components/textarea/code/_usage.erb +1 -0
  79. data/app/views/examples/components/textarea.html.erb +16 -2
  80. data/app/views/examples/components/toast/_usage.html.erb +11 -0
  81. data/app/views/examples/components/toast/code/_preview.erb +3 -0
  82. data/app/views/examples/components/toast/code/_usage.erb +2 -0
  83. data/app/views/examples/components/toast.html.erb +12 -4
  84. data/app/views/examples/components/toggle/_usage.html.erb +10 -0
  85. data/app/views/examples/components/toggle/code/_preview.erb +1 -0
  86. data/app/views/examples/components/toggle/code/_usage.erb +1 -0
  87. data/app/views/examples/components/toggle.html.erb +16 -2
  88. data/app/views/examples/components/tooltip/_usage.html.erb +11 -0
  89. data/app/views/examples/components/tooltip/code/_preview.erb +12 -0
  90. data/app/views/examples/components/tooltip/code/_usage.erb +7 -0
  91. data/app/views/examples/components/tooltip.html.erb +16 -13
  92. data/app/views/layouts/shared/_components.html.erb +35 -33
  93. data/config/environments/production.rb +4 -4
  94. data/lib/shadcn-ui/version.rb +1 -1
  95. metadata +74 -20
  96. data/app/views/examples/components/checkbox/code/preview.erb +0 -2
  97. /data/app/views/examples/components/accordion/code/{preview.erb → _preview.erb} +0 -0
  98. /data/app/views/examples/components/accordion/code/{usage.erb → _usage.erb} +0 -0
  99. /data/app/views/examples/components/alert/code/{preview.erb → _preview.erb} +0 -0
  100. /data/app/views/examples/components/alert/code/{usage.erb → _usage.erb} +0 -0
  101. /data/app/views/examples/components/badge/code/{preview.erb → _preview.erb} +0 -0
  102. /data/app/views/examples/components/badge/code/{usage.erb → _usage.erb} +0 -0
  103. /data/app/views/examples/components/button/code/{preview.erb → _preview.erb} +0 -0
  104. /data/app/views/examples/components/button/code/{usage.erb → _usage.erb} +0 -0
  105. /data/app/views/examples/components/card/code/{usage.erb → _usage.erb} +0 -0
  106. /data/app/views/examples/components/checkbox/code/{usage.erb → _usage.erb} +0 -0
  107. /data/app/views/examples/components/collapsible/code/{preview.erb → _preview.erb} +0 -0
  108. /data/app/views/examples/components/collapsible/code/{usage.erb → _usage.erb} +0 -0
  109. /data/app/views/examples/components/dialog/code/{form.erb → _form.erb} +0 -0
  110. /data/app/views/examples/components/dialog/code/{notifications.erb → _notifications.erb} +0 -0
  111. /data/app/views/examples/components/dialog/code/{preview.erb → _preview.erb} +0 -0
  112. /data/app/views/examples/components/dialog/code/{usage.erb → _usage.erb} +0 -0
@@ -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 %>
@@ -0,0 +1,3 @@
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 %>
@@ -0,0 +1,5 @@
1
+ <%= render_filter items do %>
2
+ <%# Optional %>
3
+ <%= filter_icon do %>
4
+ <% end %>
5
+ <% 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
- <% content_for :preview, flush: true do %>
9
- <div class="w-full flex justify-center">
10
- <%= render_filter items, class: "p-1" do %>
11
- <%= filter_icon do %>
12
- <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>
13
- <% end %>
14
- <% end %>
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 %>
@@ -0,0 +1,6 @@
1
+ <%= render_hover_card do %>
2
+ <%= hover_card_trigger do %>
3
+ <% end %>
4
+ <%= hover_card_content do %>
5
+ <% end %>
6
+ <% 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
- <%= render_hover_card do %>
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,3 @@
1
+ <%= render_input name: "sample_input",
2
+ id: "sample_input",
3
+ variant: :borderless %>
@@ -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
- <%= render_input name: "sample_input", id: "sample_input" %>
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", style: :borderless %>
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,5 @@
1
+ <%= render_label name: "sample_input",
2
+ label: "Sample Input",
3
+ class: "block text-left w-full" %>
4
+
5
+ <%= render_input name: "sample_input", id: "sample_input" %>
@@ -0,0 +1 @@
1
+ <%= render_label name:, label: %>
@@ -1,13 +1,22 @@
1
- <%= render_component_header title: "Input",
2
- description: "Displays a form input field or a component that looks like an input field." %>
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
- <%= render_label name: "sample_input", label: "Sample Input", class: "block text-left w-full" %>
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 %>
@@ -0,0 +1,7 @@
1
+ <%= render_popover do %>
2
+ <%= popover_trigger do %>
3
+ <% end %>
4
+
5
+ <%= popover_content do %>
6
+ <% end %>
7
+ <% end %>
@@ -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
- <%= render_popover do %>
6
- <%= popover_trigger do %>
7
- <%= render_button "Open Popover", variant: :outline %>
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
- <%= render_progress value: 37 %>
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: "Seperator",
4
+ title: "Separator",
5
5
  description: "Visually or semantically separates content." %>
6
6
  <%= content_for :preview, flush: true do %>
7
- <div>
8
- <div class="space-y-1">
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 %>
@@ -0,0 +1,7 @@
1
+ <%= render_sheet direction: "right" do %>
2
+ <%= sheet_trigger do %>
3
+ <% end %>
4
+
5
+ <%= sheet_content do %>
6
+ <% end %>
7
+ <% end %>