shadcn_phlexcomponents 0.1.0 → 0.1.2

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 (152) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/tailwind/choices.css +324 -0
  3. data/app/assets/tailwind/vanilla-calendar-pro.css +5 -0
  4. data/app/javascript/controllers/combobox_controller.js +19 -276
  5. data/app/javascript/controllers/date_picker_controller.js +118 -0
  6. data/app/javascript/controllers/date_range_picker_controller.js +231 -0
  7. data/app/javascript/controllers/dropdown_menu_controller.js +1 -1
  8. data/app/javascript/controllers/hover_card_controller.js +33 -126
  9. data/app/javascript/controllers/sidebar_controller.js +0 -1
  10. data/app/javascript/controllers/tooltip_controller.js +32 -126
  11. data/lib/components/accordion.rb +3 -3
  12. data/lib/components/accordion_content.rb +12 -10
  13. data/lib/components/accordion_item.rb +3 -3
  14. data/lib/components/accordion_trigger.rb +3 -3
  15. data/lib/components/alert_description.rb +1 -1
  16. data/lib/components/alert_dialog.rb +2 -2
  17. data/lib/components/alert_dialog_action.rb +2 -2
  18. data/lib/components/alert_dialog_action_to.rb +5 -2
  19. data/lib/components/alert_dialog_cancel.rb +1 -1
  20. data/lib/components/alert_dialog_content.rb +1 -1
  21. data/lib/components/alert_dialog_description.rb +1 -1
  22. data/lib/components/alert_dialog_footer.rb +1 -1
  23. data/lib/components/alert_dialog_header.rb +1 -1
  24. data/lib/components/alert_dialog_title.rb +1 -1
  25. data/lib/components/alert_dialog_trigger.rb +2 -2
  26. data/lib/components/aspect_ratio.rb +1 -1
  27. data/lib/components/avatar.rb +1 -1
  28. data/lib/components/avatar_fallback.rb +1 -1
  29. data/lib/components/avatar_image.rb +1 -2
  30. data/lib/components/badge.rb +2 -8
  31. data/lib/components/base.rb +5 -5
  32. data/lib/components/breadcrumb.rb +1 -1
  33. data/lib/components/breadcrumb_ellipsis.rb +1 -1
  34. data/lib/components/breadcrumb_item.rb +1 -1
  35. data/lib/components/breadcrumb_link.rb +1 -1
  36. data/lib/components/breadcrumb_page.rb +1 -1
  37. data/lib/components/breadcrumb_separator.rb +1 -1
  38. data/lib/components/button.rb +1 -1
  39. data/lib/components/card.rb +1 -1
  40. data/lib/components/card_content.rb +1 -1
  41. data/lib/components/card_description.rb +1 -1
  42. data/lib/components/card_footer.rb +1 -1
  43. data/lib/components/card_header.rb +1 -1
  44. data/lib/components/card_title.rb +1 -1
  45. data/lib/components/checkbox.rb +14 -10
  46. data/lib/components/checkbox_group.rb +26 -9
  47. data/lib/components/collapsible.rb +2 -3
  48. data/lib/components/collapsible_content.rb +2 -3
  49. data/lib/components/collapsible_trigger.rb +5 -5
  50. data/lib/components/combobox.rb +57 -0
  51. data/lib/components/combobox_item.rb +9 -0
  52. data/lib/components/date_picker.rb +94 -0
  53. data/lib/components/date_range_picker.rb +113 -0
  54. data/lib/components/dialog.rb +1 -1
  55. data/lib/components/dialog_close.rb +1 -1
  56. data/lib/components/dialog_content.rb +2 -2
  57. data/lib/components/dialog_description.rb +1 -1
  58. data/lib/components/dialog_footer.rb +1 -1
  59. data/lib/components/dialog_header.rb +1 -1
  60. data/lib/components/dialog_title.rb +1 -1
  61. data/lib/components/dialog_trigger.rb +2 -2
  62. data/lib/components/dropdown_menu.rb +5 -5
  63. data/lib/components/dropdown_menu_content.rb +12 -9
  64. data/lib/components/dropdown_menu_item.rb +5 -6
  65. data/lib/components/dropdown_menu_item_to.rb +6 -3
  66. data/lib/components/dropdown_menu_label.rb +2 -3
  67. data/lib/components/dropdown_menu_separator.rb +5 -5
  68. data/lib/components/dropdown_menu_trigger.rb +9 -10
  69. data/lib/components/form.rb +59 -0
  70. data/lib/components/form_error.rb +17 -0
  71. data/lib/components/form_hint.rb +17 -0
  72. data/lib/components/form_input.rb +49 -0
  73. data/lib/components/hover_card.rb +6 -6
  74. data/lib/components/hover_card_content.rb +8 -12
  75. data/lib/components/hover_card_trigger.rb +5 -11
  76. data/lib/components/input.rb +1 -1
  77. data/lib/components/label.rb +1 -2
  78. data/lib/components/link.rb +5 -2
  79. data/lib/components/loading_button.rb +1 -1
  80. data/lib/components/pagination.rb +4 -4
  81. data/lib/components/pagination_ellipsis.rb +3 -3
  82. data/lib/components/pagination_link.rb +5 -5
  83. data/lib/components/pagination_next.rb +5 -5
  84. data/lib/components/pagination_previous.rb +4 -4
  85. data/lib/components/popover.rb +6 -7
  86. data/lib/components/popover_content.rb +13 -10
  87. data/lib/components/popover_trigger.rb +5 -6
  88. data/lib/components/progress.rb +7 -7
  89. data/lib/components/radio_group.rb +4 -4
  90. data/lib/components/radio_group_item.rb +8 -8
  91. data/lib/components/select.rb +67 -72
  92. data/lib/components/select_content.rb +12 -7
  93. data/lib/components/select_group.rb +3 -3
  94. data/lib/components/select_item.rb +9 -8
  95. data/lib/components/select_label.rb +6 -5
  96. data/lib/components/select_trigger.rb +12 -10
  97. data/lib/components/separator.rb +3 -3
  98. data/lib/components/sheet.rb +9 -9
  99. data/lib/components/sheet_close.rb +4 -4
  100. data/lib/components/sheet_content.rb +13 -15
  101. data/lib/components/sheet_description.rb +3 -3
  102. data/lib/components/sheet_footer.rb +2 -2
  103. data/lib/components/sheet_header.rb +2 -2
  104. data/lib/components/sheet_title.rb +3 -3
  105. data/lib/components/sheet_trigger.rb +6 -6
  106. data/lib/components/sidebar.rb +30 -25
  107. data/lib/components/sidebar_container.rb +1 -1
  108. data/lib/components/sidebar_content.rb +1 -1
  109. data/lib/components/sidebar_footer.rb +2 -2
  110. data/lib/components/sidebar_group.rb +1 -1
  111. data/lib/components/sidebar_group_content.rb +1 -1
  112. data/lib/components/sidebar_group_label.rb +2 -2
  113. data/lib/components/sidebar_header.rb +2 -2
  114. data/lib/components/sidebar_inset.rb +1 -1
  115. data/lib/components/sidebar_menu.rb +2 -2
  116. data/lib/components/sidebar_menu_button.rb +5 -5
  117. data/lib/components/sidebar_menu_item.rb +1 -1
  118. data/lib/components/sidebar_menu_sub.rb +2 -2
  119. data/lib/components/sidebar_menu_sub_button.rb +7 -7
  120. data/lib/components/sidebar_menu_sub_item.rb +1 -1
  121. data/lib/components/sidebar_trigger.rb +5 -5
  122. data/lib/components/skeleton.rb +2 -2
  123. data/lib/components/switch.rb +10 -9
  124. data/lib/components/table.rb +7 -5
  125. data/lib/components/table_body.rb +2 -2
  126. data/lib/components/table_caption.rb +2 -2
  127. data/lib/components/table_cell.rb +2 -2
  128. data/lib/components/table_footer.rb +2 -2
  129. data/lib/components/table_head.rb +3 -3
  130. data/lib/components/table_header.rb +2 -2
  131. data/lib/components/table_row.rb +2 -2
  132. data/lib/components/tabs.rb +3 -3
  133. data/lib/components/tabs_content.rb +5 -5
  134. data/lib/components/tabs_list.rb +4 -4
  135. data/lib/components/tabs_trigger.rb +3 -3
  136. data/lib/components/textarea.rb +1 -1
  137. data/lib/components/theme_switcher.rb +2 -2
  138. data/lib/components/toast.rb +15 -14
  139. data/lib/components/toast_action.rb +5 -4
  140. data/lib/components/toast_action_to.rb +5 -2
  141. data/lib/components/toast_container.rb +5 -5
  142. data/lib/components/toast_content.rb +1 -1
  143. data/lib/components/toast_description.rb +1 -1
  144. data/lib/components/toast_title.rb +1 -1
  145. data/lib/components/tooltip.rb +8 -8
  146. data/lib/components/tooltip_content.rb +8 -11
  147. data/lib/components/tooltip_trigger.rb +9 -11
  148. data/lib/shadcn_phlexcomponents/alias.rb +4 -93
  149. data/lib/shadcn_phlexcomponents/version.rb +1 -1
  150. metadata +14 -5
  151. data/app/javascript/controllers/datepicker_controller.js +0 -47
  152. data/lib/components/datepicker.rb +0 -38
