shadcn-ui 0.0.1 → 0.0.3

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 (128) hide show
  1. checksums.yaml +4 -4
  2. data/.env +1 -0
  3. data/.prettierrc.json +6 -0
  4. data/README.md +260 -0
  5. data/Rakefile +6 -3
  6. data/app/assets/stylesheets/{application.scss → application.css} +0 -27
  7. data/app/assets/stylesheets/application.tailwind.css +46 -73
  8. data/app/assets/stylesheets/shadcn.css +216 -0
  9. data/app/controllers/components_controller.rb +1 -1
  10. data/app/controllers/documentation_controller.rb +10 -0
  11. data/app/helpers/application_helper.rb +19 -0
  12. data/app/helpers/components/accordion_helper.rb +14 -1
  13. data/app/helpers/components/alert_helper.rb +4 -2
  14. data/app/helpers/components/button_helper.rb +2 -1
  15. data/app/helpers/components/card_helper.rb +2 -2
  16. data/app/helpers/components/checkbox_helper.rb +2 -2
  17. data/app/helpers/components/collapsible_helper.rb +8 -0
  18. data/app/helpers/components/filter_helper.rb +12 -0
  19. data/app/helpers/components/input_helper.rb +21 -0
  20. data/app/helpers/components/label_helper.rb +5 -0
  21. data/app/helpers/components/list_helper.rb +15 -0
  22. data/app/helpers/components/progress_helper.rb +5 -0
  23. data/app/helpers/components/sheet_helper.rb +29 -0
  24. data/app/helpers/components/skeleton_helper.rb +5 -0
  25. data/app/helpers/components/slider_helper.rb +5 -0
  26. data/app/helpers/components_helper.rb +11 -0
  27. data/app/helpers/documentation_helper.rb +2 -0
  28. data/app/helpers/examples_helper.rb +1 -2
  29. data/app/javascript/controllers/theme_controller.js +25 -0
  30. data/app/javascript/controllers/ui/dialog_controller.js +3 -1
  31. data/app/javascript/controllers/ui/dropdown_controller.js +2 -22
  32. data/app/javascript/controllers/ui/filter_controller.js +20 -0
  33. data/app/javascript/controllers/ui/popover_controller.js +29 -1
  34. data/app/javascript/controllers/ui/sheet_controller.js +33 -0
  35. data/app/javascript/controllers/ui/slider_controller.js +14 -0
  36. data/app/javascript/controllers/ui/tooltip_controller.js +1 -1
  37. data/app/views/application/index.html.erb +122 -0
  38. data/app/views/components/ui/_accordion.html.erb +2 -2
  39. data/app/views/components/ui/_alert.html.erb +15 -3
  40. data/app/views/components/ui/_alert_dialog.html.erb +1 -1
  41. data/app/views/components/ui/_card.html.erb +2 -2
  42. data/app/views/components/ui/_checkbox.html.erb +3 -7
  43. data/app/views/components/ui/_collapsible.html.erb +2 -6
  44. data/app/views/components/ui/_command.html.erb +0 -0
  45. data/app/views/components/ui/_dialog.html.erb +1 -1
  46. data/app/views/components/ui/_filter.html.erb +14 -0
  47. data/app/views/components/ui/_input.html.erb +8 -0
  48. data/app/views/components/ui/_label.html.erb +3 -0
  49. data/app/views/components/ui/_list.html.erb +5 -0
  50. data/app/views/components/ui/_progress.html.erb +15 -0
  51. data/app/views/components/ui/_sheet.html.erb +44 -0
  52. data/app/views/components/ui/_skeleton.html.erb +1 -0
  53. data/app/views/components/ui/_slider.html.erb +2 -0
  54. data/app/views/components/ui/_textarea.html.erb +1 -1
  55. data/app/views/components/ui/shared/{_dialog_background.html.erb → _backdrop.html.erb} +1 -0
  56. data/app/views/components/ui/svg/_check.html.erb +11 -0
  57. data/app/views/documentation/about.html.md +20 -0
  58. data/app/views/documentation/generators.html.md +1 -0
  59. data/app/views/documentation/index.html.erb.bak +70 -0
  60. data/app/views/documentation/index.html.md +37 -0
  61. data/app/views/documentation/installation.html.md +377 -0
  62. data/app/views/examples/components/accordion/_usage.html.erb +15 -0
  63. data/app/views/examples/components/accordion/code/_block.html.erb +8 -0
  64. data/app/views/examples/components/accordion/code/_description.html.erb +7 -0
  65. data/app/views/examples/components/accordion/code/preview.erb +3 -0
  66. data/app/views/examples/components/accordion/code/usage.erb +16 -0
  67. data/app/views/examples/components/accordion.html.erb +36 -0
  68. data/app/views/examples/components/alert/_usage.html.erb +10 -0
  69. data/app/views/examples/components/alert/code/_attention.erb +3 -0
  70. data/app/views/examples/components/alert/code/_destructive.erb +2 -0
  71. data/app/views/examples/components/alert/code/_info.erb +3 -0
  72. data/app/views/examples/components/alert/code/_no_icon.erb +3 -0
  73. data/app/views/examples/components/alert/code/_success.erb +3 -0
  74. data/app/views/examples/components/alert/code/preview.erb +2 -0
  75. data/app/views/examples/components/alert/code/usage.erb +1 -0
  76. data/app/views/examples/components/alert.html.erb +90 -7
  77. data/app/views/examples/components/badge/_usage.html.erb +10 -0
  78. data/app/views/examples/components/badge/code/preview.erb +5 -0
  79. data/app/views/examples/components/badge/code/usage.erb +1 -0
  80. data/app/views/examples/components/badge.html.erb +11 -4
  81. data/app/views/examples/components/button/_usage.html.erb +19 -0
  82. data/app/views/examples/components/button/code/preview.erb +13 -0
  83. data/app/views/examples/components/button/code/usage.erb +6 -0
  84. data/app/views/examples/components/button.html.erb +20 -6
  85. data/app/views/examples/components/card/_usage.html.erb +21 -0
  86. data/app/views/examples/components/card/code/_form.erb +72 -0
  87. data/app/views/examples/components/card/code/_notifications.erb +61 -0
  88. data/app/views/examples/components/card/code/preview.erb +6 -0
  89. data/app/views/examples/components/card/code/usage.erb +3 -0
  90. data/app/views/examples/components/card.html.erb +35 -143
  91. data/app/views/examples/components/checkbox/_usage.html.erb +9 -0
  92. data/app/views/examples/components/checkbox/code/preview.erb +2 -0
  93. data/app/views/examples/components/checkbox/code/usage.erb +1 -0
  94. data/app/views/examples/components/checkbox.html.erb +14 -0
  95. data/app/views/examples/components/collapsible/_usage.html.erb +16 -0
  96. data/app/views/examples/components/collapsible/code/preview.erb +9 -0
  97. data/app/views/examples/components/collapsible/code/usage.erb +7 -0
  98. data/app/views/examples/components/collapsible.html.erb +13 -3
  99. data/app/views/examples/components/dialog.html.erb +1 -1
  100. data/app/views/examples/components/filter.html.erb +25 -0
  101. data/app/views/examples/components/input.html.erb +18 -0
  102. data/app/views/examples/components/label.html.erb +13 -0
  103. data/app/views/examples/components/progress.html.erb +12 -0
  104. data/app/views/examples/components/sheet.html.erb +19 -0
  105. data/app/views/examples/components/skeleton.html.erb +12 -0
  106. data/app/views/examples/components/slider.html.erb +12 -0
  107. data/app/views/layouts/application.html.erb +2 -3
  108. data/app/views/layouts/component.html.erb +2 -2
  109. data/app/views/layouts/documentation.html.erb +39 -0
  110. data/app/views/layouts/shared/_components.html.erb +62 -0
  111. data/app/views/layouts/shared/_header.html.erb +25 -33
  112. data/app/views/layouts/shared/_sidebar.html.erb +10 -0
  113. data/config/application.rb +2 -1
  114. data/config/importmap.rb +6 -6
  115. data/config/initializers/markdown.rb +24 -0
  116. data/config/routes.rb +7 -1
  117. data/config/shadcn.tailwind.js +98 -0
  118. data/config/tailwind.config.js +13 -74
  119. data/lib/components.json +305 -0
  120. data/lib/generators/shadcn-ui_generator.rb +201 -0
  121. data/lib/shadcn-ui/version.rb +1 -1
  122. data/package-lock.json +90 -3
  123. data/package.json +4 -0
  124. data/public/accordion.png +0 -0
  125. metadata +81 -7
  126. data/app/views/layouts/_sidebar.html.erb +0 -270
  127. data/lib/generators/shadcn_ui_generator.rb +0 -32
  128. /data/app/assets/stylesheets/{lambda.light.scss → lambda.light.css} +0 -0
