ruby_ui 1.0.2 → 1.1.0
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/LICENSE.txt +1 -1
- data/README.md +4 -0
- data/lib/generators/ruby_ui/install/docs_generator.rb +33 -0
- data/lib/ruby_ui/accordion/accordion_docs.rb +53 -0
- data/lib/ruby_ui/alert/alert_docs.rb +135 -0
- data/lib/ruby_ui/alert_dialog/alert_dialog_docs.rb +35 -0
- data/lib/ruby_ui/aspect_ratio/aspect_ratio_docs.rb +64 -0
- data/lib/ruby_ui/avatar/avatar_docs.rb +92 -0
- data/lib/ruby_ui/badge/badge_docs.rb +80 -0
- data/lib/ruby_ui/breadcrumb/breadcrumb_docs.rb +116 -0
- data/lib/ruby_ui/button/button_docs.rb +143 -0
- data/lib/ruby_ui/calendar/calendar_docs.rb +34 -0
- data/lib/ruby_ui/card/card_docs.rb +114 -0
- data/lib/ruby_ui/carousel/carousel_docs.rb +104 -0
- data/lib/ruby_ui/chart/chart_docs.rb +115 -0
- data/lib/ruby_ui/checkbox/checkbox.rb +2 -2
- data/lib/ruby_ui/checkbox/checkbox_docs.rb +41 -0
- data/lib/ruby_ui/clipboard/clipboard_docs.rb +30 -0
- data/lib/ruby_ui/codeblock/codeblock_docs.rb +55 -0
- data/lib/ruby_ui/collapsible/collapsible_docs.rb +96 -0
- data/lib/ruby_ui/combobox/combobox_controller.js +16 -1
- data/lib/ruby_ui/combobox/combobox_docs.rb +151 -0
- data/lib/ruby_ui/combobox/combobox_popover.rb +2 -1
- data/lib/ruby_ui/combobox/combobox_toggle_all_checkbox.rb +3 -2
- data/lib/ruby_ui/combobox/combobox_trigger.rb +1 -1
- data/lib/ruby_ui/command/command_docs.rb +154 -0
- data/lib/ruby_ui/context_menu/context_menu.rb +1 -1
- data/lib/ruby_ui/context_menu/context_menu_docs.rb +85 -0
- data/lib/ruby_ui/dialog/dialog_docs.rb +102 -0
- data/lib/ruby_ui/docs/base.rb +90 -0
- data/lib/ruby_ui/docs/component_setup_tabs.rb +15 -0
- data/lib/ruby_ui/docs/components_table.rb +13 -0
- data/lib/ruby_ui/docs/header.rb +17 -0
- data/lib/ruby_ui/docs/sidebar_examples.rb +22 -0
- data/lib/ruby_ui/docs/visual_code_example.rb +22 -0
- data/lib/ruby_ui/dropdown_menu/dropdown_menu_docs.rb +212 -0
- data/lib/ruby_ui/form/form_docs.rb +178 -0
- data/lib/ruby_ui/form/form_field.rb +1 -1
- data/lib/ruby_ui/form/form_field_error.rb +1 -1
- data/lib/ruby_ui/form/form_field_hint.rb +1 -1
- data/lib/ruby_ui/form/form_field_label.rb +1 -1
- data/lib/ruby_ui/hover_card/hover_card_docs.rb +71 -0
- data/lib/ruby_ui/input/input.rb +4 -3
- data/lib/ruby_ui/input/input_docs.rb +68 -0
- data/lib/ruby_ui/link/link_docs.rb +106 -0
- data/lib/ruby_ui/masked_input/masked_input_docs.rb +47 -0
- data/lib/ruby_ui/pagination/pagination_docs.rb +127 -0
- data/lib/ruby_ui/popover/popover_docs.rb +971 -0
- data/lib/ruby_ui/progress/progress_docs.rb +27 -0
- data/lib/ruby_ui/radio_button/radio_button.rb +1 -1
- data/lib/ruby_ui/radio_button/radio_button_docs.rb +53 -0
- data/lib/ruby_ui/select/select_docs.rb +129 -0
- data/lib/ruby_ui/separator/separator_docs.rb +36 -0
- data/lib/ruby_ui/sheet/sheet_content.rb +1 -1
- data/lib/ruby_ui/sheet/sheet_docs.rb +76 -0
- data/lib/ruby_ui/shortcut_key/shortcut_key_docs.rb +29 -0
- data/lib/ruby_ui/sidebar/sidebar_docs.rb +176 -0
- data/lib/ruby_ui/skeleton/skeleton_docs.rb +29 -0
- data/lib/ruby_ui/switch/switch_docs.rb +46 -0
- data/lib/ruby_ui/table/table_docs.rb +102 -0
- data/lib/ruby_ui/tabs/tabs_docs.rb +211 -0
- data/lib/ruby_ui/textarea/textarea_docs.rb +54 -0
- data/lib/ruby_ui/theme_toggle/theme_toggle_docs.rb +71 -0
- data/lib/ruby_ui/tooltip/tooltip_docs.rb +52 -0
- data/lib/ruby_ui/typography/typography_docs.rb +107 -0
- data/lib/ruby_ui.rb +1 -1
- metadata +53 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ae8ccd52ccc249a9a1a409facc1883da7f87170bc5f70a0df32755e2fc5e5577
|
|
4
|
+
data.tar.gz: df99edbcb78e881e98a114c58b1e0e771180d40acc0677ab182c50e29487d33d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9509f7c13c94b9f1b4767cc194e7eaeecda6ffd8eeb872c97693e7cf9ac875dbefa1457edc882df7e2ac093facf77ff856f1af3191549a7f37be8d901cb00ec6
|
|
7
|
+
data.tar.gz: 44f479fb9b95d79318e358dc4b2864a5b13cc51d1ddd958a199cd6c184ed190de8d93a07e07d416ca2d5c89e23094f1b158c187048b3030d17eadca9b23eb065
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -87,4 +87,8 @@ Licensed under the [MIT license](https://github.com/shadcn/ui/blob/main/LICENSE.
|
|
|
87
87
|
|
|
88
88
|
---
|
|
89
89
|
|
|
90
|
+
## Sponsors
|
|
91
|
+
[](https://www.digitalocean.com/?refcode=0fdaefc76c39&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge)
|
|
92
|
+
|
|
93
|
+
|
|
90
94
|
© 2024 RubyUI. All rights reserved. 🔒
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails/generators"
|
|
4
|
+
|
|
5
|
+
module RubyUI
|
|
6
|
+
module Generators
|
|
7
|
+
module Install
|
|
8
|
+
class DocsGenerator < Rails::Generators::Base
|
|
9
|
+
namespace "ruby_ui:install:docs"
|
|
10
|
+
source_root File.expand_path("../../../ruby_ui", __dir__)
|
|
11
|
+
class_option :force, type: :boolean, default: false
|
|
12
|
+
|
|
13
|
+
def copy_docs_files
|
|
14
|
+
say "Installing RubyUI documentation files..."
|
|
15
|
+
|
|
16
|
+
docs_file_paths.each do |source_path|
|
|
17
|
+
dest_filename = File.basename(source_path).sub("_docs", "")
|
|
18
|
+
copy_file source_path, Rails.root.join("app/views/docs", dest_filename), force: options["force"]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
say ""
|
|
22
|
+
say "Documentation installed to app/views/docs/", :green
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def docs_file_paths
|
|
28
|
+
Dir.glob(File.join(self.class.source_root, "*", "*_docs.rb"))
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Accordion < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
6
|
+
component = "Accordion"
|
|
7
|
+
render Docs::Header.new(title: component,
|
|
8
|
+
description: "A vertically stacked set of interactive headings that each reveal a section of content.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
render Docs::VisualCodeExample.new(title: "Example", context: self) do
|
|
13
|
+
@@code = <<~RUBY
|
|
14
|
+
div(class: "w-full") do
|
|
15
|
+
Accordion do
|
|
16
|
+
AccordionItem do
|
|
17
|
+
AccordionTrigger do
|
|
18
|
+
p(class: "font-medium") { "What is PhlexUI?" }
|
|
19
|
+
AccordionIcon()
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
AccordionContent do
|
|
23
|
+
p(class: "text-sm pb-4") do
|
|
24
|
+
"PhlexUI is a UI component library for Ruby devs who want to build better, faster."
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
Accordion do
|
|
31
|
+
AccordionItem do
|
|
32
|
+
AccordionTrigger do
|
|
33
|
+
p(class: "font-medium") { "Can I use it with Rails?" }
|
|
34
|
+
AccordionIcon()
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
AccordionContent do
|
|
38
|
+
p(class: "text-sm pb-4") do
|
|
39
|
+
"Yes, PhlexUI is pure Ruby and works great with Rails. It's a Ruby gem that you can install into your Rails app."
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
RUBY
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
49
|
+
|
|
50
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Alert < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "Alert"
|
|
6
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
7
|
+
render Docs::Header.new(title: "Alert", description: "Displays a callout for user attention.")
|
|
8
|
+
|
|
9
|
+
Heading(level: 2) { "Usage" }
|
|
10
|
+
|
|
11
|
+
render Docs::VisualCodeExample.new(title: "Example", context: self) do
|
|
12
|
+
<<~RUBY
|
|
13
|
+
Alert do
|
|
14
|
+
rocket_icon
|
|
15
|
+
AlertTitle { "Pro tip" }
|
|
16
|
+
AlertDescription { "With RubyUI you'll ship faster." }
|
|
17
|
+
end
|
|
18
|
+
RUBY
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
render Docs::VisualCodeExample.new(title: "Without Icon", context: self) do
|
|
22
|
+
<<~RUBY
|
|
23
|
+
Alert do
|
|
24
|
+
AlertTitle { "Pro tip" }
|
|
25
|
+
AlertDescription { "Simply, don't include an icon and your alert will look like this." }
|
|
26
|
+
end
|
|
27
|
+
RUBY
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
render Docs::VisualCodeExample.new(title: "Warning", context: self) do
|
|
31
|
+
<<~RUBY
|
|
32
|
+
Alert(variant: :warning) do
|
|
33
|
+
info_icon
|
|
34
|
+
AlertTitle { "Ship often" }
|
|
35
|
+
AlertDescription { "Shipping is good, your users will thank you for it." }
|
|
36
|
+
end
|
|
37
|
+
RUBY
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
render Docs::VisualCodeExample.new(title: "Destructive", context: self) do
|
|
41
|
+
<<~RUBY
|
|
42
|
+
Alert(variant: :destructive) do
|
|
43
|
+
alert_icon
|
|
44
|
+
AlertTitle { "Oopsie daisy!" }
|
|
45
|
+
AlertDescription { "Your design system is non-existent." }
|
|
46
|
+
end
|
|
47
|
+
RUBY
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
render Docs::VisualCodeExample.new(title: "Success", context: self) do
|
|
51
|
+
<<~RUBY
|
|
52
|
+
Alert(variant: :success) do
|
|
53
|
+
check_icon
|
|
54
|
+
AlertTitle { "Installation successful" }
|
|
55
|
+
AlertDescription { "You're all set to start using RubyUI in your application." }
|
|
56
|
+
end
|
|
57
|
+
RUBY
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
61
|
+
|
|
62
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
private
|
|
67
|
+
|
|
68
|
+
def rocket_icon
|
|
69
|
+
svg(
|
|
70
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
71
|
+
viewbox: "0 0 24 24",
|
|
72
|
+
fill: "currentColor",
|
|
73
|
+
class: "w-5 h-5"
|
|
74
|
+
) do |s|
|
|
75
|
+
s.path(
|
|
76
|
+
fill_rule: "evenodd",
|
|
77
|
+
d:
|
|
78
|
+
"M9.315 7.584C12.195 3.883 16.695 1.5 21.75 1.5a.75.75 0 01.75.75c0 5.056-2.383 9.555-6.084 12.436A6.75 6.75 0 019.75 22.5a.75.75 0 01-.75-.75v-4.131A15.838 15.838 0 016.382 15H2.25a.75.75 0 01-.75-.75 6.75 6.75 0 017.815-6.666zM15 6.75a2.25 2.25 0 100 4.5 2.25 2.25 0 000-4.5z",
|
|
79
|
+
clip_rule: "evenodd"
|
|
80
|
+
)
|
|
81
|
+
s.path(
|
|
82
|
+
d:
|
|
83
|
+
"M5.26 17.242a.75.75 0 10-.897-1.203 5.243 5.243 0 00-2.05 5.022.75.75 0 00.625.627 5.243 5.243 0 005.022-2.051.75.75 0 10-1.202-.897 3.744 3.744 0 01-3.008 1.51c0-1.23.592-2.323 1.51-3.008z"
|
|
84
|
+
)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def alert_icon
|
|
89
|
+
svg(
|
|
90
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
91
|
+
viewbox: "0 0 24 24",
|
|
92
|
+
fill: "currentColor",
|
|
93
|
+
class: "w-5 h-5"
|
|
94
|
+
) do |s|
|
|
95
|
+
s.path(
|
|
96
|
+
fill_rule: "evenodd",
|
|
97
|
+
d:
|
|
98
|
+
"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
|
|
99
|
+
clip_rule: "evenodd"
|
|
100
|
+
)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def info_icon
|
|
105
|
+
svg(
|
|
106
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
107
|
+
viewbox: "0 0 24 24",
|
|
108
|
+
fill: "currentColor",
|
|
109
|
+
class: "w-5 h-5"
|
|
110
|
+
) do |s|
|
|
111
|
+
s.path(
|
|
112
|
+
fill_rule: "evenodd",
|
|
113
|
+
d:
|
|
114
|
+
"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 01.67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 11-.671-1.34l.041-.022zM12 9a.75.75 0 100-1.5.75.75 0 000 1.5z",
|
|
115
|
+
clip_rule: "evenodd"
|
|
116
|
+
)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def check_icon
|
|
121
|
+
svg(
|
|
122
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
123
|
+
viewbox: "0 0 24 24",
|
|
124
|
+
fill: "currentColor",
|
|
125
|
+
class: "w-5 h-5"
|
|
126
|
+
) do |s|
|
|
127
|
+
s.path(
|
|
128
|
+
fill_rule: "evenodd",
|
|
129
|
+
d:
|
|
130
|
+
"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z",
|
|
131
|
+
clip_rule: "evenodd"
|
|
132
|
+
)
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::AlertDialog < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "AlertDialog"
|
|
6
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
7
|
+
render Docs::Header.new(title: "Alert Dialog", description: "A modal dialog that interrupts the user with important content and expects a response.")
|
|
8
|
+
|
|
9
|
+
Heading(level: 2) { "Usage" }
|
|
10
|
+
render Docs::VisualCodeExample.new(title: "Example", context: self) do
|
|
11
|
+
<<~RUBY
|
|
12
|
+
AlertDialog do
|
|
13
|
+
AlertDialogTrigger do
|
|
14
|
+
Button { "Show dialog" }
|
|
15
|
+
end
|
|
16
|
+
AlertDialogContent do
|
|
17
|
+
AlertDialogHeader do
|
|
18
|
+
AlertDialogTitle { "Are you absolutely sure?" }
|
|
19
|
+
AlertDialogDescription { "This action cannot be undone. This will permanently delete your account and remove your data from our servers." }
|
|
20
|
+
end
|
|
21
|
+
AlertDialogFooter do
|
|
22
|
+
AlertDialogCancel { "Cancel" }
|
|
23
|
+
AlertDialogAction { "Continue" } # Will probably be a link to a controller action (e.g. delete account)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
RUBY
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
31
|
+
|
|
32
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::AspectRatio < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "AspectRatio"
|
|
6
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
7
|
+
render Docs::Header.new(title: "Aspect Ratio", description: "Displays content within a desired ratio.")
|
|
8
|
+
|
|
9
|
+
Heading(level: 2) { "Usage" }
|
|
10
|
+
|
|
11
|
+
render Docs::VisualCodeExample.new(title: "16/9", context: self) do
|
|
12
|
+
<<~RUBY
|
|
13
|
+
AspectRatio(aspect_ratio: "16/9", class: "rounded-md overflow-hidden border shadow-sm") do
|
|
14
|
+
img(
|
|
15
|
+
alt: "Placeholder",
|
|
16
|
+
loading: "lazy",
|
|
17
|
+
src: image_path('pattern.jpg')
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
RUBY
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
render Docs::VisualCodeExample.new(title: "4/3", context: self) do
|
|
24
|
+
<<~RUBY
|
|
25
|
+
AspectRatio(aspect_ratio: "4/3", class: "rounded-md overflow-hidden border shadow-sm") do
|
|
26
|
+
img(
|
|
27
|
+
alt: "Placeholder",
|
|
28
|
+
loading: "lazy",
|
|
29
|
+
src: image_path('pattern.jpg')
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
RUBY
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
render Docs::VisualCodeExample.new(title: "1/1", context: self) do
|
|
36
|
+
<<~RUBY
|
|
37
|
+
AspectRatio(aspect_ratio: "1/1", class: "rounded-md overflow-hidden border shadow-sm") do
|
|
38
|
+
img(
|
|
39
|
+
alt: "Placeholder",
|
|
40
|
+
loading: "lazy",
|
|
41
|
+
src: image_path('pattern.jpg')
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
RUBY
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
render Docs::VisualCodeExample.new(title: "21/9", context: self) do
|
|
48
|
+
<<~RUBY
|
|
49
|
+
AspectRatio(aspect_ratio: "21/9", class: "rounded-md overflow-hidden border shadow-sm") do
|
|
50
|
+
img(
|
|
51
|
+
alt: "Placeholder",
|
|
52
|
+
loading: "lazy",
|
|
53
|
+
src: image_path('pattern.jpg')
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
RUBY
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
60
|
+
|
|
61
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Avatar < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "Avatar"
|
|
6
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
7
|
+
render Docs::Header.new(title: "Avatar", description: "An image element with a fallback for representing the user.")
|
|
8
|
+
|
|
9
|
+
Heading(level: 2) { "Usage" }
|
|
10
|
+
|
|
11
|
+
render Docs::VisualCodeExample.new(title: "Image & fallback", context: self) do
|
|
12
|
+
<<~RUBY
|
|
13
|
+
Avatar do
|
|
14
|
+
AvatarImage(src: "https://avatars.githubusercontent.com/u/246692?v=4", alt: "joeldrapper")
|
|
15
|
+
AvatarFallback { "JD" }
|
|
16
|
+
end
|
|
17
|
+
RUBY
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
render Docs::VisualCodeExample.new(title: "Only fallback", context: self) do
|
|
21
|
+
<<~RUBY
|
|
22
|
+
Avatar do
|
|
23
|
+
AvatarFallback { "JD" }
|
|
24
|
+
end
|
|
25
|
+
RUBY
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
render Docs::VisualCodeExample.new(title: "Sizes", context: self) do
|
|
29
|
+
<<~RUBY
|
|
30
|
+
div(class: 'flex items-center space-x-2') do
|
|
31
|
+
# size: :xs
|
|
32
|
+
Avatar(size: :xs) do
|
|
33
|
+
AvatarImage(src: "https://avatars.githubusercontent.com/u/246692?v=4", alt: "joeldrapper")
|
|
34
|
+
AvatarFallback { "JD" }
|
|
35
|
+
end
|
|
36
|
+
# size: :sm
|
|
37
|
+
Avatar(size: :sm) do
|
|
38
|
+
AvatarImage(src: "https://avatars.githubusercontent.com/u/246692?v=4", alt: "joeldrapper")
|
|
39
|
+
AvatarFallback { "JD" }
|
|
40
|
+
end
|
|
41
|
+
# size: :md
|
|
42
|
+
Avatar(size: :md) do
|
|
43
|
+
AvatarImage(src: "https://avatars.githubusercontent.com/u/246692?v=4", alt: "joeldrapper")
|
|
44
|
+
AvatarFallback { "JD" }
|
|
45
|
+
end
|
|
46
|
+
# size: :lg
|
|
47
|
+
Avatar(size: :lg) do
|
|
48
|
+
AvatarImage(src: "https://avatars.githubusercontent.com/u/246692?v=4", alt: "joeldrapper")
|
|
49
|
+
AvatarFallback { "JD" }
|
|
50
|
+
end
|
|
51
|
+
# size: :xl
|
|
52
|
+
Avatar(size: :xl) do
|
|
53
|
+
AvatarImage(src: "https://avatars.githubusercontent.com/u/246692?v=4", alt: "joeldrapper")
|
|
54
|
+
AvatarFallback { "JD" }
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
RUBY
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
render Docs::VisualCodeExample.new(title: "Sizes (only fallback)", context: self) do
|
|
61
|
+
@@code = <<~RUBY
|
|
62
|
+
div(class: 'flex items-center space-x-2') do
|
|
63
|
+
# size: :xs
|
|
64
|
+
Avatar(size: :xs) do
|
|
65
|
+
AvatarFallback { "JD" }
|
|
66
|
+
end
|
|
67
|
+
# size: :sm
|
|
68
|
+
Avatar(size: :sm) do
|
|
69
|
+
AvatarFallback { "JD" }
|
|
70
|
+
end
|
|
71
|
+
# size: :md
|
|
72
|
+
Avatar(size: :md) do
|
|
73
|
+
AvatarFallback { "JD" }
|
|
74
|
+
end
|
|
75
|
+
# size: :lg
|
|
76
|
+
Avatar(size: :lg) do
|
|
77
|
+
AvatarFallback { "JD" }
|
|
78
|
+
end
|
|
79
|
+
# size: :xl
|
|
80
|
+
Avatar(size: :xl) do
|
|
81
|
+
AvatarFallback { "JD" }
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
RUBY
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
88
|
+
|
|
89
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Badge < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "Badge"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Badge", description: "Displays a badge or a component that looks like a badge.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
render Docs::VisualCodeExample.new(title: "Default", context: self) do
|
|
13
|
+
<<~RUBY
|
|
14
|
+
Badge { "Badge" }
|
|
15
|
+
RUBY
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
render Docs::VisualCodeExample.new(title: "Primary", context: self) do
|
|
19
|
+
<<~RUBY
|
|
20
|
+
Badge(variant: :primary) { 'Primary' }
|
|
21
|
+
RUBY
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
render Docs::VisualCodeExample.new(title: "Outline", context: self) do
|
|
25
|
+
<<~RUBY
|
|
26
|
+
Badge(variant: :outline) { 'Outline' }
|
|
27
|
+
RUBY
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
render Docs::VisualCodeExample.new(title: "Variants", context: self) do
|
|
31
|
+
<<~RUBY
|
|
32
|
+
div(class: 'flex flex-wrap gap-2 justify-center') do
|
|
33
|
+
Badge(variant: :destructive) { 'Destructive' }
|
|
34
|
+
Badge(variant: :warning) { 'Warning' }
|
|
35
|
+
Badge(variant: :success) { 'Success' }
|
|
36
|
+
end
|
|
37
|
+
RUBY
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
render Docs::VisualCodeExample.new(title: "Other Colors", context: self) do
|
|
41
|
+
<<~RUBY
|
|
42
|
+
div(class: 'flex flex-wrap gap-2 justify-center') do
|
|
43
|
+
Badge(variant: :red) { 'Red' }
|
|
44
|
+
Badge(variant: :orange) { 'Orange' }
|
|
45
|
+
Badge(variant: :amber) { 'Amber' }
|
|
46
|
+
Badge(variant: :yellow) { 'Yellow' }
|
|
47
|
+
Badge(variant: :lime) { 'Lime' }
|
|
48
|
+
Badge(variant: :green) { 'Green' }
|
|
49
|
+
Badge(variant: :emerald) { 'Emerald' }
|
|
50
|
+
Badge(variant: :teal) { 'Teal' }
|
|
51
|
+
Badge(variant: :cyan) { 'Cyan' }
|
|
52
|
+
Badge(variant: :sky) { 'Sky' }
|
|
53
|
+
Badge(variant: :blue) { 'Blue' }
|
|
54
|
+
Badge(variant: :indigo) { 'Indigo' }
|
|
55
|
+
Badge(variant: :violet) { 'Violet' }
|
|
56
|
+
Badge(variant: :purple) { 'Purple' }
|
|
57
|
+
Badge(variant: :fuchsia) { 'Fuchsia' }
|
|
58
|
+
Badge(variant: :pink) { 'Pink' }
|
|
59
|
+
Badge(variant: :rose) { 'Rose' }
|
|
60
|
+
end
|
|
61
|
+
RUBY
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
render Docs::VisualCodeExample.new(title: "Sizes", context: self) do
|
|
65
|
+
<<~RUBY
|
|
66
|
+
div(class: 'flex flex-wrap gap-2 justify-center items-center') do
|
|
67
|
+
Badge(size: :sm) { "Small" }
|
|
68
|
+
Badge(size: :md) { "Medium" }
|
|
69
|
+
Badge(size: :lg) { "Large" }
|
|
70
|
+
end
|
|
71
|
+
RUBY
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
75
|
+
|
|
76
|
+
# components
|
|
77
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Breadcrumb < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "Breadcrumb"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Breadcrumb", description: "Indicates the user's current location within a navigational hierarchy.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
render Docs::VisualCodeExample.new(title: "Example", context: self) do
|
|
13
|
+
<<~RUBY
|
|
14
|
+
Breadcrumb do
|
|
15
|
+
BreadcrumbList do
|
|
16
|
+
BreadcrumbItem do
|
|
17
|
+
BreadcrumbLink(href: "/") { "Home" }
|
|
18
|
+
end
|
|
19
|
+
BreadcrumbSeparator()
|
|
20
|
+
BreadcrumbItem do
|
|
21
|
+
BreadcrumbLink(href: "/docs/accordion") { "Components" }
|
|
22
|
+
end
|
|
23
|
+
BreadcrumbSeparator()
|
|
24
|
+
BreadcrumbItem do
|
|
25
|
+
BreadcrumbPage { "Breadcrumb" }
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
RUBY
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
render Docs::VisualCodeExample.new(title: "With custom separator", context: self) do
|
|
33
|
+
<<~RUBY
|
|
34
|
+
Breadcrumb do
|
|
35
|
+
BreadcrumbList do
|
|
36
|
+
BreadcrumbItem do
|
|
37
|
+
BreadcrumbLink(href: "/") { "Home" }
|
|
38
|
+
end
|
|
39
|
+
BreadcrumbSeparator { slash_icon }
|
|
40
|
+
BreadcrumbItem do
|
|
41
|
+
BreadcrumbLink(href: "/docs/accordion") { "Components" }
|
|
42
|
+
end
|
|
43
|
+
BreadcrumbSeparator { slash_icon }
|
|
44
|
+
BreadcrumbItem do
|
|
45
|
+
BreadcrumbPage { "Breadcrumb" }
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
RUBY
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
render Docs::VisualCodeExample.new(title: "Collapsed", context: self) do
|
|
53
|
+
<<~RUBY
|
|
54
|
+
Breadcrumb do
|
|
55
|
+
BreadcrumbList do
|
|
56
|
+
BreadcrumbItem do
|
|
57
|
+
BreadcrumbLink(href: "/") { "Home" }
|
|
58
|
+
end
|
|
59
|
+
BreadcrumbSeparator()
|
|
60
|
+
BreadcrumbItem do
|
|
61
|
+
BreadcrumbEllipsis()
|
|
62
|
+
end
|
|
63
|
+
BreadcrumbSeparator()
|
|
64
|
+
BreadcrumbItem do
|
|
65
|
+
BreadcrumbLink(href: "/docs/accordion") { "Components" }
|
|
66
|
+
end
|
|
67
|
+
BreadcrumbSeparator()
|
|
68
|
+
BreadcrumbItem do
|
|
69
|
+
BreadcrumbPage { "Breadcrumb" }
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
RUBY
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
render Docs::VisualCodeExample.new(title: "With Link component", context: self) do
|
|
77
|
+
<<~RUBY
|
|
78
|
+
Breadcrumb do
|
|
79
|
+
BreadcrumbList do
|
|
80
|
+
BreadcrumbItem do
|
|
81
|
+
BreadcrumbLink(href: "/") { "Home" }
|
|
82
|
+
end
|
|
83
|
+
BreadcrumbSeparator()
|
|
84
|
+
BreadcrumbItem do
|
|
85
|
+
Link(href: "/docs/accordion", class: "px-0") { "Components" }
|
|
86
|
+
end
|
|
87
|
+
BreadcrumbSeparator()
|
|
88
|
+
BreadcrumbItem do
|
|
89
|
+
BreadcrumbPage { "Breadcrumb" }
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
RUBY
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
97
|
+
|
|
98
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
private
|
|
103
|
+
|
|
104
|
+
def slash_icon
|
|
105
|
+
svg(
|
|
106
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
107
|
+
class: "w-4 h-4",
|
|
108
|
+
viewbox: "0 0 24 24",
|
|
109
|
+
fill: "none",
|
|
110
|
+
stroke: "currentColor",
|
|
111
|
+
stroke_width: "2",
|
|
112
|
+
stroke_linecap: "round",
|
|
113
|
+
stroke_linejoin: "round"
|
|
114
|
+
) { |s| s.path(d: "M22 2 2 22") }
|
|
115
|
+
end
|
|
116
|
+
end
|