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.
- checksums.yaml +4 -4
- data/.env +1 -0
- data/.prettierrc.json +6 -0
- data/README.md +260 -0
- data/Rakefile +6 -3
- data/app/assets/stylesheets/{application.scss → application.css} +0 -27
- data/app/assets/stylesheets/application.tailwind.css +46 -73
- data/app/assets/stylesheets/shadcn.css +216 -0
- data/app/controllers/components_controller.rb +1 -1
- data/app/controllers/documentation_controller.rb +10 -0
- data/app/helpers/application_helper.rb +19 -0
- data/app/helpers/components/accordion_helper.rb +14 -1
- data/app/helpers/components/alert_helper.rb +4 -2
- data/app/helpers/components/button_helper.rb +2 -1
- data/app/helpers/components/card_helper.rb +2 -2
- data/app/helpers/components/checkbox_helper.rb +2 -2
- data/app/helpers/components/collapsible_helper.rb +8 -0
- data/app/helpers/components/filter_helper.rb +12 -0
- data/app/helpers/components/input_helper.rb +21 -0
- data/app/helpers/components/label_helper.rb +5 -0
- data/app/helpers/components/list_helper.rb +15 -0
- data/app/helpers/components/progress_helper.rb +5 -0
- data/app/helpers/components/sheet_helper.rb +29 -0
- data/app/helpers/components/skeleton_helper.rb +5 -0
- data/app/helpers/components/slider_helper.rb +5 -0
- data/app/helpers/components_helper.rb +11 -0
- data/app/helpers/documentation_helper.rb +2 -0
- data/app/helpers/examples_helper.rb +1 -2
- data/app/javascript/controllers/theme_controller.js +25 -0
- data/app/javascript/controllers/ui/dialog_controller.js +3 -1
- data/app/javascript/controllers/ui/dropdown_controller.js +2 -22
- data/app/javascript/controllers/ui/filter_controller.js +20 -0
- data/app/javascript/controllers/ui/popover_controller.js +29 -1
- data/app/javascript/controllers/ui/sheet_controller.js +33 -0
- data/app/javascript/controllers/ui/slider_controller.js +14 -0
- data/app/javascript/controllers/ui/tooltip_controller.js +1 -1
- data/app/views/application/index.html.erb +122 -0
- data/app/views/components/ui/_accordion.html.erb +2 -2
- data/app/views/components/ui/_alert.html.erb +15 -3
- data/app/views/components/ui/_alert_dialog.html.erb +1 -1
- data/app/views/components/ui/_card.html.erb +2 -2
- data/app/views/components/ui/_checkbox.html.erb +3 -7
- data/app/views/components/ui/_collapsible.html.erb +2 -6
- data/app/views/components/ui/_command.html.erb +0 -0
- data/app/views/components/ui/_dialog.html.erb +1 -1
- data/app/views/components/ui/_filter.html.erb +14 -0
- data/app/views/components/ui/_input.html.erb +8 -0
- data/app/views/components/ui/_label.html.erb +3 -0
- data/app/views/components/ui/_list.html.erb +5 -0
- data/app/views/components/ui/_progress.html.erb +15 -0
- data/app/views/components/ui/_sheet.html.erb +44 -0
- data/app/views/components/ui/_skeleton.html.erb +1 -0
- data/app/views/components/ui/_slider.html.erb +2 -0
- data/app/views/components/ui/_textarea.html.erb +1 -1
- data/app/views/components/ui/shared/{_dialog_background.html.erb → _backdrop.html.erb} +1 -0
- data/app/views/components/ui/svg/_check.html.erb +11 -0
- data/app/views/documentation/about.html.md +20 -0
- data/app/views/documentation/generators.html.md +1 -0
- data/app/views/documentation/index.html.erb.bak +70 -0
- data/app/views/documentation/index.html.md +37 -0
- data/app/views/documentation/installation.html.md +377 -0
- data/app/views/examples/components/accordion/_usage.html.erb +15 -0
- data/app/views/examples/components/accordion/code/_block.html.erb +8 -0
- data/app/views/examples/components/accordion/code/_description.html.erb +7 -0
- data/app/views/examples/components/accordion/code/preview.erb +3 -0
- data/app/views/examples/components/accordion/code/usage.erb +16 -0
- data/app/views/examples/components/accordion.html.erb +36 -0
- data/app/views/examples/components/alert/_usage.html.erb +10 -0
- data/app/views/examples/components/alert/code/_attention.erb +3 -0
- data/app/views/examples/components/alert/code/_destructive.erb +2 -0
- data/app/views/examples/components/alert/code/_info.erb +3 -0
- data/app/views/examples/components/alert/code/_no_icon.erb +3 -0
- data/app/views/examples/components/alert/code/_success.erb +3 -0
- data/app/views/examples/components/alert/code/preview.erb +2 -0
- data/app/views/examples/components/alert/code/usage.erb +1 -0
- data/app/views/examples/components/alert.html.erb +90 -7
- data/app/views/examples/components/badge/_usage.html.erb +10 -0
- data/app/views/examples/components/badge/code/preview.erb +5 -0
- data/app/views/examples/components/badge/code/usage.erb +1 -0
- data/app/views/examples/components/badge.html.erb +11 -4
- data/app/views/examples/components/button/_usage.html.erb +19 -0
- data/app/views/examples/components/button/code/preview.erb +13 -0
- data/app/views/examples/components/button/code/usage.erb +6 -0
- data/app/views/examples/components/button.html.erb +20 -6
- data/app/views/examples/components/card/_usage.html.erb +21 -0
- data/app/views/examples/components/card/code/_form.erb +72 -0
- data/app/views/examples/components/card/code/_notifications.erb +61 -0
- data/app/views/examples/components/card/code/preview.erb +6 -0
- data/app/views/examples/components/card/code/usage.erb +3 -0
- data/app/views/examples/components/card.html.erb +35 -143
- data/app/views/examples/components/checkbox/_usage.html.erb +9 -0
- data/app/views/examples/components/checkbox/code/preview.erb +2 -0
- data/app/views/examples/components/checkbox/code/usage.erb +1 -0
- data/app/views/examples/components/checkbox.html.erb +14 -0
- data/app/views/examples/components/collapsible/_usage.html.erb +16 -0
- data/app/views/examples/components/collapsible/code/preview.erb +9 -0
- data/app/views/examples/components/collapsible/code/usage.erb +7 -0
- data/app/views/examples/components/collapsible.html.erb +13 -3
- data/app/views/examples/components/dialog.html.erb +1 -1
- data/app/views/examples/components/filter.html.erb +25 -0
- data/app/views/examples/components/input.html.erb +18 -0
- data/app/views/examples/components/label.html.erb +13 -0
- data/app/views/examples/components/progress.html.erb +12 -0
- data/app/views/examples/components/sheet.html.erb +19 -0
- data/app/views/examples/components/skeleton.html.erb +12 -0
- data/app/views/examples/components/slider.html.erb +12 -0
- data/app/views/layouts/application.html.erb +2 -3
- data/app/views/layouts/component.html.erb +2 -2
- data/app/views/layouts/documentation.html.erb +39 -0
- data/app/views/layouts/shared/_components.html.erb +62 -0
- data/app/views/layouts/shared/_header.html.erb +25 -33
- data/app/views/layouts/shared/_sidebar.html.erb +10 -0
- data/config/application.rb +2 -1
- data/config/importmap.rb +6 -6
- data/config/initializers/markdown.rb +24 -0
- data/config/routes.rb +7 -1
- data/config/shadcn.tailwind.js +98 -0
- data/config/tailwind.config.js +13 -74
- data/lib/components.json +305 -0
- data/lib/generators/shadcn-ui_generator.rb +201 -0
- data/lib/shadcn-ui/version.rb +1 -1
- data/package-lock.json +90 -3
- data/package.json +4 -0
- data/public/accordion.png +0 -0
- metadata +81 -7
- data/app/views/layouts/_sidebar.html.erb +0 -270
- data/lib/generators/shadcn_ui_generator.rb +0 -32
- /data/app/assets/stylesheets/{lambda.light.scss → lambda.light.css} +0 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= render_component_header title: "Input",
|
2
|
+
description: "Displays a form input field or a component that looks like an input field." %>
|
3
|
+
|
4
|
+
<% content_for :preview, flush: true do %>
|
5
|
+
<%= render_input name: "sample_input", id: "sample_input" %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<% content_for :code, flush: true do %>
|
9
|
+
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render_preview %>
|
13
|
+
|
14
|
+
<%= content_for :examples, flush: true do %>
|
15
|
+
<%= render_input name: "sample_input", id: "sample_input", style: :borderless %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<%= render_example %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= render_component_header title: "Input",
|
2
|
+
description: "Displays a form input field or a component that looks like an input field." %>
|
3
|
+
|
4
|
+
<% content_for :preview, flush: true do %>
|
5
|
+
<%= render_label name: "sample_input", label: "Sample Input", class: "block text-left w-full" %>
|
6
|
+
<%= render_input name: "sample_input", id: "sample_input" %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<% content_for :code, flush: true do %>
|
10
|
+
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= render_preview %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render_component_header title: "Progress",
|
2
|
+
description: "Displays an indicator showing the completion progress of a task, typically displayed as a progress bar." %>
|
3
|
+
|
4
|
+
<% content_for :preview, flush: true do %>
|
5
|
+
<%= render_progress value: 37 %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<% content_for :code, flush: true do %>
|
9
|
+
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render_preview %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= render_component_header title: "Sheet",
|
2
|
+
description: "Extends the Dialog component to display content that complements the main content of the screen." %>
|
3
|
+
|
4
|
+
<% content_for :preview, flush: true do %>
|
5
|
+
<div class="w-full flex justify-center">
|
6
|
+
<%= render_sheet direction: "right" do %>
|
7
|
+
<%= sheet_trigger do %>
|
8
|
+
<%= render_button("Open Sidebar", variant: :outline) %>
|
9
|
+
<% end %>
|
10
|
+
<%= sheet_content do %>
|
11
|
+
<h2 class="mt-10 scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight transition-colors first:mt-0">The King's Plan</h2>
|
12
|
+
<p class="leading-7 [&:not(:first-child)]:mt-6">The king thought long and hard, and finally came up with <a href="#" class="font-medium text-primary underline underline-offset-4">a brilliant plan</a>: he would tax the jokes in the kingdom.</p>
|
13
|
+
<blockquote class="mt-6 border-l-2 pl-6 italic">"After all," he said, "everyone enjoys a good joke, so it's only fair that they should pay for the privilege."</blockquote>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<%= render_preview %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render_component_header title: "Skeleton",
|
2
|
+
description: "Use to show a placeholder while content is loading." %>
|
3
|
+
|
4
|
+
<% content_for :preview, flush: true do %>
|
5
|
+
<%= render_skeleton %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<% content_for :code, flush: true do %>
|
9
|
+
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render_preview %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render_component_header title: "Slider",
|
2
|
+
description: "An input where the user selects a value from within a given range." %>
|
3
|
+
|
4
|
+
<% content_for :preview, flush: true do %>
|
5
|
+
<%= render_slider name: "sample_slider", id: "sample_slider", value: 23 %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<% content_for :code, flush: true do %>
|
9
|
+
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render_preview %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<title
|
4
|
+
<title><%= page_title %></title>
|
5
5
|
<meta
|
6
6
|
name="viewport"
|
7
7
|
content="width=device-width,initial-scale=1">
|
@@ -21,9 +21,8 @@
|
|
21
21
|
<div class="flex-1">
|
22
22
|
<div class="border-b">
|
23
23
|
<div
|
24
|
-
class="container flex-1 items-start
|
24
|
+
class="container flex-1 items-start ">
|
25
25
|
<!--prettier-ignore-->
|
26
|
-
<%= render 'layouts/sidebar' %>
|
27
26
|
<%= yield %>
|
28
27
|
</div>
|
29
28
|
</div>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<title
|
4
|
+
<title><%= page_title %></title>
|
5
5
|
<meta
|
6
6
|
name="viewport"
|
7
7
|
content="width=device-width,initial-scale=1">
|
@@ -23,7 +23,7 @@
|
|
23
23
|
<div
|
24
24
|
class="container flex-1 items-start md:grid md:grid-cols-[220px_minmax(0,1fr)] md:gap-6 lg:grid-cols-[240px_minmax(0,1fr)] lg:gap-10">
|
25
25
|
<!--prettier-ignore-->
|
26
|
-
<%= render 'layouts/sidebar' %>
|
26
|
+
<%= render 'layouts/shared/sidebar' %>
|
27
27
|
<main class="relative py-6 lg:gap-10 lg:py-8 xl:grid xl:grid-cols-[1fr_300px]">
|
28
28
|
<div class="mx-auto w-full min-w-0"><%= yield %></div>
|
29
29
|
</main>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%= page_title %></title>
|
5
|
+
<meta
|
6
|
+
name="viewport"
|
7
|
+
content="width=device-width,initial-scale=1">
|
8
|
+
<!--prettier-ignore-->
|
9
|
+
<%= csrf_meta_tags %>
|
10
|
+
<%= csp_meta_tag %>
|
11
|
+
<%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
|
12
|
+
|
13
|
+
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
14
|
+
|
15
|
+
<%= javascript_importmap_tags %>
|
16
|
+
</head>
|
17
|
+
|
18
|
+
<body>
|
19
|
+
<div class="relative flex min-h-screen flex-col">
|
20
|
+
<%= render 'layouts/shared/header' %>
|
21
|
+
<div class="flex-1">
|
22
|
+
<div class="border-b">
|
23
|
+
<div
|
24
|
+
class="container flex-1 items-start md:grid md:grid-cols-[220px_minmax(0,1fr)] md:gap-6 lg:grid-cols-[240px_minmax(0,1fr)] lg:gap-10">
|
25
|
+
<!--prettier-ignore-->
|
26
|
+
<%= render 'layouts/shared/sidebar' %>
|
27
|
+
<main class="relative py-6 lg:gap-10 lg:py-8 xl:grid xl:grid-cols-[1fr_300px]">
|
28
|
+
<div class="mx-auto w-full min-w-0">
|
29
|
+
<article class="documentation">
|
30
|
+
<%= yield %>
|
31
|
+
</article>
|
32
|
+
</div>
|
33
|
+
</main>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
</body>
|
39
|
+
</html>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<div
|
2
|
+
class="h-full w-full rounded-[inherit] overflow-y-scroll-auto overflow-x-hidden">
|
3
|
+
<div style="min-width: 100%; display: table">
|
4
|
+
<div class="w-full">
|
5
|
+
<div class="pb-4">
|
6
|
+
<h4 class="mb-1 rounded-md px-2 py-1 text-sm font-semibold">Getting Started</h4>
|
7
|
+
<div class="grid grid-flow-row auto-rows-max text-sm">
|
8
|
+
<%= sidebar_link "Introduction", documentation_index_path %>
|
9
|
+
<%= sidebar_link "Installation", documentation_path("installation") %>
|
10
|
+
<%= sidebar_link "Generators", documentation_path("generators") %>
|
11
|
+
<%= sidebar_link "About", documentation_path("about") %>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
<div class="pb-4">
|
15
|
+
<h4 class="mb-1 rounded-md px-2 py-1 text-sm font-semibold">Components</h4>
|
16
|
+
<div class="grid grid-flow-row auto-rows-max text-sm">
|
17
|
+
<%= sidebar_link "✅ 📖 Accordion", "/docs/components/accordion" %>
|
18
|
+
<%= sidebar_link "✅ 📖 Alert", "/docs/components/alert" %>
|
19
|
+
<%= sidebar_link "✅ Alert Dialog", "/docs/components/alert-dialog" %>
|
20
|
+
<%= sidebar_link "❌ Aspect Ratio", "/docs/components/aspect-ratio" %>
|
21
|
+
<%= sidebar_link "❌ Avatar", "/docs/components/avatar" %>
|
22
|
+
<%= sidebar_link "✅ 📖 Badge", "/docs/components/badge" %>
|
23
|
+
<%= sidebar_link "✅ 📖 Button", "/docs/components/button" %>
|
24
|
+
<%= sidebar_link "❌ Calendar", "/docs/components/calendar" %>
|
25
|
+
<%= sidebar_link "✅ 📖 Card", "/docs/components/card" %>
|
26
|
+
<%= sidebar_link "✅ 📖 Checkbox", "/docs/components/checkbox" %>
|
27
|
+
<%= sidebar_link "✅ 📖 Collapsible", "/docs/components/collapsible" %>
|
28
|
+
<%= sidebar_link "Combobox", "/docs/components/combobox" %>
|
29
|
+
<%= sidebar_link "Command", "/docs/components/command" %>
|
30
|
+
<%= sidebar_link "Context Menu", "/docs/components/context-menu" %>
|
31
|
+
<%= sidebar_link "Data Table", "/docs/components/data-table" %>
|
32
|
+
<%= sidebar_link "Date Picker", "/docs/components/date-picker" %>
|
33
|
+
<%= sidebar_link "✅ 📖 Dialog", "/docs/components/dialog" %>
|
34
|
+
<%= sidebar_link "Dropdown Menu", "/docs/components/dropdown-menu" %>
|
35
|
+
<%= sidebar_link "➕ Filter", "/docs/components/filter" %>
|
36
|
+
<%= sidebar_link "Form", "/docs/components/form" %>
|
37
|
+
<%= sidebar_link "✅ Hover Card", "/docs/components/hover-card" %>
|
38
|
+
<%= sidebar_link "✅ Input", "/docs/components/input" %>
|
39
|
+
<%= sidebar_link "✅ Label", "/docs/components/label" %>
|
40
|
+
<%= sidebar_link "Menubar", "/docs/components/menubar" %>
|
41
|
+
<%= sidebar_link "Navigation Menu", "/docs/components/navigation-menu" %>
|
42
|
+
<%= sidebar_link "✅ Popover", "/docs/components/popover" %>
|
43
|
+
<%= sidebar_link "✅ Progress", "/docs/components/progress" %>
|
44
|
+
<%= sidebar_link "Radio Group", "/docs/components/radio-group" %>
|
45
|
+
<%= sidebar_link "Scroll Area", "/docs/components/scroll-area" %>
|
46
|
+
<%= sidebar_link "Select", "/docs/components/select" %>
|
47
|
+
<%= sidebar_link "✅ Separator", "/docs/components/separator" %>
|
48
|
+
<%= sidebar_link "✅ Sheet", "/docs/components/sheet" %>
|
49
|
+
<%= sidebar_link "✅ Skeleton", "/docs/components/skeleton" %>
|
50
|
+
<%= sidebar_link "✅ Slider", "/docs/components/slider" %>
|
51
|
+
<%= sidebar_link "Switch", "/docs/components/switch" %>
|
52
|
+
<%= sidebar_link "Table", "/docs/components/table" %>
|
53
|
+
<%= sidebar_link "Tabs", "/docs/components/tabs" %>
|
54
|
+
<%= sidebar_link "✅ Textarea", "/docs/components/textarea" %>
|
55
|
+
<%= sidebar_link "✅ Toast", "/docs/components/toast" %>
|
56
|
+
<%= sidebar_link "✅ Toggle", "/docs/components/toggle" %>
|
57
|
+
<%= sidebar_link "✅ Tooltip", "/docs/components/tooltip" %>
|
58
|
+
</div>
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
</div>
|
@@ -1,3 +1,13 @@
|
|
1
|
+
<%= render_sheet id: "sidebar_sheet", direction: "left", width: "w-auto" do %>
|
2
|
+
<div class=" h-full">
|
3
|
+
<%= sheet_content do %>
|
4
|
+
<div class=" h-full">
|
5
|
+
<%= render 'layouts/shared/components' %>
|
6
|
+
</div>
|
7
|
+
<% end %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
|
1
11
|
<header
|
2
12
|
class="supports-backdrop-blur:bg-background/60 sticky top-0 z-40 w-full border-b bg-background/95 backdrop-blur">
|
3
13
|
<div class="container flex h-14 items-center">
|
@@ -37,32 +47,24 @@
|
|
37
47
|
<span class="hidden font-bold sm:inline-block">shadcn/ui on Rails</span>
|
38
48
|
</a>
|
39
49
|
<nav class="flex items-center space-x-6 text-sm font-medium">
|
50
|
+
<%= link_to "Home", root_path, class: "transition-colors hover:text-foreground/80 #{params[:controller] == 'application' ? "text-foreground" : "text-foreground/60"}" %>
|
51
|
+
<%= link_to "Documentation", documentation_index_path, class: "transition-colors hover:text-foreground/80 text-foreground/60 #{params[:controller] == 'documentation' ? "text-foreground" : "text-foreground/60"}" %>
|
52
|
+
<%= link_to "Components", component_path("accordion"), class: "transition-colors hover:text-foreground/80 text-foreground/60 #{params[:controller] == 'components' ? "text-foreground" : "text-foreground/60"}" %>
|
40
53
|
<a
|
41
|
-
class="transition-colors hover:text-foreground/80 text-foreground/60"
|
42
|
-
href="/docs"
|
43
|
-
>Documentation</a
|
44
|
-
><a
|
45
|
-
class="transition-colors hover:text-foreground/80 text-foreground"
|
46
|
-
href="/docs/components"
|
47
|
-
>Components</a
|
48
|
-
><a
|
49
|
-
class="transition-colors hover:text-foreground/80 text-foreground/60"
|
50
|
-
href="/examples"
|
51
|
-
>Examples</a
|
52
|
-
><a
|
53
54
|
class="hidden text-foreground/60 transition-colors hover:text-foreground/80 lg:block"
|
54
|
-
href="https://github.com/shadcn
|
55
|
-
>GitHub</a
|
56
|
-
>
|
55
|
+
href="https://github.com/aviflombaum/shadcn-rails">GitHub</a>
|
57
56
|
</nav>
|
58
57
|
</div>
|
58
|
+
|
59
59
|
<button
|
60
60
|
class="inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 hover:text-accent-foreground h-9 py-2 mr-2 px-0 text-base hover:bg-transparent focus-visible:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 md:hidden"
|
61
61
|
type="button"
|
62
62
|
aria-haspopup="dialog"
|
63
63
|
aria-expanded="false"
|
64
|
-
|
65
|
-
data-
|
64
|
+
data-state="closed"
|
65
|
+
data-controller="ui--sheet"
|
66
|
+
data-action="click->ui--sheet#toggleOutlet"
|
67
|
+
data--ui-sheet-outlet="#sidebar_sheet">
|
66
68
|
<svg
|
67
69
|
width="15"
|
68
70
|
height="15"
|
@@ -79,23 +81,12 @@
|
|
79
81
|
<span class="sr-only">Toggle Menu</span>
|
80
82
|
</button>
|
81
83
|
<div class="flex flex-1 items-center justify-between space-x-2 md:justify-end">
|
82
|
-
|
83
|
-
<button
|
84
|
-
class="inline-flex items-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground h-9 px-4 py-2 relative w-full justify-start text-sm text-muted-foreground sm:pr-12 md:w-40 lg:w-64">
|
85
|
-
<span class="hidden lg:inline-flex">Search documentation...</span
|
86
|
-
><span class="inline-flex lg:hidden">Search...</span
|
87
|
-
><kbd
|
88
|
-
class="pointer-events-none absolute right-1.5 top-1.5 hidden h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 sm:flex"
|
89
|
-
><span class="text-xs">⌘</span>K</kbd
|
90
|
-
>
|
91
|
-
</button>
|
92
|
-
</div>
|
84
|
+
|
93
85
|
<nav class="flex items-center">
|
94
86
|
<a
|
95
87
|
target="_blank"
|
96
88
|
rel="noreferrer"
|
97
|
-
href="https://github.com/shadcn
|
98
|
-
><div
|
89
|
+
href="https://github.com/aviflombaum/shadcn-rails"><div
|
99
90
|
class="inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-9 py-2 w-9 px-0">
|
100
91
|
<svg
|
101
92
|
viewBox="0 0 438.549 438.549"
|
@@ -110,8 +101,7 @@
|
|
110
101
|
<a
|
111
102
|
target="_blank"
|
112
103
|
rel="noreferrer"
|
113
|
-
href="https://twitter.com/
|
114
|
-
><div
|
104
|
+
href="https://twitter.com/aviflombaum"><div
|
115
105
|
class="inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-9 py-2 w-9 px-0">
|
116
106
|
<svg
|
117
107
|
xmlns="http://www.w3.org/2000/svg"
|
@@ -129,7 +119,9 @@
|
|
129
119
|
id="radix-:Rtlhja:"
|
130
120
|
aria-haspopup="menu"
|
131
121
|
aria-expanded="false"
|
132
|
-
data-state="closed"
|
122
|
+
data-state="closed"
|
123
|
+
data-controller="theme"
|
124
|
+
data-action="theme#toggle">
|
133
125
|
<svg
|
134
126
|
width="15"
|
135
127
|
height="15"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<aside
|
2
|
+
class="fixed top-14 z-30 -ml-2 hidden h-[calc(100vh-3.5rem)] w-full shrink-0 md:sticky md:block ">
|
3
|
+
<div
|
4
|
+
dir="ltr"
|
5
|
+
class="relative overflow-hidden h-full py-6 pl-2 pr-6 lg:py-8"
|
6
|
+
style="position: relative;">
|
7
|
+
|
8
|
+
<%= render "layouts/shared/components" %>
|
9
|
+
</div>
|
10
|
+
</aside>
|
data/config/application.rb
CHANGED
data/config/importmap.rb
CHANGED
@@ -5,9 +5,9 @@ pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
|
|
5
5
|
pin "@hotwired/stimulus", to: "https://ga.jspm.io/npm:@hotwired/stimulus@3.2.1/dist/stimulus.js"
|
6
6
|
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
|
7
7
|
pin_all_from "app/javascript/controllers", under: "controllers"
|
8
|
-
pin "@kanety/stimulus-static-actions", to: "https://ga.jspm.io/npm:@kanety/stimulus-static-actions@1.0.1/dist/index.modern.js"
|
9
|
-
pin "highlight.js", to: "https://ga.jspm.io/npm:highlight.js@11.8.0/es/index.js"
|
10
|
-
pin "stimulus-use", to: "https://ga.jspm.io/npm:stimulus-use@0.51.3/dist/index.js"
|
11
|
-
pin "stimulus-dropdown", to: "https://ga.jspm.io/npm:stimulus-dropdown@2.1.0/dist/stimulus-dropdown.mjs"
|
12
|
-
pin "hotkeys-js", to: "https://ga.jspm.io/npm:hotkeys-js@3.10.4/dist/hotkeys.esm.js"
|
13
|
-
pin "@popperjs/core", to: "https://ga.jspm.io/npm:@popperjs/core@2.11.8/lib/index.js"
|
8
|
+
pin "@kanety/stimulus-static-actions", to: "https://ga.jspm.io/npm:@kanety/stimulus-static-actions@1.0.1/dist/index.modern.js", preload: true
|
9
|
+
pin "highlight.js", to: "https://ga.jspm.io/npm:highlight.js@11.8.0/es/index.js", preload: true
|
10
|
+
pin "stimulus-use", to: "https://ga.jspm.io/npm:stimulus-use@0.51.3/dist/index.js", preload: true
|
11
|
+
pin "stimulus-dropdown", to: "https://ga.jspm.io/npm:stimulus-dropdown@2.1.0/dist/stimulus-dropdown.mjs", preload: true
|
12
|
+
pin "hotkeys-js", to: "https://ga.jspm.io/npm:hotkeys-js@3.10.4/dist/hotkeys.esm.js", preload: true
|
13
|
+
pin "@popperjs/core", to: "https://ga.jspm.io/npm:@popperjs/core@2.11.8/lib/index.js", preload: true
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "redcarpet"
|
2
|
+
require "rouge"
|
3
|
+
require "rouge/plugins/redcarpet"
|
4
|
+
|
5
|
+
class HTML < Redcarpet::Render::HTML
|
6
|
+
include Rouge::Plugins::Redcarpet # yep, that's it.
|
7
|
+
end
|
8
|
+
|
9
|
+
# config/initializers/markdown.rb
|
10
|
+
|
11
|
+
# We define a module that can parse markdown to HTML with its `call` method
|
12
|
+
module MarkdownHandler
|
13
|
+
def self.erb
|
14
|
+
@erb ||= ActionView::Template.registered_template_handler(:erb)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.call(template, source)
|
18
|
+
compiled_source = erb.call(template, source)
|
19
|
+
"Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(with_toc_data: true), extensions = {fenced_code_blocks: true}).render(begin;#{compiled_source};end).html_safe"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Now we tell Rails to process any files with the `.md` extension using our new MarkdownHandler
|
24
|
+
ActionView::Template.register_template_handler :md, MarkdownHandler
|
data/config/routes.rb
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
2
|
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
3
|
+
|
3
4
|
get "/examples/:example", to: "application#examples", as: :example
|
4
|
-
get "/docs
|
5
|
+
get "/docs/components/:component", to: "components#show", as: :component
|
6
|
+
get "/docs/components", to: redirect("/docs/components/accordion")
|
7
|
+
get "/components", to: redirect("/docs/components/accordion"), as: :components
|
8
|
+
get "/docs/:id" => "documentation#show", :as => :documentation, :format => false
|
9
|
+
get "/docs", to: "documentation#index", as: :documentation_index
|
10
|
+
|
5
11
|
# Defines the root path route ("/")
|
6
12
|
root "application#index"
|
7
13
|
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
const defaultTheme = require("tailwindcss/defaultTheme");
|
2
|
+
|
3
|
+
module.exports = {
|
4
|
+
darkMode: ["class"],
|
5
|
+
content: [
|
6
|
+
"./public/*.html",
|
7
|
+
"./app/helpers/**/*.rb",
|
8
|
+
"./app/javascript/**/*.js",
|
9
|
+
"./app/views/**/*.{erb,haml,html,slim}",
|
10
|
+
],
|
11
|
+
theme: {
|
12
|
+
container: {
|
13
|
+
center: true,
|
14
|
+
padding: "2rem",
|
15
|
+
screens: {
|
16
|
+
"2xl": "1400px",
|
17
|
+
},
|
18
|
+
},
|
19
|
+
extend: {
|
20
|
+
colors: {
|
21
|
+
border: "hsl(var(--border))",
|
22
|
+
input: "hsl(var(--input))",
|
23
|
+
ring: "hsl(var(--ring))",
|
24
|
+
background: "hsl(var(--background))",
|
25
|
+
foreground: "hsl(var(--foreground))",
|
26
|
+
primary: {
|
27
|
+
DEFAULT: "hsl(var(--primary))",
|
28
|
+
foreground: "hsl(var(--primary-foreground))",
|
29
|
+
},
|
30
|
+
secondary: {
|
31
|
+
DEFAULT: "hsl(var(--secondary))",
|
32
|
+
foreground: "hsl(var(--secondary-foreground))",
|
33
|
+
},
|
34
|
+
destructive: {
|
35
|
+
DEFAULT: "hsl(var(--destructive))",
|
36
|
+
foreground: "hsl(var(--destructive-foreground))",
|
37
|
+
},
|
38
|
+
success: {
|
39
|
+
DEFAULT: "hsl(var(--success))",
|
40
|
+
foreground: "hsl(var(--success-foreground))",
|
41
|
+
},
|
42
|
+
info: {
|
43
|
+
DEFAULT: "hsl(var(--info))",
|
44
|
+
foreground: "hsl(var(--info-foreground))",
|
45
|
+
},
|
46
|
+
attention: {
|
47
|
+
DEFAULT: "var(--yellow-50)",
|
48
|
+
foreground: "hsl(var(--attention-foreground))",
|
49
|
+
},
|
50
|
+
muted: {
|
51
|
+
DEFAULT: "hsl(var(--muted))",
|
52
|
+
foreground: "hsl(var(--muted-foreground))",
|
53
|
+
},
|
54
|
+
accent: {
|
55
|
+
DEFAULT: "hsl(var(--accent))",
|
56
|
+
foreground: "hsl(var(--accent-foreground))",
|
57
|
+
},
|
58
|
+
popover: {
|
59
|
+
DEFAULT: "hsl(var(--popover))",
|
60
|
+
foreground: "hsl(var(--popover-foreground))",
|
61
|
+
},
|
62
|
+
card: {
|
63
|
+
DEFAULT: "hsl(var(--card))",
|
64
|
+
foreground: "hsl(var(--card-foreground))",
|
65
|
+
},
|
66
|
+
},
|
67
|
+
borderRadius: {
|
68
|
+
lg: "var(--radius)",
|
69
|
+
md: "calc(var(--radius) - 2px)",
|
70
|
+
sm: "calc(var(--radius) - 4px)",
|
71
|
+
},
|
72
|
+
fontFamily: {
|
73
|
+
sans: ["var(--font-sans)", ...defaultTheme.fontFamily.sans],
|
74
|
+
},
|
75
|
+
keyframes: {
|
76
|
+
"accordion-down": {
|
77
|
+
from: { height: 0 },
|
78
|
+
to: { height: "var(--radix-accordion-content-height)" },
|
79
|
+
},
|
80
|
+
"accordion-up": {
|
81
|
+
from: { height: "var(--radix-accordion-content-height)" },
|
82
|
+
to: { height: 0 },
|
83
|
+
},
|
84
|
+
},
|
85
|
+
animation: {
|
86
|
+
"accordion-down": "accordion-down 0.2s ease-out",
|
87
|
+
"accordion-up": "accordion-up 0.2s ease-out",
|
88
|
+
},
|
89
|
+
},
|
90
|
+
},
|
91
|
+
plugins: [
|
92
|
+
require("@tailwindcss/forms"),
|
93
|
+
require("@tailwindcss/aspect-ratio"),
|
94
|
+
require("@tailwindcss/typography"),
|
95
|
+
require("@tailwindcss/container-queries"),
|
96
|
+
require("tailwindcss-animate"),
|
97
|
+
],
|
98
|
+
};
|
data/config/tailwind.config.js
CHANGED
@@ -1,86 +1,25 @@
|
|
1
|
-
const
|
1
|
+
const shadcnConfig = require("./shadcn.tailwind.js");
|
2
2
|
|
3
3
|
module.exports = {
|
4
|
-
|
5
|
-
content: [
|
6
|
-
"./public/*.html",
|
7
|
-
"./app/helpers/**/*.rb",
|
8
|
-
"./app/javascript/**/*.js",
|
9
|
-
"./app/views/**/*.{erb,haml,html,slim}",
|
10
|
-
],
|
4
|
+
...shadcnConfig,
|
11
5
|
theme: {
|
12
|
-
container: {
|
13
|
-
center: true,
|
14
|
-
padding: "2rem",
|
15
|
-
screens: {
|
16
|
-
"2xl": "1400px",
|
17
|
-
},
|
18
|
-
},
|
19
6
|
extend: {
|
20
7
|
colors: {
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
primary: {
|
27
|
-
DEFAULT: "hsl(var(--primary))",
|
28
|
-
foreground: "hsl(var(--primary-foreground))",
|
29
|
-
},
|
30
|
-
secondary: {
|
31
|
-
DEFAULT: "hsl(var(--secondary))",
|
32
|
-
foreground: "hsl(var(--secondary-foreground))",
|
33
|
-
},
|
34
|
-
destructive: {
|
35
|
-
DEFAULT: "hsl(var(--destructive))",
|
36
|
-
foreground: "hsl(var(--destructive-foreground))",
|
37
|
-
},
|
38
|
-
muted: {
|
39
|
-
DEFAULT: "hsl(var(--muted))",
|
40
|
-
foreground: "hsl(var(--muted-foreground))",
|
41
|
-
},
|
42
|
-
accent: {
|
43
|
-
DEFAULT: "hsl(var(--accent))",
|
44
|
-
foreground: "hsl(var(--accent-foreground))",
|
8
|
+
...shadcnConfig.theme.extend.colors,
|
9
|
+
pink: "hsl(var(--pink))",
|
10
|
+
success: {
|
11
|
+
DEFAULT: "hsl(var(--success))",
|
12
|
+
foreground: "hsl(var(--success-foreground))",
|
45
13
|
},
|
46
|
-
|
47
|
-
DEFAULT: "hsl(var(--
|
48
|
-
foreground: "hsl(var(--
|
14
|
+
info: {
|
15
|
+
DEFAULT: "hsl(var(--info))",
|
16
|
+
foreground: "hsl(var(--info-foreground))",
|
49
17
|
},
|
50
|
-
|
51
|
-
DEFAULT: "hsl(var(--
|
52
|
-
foreground: "hsl(var(--
|
18
|
+
attention: {
|
19
|
+
DEFAULT: "hsl(var(--attention))",
|
20
|
+
foreground: "hsl(var(--attention-foreground))",
|
53
21
|
},
|
54
22
|
},
|
55
|
-
borderRadius: {
|
56
|
-
lg: `var(--radius)`,
|
57
|
-
md: `calc(var(--radius) - 2px)`,
|
58
|
-
sm: "calc(var(--radius) - 4px)",
|
59
|
-
},
|
60
|
-
fontFamily: {
|
61
|
-
sans: ["var(--font-sans)", ...defaultTheme.fontFamily.sans],
|
62
|
-
},
|
63
|
-
keyframes: {
|
64
|
-
"accordion-down": {
|
65
|
-
from: { height: 0 },
|
66
|
-
to: { height: "var(--radix-accordion-content-height)" },
|
67
|
-
},
|
68
|
-
"accordion-up": {
|
69
|
-
from: { height: "var(--radix-accordion-content-height)" },
|
70
|
-
to: { height: 0 },
|
71
|
-
},
|
72
|
-
},
|
73
|
-
animation: {
|
74
|
-
"accordion-down": "accordion-down 0.2s ease-out",
|
75
|
-
"accordion-up": "accordion-up 0.2s ease-out",
|
76
|
-
},
|
77
23
|
},
|
78
24
|
},
|
79
|
-
plugins: [
|
80
|
-
require("@tailwindcss/forms"),
|
81
|
-
require("@tailwindcss/aspect-ratio"),
|
82
|
-
require("@tailwindcss/typography"),
|
83
|
-
require("@tailwindcss/container-queries"),
|
84
|
-
require("tailwindcss-animate"),
|
85
|
-
],
|
86
25
|
};
|