ruby_ui 1.0.0.beta1 → 1.0.0.pre.alpha.4
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.
- checksums.yaml +4 -4
- data/lib/generators/rbui/base_generator.rb +17 -0
- data/lib/generators/rbui/component_generator.rb +137 -0
- data/lib/generators/rbui/install/install_generator.rb +194 -0
- data/lib/{ruby_ui → rbui}/accordion/accordion.rb +1 -1
- data/lib/{ruby_ui → rbui}/accordion/accordion_content.rb +2 -2
- data/lib/{ruby_ui → rbui}/accordion/accordion_default_content.rb +1 -1
- data/lib/{ruby_ui → rbui}/accordion/accordion_default_trigger.rb +3 -3
- data/lib/{ruby_ui → rbui}/accordion/accordion_icon.rb +2 -2
- data/lib/{ruby_ui → rbui}/accordion/accordion_item.rb +4 -4
- data/lib/{ruby_ui → rbui}/accordion/accordion_trigger.rb +2 -3
- data/lib/{ruby_ui → rbui}/alert/alert.rb +2 -2
- data/lib/{ruby_ui → rbui}/alert/alert_description.rb +1 -1
- data/lib/{ruby_ui → rbui}/alert/alert_title.rb +1 -1
- data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog.rb +3 -3
- data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_action.rb +2 -2
- data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_cancel.rb +3 -3
- data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_content.rb +4 -4
- data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_description.rb +1 -1
- data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_footer.rb +1 -1
- data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_header.rb +1 -1
- data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_title.rb +1 -1
- data/lib/{ruby_ui → rbui}/alert_dialog/alert_dialog_trigger.rb +2 -2
- data/lib/{ruby_ui → rbui}/aspect_ratio/aspect_ratio.rb +1 -1
- data/lib/{ruby_ui → rbui}/avatar/avatar.rb +2 -2
- data/lib/{ruby_ui → rbui}/avatar/avatar_fallback.rb +1 -1
- data/lib/{ruby_ui → rbui}/avatar/avatar_image.rb +1 -1
- data/lib/{ruby_ui → rbui}/badge/badge.rb +2 -2
- data/lib/{ruby_ui → rbui}/base.rb +8 -1
- data/lib/{ruby_ui → rbui}/button/button.rb +13 -13
- data/lib/rbui/calendar/calendar.rb +39 -0
- data/lib/{ruby_ui → rbui}/calendar/calendar_body.rb +2 -2
- data/lib/{ruby_ui → rbui}/calendar/calendar_days.rb +14 -14
- data/lib/{ruby_ui → rbui}/calendar/calendar_header.rb +1 -1
- data/lib/{ruby_ui → rbui}/calendar/calendar_next.rb +2 -2
- data/lib/{ruby_ui → rbui}/calendar/calendar_prev.rb +2 -2
- data/lib/{ruby_ui → rbui}/calendar/calendar_title.rb +2 -2
- data/lib/{ruby_ui → rbui}/calendar/calendar_weekdays.rb +2 -2
- data/lib/{ruby_ui → rbui}/card/card.rb +1 -1
- data/lib/{ruby_ui → rbui}/card/card_content.rb +1 -1
- data/lib/{ruby_ui → rbui}/card/card_description.rb +1 -1
- data/lib/{ruby_ui → rbui}/card/card_footer.rb +1 -1
- data/lib/{ruby_ui → rbui}/card/card_header.rb +1 -1
- data/lib/{ruby_ui → rbui}/card/card_title.rb +1 -1
- data/lib/{ruby_ui → rbui}/chart/chart.rb +3 -3
- data/lib/{ruby_ui → rbui}/checkbox/checkbox.rb +4 -4
- data/lib/{ruby_ui → rbui}/checkbox/checkbox_group.rb +2 -2
- data/lib/{ruby_ui → rbui}/clipboard/clipboard.rb +6 -6
- data/lib/{ruby_ui → rbui}/clipboard/clipboard_popover.rb +2 -2
- data/lib/{ruby_ui → rbui}/clipboard/clipboard_source.rb +2 -2
- data/lib/{ruby_ui → rbui}/clipboard/clipboard_trigger.rb +3 -3
- data/lib/{ruby_ui → rbui}/codeblock/codeblock.rb +10 -7
- data/lib/{ruby_ui → rbui}/collapsible/collapsible.rb +3 -3
- data/lib/{ruby_ui → rbui}/collapsible/collapsible_content.rb +2 -2
- data/lib/{ruby_ui → rbui}/collapsible/collapsible_trigger.rb +2 -2
- data/lib/rbui/combobox/combobox.rb +24 -0
- data/lib/rbui/combobox/combobox_content.rb +31 -0
- data/lib/{ruby_ui → rbui}/combobox/combobox_empty.rb +2 -2
- data/lib/{ruby_ui → rbui}/combobox/combobox_group.rb +2 -2
- data/lib/{ruby_ui → rbui}/combobox/combobox_input.rb +4 -4
- data/lib/{ruby_ui → rbui}/combobox/combobox_item.rb +5 -5
- data/lib/{ruby_ui → rbui}/combobox/combobox_list.rb +4 -2
- data/lib/{ruby_ui → rbui}/combobox/combobox_search_input.rb +3 -3
- data/lib/{ruby_ui → rbui}/combobox/combobox_separator.rb +1 -1
- data/lib/{ruby_ui → rbui}/combobox/combobox_trigger.rb +3 -3
- data/lib/{ruby_ui → rbui}/combobox/combobox_value.rb +2 -2
- data/lib/{ruby_ui → rbui}/command/command.rb +1 -1
- data/lib/{ruby_ui → rbui}/command/command_dialog.rb +2 -2
- data/lib/{ruby_ui → rbui}/command/command_dialog_content.rb +6 -6
- data/lib/{ruby_ui → rbui}/command/command_dialog_trigger.rb +3 -3
- data/lib/{ruby_ui → rbui}/command/command_empty.rb +2 -2
- data/lib/{ruby_ui → rbui}/command/command_group.rb +2 -2
- data/lib/{ruby_ui → rbui}/command/command_input.rb +3 -3
- data/lib/{ruby_ui → rbui}/command/command_item.rb +2 -2
- data/lib/{ruby_ui → rbui}/command/command_list.rb +1 -1
- data/lib/{ruby_ui → rbui}/context_menu/context_menu.rb +2 -2
- data/lib/{ruby_ui → rbui}/context_menu/context_menu_content.rb +2 -2
- data/lib/{ruby_ui → rbui}/context_menu/context_menu_item.rb +3 -3
- data/lib/{ruby_ui → rbui}/context_menu/context_menu_label.rb +2 -2
- data/lib/{ruby_ui → rbui}/context_menu/context_menu_separator.rb +1 -1
- data/lib/{ruby_ui → rbui}/context_menu/context_menu_trigger.rb +3 -3
- data/lib/{ruby_ui → rbui}/dialog/dialog.rb +3 -3
- data/lib/{ruby_ui → rbui}/dialog/dialog_content.rb +7 -7
- data/lib/{ruby_ui → rbui}/dialog/dialog_description.rb +1 -1
- data/lib/{ruby_ui → rbui}/dialog/dialog_footer.rb +1 -1
- data/lib/{ruby_ui → rbui}/dialog/dialog_header.rb +1 -1
- data/lib/{ruby_ui → rbui}/dialog/dialog_middle.rb +1 -1
- data/lib/{ruby_ui → rbui}/dialog/dialog_title.rb +1 -1
- data/lib/{ruby_ui → rbui}/dialog/dialog_trigger.rb +2 -2
- data/lib/{ruby_ui → rbui}/dropdown_menu/dropdown_menu.rb +4 -4
- data/lib/{ruby_ui → rbui}/dropdown_menu/dropdown_menu_content.rb +2 -2
- data/lib/{ruby_ui → rbui}/dropdown_menu/dropdown_menu_item.rb +3 -3
- data/lib/{ruby_ui → rbui}/dropdown_menu/dropdown_menu_label.rb +1 -1
- data/lib/{ruby_ui → rbui}/dropdown_menu/dropdown_menu_separator.rb +1 -1
- data/lib/{ruby_ui → rbui}/dropdown_menu/dropdown_menu_trigger.rb +2 -2
- data/lib/{ruby_ui → rbui}/form/form.rb +1 -1
- data/lib/{ruby_ui → rbui}/form/form_field.rb +2 -2
- data/lib/{ruby_ui → rbui}/form/form_field_error.rb +2 -2
- data/lib/{ruby_ui → rbui}/form/form_field_hint.rb +1 -1
- data/lib/{ruby_ui → rbui}/form/form_field_label.rb +1 -1
- data/lib/{ruby_ui → rbui}/hover_card/hover_card.rb +3 -3
- data/lib/{ruby_ui → rbui}/hover_card/hover_card_content.rb +2 -2
- data/lib/{ruby_ui → rbui}/hover_card/hover_card_trigger.rb +2 -2
- data/lib/{ruby_ui → rbui}/input/input.rb +3 -3
- data/lib/{ruby_ui → rbui}/link/link.rb +13 -13
- data/lib/{ruby_ui → rbui}/pagination/pagination.rb +1 -1
- data/lib/{ruby_ui → rbui}/pagination/pagination_content.rb +1 -1
- data/lib/{ruby_ui → rbui}/pagination/pagination_ellipsis.rb +1 -1
- data/lib/{ruby_ui → rbui}/pagination/pagination_item.rb +4 -4
- data/lib/{ruby_ui → rbui}/popover/popover.rb +4 -4
- data/lib/{ruby_ui → rbui}/popover/popover_content.rb +2 -2
- data/lib/{ruby_ui → rbui}/popover/popover_trigger.rb +2 -2
- data/lib/{ruby_ui → rbui}/radio_button/radio_button.rb +3 -3
- data/lib/rbui/railtie.rb +52 -0
- data/lib/{ruby_ui → rbui}/select/select.rb +5 -5
- data/lib/{ruby_ui → rbui}/select/select_content.rb +3 -3
- data/lib/{ruby_ui → rbui}/select/select_group.rb +1 -1
- data/lib/{ruby_ui → rbui}/select/select_input.rb +4 -4
- data/lib/{ruby_ui → rbui}/select/select_item.rb +4 -4
- data/lib/{ruby_ui → rbui}/select/select_label.rb +1 -1
- data/lib/{ruby_ui → rbui}/select/select_trigger.rb +3 -3
- data/lib/{ruby_ui → rbui}/select/select_value.rb +2 -2
- data/lib/{ruby_ui → rbui}/sheet/sheet.rb +2 -2
- data/lib/{ruby_ui → rbui}/sheet/sheet_content.rb +7 -7
- data/lib/{ruby_ui → rbui}/sheet/sheet_description.rb +1 -1
- data/lib/{ruby_ui → rbui}/sheet/sheet_footer.rb +1 -1
- data/lib/{ruby_ui → rbui}/sheet/sheet_header.rb +1 -1
- data/lib/{ruby_ui → rbui}/sheet/sheet_middle.rb +1 -1
- data/lib/{ruby_ui → rbui}/sheet/sheet_title.rb +1 -1
- data/lib/{ruby_ui → rbui}/sheet/sheet_trigger.rb +2 -2
- data/lib/{ruby_ui → rbui}/shortcut_key/shortcut_key.rb +1 -1
- data/lib/{ruby_ui → rbui}/table/table.rb +1 -1
- data/lib/{ruby_ui → rbui}/table/table_body.rb +1 -1
- data/lib/{ruby_ui → rbui}/table/table_caption.rb +1 -1
- data/lib/{ruby_ui → rbui}/table/table_cell.rb +1 -1
- data/lib/{ruby_ui → rbui}/table/table_footer.rb +1 -1
- data/lib/{ruby_ui → rbui}/table/table_head.rb +1 -1
- data/lib/{ruby_ui → rbui}/table/table_header.rb +1 -1
- data/lib/{ruby_ui → rbui}/table/table_row.rb +1 -1
- data/lib/{ruby_ui → rbui}/tabs/tabs.rb +3 -3
- data/lib/{ruby_ui → rbui}/tabs/tabs_content.rb +2 -2
- data/lib/{ruby_ui → rbui}/tabs/tabs_list.rb +1 -1
- data/lib/{ruby_ui → rbui}/tabs/tabs_trigger.rb +3 -3
- data/lib/{ruby_ui → rbui}/textarea/textarea.rb +3 -3
- data/lib/{ruby_ui → rbui}/theme_toggle/theme_toggle.rb +4 -4
- data/lib/{ruby_ui → rbui}/tooltip/tooltip.rb +3 -3
- data/lib/{ruby_ui → rbui}/tooltip/tooltip_content.rb +3 -3
- data/lib/{ruby_ui → rbui}/tooltip/tooltip_trigger.rb +2 -2
- data/lib/{ruby_ui → rbui}/typography/typography_blockquote.rb +1 -1
- data/lib/rbui/typography/typography_h1.rb +17 -0
- data/lib/rbui/typography/typography_h2.rb +17 -0
- data/lib/rbui/typography/typography_h3.rb +17 -0
- data/lib/rbui/typography/typography_h4.rb +17 -0
- data/lib/{ruby_ui/typography/inline_code.rb → rbui/typography/typography_inline_code.rb} +2 -2
- data/lib/{ruby_ui/typography/inline_link.rb → rbui/typography/typography_inline_link.rb} +2 -2
- data/lib/rbui/typography/typography_large.rb +17 -0
- data/lib/rbui/typography/typography_lead.rb +17 -0
- data/lib/rbui/typography/typography_list.rb +47 -0
- data/lib/rbui/typography/typography_list_item.rb +17 -0
- data/lib/rbui/typography/typography_muted.rb +17 -0
- data/lib/rbui/typography/typography_p.rb +17 -0
- data/lib/rbui/typography/typography_small.rb +17 -0
- data/lib/rbui/version.rb +5 -0
- data/lib/rbui.rb +57 -0
- data/lib/ruby_ui.rb +1 -5
- metadata +174 -163
- data/lib/generators/ruby_ui/component_generator.rb +0 -130
- data/lib/generators/ruby_ui/install/install_generator.rb +0 -90
- data/lib/generators/ruby_ui/javascript_utils.rb +0 -36
- data/lib/ruby_ui/calendar/calendar.rb +0 -39
- data/lib/ruby_ui/combobox/combobox.rb +0 -24
- data/lib/ruby_ui/combobox/combobox_content.rb +0 -31
- data/lib/ruby_ui/masked_input/masked_input.rb +0 -15
- data/lib/ruby_ui/typography/heading.rb +0 -60
- data/lib/ruby_ui/typography/text.rb +0 -53
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RBUI
|
4
|
+
class ComboboxContent < Base
|
5
|
+
def initialize(**attrs)
|
6
|
+
@id = "content#{SecureRandom.hex(4)}"
|
7
|
+
super
|
8
|
+
end
|
9
|
+
|
10
|
+
def view_template(&)
|
11
|
+
div(**attrs) do
|
12
|
+
div(class: "min-w-max max-h-[300px] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-out group-data-[rbui--combobox-open-value=true]/combobox:animate-in fade-out-0 group-data-[rbui--combobox-open-value=true]/combobox:fade-in-0 zoom-out-95 group-data-[rbui--combobox-open-value=true]/combobox:zoom-in-95 slide-in-from-top-2", &)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def default_attrs
|
19
|
+
{
|
20
|
+
id: @id,
|
21
|
+
role: "listbox",
|
22
|
+
data: {
|
23
|
+
controller: "rbui--combobox-content",
|
24
|
+
rbui__combobox_target: "content",
|
25
|
+
action: "keydown.enter->rbui--combobox#onKeyEnter keydown.esc->rbui--combobox#onEscKey keydown.down->rbui--combobox#onKeyDown keydown.up->rbui--combobox#onKeyUp"
|
26
|
+
},
|
27
|
+
class: "combobox-content hidden w-full absolute top-0 left-0 z-50"
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class ComboboxEmpty < Base
|
5
5
|
def view_template(&)
|
6
6
|
div(**attrs, &)
|
@@ -13,7 +13,7 @@ module RubyUI
|
|
13
13
|
role: "presentation",
|
14
14
|
class: "hidden py-6 text-center text-sm",
|
15
15
|
data: {
|
16
|
-
|
16
|
+
rbui__combobox_content_target: "empty"
|
17
17
|
}
|
18
18
|
}
|
19
19
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class ComboboxGroup < Base
|
5
5
|
def initialize(heading: nil, **attrs)
|
6
6
|
@heading = heading
|
@@ -30,7 +30,7 @@ module RubyUI
|
|
30
30
|
role: "presentation",
|
31
31
|
data: {
|
32
32
|
value: @heading,
|
33
|
-
|
33
|
+
rbui__combobox_content_target: "group"
|
34
34
|
}
|
35
35
|
}
|
36
36
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class ComboboxInput < Base
|
5
5
|
def view_template
|
6
6
|
input(**attrs)
|
@@ -12,9 +12,9 @@ module RubyUI
|
|
12
12
|
{
|
13
13
|
class: "hidden",
|
14
14
|
data: {
|
15
|
-
|
16
|
-
|
17
|
-
action: "change->
|
15
|
+
rbui__combobox_target: "input",
|
16
|
+
rbui__form_field_target: "input",
|
17
|
+
action: "change->rbui--form-field#onChange invalid->rbui--form-field#onInvalid"
|
18
18
|
}
|
19
19
|
}
|
20
20
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class ComboboxItem < Base
|
5
5
|
def initialize(value: nil, **attrs)
|
6
6
|
@value = value
|
@@ -41,10 +41,10 @@ module RubyUI
|
|
41
41
|
"combobox-item group 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-[current]:bg-accent aria-[current]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
42
42
|
data: {
|
43
43
|
value: @value,
|
44
|
-
|
45
|
-
|
46
|
-
controller: "
|
47
|
-
action: "click->
|
44
|
+
rbui__combobox_target: "item",
|
45
|
+
rbui__combobox_content_target: "item",
|
46
|
+
controller: "rbui--combobox-item",
|
47
|
+
action: "click->rbui--combobox#onItemSelected"
|
48
48
|
},
|
49
49
|
aria_selected: "false"
|
50
50
|
}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require "securerandom"
|
4
|
+
|
5
|
+
module RBUI
|
4
6
|
class ComboboxList < Base
|
5
7
|
def initialize(**attrs)
|
6
8
|
@id = "list#{SecureRandom.hex(4)}"
|
@@ -17,7 +19,7 @@ module RubyUI
|
|
17
19
|
{
|
18
20
|
id: @id,
|
19
21
|
data: {
|
20
|
-
|
22
|
+
rbui__combobox_target: "list"
|
21
23
|
},
|
22
24
|
role: "listbox",
|
23
25
|
tabindex: "-1"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class ComboboxSearchInput < Base
|
5
5
|
def initialize(placeholder:, **attrs)
|
6
6
|
@placeholder = placeholder
|
@@ -44,8 +44,8 @@ module RubyUI
|
|
44
44
|
"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",
|
45
45
|
placeholder: @placeholder,
|
46
46
|
data: {
|
47
|
-
action: "input->
|
48
|
-
|
47
|
+
action: "input->rbui--combobox#onSearchInput",
|
48
|
+
rbui__combobox_target: "search"
|
49
49
|
},
|
50
50
|
autocomplete: "off",
|
51
51
|
autocorrect: "off",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class ComboboxTrigger < Base
|
5
5
|
def view_template(&block)
|
6
6
|
button(**attrs) do
|
@@ -34,8 +34,8 @@ module RubyUI
|
|
34
34
|
def default_attrs
|
35
35
|
{
|
36
36
|
data: {
|
37
|
-
action: "
|
38
|
-
|
37
|
+
action: "rbui--combobox#onTriggerClick",
|
38
|
+
rbui__combobox_target: "trigger"
|
39
39
|
},
|
40
40
|
type: "button",
|
41
41
|
role: "combobox",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class ComboboxValue < Base
|
5
5
|
def initialize(placeholder: nil, **attrs)
|
6
6
|
@placeholder = placeholder
|
@@ -18,7 +18,7 @@ module RubyUI
|
|
18
18
|
def default_attrs
|
19
19
|
{
|
20
20
|
data: {
|
21
|
-
|
21
|
+
rbui__combobox_target: "value"
|
22
22
|
},
|
23
23
|
class: "pointer-events-none"
|
24
24
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class CommandDialog < Base
|
5
5
|
def view_template(&)
|
6
6
|
div(**attrs, &)
|
@@ -10,7 +10,7 @@ module RubyUI
|
|
10
10
|
|
11
11
|
def default_attrs
|
12
12
|
{
|
13
|
-
data: {controller: "
|
13
|
+
data: {controller: "rbui--command"}
|
14
14
|
}
|
15
15
|
end
|
16
16
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class CommandDialogContent < Base
|
5
5
|
SIZES = {
|
6
6
|
xs: "max-w-sm",
|
@@ -17,8 +17,8 @@ module RubyUI
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def view_template(&block)
|
20
|
-
|
21
|
-
div(data: {controller: "
|
20
|
+
template_tag(data: {rbui__command_target: "content"}) do
|
21
|
+
div(data: {controller: "rbui--command"}) do
|
22
22
|
backdrop
|
23
23
|
div(**attrs, &block)
|
24
24
|
end
|
@@ -30,17 +30,17 @@ module RubyUI
|
|
30
30
|
def default_attrs
|
31
31
|
{
|
32
32
|
data_state: "open",
|
33
|
-
class:
|
33
|
+
class: tokens(
|
34
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
35
|
SIZES[@size]
|
36
|
-
|
36
|
+
)
|
37
37
|
}
|
38
38
|
end
|
39
39
|
|
40
40
|
def backdrop
|
41
41
|
div(
|
42
42
|
data_state: "open",
|
43
|
-
data_action: "click->
|
43
|
+
data_action: "click->rbui--command#dismiss esc->rbui--command#dismiss",
|
44
44
|
class: "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"
|
45
45
|
)
|
46
46
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class CommandDialogTrigger < Base
|
5
5
|
DEFAULT_KEYBINDINGS = [
|
6
6
|
"keydown.ctrl+k@window",
|
@@ -8,7 +8,7 @@ module RubyUI
|
|
8
8
|
].freeze
|
9
9
|
|
10
10
|
def initialize(keybindings: DEFAULT_KEYBINDINGS, **attrs)
|
11
|
-
@keybindings = keybindings.map { |kb| "#{kb}->
|
11
|
+
@keybindings = keybindings.map { |kb| "#{kb}->rbui--command#open" }
|
12
12
|
super(**attrs)
|
13
13
|
end
|
14
14
|
|
@@ -21,7 +21,7 @@ module RubyUI
|
|
21
21
|
def default_attrs
|
22
22
|
{
|
23
23
|
data: {
|
24
|
-
action:
|
24
|
+
action: tokens("click->rbui--command#open", @keybindings.join(" "))
|
25
25
|
}
|
26
26
|
}
|
27
27
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class CommandEmpty < Base
|
5
5
|
def view_template(&)
|
6
6
|
div(**attrs, &)
|
@@ -12,7 +12,7 @@ module RubyUI
|
|
12
12
|
{
|
13
13
|
class: "py-6 text-center text-sm",
|
14
14
|
role: "presentation",
|
15
|
-
data: {
|
15
|
+
data: {rbui__command_target: "empty"}
|
16
16
|
}
|
17
17
|
end
|
18
18
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class CommandGroup < Base
|
5
5
|
def initialize(title: nil, **attrs)
|
6
6
|
@title = title
|
@@ -32,7 +32,7 @@ module RubyUI
|
|
32
32
|
role: "presentation",
|
33
33
|
data: {
|
34
34
|
value: @title,
|
35
|
-
|
35
|
+
rbui__command_target: "group"
|
36
36
|
}
|
37
37
|
}
|
38
38
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class CommandInput < Base
|
5
5
|
def initialize(placeholder: "Type a command or search...", **attrs)
|
6
6
|
@placeholder = placeholder
|
@@ -40,8 +40,8 @@ module RubyUI
|
|
40
40
|
{
|
41
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
42
|
placeholder: @placeholder,
|
43
|
-
data_action: "input->
|
44
|
-
|
43
|
+
data_action: "input->rbui--command#filter keydown.down->rbui--command#handleKeydown keydown.up->rbui--command#handleKeydown keydown.enter->rbui--command#handleKeydown keydown.esc->rbui--command#dismiss",
|
44
|
+
data_rbui__command_target: "input",
|
45
45
|
autocomplete: "off",
|
46
46
|
autocorrect: "off",
|
47
47
|
spellcheck: false,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class CommandItem < Base
|
5
5
|
def initialize(value:, text: "", href: "#", **attrs)
|
6
6
|
@value = value
|
@@ -21,7 +21,7 @@ module RubyUI
|
|
21
21
|
href: @href,
|
22
22
|
role: "option",
|
23
23
|
data: {
|
24
|
-
|
24
|
+
rbui__command_target: "item",
|
25
25
|
value: @value,
|
26
26
|
text: @text
|
27
27
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class ContextMenu < Base
|
5
5
|
def initialize(options: {}, **attrs)
|
6
6
|
@options = options
|
@@ -17,7 +17,7 @@ module RubyUI
|
|
17
17
|
def default_attrs
|
18
18
|
{
|
19
19
|
data: {
|
20
|
-
controller: "
|
20
|
+
controller: "rbui--context-menu",
|
21
21
|
popover_options_value: @options.to_json
|
22
22
|
}
|
23
23
|
}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class ContextMenuContent < Base
|
5
5
|
def view_template(&block)
|
6
|
-
|
6
|
+
template_tag(data: {rbui__context_menu_target: "content"}) do
|
7
7
|
div(**attrs, &block)
|
8
8
|
end
|
9
9
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class ContextMenuItem < Base
|
5
5
|
def initialize(href: "#", checked: false, shortcut: nil, disabled: false, **attrs)
|
6
6
|
@href = href
|
@@ -56,8 +56,8 @@ module RubyUI
|
|
56
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
57
|
tabindex: "-1",
|
58
58
|
data_orientation: "vertical",
|
59
|
-
data_action: "click->
|
60
|
-
|
59
|
+
data_action: "click->rbui--context-menu#close",
|
60
|
+
data_rbui__context_menu_target: "menuItem",
|
61
61
|
data_disabled: @disabled,
|
62
62
|
disabled: @disabled
|
63
63
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class ContextMenuLabel < Base
|
5
5
|
def initialize(inset: false, **attrs)
|
6
6
|
@inset = inset
|
@@ -17,7 +17,7 @@ module RubyUI
|
|
17
17
|
|
18
18
|
def default_attrs
|
19
19
|
{
|
20
|
-
class:
|
20
|
+
class: tokens("px-2 py-1.5 text-sm font-semibold text-foreground", inset?: "pl-8")
|
21
21
|
}
|
22
22
|
end
|
23
23
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class ContextMenuTrigger < Base
|
5
5
|
def view_template(&)
|
6
6
|
div(**attrs, &)
|
@@ -11,8 +11,8 @@ module RubyUI
|
|
11
11
|
def default_attrs
|
12
12
|
{
|
13
13
|
data: {
|
14
|
-
|
15
|
-
action: "contextmenu->
|
14
|
+
rbui__context_menu_target: "trigger",
|
15
|
+
action: "contextmenu->rbui--context-menu#handleContextMenu"
|
16
16
|
}
|
17
17
|
}
|
18
18
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class Dialog < Base
|
5
5
|
def initialize(open: false, **attrs)
|
6
6
|
@open = open
|
@@ -16,8 +16,8 @@ module RubyUI
|
|
16
16
|
def default_attrs
|
17
17
|
{
|
18
18
|
data: {
|
19
|
-
controller: "
|
20
|
-
|
19
|
+
controller: "rbui--dialog",
|
20
|
+
rbui__dialog_open_value: @open
|
21
21
|
}
|
22
22
|
}
|
23
23
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class DialogContent < Base
|
5
5
|
SIZES = {
|
6
6
|
xs: "max-w-sm",
|
@@ -17,8 +17,8 @@ module RubyUI
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def view_template
|
20
|
-
|
21
|
-
div(data_controller: "
|
20
|
+
template_tag(data: {rbui__dialog_target: "content"}) do
|
21
|
+
div(data_controller: "rbui--dialog") do
|
22
22
|
backdrop
|
23
23
|
div(**attrs) do
|
24
24
|
yield
|
@@ -33,10 +33,10 @@ module RubyUI
|
|
33
33
|
def default_attrs
|
34
34
|
{
|
35
35
|
data_state: "open",
|
36
|
-
class:
|
36
|
+
class: tokens(
|
37
37
|
"fixed pointer-events-auto left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 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",
|
38
38
|
SIZES[@size]
|
39
|
-
|
39
|
+
)
|
40
40
|
}
|
41
41
|
end
|
42
42
|
|
@@ -44,7 +44,7 @@ module RubyUI
|
|
44
44
|
button(
|
45
45
|
type: "button",
|
46
46
|
class: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
|
47
|
-
data_action: "click->
|
47
|
+
data_action: "click->rbui--dialog#dismiss"
|
48
48
|
) do
|
49
49
|
svg(
|
50
50
|
width: "15",
|
@@ -69,7 +69,7 @@ module RubyUI
|
|
69
69
|
def backdrop
|
70
70
|
div(
|
71
71
|
data_state: "open",
|
72
|
-
data_action: "click->
|
72
|
+
data_action: "click->rbui--dialog#dismiss esc->rbui--dialog#dismiss",
|
73
73
|
class:
|
74
74
|
"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"
|
75
75
|
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class DialogTrigger < Base
|
5
5
|
def view_template(&)
|
6
6
|
div(**attrs, &)
|
@@ -11,7 +11,7 @@ module RubyUI
|
|
11
11
|
def default_attrs
|
12
12
|
{
|
13
13
|
data: {
|
14
|
-
action: "click->
|
14
|
+
action: "click->rbui--dialog#open"
|
15
15
|
},
|
16
16
|
class: "inline-block"
|
17
17
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class DropdownMenu < Base
|
5
5
|
def initialize(options: {}, **attrs)
|
6
6
|
@options = options
|
@@ -16,9 +16,9 @@ module RubyUI
|
|
16
16
|
def default_attrs
|
17
17
|
{
|
18
18
|
data: {
|
19
|
-
controller: "
|
20
|
-
action: "click@window->
|
21
|
-
|
19
|
+
controller: "rbui--dropdown-menu",
|
20
|
+
action: "click@window->rbui--dropdown-menu#onClickOutside",
|
21
|
+
rbui__dropdown_menu_options_value: @options.to_json
|
22
22
|
}
|
23
23
|
}
|
24
24
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class DropdownMenuContent < Base
|
5
5
|
def view_template(&block)
|
6
|
-
div(data: {
|
6
|
+
div(data: {rbui__dropdown_menu_target: "content"}, class: "hidden", style: "width: max-content; position: absolute; top: 0; left: 0;") do
|
7
7
|
div(**attrs, &block)
|
8
8
|
end
|
9
9
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RBUI
|
4
4
|
class DropdownMenuItem < Base
|
5
5
|
def initialize(href: "#", **attrs)
|
6
6
|
@href = href
|
@@ -18,8 +18,8 @@ module RubyUI
|
|
18
18
|
href: @href,
|
19
19
|
role: "menuitem",
|
20
20
|
class: "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors 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",
|
21
|
-
data_action: "click->
|
22
|
-
|
21
|
+
data_action: "click->rbui--dropdown-menu#close",
|
22
|
+
data_rbui__dropdown_menu_target: "menuItem",
|
23
23
|
tabindex: "-1",
|
24
24
|
data_orientation: "vertical"
|
25
25
|
}
|