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
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Input < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "Input"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Input", description: "Displays a form input field or a component that looks like an input field.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
render Docs::VisualCodeExample.new(title: "Email", context: self) do
|
|
13
|
+
<<~RUBY
|
|
14
|
+
div(class: 'grid w-full max-w-sm items-center gap-1.5') do
|
|
15
|
+
Input(type: "email", placeholder: "Email")
|
|
16
|
+
end
|
|
17
|
+
RUBY
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
render Docs::VisualCodeExample.new(title: "File", context: self) do
|
|
21
|
+
<<~RUBY
|
|
22
|
+
div(class: "grid w-full max-w-sm items-center gap-1.5") do
|
|
23
|
+
label(for: "picture") { "Picture" }
|
|
24
|
+
Input(type: "file", id: "picture")
|
|
25
|
+
end
|
|
26
|
+
RUBY
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
render Docs::VisualCodeExample.new(title: "Disabled", context: self) do
|
|
30
|
+
<<~RUBY
|
|
31
|
+
div(class: 'grid w-full max-w-sm items-center gap-1.5') do
|
|
32
|
+
Input(disabled: true, type: "email", placeholder: "Email")
|
|
33
|
+
end
|
|
34
|
+
RUBY
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
render Docs::VisualCodeExample.new(title: "Aria Disabled", context: self) do
|
|
38
|
+
<<~RUBY
|
|
39
|
+
div(class: 'grid w-full max-w-sm items-center gap-1.5') do
|
|
40
|
+
Input(aria: {disabled: "true"}, type: "email", placeholder: "Email")
|
|
41
|
+
end
|
|
42
|
+
RUBY
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
render Docs::VisualCodeExample.new(title: "With label", context: self) do
|
|
46
|
+
<<~RUBY
|
|
47
|
+
div(class: 'grid w-full max-w-sm items-center gap-1.5') do
|
|
48
|
+
label(for: "email1") { "Email" }
|
|
49
|
+
Input(type: "email", placeholder: "Email", id: "email1")
|
|
50
|
+
end
|
|
51
|
+
RUBY
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
render Docs::VisualCodeExample.new(title: "With button", context: self) do
|
|
55
|
+
<<~RUBY
|
|
56
|
+
div(class: 'flex w-full max-w-sm items-center space-x-2') do
|
|
57
|
+
Input(type: "email", placeholder: "Email")
|
|
58
|
+
Button { "Subscribe" }
|
|
59
|
+
end
|
|
60
|
+
RUBY
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
64
|
+
|
|
65
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
data/lib/ruby_ui/link/link.rb
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
module RubyUI
|
|
4
4
|
class Link < Base
|
|
5
|
+
BASE_CLASSES = [
|
|
6
|
+
"whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors",
|
|
7
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
8
|
+
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
9
|
+
"aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-disabled:cursor-not-allowed"
|
|
10
|
+
].freeze
|
|
11
|
+
|
|
5
12
|
def initialize(href: "#", variant: :link, size: :md, icon: false, **attrs)
|
|
6
13
|
@href = href
|
|
7
14
|
@variant = variant.to_sym
|
|
@@ -36,43 +43,55 @@ module RubyUI
|
|
|
36
43
|
|
|
37
44
|
def primary_classes
|
|
38
45
|
[
|
|
39
|
-
|
|
40
|
-
size_classes
|
|
46
|
+
BASE_CLASSES,
|
|
47
|
+
size_classes,
|
|
48
|
+
"bg-primary text-primary-foreground shadow",
|
|
49
|
+
"hover:bg-primary/90"
|
|
41
50
|
]
|
|
42
51
|
end
|
|
43
52
|
|
|
44
53
|
def link_classes
|
|
45
54
|
[
|
|
46
|
-
|
|
47
|
-
size_classes
|
|
55
|
+
BASE_CLASSES,
|
|
56
|
+
size_classes,
|
|
57
|
+
"text-primary underline-offset-4",
|
|
58
|
+
"hover:underline"
|
|
48
59
|
]
|
|
49
60
|
end
|
|
50
61
|
|
|
51
62
|
def secondary_classes
|
|
52
63
|
[
|
|
53
|
-
|
|
54
|
-
size_classes
|
|
64
|
+
BASE_CLASSES,
|
|
65
|
+
size_classes,
|
|
66
|
+
"bg-secondary text-secondary-foreground",
|
|
67
|
+
"hover:bg-opacity-80"
|
|
55
68
|
]
|
|
56
69
|
end
|
|
57
70
|
|
|
58
71
|
def destructive_classes
|
|
59
72
|
[
|
|
60
|
-
|
|
61
|
-
size_classes
|
|
73
|
+
BASE_CLASSES,
|
|
74
|
+
size_classes,
|
|
75
|
+
"bg-destructive text-white shadow-sm",
|
|
76
|
+
"[a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20",
|
|
77
|
+
"dark:focus-visible:ring-destructive/40 dark:bg-destructive/60"
|
|
62
78
|
]
|
|
63
79
|
end
|
|
64
80
|
|
|
65
81
|
def outline_classes
|
|
66
82
|
[
|
|
67
|
-
|
|
68
|
-
size_classes
|
|
83
|
+
BASE_CLASSES,
|
|
84
|
+
size_classes,
|
|
85
|
+
"border border-input bg-background shadow-sm",
|
|
86
|
+
"hover:bg-accent hover:text-accent-foreground"
|
|
69
87
|
]
|
|
70
88
|
end
|
|
71
89
|
|
|
72
90
|
def ghost_classes
|
|
73
91
|
[
|
|
74
|
-
|
|
75
|
-
size_classes
|
|
92
|
+
BASE_CLASSES,
|
|
93
|
+
size_classes,
|
|
94
|
+
"hover:bg-accent hover:text-accent-foreground"
|
|
76
95
|
]
|
|
77
96
|
end
|
|
78
97
|
|
|
@@ -88,10 +107,7 @@ module RubyUI
|
|
|
88
107
|
end
|
|
89
108
|
|
|
90
109
|
def default_attrs
|
|
91
|
-
{
|
|
92
|
-
type: "button",
|
|
93
|
-
class: default_classes
|
|
94
|
-
}
|
|
110
|
+
{type: "button", class: default_classes}
|
|
95
111
|
end
|
|
96
112
|
end
|
|
97
113
|
end
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Link < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "Link"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Link", description: "Displays a link that looks like a button or underline link.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
render Docs::VisualCodeExample.new(title: "Example", description: "This is the default appearance of a Link", context: self) do
|
|
13
|
+
<<~RUBY
|
|
14
|
+
Link(href: "#") { "Link" }
|
|
15
|
+
RUBY
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
render Docs::VisualCodeExample.new(title: "Aria Disabled", context: self) do
|
|
19
|
+
<<~RUBY
|
|
20
|
+
Link(aria: {disabled: "true"}, href: "#") { "Link" }
|
|
21
|
+
RUBY
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
render Docs::VisualCodeExample.new(title: "Primary", description: "This is the primary variant of a Link", context: self) do
|
|
25
|
+
<<~RUBY
|
|
26
|
+
Link(href: "#", variant: :primary) { "Primary" }
|
|
27
|
+
RUBY
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
render Docs::VisualCodeExample.new(title: "Secondary", description: "This is the secondary variant of a Link", context: self) do
|
|
31
|
+
<<~RUBY
|
|
32
|
+
Link(href: "#", variant: :secondary) { "Secondary" }
|
|
33
|
+
RUBY
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
render Docs::VisualCodeExample.new(title: "Destructive", description: "This is the destructive variant of a Link", context: self) do
|
|
37
|
+
<<~RUBY
|
|
38
|
+
Link(href: "#", variant: :destructive) { "Destructive" }
|
|
39
|
+
RUBY
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
render Docs::VisualCodeExample.new(title: "Icon", description: "This is the icon variant of a Link", context: self) do
|
|
43
|
+
<<~RUBY
|
|
44
|
+
Link(href: "#", variant: :outline, icon: true) do
|
|
45
|
+
chevron_icon
|
|
46
|
+
end
|
|
47
|
+
RUBY
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
render Docs::VisualCodeExample.new(title: "With Icon", description: "This is the primary variant of a Link with an icon", context: self) do
|
|
51
|
+
<<~RUBY
|
|
52
|
+
Link(href: "#", variant: :primary) do
|
|
53
|
+
email_icon
|
|
54
|
+
span { "Login with Email" }
|
|
55
|
+
end
|
|
56
|
+
RUBY
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
render Docs::VisualCodeExample.new(title: "Ghost", description: "This is the ghost variant of a Link", context: self) do
|
|
60
|
+
<<~RUBY
|
|
61
|
+
Link(href: "#", variant: :ghost) { "Ghost" }
|
|
62
|
+
RUBY
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
66
|
+
|
|
67
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
private
|
|
72
|
+
|
|
73
|
+
def chevron_icon
|
|
74
|
+
svg(
|
|
75
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
76
|
+
viewbox: "0 0 20 20",
|
|
77
|
+
fill: "currentColor",
|
|
78
|
+
class: "w-5 h-5"
|
|
79
|
+
) do |s|
|
|
80
|
+
s.path(
|
|
81
|
+
fill_rule: "evenodd",
|
|
82
|
+
d:
|
|
83
|
+
"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",
|
|
84
|
+
clip_rule: "evenodd"
|
|
85
|
+
)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def email_icon
|
|
90
|
+
svg(
|
|
91
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
92
|
+
fill: "none",
|
|
93
|
+
viewbox: "0 0 24 24",
|
|
94
|
+
stroke_width: "1.5",
|
|
95
|
+
stroke: "currentColor",
|
|
96
|
+
class: "w-4 h-4 mr-2"
|
|
97
|
+
) do |s|
|
|
98
|
+
s.path(
|
|
99
|
+
stroke_linecap: "round",
|
|
100
|
+
stroke_linejoin: "round",
|
|
101
|
+
d:
|
|
102
|
+
"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"
|
|
103
|
+
)
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::MaskedInput < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "MaskedInput"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "MaskedInput", description: "Displays a form input field with applied mask.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
Text do
|
|
13
|
+
plain "For advanced usage, check out the "
|
|
14
|
+
InlineLink(href: "https://beholdr.github.io/maska/v3", target: "_blank") { "Maska website" }
|
|
15
|
+
plain "."
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
render Docs::VisualCodeExample.new(title: "Phone number", context: self) do
|
|
19
|
+
<<~RUBY
|
|
20
|
+
div(class: 'grid w-full max-w-sm items-center gap-1.5') do
|
|
21
|
+
MaskedInput(data: {maska: "(##) #####-####"})
|
|
22
|
+
end
|
|
23
|
+
RUBY
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
render Docs::VisualCodeExample.new(title: "Hex color code", context: self) do
|
|
27
|
+
<<~RUBY
|
|
28
|
+
div(class: 'grid w-full max-w-sm items-center gap-1.5') do
|
|
29
|
+
MaskedInput(data: {maska: "!#HHHHHH", maska_tokens: "H:[0-9a-fA-F]"})
|
|
30
|
+
end
|
|
31
|
+
RUBY
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
render Docs::VisualCodeExample.new(title: "CPF / CNPJ", context: self) do
|
|
35
|
+
<<~RUBY
|
|
36
|
+
div(class: 'grid w-full max-w-sm items-center gap-1.5') do
|
|
37
|
+
MaskedInput(data: {maska: "['###.###.###-##', '##.###.###/####-##']"})
|
|
38
|
+
end
|
|
39
|
+
RUBY
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
43
|
+
|
|
44
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::Pagination < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "Pagination"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Pagination", description: "Pagination with page navigation, next and previous links.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
render Docs::VisualCodeExample.new(title: "Example", description: "This is the default appearance of a Pagination", context: self) do
|
|
13
|
+
<<~RUBY
|
|
14
|
+
Pagination do
|
|
15
|
+
PaginationContent do
|
|
16
|
+
PaginationItem(href: "#") do
|
|
17
|
+
chevrons_left_icon
|
|
18
|
+
plain "First"
|
|
19
|
+
end
|
|
20
|
+
PaginationItem(href: "#") do
|
|
21
|
+
chevron_left_icon
|
|
22
|
+
plain "Prev"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
PaginationEllipsis
|
|
26
|
+
|
|
27
|
+
PaginationItem(href: "#") { "4" }
|
|
28
|
+
PaginationItem(href: "#", active: true) { "5" }
|
|
29
|
+
PaginationItem(href: "#") { "6" }
|
|
30
|
+
|
|
31
|
+
PaginationEllipsis
|
|
32
|
+
|
|
33
|
+
PaginationItem(href: "#") do
|
|
34
|
+
plain "Next"
|
|
35
|
+
chevron_right_icon
|
|
36
|
+
end
|
|
37
|
+
PaginationItem(href: "#") do
|
|
38
|
+
plain "Last"
|
|
39
|
+
chevrons_right_icon
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
RUBY
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
47
|
+
|
|
48
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
def chevrons_left_icon
|
|
55
|
+
svg(
|
|
56
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
57
|
+
width: "24",
|
|
58
|
+
height: "24",
|
|
59
|
+
viewbox: "0 0 24 24",
|
|
60
|
+
stroke_width: "1.5",
|
|
61
|
+
stroke: "currentColor",
|
|
62
|
+
fill: "none",
|
|
63
|
+
stroke_linecap: "round",
|
|
64
|
+
stroke_linejoin: "round",
|
|
65
|
+
class: "h-4 w-4"
|
|
66
|
+
) do |s|
|
|
67
|
+
s.path(stroke: "none", d: "M0 0h24v24H0z", fill: "none")
|
|
68
|
+
s.path(d: "M11 7l-5 5l5 5")
|
|
69
|
+
s.path(d: "M17 7l-5 5l5 5")
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def chevron_left_icon
|
|
74
|
+
svg(
|
|
75
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
76
|
+
width: "24",
|
|
77
|
+
height: "24",
|
|
78
|
+
viewbox: "0 0 24 24",
|
|
79
|
+
stroke_width: "1.5",
|
|
80
|
+
stroke: "currentColor",
|
|
81
|
+
fill: "none",
|
|
82
|
+
stroke_linecap: "round",
|
|
83
|
+
stroke_linejoin: "round",
|
|
84
|
+
class: "h-4 w-4"
|
|
85
|
+
) do |s|
|
|
86
|
+
s.path(stroke: "none", d: "M0 0h24v24H0z", fill: "none")
|
|
87
|
+
s.path(d: "M15 6l-6 6l6 6")
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def chevrons_right_icon
|
|
92
|
+
svg(
|
|
93
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
94
|
+
width: "24",
|
|
95
|
+
height: "24",
|
|
96
|
+
viewbox: "0 0 24 24",
|
|
97
|
+
stroke_width: "1.5",
|
|
98
|
+
stroke: "currentColor",
|
|
99
|
+
fill: "none",
|
|
100
|
+
stroke_linecap: "round",
|
|
101
|
+
stroke_linejoin: "round",
|
|
102
|
+
class: "h-4 w-4"
|
|
103
|
+
) do |s|
|
|
104
|
+
s.path(stroke: "none", d: "M0 0h24v24H0z", fill: "none")
|
|
105
|
+
s.path(d: "M7 7l5 5l-5 5")
|
|
106
|
+
s.path(d: "M13 7l5 5l-5 5")
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def chevron_right_icon
|
|
111
|
+
svg(
|
|
112
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
113
|
+
width: "24",
|
|
114
|
+
height: "24",
|
|
115
|
+
viewbox: "0 0 24 24",
|
|
116
|
+
stroke_width: "1.5",
|
|
117
|
+
stroke: "currentColor",
|
|
118
|
+
fill: "none",
|
|
119
|
+
stroke_linecap: "round",
|
|
120
|
+
stroke_linejoin: "round",
|
|
121
|
+
class: "h-4 w-4"
|
|
122
|
+
) do |s|
|
|
123
|
+
s.path(stroke: "none", d: "M0 0h24v24H0z", fill: "none")
|
|
124
|
+
s.path(d: "M9 6l6 6l-6 6")
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|