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
@@ -5,7 +5,7 @@ module ShadcnPhlexcomponents
5
5
  STYLES = <<~HEREDOC
6
6
  group pointer-events-auto relative flex w-full items-center justify-between
7
7
  space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all
8
- data-[state=open]:animate-in data-[state=closed]:animate-out
8
+ data-[state=open]:animate-in data-[state=closed]:animate-out#{" "}
9
9
  data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full
10
10
  data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full
11
11
  HEREDOC
@@ -29,11 +29,11 @@ module ShadcnPhlexcomponents
29
29
  end
30
30
 
31
31
  def title(**attributes, &)
32
- ToastTitle(data: { title: ""}, **attributes, &)
32
+ ToastTitle(data: { title: "" }, **attributes, &)
33
33
  end
34
34
 
35
35
  def description(**attributes, &)
36
- ToastDescription(data: { description: ""},**attributes, &)
36
+ ToastDescription(data: { description: "" }, **attributes, &)
37
37
  end
38
38
 
39
39
  def content(**attributes, &)
@@ -52,7 +52,7 @@ module ShadcnPhlexcomponents
52
52
  html_options ||= {}
53
53
  html_options[:variant] = @variant
54
54
  end
55
-
55
+
56
56
  ToastActionTo(name, options, html_options, &block)
57
57
  end
58
58
 
@@ -72,29 +72,30 @@ module ShadcnPhlexcomponents
72
72
  duration: @duration,
73
73
  state: "open",
74
74
  controller: "shadcn-phlexcomponents--toast",
75
- action: <<~HEREDOC
75
+ action: <<~HEREDOC,
76
76
  focus->shadcn-phlexcomponents--toast#cancelDismiss
77
77
  blur->shadcn-phlexcomponents--toast#dismiss
78
78
  mouseover->shadcn-phlexcomponents--toast#cancelDismiss
79
79
  mouseout->shadcn-phlexcomponents--toast#dismiss
80
80
  keydown.esc->shadcn-phlexcomponents--toast#close
81
81
  HEREDOC
82
- }
83
- }
82
+ },
83
+ }
84
84
  end
85
85
 
86
86
  def view_template(&)
87
87
  li(**@attributes) do
88
88
  yield
89
- button(type: "button",
90
- class: CLOSE_BUTTON_STYLES,
91
- data: {
92
- action: "shadcn-phlexcomponents--toast#close",
93
- }) do
94
-
89
+ button(
90
+ type: "button",
91
+ class: CLOSE_BUTTON_STYLES,
92
+ data: {
93
+ action: "shadcn-phlexcomponents--toast#close",
94
+ },
95
+ ) do
95
96
  icon("x", class: "size-4")
96
97
  end
97
98
  end
98
99
  end
99
100
  end
100
- end
101
+ end
@@ -15,7 +15,7 @@ module ShadcnPhlexcomponents
15
15
  @as_child = as_child
16
16
  super(**attributes)
17
17
  end
18
-
18
+
19
19
  def view_template(&)
20
20
  if @as_child
21
21
  content = capture(&)
@@ -24,10 +24,11 @@ module ShadcnPhlexcomponents
24
24
  vanish(&)
25
25
 
26
26
  element_attributes = nokogiri_attributes_to_hash(element)
27
+ styles = TAILWIND_MERGER.merge("#{@attributes[:class]} #{element_attributes[:class]}")
27
28
  merged_attributes = mix(@attributes, element_attributes)
28
- merged_attributes[:class] = TAILWIND_MERGER.merge("#{STYLES} #{element_attributes[:class]}")
29
+ merged_attributes[:class] = styles
29
30
 
30
- send(element.name, **merged_attributes) do
31
+ send(element.name, **merged_attributes) do
31
32
  sanitize_as_child(element.children.to_s)
32
33
  end
33
34
  else
@@ -35,4 +36,4 @@ module ShadcnPhlexcomponents
35
36
  end
36
37
  end
37
38
  end
38
- end
39
+ end
@@ -9,7 +9,10 @@ module ShadcnPhlexcomponents
9
9
  end
10
10
 
11
11
  def view_template(&)
12
- @html_options, @options = @options, @name if block_given?
12
+ if block_given?
13
+ @html_options = @options
14
+ @options = @name
15
+ end
13
16
  @html_options ||= {}
14
17
  @variant = @html_options.delete(:variant) || :default