@@ -22,8 +22,8 @@ module ShadcnPhlexcomponents
22
22
  if element.name == "button"
23
23
  merged_attributes.delete(:role)
24
24
  end
25
-
26
- send(element.name, **merged_attributes) do
25
+
26
+ send(element.name, **merged_attributes) do
27
27
  sanitize_as_child(element.children.to_s)
28
28
  end
29
29
  else
@@ -37,14 +37,14 @@ module ShadcnPhlexcomponents
37
37
  aria: {
38
38
  haspopup: "dialog",
39
39
  expanded: false,
40
- controls: "#{@aria_id}-content"
40
+ controls: "#{@aria_id}-content",
41
41
  },
42
42
  data: {
43
43
  as_child: @as_child.to_s,
44
44
  action: "click->shadcn-phlexcomponents--sheet#open",
45
- "shadcn-phlexcomponents--sheet-target": "trigger"
46
- }
45
+ "shadcn-phlexcomponents--sheet-target": "trigger",
46
+ },
47
47
  }
48
48
  end
49
49
  end
50
- end
50
+ end
@@ -11,7 +11,7 @@ module ShadcnPhlexcomponents
11
11
  PANEL_STYLES = {
12
12
  sidebar: "group-data-[side=left]:border-r group-data-[side=right]:border-l",
13
13
  floating: "p-2",
14
- inset: "p-2"
14
+ inset: "p-2",
15
15
  }
