phlex_ui 0.0.5 → 0.1.6

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 (149) hide show
  1. checksums.yaml +4 -4
  2. data/lib/phlex_ui/accordion/builder.rb +22 -0
  3. data/lib/phlex_ui/accordion/content.rb +15 -15
  4. data/lib/phlex_ui/accordion/default_content.rb +11 -11
  5. data/lib/phlex_ui/accordion/default_trigger.rb +14 -14
  6. data/lib/phlex_ui/accordion/icon.rb +31 -31
  7. data/lib/phlex_ui/accordion/item.rb +20 -20
  8. data/lib/phlex_ui/accordion/trigger.rb +11 -11
  9. data/lib/phlex_ui/accordion.rb +10 -21
  10. data/lib/phlex_ui/alert/description.rb +10 -10
  11. data/lib/phlex_ui/alert/title.rb +10 -10
  12. data/lib/phlex_ui/alert.rb +27 -27
  13. data/lib/phlex_ui/alert_dialog/action.rb +11 -11
  14. data/lib/phlex_ui/alert_dialog/cancel.rb +15 -15
  15. data/lib/phlex_ui/alert_dialog/content.rb +36 -36
  16. data/lib/phlex_ui/alert_dialog/description.rb +11 -11
  17. data/lib/phlex_ui/alert_dialog/footer.rb +11 -11
  18. data/lib/phlex_ui/alert_dialog/header.rb +11 -11
  19. data/lib/phlex_ui/alert_dialog/title.rb +11 -11
  20. data/lib/phlex_ui/alert_dialog/trigger.rb +12 -12
  21. data/lib/phlex_ui/alert_dialog.rb +18 -18
  22. data/lib/phlex_ui/aspect_ratio.rb +24 -24
  23. data/lib/phlex_ui/attribute_merger.rb +59 -61
  24. data/lib/phlex_ui/avatar/builder.rb +36 -0
  25. data/lib/phlex_ui/avatar/fallback.rb +11 -11
  26. data/lib/phlex_ui/avatar/image.rb +19 -19
  27. data/lib/phlex_ui/avatar.rb +23 -41
  28. data/lib/phlex_ui/badge.rb +50 -50
  29. data/lib/phlex_ui/base.rb +16 -16
  30. data/lib/phlex_ui/button.rb +80 -80
  31. data/lib/phlex_ui/calendar/body.rb +19 -0
  32. data/lib/phlex_ui/calendar/days.rb +104 -0
  33. data/lib/phlex_ui/calendar/header.rb +17 -0
  34. data/lib/phlex_ui/calendar/next.rb +43 -0
  35. data/lib/phlex_ui/calendar/prev.rb +43 -0
  36. data/lib/phlex_ui/calendar/title.rb +27 -0
  37. data/lib/phlex_ui/calendar/weekdays.rb +33 -0
  38. data/lib/phlex_ui/calendar.rb +39 -0
  39. data/lib/phlex_ui/card/content.rb +11 -11
  40. data/lib/phlex_ui/card/description.rb +11 -11
  41. data/lib/phlex_ui/card/footer.rb +11 -11
  42. data/lib/phlex_ui/card/header.rb +11 -11
  43. data/lib/phlex_ui/card/title.rb +11 -11
  44. data/lib/phlex_ui/card.rb +11 -11
  45. data/lib/phlex_ui/chart.rb +23 -0
  46. data/lib/phlex_ui/checkbox.rb +12 -12
  47. data/lib/phlex_ui/clipboard/popover.rb +28 -28
  48. data/lib/phlex_ui/clipboard/source.rb +13 -13
  49. data/lib/phlex_ui/clipboard/trigger.rb +14 -14
  50. data/lib/phlex_ui/clipboard.rb +30 -30
  51. data/lib/phlex_ui/codeblock.rb +86 -86
  52. data/lib/phlex_ui/collapsible/content.rb +12 -12
  53. data/lib/phlex_ui/collapsible/trigger.rb +13 -13
  54. data/lib/phlex_ui/collapsible.rb +18 -18
  55. data/lib/phlex_ui/command/dialog.rb +17 -0
  56. data/lib/phlex_ui/command/dialog_content.rb +49 -0
  57. data/lib/phlex_ui/command/dialog_trigger.rb +29 -0
  58. data/lib/phlex_ui/command/empty.rb +19 -0
  59. data/lib/phlex_ui/command/group.rb +41 -0
  60. data/lib/phlex_ui/command/input.rb +56 -0
  61. data/lib/phlex_ui/command/item.rb +31 -0
  62. data/lib/phlex_ui/command/list.rb +17 -0
  63. data/lib/phlex_ui/command.rb +17 -0
  64. data/lib/phlex_ui/context_menu/content.rb +19 -19
  65. data/lib/phlex_ui/context_menu/item.rb +55 -55
  66. data/lib/phlex_ui/context_menu/label.rb +16 -16
  67. data/lib/phlex_ui/context_menu/separator.rb +13 -13
  68. data/lib/phlex_ui/context_menu/trigger.rb +14 -14
  69. data/lib/phlex_ui/context_menu.rb +19 -19
  70. data/lib/phlex_ui/dialog/content.rb +67 -67
  71. data/lib/phlex_ui/dialog/description.rb +11 -11
  72. data/lib/phlex_ui/dialog/footer.rb +11 -11
  73. data/lib/phlex_ui/dialog/header.rb +11 -11
  74. data/lib/phlex_ui/dialog/middle.rb +11 -11
  75. data/lib/phlex_ui/dialog/title.rb +11 -11
  76. data/lib/phlex_ui/dialog/trigger.rb +14 -13
  77. data/lib/phlex_ui/dialog.rb +18 -18
  78. data/lib/phlex_ui/dropdown_menu/content.rb +16 -16
  79. data/lib/phlex_ui/dropdown_menu/item.rb +21 -21
  80. data/lib/phlex_ui/dropdown_menu/label.rb +11 -11
  81. data/lib/phlex_ui/dropdown_menu/separator.rb +13 -13
  82. data/lib/phlex_ui/dropdown_menu/trigger.rb +12 -11
  83. data/lib/phlex_ui/dropdown_menu.rb +19 -19
  84. data/lib/phlex_ui/form/builder.rb +38 -0
  85. data/lib/phlex_ui/form/item.rb +11 -11
  86. data/lib/phlex_ui/form/spacer.rb +11 -11
  87. data/lib/phlex_ui/form.rb +9 -28
  88. data/lib/phlex_ui/hint.rb +11 -11
  89. data/lib/phlex_ui/hover_card/content.rb +16 -16
  90. data/lib/phlex_ui/hover_card/trigger.rb +14 -13
  91. data/lib/phlex_ui/hover_card.rb +20 -20
  92. data/lib/phlex_ui/input.rb +22 -22
  93. data/lib/phlex_ui/input_error.rb +11 -11
  94. data/lib/phlex_ui/label.rb +11 -11
  95. data/lib/phlex_ui/link.rb +81 -81
  96. data/lib/phlex_ui/popover/content.rb +16 -16
  97. data/lib/phlex_ui/popover/trigger.rb +14 -13
  98. data/lib/phlex_ui/popover.rb +18 -18
  99. data/lib/phlex_ui/select/builder.rb +67 -0
  100. data/lib/phlex_ui/select/content.rb +30 -0
  101. data/lib/phlex_ui/select/group.rb +15 -0
  102. data/lib/phlex_ui/select/input.rb +20 -0
  103. data/lib/phlex_ui/select/item.rb +48 -0
  104. data/lib/phlex_ui/select/label.rb +17 -0
  105. data/lib/phlex_ui/select/trigger.rb +45 -0
  106. data/lib/phlex_ui/select/value.rb +27 -0
  107. data/lib/phlex_ui/select.rb +30 -0
  108. data/lib/phlex_ui/sheet/content.rb +77 -0
  109. data/lib/phlex_ui/sheet/description.rb +17 -0
  110. data/lib/phlex_ui/sheet/footer.rb +17 -0
  111. data/lib/phlex_ui/sheet/header.rb +17 -0
  112. data/lib/phlex_ui/sheet/middle.rb +17 -0
  113. data/lib/phlex_ui/sheet/title.rb +17 -0
  114. data/lib/phlex_ui/sheet/trigger.rb +17 -0
  115. data/lib/phlex_ui/sheet.rb +17 -0
  116. data/lib/phlex_ui/shortcut_key.rb +11 -11
  117. data/lib/phlex_ui/table/body.rb +11 -11
  118. data/lib/phlex_ui/table/builder.rb +59 -59
  119. data/lib/phlex_ui/table/caption.rb +11 -11
  120. data/lib/phlex_ui/table/cell.rb +11 -11
  121. data/lib/phlex_ui/table/footer.rb +11 -11
  122. data/lib/phlex_ui/table/head.rb +11 -11
  123. data/lib/phlex_ui/table/header.rb +11 -11
  124. data/lib/phlex_ui/table/row.rb +11 -11
  125. data/lib/phlex_ui/table.rb +13 -13
  126. data/lib/phlex_ui/tabs/content.rb +18 -18
  127. data/lib/phlex_ui/tabs/list.rb +11 -11
  128. data/lib/phlex_ui/tabs/trigger.rb +20 -20
  129. data/lib/phlex_ui/tabs.rb +17 -17
  130. data/lib/phlex_ui/theme_toggle.rb +31 -31
  131. data/lib/phlex_ui/tooltip/content.rb +16 -16
  132. data/lib/phlex_ui/tooltip/trigger.rb +12 -11
  133. data/lib/phlex_ui/tooltip.rb +18 -18
  134. data/lib/phlex_ui/typography/blockquote.rb +11 -11
  135. data/lib/phlex_ui/typography/h1.rb +10 -10
  136. data/lib/phlex_ui/typography/h2.rb +10 -10
  137. data/lib/phlex_ui/typography/h3.rb +11 -11
  138. data/lib/phlex_ui/typography/h4.rb +11 -11
  139. data/lib/phlex_ui/typography/inline_code.rb +11 -11
  140. data/lib/phlex_ui/typography/inline_link.rb +22 -0
  141. data/lib/phlex_ui/typography/large.rb +11 -11
  142. data/lib/phlex_ui/typography/lead.rb +11 -11
  143. data/lib/phlex_ui/typography/list.rb +36 -36
  144. data/lib/phlex_ui/typography/list_item.rb +11 -11
  145. data/lib/phlex_ui/typography/muted.rb +11 -11
  146. data/lib/phlex_ui/typography/p.rb +11 -11
  147. data/lib/phlex_ui/typography/small.rb +11 -11
  148. data/lib/phlex_ui.rb +9 -4
  149. metadata +88 -7
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class Form::Item < Base
5
- def template(&)
6
- div(**attrs, &)
7
- end
4
+ class Form::Item < Base
5
+ def template(&block)
6
+ div(**attrs, &block)
7
+ end
8
8
 
