shadcn-ui 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.env +1 -0
  3. data/Rakefile +6 -3
  4. data/app/assets/stylesheets/{application.scss → application.css} +0 -27
  5. data/app/assets/stylesheets/application.tailwind.css +32 -160
  6. data/app/assets/stylesheets/shadcn.css +216 -0
  7. data/app/controllers/documentation_controller.rb +1 -0
  8. data/app/helpers/components/accordion_helper.rb +14 -1
  9. data/app/helpers/components/alert_helper.rb +4 -2
  10. data/app/helpers/components/button_helper.rb +2 -1
  11. data/app/helpers/components/card_helper.rb +1 -1
  12. data/app/helpers/components/checkbox_helper.rb +2 -2
  13. data/app/helpers/components/collapsible_helper.rb +8 -0
  14. data/app/helpers/components/sheet_helper.rb +9 -0
  15. data/app/helpers/components_helper.rb +11 -0
  16. data/app/helpers/examples_helper.rb +1 -2
  17. data/app/views/components/ui/_accordion.html.erb +2 -2
  18. data/app/views/components/ui/_alert.html.erb +15 -3
  19. data/app/views/components/ui/_checkbox.html.erb +2 -1
  20. data/app/views/components/ui/_collapsible.html.erb +2 -6
  21. data/app/views/components/ui/_sheet.html.erb +1 -1
  22. data/app/views/documentation/generators.html.md +1 -0
  23. data/app/views/documentation/index.html.md +22 -0
  24. data/app/views/documentation/installation.html.md +130 -2
  25. data/app/views/examples/components/accordion/_usage.html.erb +15 -0
  26. data/app/views/examples/components/accordion/code/_block.html.erb +8 -0
  27. data/app/views/examples/components/accordion/code/_description.html.erb +7 -0
  28. data/app/views/examples/components/accordion/code/preview.erb +3 -0
  29. data/app/views/examples/components/accordion/code/usage.erb +16 -0
  30. data/app/views/examples/components/accordion.html.erb +36 -0
  31. data/app/views/examples/components/alert/_usage.html.erb +10 -0
  32. data/app/views/examples/components/alert/code/_attention.erb +3 -0
  33. data/app/views/examples/components/alert/code/_destructive.erb +2 -0
  34. data/app/views/examples/components/alert/code/_info.erb +3 -0
  35. data/app/views/examples/components/alert/code/_no_icon.erb +3 -0
  36. data/app/views/examples/components/alert/code/_success.erb +3 -0
  37. data/app/views/examples/components/alert/code/preview.erb +2 -0
  38. data/app/views/examples/components/alert/code/usage.erb +1 -0
  39. data/app/views/examples/components/alert.html.erb +90 -7
  40. data/app/views/examples/components/badge/_usage.html.erb +10 -0
  41. data/app/views/examples/components/badge/code/preview.erb +5 -0
  42. data/app/views/examples/components/badge/code/usage.erb +1 -0
  43. data/app/views/examples/components/badge.html.erb +11 -4
  44. data/app/views/examples/components/button/_usage.html.erb +19 -0
  45. data/app/views/examples/components/button/code/preview.erb +13 -0
  46. data/app/views/examples/components/button/code/usage.erb +6 -0
  47. data/app/views/examples/components/button.html.erb +20 -6
  48. data/app/views/examples/components/card/_usage.html.erb +21 -0
  49. data/app/views/examples/components/card/code/_form.erb +72 -0
  50. data/app/views/examples/components/card/code/_notifications.erb +61 -0
  51. data/app/views/examples/components/card/code/preview.erb +6 -0
  52. data/app/views/examples/components/card/code/usage.erb +3 -0
  53. data/app/views/examples/components/card.html.erb +35 -143
  54. data/app/views/examples/components/checkbox/_usage.html.erb +9 -0
  55. data/app/views/examples/components/checkbox/code/preview.erb +2 -0
  56. data/app/views/examples/components/checkbox/code/usage.erb +1 -0
  57. data/app/views/examples/components/checkbox.html.erb +14 -0
  58. data/app/views/examples/components/collapsible/_usage.html.erb +16 -0
  59. data/app/views/examples/components/collapsible/code/preview.erb +9 -0
  60. data/app/views/examples/components/collapsible/code/usage.erb +7 -0
  61. data/app/views/examples/components/collapsible.html.erb +13 -3
  62. data/app/views/examples/components/dialog.html.erb +1 -1
  63. data/app/views/layouts/shared/_components.html.erb +9 -8
  64. data/config/shadcn.tailwind.js +98 -0
  65. data/config/tailwind.config.js +13 -74
  66. data/lib/components.json +7 -3
  67. data/lib/generators/shadcn-ui_generator.rb +201 -0
  68. data/lib/shadcn-ui/version.rb +1 -1
  69. data/package-lock.json +90 -3
  70. data/package.json +4 -0
  71. metadata +39 -5
  72. data/lib/generators/shadcn_ui_generator.rb +0 -81
  73. /data/app/assets/stylesheets/{lambda.light.scss → lambda.light.css} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a6f3c1462c5fec38163ab5cbac5af561ca2d05f3944ca41bab01649c14ac6fa
