shadcn_phlexcomponents 0.1.18 → 0.1.19
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/README.md +321 -23
- data/app/javascript/controllers/accordion_controller.js +101 -90
- data/app/javascript/controllers/alert_dialog_controller.js +5 -4
- data/app/javascript/controllers/avatar_controller.js +12 -11
- data/app/javascript/controllers/checkbox_controller.js +26 -26
- data/app/javascript/controllers/collapsible_controller.js +35 -36
- data/app/javascript/controllers/combobox_controller.js +262 -231
- data/app/javascript/controllers/command_controller.js +205 -184
- data/app/javascript/controllers/date_picker_controller.js +252 -253
- data/app/javascript/controllers/date_range_picker_controller.js +189 -200
- data/app/javascript/controllers/dialog_controller.js +79 -78
- data/app/javascript/controllers/dropdown_menu_controller.js +229 -208
- data/app/javascript/controllers/dropdown_menu_sub_controller.js +111 -97
- data/app/javascript/controllers/form_field_controller.js +17 -16
- data/app/javascript/controllers/hover_card_controller.js +69 -71
- data/app/javascript/controllers/loading_button_controller.js +11 -10
- data/app/javascript/controllers/popover_controller.js +85 -78
- data/app/javascript/controllers/progress_controller.js +12 -11
- data/app/javascript/controllers/radio_group_controller.js +75 -74
- data/app/javascript/controllers/select_controller.js +247 -232
- data/app/javascript/controllers/sidebar_controller.js +26 -27
- data/app/javascript/controllers/sidebar_trigger_controller.js +12 -9
- data/app/javascript/controllers/slider_controller.js +74 -74
- data/app/javascript/controllers/switch_controller.js +23 -23
- data/app/javascript/controllers/tabs_controller.js +61 -61
- data/app/javascript/controllers/theme_switcher_controller.js +28 -27
- data/app/javascript/controllers/toast_container_controller.js +45 -31
- data/app/javascript/controllers/toast_controller.js +19 -18
- data/app/javascript/controllers/toggle_controller.js +17 -17
- data/app/javascript/controllers/toggle_group_controller.js +17 -17
- data/app/javascript/controllers/tooltip_controller.js +75 -77
- data/app/javascript/shadcn_phlexcomponents.js +27 -60
- data/app/javascript/utils/command.js +390 -334
- data/app/javascript/utils/floating_ui.js +139 -107
- data/app/javascript/utils/index.js +253 -190
- data/app/typescript/controllers/accordion_controller.ts +2 -0
- data/app/typescript/controllers/alert_dialog_controller.ts +2 -0
- data/app/typescript/controllers/avatar_controller.ts +2 -0
- data/app/typescript/controllers/checkbox_controller.ts +2 -0
- data/app/typescript/controllers/collapsible_controller.ts +2 -0
- data/app/typescript/controllers/combobox_controller.ts +2 -0
- data/app/typescript/controllers/command_controller.ts +2 -0
- data/app/typescript/controllers/date_picker_controller.ts +2 -0
- data/app/typescript/controllers/date_range_picker_controller.ts +2 -0
- data/app/typescript/controllers/dialog_controller.ts +2 -0
- data/app/typescript/controllers/dropdown_menu_controller.ts +2 -0
- data/app/typescript/controllers/dropdown_menu_sub_controller.ts +2 -0
- data/app/typescript/controllers/form_field_controller.ts +2 -0
- data/app/typescript/controllers/hover_card_controller.ts +2 -0
- data/app/typescript/controllers/loading_button_controller.ts +2 -0
- data/app/typescript/controllers/popover_controller.ts +2 -0
- data/app/typescript/controllers/progress_controller.ts +2 -0
- data/app/typescript/controllers/radio_group_controller.ts +2 -0
- data/app/typescript/controllers/select_controller.ts +2 -0
- data/app/typescript/controllers/slider_controller.ts +2 -0
- data/app/typescript/controllers/switch_controller.ts +2 -0
- data/app/typescript/controllers/tabs_controller.ts +2 -0
- data/app/typescript/controllers/theme_switcher_controller.ts +2 -0
- data/app/typescript/controllers/toast_container_controller.ts +2 -0
- data/app/typescript/controllers/toast_controller.ts +2 -0
- data/app/typescript/controllers/toggle_controller.ts +2 -0
- data/app/typescript/controllers/toggle_group_controller.ts +2 -0
- data/app/typescript/controllers/tooltip_controller.ts +2 -0
- data/app/typescript/shadcn_phlexcomponents.ts +27 -61
- data/app/typescript/utils/index.ts +7 -0
- data/lib/install/upgrade_shadcn_phlexcomponents.rb +28 -0
- data/lib/shadcn_phlexcomponents/components/accordion.rb +55 -12
- data/lib/shadcn_phlexcomponents/components/alert.rb +35 -16
- data/lib/shadcn_phlexcomponents/components/alert_dialog.rb +52 -12
- data/lib/shadcn_phlexcomponents/components/aspect_ratio.rb +33 -2
- data/lib/shadcn_phlexcomponents/components/avatar.rb +24 -7
- data/lib/shadcn_phlexcomponents/components/badge.rb +23 -18
- data/lib/shadcn_phlexcomponents/components/breadcrumb.rb +46 -6
- data/lib/shadcn_phlexcomponents/components/button.rb +32 -27
- data/lib/shadcn_phlexcomponents/components/card.rb +59 -10
- data/lib/shadcn_phlexcomponents/components/checkbox.rb +51 -30
- data/lib/shadcn_phlexcomponents/components/checkbox_group.rb +24 -4
- data/lib/shadcn_phlexcomponents/components/combobox.rb +212 -69
- data/lib/shadcn_phlexcomponents/components/command.rb +156 -52
- data/lib/shadcn_phlexcomponents/components/date_picker.rb +134 -48
- data/lib/shadcn_phlexcomponents/components/date_range_picker.rb +20 -42
- data/lib/shadcn_phlexcomponents/components/dialog.rb +80 -26
- data/lib/shadcn_phlexcomponents/components/dropdown_menu.rb +74 -25
- data/lib/shadcn_phlexcomponents/components/dropdown_menu_sub.rb +52 -24
- data/lib/shadcn_phlexcomponents/components/form/form_checkbox.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_checkbox_group.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_combobox.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_date_picker.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_date_range_picker.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_error.rb +8 -1
- data/lib/shadcn_phlexcomponents/components/form/form_helpers.rb +3 -2
- data/lib/shadcn_phlexcomponents/components/form/form_hint.rb +8 -1
- data/lib/shadcn_phlexcomponents/components/form/form_input.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_radio_group.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_select.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_slider.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_switch.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_textarea.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form.rb +22 -6
- data/lib/shadcn_phlexcomponents/components/hover_card.rb +48 -18
- data/lib/shadcn_phlexcomponents/components/input.rb +13 -8
- data/lib/shadcn_phlexcomponents/components/label.rb +9 -4
- data/lib/shadcn_phlexcomponents/components/link.rb +8 -1
- data/lib/shadcn_phlexcomponents/components/pagination.rb +34 -6
- data/lib/shadcn_phlexcomponents/components/popover.rb +43 -13
- data/lib/shadcn_phlexcomponents/components/progress.rb +37 -6
- data/lib/shadcn_phlexcomponents/components/radio_group.rb +41 -15
- data/lib/shadcn_phlexcomponents/components/select.rb +99 -42
- data/lib/shadcn_phlexcomponents/components/separator.rb +9 -4
- data/lib/shadcn_phlexcomponents/components/sheet.rb +87 -21
- data/lib/shadcn_phlexcomponents/components/skeleton.rb +8 -1
- data/lib/shadcn_phlexcomponents/components/switch.rb +45 -17
- data/lib/shadcn_phlexcomponents/components/table.rb +84 -17
- data/lib/shadcn_phlexcomponents/components/tabs.rb +36 -12
- data/lib/shadcn_phlexcomponents/components/textarea.rb +12 -7
- data/lib/shadcn_phlexcomponents/components/toast.rb +46 -20
- data/lib/shadcn_phlexcomponents/components/toast_container.rb +19 -14
- data/lib/shadcn_phlexcomponents/components/toggle.rb +28 -23
- data/lib/shadcn_phlexcomponents/components/tooltip.rb +49 -14
- data/lib/shadcn_phlexcomponents/configuration.rb +46 -0
- data/lib/shadcn_phlexcomponents/initializers/shadcn_phlexcomponents.rb +28 -0
- data/lib/shadcn_phlexcomponents/version.rb +1 -1
- data/lib/shadcn_phlexcomponents.rb +12 -1
- data/lib/tasks/upgrade.rake +10 -0
- metadata +15 -14
- data/app/typescript/controllers/sidebar_controller.ts +0 -39
- data/app/typescript/controllers/sidebar_trigger_controller.ts +0 -21
@@ -31,10 +31,15 @@ module ShadcnPhlexcomponents
|
|
31
31
|
|
32
32
|
class DropdownMenuSubTrigger < Base
|
33
33
|
class_variants(
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
**(
|
35
|
+
ShadcnPhlexcomponents.configuration.dropdown_menu_sub&.dig(:trigger) ||
|
36
|
+
{
|
37
|
+
base: <<~HEREDOC,
|
38
|
+
focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground
|
39
|
+
flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8
|
40
|
+
HEREDOC
|
41
|
+
}
|
42
|
+
),
|
38
43
|
)
|
39
44
|
|
40
45
|
def initialize(aria_id: nil, **attributes)
|
@@ -42,14 +47,6 @@ module ShadcnPhlexcomponents
|
|
42
47
|
super(**attributes)
|
43
48
|
end
|
44
49
|
|
45
|
-
def view_template(&)
|
46
|
-
div(**@attributes) do
|
47
|
-
yield
|
48
|
-
|
49
|
-
icon("chevron-right", class: "ml-auto size-4")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
50
|
def default_attributes
|
54
51
|
{
|
55
52
|
id: "#{@aria_id}-trigger",
|
@@ -80,17 +77,30 @@ module ShadcnPhlexcomponents
|
|
80
77
|
},
|
81
78
|
}
|
82
79
|
end
|
80
|
+
|
81
|
+
def view_template(&)
|
82
|
+
div(**@attributes) do
|
83
|
+
yield
|
84
|
+
|
85
|
+
icon("chevron-right", class: "ml-auto size-4")
|
86
|
+
end
|
87
|
+
end
|
83
88
|
end
|
84
89
|
|
85
90
|
class DropdownMenuSubContent < Base
|
86
91
|
class_variants(
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
92
|
+
**(
|
93
|
+
ShadcnPhlexcomponents.configuration.dropdown_menu_sub&.dig(:content) ||
|
94
|
+
{
|
95
|
+
base: <<~HEREDOC,
|
96
|
+
bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out
|
97
|
+
data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95
|
98
|
+
data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2
|
99
|
+
data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem]
|
100
|
+
origin-(--radix-popper-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg outline-none
|
101
|
+
HEREDOC
|
102
|
+
}
|
103
|
+
),
|
94
104
|
)
|
95
105
|
|
96
106
|
def initialize(aria_id: nil, side: :right, align: :start, **attributes)
|
@@ -124,13 +134,31 @@ module ShadcnPhlexcomponents
|
|
124
134
|
end
|
125
135
|
|
126
136
|
def view_template(&)
|
127
|
-
|
128
|
-
style: { display: "none" },
|
129
|
-
class: "fixed top-0 left-0 w-max z-50",
|
130
|
-
data: { dropdown_menu_sub_target: "contentContainer" },
|
131
|
-
) do
|
137
|
+
DropdownMenuSubContentContainer do
|
132
138
|
div(**@attributes, &)
|
133
139
|
end
|
134
140
|
end
|
135
141
|
end
|
142
|
+
|
143
|
+
class DropdownMenuSubContentContainer < Base
|
144
|
+
class_variants(
|
145
|
+
**(
|
146
|
+
ShadcnPhlexcomponents.configuration.dropdown_menu_sub&.dig(:content_container) ||
|
147
|
+
{
|
148
|
+
base: "fixed top-0 left-0 w-max z-50",
|
149
|
+
}
|
150
|
+
),
|
151
|
+
)
|
152
|
+
|
153
|
+
def default_attributes
|
154
|
+
{
|
155
|
+
style: { display: "none" },
|
156
|
+
data: { dropdown_menu_sub_target: "contentContainer" },
|
157
|
+
}
|
158
|
+
end
|
159
|
+
|
160
|
+
def view_template(&)
|
161
|
+
div(**@attributes, &)
|
162
|
+
end
|
163
|
+
end
|
136
164
|
end
|
@@ -55,7 +55,7 @@ module ShadcnPhlexcomponents
|
|
55
55
|
@id ||= field_id(@object_name, @method)
|
56
56
|
@name ||= field_name(@object_name, @method)
|
57
57
|
|
58
|
-
|
58
|
+
FormField do
|
59
59
|
div(class: "flex items-top space-x-2") do
|
60
60
|
div(class: "grid gap-1.5 relative", data: label_and_hint_container_attributes) do
|
61
61
|
@attributes[:class] = "#{@attributes[:class]} -mt-[1.5px] absolute top-0 left-0"
|
@@ -81,7 +81,7 @@ module ShadcnPhlexcomponents
|
|
81
81
|
@id ||= field_id(@object_name, @method)
|
82
82
|
@name ||= field_name(@object_name, @method)
|
83
83
|
|
84
|
-
|
84
|
+
FormField(data: label_and_hint_container_attributes) do
|
85
85
|
render_label(&)
|
86
86
|
|
87
87
|
CheckboxGroup(
|
@@ -49,7 +49,7 @@ module ShadcnPhlexcomponents
|
|
49
49
|
@id ||= field_id(@object_name, @method)
|
50
50
|
@name ||= field_name(@object_name, @method)
|
51
51
|
|
52
|
-
|
52
|
+
FormField(data: label_and_hint_container_attributes) do
|
53
53
|
render_label(&)
|
54
54
|
|
55
55
|
Combobox(id: @id, name: @name, value: @value, aria: aria_attributes, **@attributes) do |c|
|
@@ -35,7 +35,7 @@ module ShadcnPhlexcomponents
|
|
35
35
|
@id ||= field_id(@object_name, @method)
|
36
36
|
@name ||= field_name(@object_name, @method)
|
37
37
|
|
38
|
-
|
38
|
+
FormField(data: label_and_hint_container_attributes) do
|
39
39
|
render_label(&)
|
40
40
|
DatePicker(id: @id, name: @name, value: @value, aria: aria_attributes, **@attributes)
|
41
41
|
render_hint(&)
|
@@ -65,7 +65,7 @@ module ShadcnPhlexcomponents
|
|
65
65
|
field_name(@object_name, @end_method),
|
66
66
|
]
|
67
67
|
|
68
|
-
|
68
|
+
FormField(data: label_and_hint_container_attributes) do
|
69
69
|
render_label(&)
|
70
70
|
DateRangePicker(
|
71
71
|
id: @id,
|
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class FormError < Base
|
5
|
-
class_variants(
|
5
|
+
class_variants(
|
6
|
+
**(
|
7
|
+
ShadcnPhlexcomponents.configuration.form&.dig(:error) ||
|
8
|
+
{
|
9
|
+
base: "text-destructive text-sm",
|
10
|
+
}
|
11
|
+
),
|
12
|
+
)
|
6
13
|
|
7
14
|
def initialize(message, aria_id: nil, **attributes)
|
8
15
|
@message = message
|
@@ -25,12 +25,13 @@ module ShadcnPhlexcomponents
|
|
25
25
|
|
26
26
|
def hint(text = nil, **attributes, &)
|
27
27
|
@yield_hint = true
|
28
|
+
@hint = true
|
28
29
|
attrs = hint_attributes(**attributes)
|
29
30
|
|
30
31
|
if text
|
31
|
-
FormHint(text, **attrs)
|
32
|
+
FormHint(text, aria_id: @aria_id, **attrs)
|
32
33
|
else
|
33
|
-
FormHint(**attrs, &)
|
34
|
+
FormHint(aria_id: @aria_id, **attrs, &)
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class FormHint < Base
|
5
|
-
class_variants(
|
5
|
+
class_variants(
|
6
|
+
**(
|
7
|
+
ShadcnPhlexcomponents.configuration.form&.dig(:hint) ||
|
8
|
+
{
|
9
|
+
base: "text-muted-foreground text-sm",
|
10
|
+
}
|
11
|
+
),
|
12
|
+
)
|
6
13
|
|
7
14
|
def initialize(message = nil, aria_id: nil, **attributes)
|
8
15
|
@message = message
|
@@ -37,7 +37,7 @@ module ShadcnPhlexcomponents
|
|
37
37
|
@id ||= field_id(@object_name, @method)
|
38
38
|
@name ||= field_name(@object_name, @method)
|
39
39
|
|
40
|
-
|
40
|
+
FormField(data: label_and_hint_container_attributes) do
|
41
41
|
render_label(&)
|
42
42
|
Input(type: @type, id: @id, name: @name, value: @value, aria: aria_attributes, **@attributes)
|
43
43
|
render_hint(&)
|
@@ -71,7 +71,7 @@ module ShadcnPhlexcomponents
|
|
71
71
|
@id ||= field_id(@object_name, @method)
|
72
72
|
@name ||= field_name(@object_name, @method)
|
73
73
|
|
74
|
-
|
74
|
+
FormField(data: label_and_hint_container_attributes) do
|
75
75
|
render_label(&)
|
76
76
|
|
77
77
|
RadioGroup(
|
@@ -49,7 +49,7 @@ module ShadcnPhlexcomponents
|
|
49
49
|
@id ||= field_id(@object_name, @method)
|
50
50
|
@name ||= field_name(@object_name, @method)
|
51
51
|
|
52
|
-
|
52
|
+
FormField(data: label_and_hint_container_attributes) do
|
53
53
|
render_label(&)
|
54
54
|
|
55
55
|
Select(id: @id, name: @name, value: @value, aria: aria_attributes, **@attributes) do |s|
|
@@ -80,7 +80,7 @@ module ShadcnPhlexcomponents
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
|
83
|
+
FormField(data: label_and_hint_container_attributes) do
|
84
84
|
render_label(&)
|
85
85
|
Slider(id: @id, name: @name, value: @value, aria: aria_attributes, range: @range, **@attributes)
|
86
86
|
render_hint(&)
|
@@ -46,7 +46,7 @@ module ShadcnPhlexcomponents
|
|
46
46
|
@id ||= field_id(@object_name, @method)
|
47
47
|
@name ||= field_name(@object_name, @method)
|
48
48
|
|
49
|
-
|
49
|
+
FormField(data: label_and_hint_container_attributes) do
|
50
50
|
div(class: "flex items-center gap-2") do
|
51
51
|
Switch(
|
52
52
|
id: @id,
|
@@ -35,7 +35,7 @@ module ShadcnPhlexcomponents
|
|
35
35
|
@id ||= field_id(@object_name, @method)
|
36
36
|
@name ||= field_name(@object_name, @method)
|
37
37
|
|
38
|
-
|
38
|
+
FormField(data: label_and_hint_container_attributes) do
|
39
39
|
render_label(&)
|
40
40
|
|
41
41
|
# Wrap textarea in div to ensure spacing is correct as there were instances where certain browser extensions
|
@@ -19,13 +19,14 @@ module ShadcnPhlexcomponents
|
|
19
19
|
class Form < Base
|
20
20
|
include Phlex::Rails::Helpers::FormWith
|
21
21
|
|
22
|
-
def initialize(
|
22
|
+
def initialize(
|
23
|
+
model: false,
|
24
|
+
loading: false,
|
25
|
+
**options
|
26
|
+
)
|
23
27
|
@model = model
|
24
|
-
@scope = scope
|
25
|
-
@url = url
|
26
|
-
@format = format
|
27
|
-
@options = options
|
28
28
|
@loading = loading
|
29
|
+
@options = options
|
29
30
|
@object_name = model ? model.to_model.model_name.param_key : nil
|
30
31
|
end
|
31
32
|
|
@@ -133,7 +134,7 @@ module ShadcnPhlexcomponents
|
|
133
134
|
@form_class = @options[:class]
|
134
135
|
@options[:class] = "#{@options[:class]} #{"group" if @loading}"
|
135
136
|
# rubocop:disable Style/ExplicitBlockArgument
|
136
|
-
form_with(model: @model,
|
137
|
+
form_with(model: @model, **@options) do
|
137
138
|
yield
|
138
139
|
end
|
139
140
|
# rubocop:enable Style/ExplicitBlockArgument
|
@@ -168,4 +169,19 @@ module ShadcnPhlexcomponents
|
|
168
169
|
I18n.t(defaults.shift, model: model, default: defaults)
|
169
170
|
end
|
170
171
|
end
|
172
|
+
|
173
|
+
class FormField < Base
|
174
|
+
class_variants(
|
175
|
+
**(
|
176
|
+
ShadcnPhlexcomponents.configuration.form&.dig(:field) ||
|
177
|
+
{
|
178
|
+
base: "space-y-2",
|
179
|
+
}
|
180
|
+
),
|
181
|
+
)
|
182
|
+
|
183
|
+
def view_template(&)
|
184
|
+
div(**@attributes, &)
|
185
|
+
end
|
186
|
+
end
|
171
187
|
end
|
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class HoverCard < Base
|
5
|
-
class_variants(
|
5
|
+
class_variants(
|
6
|
+
**(
|
7
|
+
ShadcnPhlexcomponents.configuration.hover_card&.dig(:root) ||
|
8
|
+
{
|
9
|
+
base: "inline-flex max-w-fit",
|
10
|
+
}
|
11
|
+
),
|
12
|
+
)
|
6
13
|
|
7
14
|
def initialize(open: false, **attributes)
|
8
15
|
@open = open
|
@@ -71,13 +78,18 @@ module ShadcnPhlexcomponents
|
|
71
78
|
|
72
79
|
class HoverCardContent < Base
|
73
80
|
class_variants(
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
+
**(
|
82
|
+
ShadcnPhlexcomponents.configuration.hover_card&.dig(:content) ||
|
83
|
+
{
|
84
|
+
base: <<~HEREDOC,
|
85
|
+
bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out
|
86
|
+
data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95
|
87
|
+
data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2
|
88
|
+
data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64
|
89
|
+
origin-(--radix-popper-transform-origin) rounded-md border p-4 shadow-md outline-hidden
|
90
|
+
HEREDOC
|
91
|
+
}
|
92
|
+
),
|
81
93
|
)
|
82
94
|
|
83
95
|
def initialize(side: :bottom, align: :center, **attributes)
|
@@ -86,16 +98,6 @@ module ShadcnPhlexcomponents
|
|
86
98
|
super(**attributes)
|
87
99
|
end
|
88
100
|
|
89
|
-
def view_template(&)
|
90
|
-
div(
|
91
|
-
style: { display: "none" },
|
92
|
-
class: "fixed top-0 left-0 w-max z-50",
|
93
|
-
data: { hover_card_target: "contentContainer" },
|
94
|
-
) do
|
95
|
-
div(**@attributes, &)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
101
|
def default_attributes
|
100
102
|
{
|
101
103
|
tabindex: -1,
|
@@ -107,5 +109,33 @@ module ShadcnPhlexcomponents
|
|
107
109
|
},
|
108
110
|
}
|
109
111
|
end
|
112
|
+
|
113
|
+
def view_template(&)
|
114
|
+
HoverCardContentContainer do
|
115
|
+
div(**@attributes, &)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
class HoverCardContentContainer < Base
|
121
|
+
class_variants(
|
122
|
+
**(
|
123
|
+
ShadcnPhlexcomponents.configuration.hover_card&.dig(:content_container) ||
|
124
|
+
{
|
125
|
+
base: "fixed top-0 left-0 w-max z-50",
|
126
|
+
}
|
127
|
+
),
|
128
|
+
)
|
129
|
+
|
130
|
+
def default_attributes
|
131
|
+
{
|
132
|
+
style: { display: "none" },
|
133
|
+
data: { hover_card_target: "contentContainer" },
|
134
|
+
}
|
135
|
+
end
|
136
|
+
|
137
|
+
def view_template(&)
|
138
|
+
div(**@attributes, &)
|
139
|
+
end
|
110
140
|
end
|
111
141
|
end
|
@@ -3,14 +3,19 @@
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class Input < Base
|
5
5
|
class_variants(
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
**(
|
7
|
+
ShadcnPhlexcomponents.configuration.input ||
|
8
|
+
{
|
9
|
+
base: <<~HEREDOC,
|
10
|
+
file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground
|
11
|
+
dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base
|
12
|
+
shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent
|
13
|
+
file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm
|
14
|
+
focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]
|
15
|
+
aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive
|
16
|
+
HEREDOC
|
17
|
+
}
|
18
|
+
),
|
14
19
|
)
|
15
20
|
|
16
21
|
def initialize(type: :text, **attributes)
|
@@ -3,10 +3,15 @@
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class Label < Base
|
5
5
|
class_variants(
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
**(
|
7
|
+
ShadcnPhlexcomponents.configuration.label ||
|
8
|
+
{
|
9
|
+
base: <<~HEREDOC,
|
10
|
+
flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none
|
11
|
+
group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50
|
12
|
+
HEREDOC
|
13
|
+
}
|
14
|
+
),
|
10
15
|
)
|
11
16
|
|
12
17
|
def view_template(&)
|
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class Link < Base
|
5
|
-
class_variants(
|
5
|
+
class_variants(
|
6
|
+
**(
|
7
|
+
ShadcnPhlexcomponents.configuration.link ||
|
8
|
+
{
|
9
|
+
base: "font-medium underline underline-offset-4",
|
10
|
+
}
|
11
|
+
),
|
12
|
+
)
|
6
13
|
|
7
14
|
def initialize(name = nil, options = nil, html_options = nil)
|
8
15
|
@name = name
|
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class Pagination < Base
|
5
|
-
class_variants(
|
5
|
+
class_variants(
|
6
|
+
**(
|
7
|
+
ShadcnPhlexcomponents.configuration.pagination&.dig(:root) ||
|
8
|
+
{
|
9
|
+
base: "mx-auto flex w-full justify-center",
|
10
|
+
}
|
11
|
+
),
|
12
|
+
)
|
6
13
|
|
7
14
|
def item(**attributes, &)
|
8
15
|
PaginationItem(**attributes, &)
|
@@ -47,7 +54,14 @@ module ShadcnPhlexcomponents
|
|
47
54
|
end
|
48
55
|
|
49
56
|
class PaginationPrevious < Base
|
50
|
-
class_variants(
|
57
|
+
class_variants(
|
58
|
+
**(
|
59
|
+
ShadcnPhlexcomponents.configuration.pagination&.dig(:previous) ||
|
60
|
+
{
|
61
|
+
base: "gap-1 px-2.5 sm:pl-2.5",
|
62
|
+
}
|
63
|
+
),
|
64
|
+
)
|
51
65
|
|
52
66
|
def initialize(options = nil, html_options = nil)
|
53
67
|
@options = options
|
@@ -65,7 +79,7 @@ module ShadcnPhlexcomponents
|
|
65
79
|
def view_template
|
66
80
|
@html_options ||= {}
|
67
81
|
@html_options = mix(default_attributes, @html_options)
|
68
|
-
@html_options[:class] = class_variants(
|
82
|
+
@html_options[:class] = class_variants(class: @html_options[:class])
|
69
83
|
@html_options[:size] = :default
|
70
84
|
|
71
85
|
PaginationLink(@options, @html_options) do
|
@@ -76,7 +90,14 @@ module ShadcnPhlexcomponents
|
|
76
90
|
end
|
77
91
|
|
78
92
|
class PaginationNext < Base
|
79
|
-
class_variants(
|
93
|
+
class_variants(
|
94
|
+
**(
|
95
|
+
ShadcnPhlexcomponents.configuration.pagination&.dig(:next) ||
|
96
|
+
{
|
97
|
+
base: "gap-1 px-2.5 sm:pr-2.5",
|
98
|
+
}
|
99
|
+
),
|
100
|
+
)
|
80
101
|
|
81
102
|
def initialize(options = nil, html_options = nil)
|
82
103
|
@options = options
|
@@ -94,7 +115,7 @@ module ShadcnPhlexcomponents
|
|
94
115
|
def view_template
|
95
116
|
@html_options ||= {}
|
96
117
|
@html_options = mix(default_attributes, @html_options)
|
97
|
-
@html_options[:class] = class_variants(
|
118
|
+
@html_options[:class] = class_variants(class: @html_options[:class])
|
98
119
|
@html_options[:size] = :default
|
99
120
|
|
100
121
|
PaginationLink(@options, @html_options) do
|
@@ -146,7 +167,14 @@ module ShadcnPhlexcomponents
|
|
146
167
|
end
|
147
168
|
|
148
169
|
class PaginationEllipsis < Base
|
149
|
-
class_variants(
|
170
|
+
class_variants(
|
171
|
+
**(
|
172
|
+
ShadcnPhlexcomponents.configuration.pagination&.dig(:ellipsis) ||
|
173
|
+
{
|
174
|
+
base: "flex size-9 items-center justify-center",
|
175
|
+
}
|
176
|
+
),
|
177
|
+
)
|
150
178
|
|
151
179
|
def default_attributes
|
152
180
|
{
|
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class Popover < Base
|
5
|
-
class_variants(
|
5
|
+
class_variants(
|
6
|
+
**(
|
7
|
+
ShadcnPhlexcomponents.configuration.popover&.dig(:root) ||
|
8
|
+
{
|
9
|
+
base: "inline-flex max-w-fit",
|
10
|
+
}
|
11
|
+
),
|
12
|
+
)
|
6
13
|
|
7
14
|
def initialize(open: false, **attributes)
|
8
15
|
@open = open
|
@@ -73,13 +80,18 @@ module ShadcnPhlexcomponents
|
|
73
80
|
|
74
81
|
class PopoverContent < Base
|
75
82
|
class_variants(
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
+
**(
|
84
|
+
ShadcnPhlexcomponents.configuration.popover&.dig(:content) ||
|
85
|
+
{
|
86
|
+
base: <<~HEREDOC,
|
87
|
+
bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out
|
88
|
+
data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95
|
89
|
+
data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2
|
90
|
+
data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popper-transform-origin) rounded-md
|
91
|
+
border p-4 shadow-md outline-hidden
|
92
|
+
HEREDOC
|
93
|
+
}
|
94
|
+
),
|
83
95
|
)
|
84
96
|
|
85
97
|
def initialize(side: :bottom, align: :center, aria_id: nil, **attributes)
|
@@ -90,11 +102,7 @@ module ShadcnPhlexcomponents
|
|
90
102
|
end
|
91
103
|
|
92
104
|
def view_template(&)
|
93
|
-
|
94
|
-
style: { display: "none" },
|
95
|
-
class: "fixed top-0 left-0 w-max z-50",
|
96
|
-
data: { popover_target: "contentContainer" },
|
97
|
-
) do
|
105
|
+
PopoverContentContainer do
|
98
106
|
div(**@attributes, &)
|
99
107
|
end
|
100
108
|
end
|
@@ -113,4 +121,26 @@ module ShadcnPhlexcomponents
|
|
113
121
|
}
|
114
122
|
end
|
115
123
|
end
|
124
|
+
|
125
|
+
class PopoverContentContainer < Base
|
126
|
+
class_variants(
|
127
|
+
**(
|
128
|
+
ShadcnPhlexcomponents.configuration.popover&.dig(:content_container) ||
|
129
|
+
{
|
130
|
+
base: "fixed top-0 left-0 w-max z-50",
|
131
|
+
}
|
132
|
+
),
|
133
|
+
)
|
134
|
+
|
135
|
+
def default_attributes
|
136
|
+
{
|
137
|
+
style: { display: "none" },
|
138
|
+
data: { popover_target: "contentContainer" },
|
139
|
+
}
|
140
|
+
end
|
141
|
+
|
142
|
+
def view_template(&)
|
143
|
+
div(**@attributes, &)
|
144
|
+
end
|
145
|
+
end
|
116
146
|
end
|