9
- private
9
+ private
10
10
 
11
- def default_attrs
12
- {
13
- class: "space-y-2"
14
- }
15
- end
11
+ def default_attrs
12
+ {
13
+ class: "space-y-2"
14
+ }
16
15
  end
17
- end
16
+ end
17
+ end
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class Form::Spacer < Base
5
- def template(&)
6
- div(**attrs, &)
7
- end
4
+ class Form::Spacer < Base
5
+ def template(&block)
6
+ div(**attrs, &block)
7
+ end
8
8
 
9
- private
9
+ private
10
10
 
11
- def default_attrs
12
- {
13
- class: "space-y-4"
14
- }
15
- end
11
+ def default_attrs
12
+ {
13
+ class: "space-y-4"
14
+ }
16
15
  end
17
- end
16
+ end
17
+ end
data/lib/phlex_ui/form.rb CHANGED
@@ -1,34 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class Form < Base
5
- def template(&)
6
- form(**attrs, &)
7
- end
8
-
9
- def input(name, label: nil, hint: false, error: nil, **input_attrs)
10
- name = name.to_s
11
- label ||= convert_name_to_label(name)
12
-
13
- render PhlexUI::Form::Item.new do
14
- render PhlexUI::Label.new(for: name) { label } if label
15
- render PhlexUI::Input.new(name: name, id: name, **input_attrs)
16
- render PhlexUI::Hint.new { hint } if hint
17
- end
18
- end
19
-
20
- def button(**button_attrs, &)
21
- render PhlexUI::Button.new(**button_attrs, &)
22
- end
23
-
24
- private
4
+ class Form < Base
5
+ def template(&block)
6
+ form(**attrs, &block)
7
+ end
25
8
 