15
18
  @html_options = mix(default_attributes, @html_options)
@@ -22,4 +25,4 @@ module ShadcnPhlexcomponents
22
25
  end
23
26
  end
24
27
  end
25
- end
28
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module ShadcnPhlexcomponents
3
+ module ShadcnPhlexcomponents
4
4
  class ToastContainer < Base
5
5
  STYLES = <<~HEREDOC
6
6
  fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4
@@ -12,17 +12,17 @@ module ShadcnPhlexcomponents
12
12
  tabindex: -1,
13
13
  data: {
14
14
  controller: "shadcn-phlexcomponents--toast-container",
15
- }
15
+ },
16
16
  }
17
17
  end
18
-
18
+
19
19
  def view_template(&)
20
20
  div(
21
21
  role: "region",
22
22
  tabindex: -1,
23
23
  aria: {
24
24
  label: "Notifications",
25
- }
25
+ },
26
26
  ) do
27
27
  ol(**@attributes) do
28
28
  template(data: { variant: "default" }) { toast(:default) }
@@ -41,4 +41,4 @@ module ShadcnPhlexcomponents
41
41
  end
42
42
  end
43
43
  end
44
- end
44
+ 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,4 +8,4 @@ module ShadcnPhlexcomponents
8
8
  div(**@attributes, &)
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class Tooltip < Base
5
- STYLES = "inline-block".freeze
5
+ STYLES = "inline-block"
6
6
 
7
7
  def initialize(side: :top, aria_id: "tooltip-#{SecureRandom.hex(5)}", **attributes)
8
8
  @side = side
@@ -11,24 +11,24 @@ module ShadcnPhlexcomponents
11
11
  end
12
12
 
13
13
  def trigger(**attributes, &)
14
- render TooltipTrigger.new(aria_id: @aria_id, **attributes, &)
14
+ render(TooltipTrigger.new(aria_id: @aria_id, **attributes, &))
15
15
  end
16
16
 
17
17
  def content(**attributes, &)
18
- render TooltipContent.new(side: @side, aria_id: @aria_id, **attributes, &)
19
- end
18
+ render(TooltipContent.new(side: @side, aria_id: @aria_id, **attributes, &))
19
+ end
20
20
 
21
21
  def default_attributes
22
22
  {
23
23
  data: {
24
24
  controller: "shadcn-phlexcomponents--tooltip",
25
- side: @side
26
- }
27
- }
25
+ side: @side,
26
+ },
27
+ }
28
28
  end
29
29
 
30
30
  def view_template(&)
31
31
  div(**@attributes, &)
32
32
  end
33
33
  end
34
- end
34
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module ShadcnPhlexcomponents
4
4
  class TooltipContent < Base
5
- STYLES = <<~HEREDOC.freeze
6
- z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground
7
- animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0
8
- data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2
5
+ STYLES = <<~HEREDOC
6
+ overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground
7
+ animate-in fade-in-0 zoom-in-95
8
+ data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2
9
9
  data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2
10
10
  HEREDOC
11
11
 
@@ -16,11 +16,11 @@ module ShadcnPhlexcomponents
16
16
  end
17
17
 
18
18
  def view_template(&)
19
- div(class: 'hidden fixed top-0 left-0 w-max z-50', data: { "shadcn-phlexcomponents--tooltip-target": "contentWrapper" }) do
19
+ div(class: "hidden", data: { "shadcn-phlexcomponents--tooltip-target": "content" }) do
20
20
  div(**@attributes, &)
21
21
 
22
22
  span(
23
- id: "#{@aria_id}-content",
23
+ id: "#{@aria_id}-content",
24
24
  role: "tooltip",
25
25
  class: "sr-only",
26
26
  &
@@ -30,13 +30,10 @@ module ShadcnPhlexcomponents
30
30
 
31
31
  def default_attributes
32
32
  {
33
- tabindex: -1,
34
33
  data: {
35
34
  side: @side,
36
- "shadcn-phlexcomponents--tooltip-target": "content",
37
- action: "mouseover->shadcn-phlexcomponents--tooltip#clearCloseTimer mouseout->shadcn-phlexcomponents--tooltip#closeWithDelay"
38
- }
35
+ },
39
36
  }
40
37
  end
41
38
  end
42
- end
39
+ end
@@ -19,7 +19,11 @@ module ShadcnPhlexcomponents
19
19
  merged_attributes = mix(@attributes, element_attributes)