16
16
 
17
17
  def initialize(id:, variant: :sidebar, side: :left, width: "16rem", expanded: true, **attributes)
@@ -46,11 +46,11 @@ module ShadcnPhlexcomponents
46
46
  def menu(**attributes, &)
47
47
  SidebarMenu(**attributes, &)
48
48
  end
49
-
49
+
50
50
  def menu_item(**attributes, &)
51
51
  SidebarMenuItem(**attributes, &)
52
52
  end
53
-
53
+
54
54
  def menu_button(**attributes, &)
55
55
  SidebarMenuButton(**attributes, &)
56
56
  end
@@ -58,11 +58,11 @@ module ShadcnPhlexcomponents
58
58
  def menu_sub(**attributes, &)
59
59
  SidebarMenuSub(**attributes, &)
60
60
  end
61
-
61
+
62
62
  def menu_sub_item(**attributes, &)
63
63
  SidebarMenuSubItem(**attributes, &)
64
64
  end
65
-
65
+
66
66
  def menu_sub_button(**attributes, &)
67
67
  SidebarMenuSubButton(**attributes, &)
68
68
  end
@@ -72,32 +72,37 @@ module ShadcnPhlexcomponents
72
72
  end
73
73
 
74
74
  def view_template(&)
75
- div(id: @id,
76
- class: "group peer hidden md:block",
77
- style: { "--sidebar-width": @width },
78
- data: {
79
- side: @side,
80
- variant: @variant,
81
- collapsible: @expanded ? "" : "offcanvas",
82
- sidebar_id: @sidebar_id,
83
- state: @expanded ? "expanded" : "collapsed",
84
- controller: "shadcn-phlexcomponents--sidebar"
85
- }) do
86
- div(class: "relative h-svh w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200
75
+ div(
76
+ id: @id,
77
+ class: "group peer hidden md:block",
78
+ style: { "--sidebar-width": @width },
79
+ data: {
80
+ side: @side,
81
+ variant: @variant,
82
+ collapsible: @expanded ? "" : "offcanvas",
83
+ sidebar_id: @sidebar_id,
84
+ state: @expanded ? "expanded" : "collapsed",
85
+ controller: "shadcn-phlexcomponents--sidebar",
86
+ },
87
+ ) do
88
+ div(
89
+ class: "relative h-svh w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200
87
90
  ease-linear group-data-[collapsible=offcanvas]:w-0 group-data-[side=right]:rotate-180
88
- group-data-[collapsible=icon]:w-[--sidebar-width-icon]", data: { "shadcn-phlexcomponents--sidebar-target": "panelOffset" })
89
-
91
+ group-data-[collapsible=icon]:w-[--sidebar-width-icon]",
92
+ data: { "shadcn-phlexcomponents--sidebar-target": "panelOffset" },
93
+ )
90
94
 
91
- div(class: "fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200
95
+ div(
96
+ class: "fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200
92
97
  ease-linear md:flex left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]
93
98
  group-data-[collapsible=icon]:w-[--sidebar-width-icon] #{PANEL_STYLES[@variant]}",
94
- data: {
95
- "shadcn-phlexcomponents--sidebar-target": "panel"
96
- }) do
97
-
99
+ data: {
100
+ "shadcn-phlexcomponents--sidebar-target": "panel",
101
+ },
102
+ ) do
98
103
  div(**@attributes, &)