26
- def convert_name_to_label(name)
27
- name.to_s.split("_").map(&:capitalize).join(" ")
28
- end
9
+ private
29
10
 
30
- def default_attrs
31
- {}
32
- end
11
+ def default_attrs
12
+ {}
33
13
  end
34
- end
14
+ end
15
+ end
data/lib/phlex_ui/hint.rb CHANGED
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class Hint < Base
5
- def template(&)
6
- p(**attrs, &)
7
- end
4
+ class Hint < Base
5
+ def template(&block)
6
+ p(**attrs, &block)
7
+ end
8
8
 
9
- private
9
+ private
10
10
 
11
- def default_attrs
12
- {
13
- class: "text-[0.8rem] text-muted-text"
14
- }
15
- end
11
+ def default_attrs
12
+ {
13
+ class: "text-[0.8rem] text-muted-foreground"
14
+ }
16
15
  end
17
- end
16
+ end
17
+ end
@@ -1,22 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class HoverCard::Content < Base
5
- def template(&)
6
- template_tag(data: { popover_target: "content" }) do
7
- div(**attrs, &)
8
- end
9
- end
4
+ class HoverCard::Content < Base
5
+ def template(&block)
6
+ template_tag(data: {popover_target: "content"}) do
7
+ div(**attrs, &block)
8
+ end
9
+ end
10
10
 