@@ -18,13 +18,20 @@
18
18
  <div class="w-full mx-auto flex justify-center">
19
19
  <%= render_badge text: "Ghost", variant: :ghost %>
20
20
  </div>
21
- <div class="w-full mx-auto flex justify-center">
22
- <%= render_badge text: "Ghost Link", variant: :ghost, as: :link %>
23
- </div>
21
+ <% end %>
22
+
23
+ <% content_for :code, flush: true do %>
24
+ <%= code_partial("badge/code/preview", :erb) %>
24
25
  <% end %>
25
26
 
26
27
  <%= render_preview %>
27
28
 
28
29
  <h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
30
+ <%= code_sample(language: "sh") do %>
31
+ rails generate shadcn-ui badge
32
+ <% end %>
33
+
34
+ <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>
35
+ <%= code_partial("badge/code/usage", :erb) %>
29
36
 
30
- <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>
37
+ <%= render_usage("badge") %>
@@ -0,0 +1,19 @@
1
+ <p class="leading-7 [&:not(:first-child)]:mt-6">The Button component introduces:</p>
2
+
3
+ <ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
4
+ <li><%= code("app/helpers/components/button_helper.rb") %></li>
5
+ <li><%= code("app/views/components/ui/_button.html.erb") %></li>
6
+ </ul>
7
+
8
+ <p class="leading-7 [&:not(:first-child)]:mt-6">
9
+
10
+ <p>The method <%= code("render_button") %> defined in <%= code("app/helpers/components/button_helper.rb") %>
11
+ accepts a first argument for the text of the button or as a <%= code("text:") %> keyword argument.</p>
12
+
13
+ <p>Optional arguments for the button include:
14
+
15
+ <ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
16
+ <li><%= code("variant:") %>, including <%= code(":secondary") %>, <%= code(":destructive") %>, <%= code(":outline") %>, and <%= code(":ghost") %></li>
17
+ <li><%= code("as:") %> which allows the button to be rendered as a <%= code("<a>") %> tag.</li>
18
+ <li>A <%= code("block") %> can be passed to render the text including other elements such as icons.</li>
19
+ </ul>
@@ -0,0 +1,13 @@
1
+ <%= render_button "Button" %>
2
+
3
+ <%= render_button variant: :secondary do %>
4
+ <svg class="h-4 w-4 mr-2 text-primary" viewBox="0 0 20 20" fill="none" stroke="currentColor" aria-hidden="true">
5
+ <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd"></path>
6
+ </svg> Secondary with Icon
7
+ <% end %>
8
+
9
+ <%= render_button text: "Destructive", variant: :destructive %>
10
+ <%= render_button text: "Outline", variant: :outline %>
11
+ <%= render_button text: "Ghost", variant: :ghost %>
12
+ <%= render_button "Link", as: :link, href: "/" %>
13
+ <%= render_button text: "Ghost Link", variant: :ghost, as: :link %>
@@ -0,0 +1,6 @@
1
+ <%= render_button(label, text: nil,
2
+ variant: :default,
3
+ as: :button,
4
+ href: nil,
5
+ data: {},
6
+ **options, &block) %>
@@ -5,12 +5,13 @@
5
5
  description: "Displays a button or a component that looks like a button." %>
