ruby_ui 1.0.1 → 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 +6 -0
- data/lib/generators/ruby_ui/component/all_generator.rb +22 -0
- data/lib/generators/ruby_ui/component_generator.rb +4 -3
- data/lib/generators/ruby_ui/install/docs_generator.rb +33 -0
- data/lib/generators/ruby_ui/install/install_generator.rb +1 -7
- data/lib/generators/ruby_ui/install/templates/tailwind.css.erb +0 -3
- data/lib/generators/ruby_ui/javascript_utils.rb +4 -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_content.rb +2 -3
- 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.rb +32 -16
- 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 +7 -1
- 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.rb +3 -2
- data/lib/ruby_ui/combobox/combobox_checkbox.rb +4 -2
- data/lib/ruby_ui/combobox/combobox_controller.js +20 -5
- data/lib/ruby_ui/combobox/combobox_docs.rb +151 -0
- data/lib/ruby_ui/combobox/combobox_item.rb +2 -1
- data/lib/ruby_ui/combobox/combobox_popover.rb +2 -1
- data/lib/ruby_ui/combobox/combobox_radio.rb +8 -1
- data/lib/ruby_ui/combobox/combobox_search_input.rb +11 -5
- data/lib/ruby_ui/combobox/combobox_toggle_all_checkbox.rb +4 -2
- data/lib/ruby_ui/combobox/combobox_trigger.rb +8 -2
- data/lib/ruby_ui/command/command_controller.js +0 -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_content.rb +2 -3
- data/lib/ruby_ui/dialog/dialog_controller.js +1 -1
- 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.rb +9 -0
- data/lib/ruby_ui/dropdown_menu/dropdown_menu_content.rb +17 -2
- data/lib/ruby_ui/dropdown_menu/dropdown_menu_controller.js +43 -14
- 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 +7 -1
- data/lib/ruby_ui/hover_card/hover_card_docs.rb +71 -0
- data/lib/ruby_ui/input/input.rb +9 -1
- data/lib/ruby_ui/input/input_docs.rb +68 -0
- data/lib/ruby_ui/link/link.rb +32 -16
- 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 +3 -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/select/select_item.rb +14 -5
- data/lib/ruby_ui/select/select_trigger.rb +9 -4
- 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/collapsible_sidebar.rb +99 -0
- data/lib/ruby_ui/sidebar/mobile_sidebar.rb +45 -0
- data/lib/ruby_ui/sidebar/non_collapsible_sidebar.rb +17 -0
- data/lib/ruby_ui/sidebar/sidebar.rb +29 -0
- data/lib/ruby_ui/sidebar/sidebar_content.rb +20 -0
- data/lib/ruby_ui/sidebar/sidebar_controller.js +67 -0
- data/lib/ruby_ui/sidebar/sidebar_docs.rb +176 -0
- data/lib/ruby_ui/sidebar/sidebar_footer.rb +20 -0
- data/lib/ruby_ui/sidebar/sidebar_group.rb +20 -0
- data/lib/ruby_ui/sidebar/sidebar_group_action.rb +33 -0
- data/lib/ruby_ui/sidebar/sidebar_group_content.rb +20 -0
- data/lib/ruby_ui/sidebar/sidebar_group_label.rb +26 -0
- data/lib/ruby_ui/sidebar/sidebar_header.rb +20 -0
- data/lib/ruby_ui/sidebar/sidebar_input.rb +20 -0
- data/lib/ruby_ui/sidebar/sidebar_inset.rb +23 -0
- data/lib/ruby_ui/sidebar/sidebar_menu.rb +20 -0
- data/lib/ruby_ui/sidebar/sidebar_menu_action.rb +48 -0
- data/lib/ruby_ui/sidebar/sidebar_menu_badge.rb +30 -0
- data/lib/ruby_ui/sidebar/sidebar_menu_button.rb +63 -0
- data/lib/ruby_ui/sidebar/sidebar_menu_item.rb +20 -0
- data/lib/ruby_ui/sidebar/sidebar_menu_skeleton.rb +36 -0
- data/lib/ruby_ui/sidebar/sidebar_menu_sub.rb +24 -0
- data/lib/ruby_ui/sidebar/sidebar_menu_sub_button.rb +50 -0
- data/lib/ruby_ui/sidebar/sidebar_menu_sub_item.rb +9 -0
- data/lib/ruby_ui/sidebar/sidebar_rail.rb +36 -0
- data/lib/ruby_ui/sidebar/sidebar_separator.rb +20 -0
- data/lib/ruby_ui/sidebar/sidebar_trigger.rb +42 -0
- data/lib/ruby_ui/sidebar/sidebar_wrapper.rb +24 -0
- data/lib/ruby_ui/skeleton/skeleton_docs.rb +29 -0
- data/lib/ruby_ui/switch/switch.rb +12 -2
- data/lib/ruby_ui/switch/switch_docs.rb +46 -0
- data/lib/ruby_ui/table/table_docs.rb +102 -0
- data/lib/ruby_ui/table/table_footer.rb +1 -1
- data/lib/ruby_ui/table/table_row.rb +1 -1
- data/lib/ruby_ui/tabs/tabs_docs.rb +211 -0
- data/lib/ruby_ui/tabs/tabs_trigger.rb +7 -1
- data/lib/ruby_ui/textarea/textarea.rb +8 -1
- 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_controller.js +5 -4
- 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 +81 -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
|
@@ -55,6 +55,8 @@ You can generate your components using `ruby_ui:component` generator.
|
|
|
55
55
|
bin/rails g ruby_ui:component Accordion
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
You also can generate all components using `ruby_ui:component:all` generator
|
|
59
|
+
|
|
58
60
|
## Documentation 📖
|
|
59
61
|
|
|
60
62
|
Visit https://rubyui.com/docs/introduction to view the full documentation, including:
|
|
@@ -85,4 +87,8 @@ Licensed under the [MIT license](https://github.com/shadcn/ui/blob/main/LICENSE.
|
|
|
85
87
|
|
|
86
88
|
---
|
|
87
89
|
|
|
90
|
+
## Sponsors
|
|
91
|
+
[](https://www.digitalocean.com/?refcode=0fdaefc76c39&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge)
|
|
92
|
+
|
|
93
|
+
|
|
88
94
|
© 2024 RubyUI. All rights reserved. 🔒
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module RubyUI
|
|
2
|
+
module Generators
|
|
3
|
+
module Component
|
|
4
|
+
class AllGenerator < Rails::Generators::Base
|
|
5
|
+
namespace "ruby_ui:component:all"
|
|
6
|
+
|
|
7
|
+
source_root File.expand_path("../../../ruby_ui", __dir__)
|
|
8
|
+
class_option :force, type: :boolean, default: false
|
|
9
|
+
|
|
10
|
+
def generate_components
|
|
11
|
+
say "Generating all components..."
|
|
12
|
+
|
|
13
|
+
Dir.children(self.class.source_root).each do |folder_name|
|
|
14
|
+
next if folder_name.ends_with?(".rb")
|
|
15
|
+
|
|
16
|
+
run "bin/rails generate ruby_ui:component #{folder_name} --force #{options["force"]}"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -8,6 +8,7 @@ module RubyUI
|
|
|
8
8
|
|
|
9
9
|
source_root File.expand_path("../../ruby_ui", __dir__)
|
|
10
10
|
argument :component_name, type: :string, required: true
|
|
11
|
+
class_option :force, type: :boolean, default: false
|
|
11
12
|
|
|
12
13
|
def generate_component
|
|
13
14
|
if component_not_found?
|
|
@@ -23,7 +24,7 @@ module RubyUI
|
|
|
23
24
|
|
|
24
25
|
components_file_paths.each do |file_path|
|
|
25
26
|
component_file_name = file_path.split("/").last
|
|
26
|
-
copy_file file_path, Rails.root.join("app/components/ruby_ui", component_folder_name, component_file_name)
|
|
27
|
+
copy_file file_path, Rails.root.join("app/components/ruby_ui", component_folder_name, component_file_name), force: options["force"]
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
|
|
@@ -34,7 +35,7 @@ module RubyUI
|
|
|
34
35
|
|
|
35
36
|
js_controller_file_paths.each do |file_path|
|
|
36
37
|
controller_file_name = file_path.split("/").last
|
|
37
|
-
copy_file file_path, Rails.root.join("app/javascript/controllers/ruby_ui", controller_file_name)
|
|
38
|
+
copy_file file_path, Rails.root.join("app/javascript/controllers/ruby_ui", controller_file_name), force: options["force"]
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
# Importmap doesn't have controller manifest, instead it uses `eagerLoadControllersFrom("controllers", application)`
|
|
@@ -68,7 +69,7 @@ module RubyUI
|
|
|
68
69
|
|
|
69
70
|
def install_components_dependencies(components)
|
|
70
71
|
components&.each do |component|
|
|
71
|
-
run "bin/rails generate ruby_ui:component #{component}"
|
|
72
|
+
run "bin/rails generate ruby_ui:component #{component} --force #{options["force"]}"
|
|
72
73
|
end
|
|
73
74
|
end
|
|
74
75
|
|
|
@@ -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
|
|
@@ -42,7 +42,7 @@ module RubyUI
|
|
|
42
42
|
|
|
43
43
|
def add_ruby_ui_module_to_components_base
|
|
44
44
|
say "Adding RubyUI Kit to Components::Base"
|
|
45
|
-
insert_into_file Rails.root.join("app/components/base.rb"), after: "
|
|
45
|
+
insert_into_file Rails.root.join("app/components/base.rb"), after: "class Components::Base < Phlex::HTML" do
|
|
46
46
|
"\n include RubyUI"
|
|
47
47
|
end
|
|
48
48
|
end
|
|
@@ -62,12 +62,6 @@ module RubyUI
|
|
|
62
62
|
def install_tailwind_plugins
|
|
63
63
|
say "Installing tw-animate-css plugin"
|
|
64
64
|
install_js_package("tw-animate-css")
|
|
65
|
-
|
|
66
|
-
say "Installing @tailwindcss/forms plugin"
|
|
67
|
-
install_js_package("@tailwindcss/forms")
|
|
68
|
-
|
|
69
|
-
say "Installing @tailwindcss/typography plugin"
|
|
70
|
-
install_js_package("@tailwindcss/typography")
|
|
71
65
|
end
|
|
72
66
|
|
|
73
67
|
def add_ruby_ui_base
|
|
@@ -8,6 +8,8 @@ module RubyUI
|
|
|
8
8
|
run "yarn add #{package}"
|
|
9
9
|
elsif using_npm?
|
|
10
10
|
run "npm install #{package}"
|
|
11
|
+
elsif using_pnpm?
|
|
12
|
+
run "pnpm install #{package}"
|
|
11
13
|
else
|
|
12
14
|
say "Could not detect the package manager, you need to install '#{package}' manually", :red
|
|
13
15
|
end
|
|
@@ -30,6 +32,8 @@ module RubyUI
|
|
|
30
32
|
|
|
31
33
|
def using_npm? = File.exist?(Rails.root.join("package-lock.json"))
|
|
32
34
|
|
|
35
|
+
def using_pnpm? = File.exist?(Rails.root.join("pnpm-lock.yaml"))
|
|
36
|
+
|
|
33
37
|
def using_yarn? = File.exist?(Rails.root.join("yarn.lock"))
|
|
34
38
|
|
|
35
39
|
def pin_motion
|
|
@@ -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
|
|
@@ -14,8 +14,7 @@ module RubyUI
|
|
|
14
14
|
def background
|
|
15
15
|
div(
|
|
16
16
|
data_state: "open",
|
|
17
|
-
class:
|
|
18
|
-
"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
17
|
+
class: "fixed inset-0 z-50 bg-black/80 backdrop-blur-sm data-[state=open]:animate-in",
|
|
19
18
|
style: "pointer-events:auto",
|
|
20
19
|
data_aria_hidden: "true",
|
|
21
20
|
aria_hidden: "true"
|
|
@@ -26,7 +25,7 @@ module RubyUI
|
|
|
26
25
|
div(
|
|
27
26
|
role: "alertdialog",
|
|
28
27
|
data_state: "open",
|
|
29
|
-
class: "flex flex-col fixed left-[50%] top-[50%] z-50 w-full max-w-lg max-h-screen overflow-y-auto translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=
|
|
28
|
+
class: "flex flex-col fixed left-[50%] top-[50%] z-50 w-full max-w-lg max-h-screen overflow-y-auto translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:rounded-lg md:w-full",
|
|
30
29
|
style: "pointer-events:auto",
|
|
31
30
|
&
|
|
32
31
|
)
|
|
@@ -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
|