11
- private
11
+ private
12
12
 
13
- def default_attrs
14
- {
15
- data: {
16
- state: :open
17
- },
18
- class: "z-50 rounded-md border bg-background p-4 text-text shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
19
- }
20
- end
13
+ def default_attrs
14
+ {
15
+ data: {
16
+ state: :open
17
+ },
18
+ class: "z-50 rounded-md border bg-background p-4 text-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
19
+ }
21
20
  end
22
- end
21
+ end
22
+ end
@@ -1,19 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class HoverCard::Trigger < Base
5
- def template(&)
6
- div(**attrs, &)
7
- end
4
+ class HoverCard::Trigger < Base
5
+ def template(&block)
6
+ div(**attrs, &block)
7
+ end
8
8
 
9
- private
9
+ private
10
10
 
11
- def default_attrs
12
- {
13
- data: {
14
- popover_target: 'trigger'
15
- }
16
- }
17
- end
11
+ def default_attrs
12
+ {
13
+ data: {
14
+ popover_target: "trigger"
15
+ },
16
+ class: "inline-block"
17
+ }
18
18
  end
19
- end
19
+ end
20
+ end
@@ -1,27 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class HoverCard < Base
5
- def initialize(option: {}, **attrs)
6
- @options = option
7
- @options[:delay] ||= [500, 250]
8
- @options[:trigger] ||= 'mouseenter focus click'
9
- super(**attrs)
10
- end
4
+ class HoverCard < Base
5
+ def initialize(option: {}, **attrs)
6
+ @options = option
7
+ @options[:delay] ||= [500, 250]
8
+ @options[:trigger] ||= "mouseenter focus click"
9
+ super(**attrs)
10
+ end
11
11
 
12
- def template(&)
13
- div(**attrs, &)
14
- end
12
+ def template(&block)
13
+ div(**attrs, &block)
14
+ end
15
15
 
16
- private
16
+ private
17
17
 
18
- def default_attrs
19
- {
20
- data: {
21
- controller: "popover",
22
- popover_options_value: @options.to_json
23
- }
24
- }
25
- end
18
+ def default_attrs
19
+ {
20
+ data: {
21
+ controller: "popover",
22
+ popover_options_value: @options.to_json
23
+ }
24
+ }
26
25
  end
27
- end
26
+ end
27
+ end
@@ -1,29 +1,29 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class Input < Base
5
- def initialize(type: :string, error: nil, **attrs)
6
- @type = type.to_sym
7
- @error = error
8
- super(**attrs)
9
- end
4
+ class Input < Base
5
+ def initialize(type: :string, error: nil, **attrs)
6
+ @type = type.to_sym
7
+ @error = error
8
+ super(**attrs)
9
+ end
10
10
 