20
20
  merged_attributes[:class] = styles
21
21
 
22
- send(element.name, **merged_attributes) do
22
+ if element.name == "button"
23
+ merged_attributes.delete(:role)
24
+ end
25
+
26
+ send(element.name, **merged_attributes) do
23
27
  sanitize_as_child(element.children.to_s)
24
28
  end
25
29
  else
@@ -32,19 +36,13 @@ module ShadcnPhlexcomponents
32
36
  id: @id,
33
37
  role: "button",
34
38
  aria: {
35
- describedby: "#{@aria_id}-content"
39
+ describedby: "#{@aria_id}-content",
36
40
  },
37
41
  data: {
38
42
  as_child: @as_child.to_s,
39
- state: "closed",
40
- action: <<~HEREDOC,
41
- click->shadcn-phlexcomponents--tooltip#toggle
42
- mouseover->shadcn-phlexcomponents--tooltip#openWithDelay
43
- mouseout->shadcn-phlexcomponents--tooltip#closeWithDelay
44
- HEREDOC
45
- "shadcn-phlexcomponents--tooltip-target": "trigger"
46
- }
43
+ "shadcn-phlexcomponents--tooltip-target": "trigger",
44
+ },
47
45
  }
48
46
  end
49
47
  end
50
- end
48
+ end
@@ -2,131 +2,42 @@
2
2
 
3
3
  module ShadcnPhlexcomponents; end
4
4
  Accordion = ShadcnPhlexcomponents::Accordion
5
- AccordionContent = ShadcnPhlexcomponents::AccordionContent
6
- AccordionItem = ShadcnPhlexcomponents::AccordionItem
7
- AccordionTrigger = ShadcnPhlexcomponents::AccordionTrigger
8
5
  Alert = ShadcnPhlexcomponents::Alert
9
- AlertTitle = ShadcnPhlexcomponents::AlertTitle
10
- AlertDescription = ShadcnPhlexcomponents::AlertDescription
11
6
  AlertDialog = ShadcnPhlexcomponents::AlertDialog
12
- AlertDialogActionTo = ShadcnPhlexcomponents::AlertDialogActionTo
13
- AlertDialogAction = ShadcnPhlexcomponents::AlertDialogAction
14
- AlertDialogCancel = ShadcnPhlexcomponents::AlertDialogCancel
15
- AlertDialogContent = ShadcnPhlexcomponents::AlertDialogContent
16
- AlertDialogDescription = ShadcnPhlexcomponents::AlertDialogDescription
17
- AlertDialogFooter = ShadcnPhlexcomponents::AlertDialogFooter
18
- AlertDialogHeader = ShadcnPhlexcomponents::AlertDialogHeader
19
- AlertDialogTitle = ShadcnPhlexcomponents::AlertDialogTitle
20
- AlertDialogTrigger = ShadcnPhlexcomponents::AlertDialogTrigger
21
7
  AspectRatio = ShadcnPhlexcomponents::AspectRatio
22
8
  Avatar = ShadcnPhlexcomponents::Avatar
23
- AvatarFallback = ShadcnPhlexcomponents::AvatarFallback
24
- AvatarImage = ShadcnPhlexcomponents::AvatarImage
25
9
  Badge = ShadcnPhlexcomponents::Badge
26
10
  Breadcrumb = ShadcnPhlexcomponents::Breadcrumb
27
- BreadcrumbEllipsis = ShadcnPhlexcomponents::BreadcrumbEllipsis
28
- BreadcrumbItem = ShadcnPhlexcomponents::BreadcrumbItem
29
- BreadcrumbLink = ShadcnPhlexcomponents::BreadcrumbLink
30
- BreadcrumbPage = ShadcnPhlexcomponents::BreadcrumbPage
31
- BreadcrumbSeparator = ShadcnPhlexcomponents::BreadcrumbSeparator
32
11
  Button = ShadcnPhlexcomponents::Button
33
12
  Card = ShadcnPhlexcomponents::Card
34
- CardContent = ShadcnPhlexcomponents::CardContent
35
- CardDescription = ShadcnPhlexcomponents::CardDescription
36
- CardFooter = ShadcnPhlexcomponents::CardFooter
37
- CardHeader = ShadcnPhlexcomponents::CardHeader
38
- CardTitle = ShadcnPhlexcomponents::CardTitle
39
13
  CheckboxGroup = ShadcnPhlexcomponents::CheckboxGroup
