shadcn_phlexcomponents 0.1.17 → 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 +1 -0
- data/app/javascript/controllers/alert_dialog_controller.js +1 -0
- data/app/javascript/controllers/avatar_controller.js +1 -0
- data/app/javascript/controllers/checkbox_controller.js +1 -0
- data/app/javascript/controllers/collapsible_controller.js +1 -0
- data/app/javascript/controllers/combobox_controller.js +1 -1
- data/app/javascript/controllers/command_controller.js +1 -0
- data/app/javascript/controllers/date_picker_controller.js +21 -5
- data/app/javascript/controllers/date_range_picker_controller.js +1 -0
- data/app/javascript/controllers/dialog_controller.js +1 -0
- data/app/javascript/controllers/dropdown_menu_controller.js +1 -0
- data/app/javascript/controllers/dropdown_menu_sub_controller.js +1 -0
- data/app/javascript/controllers/form_field_controller.js +1 -0
- data/app/javascript/controllers/hover_card_controller.js +1 -0
- data/app/javascript/controllers/loading_button_controller.js +1 -0
- data/app/javascript/controllers/popover_controller.js +1 -0
- data/app/javascript/controllers/progress_controller.js +1 -0
- data/app/javascript/controllers/radio_group_controller.js +1 -0
- data/app/javascript/controllers/select_controller.js +1 -0
- data/app/javascript/controllers/slider_controller.js +1 -0
- data/app/javascript/controllers/switch_controller.js +1 -0
- data/app/javascript/controllers/tabs_controller.js +1 -0
- data/app/javascript/controllers/theme_switcher_controller.js +1 -0
- data/app/javascript/controllers/toast_container_controller.js +1 -0
- data/app/javascript/controllers/toast_controller.js +1 -0
- data/app/javascript/controllers/toggle_controller.js +1 -0
- data/app/javascript/controllers/toggle_group_controller.js +1 -0
- data/app/javascript/controllers/tooltip_controller.js +2 -1
- data/app/javascript/shadcn_phlexcomponents.js +27 -60
- data/app/javascript/utils/command.js +0 -2
- data/app/javascript/utils/floating_ui.js +10 -17
- data/app/stylesheets/date_picker.css +1 -1
- data/app/stylesheets/shadcn_phlexcomponents.css +173 -0
- 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 -1
- data/app/typescript/controllers/command_controller.ts +2 -0
- data/app/typescript/controllers/date_picker_controller.ts +27 -7
- 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 +3 -1
- data/app/typescript/shadcn_phlexcomponents.ts +27 -61
- data/app/typescript/utils/command.ts +0 -2
- data/app/typescript/utils/floating_ui.ts +11 -20
- data/app/typescript/utils/index.ts +1 -1
- data/lib/install/upgrade_shadcn_phlexcomponents.rb +28 -0
- data/lib/shadcn_phlexcomponents/components/accordion.rb +56 -13
- data/lib/shadcn_phlexcomponents/components/alert.rb +35 -16
- data/lib/shadcn_phlexcomponents/components/alert_dialog.rb +58 -18
- 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/base.rb +2 -2
- 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 +224 -81
- data/lib/shadcn_phlexcomponents/components/command.rb +167 -63
- data/lib/shadcn_phlexcomponents/components/date_picker.rb +140 -48
- data/lib/shadcn_phlexcomponents/components/date_range_picker.rb +26 -44
- data/lib/shadcn_phlexcomponents/components/dialog.rb +86 -32
- 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 +94 -28
- 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 +29 -24
- 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 +16 -14
- data/app/typescript/controllers/sidebar_controller.ts +0 -39
- data/app/typescript/controllers/sidebar_trigger_controller.ts +0 -21
@@ -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
|
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class Progress < Base
|
5
|
-
class_variants(
|
5
|
+
class_variants(
|
6
|
+
**(
|
7
|
+
ShadcnPhlexcomponents.configuration.progress&.dig(:root) ||
|
8
|
+
{
|
9
|
+
base: "bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",
|
10
|
+
}
|
11
|
+
),
|
12
|
+
)
|
6
13
|
|
7
14
|
def initialize(value: 0, **attributes)
|
8
15
|
@value = value
|
@@ -26,12 +33,36 @@ module ShadcnPhlexcomponents
|
|
26
33
|
|
27
34
|
def view_template
|
28
35
|
div(**@attributes) do
|
29
|
-
|
30
|
-
class: "bg-primary h-full w-full flex-1 transition-all",
|
31
|
-
style: "transform: translateX(-#{100 - @value}%)",
|
32
|
-
data: { progress_target: "indicator" },
|
33
|
-
)
|
36
|
+
ProgressIndicator(value: @value)
|
34
37
|
end
|
35
38
|
end
|
36
39
|
end
|
40
|
+
|
41
|
+
class ProgressIndicator < Base
|
42
|
+
class_variants(
|
43
|
+
**(
|
44
|
+
ShadcnPhlexcomponents.configuration.progress&.dig(:indicator) ||
|
45
|
+
{
|
46
|
+
base: "bg-primary h-full w-full flex-1 transition-all",
|
47
|
+
}
|
48
|
+
),
|
49
|
+
)
|
50
|
+
|
51
|
+
def initialize(value: nil, **attributes)
|
52
|
+
@value = value
|
53
|
+
super(**attributes)
|
54
|
+
end
|
55
|
+
|
56
|
+
def default_attributes
|
57
|
+
value = @value || 0
|
58
|
+
{
|
59
|
+
style: "transform: translateX(-#{100 - value}%)",
|
60
|
+
data: { progress_target: "indicator" },
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
def view_template
|
65
|
+
div(**@attributes)
|
66
|
+
end
|
67
|
+
end
|
37
68
|
end
|
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class RadioGroup < Base
|
5
|
-
class_variants(
|
5
|
+
class_variants(
|
6
|
+
**(
|
7
|
+
ShadcnPhlexcomponents.configuration.radio_group&.dig(:root) ||
|
8
|
+
{
|
9
|
+
base: "grid gap-3 outline-none",
|
10
|
+
}
|
11
|
+
),
|
12
|
+
)
|
6
13
|
|
7
14
|
def initialize(name: nil, value: nil, dir: "ltr", include_hidden: true, **attributes)
|
8
15
|
@name = name
|
@@ -87,12 +94,17 @@ module ShadcnPhlexcomponents
|
|
87
94
|
|
88
95
|
class RadioGroupItem < Base
|
89
96
|
class_variants(
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
97
|
+
**(
|
98
|
+
ShadcnPhlexcomponents.configuration.radio_group&.dig(:item) ||
|
99
|
+
{
|
100
|
+
base: <<~HEREDOC,
|
101
|
+
border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20
|
102
|
+
dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4
|
103
|
+
shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px]
|
104
|
+
disabled:cursor-not-allowed disabled:opacity-50 relative
|
105
|
+
HEREDOC
|
106
|
+
}
|
107
|
+
),
|
96
108
|
)
|
97
109
|
|
98
110
|
def initialize(name: nil, value: nil, checked: false, **attributes)
|
@@ -104,14 +116,7 @@ module ShadcnPhlexcomponents
|
|
104
116
|
|
105
117
|
def view_template(&)
|
106
118
|
button(**@attributes) do
|
107
|
-
|
108
|
-
class: "relative flex items-center justify-center",
|
109
|
-
data: {
|
110
|
-
radio_group_target: "indicator",
|
111
|
-
},
|
112
|
-
) do
|
113
|
-
icon("circle", class: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2")
|
114
|
-
end
|
119
|
+
RadioGroupItemIndicator()
|
115
120
|
|
116
121
|
input(
|
117
122
|
type: "radio",
|
@@ -152,4 +157,25 @@ module ShadcnPhlexcomponents
|
|
152
157
|
}
|
153
158
|
end
|
154
159
|
end
|
160
|
+
|
161
|
+
class RadioGroupItemIndicator < Base
|
162
|
+
class_variants(
|
163
|
+
**(
|
164
|
+
ShadcnPhlexcomponents.configuration.radio_group&.dig(:item_indicator) ||
|
165
|
+
{
|
166
|
+
base: "relative flex items-center justify-center",
|
167
|
+
}
|
168
|
+
),
|
169
|
+
)
|
170
|
+
|
171
|
+
def default_attributes
|
172
|
+
{ data: { radio_group_target: "indicator" } }
|
173
|
+
end
|
174
|
+
|
175
|
+
def view_template(&)
|
176
|
+
span(**@attributes) do
|
177
|
+
icon("circle", class: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2")
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
155
181
|
end
|