6
6
 
7
7
  <%= content_for :preview, flush: true do %>
8
- <div class="w-full mx-auto flex justify-center"><%= render_button text: "Button" %></div>
8
+ <div class="w-full mx-auto flex justify-center"><%= render_button "Button" %></div>
9
9
  <div class="w-full mx-auto flex justify-center">
10
- <%= render_button text: "Link", as: :link, href: "/" %>
11
- </div>
12
- <div class="w-full mx-auto flex justify-center">
13
- <%= render_button text: "Secondary", variant: :secondary %>
10
+ <%= render_button variant: :secondary do %>
11
+ <svg class="h-4 w-4 mr-2 text-primary" viewBox="0 0 20 20" fill="none" stroke="currentColor" aria-hidden="true">
12
+ <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd"></path>
13
+ </svg> Secondary with Icon
14
+ <% end %>
14
15
  </div>
15
16
  <div class="w-full mx-auto flex justify-center">
16
17
  <%= render_button text: "Destructive", variant: :destructive %>
@@ -21,13 +22,26 @@
21
22
  <div class="w-full mx-auto flex justify-center">
22
23
  <%= render_button text: "Ghost", variant: :ghost %>
23
24
  </div>
25
+ <div class="w-full mx-auto flex justify-center">
26
+ <%= render_button "Link", as: :link, href: "/" %>
27
+ </div>
24
28
  <div class="w-full mx-auto flex justify-center">