11
- def template
12
- input(type: @type, **attrs)
13
- render PhlexUI::InputError.new { @error } if @error
14
- end
11
+ def template
12
+ input(type: @type, **attrs)
13
+ render PhlexUI::InputError.new { @error } if @error
14
+ end
15
15
 
16
- private
16
+ private
17
17
 
18
- def default_attrs
19
- {
20
- class: tokens(
21
- "flex h-9 w-full rounded-md border bg-transparent 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",
22
- -> { @error.nil? } => "border-border focus-visible:ring-ring placeholder:text-muted-text",
23
- -> { @error.present? } => "placeholder:text-destructive-900/50 dark:placeholder:text-destructive-200/50 text-destructive-900 dark:text-destructive-300 border-destructive-300 dark:border-destructive focus-visible:ring-destructive dark:focus-visible:ring-destructive-300",
24
- -> { @type == :file } => "pt-1.5 dark:file:text-white"
25
- ),
26
- }
27
- end
18
+ def default_attrs
19
+ {
20
+ class: tokens(
21
+ "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",
22
+ -> { @error.nil? } => "border-border focus-visible:ring-ring placeholder:text-muted-foreground",
23
+ -> { @error.present? } => "placeholder:text-destructive/60 text-destructive dark:text-destructive border-destructive focus-visible:ring-destructive",
24
+ -> { @type == :file } => "pt-1.5 dark:file:text-white"
25
+ )
26
+ }
28
27
  end
29
- end
28
+ end
29
+ end
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class InputError < Base
5
- def template(&)
6
- p(**attrs, &)
7
- end
4
+ class InputError < Base
5
+ def template(&block)
6
+ p(**attrs, &block)
7
+ end
8
8
 
9
- private
9
+ private
10
10
 
11
- def default_attrs
12
- {
13
- class: "mt-2 text-sm text-destructive"
14
- }
15
- end
11
+ def default_attrs
12
+ {
13
+ class: "mt-2 text-sm text-destructive"
14
+ }
16
15
  end
17
- end
16
+ end
17
+ end
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class Label < Base
5
- def template(&)
6
- label(**attrs, &)
7
- end
4
+ class Label < Base
5
+ def template(&block)
6
+ label(**attrs, &block)
7
+ end
8
8
 
9
- private
9
+ private
10
10
 
11
- def default_attrs
12
- {
13
- class: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
14
- }
15
- end
11
+ def default_attrs
12
+ {
13
+ class: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
14
+ }
16
15
  end
17
- end
16
+ end
17
+ end
data/lib/phlex_ui/link.rb CHANGED
@@ -1,97 +1,97 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class Link < Base
5
- def initialize(href: "#", variant: :link, size: :md, icon: false, **attrs)
6
- @href = href
7
- @variant = variant.to_sym
8
- @size = size.to_sym
9
- @icon = icon
10
- super(**attrs)
11
- end
4
+ class Link < Base
5
+ def initialize(href: "#", variant: :link, size: :md, icon: false, **attrs)
6
+ @href = href
7
+ @variant = variant.to_sym
8
+ @size = size.to_sym
9
+ @icon = icon
10
+ super(**attrs)
11
+ end
12
12
 
13
- def template(&)
14
- a(href: @href, **attrs, &)
15
- end
13
+ def template(&block)
14
+ a(href: @href, **attrs, &block)
15
+ end
16
16
 
17
- private
17
+ private
18
18
 
19
- def size_classes
20
- if @icon
21
- case @size
22
- when :sm then "h-6 w-6"
23
- when :md then "h-9 w-9"
24
- when :lg then "h-10 w-10"
25
- when :xl then "h-12 w-12"
26
- end
27
- else
28
- case @size
29
- when :sm then "px-3 py-1.5 h-8 text-xs"
30
- when :md then "px-4 py-2 h-9 text-sm"
31
- when :lg then "px-4 py-2 h-10 text-base"
32
- when :xl then "px-6 py-3 h-12 text-base"
33
- end
34
- end
19
+ def size_classes
20
+ if @icon
21
+ case @size
22
+ when :sm then "h-6 w-6"
23
+ when :md then "h-9 w-9"
24
+ when :lg then "h-10 w-10"
25
+ when :xl then "h-12 w-12"
35
26
  end
