ruby_ui 1.0.0.beta1 → 1.0.0.pre.alpha.4

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.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/rbui/base_generator.rb +17 -0
  3. data/lib/generators/rbui/component_generator.rb +137 -0
  4. data/lib/generators/rbui/install/install_generator.rb +194 -0
  5. data/lib/{ruby_ui → rbui}/accordion/accordion.rb +1 -1
  6. data/lib/{ruby_ui → rbui}/accordion/accordion_content.rb +2 -2
  7. data/lib/{ruby_ui → rbui}/accordion/accordion_default_content.rb +1 -1
  8. data/lib/{ruby_ui → rbui}/accordion/accordion_default_trigger.rb +3 -3
  9. data/lib/{ruby_ui → rbui}/accordion/accordion_icon.rb +2 -2
  10. data/lib/{ruby_ui → rbui}/accordion/accordion_item.rb +4 -4
  11. data/lib/{ruby_ui → rbui}/accordion/accordion_trigger.rb +2 -3
  12. data/lib/{ruby_ui → rbui}/alert/alert.rb +2 -2
  13. data/lib/{ruby_ui → rbui}/alert/alert_description.rb +1 -1
  14. data/lib/{ruby_ui → rbui}/alert/alert_title.rb +1 -1
  15. data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog.rb +3 -3
  16. data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_action.rb +2 -2
  17. data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_cancel.rb +3 -3
  18. data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_content.rb +4 -4
  19. data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_description.rb +1 -1
  20. data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_footer.rb +1 -1
  21. data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_header.rb +1 -1
  22. data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_title.rb +1 -1
  23. data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_trigger.rb +2 -2
  24. data/lib/{ruby_ui → rbui}/aspect_ratio/aspect_ratio.rb +1 -1
  25. data/lib/{ruby_ui → rbui}/avatar/avatar.rb +2 -2
  26. data/lib/{ruby_ui → rbui}/avatar/avatar_fallback.rb +1 -1
  27. data/lib/{ruby_ui → rbui}/avatar/avatar_image.rb +1 -1
  28. data/lib/{ruby_ui → rbui}/badge/badge.rb +2 -2
  29. data/lib/{ruby_ui → rbui}/base.rb +8 -1
  30. data/lib/{ruby_ui → rbui}/button/button.rb +13 -13
  31. data/lib/rbui/calendar/calendar.rb +39 -0
  32. data/lib/{ruby_ui → rbui}/calendar/calendar_body.rb +2 -2
  33. data/lib/{ruby_ui → rbui}/calendar/calendar_days.rb +14 -14
  34. data/lib/{ruby_ui → rbui}/calendar/calendar_header.rb +1 -1
  35. data/lib/{ruby_ui → rbui}/calendar/calendar_next.rb +2 -2
  36. data/lib/{ruby_ui → rbui}/calendar/calendar_prev.rb +2 -2
  37. data/lib/{ruby_ui → rbui}/calendar/calendar_title.rb +2 -2
  38. data/lib/{ruby_ui → rbui}/calendar/calendar_weekdays.rb +2 -2
  39. data/lib/{ruby_ui → rbui}/card/card.rb +1 -1
  40. data/lib/{ruby_ui → rbui}/card/card_content.rb +1 -1
  41. data/lib/{ruby_ui → rbui}/card/card_description.rb +1 -1
  42. data/lib/{ruby_ui → rbui}/card/card_footer.rb +1 -1
  43. data/lib/{ruby_ui → rbui}/card/card_header.rb +1 -1
  44. data/lib/{ruby_ui → rbui}/card/card_title.rb +1 -1
  45. data/lib/{ruby_ui → rbui}/chart/chart.rb +3 -3
  46. data/lib/{ruby_ui → rbui}/checkbox/checkbox.rb +4 -4
  47. data/lib/{ruby_ui → rbui}/checkbox/checkbox_group.rb +2 -2
  48. data/lib/{ruby_ui → rbui}/clipboard/clipboard.rb +6 -6
  49. data/lib/{ruby_ui → rbui}/clipboard/clipboard_popover.rb +2 -2
  50. data/lib/{ruby_ui → rbui}/clipboard/clipboard_source.rb +2 -2
  51. data/lib/{ruby_ui → rbui}/clipboard/clipboard_trigger.rb +3 -3
  52. data/lib/{ruby_ui → rbui}/codeblock/codeblock.rb +10 -7
  53. data/lib/{ruby_ui → rbui}/collapsible/collapsible.rb +3 -3
  54. data/lib/{ruby_ui → rbui}/collapsible/collapsible_content.rb +2 -2
  55. data/lib/{ruby_ui → rbui}/collapsible/collapsible_trigger.rb +2 -2
  56. data/lib/rbui/combobox/combobox.rb +24 -0
  57. data/lib/rbui/combobox/combobox_content.rb +31 -0
  58. data/lib/{ruby_ui → rbui}/combobox/combobox_empty.rb +2 -2
  59. data/lib/{ruby_ui → rbui}/combobox/combobox_group.rb +2 -2
  60. data/lib/{ruby_ui → rbui}/combobox/combobox_input.rb +4 -4
  61. data/lib/{ruby_ui → rbui}/combobox/combobox_item.rb +5 -5
  62. data/lib/{ruby_ui → rbui}/combobox/combobox_list.rb +4 -2
  63. data/lib/{ruby_ui → rbui}/combobox/combobox_search_input.rb +3 -3
  64. data/lib/{ruby_ui → rbui}/combobox/combobox_separator.rb +1 -1
  65. data/lib/{ruby_ui → rbui}/combobox/combobox_trigger.rb +3 -3
  66. data/lib/{ruby_ui → rbui}/combobox/combobox_value.rb +2 -2
  67. data/lib/{ruby_ui → rbui}/command/command.rb +1 -1
  68. data/lib/{ruby_ui → rbui}/command/command_dialog.rb +2 -2
  69. data/lib/{ruby_ui → rbui}/command/command_dialog_content.rb +6 -6
  70. data/lib/{ruby_ui → rbui}/command/command_dialog_trigger.rb +3 -3
  71. data/lib/{ruby_ui → rbui}/command/command_empty.rb +2 -2
  72. data/lib/{ruby_ui → rbui}/command/command_group.rb +2 -2
  73. data/lib/{ruby_ui → rbui}/command/command_input.rb +3 -3
  74. data/lib/{ruby_ui → rbui}/command/command_item.rb +2 -2
  75. data/lib/{ruby_ui → rbui}/command/command_list.rb +1 -1
  76. data/lib/{ruby_ui → rbui}/context_menu/context_menu.rb +2 -2
  77. data/lib/{ruby_ui → rbui}/context_menu/context_menu_content.rb +2 -2
  78. data/lib/{ruby_ui → rbui}/context_menu/context_menu_item.rb +3 -3
  79. data/lib/{ruby_ui → rbui}/context_menu/context_menu_label.rb +2 -2
  80. data/lib/{ruby_ui → rbui}/context_menu/context_menu_separator.rb +1 -1
  81. data/lib/{ruby_ui → rbui}/context_menu/context_menu_trigger.rb +3 -3
  82. data/lib/{ruby_ui → rbui}/dialog/dialog.rb +3 -3
  83. data/lib/{ruby_ui → rbui}/dialog/dialog_content.rb +7 -7
  84. data/lib/{ruby_ui → rbui}/dialog/dialog_description.rb +1 -1
  85. data/lib/{ruby_ui → rbui}/dialog/dialog_footer.rb +1 -1
  86. data/lib/{ruby_ui → rbui}/dialog/dialog_header.rb +1 -1
  87. data/lib/{ruby_ui → rbui}/dialog/dialog_middle.rb +1 -1
  88. data/lib/{ruby_ui → rbui}/dialog/dialog_title.rb +1 -1
  89. data/lib/{ruby_ui → rbui}/dialog/dialog_trigger.rb +2 -2
  90. data/lib/{ruby_ui → rbui}/dropdown_menu/dropdown_menu.rb +4 -4
  91. data/lib/{ruby_ui → rbui}/dropdown_menu/dropdown_menu_content.rb +2 -2
  92. data/lib/{ruby_ui → rbui}/dropdown_menu/dropdown_menu_item.rb +3 -3
  93. data/lib/{ruby_ui → rbui}/dropdown_menu/dropdown_menu_label.rb +1 -1
  94. data/lib/{ruby_ui → rbui}/dropdown_menu/dropdown_menu_separator.rb +1 -1
  95. data/lib/{ruby_ui → rbui}/dropdown_menu/dropdown_menu_trigger.rb +2 -2
  96. data/lib/{ruby_ui → rbui}/form/form.rb +1 -1
  97. data/lib/{ruby_ui → rbui}/form/form_field.rb +2 -2
  98. data/lib/{ruby_ui → rbui}/form/form_field_error.rb +2 -2
  99. data/lib/{ruby_ui → rbui}/form/form_field_hint.rb +1 -1
  100. data/lib/{ruby_ui → rbui}/form/form_field_label.rb +1 -1
  101. data/lib/{ruby_ui → rbui}/hover_card/hover_card.rb +3 -3
  102. data/lib/{ruby_ui → rbui}/hover_card/hover_card_content.rb +2 -2
  103. data/lib/{ruby_ui → rbui}/hover_card/hover_card_trigger.rb +2 -2
  104. data/lib/{ruby_ui → rbui}/input/input.rb +3 -3
  105. data/lib/{ruby_ui → rbui}/link/link.rb +13 -13
  106. data/lib/{ruby_ui → rbui}/pagination/pagination.rb +1 -1
  107. data/lib/{ruby_ui → rbui}/pagination/pagination_content.rb +1 -1
  108. data/lib/{ruby_ui → rbui}/pagination/pagination_ellipsis.rb +1 -1
  109. data/lib/{ruby_ui → rbui}/pagination/pagination_item.rb +4 -4
  110. data/lib/{ruby_ui → rbui}/popover/popover.rb +4 -4
  111. data/lib/{ruby_ui → rbui}/popover/popover_content.rb +2 -2
  112. data/lib/{ruby_ui → rbui}/popover/popover_trigger.rb +2 -2
  113. data/lib/{ruby_ui → rbui}/radio_button/radio_button.rb +3 -3
  114. data/lib/rbui/railtie.rb +52 -0
  115. data/lib/{ruby_ui → rbui}/select/select.rb +5 -5
  116. data/lib/{ruby_ui → rbui}/select/select_content.rb +3 -3
  117. data/lib/{ruby_ui → rbui}/select/select_group.rb +1 -1
  118. data/lib/{ruby_ui → rbui}/select/select_input.rb +4 -4
  119. data/lib/{ruby_ui → rbui}/select/select_item.rb +4 -4
  120. data/lib/{ruby_ui → rbui}/select/select_label.rb +1 -1
  121. data/lib/{ruby_ui → rbui}/select/select_trigger.rb +3 -3
  122. data/lib/{ruby_ui → rbui}/select/select_value.rb +2 -2
  123. data/lib/{ruby_ui → rbui}/sheet/sheet.rb +2 -2
  124. data/lib/{ruby_ui → rbui}/sheet/sheet_content.rb +7 -7
  125. data/lib/{ruby_ui → rbui}/sheet/sheet_description.rb +1 -1
  126. data/lib/{ruby_ui → rbui}/sheet/sheet_footer.rb +1 -1
  127. data/lib/{ruby_ui → rbui}/sheet/sheet_header.rb +1 -1
  128. data/lib/{ruby_ui → rbui}/sheet/sheet_middle.rb +1 -1
  129. data/lib/{ruby_ui → rbui}/sheet/sheet_title.rb +1 -1
  130. data/lib/{ruby_ui → rbui}/sheet/sheet_trigger.rb +2 -2
  131. data/lib/{ruby_ui → rbui}/shortcut_key/shortcut_key.rb +1 -1
  132. data/lib/{ruby_ui → rbui}/table/table.rb +1 -1
  133. data/lib/{ruby_ui → rbui}/table/table_body.rb +1 -1
  134. data/lib/{ruby_ui → rbui}/table/table_caption.rb +1 -1
  135. data/lib/{ruby_ui → rbui}/table/table_cell.rb +1 -1
  136. data/lib/{ruby_ui → rbui}/table/table_footer.rb +1 -1
  137. data/lib/{ruby_ui → rbui}/table/table_head.rb +1 -1
  138. data/lib/{ruby_ui → rbui}/table/table_header.rb +1 -1
  139. data/lib/{ruby_ui → rbui}/table/table_row.rb +1 -1
  140. data/lib/{ruby_ui → rbui}/tabs/tabs.rb +3 -3
  141. data/lib/{ruby_ui → rbui}/tabs/tabs_content.rb +2 -2
  142. data/lib/{ruby_ui → rbui}/tabs/tabs_list.rb +1 -1
  143. data/lib/{ruby_ui → rbui}/tabs/tabs_trigger.rb +3 -3
  144. data/lib/{ruby_ui → rbui}/textarea/textarea.rb +3 -3
  145. data/lib/{ruby_ui → rbui}/theme_toggle/theme_toggle.rb +4 -4
  146. data/lib/{ruby_ui → rbui}/tooltip/tooltip.rb +3 -3
  147. data/lib/{ruby_ui → rbui}/tooltip/tooltip_content.rb +3 -3
  148. data/lib/{ruby_ui → rbui}/tooltip/tooltip_trigger.rb +2 -2
  149. data/lib/{ruby_ui → rbui}/typography/typography_blockquote.rb +1 -1
  150. data/lib/rbui/typography/typography_h1.rb +17 -0
  151. data/lib/rbui/typography/typography_h2.rb +17 -0
  152. data/lib/rbui/typography/typography_h3.rb +17 -0
  153. data/lib/rbui/typography/typography_h4.rb +17 -0
  154. data/lib/{ruby_ui/typography/inline_code.rb → rbui/typography/typography_inline_code.rb} +2 -2
  155. data/lib/{ruby_ui/typography/inline_link.rb → rbui/typography/typography_inline_link.rb} +2 -2
  156. data/lib/rbui/typography/typography_large.rb +17 -0
  157. data/lib/rbui/typography/typography_lead.rb +17 -0
  158. data/lib/rbui/typography/typography_list.rb +47 -0
  159. data/lib/rbui/typography/typography_list_item.rb +17 -0
  160. data/lib/rbui/typography/typography_muted.rb +17 -0
  161. data/lib/rbui/typography/typography_p.rb +17 -0
  162. data/lib/rbui/typography/typography_small.rb +17 -0
  163. data/lib/rbui/version.rb +5 -0
  164. data/lib/rbui.rb +57 -0
  165. data/lib/ruby_ui.rb +1 -5
  166. metadata +174 -163
  167. data/lib/generators/ruby_ui/component_generator.rb +0 -130
  168. data/lib/generators/ruby_ui/install/install_generator.rb +0 -90
  169. data/lib/generators/ruby_ui/javascript_utils.rb +0 -36
  170. data/lib/ruby_ui/calendar/calendar.rb +0 -39
  171. data/lib/ruby_ui/combobox/combobox.rb +0 -24
  172. data/lib/ruby_ui/combobox/combobox_content.rb +0 -31
  173. data/lib/ruby_ui/masked_input/masked_input.rb +0 -15
  174. data/lib/ruby_ui/typography/heading.rb +0 -60
  175. data/lib/ruby_ui/typography/text.rb +0 -53
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class DropdownMenuLabel < Base
5
5
  def view_template(&)
