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
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class HoverCard < Base
5
- STYLES = "inline-block".freeze
5
+ STYLES = "inline-block"
6
6
 
7
7
  def initialize(side: :bottom, **attributes)
8
8
  @side = side
@@ -11,7 +11,7 @@ module ShadcnPhlexcomponents
11
11
 
12
12
  def content(**attributes, &)
13
13
  HoverCardContent(**attributes, &)
14
- end
14
+ end
15
15
 
16
16
  def trigger(**attributes, &)
17
17
  HoverCardTrigger(side: @side, **attributes, &)
@@ -21,13 +21,13 @@ module ShadcnPhlexcomponents
21
21
  {
22
22
  data: {
23
23
  controller: "shadcn-phlexcomponents--hover-card",
24
- side: @side
25
- }
26
- }
24
+ side: @side,
25
+ },
26
+ }
27
27
  end
28
28
 
29
29
  def view_template(&)
30
30
  div(**@attributes, &)
31
31
  end
32
32
  end
33
- end
33
+ end
@@ -2,22 +2,20 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class HoverCardContent < Base
5
- STYLES = <<~HEREDOC.freeze
6
- z-50 rounded-md border w-64 bg-popover p-4 text-popover-foreground shadow-md outline-none
7
- data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0
8
- data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95
5
+ STYLES = <<~HEREDOC
6
+ rounded-md border w-64 bg-popover p-4 text-popover-foreground shadow-md outline-none#{" "}
7
+ animate-in fade-in-0 zoom-in-95
9
8
  data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2
10
- data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2
9
+ data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2#{" "}
11
10
  HEREDOC
12
-
11
+
13
12
  def initialize(side: :bottom, **attributes)
14
13
  @side = side
15
14
  super(**attributes)
16
15
  end
17
16
 
18
-
19
17
  def view_template(&)
20
- div(class: 'hidden fixed top-0 left-0 w-max z-50', data: { "shadcn-phlexcomponents--hover-card-target": "contentWrapper" }) do
18
+ div(class: "hidden", data: { "shadcn-phlexcomponents--hover-card-target": "content" }) do
21
19
  div(**@attributes, &)
22
20
  end
23
21
  end
@@ -27,10 +25,8 @@ module ShadcnPhlexcomponents
27
25
  tabindex: -1,
28
26
  data: {
29
27
  side: @side,
30
- "shadcn-phlexcomponents--hover-card-target": "content",
31
- action: "mouseover->shadcn-phlexcomponents--hover-card#clearCloseTimer mouseout->shadcn-phlexcomponents--hover-card#closeWithDelay"
32
- }
28
+ },
33
29
  }
34
30
  end
35
31
  end
36
- end
32
+ end
@@ -21,8 +21,8 @@ module ShadcnPhlexcomponents
21
21
  if element.name == "button"
22
22
  merged_attributes.delete(:role)
23
23
  end
24
-
25
- send(element.name, **merged_attributes) do
24
+
25
+ send(element.name, **merged_attributes) do
26
26
  sanitize_as_child(element.children.to_s)
27
27
  end
28
28
  else
@@ -35,16 +35,10 @@ module ShadcnPhlexcomponents
35
35
  id: @id,
36
36
  role: "button",
37
37
  data: {
38
- state: "closed",
39
38
  as_child: @as_child.to_s,
40
- action: <<~HEREDOC,
41
- click->shadcn-phlexcomponents--hover-card#toggle
42
- mouseover->shadcn-phlexcomponents--hover-card#openWithDelay
43
- mouseout->shadcn-phlexcomponents--hover-card#closeWithDelay
44
- HEREDOC
45
- "shadcn-phlexcomponents--hover-card-target": "trigger"
46
- }
39
+ "shadcn-phlexcomponents--hover-card-target": "trigger",
40
+ },
47
41
  }
48
42
  end
49
43
  end
50
- end
44
+ end
@@ -29,4 +29,4 @@ module ShadcnPhlexcomponents
29
29
  input(**@attributes, &)
30
30
  end
31
31
  end
32
- end
32
+ end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ShadcnPhlexcomponents
4
-
5
4
  class Label < Base
6
5
  STYLES = <<~HEREDOC
7
6
  text-sm font-medium leading-none peer-disabled:cursor-not-allowed
@@ -12,4 +11,4 @@ module ShadcnPhlexcomponents
12
11
  label(**@attributes, &)
13
12
  end
14
13
  end
