shadcn-ui 0.0.1 → 0.0.2
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/.prettierrc.json +6 -0
- data/README.md +260 -0
- data/app/assets/stylesheets/application.tailwind.css +101 -0
- data/app/controllers/components_controller.rb +1 -1
- data/app/controllers/documentation_controller.rb +9 -0
- data/app/helpers/application_helper.rb +19 -0
- data/app/helpers/components/card_helper.rb +1 -1
- 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 +20 -0
- data/app/helpers/components/skeleton_helper.rb +5 -0
- data/app/helpers/components/slider_helper.rb +5 -0
- data/app/helpers/documentation_helper.rb +2 -0
- 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/_alert_dialog.html.erb +1 -1
- data/app/views/components/ui/_card.html.erb +2 -2
- data/app/views/components/ui/_checkbox.html.erb +1 -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/index.html.erb.bak +70 -0
- data/app/views/documentation/index.html.md +15 -0
- data/app/views/documentation/installation.html.md +249 -0
- 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 +61 -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/lib/components.json +301 -0
- data/lib/generators/shadcn_ui_generator.rb +64 -15
- data/lib/shadcn-ui/version.rb +1 -1
- data/public/accordion.png +0 -0
- metadata +44 -4
- data/app/views/layouts/_sidebar.html.erb +0 -270
@@ -0,0 +1,249 @@
|
|
1
|
+
# Alpha Usage/Installation
|
2
|
+
|
3
|
+
Prior to the initial gem release, you can use this as an alpha by cloning this repository and
|
4
|
+
starting up the app as you would a standard rails app.
|
5
|
+
|
6
|
+
```sh
|
7
|
+
git clone https://github.com/aviflombaum/shadcn-rails.git
|
8
|
+
cd shadcn-rails
|
9
|
+
bundle install
|
10
|
+
./bin/dev
|
11
|
+
```
|
12
|
+
|
13
|
+
There are very few dependencies and no database so it should just boot up. Visit
|
14
|
+
http://localhost:3000 to see the demo app which is also the documentation. You'll be able to browse
|
15
|
+
the components at http://localhost:3000/components.
|
16
|
+
|
17
|
+
If there's a component you want to try in your app, you will be copying the code from this app to
|
18
|
+
yours. There's a few other steps you'll need.
|
19
|
+
|
20
|
+
## Installing a Component
|
21
|
+
|
22
|
+
### Add Tailwind CSS
|
23
|
+
|
24
|
+
Components are styled using Tailwind CSS. You need to install Tailwind CSS in your project.
|
25
|
+
|
26
|
+
[Follow the Tailwind CSS installation instructions to get started.](https://tailwindcss.com/docs/installation)
|
27
|
+
|
28
|
+
### Add dependencies
|
29
|
+
|
30
|
+
If you haven't already, install Tailwind into your rails application by adding `tailwindcss-rails`
|
31
|
+
to your `Gemfile` and install tailwind into your app:
|
32
|
+
|
33
|
+
```sh
|
34
|
+
./bin/bundle add tailwindcss-rails
|
35
|
+
./bin/rails tailwindcss:install
|
36
|
+
```
|
37
|
+
|
38
|
+
Then install ./bin/rails tailwindcss:install
|
39
|
+
|
40
|
+
### Configure tailwind.config.js
|
41
|
+
|
42
|
+
Here's what my `tailwind.config.js` file looks like:
|
43
|
+
|
44
|
+
```js
|
45
|
+
const defaultTheme = require("tailwindcss/defaultTheme");
|
46
|
+
|
47
|
+
module.exports = {
|
48
|
+
darkMode: ["class"],
|
49
|
+
content: [
|
50
|
+
"./public/*.html",
|
51
|
+
"./app/helpers/**/*.rb",
|
52
|
+
"./app/javascript/**/*.js",
|
53
|
+
"./app/views/**/*.{erb,haml,html,slim}",
|
54
|
+
],
|
55
|
+
theme: {
|
56
|
+
container: {
|
57
|
+
center: true,
|
58
|
+
padding: "2rem",
|
59
|
+
screens: {
|
60
|
+
"2xl": "1400px",
|
61
|
+
},
|
62
|
+
},
|
63
|
+
extend: {
|
64
|
+
colors: {
|
65
|
+
border: "hsl(var(--border))",
|
66
|
+
input: "hsl(var(--input))",
|
67
|
+
ring: "hsl(var(--ring))",
|
68
|
+
background: "hsl(var(--background))",
|
69
|
+
foreground: "hsl(var(--foreground))",
|
70
|
+
primary: {
|
71
|
+
DEFAULT: "hsl(var(--primary))",
|
72
|
+
foreground: "hsl(var(--primary-foreground))",
|
73
|
+
},
|
74
|
+
secondary: {
|
75
|
+
DEFAULT: "hsl(var(--secondary))",
|
76
|
+
foreground: "hsl(var(--secondary-foreground))",
|
77
|
+
},
|
78
|
+
destructive: {
|
79
|
+
DEFAULT: "hsl(var(--destructive))",
|
80
|
+
foreground: "hsl(var(--destructive-foreground))",
|
81
|
+
},
|
82
|
+
muted: {
|
83
|
+
DEFAULT: "hsl(var(--muted))",
|
84
|
+
foreground: "hsl(var(--muted-foreground))",
|
85
|
+
},
|
86
|
+
accent: {
|
87
|
+
DEFAULT: "hsl(var(--accent))",
|
88
|
+
foreground: "hsl(var(--accent-foreground))",
|
89
|
+
},
|
90
|
+
popover: {
|
91
|
+
DEFAULT: "hsl(var(--popover))",
|
92
|
+
foreground: "hsl(var(--popover-foreground))",
|
93
|
+
},
|
94
|
+
card: {
|
95
|
+
DEFAULT: "hsl(var(--card))",
|
96
|
+
foreground: "hsl(var(--card-foreground))",
|
97
|
+
},
|
98
|
+
},
|
99
|
+
borderRadius: {
|
100
|
+
lg: "var(--radius)",
|
101
|
+
md: "calc(var(--radius) - 2px)",
|
102
|
+
sm: "calc(var(--radius) - 4px)",
|
103
|
+
},
|
104
|
+
fontFamily: {
|
105
|
+
sans: ["var(--font-sans)", ...defaultTheme.fontFamily.sans],
|
106
|
+
},
|
107
|
+
keyframes: {
|
108
|
+
"accordion-down": {
|
109
|
+
from: { height: 0 },
|
110
|
+
to: { height: "var(--radix-accordion-content-height)" },
|
111
|
+
},
|
112
|
+
"accordion-up": {
|
113
|
+
from: { height: "var(--radix-accordion-content-height)" },
|
114
|
+
to: { height: 0 },
|
115
|
+
},
|
116
|
+
},
|
117
|
+
animation: {
|
118
|
+
"accordion-down": "accordion-down 0.2s ease-out",
|
119
|
+
"accordion-up": "accordion-up 0.2s ease-out",
|
120
|
+
},
|
121
|
+
},
|
122
|
+
},
|
123
|
+
plugins: [
|
124
|
+
require("@tailwindcss/forms"),
|
125
|
+
require("@tailwindcss/aspect-ratio"),
|
126
|
+
require("@tailwindcss/typography"),
|
127
|
+
require("@tailwindcss/container-queries"),
|
128
|
+
require("tailwindcss-animate"),
|
129
|
+
],
|
130
|
+
};
|
131
|
+
```
|
132
|
+
|
133
|
+
### Configure styles
|
134
|
+
|
135
|
+
Add the following to your app/assets/stylesheets/application.tailwind.css file.
|
136
|
+
|
137
|
+
```css
|
138
|
+
@tailwind base;
|
139
|
+
@tailwind components;
|
140
|
+
@tailwind utilities;
|
141
|
+
|
142
|
+
@layer base {
|
143
|
+
:root {
|
144
|
+
--background: 0 0% 100%;
|
145
|
+
--foreground: 222.2 47.4% 11.2%;
|
146
|
+
|
147
|
+
--muted: 210 40% 96.1%;
|
148
|
+
--muted-foreground: 215.4 16.3% 46.9%;
|
149
|
+
|
150
|
+
--popover: 0 0% 100%;
|
151
|
+
--popover-foreground: 222.2 47.4% 11.2%;
|
152
|
+
|
153
|
+
--border: 214.3 31.8% 91.4%;
|
154
|
+
--input: 214.3 31.8% 91.4%;
|
155
|
+
|
156
|
+
--card: 0 0% 100%;
|
157
|
+
--card-foreground: 222.2 47.4% 11.2%;
|
158
|
+
|
159
|
+
--primary: 222.2 47.4% 11.2%;
|
160
|
+
--primary-foreground: 210 40% 98%;
|
161
|
+
|
162
|
+
--secondary: 210 40% 96.1%;
|
163
|
+
--secondary-foreground: 222.2 47.4% 11.2%;
|
164
|
+
|
165
|
+
--accent: 210 40% 96.1%;
|
166
|
+
--accent-foreground: 222.2 47.4% 11.2%;
|
167
|
+
|
168
|
+
--destructive: 0 100% 50%;
|
169
|
+
--destructive-foreground: 210 40% 98%;
|
170
|
+
|
171
|
+
--ring: 215 20.2% 65.1%;
|
172
|
+
|
173
|
+
--radius: 0.5rem;
|
174
|
+
}
|
175
|
+
|
176
|
+
.dark {
|
177
|
+
--background: 224 71% 4%;
|
178
|
+
--foreground: 213 31% 91%;
|
179
|
+
|
180
|
+
--muted: 223 47% 11%;
|
181
|
+
--muted-foreground: 215.4 16.3% 56.9%;
|
182
|
+
|
183
|
+
--accent: 216 34% 17%;
|
184
|
+
--accent-foreground: 210 40% 98%;
|
185
|
+
|
186
|
+
--popover: 224 71% 4%;
|
187
|
+
--popover-foreground: 215 20.2% 65.1%;
|
188
|
+
|
189
|
+
--border: 216 34% 17%;
|
190
|
+
--input: 216 34% 17%;
|
191
|
+
|
192
|
+
--card: 224 71% 4%;
|
193
|
+
--card-foreground: 213 31% 91%;
|
194
|
+
|
195
|
+
--primary: 210 40% 98%;
|
196
|
+
--primary-foreground: 222.2 47.4% 1.2%;
|
197
|
+
|
198
|
+
--secondary: 222.2 47.4% 11.2%;
|
199
|
+
--secondary-foreground: 210 40% 98%;
|
200
|
+
|
201
|
+
--destructive: 0 63% 31%;
|
202
|
+
--destructive-foreground: 210 40% 98%;
|
203
|
+
|
204
|
+
--ring: 216 34% 17%;
|
205
|
+
|
206
|
+
--radius: 0.5rem;
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
@layer base {
|
211
|
+
* {
|
212
|
+
@apply border-border;
|
213
|
+
}
|
214
|
+
body {
|
215
|
+
@apply bg-background text-foreground;
|
216
|
+
font-feature-settings:
|
217
|
+
"rlig" 1,
|
218
|
+
"calt" 1;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
```
|
222
|
+
|
223
|
+
### Copy a a component's files to your application
|
224
|
+
|
225
|
+
For example, if you want to use the Accordion component, you would copy the following files to your
|
226
|
+
application:
|
227
|
+
|
228
|
+
- `app/javascript/controllers/components/ui/accordion_controller.js` The Stimulus controller for any
|
229
|
+
component that requires javascript.
|
230
|
+
- `app/helpers/components/accordion_helper.rb` The helper for the component that allows for easy
|
231
|
+
rendering within views.
|
232
|
+
- `app/views/components/ui/_accordion.html.erb` The html for the component.
|
233
|
+
|
234
|
+
Once those are copied in your application you can render an accordion with:
|
235
|
+
|
236
|
+
```
|
237
|
+
<%%= render_accordion title: "Did you know?",
|
238
|
+
description: "You can wrap shadcn helpers in any
|
239
|
+
component library you want!" %>
|
240
|
+
```
|
241
|
+
|
242
|
+
Result:
|
243
|
+
|
244
|
+
<img src="/accordion.png" alt="Example of Accordion" />
|
245
|
+
|
246
|
+
See the component's demo page in `app/views/examples/components/accordion.html.erb` for more
|
247
|
+
examples.
|
248
|
+
|
249
|
+
This will be similar for each component.
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%
|
2
|
+
items = [{:value => "Ruby on Rails", name: "Ruby on Rails"}, {:value => "Next.js", name: "Next.js"}, {:value => "Remix.run", name: "Remix.run"}]
|
3
|
+
%>
|
4
|
+
|
5
|
+
<%= render_component_header title: "Filter",
|
6
|
+
description: "Displays a list that is filterable via the included input." %>
|
7
|
+
|
8
|
+
<% content_for :preview, flush: true do %>
|
9
|
+
<div class="w-full flex justify-center">
|
10
|
+
<%= render_filter items, class: "p-1" do %>
|
11
|
+
<%= filter_icon do %>
|
12
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2 h-4 w-4 shrink-0 opacity-50 ml-2"><circle cx="11" cy="11" r="8"></circle><line x1="21" x2="16.65" y1="21" y2="16.65"></line></svg>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= render_preview %>
|
18
|
+
|
19
|
+
<% content_for :examples, flush: true do %>
|
20
|
+
<div class="w-full flex justify-center">
|
21
|
+
<%= render_filter items, class: "p-1" do %>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<%= render_example %>
|
@@ -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,61 @@
|
|
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 "About", documentation_path("about") %>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
<div class="pb-4">
|
14
|
+
<h4 class="mb-1 rounded-md px-2 py-1 text-sm font-semibold">Components</h4>
|
15
|
+
<div class="grid grid-flow-row auto-rows-max text-sm">
|
16
|
+
<%= sidebar_link "✅ Accordion", "/docs/components/accordion" %>
|
17
|
+
<%= sidebar_link "✅ Alert", "/docs/components/alert" %>
|
18
|
+
<%= sidebar_link "✅ Alert Dialog", "/docs/components/alert-dialog" %>
|
19
|
+
<%= sidebar_link "❌ Aspect Ratio", "/docs/components/aspect-ratio" %>
|
20
|
+
<%= sidebar_link "❌ Avatar", "/docs/components/avatar" %>
|
21
|
+
<%= sidebar_link "✅ Badge", "/docs/components/badge" %>
|
22
|
+
<%= sidebar_link "✅ Button", "/docs/components/button" %>
|
23
|
+
<%= sidebar_link "❌ Calendar", "/docs/components/calendar" %>
|
24
|
+
<%= sidebar_link "✅ Card", "/docs/components/card" %>
|
25
|
+
<%= sidebar_link "✅ Checkbox", "/docs/components/checkbox" %>
|
26
|
+
<%= sidebar_link "✅ Collapsible", "/docs/components/collapsible" %>
|
27
|
+
<%= sidebar_link "Combobox", "/docs/components/combobox" %>
|
28
|
+
<%= sidebar_link "Command", "/docs/components/command" %>
|
29
|
+
<%= sidebar_link "Context Menu", "/docs/components/context-menu" %>
|
30
|
+
<%= sidebar_link "Data Table", "/docs/components/data-table" %>
|
31
|
+
<%= sidebar_link "Date Picker", "/docs/components/date-picker" %>
|
32
|
+
<%= sidebar_link "✅ Dialog", "/docs/components/dialog" %>
|
33
|
+
<%= sidebar_link "Dropdown Menu", "/docs/components/dropdown-menu" %>
|
34
|
+
<%= sidebar_link "➕ Filter", "/docs/components/filter" %>
|
35
|
+
<%= sidebar_link "Form", "/docs/components/form" %>
|
36
|
+
<%= sidebar_link "✅ Hover Card", "/docs/components/hover-card" %>
|
37
|
+
<%= sidebar_link "✅ Input", "/docs/components/input" %>
|
38
|
+
<%= sidebar_link "✅ Label", "/docs/components/label" %>
|
39
|
+
<%= sidebar_link "Menubar", "/docs/components/menubar" %>
|
40
|
+
<%= sidebar_link "Navigation Menu", "/docs/components/navigation-menu" %>
|
41
|
+
<%= sidebar_link "✅ Popover", "/docs/components/popover" %>
|
42
|
+
<%= sidebar_link "✅ Progress", "/docs/components/progress" %>
|
43
|
+
<%= sidebar_link "Radio Group", "/docs/components/radio-group" %>
|
44
|
+
<%= sidebar_link "Scroll Area", "/docs/components/scroll-area" %>
|
45
|
+
<%= sidebar_link "Select", "/docs/components/select" %>
|
46
|
+
<%= sidebar_link "✅ Separator", "/docs/components/separator" %>
|
47
|
+
<%= sidebar_link "✅ Sheet", "/docs/components/sheet" %>
|
48
|
+
<%= sidebar_link "✅ Skeleton", "/docs/components/skeleton" %>
|
49
|
+
<%= sidebar_link "✅ Slider", "/docs/components/slider" %>
|
50
|
+
<%= sidebar_link "Switch", "/docs/components/switch" %>
|
51
|
+
<%= sidebar_link "Table", "/docs/components/table" %>
|
52
|
+
<%= sidebar_link "Tabs", "/docs/components/tabs" %>
|
53
|
+
<%= sidebar_link "✅ Textarea", "/docs/components/textarea" %>
|
54
|
+
<%= sidebar_link "✅ Toast", "/docs/components/toast" %>
|
55
|
+
<%= sidebar_link "✅ Toggle", "/docs/components/toggle" %>
|
56
|
+
<%= sidebar_link "✅ Tooltip", "/docs/components/tooltip" %>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
</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
|