rbui 0.0.0 → 1.0.0.pre.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbui/accordion/accordion.rb +17 -0
- data/lib/rbui/accordion/accordion_content.rb +21 -0
- data/lib/rbui/accordion/accordion_default_content.rb +17 -0
- data/lib/rbui/accordion/accordion_default_trigger.rb +19 -0
- data/lib/rbui/accordion/accordion_icon.rb +38 -0
- data/lib/rbui/accordion/accordion_item.rb +28 -0
- data/lib/rbui/accordion/accordion_trigger.rb +16 -0
- data/lib/rbui/alert/alert.rb +36 -0
- data/lib/rbui/alert/alert_description.rb +17 -0
- data/lib/rbui/alert/alert_title.rb +17 -0
- data/lib/rbui/alert_dialog/alert_dialog.rb +26 -0
- data/lib/rbui/alert_dialog/alert_dialog_action.rb +17 -0
- data/lib/rbui/alert_dialog/alert_dialog_cancel.rb +21 -0
- data/lib/rbui/alert_dialog/alert_dialog_content.rb +45 -0
- data/lib/rbui/alert_dialog/alert_dialog_description.rb +17 -0
- data/lib/rbui/alert_dialog/alert_dialog_footer.rb +17 -0
- data/lib/rbui/alert_dialog/alert_dialog_header.rb +17 -0
- data/lib/rbui/alert_dialog/alert_dialog_title.rb +17 -0
- data/lib/rbui/alert_dialog/alert_dialog_trigger.rb +18 -0
- data/lib/rbui/aspect_ratio/aspect_ratio.rb +33 -0
- data/lib/rbui/avatar/avatar.rb +31 -0
- data/lib/rbui/avatar/avatar_fallback.rb +17 -0
- data/lib/rbui/avatar/avatar_image.rb +26 -0
- data/lib/rbui/badge/badge.rb +60 -0
- data/lib/rbui/base.rb +27 -0
- data/lib/rbui/button/button.rb +97 -0
- data/lib/rbui/calendar/calendar.rb +39 -0
- data/lib/rbui/calendar/calendar_body.rb +19 -0
- data/lib/rbui/calendar/calendar_days.rb +104 -0
- data/lib/rbui/calendar/calendar_header.rb +17 -0
- data/lib/rbui/calendar/calendar_next.rb +43 -0
- data/lib/rbui/calendar/calendar_prev.rb +43 -0
- data/lib/rbui/calendar/calendar_title.rb +27 -0
- data/lib/rbui/calendar/calendar_weekdays.rb +33 -0
- data/lib/rbui/card/card.rb +17 -0
- data/lib/rbui/card/card_content.rb +17 -0
- data/lib/rbui/card/card_description.rb +17 -0
- data/lib/rbui/card/card_footer.rb +17 -0
- data/lib/rbui/card/card_header.rb +17 -0
- data/lib/rbui/card/card_title.rb +17 -0
- data/lib/rbui/chart/chart.rb +23 -0
- data/lib/rbui/checkbox/checkbox.rb +23 -0
- data/lib/rbui/checkbox/checkbox_group.rb +20 -0
- data/lib/rbui/clipboard/clipboard.rb +42 -0
- data/lib/rbui/clipboard/clipboard_popover.rb +40 -0
- data/lib/rbui/clipboard/clipboard_source.rb +19 -0
- data/lib/rbui/clipboard/clipboard_trigger.rb +20 -0
- data/lib/rbui/codeblock/codeblock.rb +105 -0
- data/lib/rbui/collapsible/collapsible.rb +25 -0
- data/lib/rbui/collapsible/collapsible_content.rb +18 -0
- data/lib/rbui/collapsible/collapsible_trigger.rb +19 -0
- data/lib/rbui/combobox/combobox.rb +24 -0
- data/lib/rbui/combobox/combobox_content.rb +31 -0
- data/lib/rbui/combobox/combobox_empty.rb +21 -0
- data/lib/rbui/combobox/combobox_group.rb +38 -0
- data/lib/rbui/combobox/combobox_input.rb +22 -0
- data/lib/rbui/combobox/combobox_item.rb +53 -0
- data/lib/rbui/combobox/combobox_list.rb +29 -0
- data/lib/rbui/combobox/combobox_search_input.rb +56 -0
- data/lib/rbui/combobox/combobox_separator.rb +15 -0
- data/lib/rbui/combobox/combobox_trigger.rb +52 -0
- data/lib/rbui/combobox/combobox_value.rb +27 -0
- data/lib/rbui/command/command.rb +9 -0
- data/lib/rbui/command/command_dialog.rb +17 -0
- data/lib/rbui/command/command_dialog_content.rb +48 -0
- data/lib/rbui/command/command_dialog_trigger.rb +29 -0
- data/lib/rbui/command/command_empty.rb +19 -0
- data/lib/rbui/command/command_group.rb +40 -0
- data/lib/rbui/command/command_input.rb +56 -0
- data/lib/rbui/command/command_item.rb +32 -0
- data/lib/rbui/command/command_list.rb +17 -0
- data/lib/rbui/context_menu/context_menu.rb +26 -0
- data/lib/rbui/context_menu/context_menu_content.rb +25 -0
- data/lib/rbui/context_menu/context_menu_item.rb +66 -0
- data/lib/rbui/context_menu/context_menu_label.rb +24 -0
- data/lib/rbui/context_menu/context_menu_separator.rb +19 -0
- data/lib/rbui/context_menu/context_menu_trigger.rb +20 -0
- data/lib/rbui/dialog/dialog.rb +25 -0
- data/lib/rbui/dialog/dialog_content.rb +78 -0
- data/lib/rbui/dialog/dialog_description.rb +17 -0
- data/lib/rbui/dialog/dialog_footer.rb +17 -0
- data/lib/rbui/dialog/dialog_header.rb +17 -0
- data/lib/rbui/dialog/dialog_middle.rb +17 -0
- data/lib/rbui/dialog/dialog_title.rb +17 -0
- data/lib/rbui/dialog/dialog_trigger.rb +20 -0
- data/lib/rbui/dropdown_menu/dropdown_menu.rb +26 -0
- data/lib/rbui/dropdown_menu/dropdown_menu_content.rb +22 -0
- data/lib/rbui/dropdown_menu/dropdown_menu_item.rb +28 -0
- data/lib/rbui/dropdown_menu/dropdown_menu_label.rb +17 -0
- data/lib/rbui/dropdown_menu/dropdown_menu_separator.rb +19 -0
- data/lib/rbui/dropdown_menu/dropdown_menu_trigger.rb +18 -0
- data/lib/rbui/form/form.rb +15 -0
- data/lib/rbui/form/form_field.rb +20 -0
- data/lib/rbui/form/form_field_error.rb +20 -0
- data/lib/rbui/form/form_field_hint.rb +15 -0
- data/lib/rbui/form/form_field_label.rb +15 -0
- data/lib/rbui/hover_card/hover_card.rb +27 -0
- data/lib/rbui/hover_card/hover_card_content.rb +22 -0
- data/lib/rbui/hover_card/hover_card_trigger.rb +20 -0
- data/lib/rbui/input/input.rb +26 -0
- data/lib/rbui/link/link.rb +97 -0
- data/lib/rbui/pagination/pagination.rb +19 -0
- data/lib/rbui/pagination/pagination_content.rb +17 -0
- data/lib/rbui/pagination/pagination_ellipsis.rb +42 -0
- data/lib/rbui/pagination/pagination_item.rb +28 -0
- data/lib/rbui/popover/popover.rb +25 -0
- data/lib/rbui/popover/popover_content.rb +22 -0
- data/lib/rbui/popover/popover_trigger.rb +20 -0
- data/lib/rbui/radio_button/radio_button.rb +22 -0
- data/lib/rbui/select/select.rb +23 -0
- data/lib/rbui/select/select_content.rb +32 -0
- data/lib/rbui/select/select_group.rb +15 -0
- data/lib/rbui/select/select_input.rb +22 -0
- data/lib/rbui/select/select_item.rb +52 -0
- data/lib/rbui/select/select_label.rb +17 -0
- data/lib/rbui/select/select_trigger.rb +54 -0
- data/lib/rbui/select/select_value.rb +27 -0
- data/lib/rbui/sheet/sheet.rb +17 -0
- data/lib/rbui/sheet/sheet_content.rb +77 -0
- data/lib/rbui/sheet/sheet_description.rb +17 -0
- data/lib/rbui/sheet/sheet_footer.rb +17 -0
- data/lib/rbui/sheet/sheet_header.rb +17 -0
- data/lib/rbui/sheet/sheet_middle.rb +17 -0
- data/lib/rbui/sheet/sheet_title.rb +17 -0
- data/lib/rbui/sheet/sheet_trigger.rb +17 -0
- data/lib/rbui/shortcut_key/shortcut_key.rb +17 -0
- data/lib/rbui/table/table.rb +19 -0
- data/lib/rbui/table/table_body.rb +17 -0
- data/lib/rbui/table/table_caption.rb +17 -0
- data/lib/rbui/table/table_cell.rb +17 -0
- data/lib/rbui/table/table_footer.rb +17 -0
- data/lib/rbui/table/table_head.rb +17 -0
- data/lib/rbui/table/table_header.rb +17 -0
- data/lib/rbui/table/table_row.rb +17 -0
- data/lib/rbui/tabs/tabs.rb +25 -0
- data/lib/rbui/tabs/tabs_content.rb +26 -0
- data/lib/rbui/tabs/tabs_list.rb +17 -0
- data/lib/rbui/tabs/tabs_trigger.rb +28 -0
- data/lib/rbui/theme_toggle/theme_toggle.rb +41 -0
- data/lib/rbui/tooltip/tooltip.rb +26 -0
- data/lib/rbui/tooltip/tooltip_content.rb +26 -0
- data/lib/rbui/tooltip/tooltip_trigger.rb +19 -0
- data/lib/rbui/typography/typography_blockquote.rb +17 -0
- data/lib/rbui/typography/typography_h1.rb +17 -0
- data/lib/rbui/typography/typography_h2.rb +17 -0
- data/lib/rbui/typography/typography_h3.rb +17 -0
- data/lib/rbui/typography/typography_h4.rb +17 -0
- data/lib/rbui/typography/typography_inline_code.rb +17 -0
- data/lib/rbui/typography/typography_inline_link.rb +22 -0
- data/lib/rbui/typography/typography_large.rb +17 -0
- data/lib/rbui/typography/typography_lead.rb +17 -0
- data/lib/rbui/typography/typography_list.rb +47 -0
- data/lib/rbui/typography/typography_list_item.rb +17 -0
- data/lib/rbui/typography/typography_muted.rb +17 -0
- data/lib/rbui/typography/typography_p.rb +17 -0
- data/lib/rbui/typography/typography_small.rb +17 -0
- data/lib/rbui/version.rb +5 -0
- data/lib/rbui.rb +42 -3
- metadata +254 -12
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RBUI
|
4
|
+
class Tooltip < Base
|
5
|
+
def initialize(placement: "top", **attrs)
|
6
|
+
@placement = placement
|
7
|
+
super(**attrs)
|
8
|
+
end
|
9
|
+
|
10
|
+
def view_template(&)
|
11
|
+
div(**attrs, &)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def default_attrs
|
17
|
+
{
|
18
|
+
data: {
|
19
|
+
controller: "rbui--tooltip",
|
20
|
+
rbui__tooltip_placement_value: @placement
|
21
|
+
},
|
22
|
+
class: "group"
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RBUI
|
4
|
+
class TooltipContent < Base
|
5
|
+
def initialize(**attrs)
|
6
|
+
@id = "tooltip#{SecureRandom.hex(4)}"
|
7
|
+
super
|
8
|
+
end
|
9
|
+
|
10
|
+
def view_template(&)
|
11
|
+
div(**attrs, &)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def default_attrs
|
17
|
+
{
|
18
|
+
id: @id,
|
19
|
+
data: {
|
20
|
+
rbui__tooltip_target: "content"
|
21
|
+
},
|
22
|
+
class: "invisible peer-hover:visible peer-focus:visible w-max absolute top-0 left-0 z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md peer-focus:zoom-in-95 animate-out fade-out-0 zoom-out-95 peer-hover:animate-in peer-focus:animate-in peer-hover:fade-in-0 peer-focus:fade-in-0 peer-hover:zoom-in-95 group-data-[rbui--tooltip-placement-value=bottom]:slide-in-from-top-2 group-data-[rbui--tooltip-placement-value=left]:slide-in-from-right-2 group-data-[rbui--tooltip-placement-value=right]:slide-in-from-left-2 group-data-[rbui--tooltip-placement-value=top]:slide-in-from-bottom-2 delay-500"
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RBUI
|
4
|
+
class TooltipTrigger < Base
|
5
|
+
def view_template(&)
|
6
|
+
div(**attrs, &)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def default_attrs
|
12
|
+
{
|
13
|
+
data: {rbui__tooltip_target: "trigger"},
|
14
|
+
variant: :outline,
|
15
|
+
class: "peer"
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RBUI
|
4
|
+
class TypographyH1 < Base
|
5
|
+
def view_template(&)
|
6
|
+
h1(**attrs, &)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def default_attrs
|
12
|
+
{
|
13
|
+
class: "scroll-m-20 text-3xl font-bold leading-normal lg:leading-normal tracking-tight lg:text-4xl"
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RBUI
|
4
|
+
class TypographyH2 < Base
|
5
|
+
def view_template(&)
|
6
|
+
h2(**attrs, &)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def default_attrs
|
12
|
+
{
|
13
|
+
class: "scroll-m-20 text-2xl font-semibold tracking-tight transition-colors first:mt-0 pb-4 border-b"
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RBUI
|
4
|
+
class TypographyH3 < Base
|
5
|
+
def view_template(&)
|
6
|
+
h3(**attrs, &)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def default_attrs
|
12
|
+
{
|
13
|
+
class: "scroll-m-20 text-xl font-semibold tracking-tight"
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RBUI
|
4
|
+
class TypographyInlineCode < Base
|
5
|
+
def view_template(&)
|
6
|
+
code(**attrs, &)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def default_attrs
|
12
|
+
{
|
13
|
+
class: "relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold"
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RBUI
|
4
|
+
class TypographyInlineLink < Base
|
5
|
+
def initialize(href:, **attrs)
|
6
|
+
super(**attrs)
|
7
|
+
@href = href
|
8
|
+
end
|
9
|
+
|
10
|
+
def view_template(&)
|
11
|
+
a(href: @href, **attrs, &)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def default_attrs
|
17
|
+
{
|
18
|
+
class: "text-primary font-medium hover:underline underline-offset-4 cursor-pointer"
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RBUI
|
4
|
+
class TypographyList < Base
|
5
|
+
def initialize(items: [], numbered: false, **attrs)
|
6
|
+
@items = items
|
7
|
+
@numbered = numbered
|
8
|
+
super(**attrs)
|
9
|
+
end
|
10
|
+
|
11
|
+
def view_template(&)
|
12
|
+
if @items.empty?
|
13
|
+
list(**attrs, &)
|
14
|
+
else
|
15
|
+
list(**attrs) do
|
16
|
+
@items.each do |item|
|
17
|
+
TypographyListItem { item }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def list(**attrs, &)
|
26
|
+
if numbered?
|
27
|
+
ol(**attrs, &)
|
28
|
+
else
|
29
|
+
ul(**attrs, &)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def numbered? = @numbered
|
34
|
+
|
35
|
+
def not_numbered? = !numbered?
|
36
|
+
|
37
|
+
def default_attrs
|
38
|
+
{
|
39
|
+
class: tokens(
|
40
|
+
"my-6 ml-6 [&>li]:mt-2 [&>li]:pl-2",
|
41
|
+
numbered?: "list-decimal marker:font-medium",
|
42
|
+
not_numbered?: "list-disc"
|
43
|
+
)
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/rbui/version.rb
ADDED
data/lib/rbui.rb
CHANGED
@@ -1,5 +1,44 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require "phlex"
|
5
|
+
|
6
|
+
module RBUI
|
7
|
+
extend Phlex::Kit
|
8
|
+
|
9
|
+
attr_accessor :namespace
|
10
|
+
|
11
|
+
def self.setup
|
12
|
+
yield self
|
13
|
+
create_namespace_module if namespace
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.create_namespace_module
|
17
|
+
source_module = self
|
18
|
+
mod = namespace.to_s.split("::").inject(Object) do |parent, const|
|
19
|
+
parent.const_get(const)
|
20
|
+
rescue
|
21
|
+
parent.const_set(const, Module.new)
|
22
|
+
end
|
23
|
+
|
24
|
+
mod.singleton_class.class_eval do
|
25
|
+
define_method :const_missing do |name|
|
26
|
+
source_module.const_defined?(name) ? source_module.const_get(name) : super(name)
|
27
|
+
end
|
28
|
+
|
29
|
+
define_method :method_missing do |name, *args, &block|
|
30
|
+
source_module.respond_to?(name) ? source_module.send(name, *args, &block) : super(name, *args, &block)
|
31
|
+
end
|
32
|
+
|
33
|
+
define_method :respond_to_missing? do |name, include_private = false|
|
34
|
+
source_module.respond_to?(name) || super(name, include_private)
|
35
|
+
end
|
36
|
+
end
|
4
37
|
end
|
5
38
|
end
|
39
|
+
|
40
|
+
# Require the Base class first
|
41
|
+
require_relative "rbui/base"
|
42
|
+
|
43
|
+
# Manually require all the files
|
44
|
+
Dir.glob(File.join(__dir__, "rbui", "**", "*.rb")).sort.each { |file| require file }
|