99
104
  end
100
105
  end
101
106
  end
102
107
  end
103
- end
108
+ end
@@ -8,4 +8,4 @@ module ShadcnPhlexcomponents
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -8,4 +8,4 @@ module ShadcnPhlexcomponents
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class SidebarFooter < Base
5
- STYLES = "flex flex-col gap-2 p-2".freeze
5
+ STYLES = "flex flex-col gap-2 p-2"
6
6
 
7
7
  def view_template(&)
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -8,4 +8,4 @@ module ShadcnPhlexcomponents
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -8,4 +8,4 @@ module ShadcnPhlexcomponents
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -8,9 +8,9 @@ module ShadcnPhlexcomponents
8
8
  duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0
9
9
  group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0
10
10
  HEREDOC
11
-
11
+
12
12
  def view_template(&)
13
13
  div(**@attributes, &)
14
14
  end
15
15
  end
16
- end
16
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class SidebarHeader < Base
5
- STYLES = "flex flex-col gap-2 p-2".freeze
5
+ STYLES = "flex flex-col gap-2 p-2"
6
6
 
7
7
  def view_template(&)
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -12,4 +12,4 @@ module ShadcnPhlexcomponents
12
12
  main(**@attributes, &)
13
13
  end
14
14
  end
15
- end
15
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class SidebarMenu < Base
5
- STYLES = "flex w-full min-w-0 flex-col gap-1".freeze
5
+ STYLES = "flex w-full min-w-0 flex-col gap-1"
6
6
 
7
7
  def view_template(&)
8
8
  ul(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -30,9 +30,9 @@ module ShadcnPhlexcomponents
30
30
  def default_attributes
31
31
  {
32
32
  data: {
33
- active: @active.to_s
34
- }
35
- }
33
+ active: @active.to_s,
34
+ },
35
+ }
36
36
  end
37
37
 
38
38
  def default_styles
@@ -50,7 +50,7 @@ module ShadcnPhlexcomponents
50
50
  merged_attributes = mix(@attributes, element_attributes)
51
51
  merged_attributes[:class] = styles
52
52
 