15
- end
14
+ end
@@ -11,7 +11,10 @@ module ShadcnPhlexcomponents
11
11
  end
12
12
 
13
13
  def view_template(&)
14
- @html_options, @options = @options, @name if block_given?
14
+ if block_given?
15
+ @html_options = @options
16
+ @options = @name
17
+ end
15
18
  @html_options ||= {}
16
19
  @html_options = mix(default_attributes, @html_options)
17
20
  @html_options[:class] = TAILWIND_MERGER.merge("#{default_styles} #{@html_options[:class]}")
@@ -23,4 +26,4 @@ module ShadcnPhlexcomponents
23
26
  end
24
27
  end
25
28
  end
26
- end
29
+ end
@@ -18,4 +18,4 @@ module ShadcnPhlexcomponents
18
18
  end
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -7,7 +7,7 @@ module ShadcnPhlexcomponents
7
7
  def link(**attributes, &)
8
8
  PaginationLink(**attributes, &)
9
9
  end
10
-
10
+
11
11
  def previous(**attributes, &)
12
12
  PaginationPrevious(**attributes, &)
13
13
  end
@@ -15,7 +15,7 @@ module ShadcnPhlexcomponents
15
15
  def next(**attributes, &)
16
16
  PaginationNext(**attributes, &)
17
17
  end
18
-
18
+
19
19
  def ellipsis(**attributes, &)
20
20
  PaginationEllipsis(**attributes, &)
21
21
  end
@@ -25,7 +25,7 @@ module ShadcnPhlexcomponents
25
25
  role: "navigation",
26
26
  aria: {
27
27
  label: "navigation",
28
- }
28
+ },
29
29
  }
30
30
  end
31
31
 
@@ -35,4 +35,4 @@ module ShadcnPhlexcomponents
35
35
  end
36
36
  end
37
37
  end
38
- end
38
+ end
@@ -7,8 +7,8 @@ module ShadcnPhlexcomponents
7
7
  def default_attributes
8
8
  {
9
9
  aria: {
10
- hidden: "true"
11
- }
10
+ hidden: "true",
11
+ },
12
12
  }
13
13
  end
14
14
 
@@ -21,4 +21,4 @@ module ShadcnPhlexcomponents
21
21
  end
22
22
  end
23
23
  end
24
- end
24
+ end
@@ -3,7 +3,7 @@
3
3
  module ShadcnPhlexcomponents
4
4
  class PaginationLink < Base
5
5
  def initialize(href: nil, active: false, **attributes)
6
- @href = href
6
+ @href = href
7
7
  @active = active
8
8
  super(**attributes)
9
9
  end
@@ -20,9 +20,9 @@ module ShadcnPhlexcomponents
20
20
  {
21
21
  href: @href,
22
22
  aria: {
23
- current: @active ? "page" : nil
24
- }
25
- }
23
+ current: @active ? "page" : nil,
24
+ },
25
+ }
26
26
  end
27
27
 
28
28
  def view_template(&)
@@ -31,4 +31,4 @@ module ShadcnPhlexcomponents
31
31
  end
32
32
  end
33
33
  end
34
- end
34
+ end
@@ -3,7 +3,7 @@
3
3
  module ShadcnPhlexcomponents
4
4
  class PaginationNext < Base
5
5
  def initialize(href: nil, **attributes)
6
- @href = href
6
+ @href = href
7
7
  super(**attributes)
8
8
  end
9
9
 
@@ -15,9 +15,9 @@ module ShadcnPhlexcomponents
15
15
  {
16
16
  href: @href,
17
17
  aria: {
18
- label: "Go to next page"
19
- }
20
- }
18
+ label: "Go to next page",
19
+ },
20
+ }
21
21
  end
22
22
 
23
23
  def view_template(&)
@@ -29,4 +29,4 @@ module ShadcnPhlexcomponents
29
29
  end
30
30
  end
31
31
  end
32
- end
32
+ end
@@ -11,9 +11,9 @@ module ShadcnPhlexcomponents
11
11
  {
12
12
  href: @href,
13
13
  aria: {
14
- label: "Go to previous page"
15
- }
16
- }
14
+ label: "Go to previous page",
15
+ },
16
+ }
17
17
  end
18
18
 
19
19
  def default_styles
@@ -29,4 +29,4 @@ module ShadcnPhlexcomponents
29
29
  end
30
30
  end
31
31
  end
32
- end
32
+ end
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ShadcnPhlexcomponents
4
-
5
4
  class Popover < Base