4
- data.tar.gz: 5a7fb75ae5e0f7d0db67bf0e55fdc55e65390e5bf535b351f17d69b4b03dd23c
3
+ metadata.gz: 22a141b91988a0b7411fa66841274699ee3f55d4a6b7b2afb152000cdba95385
4
+ data.tar.gz: f7a806d1a7897c1154b4b6a23903d1a2295e4152e29638ff6e5721982eea4760
5
5
  SHA512:
6
- metadata.gz: 1923bfc2b23ab4fd10aff954938111600c1d4e820c47b87827b67c8529bf1540eb36ae058d8bb0973dce3090802855414e6b200f633d08cfeac75db698e75057
7
- data.tar.gz: b16a329953472dee87d8851958f17e2757b1c8709e21c3e5825990486ef80c1ed1b78f459ce23c3d55645786b8173fce76ad6d5b834ecafbadf9940970330410
6
+ metadata.gz: 1b2264728f5100c07607e963c4027aa406e91c7635ef9b9cf6e1c21f5dd7fa193575e0a11b08a2021358835de6645665f6370b4119a1169c99b6ece40c195f9d
7
+ data.tar.gz: 357afd147401ff2c9911082690ed8b8f8162bbf60d64a229ee1c51bfbfd7c6cbfcfa88c8ace873dc1c64029c3ef5fefe64d4e0767029eec579eeb4208defb985
data/.env ADDED
@@ -0,0 +1 @@
1
+ RAILS_MASTER_KEY=1b9d0e6b785b2a5e2648a484f41295cd
data/Rakefile CHANGED
@@ -1,11 +1,14 @@
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 "rspec/core/rake_task"
5
4
 
6
- RSpec::Core::RakeTask.new(:spec)
5
+ if ENV["RAILS_ENV"] != "production"
6
+ require "rspec/core/rake_task"
7
7
 
8
- task default: :spec
8
+ RSpec::Core::RakeTask.new(:spec)
9
+
10
+ task default: :spec
11
+ end
9
12
 
10
13
  require_relative "config/application"
11
14
 
@@ -13,30 +13,3 @@
13
13
  *=
14
14
  *= require_self
15
15
  */
16
- .st-accordion {
17
- .st-accordion__icon:before {
18
- content: "▼";
19
- display: inline-block;
20
- margin-right: 5px;
21
- font-size: 80%;
22
- text-decoration: none;
23
- transform: rotate(-90deg);
24
- }
25
- .st-accordion__icon--opened:before {
26
- transform: rotate(0deg);
27
- }
28
-
29
- .st-accordion__content:not(.st-accordion__content--visible) {
30
- height: 0;
31
- opacity: 0;
32
- visibility: hidden;
33
- overflow: hidden;
34
- transition: all 0.2s;
35
- }
36
- .st-accordion__content.st-accordion__content--visible {
37
- opacity: 1;
38
- visibility: visible;
39
- overflow: hidden;
40
- transition: all 0.2s;
41
- }
42
- }
@@ -1,182 +1,42 @@
1
+ @import "shadcn.css";
2
+
1
3
  @tailwind base;
2
4
  @tailwind components;
3
5
  @tailwind utilities;
4
6
 