53
- send(element.name, **merged_attributes) do
53
+ send(element.name, **merged_attributes) do
54
54
  sanitize_as_child(element.children.to_s)
55
55
  end
56
56
  else
@@ -58,4 +58,4 @@ module ShadcnPhlexcomponents
58
58
  end
59
59
  end
60
60
  end
61
- end
61
+ end
@@ -6,4 +6,4 @@ module ShadcnPhlexcomponents
6
6
  li(**@attributes, &)
7
7
  end
8
8
  end
9
- end
9
+ end
@@ -4,11 +4,11 @@ module ShadcnPhlexcomponents
4
4
  class SidebarMenuSub < Base
5
5
  STYLES = <<~HEREDOC
6
6
  border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col
7
- gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden
7
+ gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden#{" "}
8
8
  HEREDOC
9
9
 
10
10
  def view_template(&)
11
11
  ul(**@attributes, &)
12
12
  end
13
13
  end
14
- end
14
+ end
@@ -7,8 +7,8 @@ module ShadcnPhlexcomponents
7
7
  active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground
8
8
  flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-none
9
9
  focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none
10
- aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0
11
- data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground
10
+ aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0#{" "}
11
+ data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground#{" "}
12
12
  text-sm group-data-[collapsible=icon]:hidden cursor-pointer
13
13
  HEREDOC
14
14
 
@@ -21,9 +21,9 @@ module ShadcnPhlexcomponents
21
21
  def default_attributes
22
22
  {
23
23
  data: {
24
- active: @active.to_s
25
- }
26
- }
24
+ active: @active.to_s,
25
+ },
26
+ }
27
27
  end
28
28
 
29
29
  def view_template(&)
@@ -37,7 +37,7 @@ module ShadcnPhlexcomponents
37
37
  merged_attributes = mix(@attributes, element_attributes)
38
38
  merged_attributes[:class] = styles
39
39
 
40
- send(element.name, **merged_attributes) do
40
+ send(element.name, **merged_attributes) do
41
41
  sanitize_as_child(element.children.to_s)
42
42
  end
43
43
  else
@@ -45,4 +45,4 @@ module ShadcnPhlexcomponents
45
45
  end
46
46
  end
47
47
  end
48
- end
48
+ end
@@ -6,4 +6,4 @@ module ShadcnPhlexcomponents
6
6
  li(**@attributes, &)
7
7
  end
8
8
  end
9
- end
9
+ end
@@ -14,15 +14,15 @@ module ShadcnPhlexcomponents
14
14
  @sidebar_id = sidebar_id
15
15
  super(**attributes)
16
16
  end
17
-
17
+
18
18
  def default_attributes
19
19
  {
20
20
  data: {
21
21
  sidebar_id: @sidebar_id,
22
22
  controller: "shadcn-phlexcomponents--sidebar-trigger",
23
- action: "click->shadcn-phlexcomponents--sidebar-trigger#toggle"
24
- }
25
- }
23
+ action: "click->shadcn-phlexcomponents--sidebar-trigger#toggle",
24
+ },
25
+ }
26
26
  end
27
27
 
28
28
  def view_template(&)
@@ -37,4 +37,4 @@ module ShadcnPhlexcomponents
37
37
  end
38
38
  end
39
39
  end
40
- end
40
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class Skeleton < Base
5
- STYLES = "animate-pulse rounded-md bg-primary/10".freeze
5
+ STYLES = "animate-pulse rounded-md bg-primary/10"
6
6
 
7
7
  def view_template(&)
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -2,15 +2,16 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class Switch < Base
5
- STYLES = <<~HEREDOC.freeze
5
+ STYLES = <<~HEREDOC
6
6
  peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full
7
- border-2 border-transparent transition-colors focus-visible:outline-none
7
+ border-2 border-transparent transition-colors focus-visible:outline-none#{" "}
8
8
  focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
9
9
  focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50
10
10
  data-[checked=true]:bg-primary data-[checked=false]:bg-input group/switch
11
11
  HEREDOC
12
12
 
