shadcn-ui 0.0.5 → 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/Procfile.dev +1 -0
- data/Rakefile +90 -0
- data/app/assets/stylesheets/shadcn.css +1 -1
- data/app/helpers/application_helper.rb +5 -0
- 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/{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_helper.rb +7 -5
- 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/views/application/index.html.erb +1 -1
- data/app/views/components/ui/_combobox.html.erb +11 -0
- 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/tabs/_panel.html.erb +8 -0
- data/app/views/components/ui/tabs/_tab.html.erb +10 -0
- 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/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/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/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 +3 -3
- data/lib/components.json +15 -12
- data/lib/generators/shadcn-ui_generator.rb +1 -1
- data/lib/shadcn-ui/version.rb +1 -1
- metadata +43 -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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1a6d106b3e241c5c7a418478bde0b7c4e4e50ce27c0999a1963d7a40b543dd2
|
4
|
+
data.tar.gz: 47a2ff41f7186f01c3cdef384b2b602b39868fbd9f2c2f15f7a3d8c2e0d3a72c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b040f697a8b80b085a5d4a595bb20ed7b78b9f26d90082831977feb7acb80389787c8b23983f2094cde67212f5bf0a682f206c79171231d5b023ca22e11716e
|
7
|
+
data.tar.gz: 1e44cfd6682738fc2df66f886ba9d2c6de2b044c6828f43ff9e2b67aef0f37f62a01087f78bd4158911083eee8cb45ef59f18ad64e0044d824b7b6075ccb6966
|
data/Procfile.dev
CHANGED
data/Rakefile
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
2
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
3
|
require "bundler/gem_tasks"
|
4
|
+
require 'fileutils'
|
4
5
|
|
5
6
|
if ENV["RAILS_ENV"] != "production"
|
6
7
|
require "rspec/core/rake_task"
|
@@ -13,3 +14,92 @@ end
|
|
13
14
|
require_relative "config/application"
|
14
15
|
|
15
16
|
Rails.application.load_tasks
|
17
|
+
# Rake task
|
18
|
+
|
19
|
+
HELPER_TEMPLATE = <<~TEMPLATE
|
20
|
+
module Components::<%= component_name %>Helper
|
21
|
+
end
|
22
|
+
TEMPLATE
|
23
|
+
|
24
|
+
STIMULUS_TEMPLATE = <<~TEMPLATE
|
25
|
+
import { Controller } from "@hotwired/stimulus";
|
26
|
+
|
27
|
+
export default class extends Controller {
|
28
|
+
}
|
29
|
+
TEMPLATE
|
30
|
+
|
31
|
+
def documentation_erb(name)
|
32
|
+
content = <<~TEMPLATE
|
33
|
+
<%= render "layouts/documentation/component_header",
|
34
|
+
title: "#{name.capitalize}",
|
35
|
+
description: "" %>
|
36
|
+
|
37
|
+
<% content_for :preview, flush: true do %>
|
38
|
+
<div class="w-full flex justify-center">
|
39
|
+
<%= render_code_preview('#{name}') %>
|
40
|
+
</div>
|
41
|
+
<% end %>
|
42
|
+
|
43
|
+
<% content_for :code, flush: true do %>
|
44
|
+
<div class="w-full flex justify-center">
|
45
|
+
<%= code_partial("#{name}/preview", :erb) %>
|
46
|
+
</div>
|
47
|
+
<% end %>
|
48
|
+
|
49
|
+
<%= render_preview %>
|
50
|
+
|
51
|
+
<h2 class="font-heading scroll-m-20 border-b pb-2 text-2xl font-semibold tracking-tight first:mt-0" id="installation">Installation</h2>
|
52
|
+
<%= code_sample(language: "sh") do %>
|
53
|
+
rails generate shadcn-ui #{name}
|
54
|
+
<% end %>
|
55
|
+
|
56
|
+
<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>
|
57
|
+
<%= code_partial("#{name}/usage", :erb) %>
|
58
|
+
|
59
|
+
<%= render_usage("#{name}") %>
|
60
|
+
TEMPLATE
|
61
|
+
end
|
62
|
+
|
63
|
+
namespace :component do
|
64
|
+
desc "Generate a new component"
|
65
|
+
task :generate => :environment do
|
66
|
+
name = ENV['name']
|
67
|
+
abort("No component name provided. Use `rake component:generate name=component_name`") unless name.present?
|
68
|
+
|
69
|
+
puts "Do you want to include a Stimulus controller? (yes/no)"
|
70
|
+
response = STDIN.gets.chomp.downcase
|
71
|
+
|
72
|
+
component_view_path = Rails.root.join("app", "views", "components", "ui", "_#{name}.html.erb")
|
73
|
+
helper_path = Rails.root.join("app", "helpers", "components", "#{name}_helper.rb")
|
74
|
+
controller_path = Rails.root.join("app", "javascript", "controllers", "ui", "#{name}_controller.js")
|
75
|
+
|
76
|
+
documentation_path = Rails.root.join("app", "views", "examples", "components", "#{name}.html.erb")
|
77
|
+
preview_path = Rails.root.join("app", "views", "examples", "components", name, "code", "_preview.html.erb")
|
78
|
+
preview_directory_path = Rails.root.join("app", "views", "examples", "components", name, "code")
|
79
|
+
preview_file_path = "#{preview_directory_path}/_preview.erb"
|
80
|
+
sample_usage_path = "#{preview_directory_path}/_usage.erb"
|
81
|
+
usage_instructions_path = Rails.root.join("app", "views", "examples", "components", name, "_usage.html.erb")
|
82
|
+
|
83
|
+
camelized_name = name.camelize
|
84
|
+
helper_template = ERB.new(HELPER_TEMPLATE)
|
85
|
+
helper_content = helper_template.result_with_hash(component_name: camelized_name)
|
86
|
+
|
87
|
+
stimulus_template = ERB.new(STIMULUS_TEMPLATE)
|
88
|
+
stimulus_content = stimulus_template.result
|
89
|
+
|
90
|
+
File.new(component_view_path, "w")
|
91
|
+
File.open(helper_path, "w") { |file| file.write(helper_content) }
|
92
|
+
|
93
|
+
File.open(documentation_path, "w") { |file| file.write(documentation_erb(name)) }
|
94
|
+
FileUtils.mkdir_p(preview_directory_path)
|
95
|
+
File.new(preview_file_path, "w")
|
96
|
+
File.new(sample_usage_path, "w")
|
97
|
+
File.new(usage_instructions_path, "w")
|
98
|
+
|
99
|
+
if ["yes", "y"].include?(response.downcase)
|
100
|
+
File.open(controller_path, "w") { |file| file.write(stimulus_content) }
|
101
|
+
end
|
102
|
+
|
103
|
+
puts "Component #{name} was created successfully!"
|
104
|
+
end
|
105
|
+
end
|
@@ -1,12 +1,16 @@
|
|
1
1
|
module Components::AlertHelper
|
2
|
-
def render_alert(title:, description
|
2
|
+
def render_alert(title:, description: nil, variant: :default, icon: true)
|
3
3
|
alert_classes = case variant.to_sym
|
4
4
|
when :default
|
5
5
|
"[&>svg]:text-foreground bg-background text-foreground"
|
6
6
|
when :error, :danger, :alert, :destructive
|
7
7
|
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
|
8
|
-
|
9
|
-
"border
|
8
|
+
when :success
|
9
|
+
"border-success/50 text-success dark:border-success [&>svg]:text-success"
|
10
|
+
when :info
|
11
|
+
"border-info/50 text-info dark:border-info [&>svg]:text-info"
|
12
|
+
when :attention
|
13
|
+
"border-attention/50 text-attention dark:border-attention [&>svg]:text-attention"
|
10
14
|
end
|
11
15
|
render "components/ui/alert", title:, description:, alert_classes:, variant:, icon:
|
12
16
|
end
|
@@ -15,6 +15,9 @@ module Components::BadgeHelper
|
|
15
15
|
end
|
16
16
|
badge_classes << " #{varianet_classes}"
|
17
17
|
text = label if label.present?
|
18
|
-
|
18
|
+
|
19
|
+
content_tag :div, class: badge_classes do
|
20
|
+
text
|
21
|
+
end
|
19
22
|
end
|
20
23
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Components::TabsHelper
|
2
|
+
def render_tabs(&block)
|
3
|
+
@_tabs = []
|
4
|
+
capture(&block)
|
5
|
+
render "components/ui/tabs"
|
6
|
+
end
|
7
|
+
|
8
|
+
def tab_list(&block)
|
9
|
+
content_for :tab_list, capture(&block), flush: true
|
10
|
+
end
|
11
|
+
|
12
|
+
def tab(title, **options)
|
13
|
+
options[:id] ||= "tab_#{title.parameterize}"
|
14
|
+
options[:state] = options[:active] ? "active" : "inactive"
|
15
|
+
|
16
|
+
@_tabs << {title: title, id: options[:id]}
|
17
|
+
render("components/ui/tabs/tab", title:, options:)
|
18
|
+
end
|
19
|
+
|
20
|
+
def tab_panels(&block)
|
21
|
+
content_for :tab_panels, capture(&block), flush: true
|
22
|
+
end
|
23
|
+
|
24
|
+
def tab_panel(**options, &block)
|
25
|
+
options[:state] = options[:active] ? "active" : "inactive"
|
26
|
+
content_for :panel, capture(&block), flush: true
|
27
|
+
render("components/ui/tabs/panel", options:)
|
28
|
+
end
|
29
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "tailwind_merge"
|
2
|
+
|
1
3
|
module ComponentsHelper
|
2
4
|
def tw(classes)
|
3
5
|
TailwindMerge::Merger.new.merge(classes)
|
@@ -10,11 +12,11 @@ module ComponentsHelper
|
|
10
12
|
DESTRUCTIVE_CLASSES = " bg-destructive text-destructive-foreground hover:bg-destructive/90 "
|
11
13
|
|
12
14
|
module Button
|
13
|
-
PRIMARY =
|
14
|
-
SECONDARY =
|
15
|
-
OUTLINE =
|
16
|
-
GHOST =
|
17
|
-
DESTRUCTIVE =
|
15
|
+
PRIMARY = ComponentsHelper::PRIMARY_CLASSES
|
16
|
+
SECONDARY = ComponentsHelper::SECONDARY_CLASSES
|
17
|
+
OUTLINE = ComponentsHelper::OUTLINE_CLASSES
|
18
|
+
GHOST = ComponentsHelper::GHOST_CLASSES
|
19
|
+
DESTRUCTIVE = ComponentsHelper::DESTRUCTIVE_CLASSES
|
18
20
|
end
|
19
21
|
|
20
22
|
module Alert
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// Inspired by: https://github.com/excid3/tailwindcss-stimulus-components/blob/master/src/popover.js
|
2
|
+
|
3
|
+
import { Controller } from "@hotwired/stimulus";
|
4
|
+
|
5
|
+
export default class UIToggleController extends Controller {
|
6
|
+
connect() {}
|
7
|
+
|
8
|
+
toggle() {
|
9
|
+
const button = this.element.querySelector("button");
|
10
|
+
const span = this.element.querySelector("span");
|
11
|
+
const input = this.element.querySelector("input[type='hidden']");
|
12
|
+
|
13
|
+
if (this.element.dataset.state == "checked") {
|
14
|
+
input.value = "unchecked";
|
15
|
+
button.dataset.state = "unchecked";
|
16
|
+
span.dataset.state = "unchecked";
|
17
|
+
this.element.dataset.state = "unchecked";
|
18
|
+
} else {
|
19
|
+
input.value = "checked";
|
20
|
+
button.dataset.state = "checked";
|
21
|
+
span.dataset.state = "checked";
|
22
|
+
this.element.dataset.state = "checked";
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// https://github.com/excid3/tailwindcss-stimulus-components/blob/master/src/tabs.js
|
2
2
|
import { Controller } from "@hotwired/stimulus";
|
3
|
-
import "
|
3
|
+
import "https://ga.jspm.io/npm:@kanety/stimulus-static-actions@1.0.1/dist/index.modern.js";
|
4
4
|
|
5
5
|
export default class extends Controller {
|
6
6
|
static targets = ["tab", "panel"];
|
@@ -10,7 +10,7 @@ export default class extends Controller {
|
|
10
10
|
this.activeTabClasses = (this.data.get("activeTab") || "active").split(" ");
|
11
11
|
this.inactiveTabClasses = (this.data.get("inactiveTab") || "inactive").split(" ");
|
12
12
|
if (this.anchor) this.index = this.tabTargets.findIndex((tab) => tab.id === this.anchor);
|
13
|
-
this.showTab();
|
13
|
+
// this.showTab();
|
14
14
|
}
|
15
15
|
|
16
16
|
change(event) {
|
@@ -8,7 +8,7 @@
|
|
8
8
|
data-orientation="vertical"
|
9
9
|
role="none"
|
10
10
|
class="shrink-0 bg-border w-[1px] mx-2 h-4"></div>
|
11
|
-
<span class="sm:hidden">
|
11
|
+
<span class="sm:hidden">Introducing shadcn/ui on Rails!</span>
|
12
12
|
<span class="hidden sm:inline">Introducing shadcn/ui on Rails!</span>
|
13
13
|
<svg
|
14
14
|
width="15"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= render_popover do %>
|
2
|
+
<%= popover_trigger do %>
|
3
|
+
<button class="inline-flex items-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 w-[200px] justify-between" role="combobox" aria-expanded="false" type="button" aria-haspopup="dialog" data-state="closed">
|
4
|
+
<%= content_for :trigger %>
|
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="ml-2 h-4 w-4 shrink-0 opacity-50"><path d="m7 15 5 5 5-5"></path><path d="m7 9 5-5 5 5"></path></svg>
|
6
|
+
</button>
|
7
|
+
<% end %>
|
8
|
+
<%= popover_content class: "border-none p-0" do %>
|
9
|
+
<%= render_filter items %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
data-align="center"
|
12
12
|
data-state="closed"
|
13
13
|
role="dialog"
|
14
|
-
class="hidden z-50
|
14
|
+
class="<%= tw("hidden z-50 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none #{content_for(:popover_content_class)}") %>"
|
15
15
|
tabindex=" -1 ">
|
16
16
|
<%= content_for(:popover_content) %>
|
17
17
|
</div>
|
@@ -1,2 +1,6 @@
|
|
1
1
|
|
2
|
-
<input type="range" min="1" max="100"
|
2
|
+
<input type="range" min="1" max="100"
|
3
|
+
value="<%= value %>" id="<%= id %>" name="<%= name %>"
|
4
|
+
style="background-size: <%= value %>% 100%"
|
5
|
+
data-controller="ui--slider" data-action="input->ui--slider#updateRange"
|
6
|
+
class="<%= options[:class] %>">
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<div
|
2
|
+
data-controller="ui--switch"
|
3
|
+
class="flex items-center space-x-2 cursor-pointer"
|
4
|
+
data-action="click->ui--switch#toggle"
|
5
|
+
data-state="<%= state %>">
|
6
|
+
<input type="hidden" value="<%= state %>" name="<%= name %>">
|
7
|
+
<button
|
8
|
+
type="button"
|
9
|
+
role="switch"
|
10
|
+
aria-checked="false"
|
11
|
+
data-state="<%= state %>"
|
12
|
+
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"
|
13
|
+
id="<%= id %>">
|
14
|
+
<span
|
15
|
+
data-state="<%= state %>"
|
16
|
+
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">
|
17
|
+
</span>
|
18
|
+
</button>
|
19
|
+
<label
|
20
|
+
data-action="click->ui--switch#toggle"
|
21
|
+
class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer"
|
22
|
+
for="<%= id %>">
|
23
|
+
<%= text %>
|
24
|
+
</label>
|
25
|
+
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div class="group" data-controller="ui--tabs">
|
2
|
+
<div
|
3
|
+
role="tablist"
|
4
|
+
aria-orientation="horizontal"
|
5
|
+
class="h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground grid w-full grid-cols-2"
|
6
|
+
tabindex="0"
|
7
|
+
data-orientation="horizontal"
|
8
|
+
style="outline: none">
|
9
|
+
<%= content_for :tab_list %>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<%= content_for :tab_panels %>
|
13
|
+
</div>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<button
|
2
|
+
type="button"
|
3
|
+
role="tab"
|
4
|
+
data-ui--tabs-target="tab"
|
5
|
+
data-state="<%= options[:state] %>"
|
6
|
+
class="inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all 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 data-[state=active]:text-foreground data-[state=active]:shadow-sm"
|
7
|
+
tabindex="0"
|
8
|
+
data-orientation="horizontal">
|
9
|
+
<%= title %>
|
10
|
+
</button>
|
@@ -1,3 +1,11 @@
|
|
1
|
-
<%= render_accordion title: "Did you know?",
|
2
|
-
component library you want!" %>
|
3
|
-
|
1
|
+
<%= render_accordion title: "Did you know?",
|
2
|
+
description: "You can wrap shadcn helpers in any component library you want!" %>
|
3
|
+
|
4
|
+
<%= render_accordion do %>
|
5
|
+
<%= accordion_title do %>
|
6
|
+
Use the generators
|
7
|
+
<% end %>
|
8
|
+
<%= accordion_description do %>
|
9
|
+
Add components with <%= code("rails g shadcn_ui add accordion") %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
@@ -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,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,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"
|
@@ -27,7 +27,7 @@
|
|
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" %>
|
@@ -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" %>
|
data/lib/components.json
CHANGED
@@ -30,11 +30,7 @@
|
|
30
30
|
"badge": {
|
31
31
|
"name": "badge",
|
32
32
|
"type": "components:ui",
|
33
|
-
"files": [
|
34
|
-
"app/helpers/components/badge_helper.rb",
|
35
|
-
"app/views/components/ui/_badge.html.erb",
|
36
|
-
"app/javascript/controllers/ui/badge_controller.js"
|
37
|
-
]
|
33
|
+
"files": ["app/helpers/components/badge_helper.rb"]
|
38
34
|
},
|
39
35
|
"button": {
|
40
36
|
"name": "button",
|
@@ -72,6 +68,15 @@
|
|
72
68
|
"app/javascript/controllers/ui/collapsible_controller.js"
|
73
69
|
]
|
74
70
|
},
|
71
|
+
"combobox": {
|
72
|
+
"name": "combobox",
|
73
|
+
"type": "components:ui",
|
74
|
+
"files": [
|
75
|
+
"app/helpers/components/combobox_helper.rb",
|
76
|
+
"app/views/components/ui/_combobox.html.erb"
|
77
|
+
],
|
78
|
+
"dependencies": [{ "component": "popover" }, { "component": "filter" }]
|
79
|
+
},
|
75
80
|
"command": {
|
76
81
|
"name": "command",
|
77
82
|
"type": "components:ui",
|
@@ -127,8 +132,8 @@
|
|
127
132
|
"name": "hover-card",
|
128
133
|
"type": "components:ui",
|
129
134
|
"files": [
|
130
|
-
"app/helpers/components/
|
131
|
-
"app/views/components/ui/
|
135
|
+
"app/helpers/components/hover_card_helper.rb",
|
136
|
+
"app/views/components/ui/_hover_card.html.erb",
|
132
137
|
"app/javascript/controllers/ui/hover-card_controller.js"
|
133
138
|
]
|
134
139
|
},
|
@@ -216,11 +221,7 @@
|
|
216
221
|
"separator": {
|
217
222
|
"name": "separator",
|
218
223
|
"type": "components:ui",
|
219
|
-
"files": [
|
220
|
-
"app/helpers/components/separator_helper.rb",
|
221
|
-
"app/views/components/ui/_separator.html.erb",
|
222
|
-
"app/javascript/controllers/ui/separator_controller.js"
|
223
|
-
]
|
224
|
+
"files": ["app/helpers/components/separator_helper.rb"]
|
224
225
|
},
|
225
226
|
"sheet": {
|
226
227
|
"name": "sheet",
|
@@ -273,6 +274,8 @@
|
|
273
274
|
"files": [
|
274
275
|
"app/helpers/components/tabs_helper.rb",
|
275
276
|
"app/views/components/ui/_tabs.html.erb",
|
277
|
+
"app/views/components/ui/tabs/_tab.html.erb",
|
278
|
+
"app/views/components/ui/tabs/_panel.html.erb",
|
276
279
|
"app/javascript/controllers/ui/tabs_controller.js"
|
277
280
|
]
|
278
281
|
},
|
@@ -67,7 +67,7 @@ class ShadcnUiGenerator < Rails::Generators::Base
|
|
67
67
|
|
68
68
|
available_components.each do |component, _|
|
69
69
|
description = "# A #{component} component"
|
70
|
-
banner_line = "rails generate shadcn-ui #{component}
|
70
|
+
banner_line = "rails generate shadcn-ui #{component} #{" " * (20 - component.length)} #{description}"
|
71
71
|
puts banner_line
|
72
72
|
end
|
73
73
|
end
|
data/lib/shadcn-ui/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shadcn-ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Avi Flombaum
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
12
|
-
dependencies:
|
11
|
+
date: 2023-08-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: tailwind_merge
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.7'
|
13
27
|
description: This gem is a documentation site and gem that will copy components from
|
14
28
|
the shadcn-ui library into a Ruby on Rails application.
|
15
29
|
email:
|
@@ -19,7 +33,6 @@ extensions: []
|
|
19
33
|
extra_rdoc_files: []
|
20
34
|
files:
|
21
35
|
- ".editorconfig"
|
22
|
-
- ".env"
|
23
36
|
- ".prettierignore"
|
24
37
|
- ".prettierrc.json"
|
25
38
|
- ".rspec"
|
@@ -55,6 +68,7 @@ files:
|
|
55
68
|
- app/helpers/components/card_helper.rb
|
56
69
|
- app/helpers/components/checkbox_helper.rb
|
57
70
|
- app/helpers/components/collapsible_helper.rb
|
71
|
+
- app/helpers/components/combobox_helper.rb
|
58
72
|
- app/helpers/components/dialog_helper.rb
|
59
73
|
- app/helpers/components/dropdown_menu_helper.rb
|
60
74
|
- app/helpers/components/filter_helper.rb
|
@@ -65,10 +79,12 @@ files:
|
|
65
79
|
- app/helpers/components/list_helper.rb
|
66
80
|
- app/helpers/components/popover_helper.rb
|
67
81
|
- app/helpers/components/progress_helper.rb
|
68
|
-
- app/helpers/components/
|
82
|
+
- app/helpers/components/separator_helper.rb
|
69
83
|
- app/helpers/components/sheet_helper.rb
|
70
84
|
- app/helpers/components/skeleton_helper.rb
|
71
85
|
- app/helpers/components/slider_helper.rb
|
86
|
+
- app/helpers/components/switch_helper.rb
|
87
|
+
- app/helpers/components/tabs_helper.rb
|
72
88
|
- app/helpers/components/textarea_helper.rb
|
73
89
|
- app/helpers/components/toast_helper.rb
|
74
90
|
- app/helpers/components/toggle_helper.rb
|
@@ -81,7 +97,6 @@ files:
|
|
81
97
|
- app/javascript/controllers/hello_controller.js
|
82
98
|
- app/javascript/controllers/highlight_controller.js
|
83
99
|
- app/javascript/controllers/index.js
|
84
|
-
- app/javascript/controllers/tabs_controller.js
|
85
100
|
- app/javascript/controllers/theme_controller.js
|
86
101
|
- app/javascript/controllers/ui/accordion_controller.js
|
87
102
|
- app/javascript/controllers/ui/checkbox_controller.js
|
@@ -93,6 +108,8 @@ files:
|
|
93
108
|
- app/javascript/controllers/ui/popover_controller.js
|
94
109
|
- app/javascript/controllers/ui/sheet_controller.js
|
95
110
|
- app/javascript/controllers/ui/slider_controller.js
|
111
|
+
- app/javascript/controllers/ui/switch_controller.js
|
112
|
+
- app/javascript/controllers/ui/tabs_controller.js
|
96
113
|
- app/javascript/controllers/ui/toast_controller.js
|
97
114
|
- app/javascript/controllers/ui/toggle_controller.js
|
98
115
|
- app/javascript/controllers/ui/tooltip_controller.js
|
@@ -106,11 +123,11 @@ files:
|
|
106
123
|
- app/views/components/ui/_accordion.html.erb
|
107
124
|
- app/views/components/ui/_alert.html.erb
|
108
125
|
- app/views/components/ui/_alert_dialog.html.erb
|
109
|
-
- app/views/components/ui/_badge.html.erb
|
110
126
|
- app/views/components/ui/_button.html.erb
|
111
127
|
- app/views/components/ui/_card.html.erb
|
112
128
|
- app/views/components/ui/_checkbox.html.erb
|
113
129
|
- app/views/components/ui/_collapsible.html.erb
|
130
|
+
- app/views/components/ui/_combobox.html.erb
|
114
131
|
- app/views/components/ui/_command.html.erb
|
115
132
|
- app/views/components/ui/_dialog.html.erb
|
116
133
|
- app/views/components/ui/_dropdown_menu.html.erb
|
@@ -121,10 +138,11 @@ files:
|
|
121
138
|
- app/views/components/ui/_list.html.erb
|
122
139
|
- app/views/components/ui/_popover.html.erb
|
123
140
|
- app/views/components/ui/_progress.html.erb
|
124
|
-
- app/views/components/ui/_separator.html.erb
|
125
141
|
- app/views/components/ui/_sheet.html.erb
|
126
142
|
- app/views/components/ui/_skeleton.html.erb
|
127
143
|
- app/views/components/ui/_slider.html.erb
|
144
|
+
- app/views/components/ui/_switch.html.erb
|
145
|
+
- app/views/components/ui/_tabs.html.erb
|
128
146
|
- app/views/components/ui/_textarea.html.erb
|
129
147
|
- app/views/components/ui/_toast.html.erb
|
130
148
|
- app/views/components/ui/_toggle.html.erb
|
@@ -132,6 +150,8 @@ files:
|
|
132
150
|
- app/views/components/ui/shared/_backdrop.html.erb
|
133
151
|
- app/views/components/ui/shared/_menu_item.html.erb
|
134
152
|
- app/views/components/ui/svg/_check.html.erb
|
153
|
+
- app/views/components/ui/tabs/_panel.html.erb
|
154
|
+
- app/views/components/ui/tabs/_tab.html.erb
|
135
155
|
- app/views/documentation/about.html.md
|
136
156
|
- app/views/documentation/generators.html.md
|
137
157
|
- app/views/documentation/helpers.html.md
|
@@ -181,6 +201,10 @@ files:
|
|
181
201
|
- app/views/examples/components/collapsible/_usage.html.erb
|
182
202
|
- app/views/examples/components/collapsible/code/_preview.erb
|
183
203
|
- app/views/examples/components/collapsible/code/_usage.erb
|
204
|
+
- app/views/examples/components/combobox.html.erb
|
205
|
+
- app/views/examples/components/combobox/_usage.html.erb
|
206
|
+
- app/views/examples/components/combobox/code/_preview.erb
|
207
|
+
- app/views/examples/components/combobox/code/_usage.erb
|
184
208
|
- app/views/examples/components/dialog.html.erb
|
185
209
|
- app/views/examples/components/dialog/_usage.html.erb
|
186
210
|
- app/views/examples/components/dialog/code/_form.erb
|
@@ -240,6 +264,16 @@ files:
|
|
240
264
|
- app/views/examples/components/slider/_usage.html.erb
|
241
265
|
- app/views/examples/components/slider/code/_preview.erb
|
242
266
|
- app/views/examples/components/slider/code/_usage.erb
|
267
|
+
- app/views/examples/components/switch.html.erb
|
268
|
+
- app/views/examples/components/switch/_usage.html.erb
|
269
|
+
- app/views/examples/components/switch/code/_preview.erb
|
270
|
+
- app/views/examples/components/switch/code/_usage.erb
|
271
|
+
- app/views/examples/components/tabs.html.erb
|
272
|
+
- app/views/examples/components/tabs/_usage.html.erb
|
273
|
+
- app/views/examples/components/tabs/code/_account.html.erb
|
274
|
+
- app/views/examples/components/tabs/code/_password.html.erb
|
275
|
+
- app/views/examples/components/tabs/code/_preview.erb
|
276
|
+
- app/views/examples/components/tabs/code/_usage.erb
|
243
277
|
- app/views/examples/components/textarea.html.erb
|
244
278
|
- app/views/examples/components/textarea/_usage.html.erb
|
245
279
|
- app/views/examples/components/textarea/code/_preview.erb
|
@@ -345,7 +379,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
345
379
|
- !ruby/object:Gem::Version
|
346
380
|
version: '0'
|
347
381
|
requirements: []
|
348
|
-
rubygems_version: 3.4.
|
382
|
+
rubygems_version: 3.4.10
|
349
383
|
signing_key:
|
350
384
|
specification_version: 4
|
351
385
|
summary: Provides the shadcn-ui component library to a Ruby on Rails application.
|
@@ -1 +0,0 @@
|
|
1
|
-
<div class="<%= badge_classes %>"><%= text %></div>
|