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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Progress < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "Progress"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Progress", description: "Displays an indicator showing the completion progress of a task, typically displayed as a progress bar.")
|
|
9
|
+
|
|
10
|
+
render Docs::VisualCodeExample.new(title: "Example", context: self) do
|
|
11
|
+
<<~RUBY
|
|
12
|
+
Progress(value: 50, class: "w-[60%]")
|
|
13
|
+
RUBY
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
render Docs::VisualCodeExample.new(title: "With custom indicator color", context: self) do
|
|
17
|
+
<<~RUBY
|
|
18
|
+
Progress(value: 35, class: "w-[60%] [&>*]:bg-success")
|
|
19
|
+
RUBY
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
23
|
+
|
|
24
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -18,7 +18,7 @@ module RubyUI
|
|
|
18
18
|
class: [
|
|
19
19
|
"h-4 w-4 p-0 border-primary rounded-full flex-none",
|
|
20
20
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
21
|
-
"checked:bg-primary checked:text-primary-foreground",
|
|
21
|
+
"checked:bg-primary checked:text-primary-foreground dark:checked:bg-secondary checked:text-primary checked:border-primary",
|
|
22
22
|
"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none"
|
|
23
23
|
]
|
|
24
24
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::RadioButton < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "RadioButton"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Radio Button", description: "A control that allows users to make a single selection from a list of options.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
render Docs::VisualCodeExample.new(title: "Example", context: self) do
|
|
13
|
+
<<~RUBY
|
|
14
|
+
div(class: "flex items-center space-x-2") do
|
|
15
|
+
RadioButton(id: "default")
|
|
16
|
+
FormFieldLabel(for: "default") { "Default" }
|
|
17
|
+
end
|
|
18
|
+
RUBY
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
render Docs::VisualCodeExample.new(title: "Checked", context: self) do
|
|
22
|
+
<<~RUBY
|
|
23
|
+
div(class: "flex items-center space-x-2") do
|
|
24
|
+
RadioButton(id: "checked", checked: true)
|
|
25
|
+
FormFieldLabel(for: "checked") { "Checked" }
|
|
26
|
+
end
|
|
27
|
+
RUBY
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
render Docs::VisualCodeExample.new(title: "Disabled", context: self) do
|
|
31
|
+
<<~RUBY
|
|
32
|
+
div(class: "flex flex-row items-center gap-2") do
|
|
33
|
+
RadioButton(class: "peer",id: "disabled", disabled: true)
|
|
34
|
+
FormFieldLabel(for: "disabled") { "Disabled" }
|
|
35
|
+
end
|
|
36
|
+
RUBY
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
render Docs::VisualCodeExample.new(title: "Aria Disabled", context: self) do
|
|
40
|
+
<<~RUBY
|
|
41
|
+
div(class: "flex flex-row items-center gap-2") do
|
|
42
|
+
RadioButton(class: "peer", id: "aria-disabled", aria: {disabled: "true"})
|
|
43
|
+
FormFieldLabel(for: "aria-disabled") { "Aria Disabled" }
|
|
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,129 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Select < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "Select"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Select", description: "Displays a list of options for the user to pick from—triggered by a button.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
render Docs::VisualCodeExample.new(title: "Select (Deconstructed)", context: self) do
|
|
13
|
+
<<~RUBY
|
|
14
|
+
Select(class: "w-56") do
|
|
15
|
+
SelectInput(value: "apple", id: "select-a-fruit")
|
|
16
|
+
|
|
17
|
+
SelectTrigger do
|
|
18
|
+
SelectValue(placeholder: "Select a fruit", id: "select-a-fruit") { "Apple" }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
SelectContent(outlet_id: "select-a-fruit") do
|
|
22
|
+
SelectGroup do
|
|
23
|
+
SelectLabel { "Fruits" }
|
|
24
|
+
SelectItem(value: "apple") { "Apple" }
|
|
25
|
+
SelectItem(value: "orange") { "Orange" }
|
|
26
|
+
SelectItem(value: "banana") { "Banana" }
|
|
27
|
+
SelectItem(value: "watermelon") { "Watermelon" }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
RUBY
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
render Docs::VisualCodeExample.new(title: "Pre-selected Item", context: self) do
|
|
35
|
+
<<~RUBY
|
|
36
|
+
Select(class: "w-56") do
|
|
37
|
+
SelectInput(value: "banana", id: "select-preselected-fruit")
|
|
38
|
+
|
|
39
|
+
SelectTrigger do
|
|
40
|
+
SelectValue(placeholder: "Select a fruit", id: "select-preselected-fruit") { "Banana" }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
SelectContent(outlet_id: "select-preselected-fruit") do
|
|
44
|
+
SelectGroup do
|
|
45
|
+
SelectLabel { "Fruits" }
|
|
46
|
+
SelectItem(value: "apple") { "Apple" }
|
|
47
|
+
SelectItem(value: "orange") { "Orange" }
|
|
48
|
+
SelectItem(value: "banana") { "Banana" }
|
|
49
|
+
SelectItem(value: "watermelon") { "Watermelon" }
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
RUBY
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
render Docs::VisualCodeExample.new(title: "Disabled", context: self) do
|
|
57
|
+
<<~RUBY
|
|
58
|
+
Select(class: "w-56") do
|
|
59
|
+
SelectInput(value: "apple", id: "select-a-fruit")
|
|
60
|
+
|
|
61
|
+
SelectTrigger(disabled: true) do
|
|
62
|
+
SelectValue(placeholder: "Select a fruit", id: "select-a-fruit") { "Apple" }
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
RUBY
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
render Docs::VisualCodeExample.new(title: "Data Disabled", context: self) do
|
|
69
|
+
<<~RUBY
|
|
70
|
+
Select(class: "w-56") do
|
|
71
|
+
SelectInput(value: "apple", id: "select-a-fruit")
|
|
72
|
+
|
|
73
|
+
SelectTrigger do
|
|
74
|
+
SelectValue(placeholder: "Select a fruit", id: "select-a-fruit") { "Apple" }
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
SelectContent(outlet_id: "select-a-fruit") do
|
|
78
|
+
SelectGroup do
|
|
79
|
+
SelectLabel { "Fruits" }
|
|
80
|
+
SelectItem(data: {disabled: true}, value: "apple") { "Apple" }
|
|
81
|
+
SelectItem(value: "orange") { "Orange" }
|
|
82
|
+
SelectItem(value: "banana") { "Banana" }
|
|
83
|
+
SelectItem(data: {disabled: true}, value: "watermelon") { "Watermelon" }
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
RUBY
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
render Docs::VisualCodeExample.new(title: "Aria Disabled Trigger", context: self) do
|
|
91
|
+
<<~RUBY
|
|
92
|
+
Select(class: "w-56") do
|
|
93
|
+
SelectInput(value: "apple", id: "select-a-fruit")
|
|
94
|
+
|
|
95
|
+
SelectTrigger(aria: {disabled: "true"}) do
|
|
96
|
+
SelectValue(placeholder: "Select a fruit", id: "select-a-fruit") { "Apple" }
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
RUBY
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
render Docs::VisualCodeExample.new(title: "Aria Disabled Item", context: self) do
|
|
103
|
+
<<~RUBY
|
|
104
|
+
Select(class: "w-56") do
|
|
105
|
+
SelectInput(value: "apple", id: "select-a-fruit")
|
|
106
|
+
|
|
107
|
+
SelectTrigger do
|
|
108
|
+
SelectValue(placeholder: "Select a fruit", id: "select-a-fruit") { "Apple" }
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
SelectContent(outlet_id: "select-a-fruit") do
|
|
112
|
+
SelectGroup do
|
|
113
|
+
SelectLabel { "Fruits" }
|
|
114
|
+
SelectItem(aria: {disabled: "true"}, value: "apple") { "Apple" }
|
|
115
|
+
SelectItem(value: "orange") { "Orange" }
|
|
116
|
+
SelectItem(value: "banana") { "Banana" }
|
|
117
|
+
SelectItem(aria: {disabled: "true"}, value: "watermelon") { "Watermelon" }
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
RUBY
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
125
|
+
|
|
126
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Separator < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "Separator"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Separator", description: "Visually or semantically separates content.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
render Docs::VisualCodeExample.new(title: "Example", context: self) do
|
|
13
|
+
<<~RUBY
|
|
14
|
+
div do
|
|
15
|
+
div(class: "space-y-1") do
|
|
16
|
+
h4(class: "text-sm font-medium leading-none") { "RubyUI" }
|
|
17
|
+
p(class: "text-sm text-muted-foreground") { "An open-source UI component library." }
|
|
18
|
+
end
|
|
19
|
+
Separator(class: "my-4")
|
|
20
|
+
div(class: "flex h-5 items-center space-x-4 text-sm") do
|
|
21
|
+
div { "Blog" }
|
|
22
|
+
Separator(as: :hr, orientation: :vertical)
|
|
23
|
+
div { "Docs" }
|
|
24
|
+
Separator(orientation: :vertical)
|
|
25
|
+
div { "Source" }
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
RUBY
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
32
|
+
|
|
33
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -33,7 +33,7 @@ module RubyUI
|
|
|
33
33
|
{
|
|
34
34
|
data_state: "open", # For animate in
|
|
35
35
|
class: [
|
|
36
|
-
"fixed pointer-events-auto z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
36
|
+
"fixed pointer-events-auto z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500 overflow-scroll",
|
|
37
37
|
@side_classes
|
|
38
38
|
]
|
|
39
39
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Sheet < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "Sheet"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Sheet", description: "Extends the Sheet component to display content that complements the main content of the screen.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
render Docs::VisualCodeExample.new(title: "Example", context: self) do
|
|
13
|
+
<<~RUBY
|
|
14
|
+
Sheet do
|
|
15
|
+
SheetTrigger do
|
|
16
|
+
Button(variant: :outline) { "Open Sheet" }
|
|
17
|
+
end
|
|
18
|
+
SheetContent(class: 'sm:max-w-sm') do
|
|
19
|
+
SheetHeader do
|
|
20
|
+
SheetTitle { "Edit profile" }
|
|
21
|
+
SheetDescription { "Make changes to your profile here. Click save when you're done." }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
SheetMiddle do
|
|
25
|
+
label { "Name" }
|
|
26
|
+
Input(placeholder: "Joel Drapper") { "Joel Drapper" }
|
|
27
|
+
label { "Email" }
|
|
28
|
+
Input(placeholder: "joel@drapper.me")
|
|
29
|
+
end
|
|
30
|
+
SheetFooter do
|
|
31
|
+
Button(variant: :outline, data: { action: 'click->ruby-ui--sheet-content#close' }) { "Cancel" }
|
|
32
|
+
Button(type: "submit") { "Save" }
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
RUBY
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
render Docs::VisualCodeExample.new(title: "Side", description: "Use the side property to indicate the edge of the screen where the component will appear.", context: self) do
|
|
40
|
+
<<~RUBY
|
|
41
|
+
div(class: 'grid grid-cols-2 gap-4') do
|
|
42
|
+
# -- TOP --
|
|
43
|
+
Sheet do
|
|
44
|
+
SheetTrigger do
|
|
45
|
+
Button(variant: :outline, class: 'w-full justify-center') { :top }
|
|
46
|
+
end
|
|
47
|
+
SheetContent(side: :top, class: ("sm:max-w-sm" if [:left, :right].include?(:top))) do
|
|
48
|
+
SheetHeader do
|
|
49
|
+
SheetTitle { "Edit profile" }
|
|
50
|
+
SheetDescription { "Make changes to your profile here. Click save when you're done." }
|
|
51
|
+
end
|
|
52
|
+
Form do
|
|
53
|
+
SheetMiddle do
|
|
54
|
+
label { "Name" }
|
|
55
|
+
Input(placeholder: "Joel Drapper") { "Joel Drapper" }
|
|
56
|
+
|
|
57
|
+
label { "Email" }
|
|
58
|
+
Input(placeholder: "joel@drapper.me")
|
|
59
|
+
end
|
|
60
|
+
SheetFooter do
|
|
61
|
+
Button(variant: :outline, data: { action: 'click->ruby-ui--sheet-content#close' }) { "Cancel" }
|
|
62
|
+
Button(type: "submit") { "Save" }
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
RUBY
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
72
|
+
|
|
73
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::ShortcutKey < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "ShortcutKey"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Shortcut Key", description: "A component for displaying keyboard shortcuts.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
render Docs::VisualCodeExample.new(title: "Example", context: self) do
|
|
13
|
+
<<~RUBY
|
|
14
|
+
div(class: "flex flex-col items-center gap-y-4") do
|
|
15
|
+
ShortcutKey do
|
|
16
|
+
span(class: "text-xs") { "⌘" }
|
|
17
|
+
plain "K"
|
|
18
|
+
end
|
|
19
|
+
p(class: "text-muted-foreground text-sm text-center") { "Note this does not trigger anything, it is purely a visual prompt" }
|
|
20
|
+
end
|
|
21
|
+
RUBY
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
25
|
+
|
|
26
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Sidebar < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "Sidebar"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Sidebar", description: "A composable, themeable and customizable sidebar component.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
Alert do
|
|
13
|
+
info_icon
|
|
14
|
+
AlertTitle { "Requirements" }
|
|
15
|
+
AlertDescription { "The sidebar component depends on the following components:" }
|
|
16
|
+
ul(class: "list-disc list-inside") do
|
|
17
|
+
li do
|
|
18
|
+
InlineLink(href: docs_sheet_path, target: "_blank", class: "inline-flex items-center gap-2") do
|
|
19
|
+
span { "Sheet" }
|
|
20
|
+
external_icon_link
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
li do
|
|
24
|
+
div(class: "inline-flex items-center gap-2") do
|
|
25
|
+
InlineLink(href: docs_separator_path, target: "_blank") { "Separator" }
|
|
26
|
+
external_icon_link
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
render Docs::VisualCodeExample.new(title: "Example", src: "/docs/sidebar/example", context: self) do
|
|
33
|
+
Views::Docs::Sidebar::Example::CODE
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
render Docs::VisualCodeExample.new(title: "Inset variant", src: "/docs/sidebar/inset", context: self) do
|
|
37
|
+
Views::Docs::Sidebar::InsetExample::CODE
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
render Docs::VisualCodeExample.new(title: "Dialog variant", context: self) do
|
|
41
|
+
<<~RUBY
|
|
42
|
+
Dialog(data: {action: "ruby-ui--dialog:connect->ruby-ui--dialog#open"}) do
|
|
43
|
+
DialogTrigger do
|
|
44
|
+
Button { "Open Dialog" }
|
|
45
|
+
end
|
|
46
|
+
DialogContent(class: "grid overflow-hidden p-0 md:max-h-[500px] md:max-w-[700px] lg:max-w-[800px]") do
|
|
47
|
+
SidebarWrapper(class: "items-start") do
|
|
48
|
+
Sidebar(collapsible: :none, class: "hidden md:flex") do
|
|
49
|
+
SidebarContent do
|
|
50
|
+
SidebarGroup do
|
|
51
|
+
SidebarGroupContent do
|
|
52
|
+
SidebarMenu do
|
|
53
|
+
SidebarMenuItem do
|
|
54
|
+
SidebarMenuButton(as: :a, href: "#") do
|
|
55
|
+
search_icon()
|
|
56
|
+
span { "Search" }
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
SidebarMenuItem do
|
|
60
|
+
SidebarMenuButton(as: :a, href: "#", active: true) do
|
|
61
|
+
home_icon()
|
|
62
|
+
span { "Home" }
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
SidebarMenuItem do
|
|
66
|
+
SidebarMenuButton(as: :a, href: "#") do
|
|
67
|
+
inbox_icon()
|
|
68
|
+
span { "Inbox" }
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
main(class: "flex h-[480px] flex-1 flex-col overflow-hidden") do
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
RUBY
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
85
|
+
|
|
86
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def search_icon
|
|
91
|
+
svg(
|
|
92
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
93
|
+
width: "24",
|
|
94
|
+
height: "24",
|
|
95
|
+
viewBox: "0 0 24 24",
|
|
96
|
+
fill: "none",
|
|
97
|
+
stroke: "currentColor",
|
|
98
|
+
stroke_width: "2",
|
|
99
|
+
stroke_linecap: "round",
|
|
100
|
+
stroke_linejoin: "round",
|
|
101
|
+
class: "lucide lucide-search"
|
|
102
|
+
) do |s|
|
|
103
|
+
s.circle(cx: "11", cy: "11", r: "8")
|
|
104
|
+
s.path(d: "M21 21L16.7 16.7")
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def home_icon
|
|
109
|
+
svg(
|
|
110
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
111
|
+
width: "24",
|
|
112
|
+
height: "24",
|
|
113
|
+
viewBox: "0 0 24 24",
|
|
114
|
+
fill: "none",
|
|
115
|
+
stroke: "currentColor",
|
|
116
|
+
stroke_width: "2",
|
|
117
|
+
stroke_linecap: "round",
|
|
118
|
+
stroke_linejoin: "round",
|
|
119
|
+
class: "lucide lucide-house"
|
|
120
|
+
) do |s|
|
|
121
|
+
s.path(d: "M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8")
|
|
122
|
+
s.path(d: "M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z")
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def inbox_icon
|
|
127
|
+
svg(
|
|
128
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
129
|
+
width: "24",
|
|
130
|
+
height: "24",
|
|
131
|
+
viewBox: "0 0 24 24",
|
|
132
|
+
fill: "none",
|
|
133
|
+
stroke: "currentColor",
|
|
134
|
+
stroke_width: "2",
|
|
135
|
+
stroke_linecap: "round",
|
|
136
|
+
stroke_linejoin: "round",
|
|
137
|
+
class: "lucide lucide-inbox"
|
|
138
|
+
) do |s|
|
|
139
|
+
s.polyline(points: "22 12 16 12 14 15 10 15 8 12 2 12")
|
|
140
|
+
s.path(d: "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z")
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def external_icon_link
|
|
145
|
+
svg(
|
|
146
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
147
|
+
viewBox: "0 0 24 24",
|
|
148
|
+
fill: "none",
|
|
149
|
+
stroke: "currentColor",
|
|
150
|
+
stroke_width: "2",
|
|
151
|
+
stroke_linecap: "round",
|
|
152
|
+
stroke_linejoin: "round",
|
|
153
|
+
class: "lucide lucide-external-link-icon lucide-external-link size-3"
|
|
154
|
+
) do |s|
|
|
155
|
+
s.path(d: "M15 3h6v6")
|
|
156
|
+
s.path(d: "M10 14 21 3")
|
|
157
|
+
s.path(d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6")
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def info_icon
|
|
162
|
+
svg(
|
|
163
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
164
|
+
viewbox: "0 0 24 24",
|
|
165
|
+
fill: "currentColor",
|
|
166
|
+
class: "w-5 h-5"
|
|
167
|
+
) do |s|
|
|
168
|
+
s.path(
|
|
169
|
+
fill_rule: "evenodd",
|
|
170
|
+
d:
|
|
171
|
+
"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",
|
|
172
|
+
clip_rule: "evenodd"
|
|
173
|
+
)
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Skeleton < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "Skeleton"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Skeleton", description: "Use to show a placeholder while content is loading.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
render Docs::VisualCodeExample.new(title: "Example", context: self) do
|
|
13
|
+
<<~RUBY
|
|
14
|
+
div(class: "flex items-center space-x-4") do
|
|
15
|
+
Skeleton(class: "h-12 w-12 rounded-full")
|
|
16
|
+
div(class: "space-y-2") do
|
|
17
|
+
Skeleton(class: "h-4 w-[250px]")
|
|
18
|
+
Skeleton(class: "h-4 w-[200px]")
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
RUBY
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
25
|
+
|
|
26
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Switch < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "Switch"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Switch", description: "A control that allows the user to toggle between checked and not checked.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
render Docs::VisualCodeExample.new(title: "Default", context: self) do
|
|
13
|
+
<<~RUBY
|
|
14
|
+
Switch(name: "switch")
|
|
15
|
+
RUBY
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
render Docs::VisualCodeExample.new(title: "Checked", context: self) do
|
|
19
|
+
<<~RUBY
|
|
20
|
+
Switch(name: "switch", checked: true)
|
|
21
|
+
RUBY
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
render Docs::VisualCodeExample.new(title: "Disabled", context: self) do
|
|
25
|
+
<<~RUBY
|
|
26
|
+
Switch(name: "switch", disabled: true)
|
|
27
|
+
RUBY
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
render Docs::VisualCodeExample.new(title: "Aria Disabled", context: self) do
|
|
31
|
+
<<~RUBY
|
|
32
|
+
Switch(name: "switch", aria: {disabled: "true"})
|
|
33
|
+
RUBY
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
render Docs::VisualCodeExample.new(title: "With flag include_hidden false", context: self) do
|
|
37
|
+
<<~RUBY
|
|
38
|
+
# Supports the creation of a hidden input to be used in forms inspired by the Ruby on Rails implementation of check_box. Default is true.
|
|
39
|
+
Switch(name: "switch", include_hidden: false)
|
|
40
|
+
RUBY
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|