13
- def initialize(name: nil, value: "1", unchecked_value: "0", checked: false, id: nil, include_hidden: true, **attributes)
13
+ def initialize(name: nil, value: "1", unchecked_value: "0", checked: false, id: nil, include_hidden: true,
14
+ **attributes)
14
15
  @name = name
15
16
  @value = value
16
17
  @unchecked_value = unchecked_value
@@ -31,7 +32,7 @@ module ShadcnPhlexcomponents
31
32
  end
32
33
 
33
34
  input(
34
- type: "checkbox",
35
+ type: "checkbox",
35
36
  value: @value,
36
37
  class: "-translate-x-full pointer-events-none absolute top-0 left-0 size-4 opacity-0",
37
38
  name: @name,
@@ -39,14 +40,14 @@ module ShadcnPhlexcomponents
39
40
  checked: @checked,
40
41
  aria: { hidden: true },
41
42
  data: {
42
- "shadcn-phlexcomponents--switch-target": "input"
43
- }
43
+ "shadcn-phlexcomponents--switch-target": "input",
44
+ },
44
45
  )
45
46
  end
46
47
  end
47
48
 
48
49
  def default_attributes
49
- {
50
+ {
50
51
  id: @id,
51
52
  type: "button",
52
53
  role: "switch",
@@ -58,8 +59,8 @@ module ShadcnPhlexcomponents
58
59
  controller: "shadcn-phlexcomponents--switch",
59
60
  action: "click->shadcn-phlexcomponents--switch#toggle",
60
61
  "shadcn-phlexcomponents--switch-checked-value": @checked,
61
- }
62
+ },
62
63
  }
63
64
  end
64
65
  end
65
- end
66
+ end
@@ -2,9 +2,9 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class Table < Base
5
- STYLES = "w-full caption-bottom text-sm".freeze
5
+ STYLES = "w-full caption-bottom text-sm"
6
6
 
7
- def initialize( **attributes)
7
+ def initialize(**attributes)
8
8
  @columns = []
9
9
  super(**attributes)
10
10
  end
@@ -15,7 +15,7 @@ module ShadcnPhlexcomponents
15
15
 
16
16
  def header(**attributes, &)
17
17
  TableHeader(**attributes, &)
18
- end
18
+ end
19
19
 
20
20
  def caption(**attributes, &)
21
21
  TableCaption(**attributes, &)
@@ -58,7 +58,9 @@ module ShadcnPhlexcomponents
58
58
  @rows.each do |row|
59
59
  tr(class: TableRow::STYLES) do
60
60
  @columns.each do |column|
61
- td(class: TAILWIND_MERGER.merge("#{TableCell::STYLES} #{column[:cell_class]}")) { column[:content].call(row) }
61
+ td(class: TAILWIND_MERGER.merge("#{TableCell::STYLES} #{column[:cell_class]}")) do
62
+ column[:content].call(row)
63
+ end
62
64
  end
63
65
  end
64
66
  end
@@ -70,4 +72,4 @@ module ShadcnPhlexcomponents
70
72
  nil
71
73
  end
72
74
  end
73
- end
75
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class TableBody < Base
5
- STYLES = "[&_tr:last-child]:border-0".freeze
5
+ STYLES = "[&_tr:last-child]:border-0"
6
6
 
7
7
  def view_template(&)
