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.
- checksums.yaml +4 -4
- data/app/assets/tailwind/choices.css +324 -0
- data/app/assets/tailwind/vanilla-calendar-pro.css +5 -0
- data/app/javascript/controllers/combobox_controller.js +19 -276
- data/app/javascript/controllers/date_picker_controller.js +118 -0
- data/app/javascript/controllers/date_range_picker_controller.js +231 -0
- data/app/javascript/controllers/dropdown_menu_controller.js +1 -1
- data/app/javascript/controllers/hover_card_controller.js +33 -126
- data/app/javascript/controllers/sidebar_controller.js +0 -1
- data/app/javascript/controllers/tooltip_controller.js +32 -126
- data/lib/components/accordion.rb +3 -3
- data/lib/components/accordion_content.rb +12 -10
- data/lib/components/accordion_item.rb +3 -3
- data/lib/components/accordion_trigger.rb +3 -3
- data/lib/components/alert_description.rb +1 -1
- data/lib/components/alert_dialog.rb +2 -2
- data/lib/components/alert_dialog_action.rb +2 -2
- data/lib/components/alert_dialog_action_to.rb +5 -2
- data/lib/components/alert_dialog_cancel.rb +1 -1
- data/lib/components/alert_dialog_content.rb +1 -1
- data/lib/components/alert_dialog_description.rb +1 -1
- data/lib/components/alert_dialog_footer.rb +1 -1
- data/lib/components/alert_dialog_header.rb +1 -1
- data/lib/components/alert_dialog_title.rb +1 -1
- data/lib/components/alert_dialog_trigger.rb +2 -2
- data/lib/components/aspect_ratio.rb +1 -1
- data/lib/components/avatar.rb +1 -1
- data/lib/components/avatar_fallback.rb +1 -1
- data/lib/components/avatar_image.rb +1 -2
- data/lib/components/badge.rb +2 -8
- data/lib/components/base.rb +5 -5
- data/lib/components/breadcrumb.rb +1 -1
- data/lib/components/breadcrumb_ellipsis.rb +1 -1
- data/lib/components/breadcrumb_item.rb +1 -1
- data/lib/components/breadcrumb_link.rb +1 -1
- data/lib/components/breadcrumb_page.rb +1 -1
- data/lib/components/breadcrumb_separator.rb +1 -1
- data/lib/components/button.rb +1 -1
- data/lib/components/card.rb +1 -1
- data/lib/components/card_content.rb +1 -1
- data/lib/components/card_description.rb +1 -1
- data/lib/components/card_footer.rb +1 -1
- data/lib/components/card_header.rb +1 -1
- data/lib/components/card_title.rb +1 -1
- data/lib/components/checkbox.rb +14 -10
- data/lib/components/checkbox_group.rb +26 -9
- data/lib/components/collapsible.rb +2 -3
- data/lib/components/collapsible_content.rb +2 -3
- data/lib/components/collapsible_trigger.rb +5 -5
- data/lib/components/combobox.rb +57 -0
- data/lib/components/combobox_item.rb +9 -0
- data/lib/components/date_picker.rb +94 -0
- data/lib/components/date_range_picker.rb +113 -0
- data/lib/components/dialog.rb +1 -1
- data/lib/components/dialog_close.rb +1 -1
- data/lib/components/dialog_content.rb +2 -2
- data/lib/components/dialog_description.rb +1 -1
- data/lib/components/dialog_footer.rb +1 -1
- data/lib/components/dialog_header.rb +1 -1
- data/lib/components/dialog_title.rb +1 -1
- data/lib/components/dialog_trigger.rb +2 -2
- data/lib/components/dropdown_menu.rb +5 -5
- data/lib/components/dropdown_menu_content.rb +12 -9
- data/lib/components/dropdown_menu_item.rb +5 -6
- data/lib/components/dropdown_menu_item_to.rb +6 -3
- data/lib/components/dropdown_menu_label.rb +2 -3
- data/lib/components/dropdown_menu_separator.rb +5 -5
- data/lib/components/dropdown_menu_trigger.rb +9 -10
- data/lib/components/form.rb +59 -0
- data/lib/components/form_error.rb +17 -0
- data/lib/components/form_hint.rb +17 -0
- data/lib/components/form_input.rb +49 -0
- data/lib/components/hover_card.rb +6 -6
- data/lib/components/hover_card_content.rb +8 -12
- data/lib/components/hover_card_trigger.rb +5 -11
- data/lib/components/input.rb +1 -1
- data/lib/components/label.rb +1 -2
- data/lib/components/link.rb +5 -2
- data/lib/components/loading_button.rb +1 -1
- data/lib/components/pagination.rb +4 -4
- data/lib/components/pagination_ellipsis.rb +3 -3
- data/lib/components/pagination_link.rb +5 -5
- data/lib/components/pagination_next.rb +5 -5
- data/lib/components/pagination_previous.rb +4 -4
- data/lib/components/popover.rb +6 -7
- data/lib/components/popover_content.rb +13 -10
- data/lib/components/popover_trigger.rb +5 -6
- data/lib/components/progress.rb +7 -7
- data/lib/components/radio_group.rb +4 -4
- data/lib/components/radio_group_item.rb +8 -8
- data/lib/components/select.rb +67 -72
- data/lib/components/select_content.rb +12 -7
- data/lib/components/select_group.rb +3 -3
- data/lib/components/select_item.rb +9 -8
- data/lib/components/select_label.rb +6 -5
- data/lib/components/select_trigger.rb +12 -10
- data/lib/components/separator.rb +3 -3
- data/lib/components/sheet.rb +9 -9
- data/lib/components/sheet_close.rb +4 -4
- data/lib/components/sheet_content.rb +13 -15
- data/lib/components/sheet_description.rb +3 -3
- data/lib/components/sheet_footer.rb +2 -2
- data/lib/components/sheet_header.rb +2 -2
- data/lib/components/sheet_title.rb +3 -3
- data/lib/components/sheet_trigger.rb +6 -6
- data/lib/components/sidebar.rb +30 -25
- data/lib/components/sidebar_container.rb +1 -1
- data/lib/components/sidebar_content.rb +1 -1
- data/lib/components/sidebar_footer.rb +2 -2
- data/lib/components/sidebar_group.rb +1 -1
- data/lib/components/sidebar_group_content.rb +1 -1
- data/lib/components/sidebar_group_label.rb +2 -2
- data/lib/components/sidebar_header.rb +2 -2
- data/lib/components/sidebar_inset.rb +1 -1
- data/lib/components/sidebar_menu.rb +2 -2
- data/lib/components/sidebar_menu_button.rb +5 -5
- data/lib/components/sidebar_menu_item.rb +1 -1
- data/lib/components/sidebar_menu_sub.rb +2 -2
- data/lib/components/sidebar_menu_sub_button.rb +7 -7
- data/lib/components/sidebar_menu_sub_item.rb +1 -1
- data/lib/components/sidebar_trigger.rb +5 -5
- data/lib/components/skeleton.rb +2 -2
- data/lib/components/switch.rb +10 -9
- data/lib/components/table.rb +7 -5
- data/lib/components/table_body.rb +2 -2
- data/lib/components/table_caption.rb +2 -2
- data/lib/components/table_cell.rb +2 -2
- data/lib/components/table_footer.rb +2 -2
- data/lib/components/table_head.rb +3 -3
- data/lib/components/table_header.rb +2 -2
- data/lib/components/table_row.rb +2 -2
- data/lib/components/tabs.rb +3 -3
- data/lib/components/tabs_content.rb +5 -5
- data/lib/components/tabs_list.rb +4 -4
- data/lib/components/tabs_trigger.rb +3 -3
- data/lib/components/textarea.rb +1 -1
- data/lib/components/theme_switcher.rb +2 -2
- data/lib/components/toast.rb +15 -14
- data/lib/components/toast_action.rb +5 -4
- data/lib/components/toast_action_to.rb +5 -2
- data/lib/components/toast_container.rb +5 -5
- data/lib/components/toast_content.rb +1 -1
- data/lib/components/toast_description.rb +1 -1
- data/lib/components/toast_title.rb +1 -1
- data/lib/components/tooltip.rb +8 -8
- data/lib/components/tooltip_content.rb +8 -11
- data/lib/components/tooltip_trigger.rb +9 -11
- data/lib/shadcn_phlexcomponents/alias.rb +4 -93
- data/lib/shadcn_phlexcomponents/version.rb +1 -1
- metadata +14 -5
- data/app/javascript/controllers/datepicker_controller.js +0 -47
- data/lib/components/datepicker.rb +0 -38
@@ -22,8 +22,8 @@ module ShadcnPhlexcomponents
|
|
22
22
|
if element.name == "button"
|
23
23
|
merged_attributes.delete(:role)
|
24
24
|
end
|
25
|
-
|
26
|
-
send(element.name, **merged_attributes) do
|
25
|
+
|
26
|
+
send(element.name, **merged_attributes) do
|
27
27
|
sanitize_as_child(element.children.to_s)
|
28
28
|
end
|
29
29
|
else
|
@@ -37,14 +37,14 @@ module ShadcnPhlexcomponents
|
|
37
37
|
aria: {
|
38
38
|
haspopup: "dialog",
|
39
39
|
expanded: false,
|
40
|
-
controls: "#{@aria_id}-content"
|
40
|
+
controls: "#{@aria_id}-content",
|
41
41
|
},
|
42
42
|
data: {
|
43
43
|
as_child: @as_child.to_s,
|
44
44
|
action: "click->shadcn-phlexcomponents--sheet#open",
|
45
|
-
"shadcn-phlexcomponents--sheet-target": "trigger"
|
46
|
-
}
|
45
|
+
"shadcn-phlexcomponents--sheet-target": "trigger",
|
46
|
+
},
|
47
47
|
}
|
48
48
|
end
|
49
49
|
end
|
50
|
-
end
|
50
|
+
end
|
data/lib/components/sidebar.rb
CHANGED
@@ -11,7 +11,7 @@ module ShadcnPhlexcomponents
|
|
11
11
|
PANEL_STYLES = {
|
12
12
|
sidebar: "group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
13
13
|
floating: "p-2",
|
14
|
-
inset: "p-2"
|
14
|
+
inset: "p-2",
|
15
15
|
}
|
16
16
|
|
17
17
|
def initialize(id:, variant: :sidebar, side: :left, width: "16rem", expanded: true, **attributes)
|
@@ -46,11 +46,11 @@ module ShadcnPhlexcomponents
|
|
46
46
|
def menu(**attributes, &)
|
47
47
|
SidebarMenu(**attributes, &)
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
def menu_item(**attributes, &)
|
51
51
|
SidebarMenuItem(**attributes, &)
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
def menu_button(**attributes, &)
|
55
55
|
SidebarMenuButton(**attributes, &)
|
56
56
|
end
|
@@ -58,11 +58,11 @@ module ShadcnPhlexcomponents
|
|
58
58
|
def menu_sub(**attributes, &)
|
59
59
|
SidebarMenuSub(**attributes, &)
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
def menu_sub_item(**attributes, &)
|
63
63
|
SidebarMenuSubItem(**attributes, &)
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
def menu_sub_button(**attributes, &)
|
67
67
|
SidebarMenuSubButton(**attributes, &)
|
68
68
|
end
|
@@ -72,32 +72,37 @@ module ShadcnPhlexcomponents
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def view_template(&)
|
75
|
-
div(
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
75
|
+
div(
|
76
|
+
id: @id,
|
77
|
+
class: "group peer hidden md:block",
|
78
|
+
style: { "--sidebar-width": @width },
|
79
|
+
data: {
|
80
|
+
side: @side,
|
81
|
+
variant: @variant,
|
82
|
+
collapsible: @expanded ? "" : "offcanvas",
|
83
|
+
sidebar_id: @sidebar_id,
|
84
|
+
state: @expanded ? "expanded" : "collapsed",
|
85
|
+
controller: "shadcn-phlexcomponents--sidebar",
|
86
|
+
},
|
87
|
+
) do
|
88
|
+
div(
|
89
|
+
class: "relative h-svh w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200
|
87
90
|
ease-linear group-data-[collapsible=offcanvas]:w-0 group-data-[side=right]:rotate-180
|
88
|
-
group-data-[collapsible=icon]:w-[--sidebar-width-icon]",
|
89
|
-
|
91
|
+
group-data-[collapsible=icon]:w-[--sidebar-width-icon]",
|
92
|
+
data: { "shadcn-phlexcomponents--sidebar-target": "panelOffset" },
|
93
|
+
)
|
90
94
|
|
91
|
-
div(
|
95
|
+
div(
|
96
|
+
class: "fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200
|
92
97
|
ease-linear md:flex left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]
|
93
98
|
group-data-[collapsible=icon]:w-[--sidebar-width-icon] #{PANEL_STYLES[@variant]}",
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
99
|
+
data: {
|
100
|
+
"shadcn-phlexcomponents--sidebar-target": "panel",
|
101
|
+
},
|
102
|
+
) do
|
98
103
|
div(**@attributes, &)
|
99
104
|
end
|
100
105
|
end
|
101
106
|
end
|
102
107
|
end
|
103
|
-
end
|
108
|
+
end
|
@@ -8,9 +8,9 @@ module ShadcnPhlexcomponents
|
|
8
8
|
duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0
|
9
9
|
group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0
|
10
10
|
HEREDOC
|
11
|
-
|
11
|
+
|
12
12
|
def view_template(&)
|
13
13
|
div(**@attributes, &)
|
14
14
|
end
|
15
15
|
end
|
16
|
-
end
|
16
|
+
end
|
@@ -30,9 +30,9 @@ module ShadcnPhlexcomponents
|
|
30
30
|
def default_attributes
|
31
31
|
{
|
32
32
|
data: {
|
33
|
-
active: @active.to_s
|
34
|
-
}
|
35
|
-
}
|
33
|
+
active: @active.to_s,
|
34
|
+
},
|
35
|
+
}
|
36
36
|
end
|
37
37
|
|
38
38
|
def default_styles
|
@@ -50,7 +50,7 @@ module ShadcnPhlexcomponents
|
|
50
50
|
merged_attributes = mix(@attributes, element_attributes)
|
51
51
|
merged_attributes[:class] = styles
|
52
52
|
|
53
|
-
send(element.name, **merged_attributes) do
|
53
|
+
send(element.name, **merged_attributes) do
|
54
54
|
sanitize_as_child(element.children.to_s)
|
55
55
|
end
|
56
56
|
else
|
@@ -58,4 +58,4 @@ module ShadcnPhlexcomponents
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
61
|
-
end
|
61
|
+
end
|
@@ -4,11 +4,11 @@ module ShadcnPhlexcomponents
|
|
4
4
|
class SidebarMenuSub < Base
|
5
5
|
STYLES = <<~HEREDOC
|
6
6
|
border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col
|
7
|
-
gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden
|
7
|
+
gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden#{" "}
|
8
8
|
HEREDOC
|
9
9
|
|
10
10
|
def view_template(&)
|
11
11
|
ul(**@attributes, &)
|
12
12
|
end
|
13
13
|
end
|
14
|
-
end
|
14
|
+
end
|
@@ -7,8 +7,8 @@ module ShadcnPhlexcomponents
|
|
7
7
|
active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground
|
8
8
|
flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-none
|
9
9
|
focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none
|
10
|
-
aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0
|
11
|
-
data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground
|
10
|
+
aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0#{" "}
|
11
|
+
data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground#{" "}
|
12
12
|
text-sm group-data-[collapsible=icon]:hidden cursor-pointer
|
13
13
|
HEREDOC
|
14
14
|
|
@@ -21,9 +21,9 @@ module ShadcnPhlexcomponents
|
|
21
21
|
def default_attributes
|
22
22
|
{
|
23
23
|
data: {
|
24
|
-
active: @active.to_s
|
25
|
-
}
|
26
|
-
}
|
24
|
+
active: @active.to_s,
|
25
|
+
},
|
26
|
+
}
|
27
27
|
end
|
28
28
|
|
29
29
|
def view_template(&)
|
@@ -37,7 +37,7 @@ module ShadcnPhlexcomponents
|
|
37
37
|
merged_attributes = mix(@attributes, element_attributes)
|
38
38
|
merged_attributes[:class] = styles
|
39
39
|
|
40
|
-
send(element.name, **merged_attributes) do
|
40
|
+
send(element.name, **merged_attributes) do
|
41
41
|
sanitize_as_child(element.children.to_s)
|
42
42
|
end
|
43
43
|
else
|
@@ -45,4 +45,4 @@ module ShadcnPhlexcomponents
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
48
|
-
end
|
48
|
+
end
|
@@ -14,15 +14,15 @@ module ShadcnPhlexcomponents
|
|
14
14
|
@sidebar_id = sidebar_id
|
15
15
|
super(**attributes)
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def default_attributes
|
19
19
|
{
|
20
20
|
data: {
|
21
21
|
sidebar_id: @sidebar_id,
|
22
22
|
controller: "shadcn-phlexcomponents--sidebar-trigger",
|
23
|
-
action: "click->shadcn-phlexcomponents--sidebar-trigger#toggle"
|
24
|
-
}
|
25
|
-
}
|
23
|
+
action: "click->shadcn-phlexcomponents--sidebar-trigger#toggle",
|
24
|
+
},
|
25
|
+
}
|
26
26
|
end
|
27
27
|
|
28
28
|
def view_template(&)
|
@@ -37,4 +37,4 @@ module ShadcnPhlexcomponents
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
|
-
end
|
40
|
+
end
|
data/lib/components/skeleton.rb
CHANGED
data/lib/components/switch.rb
CHANGED
@@ -2,15 +2,16 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class Switch < Base
|
5
|
-
STYLES = <<~HEREDOC
|
5
|
+
STYLES = <<~HEREDOC
|
6
6
|
peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full
|
7
|
-
border-2 border-transparent transition-colors focus-visible:outline-none
|
7
|
+
border-2 border-transparent transition-colors focus-visible:outline-none#{" "}
|
8
8
|
focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
|
9
9
|
focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50
|
10
10
|
data-[checked=true]:bg-primary data-[checked=false]:bg-input group/switch
|
11
11
|
HEREDOC
|
12
12
|
|
13
|
-
def initialize(name: nil, value: "1", unchecked_value: "0", checked: false, id: nil, include_hidden: true,
|
13
|
+
def initialize(name: nil, value: "1", unchecked_value: "0", checked: false, id: nil, include_hidden: true,
|
14
|
+
**attributes)
|
14
15
|
@name = name
|
15
16
|
@value = value
|
16
17
|
@unchecked_value = unchecked_value
|
@@ -31,7 +32,7 @@ module ShadcnPhlexcomponents
|
|
31
32
|
end
|
32
33
|
|
33
34
|
input(
|
34
|
-
type: "checkbox",
|
35
|
+
type: "checkbox",
|
35
36
|
value: @value,
|
36
37
|
class: "-translate-x-full pointer-events-none absolute top-0 left-0 size-4 opacity-0",
|
37
38
|
name: @name,
|
@@ -39,14 +40,14 @@ module ShadcnPhlexcomponents
|
|
39
40
|
checked: @checked,
|
40
41
|
aria: { hidden: true },
|
41
42
|
data: {
|
42
|
-
"shadcn-phlexcomponents--switch-target": "input"
|
43
|
-
}
|
43
|
+
"shadcn-phlexcomponents--switch-target": "input",
|
44
|
+
},
|
44
45
|
)
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
48
49
|
def default_attributes
|
49
|
-
{
|
50
|
+
{
|
50
51
|
id: @id,
|
51
52
|
type: "button",
|
52
53
|
role: "switch",
|
@@ -58,8 +59,8 @@ module ShadcnPhlexcomponents
|
|
58
59
|
controller: "shadcn-phlexcomponents--switch",
|
59
60
|
action: "click->shadcn-phlexcomponents--switch#toggle",
|
60
61
|
"shadcn-phlexcomponents--switch-checked-value": @checked,
|
61
|
-
}
|
62
|
+
},
|
62
63
|
}
|
63
64
|
end
|
64
65
|
end
|
65
|
-
end
|
66
|
+
end
|
data/lib/components/table.rb
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class Table < Base
|
5
|
-
STYLES = "w-full caption-bottom text-sm"
|
5
|
+
STYLES = "w-full caption-bottom text-sm"
|
6
6
|
|
7
|
-
def initialize(
|
7
|
+
def initialize(**attributes)
|
8
8
|
@columns = []
|
9
9
|
super(**attributes)
|
10
10
|
end
|
@@ -15,7 +15,7 @@ module ShadcnPhlexcomponents
|
|
15
15
|
|
16
16
|
def header(**attributes, &)
|
17
17
|
TableHeader(**attributes, &)
|
18
|
-
end
|
18
|
+
end
|
19
19
|
|
20
20
|
def caption(**attributes, &)
|
21
21
|
TableCaption(**attributes, &)
|
@@ -58,7 +58,9 @@ module ShadcnPhlexcomponents
|
|
58
58
|
@rows.each do |row|
|
59
59
|
tr(class: TableRow::STYLES) do
|
60
60
|
@columns.each do |column|
|
61
|
-
td(class: TAILWIND_MERGER.merge("#{TableCell::STYLES} #{column[:cell_class]}"))
|
61
|
+
td(class: TAILWIND_MERGER.merge("#{TableCell::STYLES} #{column[:cell_class]}")) do
|
62
|
+
column[:content].call(row)
|
63
|
+
end
|
62
64
|
end
|
63
65
|
end
|
64
66
|
end
|
@@ -70,4 +72,4 @@ module ShadcnPhlexcomponents
|
|
70
72
|
nil
|
71
73
|
end
|
72
74
|
end
|
73
|
-
end
|
75
|
+
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class TableCell < Base
|
5
|
-
STYLES = "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"
|
5
|
+
STYLES = "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"
|
6
6
|
|
7
7
|
def view_template(&)
|
8
8
|
td(**@attributes, &)
|
9
9
|
end
|
10
10
|
end
|
11
|
-
end
|
11
|
+
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class TableFooter < Base
|
5
|
-
STYLES = "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0"
|
5
|
+
STYLES = "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0"
|
6
6
|
|
7
7
|
def view_template(&)
|
8
8
|
tfoot(**@attributes, &)
|
9
9
|
end
|
10
10
|
end
|
11
|
-
end
|
11
|
+
end
|
@@ -4,11 +4,11 @@ module ShadcnPhlexcomponents
|
|
4
4
|
class TableHead < Base
|
5
5
|
STYLES = <<~HEREDOC
|
6
6
|
h-10 px-2 text-left align-middle font-medium text-muted-foreground
|
7
|
-
[&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]
|
7
|
+
[&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]#{" "}
|
8
8
|
HEREDOC
|
9
|
-
|
9
|
+
|
10
10
|
def view_template(&)
|
11
11
|
th(**@attributes, &)
|
12
12
|
end
|
13
13
|
end
|
14
|
-
end
|
14
|
+
end
|
data/lib/components/table_row.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class TableRow < Base
|
5
|
-
STYLES = "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
|
5
|
+
STYLES = "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
|
6
6
|
|
7
7
|
def view_template(&)
|
8
8
|
tr(**@attributes, &)
|
9
9
|
end
|
10
10
|
end
|
11
|
-
end
|
11
|
+
end
|
data/lib/components/tabs.rb
CHANGED
@@ -18,8 +18,8 @@ module ShadcnPhlexcomponents
|
|
18
18
|
dir: @dir,
|
19
19
|
data: {
|
20
20
|
controller: "shadcn-phlexcomponents--tabs",
|
21
|
-
"shadcn-phlexcomponents--tabs-selected-value": @value
|
22
|
-
}
|
21
|
+
"shadcn-phlexcomponents--tabs-selected-value": @value,
|
22
|
+
},
|
23
23
|
}
|
24
24
|
end
|
25
25
|
|
@@ -35,4 +35,4 @@ module ShadcnPhlexcomponents
|
|
35
35
|
TabsContent(aria_id: @aria_id, **attributes, &)
|
36
36
|
end
|
37
37
|
end
|
38
|
-
end
|
38
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class TabsContent < Base
|
5
|
-
STYLES = <<~HEREDOC
|
5
|
+
STYLES = <<~HEREDOC
|
6
6
|
mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2
|
7
7
|
focus-visible:ring-ring focus-visible:ring-offset-2 hidden
|
8
8
|
HEREDOC
|
@@ -23,13 +23,13 @@ module ShadcnPhlexcomponents
|
|
23
23
|
role: "tabpanel",
|
24
24
|
tabindex: "0",
|
25
25
|
aria: {
|
26
|
-
labelledby: "#{@aria_id}-trigger-#{@value}"
|
26
|
+
labelledby: "#{@aria_id}-trigger-#{@value}",
|
27
27
|
},
|
28
28
|
data: {
|
29
29
|
value: @value,
|
30
|
-
"shadcn-phlexcomponents--tabs-target": "content"
|
31
|
-
}
|
30
|
+
"shadcn-phlexcomponents--tabs-target": "content",
|
31
|
+
},
|
32
32
|
}
|
33
33
|
end
|
34
34
|
end
|
35
|
-
end
|
35
|
+
end
|
data/lib/components/tabs_list.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class TabsList < Base
|
5
|
-
STYLES = <<~HEREDOC
|
5
|
+
STYLES = <<~HEREDOC
|
6
6
|
inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground outline-none
|
7
7
|
HEREDOC
|
8
8
|
|
@@ -15,9 +15,9 @@ module ShadcnPhlexcomponents
|
|
15
15
|
role: "tablist",
|
16
16
|
tabindex: "-1",
|
17
17
|
aria: {
|
18
|
-
orientation: "horizontal"
|
19
|
-
}
|
18
|
+
orientation: "horizontal",
|
19
|
+
},
|
20
20
|
}
|
21
21
|
end
|
22
22
|
end
|
23
|
-
end
|
23
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class TabsTrigger < Base
|
5
|
-
STYLES = <<~HEREDOC
|
5
|
+
STYLES = <<~HEREDOC
|
6
6
|
inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm
|
7
7
|
font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2
|
8
8
|
focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50
|
@@ -38,8 +38,8 @@ module ShadcnPhlexcomponents
|
|
38
38
|
keydown.left->shadcn-phlexcomponents--tabs#setActiveToPrev:prevent
|
39
39
|
keydown.right->shadcn-phlexcomponents--tabs#setActiveToNext:prevent
|
40
40
|
HEREDOC
|
41
|
-
}
|
41
|
+
},
|
42
42
|
}
|
43
43
|
end
|
44
44
|
end
|
45
|
-
end
|
45
|
+
end
|
data/lib/components/textarea.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class ThemeSwitcher < Base
|
5
5
|
def view_template
|
6
|
-
Button(variant: :ghost, size: :icon, **@attributes)do
|
6
|
+
Button(variant: :ghost, size: :icon, **@attributes) do
|
7
7
|
icon("sun", class: "hidden dark:inline")
|
8
8
|
icon("moon", class: "inline dark:hidden")
|
9
9
|
end
|
@@ -18,4 +18,4 @@ module ShadcnPhlexcomponents
|
|
18
18
|
}
|
19
19
|
end
|
20
20
|
end
|
21
|
-
end
|
21
|
+
end
|