6
6
  h3(**attrs, &)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class DropdownMenuSeparator < Base
5
5
  def view_template
6
6
  div(**attrs)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class DropdownMenuTrigger < Base
5
5
  def view_template(&)
6
6
  div(**attrs, &)
@@ -10,7 +10,7 @@ module RubyUI
10
10
 
11
11
  def default_attrs
12
12
  {
13
- data: {ruby_ui__dropdown_menu_target: "trigger", action: "click->ruby-ui--dropdown-menu#toggle"},
13
+ data: {rbui__dropdown_menu_target: "trigger", action: "click->rbui--dropdown-menu#toggle"},
14
14
  class: "inline-block"
15
15
  }
16
16
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class Form < Base
5
5
  def view_template(&)
6
6
  form(**attrs, &)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class FormField < Base
5
5
  def view_template(&)
6
6
  div(**attrs, &)
@@ -11,7 +11,7 @@ module RubyUI
11
11
  def default_attrs
12
12
  {
13
13
  data: {
14
- controller: "ruby-ui--form-field"
14
+ controller: "rbui--form-field"
15
15
  },
16
16
  class: "space-y-2"
17
17
  }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class FormFieldError < Base
5
5
  def view_template(&)
6
6
  p(**attrs, &)
@@ -11,7 +11,7 @@ module RubyUI
11
11
  def default_attrs