40
14
  Checkbox = ShadcnPhlexcomponents::Checkbox
41
15
  Collapsible = ShadcnPhlexcomponents::Collapsible
42
- CollapsibleContent = ShadcnPhlexcomponents::CollapsibleContent
43
- CollapsibleTrigger = ShadcnPhlexcomponents::CollapsibleTrigger
44
- Datepicker = ShadcnPhlexcomponents::Datepicker
16
+ Combobox = ShadcnPhlexcomponents::Combobox
17
+ DatePicker = ShadcnPhlexcomponents::DatePicker
18
+ DateRangePicker = ShadcnPhlexcomponents::DateRangePicker
45
19
  Dialog = ShadcnPhlexcomponents::Dialog
46
- DialogClose = ShadcnPhlexcomponents::DialogClose
47
- DialogContent = ShadcnPhlexcomponents::DialogContent
48
- DialogDescription = ShadcnPhlexcomponents::DialogDescription
49
- DialogFooter = ShadcnPhlexcomponents::DialogFooter
50
- DialogHeader = ShadcnPhlexcomponents::DialogHeader
51
- DialogTitle = ShadcnPhlexcomponents::DialogTitle
52
- DialogTrigger = ShadcnPhlexcomponents::DialogTrigger
53
20
  DropdownMenu = ShadcnPhlexcomponents::DropdownMenu
54
- DropdownMenuContent = ShadcnPhlexcomponents::DropdownMenuContent
55
- DropdownMenuItem = ShadcnPhlexcomponents::DropdownMenuItem
56
- DropdownMenuLabel = ShadcnPhlexcomponents::DropdownMenuLabel
57
- DropdownMenuSeparator = ShadcnPhlexcomponents::DropdownMenuSeparator
58
- DropdownMenuTrigger = ShadcnPhlexcomponents::DropdownMenuTrigger
21
+ Form = ShadcnPhlexcomponents::Form
59
22
  HoverCard = ShadcnPhlexcomponents::HoverCard
60
- HoverCardContent = ShadcnPhlexcomponents::HoverCardContent
61
- HoverCardTrigger = ShadcnPhlexcomponents::HoverCardTrigger
62
23
  Input = ShadcnPhlexcomponents::Input
63
24
  Label = ShadcnPhlexcomponents::Label
64
25
  Link = ShadcnPhlexcomponents::Link
65
26
  LoadingButton = ShadcnPhlexcomponents::LoadingButton
66
27
  Pagination = ShadcnPhlexcomponents::Pagination
67
- PaginationEllipsis = ShadcnPhlexcomponents::PaginationEllipsis
68
- PaginationLink = ShadcnPhlexcomponents::PaginationLink
69
- PaginationNext = ShadcnPhlexcomponents::PaginationNext
70
- PaginationPrevious = ShadcnPhlexcomponents::PaginationPrevious
71
28
  Popover = ShadcnPhlexcomponents::Popover
72
- PopoverContent = ShadcnPhlexcomponents::PopoverContent
73
- PopoverTrigger = ShadcnPhlexcomponents::PopoverTrigger
74
29
  Progress = ShadcnPhlexcomponents::Progress
75
30
  RadioGroup = ShadcnPhlexcomponents::RadioGroup
76
- RadioGroupItem = ShadcnPhlexcomponents::RadioGroupItem
77
31
  Select = ShadcnPhlexcomponents::Select
78
- SelectContent = ShadcnPhlexcomponents::SelectContent
79
- SelectGroup = ShadcnPhlexcomponents::SelectGroup
80
- SelectItem = ShadcnPhlexcomponents::SelectItem
81
- SelectLabel = ShadcnPhlexcomponents::SelectLabel
82
32
  Separator = ShadcnPhlexcomponents::Separator
83
33
  Sheet = ShadcnPhlexcomponents::Sheet
84
- SheetClose = ShadcnPhlexcomponents::SheetClose
85
- SheetContent = ShadcnPhlexcomponents::SheetContent
86
- SheetDescription = ShadcnPhlexcomponents::SheetDescription
87
- SheetFooter = ShadcnPhlexcomponents::SheetFooter
88
- SheetHeader = ShadcnPhlexcomponents::SheetHeader
89
- SheetTitle = ShadcnPhlexcomponents::SheetTitle
90
- SheetTrigger = ShadcnPhlexcomponents::SheetTrigger
91
34
  Sidebar = ShadcnPhlexcomponents::Sidebar
