phlex_ui 0.0.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PhlexUI
4
+ class Command::DialogContent < Base
5
+ SIZES = {
6
+ xs: "max-w-sm",
7
+ sm: "max-w-md",
8
+ md: "max-w-lg",
9
+ lg: "max-w-2xl",
10
+ xl: "max-w-4xl",
11
+ full: "max-w-full",
12
+ }
13
+
14
+ def initialize(size: :md, **attrs)
15
+ @size = size
16
+ super(**attrs)
17
+ end
18
+
19
+ def template(&block)
20
+ template_tag(data: { dialog_target: "content" }) do
21
+ div(data: { controller: 'dismissable' }) do
22
+ backdrop
23
+ div(**attrs, &block)
24
+ end
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def default_attrs
31
+ {
32
+ data_state: "open",
33
+ class: tokens(
34
+ "fixed pointer-events-auto left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",
35
+ SIZES[@size]
36
+ ),
37
+ }
38
+ end
39
+
40
+ def backdrop
41
+ div(
42
+ data_state: "open",
43
+ data_action: "click->dismissable#dismiss esc->dismissable#dismiss",
44
+ class:
45
+ "fixed pointer-events-auto inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
46
+ )
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PhlexUI
4
+ class Command::DialogTrigger < Base
5
+ DEFAULT_KEYBINDINGS = [
6
+ "keydown.ctrl+k@window",
7
+ "keydown.meta+k@window"
8
+ ].freeze
9
+
10
+ def initialize(keybindings: DEFAULT_KEYBINDINGS, **attrs)
11
+ @keybindings = keybindings.map { |kb| "#{kb}->dialog#open" }
12
+ super(**attrs)
13
+ end
14
+
15
+ def template(&block)
16
+ div(**attrs, &block)
17
+ end
18
+
19
+ private
20
+
21
+ def default_attrs
22
+ {
23
+ data: {
24
+ action: tokens("click->dialog#open", @keybindings.join(' '))
25
+ },
26
+ }
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PhlexUI
4
+ class Command::Empty < Base
5
+ def template(&block)
6
+ div(**attrs, &block)
7
+ end
8
+
9
+ private
10
+
11
+ def default_attrs
12
+ {
13
+ class: "py-6 text-center text-sm",
14
+ role: "presentation",
15
+ data: { command_target: "empty" },
16
+ }
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PhlexUI
4
+ class Command::Group < Base
5
+ def initialize(title: nil, **attrs)
6
+ @title = title
7
+ super(**attrs)
8
+ end
9
+
10
+ def template(&block)
11
+ div(**attrs) do
12
+ render_header if @title
13
+ render_items(&block)
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def render_header
20
+ div(group_heading: @title) do
21
+ @title
22
+ end
23
+ end
24
+
25
+ def render_items(&block)
26
+ div(group_items: "", role: "group", &block)
27
+ end
28
+
29
+ def default_attrs
30
+ {
31
+ class:
32
+ "overflow-hidden p-1 text-foreground [&_[group-heading]]:px-2 [&_[group-heading]]:py-1.5 [&_[group-heading]]:text-xs [&_[group-heading]]:font-medium [&_[group-heading]]:text-muted-foreground",
33
+ role: "presentation",
34
+ data: {
35
+ value: @title,
36
+ command_target: "group",
37
+ }
38
+ }
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PhlexUI
4
+ class Command::Input < Base
5
+ def initialize(placeholder: "Type a command or search...", **attrs)
6
+ @placeholder = placeholder
7
+ super(**attrs)
8
+ end
9
+
10
+ def template
11
+ input_container do
12
+ search_icon
13
+ input(**attrs)
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def search_icon
20
+ svg(
21
+ xmlns: "http://www.w3.org/2000/svg",
22
+ viewbox: "0 0 20 20",
23
+ fill: "currentColor",
24
+ class: "w-4 h-4 mr-1.5"
25
+ ) do |s|
26
+ s.path(
27
+ fill_rule: "evenodd",
28
+ d:
29
+ "M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z",
30
+ clip_rule: "evenodd"
31
+ )
32
+ end
33
+ end
34
+
35
+ def input_container(&block)
36
+ div(class: "flex items-center border-b px-3", &block)
37
+ end
38
+
39
+ def default_attrs
40
+ {
41
+ class: "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
42
+ placeholder: @placeholder,
43
+ data_action: "input->command#filter keydown.down->command#handleKeydown keydown.up->command#handleKeydown keydown.enter->command#handleKeydown keydown.esc->dismissable#dismiss",
44
+ data_command_target: "input",
45
+ autocomplete: "off",
46
+ autocorrect: "off",
47
+ spellcheck: false,
48
+ autofocus: true,
49
+ aria_autocomplete: "list",
50
+ role: "combobox",
51
+ aria_expanded: true,
52
+ value: ""
53
+ }
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PhlexUI
4
+ class Command::Item < Base
5
+ def initialize(value:, text: "", href: "#", **attrs)
6
+ @value = value
7
+ @text = text
8
+ @href = href
9
+ super(**attrs)
10
+ end
11
+
12
+ def template(&block)
13
+ a(**attrs, &block)
14
+ end
15
+
16
+ private
17
+
18
+ def default_attrs
19
+ {
20
+ class: "relative flex cursor-pointer select-none items-center gap-x-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
21
+ href: @href,
22
+ role: "option",
23
+ data: {
24
+ command_target: "item",
25
+ value: @value, text: @text
26
+ },
27
+ # aria_selected: "true", # Toggles aria-selected="true" on keydown
28
+ }
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PhlexUI
4
+ class Command::List < Base
5
+ def template(&block)
6
+ div(**attrs, &block)
7
+ end
8
+
9
+ private
10
+
11
+ def default_attrs
12
+ {
13
+ class: "divide-y divide-border",
14
+ }
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PhlexUI
4
+ class Command < Base
5
+ def template(&block)
6
+ div(**attrs, &block)
7
+ end
8
+
9
+ private
10
+
11
+ def default_attrs
12
+ {
13
+ data: { controller: "command" }
14
+ }
15
+ end
16
+ end
17
+ end
@@ -1,25 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class ContextMenu::Content < Base
5
- def template(&)
6
- template_tag(data: { popover_target: "content" }) do
7
- div(**attrs, &)
8
- end
9
- end
4
+ class ContextMenu::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
- role: "menu",
16
- aria_orientation: "vertical",
17
- data_state: "open",
18
- class:
19
- "z-50 min-w-[8rem] outline-none pointer-events-auto overflow-hidden rounded-md border bg-background p-1 text-text shadow-md 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",
20
- tabindex: "-1",
21
- data_orientation: "vertical",
22
- }
23
- end
13
+ def default_attrs
14
+ {
15
+ role: "menu",
16
+ aria_orientation: "vertical",
17
+ data_state: "open",
18
+ class:
19
+ "z-50 min-w-[8rem] outline-none pointer-events-auto overflow-hidden rounded-md border bg-background p-1 text-foreground shadow-md 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",
20
+ tabindex: "-1",
21
+ data_orientation: "vertical"
22
+ }
24
23
  end