36
-
37
- def primary_classes
38
- tokens(
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-text shadow hover:bg-primary/90",
40
- size_classes
41
- )
27
+ else
28
+ case @size
29
+ when :sm then "px-3 py-1.5 h-8 text-xs"
30
+ when :md then "px-4 py-2 h-9 text-sm"
31
+ when :lg then "px-4 py-2 h-10 text-base"
32
+ when :xl then "px-6 py-3 h-12 text-base"
42
33
  end
34
+ end
35
+ end
43
36
 
44
- def link_classes
45
- tokens(
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
- size_classes
48
- )
49
- end
37
+ def primary_classes
38
+ tokens(
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
+ size_classes
41
+ )
42
+ end
50
43
 
51
- def secondary_classes
52
- tokens(
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-muted-background text-text shadow-sm hover:bg-opacity-80",
54
- size_classes
55
- )
56
- end
44
+ def link_classes
45
+ tokens(
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
+ size_classes
48
+ )
49
+ end
57
50
 
58
- def destructive_classes
59
- tokens(
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-white shadow-sm hover:bg-destructive/90",
61
- size_classes
62
- )
63
- end
51
+ def secondary_classes
52
+ tokens(
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
+ size_classes
55
+ )
56
+ end
64
57
 
65
- def outline_classes
66
- tokens(
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-background hover:text-accent-text",
68
- size_classes
69
- )
70
- end
58
+ def destructive_classes
59
+ tokens(
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
+ size_classes
62
+ )
63
+ end
71
64
 
72
- def ghost_classes
73
- tokens(
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-background hover:text-accent-text",
75
- size_classes
76
- )
77
- end
65
+ def outline_classes
66
+ tokens(
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
+ size_classes
69
+ )
70
+ end
78
71
 
79
- def default_classes
80
- case @variant
81
- when :primary then primary_classes
82
- when :link then link_classes
83
- when :secondary then secondary_classes
84
- when :destructive then destructive_classes
85
- when :outline then outline_classes
86
- when :ghost then ghost_classes
87
- end
88
- end
72
+ def ghost_classes
73
+ tokens(
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
+ size_classes
76
+ )
77
+ end
89
78
 
90
- def default_attrs
91
- {
92
- type: "button",
93
- class: default_classes,
94
- }
95
- end
79
+ def default_classes
80
+ case @variant
81
+ when :primary then primary_classes
82
+ when :link then link_classes
83
+ when :secondary then secondary_classes
84
+ when :destructive then destructive_classes
85
+ when :outline then outline_classes
86
+ when :ghost then ghost_classes
87
+ end
88
+ end
89
+
90
+ def default_attrs
91
+ {
92
+ type: "button",
93
+ class: default_classes
94
+ }
96
95
  end
97
- end
96
+ end
97
+ end
@@ -1,22 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class Popover::Content < Base
5
- def template(&)
6
- template_tag(data: { popover_target: "content" }) do
7
- div(**attrs, &)
8
- end
9
- end
4
+ class Popover::Content < Base
5
+ def template(&block)
6
+ template_tag(data: {popover_target: "content"}) do
7
+ div(**attrs, &block)
8
+ end
9
+ end
10
10
 
11
- private
11
+ private
12
12
 
13
- def default_attrs
14
- {
15
- data: {
16
- state: :open
17
- },
18
- class: "z-50 rounded-md border bg-background p-2 text-text shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
19
- }
20
- end
13
+ def default_attrs
14
+ {
15
+ data: {
16
+ state: :open
17
+ },
18
+ class: "z-50 rounded-md border bg-background p-2 text-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
19
+ }
21
20
  end
22
- end
21
+ end
22
+ end
@@ -1,19 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class Popover::Trigger < Base
5
- def template(&)
6
- div(**attrs, &)
7
- end
4
+ class Popover::Trigger < Base
5
+ def template(&block)
6
+ div(**attrs, &block)
7
+ end
8
8
 
9
- private
9
+ private
10
10
 
11
- def default_attrs
12
- {
13
- data: {
14
- popover_target: 'trigger'
15
- }
16
- }
17
- end
11
+ def default_attrs
12
+ {
13
+ data: {
14
+ popover_target: "trigger"
15
+ },
16
+ class: "inline-block"
17
+ }
18
18
  end
19
- end
19
+ end
20
+ end