92
- SidebarContainer = ShadcnPhlexcomponents::SidebarContainer
93
- SidebarContent = ShadcnPhlexcomponents::SidebarContent
94
- SidebarFooter = ShadcnPhlexcomponents::SidebarFooter
95
- SidebarGroupContent = ShadcnPhlexcomponents::SidebarGroupContent
96
- SidebarGroupLabel = ShadcnPhlexcomponents::SidebarGroupLabel
97
- SidebarGroup = ShadcnPhlexcomponents::SidebarGroup
98
- SidebarHeader = ShadcnPhlexcomponents::SidebarHeader
99
- SidebarInset = ShadcnPhlexcomponents::SidebarInset
100
- SidebarMenuButton = ShadcnPhlexcomponents::SidebarMenuButton
101
- SidebarMenuItem = ShadcnPhlexcomponents::SidebarMenuItem
102
- SidebarMenuSubButton = ShadcnPhlexcomponents::SidebarMenuSubButton
103
- SidebarMenuSubItem = ShadcnPhlexcomponents::SidebarMenuSubItem
104
- SidebarMenuSub = ShadcnPhlexcomponents::SidebarMenuSub
105
- SidebarMenu = ShadcnPhlexcomponents::SidebarMenu
106
- SidebarTrigger = ShadcnPhlexcomponents::SidebarTrigger
107
35
  Skeleton = ShadcnPhlexcomponents::Skeleton
108
36
  Switch = ShadcnPhlexcomponents::Switch
109
37
  Table = ShadcnPhlexcomponents::Table
110
- TableBody = ShadcnPhlexcomponents::TableBody
111
- TableCaption = ShadcnPhlexcomponents::TableCaption
112
- TableCell = ShadcnPhlexcomponents::TableCell
113
- TableFooter = ShadcnPhlexcomponents::TableFooter
114
- TableHead = ShadcnPhlexcomponents::TableHead
115
- TableHeader = ShadcnPhlexcomponents::TableHeader
116
- TableRow = ShadcnPhlexcomponents::TableRow
117
38
  Tabs = ShadcnPhlexcomponents::Tabs
118
- TabsContent = ShadcnPhlexcomponents::TabsContent
119
- TabsList = ShadcnPhlexcomponents::TabsList
120
- TabsTrigger = ShadcnPhlexcomponents::TabsTrigger
121
39
  Textarea = ShadcnPhlexcomponents::Textarea
122
40
  ThemeSwitcher = ShadcnPhlexcomponents::ThemeSwitcher
123
41
  Toast = ShadcnPhlexcomponents::Toast
124
- ToastActionTo = ShadcnPhlexcomponents::ToastActionTo
125
- ToastAction = ShadcnPhlexcomponents::ToastAction
126
42
  ToastContainer = ShadcnPhlexcomponents::ToastContainer
127
- ToastContent = ShadcnPhlexcomponents::ToastContent
128
- ToastDescription = ShadcnPhlexcomponents::ToastDescription
129
- ToastTitle = ShadcnPhlexcomponents::ToastTitle
130
43
  Tooltip = ShadcnPhlexcomponents::Tooltip
131
- TooltipContent = ShadcnPhlexcomponents::TooltipContent
132
- TooltipTrigger = ShadcnPhlexcomponents::TooltipTrigger
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ShadcnPhlexcomponents
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shadcn_phlexcomponents
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Yeoh
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-18 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: lucide-rails
@@ -73,6 +73,7 @@ extra_rdoc_files: []
73
73
  files:
74
74
  - README.md
75
75
  - Rakefile
76
+ - app/assets/tailwind/choices.css
76
77
  - app/assets/tailwind/tailwindcss-animate.css
77
78
  - app/assets/tailwind/vanilla-calendar-pro.css
78
79
  - app/javascript/controllers/accordion_controller.js
@@ -81,7 +82,8 @@ files:
81
82
  - app/javascript/controllers/checkbox_controller.js
82
83
  - app/javascript/controllers/collapsible_controller.js
83
84
  - app/javascript/controllers/combobox_controller.js
84
- - app/javascript/controllers/datepicker_controller.js
85
+ - app/javascript/controllers/date_picker_controller.js
86
+ - app/javascript/controllers/date_range_picker_controller.js
85
87
  - app/javascript/controllers/dialog_controller.js