8
8
  tbody(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class TableCaption < Base
5
- STYLES = "mt-4 text-sm text-muted-foreground".freeze
5
+ STYLES = "mt-4 text-sm text-muted-foreground"
6
6
 
7
7
  def view_template(&)
8
8
  caption(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class TableCell < Base
5
- STYLES = "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]".freeze
5
+ STYLES = "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"
6
6
 
7
7
  def view_template(&)
8
8
  td(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class TableFooter < Base
5
- STYLES = "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0".freeze
5
+ STYLES = "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0"
6
6
 
7
7
  def view_template(&)
8
8
  tfoot(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -4,11 +4,11 @@ module ShadcnPhlexcomponents
4
4
  class TableHead < Base
5
5
  STYLES = <<~HEREDOC
6
6
  h-10 px-2 text-left align-middle font-medium text-muted-foreground
7
- [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]
7
+ [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]#{" "}
8
8
  HEREDOC
9
-
9
+
10
10
  def view_template(&)
11
11
  th(**@attributes, &)
12
12
  end
13
13
  end
14
- end
14
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class TableHeader < Base
5
- STYLES = "[&_tr]:border-b".freeze
5
+ STYLES = "[&_tr]:border-b"
6
6
 
7
7
  def view_template(&)
8
8
  thead(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class TableRow < Base
5
- STYLES = "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted".freeze
5
+ STYLES = "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
6
6
 
7
7
  def view_template(&)
8
8
  tr(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -18,8 +18,8 @@ module ShadcnPhlexcomponents
18
18
  dir: @dir,
19
19
  data: {
20
20
  controller: "shadcn-phlexcomponents--tabs",
21
- "shadcn-phlexcomponents--tabs-selected-value": @value
22
- }
21
+ "shadcn-phlexcomponents--tabs-selected-value": @value,
22
+ },
23
23
  }
24
24
  end
25
25
 
@@ -35,4 +35,4 @@ module ShadcnPhlexcomponents
35
35
  TabsContent(aria_id: @aria_id, **attributes, &)
36
36
  end
37
37
  end
38
- end
38
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class TabsContent < Base
5
- STYLES = <<~HEREDOC.freeze
5
+ STYLES = <<~HEREDOC
6
6
  mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2
7
7
  focus-visible:ring-ring focus-visible:ring-offset-2 hidden
8
8
  HEREDOC
@@ -23,13 +23,13 @@ module ShadcnPhlexcomponents
23
23
  role: "tabpanel",
24
24
  tabindex: "0",
25
25
  aria: {
26
- labelledby: "#{@aria_id}-trigger-#{@value}"
26
+ labelledby: "#{@aria_id}-trigger-#{@value}",
27
27
  },
28
28
  data: {
29
29
  value: @value,
30
- "shadcn-phlexcomponents--tabs-target": "content"
31
- }
30
+ "shadcn-phlexcomponents--tabs-target": "content",
31
+ },
32
32
  }
33
33
  end
34
34
  end
35
- end
35
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class TabsList < Base
5
- STYLES = <<~HEREDOC.freeze
5
+ STYLES = <<~HEREDOC
6
6
  inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground outline-none
7
7
  HEREDOC
8
8
 
@@ -15,9 +15,9 @@ module ShadcnPhlexcomponents
15
15
  role: "tablist",
16
16
  tabindex: "-1",
17
17
  aria: {
18
- orientation: "horizontal"
19
- }
18
+ orientation: "horizontal",
19
+ },
20
20
  }
21
21
  end
22
22
  end
23
- end
23
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class TabsTrigger < Base
5
- STYLES = <<~HEREDOC.freeze
5
+ STYLES = <<~HEREDOC
6
6
  inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm
7
7
  font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2
8
8
  focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50
@@ -38,8 +38,8 @@ module ShadcnPhlexcomponents
38
38
  keydown.left->shadcn-phlexcomponents--tabs#setActiveToPrev:prevent
39
39
  keydown.right->shadcn-phlexcomponents--tabs#setActiveToNext:prevent
40
40
  HEREDOC
41
- }
41
+ },
42
42
  }
43
43
  end
44
44
  end
45
- end
45
+ end
@@ -25,4 +25,4 @@ module ShadcnPhlexcomponents
25
25
  textarea(**@attributes, &)
26
26
  end
27
27
  end
28
- end
28
+ end
@@ -3,7 +3,7 @@
3
3
  module ShadcnPhlexcomponents
4
4
  class ThemeSwitcher < Base
5
5
  def view_template
6
- Button(variant: :ghost, size: :icon, **@attributes)do
6
+ Button(variant: :ghost, size: :icon, **@attributes) do
7
7
  icon("sun", class: "hidden dark:inline")
8
8
  icon("moon", class: "inline dark:hidden")
9
9
  end
@@ -18,4 +18,4 @@ module ShadcnPhlexcomponents
18
18
  }
19
19
  end
20
20
  end
21
- end
21
+ end