25
29
  <%= render_button text: "Ghost Link", variant: :ghost, as: :link %>
26
30
  </div>
27
31
  <% end %>
28
32
 
33
+ <% content_for :code, flush: true do %>
34
+ <%= code_partial("button/code/preview", :erb) %>
35
+ <% end %>
36
+
29
37
  <%= render_preview %>
30
38
 
31
39
  <h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
40
+ <%= code_sample(language: "sh") do %>
41
+ rails generate shadcn-ui button
42
+ <% end %>
43
+
44
+ <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>
45
+ <%= code_partial("button/code/usage", :erb) %>
32
46
 
33
- <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>
47
+ <%= render_usage("button") %>
@@ -0,0 +1,21 @@
1
+ <p class="leading-7 [&:not(:first-child)]:mt-6">The 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/card_helper.rb") %></li>
5
+ <li><%= code("app/views/components/ui/_card.html.erb") %></li>
6
+ </ul>
7
+
8
+ <p class="leading-7 [&:not(:first-child)]:mt-6">
9
+
10
+ <p>The method <%= code("render_card") %> defined in <%= code("app/helpers/components/card_helper.rb") %>
11
+ accepts optional keyword arguments for each section of content in the card, offering maximum flexibility. </p>
12
+
13
+ <p>The sections are.</p>
14
+
15
+ <ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
16
+ <li><%= code("title:") %>, for the header of the card, will be rendered in a large bold font.</li>
17
+ <li><%= code("subtitle:") %> for a muted title under the main title..</li>
18
+ <li>A <%= code("body:") %> The main content section. Without providing either a keyword argument or a block, an empty card will be rendered.</li>
19
+ </ul>
20
+
21
+ <p><em>Note:</em> Padding to the body is applied logically leaving you to define it when a block is passed with the presence of a title, otherwise, a default padding is provided to simplify the markup. Feel free to edit this in <%= code("app/views/components/ui/_card.html.erb") %>,
@@ -0,0 +1,72 @@
1
+ <%= render_card title: "Card with Form" do %>
2
+ <div class="p-6 pt-0">
3
+ <form>
4
+ <div class="grid w-full items-center gap-4">
5
+ <div class="flex flex-col space-y-1.5">
6
+ <label
7
+ class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
8
+ for="name">Name</label><input
9
+ class="flex h-10 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"
10
+ id="name"
11
+ placeholder="Name of your project">
12
+ </div>
13
+ <div class="flex flex-col space-y-1.5">
14
+ <label
15
+ class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
16
+ for="name">Framework</label><button
17
+ type="button"
18
+ role="combobox"
19
+ aria-controls="radix-:r76:"
20
+ aria-expanded="false"
21
+ aria-autocomplete="none"
22
+ dir="ltr"
23
+ data-state="closed"
24
+ data-placeholder=""
25
+ class="flex h-10 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50">
26
+ <span style="pointer-events: none">Select</span><svg
27
+ xmlns="http://www.w3.org/2000/svg"
28
+ width="24"
29
+ height="24"
30
+ viewBox="0 0 24 24"
31
+ fill="none"
32
+ stroke="currentColor"
33
+ stroke-width="2"
34
+ stroke-linecap="round"
35
+ stroke-linejoin="round"
36
+ class="h-4 w-4 opacity-50"
37
+ aria-hidden="true">
38
+ <polyline points="6 9 12 15 18 9"></polyline>
39
+ </svg></button><select
40
+ aria-hidden="true"
41
+ tabindex="-1"
42
+ style="
43
+ position: absolute;
44
+ border: 0px;
45
+ width: 1px;
46
+ height: 1px;
47
+ padding: 0px;
48
+ margin: -1px;
49
+ overflow: hidden;
50
+ clip: rect(0px, 0px, 0px, 0px);
51
+ white-space: nowrap;
52
+ overflow-wrap: normal;
53
+ ">
54
+ <option value=""></option>
55
+ <option value="next">Next.js</option>
56
+ <option value="sveltekit">SvelteKit</option>
57
+ <option value="astro">Astro</option>
58
+ <option value="nuxt">Nuxt.js</option>
59
+ </select>
60
+ </div>
61
+ </div>
62
+ </form>
63
+ </div>
64
+ <div class="items-center p-6 pt-0 flex justify-between">
65
+ <button
66
+ class="inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2">
67
+ Cancel</button><button
68
+ class="inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground hover:bg-primary/90 h-10 px-4 py-2">
69
+ Deploy
70
+ </button>
71
+ </div>
72
+ <% end %>
@@ -0,0 +1,61 @@
1
+ <%= render_card title: "Notifications", footer: render_button(text: "Mark all as read", class:
2
+ "w-full") do %>
3
+ <div class="p-6 pt-0 grid gap-4">
4
+ <div class="flex items-center space-x-4 rounded-md border p-4">
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ width="24"
8
+ height="24"
9
+ viewBox="0 0 24 24"
10
+ fill="none"
11
+ stroke="currentColor"
12
+ stroke-width="2"
13
+ stroke-linecap="round"
14
+ stroke-linejoin="round"
15
+ class="lucide lucide-bell-ring">
16
+ <path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"></path>
17
+ <path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"></path>
18
+ <path d="M4 2C2.8 3.7 2 5.7 2 8"></path>
19
+ <path d="M22 8c0-2.3-.8-4.3-2-6"></path>
20
+ </svg>
21
+ <div class="flex-1 space-y-1">
22
+ <p class="text-sm font-medium leading-none">Push Notifications</p>
23
+ <p class="text-sm text-muted-foreground">Send notifications to device.</p>
24
+ </div>
25
+ <button
26
+ type="button"
27
+ role="switch"
28
+ aria-checked="false"
29
+ data-state="unchecked"
30
+ value="on"
31
+ class="peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input">
32
+ <span
33
+ data-state="unchecked"
34
+ class="pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"></span>
35
+ </button>
36
+ </div>
37
+ <div>
38
+ <div class="mb-4 grid grid-cols-[25px_1fr] items-start pb-4 last:mb-0 last:pb-0">
39
+ <span class="flex h-2 w-2 translate-y-1 rounded-full bg-sky-500"></span>
40
+ <div class="space-y-1">
41
+ <p class="text-sm font-medium leading-none">Your call has been confirmed.</p>
42
+ <p class="text-sm text-muted-foreground">1 hour ago</p>
43
+ </div>
44
+ </div>
45
+ <div class="mb-4 grid grid-cols-[25px_1fr] items-start pb-4 last:mb-0 last:pb-0">
46
+ <span class="flex h-2 w-2 translate-y-1 rounded-full bg-sky-500"></span>
47
+ <div class="space-y-1">
48
+ <p class="text-sm font-medium leading-none">You have a new message!</p>
49
+ <p class="text-sm text-muted-foreground">1 hour ago</p>
50
+ </div>
51
+ </div>
52
+ <div class="mb-4 grid grid-cols-[25px_1fr] items-start pb-4 last:mb-0 last:pb-0">
53
+ <span class="flex h-2 w-2 translate-y-1 rounded-full bg-sky-500"></span>
54
+ <div class="space-y-1">
55
+ <p class="text-sm font-medium leading-none">Your subscription is expiring soon!</p>
56
+ <p class="text-sm text-muted-foreground">2 hours ago</p>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <%= render_card body: "The Most Basic of Cards" %>
2
+
3
+ <%= render_card title: "Did you know?",
4
+ subtitle: "This is kinda cool."
5
+ body: "You can embed any HTML in the body with a block.",
6
+ footer: "Have a great day!" %>
@@ -0,0 +1,3 @@
1
+ <%= render(title: nil, subtitle: nil, body: nil, footer: nil:) do %>
2
+ <!-- Optional Body Block -->
3
+ <% end %>
@@ -4,153 +4,45 @@
4
4
  description: "Displays a card with header, content, and footer." %>
