shadcn-ui 0.0.4 → 0.0.8
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/README.md +13 -314
- data/Rakefile +90 -0
- data/app/assets/stylesheets/shadcn.css +9 -1
- data/app/controllers/components_controller.rb +1 -0
- data/app/controllers/users_controller.rb +19 -0
- data/app/form_builders/shadcn_form_builder.rb +43 -0
- data/app/helpers/application_helper.rb +5 -0
- data/app/helpers/components/alert_dialog_helper.rb +19 -3
- data/app/helpers/components/alert_helper.rb +7 -3
- data/app/helpers/components/badge_helper.rb +4 -1
- data/app/helpers/components/combobox_helper.rb +10 -0
- data/app/helpers/components/forms_helper.rb +13 -0
- data/app/helpers/components/input_helper.rb +14 -4
- data/app/helpers/components/{seperator_helper.rb → separator_helper.rb} +1 -1
- data/app/helpers/components/slider_helper.rb +1 -1
- data/app/helpers/components/switch_helper.rb +5 -0
- data/app/helpers/components/tabs_helper.rb +29 -0
- data/app/helpers/components/toast_helper.rb +4 -1
- data/app/helpers/components_helper.rb +11 -5
- data/app/javascript/controllers/ui/dialog_controller.js +1 -1
- data/app/javascript/controllers/ui/dropdown_controller.js +1 -1
- data/app/javascript/controllers/ui/hover-card_controller.js +2 -3
- data/app/javascript/controllers/ui/popover_controller.js +2 -2
- data/app/javascript/controllers/ui/sheet_controller.js +1 -1
- data/app/javascript/controllers/ui/switch_controller.js +25 -0
- data/app/javascript/controllers/{tabs_controller.js → ui/tabs_controller.js} +2 -2
- data/app/javascript/controllers/ui/toast_controller.js +50 -23
- data/app/javascript/controllers/ui/transition_controller.js +1 -1
- data/app/models/user.rb +9 -0
- data/app/views/application/index.html.erb +1 -1
- data/app/views/components/ui/_alert_dialog.html.erb +10 -6
- data/app/views/components/ui/_combobox.html.erb +11 -0
- data/app/views/components/ui/_dialog.html.erb +0 -26
- data/app/views/components/ui/_filter.html.erb +1 -1
- data/app/views/components/ui/_input.html.erb +3 -0
- data/app/views/components/ui/_label.html.erb +1 -1
- data/app/views/components/ui/_popover.html.erb +1 -1
- data/app/views/components/ui/_slider.html.erb +5 -1
- data/app/views/components/ui/_switch.html.erb +25 -0
- data/app/views/components/ui/_tabs.html.erb +13 -0
- data/app/views/components/ui/_toast.html.erb +8 -4
- data/app/views/components/ui/tabs/_panel.html.erb +8 -0
- data/app/views/components/ui/tabs/_tab.html.erb +10 -0
- data/app/views/documentation/installation.html.md +1 -1
- data/app/views/examples/components/accordion/code/_preview.erb +11 -3
- data/app/views/examples/components/accordion/code/_usage.erb +2 -2
- data/app/views/examples/components/alert/code/_no_icon.erb +1 -1
- data/app/views/examples/components/alert-dialog/_usage.html.erb +24 -0
- data/app/views/examples/components/alert-dialog/code/_preview.erb +22 -6
- data/app/views/examples/components/alert-dialog/code/_usage.erb +13 -0
- data/app/views/examples/components/alert-dialog.html.erb +7 -1
- data/app/views/examples/components/card/code/_usage.erb +1 -1
- data/app/views/examples/components/combobox/_usage.html.erb +11 -0
- data/app/views/examples/components/combobox/code/_preview.erb +7 -0
- data/app/views/examples/components/combobox/code/_usage.erb +4 -0
- data/app/views/examples/components/combobox.html.erb +27 -0
- data/app/views/examples/components/forms/_usage.html.erb +28 -0
- data/app/views/examples/components/forms/code/_preview.erb +13 -0
- data/app/views/examples/components/forms/code/_usage.erb +6 -0
- data/app/views/examples/components/forms.html.erb +23 -0
- data/app/views/examples/components/slider/code/_preview.erb +2 -1
- data/app/views/examples/components/switch/_usage.html.erb +11 -0
- data/app/views/examples/components/switch/code/_preview.erb +4 -0
- data/app/views/examples/components/switch/code/_usage.erb +1 -0
- data/app/views/examples/components/switch.html.erb +27 -0
- data/app/views/examples/components/tabs/_usage.html.erb +15 -0
- data/app/views/examples/components/tabs/code/_account.html.erb +32 -0
- data/app/views/examples/components/tabs/code/_password.html.erb +19 -0
- data/app/views/examples/components/tabs/code/_preview.erb +14 -0
- data/app/views/examples/components/tabs/code/_usage.erb +12 -0
- data/app/views/examples/components/tabs.html.erb +27 -0
- data/app/views/examples/components/toast/code/_destructive.erb +6 -0
- data/app/views/examples/components/toast/code/_preview.erb +4 -3
- data/app/views/examples/components/toast.html.erb +17 -2
- data/app/views/layouts/application.html.erb +26 -4
- data/app/views/layouts/documentation/_component_header.html.erb +5 -4
- data/app/views/layouts/documentation/_examples.html.erb +7 -9
- data/app/views/layouts/documentation/_preview.html.erb +5 -5
- data/app/views/layouts/shared/_components.html.erb +6 -6
- data/config/routes.rb +3 -0
- data/lib/components.json +28 -13
- data/lib/generators/shadcn-ui_generator.rb +1 -1
- data/lib/shadcn-ui/version.rb +1 -1
- metadata +53 -9
- data/.env +0 -1
- data/app/views/components/ui/_badge.html.erb +0 -1
- data/app/views/components/ui/_separator.html.erb +0 -4
@@ -15,7 +15,13 @@
|
|
15
15
|
|
16
16
|
<%= render_preview %>
|
17
17
|
|
18
|
-
|
19
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 alert-dialog
|
21
|
+
<% end %>
|
20
22
|
|
21
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"><a href="/docs/components/dialog#usage">Usage</a></h2>
|
24
|
+
|
25
|
+
<%= code_partial("alert-dialog/usage", :erb) %>
|
26
|
+
|
27
|
+
<%= render_usage("alert-dialog") %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Combobox component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/combobox_helper.rb") %></li>
|
5
|
+
<li><%= code("app/views/components/ui/_combobox.html.erb") %></li>
|
6
|
+
</ul>
|
7
|
+
|
8
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
9
|
+
The method <%= code("render_combobox") %> method accepts one mandtory argument, an array of hashes that each have a <%= code("value") %> and name <%= code("name") %>.</p>
|
10
|
+
|
11
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">This componnet is the combination of a popover and a filter.</p>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= render "layouts/documentation/component_header",
|
2
|
+
title: "Combobox",
|
3
|
+
description: "" %>
|
4
|
+
|
5
|
+
<% content_for :preview, flush: true do %>
|
6
|
+
<div class="w-full flex justify-center">
|
7
|
+
<%= render_code_preview('combobox') %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<% content_for :code, flush: true do %>
|
12
|
+
<div class="w-full flex justify-center">
|
13
|
+
<%= code_partial("combobox/preview", :erb) %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= render_preview %>
|
18
|
+
|
19
|
+
<h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
|
20
|
+
<%= code_sample(language: "sh") do %>
|
21
|
+
rails generate shadcn-ui combobox
|
22
|
+
<% end %>
|
23
|
+
|
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">Usage</h2>
|
25
|
+
<%= code_partial("combobox/usage", :erb) %>
|
26
|
+
|
27
|
+
<%= render_usage("combobox") %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Forms component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/form_builders/shadcn_form_builder.rb") %></li>
|
5
|
+
<li><%= code("app/helpers/components/forms_helper.rb") %></li>
|
6
|
+
</ul>
|
7
|
+
|
8
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
9
|
+
The <code>ShadcnFormBuilder</code> is a custom form builder that extends the
|
10
|
+
<code>FormBuilder</code> class. It adds the following methods that provide the form with inputs and controls:
|
11
|
+
<p>
|
12
|
+
|
13
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
14
|
+
<li><%= code("label") %></li>
|
15
|
+
<li><%= code("text_field") %></li>
|
16
|
+
<li><%= code("password_field") %></li>
|
17
|
+
<li><%= code("email_field") %></li>
|
18
|
+
</ul>
|
19
|
+
</p>
|
20
|
+
|
21
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
22
|
+
To use these methods which generate the styled, ActiveModel backed form, you use the <%= code("render_form_for") %> or <%= code("render_form_with") %> methods provided by <%= code("app/helpers/components/forms_helper.rb") %>.
|
23
|
+
These methods yield the common <code>FormBuilder</code> instance that you can use to generate the controls and inputs above.
|
24
|
+
</p>
|
25
|
+
|
26
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
27
|
+
If a form field or attribute fails validation, its label and input will be given an <code>error</code> class to allow for styling. The default <code>error</code> style is defined in <%= code("app/assets/stylesheets/shadcn.css") %>
|
28
|
+
</p>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= render_form_for(@user, class: "w-full") do |form| %>
|
2
|
+
<div class="grid grid-cols-3 items-baseline mb-4">
|
3
|
+
<%= form.label :email, class: "text-right mr-4 text-lg" %>
|
4
|
+
<%= form.text_field :email, class: "col-span-2" %>
|
5
|
+
</div>
|
6
|
+
<div class="grid grid-cols-3 items-baseline">
|
7
|
+
<%= form.label :password, class: "text-right mr-4 text-lg" %>
|
8
|
+
<%= form.password_field :password, class: "col-span-2 mb-8" %>
|
9
|
+
</div>
|
10
|
+
<div class="flex justify-center">
|
11
|
+
<%= form.submit "Create Account" %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%= render_component_header title: "Forms",
|
2
|
+
description: "Creates an ActiveModel backed form with error " %>
|
3
|
+
|
4
|
+
<% content_for :preview, flush: true do %>
|
5
|
+
<div class="w-full flex justify-center">
|
6
|
+
<%= render_code_preview('forms') %>
|
7
|
+
</div>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% content_for :code, flush: true do %>
|
11
|
+
<%= code_partial("forms/preview", :erb) %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= render_preview %>
|
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 forms
|
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("forms/usage", :erb) %>
|
23
|
+
<%= render_usage("forms") %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Switch component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/switch_helper.rb") %></li>
|
5
|
+
<li><%= code("app/javascript/controllers/ui/switch_controller.js") %></li>
|
6
|
+
<li><%= code("app/views/components/ui/_switch.html.erb") %></li>
|
7
|
+
</ul>
|
8
|
+
|
9
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
10
|
+
<%= code("render_switch") %> accepts one argument for the text near the switch and two keyword arguments for the <%= code("id") %> of the button and <%= code("name") %> of the hidden input element used to pass the form value of the state. It optionally accepts a <%= code("state") %> keyword for the starting value of the switch.
|
11
|
+
The javascript controller is responsible for the toggle effect by changing the <%= code("data-state") %> of the underlying elements.</p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_switch text, id:, name: %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= render "layouts/documentation/component_header",
|
2
|
+
title: "Switch",
|
3
|
+
description: "" %>
|
4
|
+
|
5
|
+
<% content_for :preview, flush: true do %>
|
6
|
+
<div class="w-full flex justify-center">
|
7
|
+
<%= render_code_preview('switch') %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<% content_for :code, flush: true do %>
|
12
|
+
<div class="w-full flex justify-center">
|
13
|
+
<%= code_partial("switch/preview", :erb) %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= render_preview %>
|
18
|
+
|
19
|
+
<h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
|
20
|
+
<%= code_sample(language: "sh") do %>
|
21
|
+
rails generate shadcn-ui switch
|
22
|
+
<% end %>
|
23
|
+
|
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">Usage</h2>
|
25
|
+
<%= code_partial("switch/usage", :erb) %>
|
26
|
+
|
27
|
+
<%= render_usage("switch") %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The Tabs component introduces:</p>
|
2
|
+
|
3
|
+
<ul class="my-6 ml-6 list-disc [&>li]:mt-2 text-sm">
|
4
|
+
<li><%= code("app/helpers/components/tabs_helper.rb") %></li>
|
5
|
+
<li><%= code("app/javascript/controllers/ui/tabs_controllers.rb") %></li>
|
6
|
+
<li><%= code("app/views/components/ui/_tabs.html.erb") %></li>
|
7
|
+
<li><%= code("app/views/components/ui/tabs/_tab.html.erb") %></li>
|
8
|
+
<li><%= code("app/views/components/ui/tabs/_panel.html.erb") %></li>
|
9
|
+
</ul>
|
10
|
+
|
11
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">
|
12
|
+
<%= code("render_tabs") %> accepts two key blocks, <%= code("tab_list") %> and <%= code("tab_panel") %>.
|
13
|
+
Within <%= code("tab_list") %> call <%= code("tab") %> for each tab, accepting the text you want for the tab and making one of them <%= code("active: true") %> to determine the starting active state of the tab.
|
14
|
+
Within <%= code("tab_panel") %> call <%= code("tab_panel") %> for each tab panel, accepting a block for the content of the panel and making one of them <%= code("active: true") %> to determine the starting active state of the panels (generally corresponding to the active tab).
|
15
|
+
</p>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<div class="rounded-lg border bg-card text-card-foreground shadow-sm">
|
2
|
+
<div class="flex flex-col space-y-1.5 p-6">
|
3
|
+
<h3 class="text-2xl font-semibold leading-none tracking-tight">Account</h3>
|
4
|
+
<p class="text-sm text-muted-foreground">
|
5
|
+
Make changes to your account here. Click save when you're done.
|
6
|
+
</p>
|
7
|
+
</div>
|
8
|
+
<div class="p-6 pt-0 space-y-2">
|
9
|
+
<div class="space-y-1">
|
10
|
+
<label
|
11
|
+
class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
12
|
+
for="name">Name</label><input
|
13
|
+
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"
|
14
|
+
id="name"
|
15
|
+
value="Avi Flombaum">
|
16
|
+
</div>
|
17
|
+
<div class="space-y-1">
|
18
|
+
<label
|
19
|
+
class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
20
|
+
for="username">Username</label><input
|
21
|
+
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"
|
22
|
+
id="username"
|
23
|
+
value="@aviflombaum">
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
<div class="flex items-center p-6 pt-0">
|
27
|
+
<button
|
28
|
+
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">
|
29
|
+
Save changes
|
30
|
+
</button>
|
31
|
+
</div>
|
32
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<div class="rounded-lg border bg-card text-card-foreground shadow-sm">
|
2
|
+
<div class="flex flex-col space-y-1.5 p-6">
|
3
|
+
<h3 class="text-2xl font-semibold leading-none tracking-tight">Password</h3>
|
4
|
+
<p class="text-sm text-muted-foreground">Change your password here. After saving, you'll be logged out.</p>
|
5
|
+
</div>
|
6
|
+
<div class="p-6 pt-0 space-y-2">
|
7
|
+
<div class="space-y-1">
|
8
|
+
<label class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="current">Current password</label>
|
9
|
+
<input 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" id="current" type="password">
|
10
|
+
</div>
|
11
|
+
<div class="space-y-1">
|
12
|
+
<label class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="new">New password</label>
|
13
|
+
<input 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" id="new" type="password">
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<div class="flex items-center p-6 pt-0">
|
17
|
+
<button 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">Save password</button>
|
18
|
+
</div>
|
19
|
+
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%= render_tabs do %>
|
2
|
+
<%= tab_list do %>
|
3
|
+
<%= tab "Account" %>
|
4
|
+
<%= tab "Password", active: true %>
|
5
|
+
<% end %>
|
6
|
+
<%= tab_panels do %>
|
7
|
+
<%= tab_panel do %>
|
8
|
+
<%= render "examples/components/tabs/code/account" %>
|
9
|
+
<% end %>
|
10
|
+
<%= tab_panel active: true do %>
|
11
|
+
<%= render "examples/components/tabs/code/password" %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= render "layouts/documentation/component_header",
|
2
|
+
title: "Tabs",
|
3
|
+
description: "" %>
|
4
|
+
|
5
|
+
<% content_for :preview, flush: true do %>
|
6
|
+
<div class="w-full flex justify-center">
|
7
|
+
<%= render_code_preview('tabs') %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<% content_for :code, flush: true do %>
|
12
|
+
<div class="w-full flex justify-center">
|
13
|
+
<%= code_partial("tabs/preview", :erb) %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= render_preview %>
|
18
|
+
|
19
|
+
<h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
|
20
|
+
<%= code_sample(language: "sh") do %>
|
21
|
+
rails generate shadcn-ui tabs
|
22
|
+
<% end %>
|
23
|
+
|
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">Usage</h2>
|
25
|
+
<%= code_partial("tabs/usage", :erb) %>
|
26
|
+
|
27
|
+
<%= render_usage("tabs") %>
|
@@ -1,3 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
<%= render_toast header: "Scheduled: Catch up",
|
2
|
+
description: "Friday, February 10, 2023 at 5:57 PM",
|
3
|
+
action: render_button("Undo", variant: :outline),
|
4
|
+
id: "default_toast" %>
|
@@ -2,8 +2,10 @@
|
|
2
2
|
description: "A succinct message that is displayed temporarily." %>
|
3
3
|
|
4
4
|
<% content_for :preview, flush: true do %>
|
5
|
-
|
6
|
-
|
5
|
+
<div class="w-full flex justify-center">
|
6
|
+
<%= render_button "Trigger Toast", variant: "outline", data: {controller: "ui--toast", action: "ui--toast#trigger", target: "#default_toast"} %>
|
7
|
+
<%= render_code_preview('toast') %>
|
8
|
+
</div>
|
7
9
|
<% end %>
|
8
10
|
|
9
11
|
<% content_for :code, flush: true do %>
|
@@ -21,3 +23,16 @@
|
|
21
23
|
<%= code_partial("toast/usage", :erb) %>
|
22
24
|
|
23
25
|
<%= render_usage("toast") %>
|
26
|
+
|
27
|
+
<% content_for :examples, flush: true do %>
|
28
|
+
<div class="w-full flex justify-center">
|
29
|
+
<%= render_button "Trigger Destructive Toast", variant: "outline", data: {controller: "ui--toast", action: "ui--toast#trigger", target: "#alert_toast"} %>
|
30
|
+
<%= render "examples/components/toast/code/destructive" %>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
33
|
+
|
34
|
+
<% content_for :code, flush: true do %>
|
35
|
+
<%= code_partial("toast/destructive", :erb) %>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
<%= render_example %>
|
@@ -1,11 +1,10 @@
|
|
1
|
-
<!
|
1
|
+
<!doctype html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<title><%= page_title %></title>
|
5
5
|
<meta
|
6
6
|
name="viewport"
|
7
7
|
content="width=device-width,initial-scale=1">
|
8
|
-
<!--prettier-ignore-->
|
9
8
|
<%= csrf_meta_tags %>
|
10
9
|
<%= csp_meta_tag %>
|
11
10
|
<%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
|
@@ -13,6 +12,13 @@
|
|
13
12
|
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
14
13
|
<%= content_for :stylesheets %>
|
15
14
|
<%= javascript_importmap_tags %>
|
15
|
+
|
16
|
+
<%= display_meta_tags(
|
17
|
+
description: "An open-source frontend themed component library for Ruby on Rails based on shadcn/ui.",
|
18
|
+
keywords: "shadcn/ui, rails components, ruby on rails, rails themes, viewcomponent, shadcn, ror themes, rails designs.",
|
19
|
+
og: {title: :title, description: :description, image: "/public/og.png"}, twitter: {image: "/public/og.png"}
|
20
|
+
) %>
|
21
|
+
<script defer data-domain="rails-components.com" src="https://a.wip.dev/js/script.js"></script>
|
16
22
|
</head>
|
17
23
|
|
18
24
|
<body>
|
@@ -20,12 +26,28 @@
|
|
20
26
|
<%= render 'layouts/shared/header' %>
|
21
27
|
<div class="flex-1">
|
22
28
|
<div class="border-b">
|
23
|
-
<div
|
24
|
-
class="container flex-1 items-start ">
|
29
|
+
<div class="container flex-1 items-start">
|
25
30
|
<!--prettier-ignore-->
|
26
31
|
<%= yield %>
|
27
32
|
</div>
|
28
33
|
</div>
|
34
|
+
<footer class="py-6 md:px-8 md:py-0">
|
35
|
+
<div
|
36
|
+
class="container flex flex-col items-center justify-between gap-4 md:h-24 md:flex-row">
|
37
|
+
<p class="text-center text-sm leading-loose text-muted-foreground md:text-left">
|
38
|
+
A
|
39
|
+
<a
|
40
|
+
href="https://rails-components.com"
|
41
|
+
target="_blank"
|
42
|
+
rel="noreferrer"
|
43
|
+
class="font-medium underline underline-offset-4">Rails Components</a> Project by <a
|
44
|
+
href="https://twitter.com/aviflombaum"
|
45
|
+
target="_blank"
|
46
|
+
rel="noreferrer"
|
47
|
+
class="font-medium underline underline-offset-4">aviflombaum</a>.
|
48
|
+
</p>
|
49
|
+
</div>
|
50
|
+
</footer>
|
29
51
|
</div>
|
30
52
|
</div>
|
31
53
|
</body>
|
@@ -1,11 +1,12 @@
|
|
1
1
|
<div class="space-y-2">
|
2
|
-
<h1 class="scroll-m-20
|
2
|
+
<h1 class="scroll-m-20 flex justify-between">
|
3
|
+
<span class="text-4xl font-bold tracking-tight"><%= title %></span>
|
4
|
+
<%= render_button "Edit", variant: :ghost, class: "text-sm", as: :link, href: "https://github.com/aviflombaum/shadcn-rails/blob/main/app/views/examples/components/#{params[:component]}.html.erb" %>
|
5
|
+
</h1>
|
3
6
|
<p class="text-lg text-muted-foreground">
|
4
7
|
<span
|
5
8
|
data-br=":r24:"
|
6
9
|
data-brr="1"
|
7
|
-
style="display: inline-block; vertical-align: top; text-decoration: inherit"
|
8
|
-
><%= description %></span
|
9
|
-
>
|
10
|
+
style="display: inline-block; vertical-align: top; text-decoration: inherit"><%= description %></span>
|
10
11
|
</p>
|
11
12
|
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
|
3
|
-
<div class="group relative my-4 flex flex-col space-y-2" data-controller="tabs">
|
3
|
+
<div class="group relative my-4 flex flex-col space-y-2" data-controller="ui--tabs">
|
4
4
|
<div
|
5
5
|
dir="ltr"
|
6
6
|
data-orientation="horizontal"
|
@@ -15,7 +15,7 @@
|
|
15
15
|
style="outline: none">
|
16
16
|
<button
|
17
17
|
type="button"
|
18
|
-
data-tabs-target="tab"
|
18
|
+
data-ui--tabs-target="tab"
|
19
19
|
role="tab"
|
20
20
|
aria-selected="true"
|
21
21
|
aria-controls="content-preview"
|
@@ -23,28 +23,26 @@
|
|
23
23
|
id="trigger-preview"
|
24
24
|
class="inline-flex items-center justify-center whitespace-nowrap py-1 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background relative h-9 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 font-semibold text-muted-foreground shadow-none transition-none data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none"
|
25
25
|
tabindex="-1"
|
26
|
-
data-orientation="horizontal"
|
27
|
-
data-radix-collection-item="">
|
26
|
+
data-orientation="horizontal">
|
28
27
|
Preview</button>
|
29
28
|
<button
|
30
29
|
type="button"
|
31
30
|
role="tab"
|
32
|
-
data-tabs-target="tab"
|
31
|
+
data-ui--tabs-target="tab"
|
33
32
|
aria-selected="false"
|
34
33
|
aria-controls="content-code"
|
35
34
|
data-state="inactive"
|
36
35
|
id="trigger-code"
|
37
36
|
class="inline-flex items-center justify-center whitespace-nowrap py-1 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background relative h-9 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 font-semibold text-muted-foreground shadow-none transition-none data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none"
|
38
37
|
tabindex="-1"
|
39
|
-
data-orientation="horizontal"
|
40
|
-
data-radix-collection-item="">
|
38
|
+
data-orientation="horizontal">
|
41
39
|
Code
|
42
40
|
</button>
|
43
41
|
</div>
|
44
42
|
</div>
|
45
43
|
<div
|
46
44
|
data-state="active"
|
47
|
-
data-tabs-target="panel"
|
45
|
+
data-ui--tabs-target="panel"
|
48
46
|
data-orientation="horizontal"
|
49
47
|
role="tabpanel"
|
50
48
|
aria-labelledby="trigger-preview"
|
@@ -61,7 +59,7 @@
|
|
61
59
|
</div>
|
62
60
|
<div
|
63
61
|
data-state="inactive"
|
64
|
-
data-tabs-target="panel"
|
62
|
+
data-ui--tabs-target="panel"
|
65
63
|
data-orientation="horizontal"
|
66
64
|
role="tabpanel"
|
67
65
|
aria-labelledby="trigger-code"
|
@@ -8,7 +8,7 @@
|
|
8
8
|
id="examples">
|
9
9
|
Examples
|
10
10
|
</h2>
|
11
|
-
<div class="group relative my-4 flex flex-col space-y-2" data-controller="tabs">
|
11
|
+
<div class="group relative my-4 flex flex-col space-y-2" data-controller="ui--tabs">
|
12
12
|
<div
|
13
13
|
dir="ltr"
|
14
14
|
data-orientation="horizontal"
|
@@ -23,7 +23,7 @@
|
|
23
23
|
style="outline: none">
|
24
24
|
<button
|
25
25
|
type="button"
|
26
|
-
data-tabs-target="tab"
|
26
|
+
data-ui--tabs-target="tab"
|
27
27
|
role="tab"
|
28
28
|
aria-selected="true"
|
29
29
|
aria-controls="content-preview"
|
@@ -37,7 +37,7 @@
|
|
37
37
|
<button
|
38
38
|
type="button"
|
39
39
|
role="tab"
|
40
|
-
data-tabs-target="tab"
|
40
|
+
data-ui--tabs-target="tab"
|
41
41
|
aria-selected="false"
|
42
42
|
aria-controls="content-code"
|
43
43
|
data-state="inactive"
|
@@ -52,7 +52,7 @@
|
|
52
52
|
</div>
|
53
53
|
<div
|
54
54
|
data-state="active"
|
55
|
-
data-tabs-target="panel"
|
55
|
+
data-ui--tabs-target="panel"
|
56
56
|
data-orientation="horizontal"
|
57
57
|
role="tabpanel"
|
58
58
|
aria-labelledby="trigger-preview"
|
@@ -69,7 +69,7 @@
|
|
69
69
|
</div>
|
70
70
|
<div
|
71
71
|
data-state="inactive"
|
72
|
-
data-tabs-target="panel"
|
72
|
+
data-ui--tabs-target="panel"
|
73
73
|
data-orientation="horizontal"
|
74
74
|
role="tabpanel"
|
75
75
|
aria-labelledby="trigger-code"
|
@@ -18,7 +18,7 @@
|
|
18
18
|
<div class="grid grid-flow-row auto-rows-max text-sm">
|
19
19
|
<%= sidebar_link "✅ 📖 Accordion", "/docs/components/accordion" %>
|
20
20
|
<%= sidebar_link "✅ 📖 Alert", "/docs/components/alert" %>
|
21
|
-
|
21
|
+
<%= sidebar_link "✅ 📖 Alert Dialog", "/docs/components/alert-dialog" %>
|
22
22
|
<%#= sidebar_link "❌ Aspect Ratio", "/docs/components/aspect-ratio" %>
|
23
23
|
<%#= sidebar_link "❌ Avatar", "/docs/components/avatar" %>
|
24
24
|
<%= sidebar_link "✅ 📖 Badge", "/docs/components/badge" %>
|
@@ -27,15 +27,15 @@
|
|
27
27
|
<%= sidebar_link "✅ 📖 Card", "/docs/components/card" %>
|
28
28
|
<%= sidebar_link "✅ 📖 Checkbox", "/docs/components/checkbox" %>
|
29
29
|
<%= sidebar_link "✅ 📖 Collapsible", "/docs/components/collapsible" %>
|
30
|
-
|
30
|
+
<%= sidebar_link "✅ 📖 Combobox", "/docs/components/combobox" %>
|
31
31
|
<%#= sidebar_link "Command", "/docs/components/command" %>
|
32
32
|
<%#= sidebar_link "Context Menu", "/docs/components/context-menu" %>
|
33
33
|
<%#= sidebar_link "Data Table", "/docs/components/data-table" %>
|
34
34
|
<%#= sidebar_link "Date Picker", "/docs/components/date-picker" %>
|
35
35
|
<%= sidebar_link "✅ 📖 Dialog", "/docs/components/dialog" %>
|
36
36
|
<%= sidebar_link "✅ 📖 Dropdown Menu", "/docs/components/dropdown-menu" %>
|
37
|
-
<%= sidebar_link "
|
38
|
-
|
37
|
+
<%= sidebar_link "✅ 📖 Filter", "/docs/components/filter" %>
|
38
|
+
<%= sidebar_link "✅ 📖 Forms", "/docs/components/forms" %>
|
39
39
|
<%= sidebar_link "✅ 📖 Hover Card", "/docs/components/hover-card" %>
|
40
40
|
<%= sidebar_link "✅ 📖 Input", "/docs/components/input" %>
|
41
41
|
<%= sidebar_link "✅ 📖 Label", "/docs/components/label" %>
|
@@ -50,9 +50,9 @@
|
|
50
50
|
<%= sidebar_link "✅ 📖 Sheet", "/docs/components/sheet" %>
|
51
51
|
<%= sidebar_link "✅ 📖 Skeleton", "/docs/components/skeleton" %>
|
52
52
|
<%= sidebar_link "✅ 📖 Slider", "/docs/components/slider" %>
|
53
|
-
|
53
|
+
<%= sidebar_link "✅ 📖 Switch", "/docs/components/switch" %>
|
54
54
|
<%#= sidebar_link "Table", "/docs/components/table" %>
|
55
|
-
|
55
|
+
<%= sidebar_link "✅ 📖 Tabs", "/docs/components/tabs" %>
|
56
56
|
<%= sidebar_link "✅ 📖 Textarea", "/docs/components/textarea" %>
|
57
57
|
<%= sidebar_link "✅ 📖 Toast", "/docs/components/toast" %>
|
58
58
|
<%= sidebar_link "✅ 📖 Toggle", "/docs/components/toggle" %>
|