12
12
  {
13
13
  data: {
14
- ruby_ui__form_field_target: "error"
14
+ rbui__form_field_target: "error"
15
15
  },
16
16
  class: "text-sm font-medium text-destructive"
17
17
  }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class FormFieldHint < Base
5
5
  def view_template(&)
6
6
  p(**attrs, &)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class FormFieldLabel < Base
5
5
  def view_template(&)
6
6
  label(**attrs, &)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class HoverCard < Base
5
5
  def initialize(option: {}, **attrs)
6
6
  @options = option
@@ -18,8 +18,8 @@ module RubyUI
18
18
  def default_attrs
19
19
  {
20
20
  data: {
21
- controller: "ruby-ui--hover-card",
22
- ruby_ui__hover_card_options_value: @options.to_json
21
+ controller: "rbui--hover-card",
22
+ rbui__hover_card_options_value: @options.to_json
23
23
  }
24
24
  }
25
25
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class HoverCardContent < Base
5
5
  def view_template(&block)
6
- template(data: {ruby_ui__hover_card_target: "content"}) do
6
+ template_tag(data: {rbui__hover_card_target: "content"}) do
7
7
  div(**attrs, &block)
8
8
  end
9
9
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class HoverCardTrigger < Base
5
5
  def view_template(&)
6
6
  div(**attrs, &)