5
5
 
6
6
  <%= content_for :preview, flush: true do %>
7
- <div class="w-full flex justify-center"><%= render_card body: "The Most Basic of Cards" %></div>
8
- <div class="w-full flex justify-center">
9
- <%= render_card title: "Did you know?", body: "You can embed any HTML in the body of a card by
10
- yielding to a block for the body?", subtitle: "This is important." %>
11
- </div>
12
-
13
- <div class="w-full flex justify-center">
14
- <%= render_card title: "Card with Form" do %>
15
- <div class="p-6 pt-0">
16
- <form>
17
- <div class="grid w-full items-center gap-4">
18
- <div class="flex flex-col space-y-1.5">
19
- <label
20
- class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
21
- for="name">Name</label><input
22
- class="flex h-10 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"
23
- id="name"
24
- placeholder="Name of your project">
25
- </div>
26
- <div class="flex flex-col space-y-1.5">
27
- <label
28
- class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
29
- for="name">Framework</label><button
30
- type="button"
31
- role="combobox"
32
- aria-controls="radix-:r76:"
33
- aria-expanded="false"
34
- aria-autocomplete="none"
35
- dir="ltr"
36
- data-state="closed"
37
- data-placeholder=""
38
- class="flex h-10 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50">
39
- <span style="pointer-events: none">Select</span><svg
40
- xmlns="http://www.w3.org/2000/svg"
41
- width="24"
42
- height="24"
43
- viewBox="0 0 24 24"
44
- fill="none"
45
- stroke="currentColor"
46
- stroke-width="2"
47
- stroke-linecap="round"
48
- stroke-linejoin="round"
49
- class="h-4 w-4 opacity-50"
50
- aria-hidden="true">
51
- <polyline points="6 9 12 15 18 9"></polyline>
52
- </svg></button><select
53
- aria-hidden="true"
54
- tabindex="-1"
55
- style="
56
- position: absolute;
57
- border: 0px;
58
- width: 1px;
59
- height: 1px;
60
- padding: 0px;
61
- margin: -1px;
62
- overflow: hidden;
63
- clip: rect(0px, 0px, 0px, 0px);
64
- white-space: nowrap;
65
- overflow-wrap: normal;
66
- ">
67
- <option value=""></option>
68
- <option value="next">Next.js</option>
69
- <option value="sveltekit">SvelteKit</option>
70
- <option value="astro">Astro</option>
71
- <option value="nuxt">Nuxt.js</option>
72
- </select>
73
- </div>
74
- </div>
75
- </form>
76
- </div>
77
- <div class="items-center p-6 pt-0 flex justify-between">
78
- <button
79
- class="inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2">
80
- Cancel</button><button
81
- class="inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground hover:bg-primary/90 h-10 px-4 py-2">
82
- Deploy
83
- </button>
84
- </div>
85
- <% end %>
86
- </div>
87
- <div class="w-full flex justify-center">
88
- <%= render_card title: "Notifications", footer: render_button(text: "Mark all as read", class:
89
- "w-full") do %>
90
- <div class="p-6 pt-0 grid gap-4">
91
- <div class="flex items-center space-x-4 rounded-md border p-4">
92
- <svg
93
- xmlns="http://www.w3.org/2000/svg"
94
- width="24"
95
- height="24"
96
- viewBox="0 0 24 24"
97
- fill="none"
98
- stroke="currentColor"
99
- stroke-width="2"
100
- stroke-linecap="round"
101
- stroke-linejoin="round"
102
- class="lucide lucide-bell-ring">
103
- <path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"></path>
104
- <path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"></path>
105
- <path d="M4 2C2.8 3.7 2 5.7 2 8"></path>
106
- <path d="M22 8c0-2.3-.8-4.3-2-6"></path>
107
- </svg>
108
- <div class="flex-1 space-y-1">
109
- <p class="text-sm font-medium leading-none">Push Notifications</p>
110
- <p class="text-sm text-muted-foreground">Send notifications to device.</p>
111
- </div>
112
- <button
113
- type="button"
114
- role="switch"
115
- aria-checked="false"
116
- data-state="unchecked"
117
- value="on"
118
- class="peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input">
119
- <span
120
- data-state="unchecked"
121
- class="pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"></span>
122
- </button>
123
- </div>
124
- <div>
125
- <div class="mb-4 grid grid-cols-[25px_1fr] items-start pb-4 last:mb-0 last:pb-0">
126
- <span class="flex h-2 w-2 translate-y-1 rounded-full bg-sky-500"></span>
127
- <div class="space-y-1">
128
- <p class="text-sm font-medium leading-none">Your call has been confirmed.</p>
129
- <p class="text-sm text-muted-foreground">1 hour ago</p>
130
- </div>
131
- </div>
132
- <div class="mb-4 grid grid-cols-[25px_1fr] items-start pb-4 last:mb-0 last:pb-0">
133
- <span class="flex h-2 w-2 translate-y-1 rounded-full bg-sky-500"></span>
134
- <div class="space-y-1">
135
- <p class="text-sm font-medium leading-none">You have a new message!</p>
136
- <p class="text-sm text-muted-foreground">1 hour ago</p>
137
- </div>
138
- </div>
139
- <div class="mb-4 grid grid-cols-[25px_1fr] items-start pb-4 last:mb-0 last:pb-0">
140
- <span class="flex h-2 w-2 translate-y-1 rounded-full bg-sky-500"></span>
141
- <div class="space-y-1">
142
- <p class="text-sm font-medium leading-none">Your subscription is expiring soon!</p>
143
- <p class="text-sm text-muted-foreground">2 hours ago</p>
144
- </div>
145
- </div>
146
- </div>
7
+ <div class="w-full flex justify-center"><%= render_card body: "The Most Basic of Cards" %></div>
8
+ <div class="w-full flex justify-center">
9
+ <%= render_card title: "Did you know?", body: "You can embed any HTML in the body of a card by
10
+ yielding to a block for the body?", subtitle: "This is important.", footer: "Have a great day!" %>
147
11
  </div>