25
- end
24
+ end
25
+ end
@@ -1,66 +1,66 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class ContextMenu::Item < Base
5
- def initialize(href: "#", checked: false, shortcut: nil, disabled: false, **attrs)
6
- @href = href
7
- @checked = checked
8
- @shortcut = shortcut
9
- @disabled = disabled
4
+ class ContextMenu::Item < Base
5
+ def initialize(href: "#", checked: false, shortcut: nil, disabled: false, **attrs)
6
+ @href = href
7
+ @checked = checked
8
+ @shortcut = shortcut
9
+ @disabled = disabled
10
10
 
11
- super(**attrs)
12
- end
11
+ super(**attrs)
12
+ end
13
13
 
14
- def template(&)
15
- a(**attrs) do
16
- render_checkmark if @checked
17
- yield
18
- render_shortcut if @shortcut
19
- end
20
- end
14
+ def template(&block)
15
+ a(**attrs) do
16
+ render_checkmark if @checked
17
+ yield
18
+ render_shortcut if @shortcut
19
+ end
20
+ end
21
21
 
22
- private
22
+ private
23
23
 
24
- def render_checkmark
25
- span(class: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center") do
26
- span(data_state: "checked") do
27
- svg(
28
- width: "15",
29
- height: "15",
30
- viewbox: "0 0 15 15",
31
- fill: "none",
32
- xmlns: "http://www.w3.org/2000/svg",
33
- class: "h-4 w-4"
34
- ) do |s|
35
- s.path(
36
- d:
37
- "M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",
38
- fill: "currentColor",
39
- fill_rule: "evenodd",
40
- clip_rule: "evenodd"
41
- )
42
- end
43
- end
44
- end
24
+ def render_checkmark
25
+ span(class: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center") do
26
+ span(data_state: "checked") do
27
+ svg(
28
+ width: "15",
29
+ height: "15",
30
+ viewbox: "0 0 15 15",
31
+ fill: "none",
32
+ xmlns: "http://www.w3.org/2000/svg",
33
+ class: "h-4 w-4"
34
+ ) do |s|
35
+ s.path(
36
+ d:
37
+ "M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",
38
+ fill: "currentColor",
39
+ fill_rule: "evenodd",
40
+ clip_rule: "evenodd"
41
+ )
42
+ end
45
43
  end
44
+ end
45
+ end
46
46
 
47
- def render_shortcut
48
- span(class: "ml-auto text-xs tracking-widest text-muted-text") { @shortcut }
49
- end
47
+ def render_shortcut
48
+ span(class: "ml-auto text-xs tracking-widest text-muted-foreground") { @shortcut }
49
+ end
50
50
 
51
- def default_attrs
52
- {
53
- href: @href,
54
- role: "menuitem",
55
- class:
56
- "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent-background hover:text-accent-text focus:bg-accent-background focus:text-accent-text aria-selected:bg-accent-background aria-selected:text-accent-text data-[disabled]:pointer-events-none data-[disabled]:opacity-50 pl-8",
57
- tabindex: "-1",
58
- data_orientation: "vertical",
59
- data_action: "click->popover#close",
60
- data_popover_target: "menuItem",
61
- data_disabled: @disabled,
62
- disabled: @disabled
63
- }
64
- end
51
+ def default_attrs
52
+ {
53
+ href: @href,
54
+ role: "menuitem",
55
+ class:
56
+ "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 pl-8",
57
+ tabindex: "-1",
58
+ data_orientation: "vertical",
59
+ data_action: "click->popover#close",
60
+ data_popover_target: "menuItem",
61
+ data_disabled: @disabled,
62
+ disabled: @disabled
63
+ }
65
64
  end
66
- end
65
+ end
66
+ end
@@ -1,24 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class ContextMenu::Label < Base
5
- def initialize(inset: false, **attrs)
6
- @inset = inset
7
- super(**attrs)
8
- end
4
+ class ContextMenu::Label < Base
5
+ def initialize(inset: false, **attrs)
6
+ @inset = inset
7
+ super(**attrs)
8
+ end
9
9
 
10
- def template(&)
11
- div(**attrs, &)
12
- end
10
+ def template(&block)
11
+ div(**attrs, &block)
12
+ end
13
13
 
14
- private
14
+ private
15
15
 
16
- def inset? = @inset
16
+ def inset? = @inset
17
17
 
18
- def default_attrs
19
- {
20
- class: tokens("px-2 py-1.5 text-sm font-semibold text-text", inset?: "pl-8")
21
- }
22
- end
18
+ def default_attrs
19
+ {
20
+ class: tokens("px-2 py-1.5 text-sm font-semibold text-foreground", inset?: "pl-8")
21
+ }
23
22
  end
24
- end
23
+ end
24
+ end
@@ -1,19 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class ContextMenu::Separator < Base
5
- def template
6
- div(**attrs)
7
- end
4
+ class ContextMenu::Separator < Base
5
+ def template
6
+ div(**attrs)
7
+ end
8
8
 
9
- private
9
+ private
10
10
 
11
- def default_attrs
12
- {
13
- role: "separator",
14
- aria_orientation: "horizontal",
15
- class: "-mx-1 my-1 h-px bg-border"
16
- }
17
- end
11
+ def default_attrs
12
+ {
13
+ role: "separator",
14
+ aria_orientation: "horizontal",
15
+ class: "-mx-1 my-1 h-px bg-border"
16
+ }
18
17
  end
19
- end
18
+ end
19
+ end
@@ -1,20 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class ContextMenu::Trigger < Base
5
- def template(&)
6
- div(**attrs, &)
7
- end
4
+ class ContextMenu::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
- action: 'contextmenu->popover#handleContextMenu'
16
- }
17
- }
18
- end
11
+ def default_attrs
12
+ {
13
+ data: {
14
+ popover_target: "trigger",
15
+ action: "contextmenu->popover#handleContextMenu"
16
+ }
17
+ }
19
18
  end
20
- end
19
+ end
20
+ end
@@ -1,26 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexUI
4
- class ContextMenu < Base
5
- def initialize(options: {}, **attrs)
6
- @options = options
7
- @options[:trigger] ||= "manual"
8
- super(**attrs)
9
- end
4
+ class ContextMenu < Base
5
+ def initialize(options: {}, **attrs)
6
+ @options = options
7
+ @options[:trigger] ||= "manual"
8
+ super(**attrs)
9
+ end
10
10
 
11
- def template(&)
12
- div(**attrs, &)
13
- end
11
+ def template(&block)
12
+ div(**attrs, &block)
13
+ end
14
14
 
15
- private
15
+ private
16
16
 
17
- def default_attrs
18
- {
19
- data: {
20
- controller: "popover",
21
- popover_options_value: @options.to_json
22
- }
23
- }
24
- end
17
+ def default_attrs
18
+ {
19
+ data: {
20
+ controller: "popover",
21
+ popover_options_value: @options.to_json
22
+ }
23
+ }
25
24
  end
26
- end
25
+ end
26
+ end