@@ -11,7 +11,7 @@ module RubyUI
11
11
  def default_attrs
12
12
  {
13
13
  data: {
14
- ruby_ui__hover_card_target: "trigger"
14
+ rbui__hover_card_target: "trigger"
15
15
  },
16
16
  class: "inline-block"
17
17
  }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class Input < Base
5
5
  def initialize(type: :string, **attrs)
6
6
  @type = type.to_sym
@@ -16,8 +16,8 @@ module RubyUI
16
16
  def default_attrs
17
17
  {
18
18
  data: {
19
- ruby_ui__form_field_target: "input",
20
- action: "input->ruby-ui--form-field#onInput invalid->ruby-ui--form-field#onInvalid"
19
+ rbui__form_field_target: "input",
20
+ action: "input->rbui--form-field#onInput invalid->rbui--form-field#onInvalid"
21
21
  },
22
22
  class: "flex h-9 w-full rounded-md border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50 border-border focus-visible:ring-ring placeholder:text-muted-foreground"
23
23
  }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class Link < Base
5
5
  def initialize(href: "#", variant: :link, size: :md, icon: false, **attrs)
6
6
  @href = href
@@ -35,45 +35,45 @@ module RubyUI
35
35
  end
36
36
 
37
37
  def primary_classes
38
- [
38
+ tokens(
39
39
  "whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground shadow hover:bg-primary/90",
40
40
  size_classes
41
- ]
41
+ )
42
42
  end