86
88
  - app/javascript/controllers/dropdown_menu_controller.js
87
89
  - app/javascript/controllers/hover_card_controller.js
@@ -140,7 +142,10 @@ files:
140
142
  - lib/components/collapsible.rb
141
143
  - lib/components/collapsible_content.rb
142
144
  - lib/components/collapsible_trigger.rb
143
- - lib/components/datepicker.rb
145
+ - lib/components/combobox.rb
146
+ - lib/components/combobox_item.rb
147
+ - lib/components/date_picker.rb
148
+ - lib/components/date_range_picker.rb
144
149
  - lib/components/dialog.rb
145
150
  - lib/components/dialog_close.rb
146
151
  - lib/components/dialog_content.rb
@@ -156,6 +161,10 @@ files:
156
161
  - lib/components/dropdown_menu_label.rb
157
162
  - lib/components/dropdown_menu_separator.rb
158
163
  - lib/components/dropdown_menu_trigger.rb
164
+ - lib/components/form.rb
165
+ - lib/components/form_error.rb
166
+ - lib/components/form_hint.rb
167
+ - lib/components/form_input.rb
159
168
  - lib/components/hover_card.rb
160
169
  - lib/components/hover_card_content.rb
161
170
  - lib/components/hover_card_trigger.rb
@@ -258,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
267
  - !ruby/object:Gem::Version
259
268
  version: '0'
260
269
  requirements: []
261
- rubygems_version: 3.6.2
270
+ rubygems_version: 3.6.7
262
271
  specification_version: 4
263
272
  summary: Shadcn Phlexcomponents is a UI Component library built for Ruby on Rails.
264
273
  test_files: []
@@ -1,47 +0,0 @@
1
- import { Controller } from '@hotwired/stimulus'
2
- import { Calendar } from 'vanilla-calendar-pro'
3
- import { getDateString, parseDates } from 'vanilla-calendar-pro/utils'
4
- import dayjs from 'dayjs'
5
-
6
- export default class extends Controller {
7
- connect() {
8
- this.date = new Date(this.element.dataset.value)
9
- this.format = this.element.dataset.format
10
- const settings = this.getSettings()
11
-
12
- if (!isNaN(this.date.getTime())) {
13
- const dateString = getDateString(this.date)
14
- const formattedDate = this.format
15
- ? dayjs(this.date).format(this.format)
16
- : this.date.toLocaleDateString()
17
- this.element.value = formattedDate
18
- settings.selectedDates = [dateString]
19
- }
20
-
21
- const calendar = new Calendar(this.element, {
22
- inputMode: true,
23
- enableJumpToSelectedDate: true,
24
- ...settings,
25
- onClickDate(self, event) {
26
- const date = self.context.selectedDates[0]
27
- const formattedDate = self.context.inputElement.dataset.format
28
- ? dayjs(date).format(self.context.inputElement.dataset.format)
29
- : new Date(date).toLocaleDateString()
30
-
31
- self.context.inputElement.value = formattedDate
32
- self.hide()
33
- },
34
- })
35
- calendar.init()
36
-
37
- this.calendar = calendar
38
- }
39
-
40
- getSettings() {
41
- try {
42
- return JSON.parse(this.element.dataset.settings)
43
- } catch {
44
- return {}
45
- }
46
- }
47
- }
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ShadcnPhlexcomponents
4
- class Datepicker < Base
5
- STYLES = <<~HEREDOC
6
- flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1
7
- text-base shadow-sm transition-colors file:border-0 file:bg-transparent
8
- file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground
9
- focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring
10
- disabled:cursor-not-allowed disabled:opacity-50 md:text-sm
11
- file:pt-0.5
12
- HEREDOC
13
-
14
- def initialize(name: nil, id: nil, value: nil, format: nil, settings: {}, **attributes)
15
- @name = name
16
- @id = id || @name
17
- @value = value
18
- @settings = settings
19
- @format = format
20
- super(**attributes)
21
- end
22
-
23
- def default_attributes
24
- {
25
- data: {
26
- value: @value&.utc.to_s,
27
- format: @format,
28
- controller: "shadcn-phlexcomponents--datepicker",
29
- settings: @settings.to_json
30
- }
31
- }
32
- end
33
-
34
- def view_template
35
- input(type: :text, readonly: true, **@attributes)
36
- end
37
- end
38
- end