6
- STYLES = "inline-block".freeze
5
+ STYLES = "inline-block"
7
6
 
8
7
  def initialize(side: :bottom, aria_id: "popover-#{SecureRandom.hex(5)}", **attributes)
9
8
  @side = side
@@ -13,7 +12,7 @@ module ShadcnPhlexcomponents
13
12
 
14
13
  def content(**attributes, &)
15
14
  PopoverContent(side: @side, aria_id: @aria_id, **attributes, &)
16
- end
15
+ end
17
16
 
18
17
  def trigger(**attributes, &)
19
18
  PopoverTrigger(aria_id: @aria_id, **attributes, &)
@@ -23,13 +22,13 @@ module ShadcnPhlexcomponents
23
22
  {
24
23
  data: {
25
24
  controller: "shadcn-phlexcomponents--popover",
26
- side: @side
27
- }
28
- }
25
+ side: @side,
26
+ },
27
+ }
29
28
  end
30
29
 
31
30
  def view_template(&)
32
31
  div(**@attributes, &)
33
32
  end
34
33
  end
35
- end
34
+ end
@@ -2,14 +2,14 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class PopoverContent < Base
5
- STYLES = <<~HEREDOC.freeze
6
- z-50 rounded-md border w-72 bg-popover p-4 text-popover-foreground shadow-md outline-none
7
- data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0
8
- data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95
5
+ STYLES = <<~HEREDOC
6
+ z-50 rounded-md border w-72 bg-popover p-4 text-popover-foreground shadow-md outline-none#{" "}
7
+ data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0#{" "}
8
+ data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95#{" "}
9
9
  data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2
10
- data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2
10
+ data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2#{" "}
11
11
  HEREDOC
12
-
12
+
13
13
  def initialize(side: :bottom, aria_id: nil, **attributes)
14
14
  @side = side
15
15
  @aria_id = aria_id
@@ -17,7 +17,10 @@ module ShadcnPhlexcomponents
17
17
  end
18
18
 
19
19
  def view_template(&)
20
- div(class: 'hidden fixed top-0 left-0 w-max z-50', data: { "shadcn-phlexcomponents--popover-target": "contentWrapper" }) do
20
+ div(
21
+ class: "hidden fixed top-0 left-0 w-max z-50",
22
+ data: { "shadcn-phlexcomponents--popover-target": "contentWrapper" },
23
+ ) do
21
24
  div(**@attributes, &)
22
25
  end
23
26
  end
@@ -29,9 +32,9 @@ module ShadcnPhlexcomponents
29
32
  role: "dialog",
30
33
  data: {
31
34
  side: @side,
32
- "shadcn-phlexcomponents--popover-target": "content"
33
- }
35
+ "shadcn-phlexcomponents--popover-target": "content",
36
+ },
34
37
  }
35
38
  end
36
39
  end
37
- end
40
+ end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ShadcnPhlexcomponents
4
-
5
4
  class PopoverTrigger < Base
6
5
  def initialize(as_child: false, aria_id: nil, **attributes)
7
6
  @as_child = as_child
@@ -24,7 +23,7 @@ module ShadcnPhlexcomponents
24
23
  merged_attributes.delete(:role)
25
24
  end
26
25
 
27
- send(element.name, **merged_attributes) do
26
+ send(element.name, **merged_attributes) do
28
27
  sanitize_as_child(element.children.to_s)
29
28
  end
30
29
  else
@@ -39,14 +38,14 @@ module ShadcnPhlexcomponents
39
38
  aria: {
40
39
  haspopup: "dialog",
41
40
  expanded: false,
42
- controls: "#{@aria_id}-content"
41
+ controls: "#{@aria_id}-content",
43
42
  },
44
43
  data: {
45
44
  as_child: @as_child.to_s,
46
45
  action: "click->shadcn-phlexcomponents--popover#toggle",
47
- "shadcn-phlexcomponents--popover-target": "trigger"
48
- }
46
+ "shadcn-phlexcomponents--popover-target": "trigger",
47
+ },
49
48
  }
50
49
  end
51
50
  end
52
- end
51
+ end
@@ -6,7 +6,7 @@ module ShadcnPhlexcomponents
6
6
 
7
7
  def initialize(value: 0, **attributes)
8
8
  @value = value
9
- super(**attributes)
9
+ super(**attributes)
10
10
  end
11
11
 
12
12
  def default_attributes