43
43
 
44
44
  def link_classes
45
- [
45
+ tokens(
46
46
  "whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 text-primary underline-offset-4 hover:underline",
47
47
  size_classes
48
- ]
48
+ )
49
49
  end
50
50
 
51
51
  def secondary_classes
52
- [
52
+ tokens(
53
53
  "whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-secondary text-secondary-foreground hover:bg-opacity-80",
54
54
  size_classes
55
- ]
55
+ )
56
56
  end
57
57
 
58
58
  def destructive_classes
59
- [
59
+ tokens(
60
60
  "whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
61
61
  size_classes
62
- ]
62
+ )
63
63
  end
64
64
 
65
65
  def outline_classes
66
- [
66
+ tokens(
67
67
  "whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
68
68
  size_classes
69
- ]
69
+ )
70
70
  end
71
71
 
72
72
  def ghost_classes
73
- [
73
+ tokens(
74
74
  "whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground",
75
75
  size_classes
76
- ]
76
+ )
77
77
  end
78
78
 
79
79
  def default_classes
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class Pagination < Base
5
5
  def view_template(&)
6
6
  nav(**attrs, &)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class PaginationContent < Base
5
5
  def view_template(&)
6
6
  ul(**attrs, &)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class PaginationEllipsis < Base