148
- <% end %>
149
- </div>
12
+ <% end %>
13
+
14
+ <% content_for :code, flush: true do %>
15
+ <%= code_partial("card/code/preview", :erb) %>
150
16
  <% end %>
151
17
 
152
18
  <%= render_preview %>
153
19
 
154
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 card
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("card/code/usage", :erb) %>
27
+
28
+ <%= render_usage("card") %>
29
+
30
+ <% content_for :examples, flush: true do %>
31
+ <%= render "examples/components/card/code/form" %>
32
+ <% end %>
33
+
34
+ <% content_for :code, flush: true do %>
35
+ <%= code_partial("card/code/_form", :erb) %>
36
+ <% end %>
37
+
38
+ <%= render_example %>
39
+
40
+ <% content_for :examples, flush: true do %>
41
+ <%= render "examples/components/card/code/notifications" %>
42
+ <% end %>
43
+
44
+ <% content_for :code, flush: true do %>
45
+ <%= code_partial("card/code/_notifications", :erb) %>
46
+ <% end %>
155
47
 
156
- <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>
48
+ <%= render_example %>
@@ -0,0 +1,9 @@
1
+ <p class="leading-7 [&:not(:first-child)]:mt-6">The Checkbox component introduces:</p>
2
+
3
+ <ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
4
+ <li><%= code("app/helpers/components/checkbox_helper.rb") %></li>
5
+ <li><%= code("app/views/components/ui/_checkbox.html.erb") %></li>
6
+ <li><%= code("app/javascript/controllers/ui/checkbox_controller.js") %></li>
7
+ </ul>
8
+
9
+ <p class="leading-7 [&:not(:first-child)]:mt-6"><%= code("render_checkbox") %> accepts two required arguments, one for the <%= code("name:") %> of the checkbox which will pair with <%= code("label:") %> of the checkbox. The toggle functionality is controller by <%= code("app/javascript/controllers/ui/checkbox_controller.js") %>.</p>
@@ -0,0 +1,2 @@
1
+ <%= render_checkbox name: "terms",
2
+ label: "Accept terms and conditions", %>
@@ -0,0 +1 @@
1
+ <%= render_checkbox(label:, name:) %>
@@ -5,4 +5,18 @@
5
5
  <%= render_checkbox label: "Accept terms and conditions", name: "terms" %>