5
7
  @layer base {
6
- :root {
7
- --font-sans: "Inter var";
8
- --background: 0 0% 100%;
9
- --foreground: 222.2 47.4% 11.2%;
10
-
11
- --muted: 210 40% 96.1%;
12
- --muted-foreground: 215.4 16.3% 46.9%;
13
-
14
- --popover: 0 0% 100%;
15
- --popover-foreground: 222.2 47.4% 11.2%;
16
-
17
- --border: 214.3 31.8% 91.4%;
18
- --input: 214.3 31.8% 91.4%;
19
-
20
- --card: 0 0% 100%;
21
- --card-foreground: 222.2 47.4% 11.2%;
22
-
23
- --primary: 222.2 47.4% 11.2%;
24
- --primary-foreground: 210 40% 98%;
25
-
26
- --secondary: 210 40% 96.1%;
27
- --secondary-foreground: 222.2 47.4% 11.2%;
28
-
29
- --accent: 210 40% 96.1%;
30
- --accent-foreground: 222.2 47.4% 11.2%;
31
-
32
- --destructive: 0 100% 50%;
33
- --destructive-foreground: 210 40% 98%;
34
-
35
- --ring: 215 20.2% 65.1%;
36
-
37
- --radius: 0.5rem;
8
+ .container {
9
+ margin-left: auto;
10
+ margin-right: auto;
11
+ padding-left: 2rem;
12
+ padding-right: 2rem;
13
+ width: 100%;
38
14
  }
39
15
 
40
- .dark {
41
- --background: 224 71% 4%;
42
- --foreground: 213 31% 91%;
43
-
44
- --muted: 223 47% 11%;
45
- --muted-foreground: 215.4 16.3% 56.9%;
46
-
47
- --accent: 216 34% 17%;
48
- --accent-foreground: 210 40% 98%;
49
-
50
- --popover: 224 71% 4%;
51
- --popover-foreground: 215 20.2% 65.1%;
52
-
53
- --border: 216 34% 17%;
54
- --input: 216 34% 17%;
55
-
56
- --card: 224 71% 4%;
57
- --card-foreground: 213 31% 91%;
58
-
59
- --primary: 210 40% 98%;
60
- --primary-foreground: 222.2 47.4% 1.2%;
61
-
62
- --secondary: 222.2 47.4% 11.2%;
63
- --secondary-foreground: 210 40% 98%;
64
-
65
- --destructive: 0 63% 31%;
66
- --destructive-foreground: 210 40% 98%;
67
-
68
- --ring: 216 34% 17%;
69
-
70
- --radius: 0.5rem;
71
- }
72
- }
73
-
74
- @layer base {
75
- * {
76
- @apply border-border;
77
- }
78
- body {
79
- @apply bg-background text-foreground;
80
- font-feature-settings:
81
- "rlig" 1,
82
- "calt" 1;
83
- }
84
-
85
- .code-sample {
86
- @apply max-h-[650px] overflow-x-auto rounded-lg border bg-zinc-950 dark:bg-zinc-900;
87
- }
88
-
89
- .code-sample span {
90
- @apply bg-zinc-950;
16
+ :root {
17
+ --pink: 301 98% 50% 0.88;
91
18
  }
92
19
  }
93
- input[type="range"] {
94
- display: inline-block;
95
- vertical-align: middle;
96
- font-size: 1em;
97
- font-family: Arial, sans-serif;
98
- }
99
-
100
- /* input[type="range"]:focus,
101
- input[type="number"]:focus {
102
- box-shadow: 0 0 3px 1px #4b81dd;
103
- outline: none;
104
- } */
105
-
106
- input[type="range"] {
107
- -webkit-appearance: none;
108
- margin-right: 15px;
109
- width: 200px;
110
- height: 7px;
111
- background: #f4f4f5;
112
- border-radius: 5px;
113
- background-image: linear-gradient(#000, #000);
114
- background-repeat: no-repeat;
115
- }
116
-
117
- /* Input Thumb */
118
- input[type="range"]::-webkit-slider-thumb {
119
- -webkit-appearance: none;
120
- height: 20px;
121
- width: 20px;
122
- border-radius: 50%;
123
- background: #fff;
124
- cursor: ew-resize;
125
- box-shadow: 0 0 2px 0 #000;
126
- transition: background 0.3s ease-in-out;
127
- }
128
-
129
- input[type="range"]::-moz-range-thumb {
130
- -webkit-appearance: none;
131
- height: 20px;
132
- width: 20px;
133
- border-radius: 50%;
134
- background: #fff;
135
- cursor: ew-resize;
136
- box-shadow: 0 0 2px 0 #000;
137
- transition: background 0.3s ease-in-out;
138
- }
139
20
 
140
- input[type="range"]::-ms-thumb {
141
- -webkit-appearance: none;
142
- height: 20px;
143
- width: 20px;
144
- border-radius: 50%;
145
- background: #fff;
146
- cursor: ew-resize;
147
- box-shadow: 0 0 2px 0 #000;
148
- transition: background 0.3s ease-in-out;
21
+ article.documentation h1 {
22
+ @apply scroll-m-20 text-4xl font-bold tracking-tight;
149
23
  }
150
24
 
151
- /* input[type="range"]::-webkit-slider-thumb:hover {
152
- background: #a1a1aa;
25
+ article.documentation p + h1 {
26
+ @apply mt-12;
153
27
  }
154
-
155
- input[type="range"]::-moz-range-thumb:hover {
156
- background: #a1a1aa;
28
+ article.documentation h2 {
29
+ @apply scroll-m-20 text-3xl font-bold tracking-tight my-8;
157
30
  }
158
31
 
159
- input[type="range"]::-ms-thumb:hover {
160
- background: #a1a1aa;
161
- } */
162
-
163
- input[type="range"]::-moz-range-track {
164
- -webkit-appearance: none;
165
- box-shadow: none;
166
- border: none;
167
- background: transparent;
32
+ article.documentation h3 {
33
+ @apply scroll-m-20 text-2xl font-bold tracking-tight my-4;
168
34
  }
169
35
 
170
- input[type="range"]::-ms-track {
171
- -webkit-appearance: none;
172
- box-shadow: none;
173
- border: none;
174
- background: transparent;
36
+ article.documentation h4 {
37
+ @apply scroll-m-20 text-xl font-bold tracking-tight my-2;
175
38
  }
176
39
 
177
- article.documentation h1 {
178
- @apply scroll-m-20 text-4xl font-bold tracking-tight;
179
- }
180
40
  article.documentation subtitle {
181
41
  @apply text-lg text-muted-foreground;
182
42
  }
@@ -191,3 +51,15 @@ article.documentation :where(code):not(:where([class~="not-prose"] *)):before {
191
51
  article.documentation :where(code):not(:where([class~="not-prose"] *)):after {
192
52
  content: "";
193
53
  }
54
+
55
+ article.documentation p a {
56
+ @apply underline hover:text-pink;
57
+ }
58
+
59
+ article.documentation pre {
60
+ @apply max-h-[650px] overflow-x-auto rounded-lg border bg-zinc-950 dark:bg-zinc-900 text-white py-4 px-8 rounded-lg my-4;
61
+ }
62
+
63
+ article.documentation p > code {
64
+ @apply text-white bg-black p-1 rounded;
65
+ }
@@ -0,0 +1,216 @@
1
+ @layer base {
2
+ :root {
3
+ --font-sans: "Inter var";
4
+ --background: 0 0% 100%;
5
+ --foreground: 222.2 47.4% 11.2%;
6
+
7
+ --muted: 210 40% 96.1%;
8
+ --muted-foreground: 215.4 16.3% 46.9%;
9
+
10
+ --popover: 0 0% 100%;
11
+ --popover-foreground: 222.2 47.4% 11.2%;
12
+
13
+ --border: 214.3 31.8% 91.4%;
14
+ --input: 214.3 31.8% 91.4%;
15
+
16
+ --card: 0 0% 100%;
17
+ --card-foreground: 222.2 47.4% 11.2%;
18
+
19
+ --primary: 222.2 47.4% 11.2%;
20
+ --primary-foreground: 210 40% 98%;
21
+
22
+ --secondary: 210 40% 96.1%;
23
+ --secondary-foreground: 222.2 47.4% 11.2%;
24
+
25
+ --accent: 210 40% 96.1%;
26
+ --accent-foreground: 222.2 47.4% 11.2%;
27
+
28
+ --destructive: 0 100% 50%;
29
+ --destructive-foreground: 210 40% 98%;
30
+
31
+ --success: 132, 95.3%, 33.3%, 0.74;
32
+ --success-foreground: 109 55% 28%;
33
+
34
+ --info: 223 78% 42%;
35
+ --info-foreground: 225 100% 50%;
36
+
37
+ --attention: 45 90% 45%;
38
+ --attention-foreground: 60 98.4% 48.8% 0.82;
39
+
40
+ --ring: 215 20.2% 65.1%;
41
+
42
+ --radius: 0.5rem;
43
+ }
44
+
45
+ .dark {
46
+ --background: 224 71% 4%;
47
+ --foreground: 213 31% 91%;
48
+
49
+ --muted: 223 47% 11%;
50
+ --muted-foreground: 215.4 16.3% 56.9%;
51
+
52
+ --accent: 216 34% 17%;
53
+ --accent-foreground: 210 40% 98%;
54
+
55
+ --popover: 224 71% 4%;
56
+ --popover-foreground: 215 20.2% 65.1%;
57
+
58
+ --border: 216 34% 17%;
59
+ --input: 216 34% 17%;
60
+
61
+ --card: 224 71% 4%;
62
+ --card-foreground: 213 31% 91%;
63
+
64
+ --primary: 210 40% 98%;
65
+ --primary-foreground: 222.2 47.4% 1.2%;
66
+
67
+ --secondary: 222.2 47.4% 11.2%;
68
+ --secondary-foreground: 210 40% 98%;
69
+
70
+ --destructive: 0 63% 31%;
71
+ --destructive-foreground: 210 40% 98%;
72
+
73
+ --attention: 45, 90%, 45%, 0.8;
74
+ --attention-foreground: 60 98.4% 48.8% 0.82;
75
+
76
+ --success: 109 55% 28%;
77
+ --success-foreground: 109 55% 28%;
78
+
79
+ --ring: 216 34% 17%;
80
+
81
+ --radius: 0.5rem;
82
+ }
83
+ }
84
+
85
+ @layer base {
86
+ * {
87
+ @apply border-border;
88
+ }
89
+ body {
90
+ @apply bg-background text-foreground;
91
+ font-feature-settings:
92
+ "rlig" 1,
93
+ "calt" 1;
94
+ }
95
+
96
+ .code-sample {
97
+ @apply max-h-[650px] min-h-[350px] overflow-x-auto rounded-lg border bg-zinc-950 dark:bg-zinc-900;
98
+ }
99
+
100
+ .code-sample pre {
101
+ @apply min-h-[350px];
102
+ }
103
+
104
+ .code-sample span {
105
+ @apply bg-zinc-950;
106
+ }
107
+ }
108
+ input[type="range"] {
109
+ display: inline-block;
110
+ vertical-align: middle;
111
+ font-size: 1em;
112
+ font-family: Arial, sans-serif;
113
+ }
114
+
115
+ /* input[type="range"]:focus,
116
+ input[type="number"]:focus {
117
+ box-shadow: 0 0 3px 1px #4b81dd;
118
+ outline: none;
119
+ } */
120
+
121
+ input[type="range"] {
122
+ -webkit-appearance: none;
123
+ margin-right: 15px;
124
+ width: 200px;
125
+ height: 7px;
126
+ background: #f4f4f5;
127
+ border-radius: 5px;
128
+ background-image: linear-gradient(#000, #000);
129
+ background-repeat: no-repeat;
130
+ }
131
+
132
+ /* Input Thumb */
133
+ input[type="range"]::-webkit-slider-thumb {
134
+ -webkit-appearance: none;
135
+ height: 20px;
136
+ width: 20px;
137
+ border-radius: 50%;
138
+ background: #fff;
139
+ cursor: ew-resize;
140
+ box-shadow: 0 0 2px 0 #000;
141
+ transition: background 0.3s ease-in-out;
142
+ }
143
+
144
+ input[type="range"]::-moz-range-thumb {
145
+ -webkit-appearance: none;
146
+ height: 20px;
147
+ width: 20px;
148
+ border-radius: 50%;
149
+ background: #fff;
150
+ cursor: ew-resize;
151
+ box-shadow: 0 0 2px 0 #000;
152
+ transition: background 0.3s ease-in-out;
153
+ }
154
+
155
+ input[type="range"]::-ms-thumb {
156
+ -webkit-appearance: none;
157
+ height: 20px;
158
+ width: 20px;
159
+ border-radius: 50%;
160
+ background: #fff;
161
+ cursor: ew-resize;
162
+ box-shadow: 0 0 2px 0 #000;
163
+ transition: background 0.3s ease-in-out;
164
+ }
165
+
166
+ /* input[type="range"]::-webkit-slider-thumb:hover {
167
+ background: #a1a1aa;
168
+ }
169
+
170
+ input[type="range"]::-moz-range-thumb:hover {
171
+ background: #a1a1aa;
172
+ }
173
+
174
+ input[type="range"]::-ms-thumb:hover {
175
+ background: #a1a1aa;
176
+ } */
177
+
178
+ input[type="range"]::-moz-range-track {
179
+ -webkit-appearance: none;
180
+ box-shadow: none;
181
+ border: none;
182
+ background: transparent;
183
+ }
184
+
185
+ input[type="range"]::-ms-track {
186
+ -webkit-appearance: none;
187
+ box-shadow: none;
188
+ border: none;
189
+ background: transparent;
190
+ }
191
+
192
+ .st-accordion .st-accordion__icon:before {
193
+ content: "▼";
194
+ display: inline-block;
195
+ margin-right: 5px;
196
+ font-size: 80%;
197
+ text-decoration: none;
198
+ transform: rotate(-90deg);
199
+ }
200
+ .st-accordion .st-accordion__icon--opened:before {
201
+ transform: rotate(0deg);
202
+ }
203
+
204
+ .st-accordion .st-accordion__content:not(.st-accordion__content--visible) {
205
+ height: 0;
206
+ opacity: 0;
207
+ visibility: hidden;
208
+ overflow: hidden;
209
+ transition: all 0.2s;
210
+ }
211
+ .st-accordion .st-accordion__content.st-accordion__content--visible {
212
+ opacity: 1;
213
+ visibility: visible;
214
+ overflow: hidden;
215
+ transition: all 0.2s;
216
+ }
@@ -4,6 +4,7 @@ class DocumentationController < ActionController::Base
4
4
  end
5
5
 
6
6
  def show
7
+ binding.pry
7
8
  render "documentation/#{params[:id]}"
8
9
  end
9
10
  end
@@ -1,5 +1,18 @@
1
1
  module Components::AccordionHelper
2
- def render_accordion(title:, description:)
2
+ def accordion_title(&block)
3
+ content_for :title, capture(&block), flush: true
4
+ end
5
+
6
+ def accordion_description(&block)
7
+ content_for :description, capture(&block), flush: true
8
+ end
9
+
10
+ def render_accordion(title: nil, description: nil, &block)
11
+ if title && !description
12
+ content_for :description, capture(&block), flush: true
13
+ elsif !title && !description
14
+ capture(&block)
15
+ end
3
16
  render "components/ui/accordion", title: title, description: description
4
17
  end
5
18
  end
@@ -1,11 +1,13 @@
1
1
  module Components::AlertHelper
2
- def render_alert(title:, description:, variant: :default)
2
+ def render_alert(title:, description:, 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
+ else
9
+ "border-#{variant}/50 text-#{variant} dark:border-#{variant} [&>svg]:text-#{variant}"
8
10
  end
9
- render "components/ui/alert", title: title, description: description, alert_classes: alert_classes, variant: variant
11
+ render "components/ui/alert", title:, description:, alert_classes:, variant:, icon:
10
12
  end
11
13
  end
@@ -1,5 +1,5 @@
1
1
  module Components::ButtonHelper
2
- def render_button(label = "", data: "", text: "", variant: :default, as: :button, href: nil, **options)
2
+ def render_button(label = "", text: nil, variant: :default, as: :button, href: nil, data: {}, **options, &block)
3
3
  button_classes = " 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 h-10 px-4 py-2 "
4
4
  varianet_classes = case variant.to_sym
5
5
  when :default
@@ -15,6 +15,7 @@ module Components::ButtonHelper
15
15
  end
16
16
  button_classes << " #{varianet_classes} #{options[:class]}"
17
17
  text = label if label.present?
18
+ text = capture(&block) if block
18
19
  render "components/ui/button", text:, button_classes:, as:, href:, data:, **options
19
20
  end
20
21
  end
@@ -1,5 +1,5 @@
1
1
  module Components::CardHelper
2
- def render_card(footer: nil, title: nil, subtitle: nil, body: nil, **options, &block)
2
+ def render_card(title: nil, subtitle: nil, body: nil, footer: nil, **options, &block)
3
3
  render "components/ui/card", title: title, subtitle: subtitle, footer: footer, body: (block ? capture(&block) : body), block:, options: options
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Components::CheckboxHelper
2
- def render_checkbox(label:, name:)
3
- render "components/ui/checkbox", name: name, label: label
2
+ def render_checkbox(label:, name:, **options)
3
+ render "components/ui/checkbox", name: name, label: label, options: options
4
4
  end
5
5
  end
@@ -1,4 +1,12 @@
1
1
  module Components::CollapsibleHelper
2
+ def collapsible_preview(&block)
3
+ content_for :preview, capture(&block) if block
4
+ end
5
+
6
+ def collapsible_body(&block)
7
+ content_for :body, capture(&block) if block
8
+ end
9
+
2
10
  def render_collapsible(**options, &block)
3
11
  content = capture(&block) if block
4
12
  render "components/ui/collapsible", content: content, **options
@@ -17,4 +17,13 @@ module Components::SheetHelper
17
17
  def sheet_content(&block)
18
18
  content_for :sheet_content, capture(&block), flush: true
19
19
  end
20
+
21
+ def direction_class(direction)
22
+ mappings = {
23
+ "left": 'left-0',
24
+ "right": 'right-0'
25
+ }
26
+
27
+ mappings[direction.to_sym]
28
+ end
20
29
  end
@@ -4,4 +4,15 @@ module ComponentsHelper
4
4
  OUTLINE_CLASSES = " border border-input bg-background hover:bg-accent hover:text-accent-foreground "
5
5
  GHOST_CLASSES = " hover:bg-accent hover:text-accent-foreground "
6
6
  DESTRUCTIVE_CLASSES = " bg-destructive text-destructive-foreground hover:bg-destructive/90 "
7
+
8
+ module Button
9
+ PRIMARY = " bg-primary text-primary-foreground hover:bg-primary/80 "
10
+ SECONDARY = " bg-secondary text-secondary-foreground hover:bg-secondary/80 "
11
+ OUTLINE = " border border-input bg-background hover:bg-accent hover:text-accent-foreground "
12
+ GHOST = " hover:bg-accent hover:text-accent-foreground "
13
+ DESTRUCTIVE = " bg-destructive text-destructive-foreground hover:bg-destructive/90 "
14
+ end
15
+
16
+ module Alert
17
+ end
7
18
  end
@@ -24,9 +24,8 @@ module ExamplesHelper
24
24
  end
25
25
 
26
26
  def code_sample(content = "", language:, &block)
27
- content_tag :pre, class: "code-sample px-4 my-2 pb-5", data: {controller: "highlight"} do
27
+ content_tag :pre, class: "code-sample px-4 my-2 pb-5 min-h-fit", data: {controller: "highlight"} do
28
28
  content_tag :code, class: "language-#{language}" do
29
- content
30
29
  yield if block
31
30
  end
32
31
  end
@@ -14,7 +14,7 @@
14
14
  aria-expanded="true"
15
15
  data-orientation="vertical"
16
16
  class="flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180">
17
- <%= title %><svg
17
+ <%= title || content_for(:title) %><svg
18
18
  xmlns="http://www.w3.org/2000/svg"
19
19
  width="24"
20
20
  height="24"
@@ -34,7 +34,7 @@
34
34
  role="region"
35
35
  data-orientation="vertical"
36
36
  class="st-accordion__content overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down">
37
- <div class="pb-4 pt-0"><%= description %></div>
37
+ <div class="pb-4 pt-0"><%= description || content_for(:description) %></div>
38
38
  </div>
39
39
  </div>
40
40
  </div>