5
5
  def view_template(&block)
6
6
  li do
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class PaginationItem < Base
5
5
  def initialize(href: "#", active: false, **attrs)
6
6
  @href = href
@@ -19,9 +19,9 @@ module RubyUI
19
19
  def default_attrs
20
20
  {
21
21
  aria: {current: @active ? "page" : nil},
22
- class: [
23
- RubyUI::Button.new(variant: @active ? :outline : :ghost).attrs[:class]
24
- ]
22
+ class: tokens(
23
+ RBUI::Button.new(variant: @active ? :outline : :ghost).attrs[:class]
24
+ )
25
25
  }
26
26
  end
27
27
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class Popover < Base
5
5
  def initialize(options: {}, **attrs)
6
6
  @options = options
@@ -16,9 +16,9 @@ module RubyUI
16
16
  def default_attrs
17
17
  {
18
18
  data: {
19
- controller: "ruby-ui--popover",
20
- ruby_ui__popover_options_value: @options.to_json,
21
- ruby_ui__popover_trigger_value: @options[:trigger] || "hover"
19
+ controller: "rbui--popover",
20
+ rbui__popover_options_value: @options.to_json,
21
+ rbui__popover_trigger_value: @options[:trigger] || "hover"
22
22
  }
23
23
  }
24
24
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class PopoverContent < Base
5
5
  def view_template(&)
6
6
  div(**attrs, &)
@@ -11,7 +11,7 @@ module RubyUI
11
11
  def default_attrs
