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,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Views::Docs::HoverCard < Views::Base
|
|
4
|
+
def view_template
|
|
5
|
+
component = "HoverCard"
|
|
6
|
+
|
|
7
|
+
div(class: "max-w-2xl mx-auto w-full py-10 space-y-10") do
|
|
8
|
+
render Docs::Header.new(title: "Hover Card", description: "For sighted users to preview content available behind a link.")
|
|
9
|
+
|
|
10
|
+
Heading(level: 2) { "Usage" }
|
|
11
|
+
|
|
12
|
+
render Docs::VisualCodeExample.new(title: "Example", context: self) do
|
|
13
|
+
<<~RUBY
|
|
14
|
+
HoverCard do
|
|
15
|
+
HoverCardTrigger do
|
|
16
|
+
Button(variant: :link) { "@joeldrapper" } # Make this a link in order to navigate somewhere
|
|
17
|
+
end
|
|
18
|
+
HoverCardContent do
|
|
19
|
+
div(class: "flex justify-between space-x-4") do
|
|
20
|
+
Avatar do
|
|
21
|
+
AvatarImage(src: "https://avatars.githubusercontent.com/u/246692?v=4", alt: "joeldrapper")
|
|
22
|
+
AvatarFallback { "JD" }
|
|
23
|
+
end
|
|
24
|
+
div(class: "space-y-1") do
|
|
25
|
+
h4(class: "text-sm font-medium") { "@joeldrapper" }
|
|
26
|
+
p(class: "text-sm") do
|
|
27
|
+
"Creator of Phlex Components. Ruby on Rails developer."
|
|
28
|
+
end
|
|
29
|
+
div(class: "flex items-center pt-2") do
|
|
30
|
+
svg(
|
|
31
|
+
width: "15",
|
|
32
|
+
height: "15",
|
|
33
|
+
viewbox: "0 0 15 15",
|
|
34
|
+
fill: "none",
|
|
35
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
36
|
+
class: "mr-2 h-4 w-4 opacity-70"
|
|
37
|
+
) do |s|
|
|
38
|
+
s.path(
|
|
39
|
+
d:
|
|
40
|
+
"M4.5 1C4.77614 1 5 1.22386 5 1.5V2H10V1.5C10 1.22386 10.2239 1 10.5 1C10.7761 1 11 1.22386 11 1.5V2H12.5C13.3284 2 14 2.67157 14 3.5V12.5C14 13.3284 13.3284 14 12.5 14H2.5C1.67157 14 1 13.3284 1 12.5V3.5C1 2.67157 1.67157 2 2.5 2H4V1.5C4 1.22386 4.22386 1 4.5 1ZM10 3V3.5C10 3.77614 10.2239 4 10.5 4C10.7761 4 11 3.77614 11 3.5V3H12.5C12.7761 3 13 3.22386 13 3.5V5H2V3.5C2 3.22386 2.22386 3 2.5 3H4V3.5C4 3.77614 4.22386 4 4.5 4C4.77614 4 5 3.77614 5 3.5V3H10ZM2 6V12.5C2 12.7761 2.22386 13 2.5 13H12.5C12.7761 13 13 12.7761 13 12.5V6H2ZM7 7.5C7 7.22386 7.22386 7 7.5 7C7.77614 7 8 7.22386 8 7.5C8 7.77614 7.77614 8 7.5 8C7.22386 8 7 7.77614 7 7.5ZM9.5 7C9.22386 7 9 7.22386 9 7.5C9 7.77614 9.22386 8 9.5 8C9.77614 8 10 7.77614 10 7.5C10 7.22386 9.77614 7 9.5 7ZM11 7.5C11 7.22386 11.2239 7 11.5 7C11.7761 7 12 7.22386 12 7.5C12 7.77614 11.7761 8 11.5 8C11.2239 8 11 7.77614 11 7.5ZM11.5 9C11.2239 9 11 9.22386 11 9.5C11 9.77614 11.2239 10 11.5 10C11.7761 10 12 9.77614 12 9.5C12 9.22386 11.7761 9 11.5 9ZM9 9.5C9 9.22386 9.22386 9 9.5 9C9.77614 9 10 9.22386 10 9.5C10 9.77614 9.77614 10 9.5 10C9.22386 10 9 9.77614 9 9.5ZM7.5 9C7.22386 9 7 9.22386 7 9.5C7 9.77614 7.22386 10 7.5 10C7.77614 10 8 9.77614 8 9.5C8 9.22386 7.77614 9 7.5 9ZM5 9.5C5 9.22386 5.22386 9 5.5 9C5.77614 9 6 9.22386 6 9.5C6 9.77614 5.77614 10 5.5 10C5.22386 10 5 9.77614 5 9.5ZM3.5 9C3.22386 9 3 9.22386 3 9.5C3 9.77614 3.22386 10 3.5 10C3.77614 10 4 9.77614 4 9.5C4 9.22386 3.77614 9 3.5 9ZM3 11.5C3 11.2239 3.22386 11 3.5 11C3.77614 11 4 11.2239 4 11.5C4 11.7761 3.77614 12 3.5 12C3.22386 12 3 11.7761 3 11.5ZM5.5 11C5.22386 11 5 11.2239 5 11.5C5 11.7761 5.22386 12 5.5 12C5.77614 12 6 11.7761 6 11.5C6 11.2239 5.77614 11 5.5 11ZM7 11.5C7 11.2239 7.22386 11 7.5 11C7.77614 11 8 11.2239 8 11.5C8 11.7761 7.77614 12 7.5 12C7.22386 12 7 11.7761 7 11.5ZM9.5 11C9.22386 11 9 11.2239 9 11.5C9 11.7761 9.22386 12 9.5 12C9.77614 12 10 11.7761 10 11.5C10 11.2239 9.77614 11 9.5 11Z",
|
|
41
|
+
fill: "currentColor",
|
|
42
|
+
fill_rule: "evenodd",
|
|
43
|
+
clip_rule: "evenodd"
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
span(class: "text-xs text-muted-foreground") { "Joined December 2021" }
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
RUBY
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
render Components::ComponentSetup::Tabs.new(component_name: component)
|
|
56
|
+
|
|
57
|
+
render Docs::ComponentsTable.new(component_files(component))
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
private
|
|
62
|
+
|
|
63
|
+
# def components
|
|
64
|
+
# [
|
|
65
|
+
# Docs::ComponentStruct.new(name: "PopoverController", source: "https://github.com/PhlexUI/phlex_ui_stimulus/blob/main/controllers/popover_controller.js", built_using: :stimulus),
|
|
66
|
+
# Docs::ComponentStruct.new(name: "HoverCard", source: "https://github.com/PhlexUI/phlex_ui/blob/main/lib/phlex_ui/hover_card.rb", built_using: :phlex),
|
|
67
|
+
# Docs::ComponentStruct.new(name: "HoverCardTrigger", source: "https://github.com/PhlexUI/phlex_ui/blob/main/lib/phlex_ui/hover_card/trigger.rb", built_using: :phlex),
|
|
68
|
+
# Docs::ComponentStruct.new(name: "HoverCardContent", source: "https://github.com/PhlexUI/phlex_ui/blob/main/lib/phlex_ui/hover_card/content.rb", built_using: :phlex)
|
|
69
|
+
# ]
|
|
70
|
+
# end
|
|
71
|
+
end
|
data/lib/ruby_ui/input/input.rb
CHANGED
|
@@ -20,12 +20,13 @@ module RubyUI
|
|
|
20
20
|
action: "input->ruby-ui--form-field#onInput invalid->ruby-ui--form-field#onInvalid"
|
|
21
21
|
},
|
|
22
22
|
class: [
|
|
23
|
-
"flex h-9 w-full rounded-md border bg-background px-3 py-1 text-sm shadow-
|
|
23
|
+
"flex h-9 w-full rounded-md border bg-background px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] border-border ring-0 ring-ring/0",
|
|
24
24
|
"placeholder:text-muted-foreground",
|
|
25
25
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
26
26
|
"file:border-0 file:bg-transparent file:text-sm file:font-medium",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
27
|
+
"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none",
|
|
28
|
+
"focus-visible:outline-none focus-visible:ring-ring/50 focus-visible:ring-2 focus-visible:border-ring focus-visible:shadow-sm",
|
|
29
|
+
(@type.to_s == "file") ? "pt-[7px]" : ""
|
|
29
30
|
]
|
|
30
31
|
}
|
|
31
32
|
end
|
|
@@ -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
|
|
@@ -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
|