6
6
  <% end %>
7
7
 
8
+ <% content_for :code, flush: true do %>
9
+ <%= code_partial("checkbox/code/preview", :erb) %>
10
+ <% end %>
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/code/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 %>
@@ -0,0 +1,7 @@
1
+ <%= render_collapsible trigger: do %>
2
+ <% collapsible_preview do %>
3
+ <% end %>
4
+
5
+ <% collapsible_body do %>
6
+ <% end %>
7
+ <% end %>
@@ -6,10 +6,10 @@
6
6
  <%= content_for :preview, flush: true do %>
7
7
  <div class="w-full flex justify-center">
8
8
  <%= render_collapsible trigger: "@peduarte starred 3 repositories" do %>
9
- <% content_for :preview do %>
9
+ <% collapsible_preview do %>
10
10
  <div class="rounded-md border px-4 py-3 font-mono text-sm">@radix-ui/primitives</div>
11
11
  <% end %>
12
- <% content_for :body do %>
12
+ <% collapsible_body do %>
13
13
  <div class="rounded-md border px-4 py-3 font-mono text-sm">@radix-ui/colors</div>
14
14
  <div class="rounded-md border px-4 py-3 font-mono text-sm">@stitches/react</div>
15
15
  <% end %>
@@ -17,8 +17,18 @@
17
17
  </div>