12
12
  {
13
13
  data: {
14
- ruby_ui__popover_target: "content"
14
+ rbui__popover_target: "content"
15
15
  },
16
16
  class: [
17
17
  "hidden z-50 rounded-md border bg-background p-1 text-foreground shadow-md outline-none",
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class PopoverTrigger < Base
5
5
  def view_template(&)
6
6
  div(**attrs, &)
@@ -11,7 +11,7 @@ module RubyUI
11
11
  def default_attrs
12
12
  {
13
13
  data: {
14
- ruby_ui__popover_target: "trigger"
14
+ rbui__popover_target: "trigger"
15
15
  },
16
16
  class: "inline-block"
17
17
  }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class RadioButton < Base
5
5
  def view_template
6
6
  input(**attrs)
@@ -12,8 +12,8 @@ module RubyUI
12
12
  {
13
13
  type: "radio",
14
14
  data: {
15
- ruby_ui__form_field_target: "input",
16
- action: "change->ruby-ui--form-field#onInput invalid->ruby-ui--form-field#onInvalid"
15
+ rbui__form_field_target: "input",
16
+ action: "input->rbui--form-field#onInput invalid->rbui--form-field#onInvalid"
17
17
  },
18
18
  class: "h-4 w-4 p-0 border-primary rounded-full flex-none"
19
19
  }
@@ -0,0 +1,52 @@
1
+ module RBUI
2
+ if defined?(Rails)
3
+ class Railtie < ::Rails::Railtie
4
+ generators do
5
+ require_relative "../generators/rbui/install/install_generator"
6
+
7
+ config.app_generators do |g|
8
+ g.templates.unshift File.expand_path("../templates", __FILE__)
9
+ end
10
+
11
+ initializer "rbui.set_generator_namespace" do
12
+ Rails::Generators.namespace(RBUI::Generators, as: "rbui")
13
+ end
14
+ end
15
+
16
+ # Add component loading
17
+ config.to_prepare do
18
+ # Define the path to the RBUI components
19
+ rbui_components_path = Rails.root.join("app/components/rbui")
20
+
21
+ # Check if the RBUI components directory exists
22
+ if Dir.exist?(rbui_components_path)
23
+ # Find all Ruby files in the RBUI components directory and its subdirectories
24
+ Dir[rbui_components_path.join("**", "*.rb")].each do |file|
25
+ # Get the relative path of the file from the RBUI components directory
26
+ relative_path = Pathname.new(file).relative_path_from(rbui_components_path)
27
+
28
+ # Convert the file path to a component name
29
+ # e.g., "form/input.rb" becomes ["Form", "Input"]
30
+ component_name_parts = relative_path.to_s.chomp(".rb").split("/").map(&:camelize)
31
+
32
+ # Create the full component name with RBUI namespace
33
+ # e.g., "RBUI::Form::Input"
34
+ full_component_name = "RBUI::#{component_name_parts.join("::")}"
35
+
36
+ begin
37
+ # Check if the component is already defined
38
+ if defined?(full_component_name.constantize)
39
+ # If it's defined, load (or reload) the file
40
+ load file
41
+ end
42
+ rescue NameError
43
+ # If the constant isn't defined (i.e., the component doesn't exist),
44
+ # we'll skip this file and move to the next one
45
+ next
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class Select < Base
5
5
  def view_template(&)
6
6
  div(**attrs, &)
@@ -11,10 +11,10 @@ module RubyUI
11
11
  def default_attrs
12
12
  {
13
13
  data: {
14
- controller: "ruby-ui--select",
15
- ruby_ui__select_open_value: "false",
16
- action: "click@window->ruby-ui--select#clickOutside",
17
- ruby_ui__select_ruby_ui__select_item_outlet: ".item"
14
+ controller: "rbui--select",
15
+ rbui__select_open_value: "false",
16
+ action: "click@window->rbui--select#clickOutside",
17
+ rbui__select_rbui__select_item_outlet: ".item"
18
18
  },
19
19
  class: "group/select w-full relative"
20
20
  }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class SelectContent < Base
5
5
  def initialize(**attrs)
6
6
  @id = "content#{SecureRandom.hex(4)}"
@@ -10,7 +10,7 @@ module RubyUI
10
10
  def view_template(&block)
11
11
  div(**attrs) do
12
12
  div(
13
- class: "max-h-96 min-w-max overflow-auto rounded-md border bg-background p-1 text-foreground shadow-md animate-out group-data-[ruby-ui--select-open-value=true]/select:animate-in fade-out-0 group-data-[ruby-ui--select-open-value=true]/select:fade-in-0 zoom-out-95 group-data-[ruby-ui--select-open-value=true]/select:zoom-in-95 slide-in-from-top-2", &block
13
+ class: "max-h-96 min-w-max overflow-auto rounded-md border bg-background p-1 text-foreground shadow-md animate-out group-data-[rbui--select-open-value=true]/select:animate-in fade-out-0 group-data-[rbui--select-open-value=true]/select:fade-in-0 zoom-out-95 group-data-[rbui--select-open-value=true]/select:zoom-in-95 slide-in-from-top-2", &block
14
14
  )
15
15
  end
16
16
  end
@@ -23,7 +23,7 @@ module RubyUI
23
23
  role: "listbox",
24
24
  tabindex: "-1",
25
25
  data: {
26
- ruby_ui__select_target: "content"
26
+ rbui__select_target: "content"
27
27
  },
28
28
  class: "hidden w-full absolute top-0 left-0 z-50"
29
29
  }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class SelectGroup < Base
5
5
  def view_template(&)
6
6
  div(**attrs, &)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class SelectInput < Base
5
5
  def view_template
6
6
  input(**attrs)
@@ -12,9 +12,9 @@ module RubyUI
12
12
  {
13
13
  class: "hidden",
14
14
  data: {
15
- ruby_ui__select_target: "input",
16
- ruby_ui__form_field_target: "input",
17
- action: "change->ruby-ui--form-field#onChange invalid->ruby-ui--form-field#onInvalid"
15
+ rbui__select_target: "input",
16
+ rbui__form_field_target: "input",
17
+ action: "change->rbui--form-field#onChange invalid->rbui--form-field#onInvalid"
18
18
  }
19
19
  }
20
20
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class SelectItem < Base
5
5
  def initialize(value: nil, **attrs)
6
6
  @value = value
@@ -39,9 +39,9 @@ module RubyUI
39
39
  tabindex: "0",
40
40
  class: "item group relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
41
41
  data: {
42
- controller: "ruby-ui--select-item",
43
- action: "click->ruby-ui--select#selectItem keydown.enter->ruby-ui--select#selectItem keydown.down->ruby-ui--select#handleKeyDown keydown.up->ruby-ui--select#handleKeyUp keydown.esc->ruby-ui--select#handleEsc",
44
- ruby_ui__select_target: "item"
42
+ controller: "rbui--select-item",
43
+ action: "click->rbui--select#selectItem keydown.enter->rbui--select#selectItem keydown.down->rbui--select#handleKeyDown keydown.up->rbui--select#handleKeyUp keydown.esc->rbui--select#handleEsc",
44
+ rbui__select_target: "item"
45
45
  },
46
46
  data_value: @value,
47
47
  data_orientation: "vertical",
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class SelectLabel < Base
5
5
  def view_template(&)
6
6
  h3(**attrs, &)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class SelectTrigger < Base
5
5
  def view_template(&block)
6
6
  button(**attrs) do
@@ -34,8 +34,8 @@ module RubyUI
34
34
  def default_attrs
35
35
  {
36
36
  data: {
37
- action: "ruby-ui--select#onClick",
38
- ruby_ui__select_target: "trigger"
37
+ action: "rbui--select#onClick",
38
+ rbui__select_target: "trigger"
39
39
  },
40
40
  type: "button",
41
41
  role: "combobox",
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class SelectValue < Base
5
5
  def initialize(placeholder: nil, **attrs)
6
6
  @placeholder = placeholder
@@ -18,7 +18,7 @@ module RubyUI
18
18
  def default_attrs
19
19
  {
20
20
  data: {
21
- ruby_ui__select_target: "value"
21
+ rbui__select_target: "value"
22
22
  },
23
23
  class: "pointer-events-none"
24
24
  }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class Sheet < Base
5
5
  def view_template(&)
6
6
  div(**attrs, &)
@@ -10,7 +10,7 @@ module RubyUI
10
10
 
11
11
  def default_attrs
12
12
  {
13
- data: {controller: "ruby-ui--sheet"}
13
+ data: {controller: "rbui--sheet"}
14
14
  }
15
15
  end
16
16
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class SheetContent < Base
5
5
  SIDE_CLASS = {
6
6
  top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
@@ -16,8 +16,8 @@ module RubyUI
16
16
  end
17
17
 
18
18
  def view_template(&block)
19
- template(data: {ruby_ui__sheet_target: "content"}) do
20
- div(data: {controller: "ruby-ui--sheet-content"}) do
19
+ template_tag(data: {rbui__sheet_target: "content"}) do
20
+ div(data: {controller: "rbui--sheet-content"}) do
21
21
  backdrop
22
22
  div(**attrs) do
23
23
  block&.call
@@ -32,10 +32,10 @@ module RubyUI
32
32
  def default_attrs
33
33
  {
34
34
  data_state: "open", # For animate in
35
- class: [
35
+ class: tokens(
36
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",
37
37
  @side_classes
38
- ]
38
+ )
39
39
  }
40
40
  end
41
41
 
@@ -43,7 +43,7 @@ module RubyUI
43
43
  button(
44
44
  type: "button",
45
45
  class: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
46
- data_action: "click->ruby-ui--sheet-content#close"
46
+ data_action: "click->rbui--sheet-content#close"
47
47
  ) do
48
48
  svg(
49
49
  width: "15",
@@ -68,7 +68,7 @@ module RubyUI
68
68
  def backdrop
69
69
  div(
70
70
  data_state: "open",
71
- data_action: "click->ruby-ui--sheet-content#close",
71
+ data_action: "click->rbui--sheet-content#close",
72
72
  class:
73
73
  "fixed pointer-events-auto inset-0 z-50 bg-background/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"
74
74
  )
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class SheetDescription < Base
5
5
  def view_template(&)
6
6
  p(**attrs, &)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class SheetFooter < Base
5
5
  def view_template(&)
6
6
  div(**attrs, &)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module RubyUI
3
+ module RBUI
4
4
  class SheetHeader < Base
5
5
  def view_template(&)
6
6
  div(**attrs, &)