@@ -19,19 +19,19 @@ module ShadcnPhlexcomponents
19
19
  },
20
20
  data: {
21
21
  controller: "shadcn-phlexcomponents--progress",
22
- "shadcn-phlexcomponents--progress-progress-value": @value
23
- }
22
+ "shadcn-phlexcomponents--progress-progress-value": @value,
23
+ },
24
24
  }
25
25
  end
26
26
 
27
27
  def view_template
28
28
  div(**@attributes) do
29
29
  div(
30
- class: "h-full w-full flex-1 bg-primary transition-all",
31
- style: "transform: translateX(-#{100-@value}%)",
32
- data: { "shadcn-phlexcomponents--progress-target": "bar"}
30
+ class: "h-full w-full flex-1 bg-primary transition-all",
31
+ style: "transform: translateX(-#{100 - @value}%)",
32
+ data: { "shadcn-phlexcomponents--progress-target": "bar" },
33
33
  )
34
34
  end
35
35
  end
36
36
  end
37
- end
37
+ end
@@ -19,7 +19,7 @@ module ShadcnPhlexcomponents
19
19
  def items(collection, value_method:, text_method:, wrapper_class: nil)
20
20
  wrapper_class = TAILWIND_MERGER.merge("flex items-center space-x-2 #{wrapper_class}")
21
21
 
22
- if collection.first && collection.first.is_a?(Hash)
22
+ if collection.first&.is_a?(Hash)
23
23
  collection = convert_collection_hash_to_struct(collection, value_method: value_method, text_method: text_method)
24
24
  end
25
25
 
@@ -46,7 +46,7 @@ module ShadcnPhlexcomponents
46
46
  end
47
47
 
48
48
  def default_attributes
49
- {
49
+ {
50
50
  role: "radiogroup",
51
51
  dir: @dir,
52
52
  aria: {
@@ -55,8 +55,8 @@ module ShadcnPhlexcomponents
55
55
  data: {
56
56
  controller: "shadcn-phlexcomponents--radio-group",
57
57
  "shadcn-phlexcomponents--radio-group-selected-value": @value,
58
- }
58
+ },
59
59
  }
60
60
  end
61
61
  end
62
- end
62
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class RadioGroupItem < Base
5
- STYLES = <<~HEREDOC.freeze
5
+ STYLES = <<~HEREDOC
6
6
  aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow
7
7
  focus:outline-none focus-visible:ring-1 focus-visible:ring-ring
8
8
  disabled:cursor-not-allowed disabled:opacity-50 relative cursor-pointer
@@ -20,8 +20,8 @@ module ShadcnPhlexcomponents
20
20
  def view_template(&)
21
21
  button(**@attributes) do
22
22
  span(
23
- class: "items-center justify-center hidden group-data-[checked=true]/radio:flex"
24
- ) do
23
+ class: "items-center justify-center hidden group-data-[checked=true]/radio:flex",
24
+ ) do
25
25
  icon("circle", class: "size-2.5 fill-primary")
26
26
  end
27
27
 
@@ -33,7 +33,7 @@ module ShadcnPhlexcomponents
33
33
  tabindex: -1,
34
34
  checked: @checked,
35
35
  aria: { hidden: true },
36
- data: { input: "" }
36
+ data: { input: "" },
37
37
  )
38
38
  end
39
39
  end
@@ -46,12 +46,12 @@ module ShadcnPhlexcomponents
46
46
  role: "radio",
47
47
  aria: {
48
48
  checked: @checked.to_s,
49
- },
49
+ },
50
50
  data: {
51
51
  checked: @checked.to_s,
52
52
  value: @value,
53
53
  "shadcn-phlexcomponents--radio-group-target": "item",
54
- action: <<~HEREDOC
54
+ action: <<~HEREDOC,
55
55
  click->shadcn-phlexcomponents--radio-group#setChecked
56
56
  keydown.right->shadcn-phlexcomponents--radio-group#setCheckedToNext:prevent
57
57
  keydown.down->shadcn-phlexcomponents--radio-group#setCheckedToNext:prevent
@@ -59,8 +59,8 @@ module ShadcnPhlexcomponents
59
59
  keydown.left->shadcn-phlexcomponents--radio-group#setCheckedToPrev:prevent
60
60
  keydown.enter->shadcn-phlexcomponents--radio-group#preventDefault
61
61
  HEREDOC
62
- }
62
+ },
63
63
  }
64
64
  end
65
65
  end
66
- end
66
+ end