18
18
  <% end %>
19
19
 
20
+ <% content_for :code, flush: true do %>
21
+ <%= code_partial("collapsible/code/preview", :erb) %>
22
+ <% end %>
23
+
20
24
  <%= render_preview %>
21
25
 
22
26
  <h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
27
+ <%= code_sample(language: "sh") do %>
28
+ rails generate shadcn-ui collapsible
29
+ <% end %>
30
+
31
+ <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>
32
+ <%= code_partial("collapsible/code/usage", :erb) %>
23
33
 
24
- <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>
34
+ <%= render_usage("collapsible") %>
@@ -25,7 +25,7 @@
25
25
  <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
26
 
27
27
  <%= code_sample(language: "sh") do %>
28
- rails generate shadcn-ui dialog
28
+ rails generate shadcn_ui dialog
29
29
  <% end %>
30
30
 
31
31
  <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>
@@ -0,0 +1,25 @@
1
+ <%
2
+ items = [{:value => "Ruby on Rails", name: "Ruby on Rails"}, {:value => "Next.js", name: "Next.js"}, {:value => "Remix.run", name: "Remix.run"}]
3
+ %>
4
+
5
+ <%= render_component_header title: "Filter",
6
+ description: "Displays a list that is filterable via the included input." %>
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 %>
15
+ <% end %>
16
+
17
+ <%= render_preview %>
18
+
19
+ <% content_for :examples, flush: true do %>
20
+ <div class="w-full flex justify-center">
21
+ <%= render_filter items, class: "p-1" do %>
22
+ <% end %>
23
+ <% end %>
24
+
25
+ <%= render_example %>