plutonium 0.32.0 → 0.33.0
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/CHANGELOG.md +5 -0
- data/app/assets/plutonium.css +2 -2
- data/lib/plutonium/ui/action_button.rb +5 -11
- data/lib/plutonium/ui/block.rb +1 -4
- data/lib/plutonium/ui/breadcrumbs.rb +8 -10
- data/lib/plutonium/ui/color_mode_selector.rb +2 -2
- data/lib/plutonium/ui/component/behaviour.rb +0 -8
- data/lib/plutonium/ui/component/kit.rb +1 -1
- data/lib/plutonium/ui/display/components/attachment.rb +2 -2
- data/lib/plutonium/ui/display/theme.rb +16 -16
- data/lib/plutonium/ui/empty_card.rb +2 -5
- data/lib/plutonium/ui/form/components/key_value_store.rb +11 -11
- data/lib/plutonium/ui/form/components/secure_association.rb +2 -2
- data/lib/plutonium/ui/form/components/uppy.rb +5 -5
- data/lib/plutonium/ui/form/concerns/renders_nested_resource_fields.rb +5 -5
- data/lib/plutonium/ui/form/query.rb +11 -11
- data/lib/plutonium/ui/form/resource.rb +2 -2
- data/lib/plutonium/ui/form/theme.rb +17 -17
- data/lib/plutonium/ui/layout/base.rb +2 -2
- data/lib/plutonium/ui/layout/header.rb +7 -10
- data/lib/plutonium/ui/layout/rodauth_layout.rb +5 -5
- data/lib/plutonium/ui/layout/sidebar.rb +2 -2
- data/lib/plutonium/ui/nav_grid_menu.rb +6 -6
- data/lib/plutonium/ui/nav_user.rb +7 -8
- data/lib/plutonium/ui/page/interactive_action.rb +4 -4
- data/lib/plutonium/ui/page_header.rb +4 -7
- data/lib/plutonium/ui/panel.rb +3 -3
- data/lib/plutonium/ui/sidebar_menu.rb +12 -12
- data/lib/plutonium/ui/skeleton_table.rb +8 -8
- data/lib/plutonium/ui/tab_list.rb +3 -5
- data/lib/plutonium/ui/table/components/attachment.rb +2 -2
- data/lib/plutonium/ui/table/components/pagy_info.rb +3 -3
- data/lib/plutonium/ui/table/components/pagy_pagination.rb +3 -3
- data/lib/plutonium/ui/table/components/scopes_bar.rb +14 -14
- data/lib/plutonium/ui/table/display_theme.rb +3 -3
- data/lib/plutonium/ui/table/resource.rb +2 -2
- data/lib/plutonium/ui/table/theme.rb +13 -13
- data/lib/plutonium/version.rb +1 -1
- data/package.json +1 -1
- data/src/css/core.css +2 -2
- data/src/css/easymde.css +8 -8
- data/src/css/intl_tel_input.css +7 -7
- data/src/css/slim_select.css +5 -5
- data/tailwind.options.js +2 -30
- metadata +1 -3
- data/docs/guide/theming.md +0 -431
- data/lib/plutonium/ui/component/theme.rb +0 -47
|
@@ -70,29 +70,23 @@ module Plutonium
|
|
|
70
70
|
base_classes,
|
|
71
71
|
color_classes,
|
|
72
72
|
size_classes,
|
|
73
|
-
-> { @action.icon && @variant != :table } => "space-x-
|
|
73
|
+
-> { @action.icon && @variant != :table } => "space-x-1"
|
|
74
74
|
)
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
def base_classes
|
|
78
78
|
if @variant == :table
|
|
79
|
-
|
|
80
|
-
theme_class(:button, variant: :table),
|
|
81
|
-
"inline-flex items-center justify-center py-xs px-sm rounded-sm focus:outline-none focus:ring-2"
|
|
82
|
-
)
|
|
79
|
+
"inline-flex items-center justify-center py-1 px-2 rounded-lg focus:outline-none focus:ring-2"
|
|
83
80
|
else
|
|
84
|
-
|
|
85
|
-
theme_class(:button),
|
|
86
|
-
"flex items-center justify-center px-md py-sm text-sm font-medium rounded-sm focus:outline-none focus:ring-4"
|
|
87
|
-
)
|
|
81
|
+
"flex items-center justify-center px-4 py-2 text-sm font-medium rounded-lg focus:outline-none focus:ring-4"
|
|
88
82
|
end
|
|
89
83
|
end
|
|
90
84
|
|
|
91
85
|
def icon_classes
|
|
92
86
|
if @variant == :table
|
|
93
|
-
"h-4 w-4 mr-
|
|
87
|
+
"h-4 w-4 mr-1"
|
|
94
88
|
else
|
|
95
|
-
"h-3.5 w-3.5 -ml-
|
|
89
|
+
"h-3.5 w-3.5 -ml-1"
|
|
96
90
|
end
|
|
97
91
|
end
|
|
98
92
|
|
data/lib/plutonium/ui/block.rb
CHANGED
|
@@ -4,10 +4,7 @@ module Plutonium
|
|
|
4
4
|
def view_template(&)
|
|
5
5
|
raise ArgumentError, "Block requires a content block" unless block_given?
|
|
6
6
|
|
|
7
|
-
div class:
|
|
8
|
-
theme_class(:block),
|
|
9
|
-
"relative bg-surface dark:bg-surface-dark shadow-md sm:rounded-sm my-sm"
|
|
10
|
-
) do
|
|
7
|
+
div class: "relative bg-white dark:bg-gray-800 shadow-md sm:rounded-lg my-3" do
|
|
11
8
|
yield
|
|
12
9
|
end
|
|
13
10
|
end
|
|
@@ -6,15 +6,13 @@ module Plutonium
|
|
|
6
6
|
|
|
7
7
|
def view_template
|
|
8
8
|
nav(
|
|
9
|
-
class:
|
|
10
|
-
|
|
11
|
-
"flex py-sm text-gray-700 mb-sm"
|
|
12
|
-
),
|
|
9
|
+
class:
|
|
10
|
+
"flex py-3 text-gray-700 mb-2",
|
|
13
11
|
aria_label: "Breadcrumb"
|
|
14
12
|
) do
|
|
15
13
|
ol(
|
|
16
14
|
class:
|
|
17
|
-
"inline-flex items-center space-x-
|
|
15
|
+
"inline-flex items-center space-x-1 md:space-x-2 rtl:space-x-reverse"
|
|
18
16
|
) do
|
|
19
17
|
# Dashboard
|
|
20
18
|
li(class: "inline-flex items-center") do
|
|
@@ -44,7 +42,7 @@ module Plutonium
|
|
|
44
42
|
# Parent Resource
|
|
45
43
|
li(class: "flex items-center") do
|
|
46
44
|
svg(
|
|
47
|
-
class: "rtl:rotate-180 block w-3 h-3 mx-
|
|
45
|
+
class: "rtl:rotate-180 block w-3 h-3 mx-1 text-gray-400",
|
|
48
46
|
aria_hidden: "true",
|
|
49
47
|
xmlns: "http://www.w3.org/2000/svg",
|
|
50
48
|
fill: "none",
|
|
@@ -67,7 +65,7 @@ module Plutonium
|
|
|
67
65
|
# Parent Itself
|
|
68
66
|
li(class: "flex items-center") do
|
|
69
67
|
svg(
|
|
70
|
-
class: "rtl:rotate-180 block w-3 h-3 mx-
|
|
68
|
+
class: "rtl:rotate-180 block w-3 h-3 mx-1 text-gray-400",
|
|
71
69
|
aria_hidden: "true",
|
|
72
70
|
xmlns: "http://www.w3.org/2000/svg",
|
|
73
71
|
fill: "none",
|
|
@@ -94,7 +92,7 @@ module Plutonium
|
|
|
94
92
|
# Record Resource
|
|
95
93
|
li(class: "flex items-center") do
|
|
96
94
|
svg(
|
|
97
|
-
class: "rtl:rotate-180 block w-3 h-3 mx-
|
|
95
|
+
class: "rtl:rotate-180 block w-3 h-3 mx-1 text-gray-400",
|
|
98
96
|
aria_hidden: "true",
|
|
99
97
|
xmlns: "http://www.w3.org/2000/svg",
|
|
100
98
|
fill: "none",
|
|
@@ -119,7 +117,7 @@ module Plutonium
|
|
|
119
117
|
if resource_record!.persisted? && action_name != "show"
|
|
120
118
|
li(class: "flex items-center") do
|
|
121
119
|
svg(
|
|
122
|
-
class: "rtl:rotate-180 block w-3 h-3 mx-
|
|
120
|
+
class: "rtl:rotate-180 block w-3 h-3 mx-1 text-gray-400",
|
|
123
121
|
aria_hidden: "true",
|
|
124
122
|
xmlns: "http://www.w3.org/2000/svg",
|
|
125
123
|
fill: "none",
|
|
@@ -144,7 +142,7 @@ module Plutonium
|
|
|
144
142
|
# Trailing Caret
|
|
145
143
|
li(class: "flex items-center") do
|
|
146
144
|
svg(
|
|
147
|
-
class: "rtl:rotate-180 block w-3 h-3 mx-
|
|
145
|
+
class: "rtl:rotate-180 block w-3 h-3 mx-1 text-gray-400",
|
|
148
146
|
aria_hidden: "true",
|
|
149
147
|
xmlns: "http://www.w3.org/2000/svg",
|
|
150
148
|
fill: "none",
|
|
@@ -8,8 +8,8 @@ module Plutonium
|
|
|
8
8
|
class ColorModeSelector < Plutonium::UI::Component::Base
|
|
9
9
|
# Common CSS classes used across the component
|
|
10
10
|
COMMON_CLASSES = {
|
|
11
|
-
button: "
|
|
12
|
-
icon: "
|
|
11
|
+
button: "inline-flex justify-center items-center p-2 text-gray-500 rounded cursor-pointer dark:hover:text-white dark:text-gray-200 hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors duration-200",
|
|
12
|
+
icon: "w-5 h-5"
|
|
13
13
|
}.freeze
|
|
14
14
|
|
|
15
15
|
# Available color modes with their associated icons and actions
|
|
@@ -10,14 +10,6 @@ module Plutonium
|
|
|
10
10
|
include Kit
|
|
11
11
|
include Tokens
|
|
12
12
|
|
|
13
|
-
# Generate custom CSS class for theming
|
|
14
|
-
# @example
|
|
15
|
-
# theme_class(:button) # => "pu-button"
|
|
16
|
-
# theme_class(:button, variant: :table) # => "pu-button-table"
|
|
17
|
-
def theme_class(component, variant: nil, element: nil)
|
|
18
|
-
Theme.custom_class(component, variant:, element:)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
13
|
if Rails.env.development?
|
|
22
14
|
def around_template(&)
|
|
23
15
|
comment { "open:#{self.class.name}" }
|
|
@@ -34,12 +34,12 @@ module Plutonium
|
|
|
34
34
|
return unless attachment.url.present?
|
|
35
35
|
|
|
36
36
|
div(
|
|
37
|
-
class: "w-full aspect-square bg-white border border-gray-200 rounded-
|
|
37
|
+
class: "w-full aspect-square bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700 transition-all duration-300",
|
|
38
38
|
data: {attachment_preview_target: "thumbnail"}
|
|
39
39
|
) do
|
|
40
40
|
a(
|
|
41
41
|
href: attachment.url,
|
|
42
|
-
class: "block aspect-square overflow-hidden rounded-
|
|
42
|
+
class: "block aspect-square overflow-hidden rounded-lg",
|
|
43
43
|
target: :blank,
|
|
44
44
|
data: {attachment_preview_target: "thumbnailLink"}
|
|
45
45
|
) do
|
|
@@ -6,23 +6,23 @@ module Plutonium
|
|
|
6
6
|
class Theme < Phlexi::Display::Theme
|
|
7
7
|
def self.theme
|
|
8
8
|
super.merge({
|
|
9
|
-
base: "
|
|
9
|
+
base: "",
|
|
10
10
|
value_wrapper: "max-h-[300px] overflow-y-auto",
|
|
11
|
-
fields_wrapper: "
|
|
12
|
-
label: "
|
|
13
|
-
description: "
|
|
14
|
-
placeholder: "
|
|
15
|
-
string: "
|
|
16
|
-
text: "
|
|
17
|
-
link: "
|
|
18
|
-
color: "
|
|
19
|
-
color_indicator: "
|
|
20
|
-
email: "
|
|
21
|
-
phone: "
|
|
22
|
-
json: "
|
|
23
|
-
prefixed_icon: "
|
|
24
|
-
markdown: "
|
|
25
|
-
attachment_value_wrapper: "
|
|
11
|
+
fields_wrapper: "p-6 grid grid-cols-1 md:grid-cols-2 2xl:grid-cols-4 gap-6 gap-y-10 grid-flow-row-dense",
|
|
12
|
+
label: "text-base font-bold text-gray-500 dark:text-gray-400 mb-1",
|
|
13
|
+
description: "text-sm text-gray-400 dark:text-gray-500",
|
|
14
|
+
placeholder: "text-md text-gray-500 dark:text-gray-300 mb-1 italic",
|
|
15
|
+
string: "text-md text-gray-900 dark:text-white mb-1 whitespace-pre-line",
|
|
16
|
+
text: "text-md text-gray-900 dark:text-white mb-1 whitespace-pre-line",
|
|
17
|
+
link: "text-primary-600 dark:text-primary-500 whitespace-pre-line",
|
|
18
|
+
color: "flex items-center text-md text-gray-900 dark:text-white mb-1 whitespace-pre-line",
|
|
19
|
+
color_indicator: "w-10 h-10 rounded-full mr-2", # max-h-fit
|
|
20
|
+
email: "flex items-center text-md text-primary-600 dark:text-primary-500 mb-1 whitespace-pre-line",
|
|
21
|
+
phone: "flex items-center text-md text-primary-600 dark:text-primary-500 mb-1 whitespace-pre-line",
|
|
22
|
+
json: "text-sm text-gray-900 dark:text-white mb-1 whitespace-pre font-mono shadow-inner p-4",
|
|
23
|
+
prefixed_icon: "w-8 h-8 mr-2",
|
|
24
|
+
markdown: "format dark:format-invert format-primary",
|
|
25
|
+
attachment_value_wrapper: "grid grid-cols-[repeat(auto-fill,minmax(0,180px))]",
|
|
26
26
|
phlexi_render: :string
|
|
27
27
|
})
|
|
28
28
|
end
|
|
@@ -8,11 +8,8 @@ module Plutonium
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def view_template
|
|
11
|
-
div(class:
|
|
12
|
-
|
|
13
|
-
"relative bg-surface dark:bg-surface-dark shadow-md sm:rounded-sm"
|
|
14
|
-
)) do
|
|
15
|
-
div(class: "p-lg flex items-center flex-col gap-sm") do
|
|
11
|
+
div(class: "relative bg-white dark:bg-gray-800 shadow-md") do
|
|
12
|
+
div(class: "p-6 flex items-center flex-col gap-2") do
|
|
16
13
|
p(class: "text-gray-500 sm:text-lg dark:text-gray-200 text-center") { message }
|
|
17
14
|
yield if block_given?
|
|
18
15
|
end
|
|
@@ -60,7 +60,7 @@ module Plutonium
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
def render_key_value_pairs
|
|
63
|
-
div(class: "key-value-pairs space-y-
|
|
63
|
+
div(class: "key-value-pairs space-y-2", data_key_value_store_target: "container") do
|
|
64
64
|
pairs.each_with_index do |(key, value), index|
|
|
65
65
|
render_key_value_pair(key, value, index)
|
|
66
66
|
end
|
|
@@ -69,7 +69,7 @@ module Plutonium
|
|
|
69
69
|
|
|
70
70
|
def render_key_value_pair(key, value, index)
|
|
71
71
|
div(
|
|
72
|
-
class: "key-value-pair flex items-center gap-
|
|
72
|
+
class: "key-value-pair flex items-center gap-2 p-2 border border-gray-200 dark:border-gray-700 rounded",
|
|
73
73
|
data_key_value_store_target: "pair"
|
|
74
74
|
) do
|
|
75
75
|
# Key input
|
|
@@ -79,7 +79,7 @@ module Plutonium
|
|
|
79
79
|
value: key,
|
|
80
80
|
name: "#{field_name}[#{index}][key]",
|
|
81
81
|
id: "#{field.dom.id}_#{index}_key",
|
|
82
|
-
class: "flex-1 px-
|
|
82
|
+
class: "flex-1 px-3 py-1 text-sm border border-gray-300 rounded focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white",
|
|
83
83
|
data_key_value_store_target: "keyInput"
|
|
84
84
|
)
|
|
85
85
|
|
|
@@ -90,14 +90,14 @@ module Plutonium
|
|
|
90
90
|
value: value,
|
|
91
91
|
name: "#{field_name}[#{index}][value]",
|
|
92
92
|
id: "#{field.dom.id}_#{index}_value",
|
|
93
|
-
class: "flex-1 px-
|
|
93
|
+
class: "flex-1 px-3 py-1 text-sm border border-gray-300 rounded focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white",
|
|
94
94
|
data_key_value_store_target: "valueInput"
|
|
95
95
|
)
|
|
96
96
|
|
|
97
97
|
# Remove button
|
|
98
98
|
button(
|
|
99
99
|
type: :button,
|
|
100
|
-
class: "px-
|
|
100
|
+
class: "px-2 py-1 text-red-600 hover:text-red-800 focus:outline-none",
|
|
101
101
|
data_action: "key-value-store#removePair"
|
|
102
102
|
) do
|
|
103
103
|
plain "×"
|
|
@@ -106,11 +106,11 @@ module Plutonium
|
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
def render_add_button
|
|
109
|
-
div(class: "key-value-store-actions mt-
|
|
109
|
+
div(class: "key-value-store-actions mt-2") do
|
|
110
110
|
button(
|
|
111
111
|
type: :button,
|
|
112
112
|
id: "#{field.dom.id}_add_button",
|
|
113
|
-
class: "inline-flex items-center px-
|
|
113
|
+
class: "inline-flex items-center px-3 py-1 text-sm font-medium text-blue-600 bg-blue-50 border border-blue-200 rounded hover:bg-blue-100 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-blue-900 dark:text-blue-300 dark:border-blue-700 dark:hover:bg-blue-800",
|
|
114
114
|
data: {
|
|
115
115
|
action: "key-value-store#addPair",
|
|
116
116
|
key_value_store_target: "addButton"
|
|
@@ -124,7 +124,7 @@ module Plutonium
|
|
|
124
124
|
def render_template
|
|
125
125
|
template(data_key_value_store_target: "template") do
|
|
126
126
|
div(
|
|
127
|
-
class: "key-value-pair flex items-center gap-
|
|
127
|
+
class: "key-value-pair flex items-center gap-2 p-2 border border-gray-200 dark:border-gray-700 rounded",
|
|
128
128
|
data_key_value_store_target: "pair"
|
|
129
129
|
) do
|
|
130
130
|
input(
|
|
@@ -132,7 +132,7 @@ module Plutonium
|
|
|
132
132
|
placeholder: "Key",
|
|
133
133
|
name: "#{field_name}[__INDEX__][key]",
|
|
134
134
|
id: "#{field.dom.id}___INDEX___key",
|
|
135
|
-
class: "flex-1 px-
|
|
135
|
+
class: "flex-1 px-3 py-1 text-sm border border-gray-300 rounded focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white",
|
|
136
136
|
data_key_value_store_target: "keyInput"
|
|
137
137
|
)
|
|
138
138
|
|
|
@@ -141,13 +141,13 @@ module Plutonium
|
|
|
141
141
|
placeholder: "Value",
|
|
142
142
|
name: "#{field_name}[__INDEX__][value]",
|
|
143
143
|
id: "#{field.dom.id}___INDEX___value",
|
|
144
|
-
class: "flex-1 px-
|
|
144
|
+
class: "flex-1 px-3 py-1 text-sm border border-gray-300 rounded focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white",
|
|
145
145
|
data_key_value_store_target: "valueInput"
|
|
146
146
|
)
|
|
147
147
|
|
|
148
148
|
button(
|
|
149
149
|
type: :button,
|
|
150
|
-
class: "px-
|
|
150
|
+
class: "px-2 py-1 text-red-600 hover:text-red-800 focus:outline-none",
|
|
151
151
|
data_action: "key-value-store#removePair"
|
|
152
152
|
) do
|
|
153
153
|
plain "×"
|
|
@@ -8,7 +8,7 @@ module Plutonium
|
|
|
8
8
|
include Plutonium::UI::Component::Methods
|
|
9
9
|
|
|
10
10
|
def view_template
|
|
11
|
-
div(class: "flex space-x-
|
|
11
|
+
div(class: "flex space-x-1") do
|
|
12
12
|
super
|
|
13
13
|
render_add_button
|
|
14
14
|
end
|
|
@@ -24,7 +24,7 @@ module Plutonium
|
|
|
24
24
|
a(
|
|
25
25
|
href: add_url,
|
|
26
26
|
class:
|
|
27
|
-
"bg-gray-100 dark:bg-gray-600 dark:hover:bg-gray-700 dark:border-gray-500 hover:bg-gray-200 border border-gray-300 rounded-
|
|
27
|
+
"bg-gray-100 dark:bg-gray-600 dark:hover:bg-gray-700 dark:border-gray-500 hover:bg-gray-200 border border-gray-300 rounded-lg p-3 focus:ring-gray-100 dark:focus:ring-gray-700 focus:ring-2 focus:outline-none dark:text-white"
|
|
28
28
|
) do
|
|
29
29
|
render Phlex::TablerIcons::Plus.new(class: "w-3 h-3")
|
|
30
30
|
end
|
|
@@ -8,7 +8,7 @@ module Plutonium
|
|
|
8
8
|
include Phlexi::Form::Components::Concerns::UploadsFile
|
|
9
9
|
|
|
10
10
|
def view_template
|
|
11
|
-
div(class: tokens(field.dom.id, "flex flex-col-reverse gap-
|
|
11
|
+
div(class: tokens(field.dom.id, "flex flex-col-reverse gap-2")) do
|
|
12
12
|
div do
|
|
13
13
|
# Hidden field for ensuring removal of esp. has_one_attached attachments
|
|
14
14
|
input(type: :hidden, name: attributes[:name], multiple: attributes[:multiple], value: nil, autocomplete: "off", hidden: true)
|
|
@@ -16,7 +16,7 @@ module Plutonium
|
|
|
16
16
|
next if field.value.nil?
|
|
17
17
|
|
|
18
18
|
div(
|
|
19
|
-
class: "attachment-preview-container grid grid-cols-[repeat(auto-fill,minmax(0,180px))] gap-
|
|
19
|
+
class: "attachment-preview-container grid grid-cols-[repeat(auto-fill,minmax(0,180px))] gap-4",
|
|
20
20
|
data_controller: "attachment-preview-container"
|
|
21
21
|
) do
|
|
22
22
|
render_existing_attachments
|
|
@@ -67,7 +67,7 @@ module Plutonium
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
div(
|
|
70
|
-
class: "attachment-preview group relative bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-
|
|
70
|
+
class: "attachment-preview group relative bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm hover:shadow-md transition-all duration-300",
|
|
71
71
|
data: {
|
|
72
72
|
controller: "attachment-preview",
|
|
73
73
|
attachment_preview_mime_type_value: attachment.content_type,
|
|
@@ -109,7 +109,7 @@ module Plutonium
|
|
|
109
109
|
|
|
110
110
|
def render_filename(attachment)
|
|
111
111
|
div(
|
|
112
|
-
class: "px-
|
|
112
|
+
class: "px-2 py-1.5 text-sm text-gray-700 dark:text-gray-300 border-t border-gray-200 dark:border-gray-700 truncate text-center bg-white dark:bg-gray-800",
|
|
113
113
|
title: attachment.filename
|
|
114
114
|
) do
|
|
115
115
|
plain attachment.filename.to_s
|
|
@@ -119,7 +119,7 @@ module Plutonium
|
|
|
119
119
|
def render_delete_button
|
|
120
120
|
button(
|
|
121
121
|
type: "button",
|
|
122
|
-
class: "w-full py-
|
|
122
|
+
class: "w-full py-2 px-4 text-sm text-red-600 dark:text-red-400 bg-white dark:bg-gray-800 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-b-lg transition-colors duration-200 flex items-center justify-center gap-2 border-t border-gray-200 dark:border-gray-700",
|
|
123
123
|
data: {action: "click->attachment-preview#remove"}
|
|
124
124
|
) do
|
|
125
125
|
span(class: "bi bi-trash")
|
|
@@ -132,7 +132,7 @@ module Plutonium
|
|
|
132
132
|
|
|
133
133
|
def render_nested_field_container(context, &)
|
|
134
134
|
div(
|
|
135
|
-
class: "col-span-full space-y-
|
|
135
|
+
class: "col-span-full space-y-2 my-4",
|
|
136
136
|
data: {
|
|
137
137
|
controller: "nested-resource-form-fields",
|
|
138
138
|
nested_resource_form_fields_limit_value: context.options[:limit]
|
|
@@ -193,7 +193,7 @@ module Plutonium
|
|
|
193
193
|
def render_nested_fields_fieldset(nested, context)
|
|
194
194
|
fieldset(
|
|
195
195
|
data_new_record: !nested.object&.persisted?,
|
|
196
|
-
class: "nested-resource-form-fields border border-gray-200 dark:border-gray-700 rounded-
|
|
196
|
+
class: "nested-resource-form-fields border border-gray-200 dark:border-gray-700 rounded-lg p-4 space-y-4 relative"
|
|
197
197
|
) do
|
|
198
198
|
render_nested_fields_fieldset_content(nested, context)
|
|
199
199
|
render_nested_fields_delete_button(nested, context.options)
|
|
@@ -201,7 +201,7 @@ module Plutonium
|
|
|
201
201
|
end
|
|
202
202
|
|
|
203
203
|
def render_nested_fields_fieldset_content(nested, context)
|
|
204
|
-
div(class: "grid grid-cols-1 md:grid-cols-2 2xl:grid-cols-4 gap-
|
|
204
|
+
div(class: "grid grid-cols-1 md:grid-cols-2 2xl:grid-cols-4 gap-4 grid-flow-row-dense") do
|
|
205
205
|
render_nested_fields_hidden_fields(nested, context)
|
|
206
206
|
render_nested_fields_visible_fields(nested, context)
|
|
207
207
|
end
|
|
@@ -259,8 +259,8 @@ module Plutonium
|
|
|
259
259
|
end
|
|
260
260
|
|
|
261
261
|
def render_nested_fields_add_button_content(name)
|
|
262
|
-
span(class: "bg-secondary-700 text-white hover:bg-secondary-800 focus:ring-secondary-300 dark:bg-secondary-600 dark:hover:bg-secondary-700 dark:focus:ring-secondary-800 flex items-center justify-center px-
|
|
263
|
-
render Phlex::TablerIcons::Plus.new(class: "w-4 h-4 mr-
|
|
262
|
+
span(class: "bg-secondary-700 text-white hover:bg-secondary-800 focus:ring-secondary-300 dark:bg-secondary-600 dark:hover:bg-secondary-700 dark:focus:ring-secondary-800 flex items-center justify-center px-4 py-1.5 text-sm font-medium rounded-lg focus:outline-none focus:ring-4") do
|
|
263
|
+
render Phlex::TablerIcons::Plus.new(class: "w-4 h-4 mr-1")
|
|
264
264
|
span { "Add #{name.to_s.singularize.humanize}" }
|
|
265
265
|
end
|
|
266
266
|
end
|
|
@@ -11,7 +11,7 @@ module Plutonium
|
|
|
11
11
|
options[:method] = :get
|
|
12
12
|
attributes = mix(attributes.deep_merge(
|
|
13
13
|
id: :search_form,
|
|
14
|
-
class!: "space-y-
|
|
14
|
+
class!: "space-y-2 mb-4",
|
|
15
15
|
controller: "form",
|
|
16
16
|
data: {controller: "form", turbo_frame: nil}
|
|
17
17
|
))
|
|
@@ -67,7 +67,7 @@ module Plutonium
|
|
|
67
67
|
|
|
68
68
|
search_query = query_object.search_query
|
|
69
69
|
div(class: "relative") do
|
|
70
|
-
div(class: "absolute inset-y-0 left-0 flex items-center pl-
|
|
70
|
+
div(class: "absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none") do
|
|
71
71
|
svg(
|
|
72
72
|
class: "w-5 h-5 text-gray-500 dark:text-gray-400",
|
|
73
73
|
aria_hidden: "true",
|
|
@@ -87,7 +87,7 @@ module Plutonium
|
|
|
87
87
|
.placeholder("Search...")
|
|
88
88
|
.input_tag(
|
|
89
89
|
value: search_query,
|
|
90
|
-
class: "block w-full p-
|
|
90
|
+
class: "block w-full p-2 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500",
|
|
91
91
|
data: {
|
|
92
92
|
action: "form#submit",
|
|
93
93
|
turbo_permanent: true
|
|
@@ -99,10 +99,10 @@ module Plutonium
|
|
|
99
99
|
def render_filter_fields
|
|
100
100
|
return if query_object.filter_definitions.blank?
|
|
101
101
|
|
|
102
|
-
div(class: "flex flex-wrap items-center gap-
|
|
102
|
+
div(class: "flex flex-wrap items-center gap-4") do
|
|
103
103
|
span(class: "text-sm font-medium text-gray-900 dark:text-white") { "Filters:" }
|
|
104
|
-
div(class: "flex flex-wrap items-center gap-
|
|
105
|
-
div class: "flex flex-wrap items-center gap-
|
|
104
|
+
div(class: "flex flex-wrap items-center gap-4 mr-auto") do
|
|
105
|
+
div class: "flex flex-wrap items-center gap-4" do
|
|
106
106
|
query_object.filter_definitions.each do |filter_name, definition|
|
|
107
107
|
nest_one filter_name do |nested|
|
|
108
108
|
definition.defined_inputs.each do |input_name, _|
|
|
@@ -112,22 +112,22 @@ module Plutonium
|
|
|
112
112
|
end
|
|
113
113
|
end
|
|
114
114
|
end
|
|
115
|
-
div(class: "flex flex-wrap items-center gap-
|
|
115
|
+
div(class: "flex flex-wrap items-center gap-2") do
|
|
116
116
|
actions_wrapper do
|
|
117
117
|
render field(:submit).submit_button_tag(
|
|
118
118
|
name: nil,
|
|
119
|
-
class!: "inline-flex items-center text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-
|
|
119
|
+
class!: "inline-flex items-center text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800"
|
|
120
120
|
) do
|
|
121
|
-
render Phlex::TablerIcons::Filter.new(class: "w-4 h-4 mr-
|
|
121
|
+
render Phlex::TablerIcons::Filter.new(class: "w-4 h-4 mr-2")
|
|
122
122
|
plain "Apply Filters"
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
render field(:reset).submit_button_tag(
|
|
126
126
|
name: nil,
|
|
127
127
|
type: :reset,
|
|
128
|
-
class!: "inline-flex items-center text-gray-900 bg-
|
|
128
|
+
class!: "inline-flex items-center text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-lg text-sm px-4 py-2 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700"
|
|
129
129
|
) do
|
|
130
|
-
render Phlex::TablerIcons::X.new(class: "w-4 h-4 mr-
|
|
130
|
+
render Phlex::TablerIcons::X.new(class: "w-4 h-4 mr-2")
|
|
131
131
|
plain "Clear Filters"
|
|
132
132
|
end
|
|
133
133
|
end
|
|
@@ -41,14 +41,14 @@ module Plutonium
|
|
|
41
41
|
type: :submit,
|
|
42
42
|
name: "return_to",
|
|
43
43
|
value: request.url,
|
|
44
|
-
class:
|
|
44
|
+
class: "px-4 py-2 bg-secondary-600 text-white rounded-md hover:bg-secondary-700 focus:outline-none focus:ring-2 focus:ring-secondary-500"
|
|
45
45
|
) { "Create and add another" }
|
|
46
46
|
else
|
|
47
47
|
button(
|
|
48
48
|
type: :submit,
|
|
49
49
|
name: "return_to",
|
|
50
50
|
value: request.url,
|
|
51
|
-
class:
|
|
51
|
+
class: "px-4 py-2 bg-secondary-600 text-white rounded-md hover:bg-secondary-700 focus:outline-none focus:ring-2 focus:ring-secondary-500"
|
|
52
52
|
) { "Update and continue editing" }
|
|
53
53
|
end
|
|
54
54
|
end
|
|
@@ -6,43 +6,43 @@ module Plutonium
|
|
|
6
6
|
class Theme < Phlexi::Form::Theme
|
|
7
7
|
def self.theme
|
|
8
8
|
super.merge({
|
|
9
|
-
base: "
|
|
10
|
-
fields_wrapper: "
|
|
11
|
-
actions_wrapper: "
|
|
12
|
-
wrapper:
|
|
13
|
-
inner_wrapper: "
|
|
9
|
+
base: "relative bg-white dark:bg-gray-800 shadow-md sm:rounded-lg my-3 p-6 space-y-6",
|
|
10
|
+
fields_wrapper: "grid grid-cols-1 md:grid-cols-2 2xl:grid-cols-4 gap-4 grid-flow-row-dense",
|
|
11
|
+
actions_wrapper: "flex justify-end space-x-2",
|
|
12
|
+
wrapper: nil,
|
|
13
|
+
inner_wrapper: "w-full",
|
|
14
14
|
# errors
|
|
15
|
-
form_errors_wrapper: "
|
|
16
|
-
form_errors_message: "
|
|
17
|
-
form_errors_list: "
|
|
15
|
+
form_errors_wrapper: "flex p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400",
|
|
16
|
+
form_errors_message: "font-medium",
|
|
17
|
+
form_errors_list: "mt-1.5 list-disc list-inside",
|
|
18
18
|
# label themes
|
|
19
|
-
label: "
|
|
19
|
+
label: "mt-2 block mb-2 text-base font-bold",
|
|
20
20
|
invalid_label: "text-red-700 dark:text-red-500",
|
|
21
21
|
valid_label: "text-green-700 dark:text-green-500",
|
|
22
22
|
neutral_label: "text-gray-500 dark:text-gray-400",
|
|
23
23
|
# input themes
|
|
24
|
-
input: "
|
|
24
|
+
input: "w-full p-2 border rounded-md shadow-sm font-medium text-sm dark:bg-gray-700 focus:ring-2",
|
|
25
25
|
invalid_input: "bg-red-50 border-red-500 dark:border-red-500 text-red-900 dark:text-red-500 placeholder-red-700 dark:placeholder-red-500 focus:ring-red-500 focus:border-red-500",
|
|
26
26
|
valid_input: "bg-green-50 border-green-500 dark:border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 focus:ring-green-500 focus:border-green-500",
|
|
27
27
|
neutral_input: "border-gray-300 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white focus:ring-primary-500 focus:border-primary-500",
|
|
28
28
|
# checkbox
|
|
29
|
-
checkbox: "
|
|
29
|
+
checkbox: "p-2 border rounded-md shadow-sm font-medium text-sm dark:bg-gray-700",
|
|
30
30
|
# radio buttons
|
|
31
|
-
radio_button: "
|
|
31
|
+
radio_button: "p-2 border shadow-sm font-medium text-sm dark:bg-gray-700",
|
|
32
32
|
# color
|
|
33
33
|
color: "pu-color-input appearance-none bg-transparent border-none cursor-pointer w-10 h-10",
|
|
34
34
|
invalid_color: nil,
|
|
35
35
|
valid_color: nil,
|
|
36
36
|
neutral_color: nil,
|
|
37
37
|
# file
|
|
38
|
-
# file: "w-full border rounded shadow-sm font-medium text-sm dark:bg-
|
|
39
|
-
file: "
|
|
38
|
+
# file: "w-full border rounded-md shadow-sm font-medium text-sm dark:bg-gray-700 focus:outline-none",
|
|
39
|
+
file: "w-full border rounded-md shadow-sm font-medium text-sm dark:bg-gray-700 border-gray-300 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white focus:ring-primary-500 focus:border-primary-500 focus:outline-none focus:ring-2 [&::file-selector-button]:mr-3 [&::file-selector-button]:px-4 [&::file-selector-button]:py-2 [&::file-selector-button]:bg-gray-50 [&::file-selector-button]:border-0 [&::file-selector-button]:rounded-l-md [&::file-selector-button]:text-sm [&::file-selector-button]:font-medium [&::file-selector-button]:text-gray-700 [&::file-selector-button]:hover:bg-gray-100 [&::file-selector-button]:cursor-pointer dark:[&::file-selector-button]:bg-gray-600 dark:[&::file-selector-button]:text-gray-200 dark:[&::file-selector-button]:hover:bg-gray-500",
|
|
40
40
|
# hint themes
|
|
41
|
-
hint: "
|
|
41
|
+
hint: "mt-2 text-sm text-gray-500 dark:text-gray-200 whitespace-pre",
|
|
42
42
|
# error themes
|
|
43
|
-
error: "
|
|
43
|
+
error: "mt-2 text-sm text-red-600 dark:text-red-500",
|
|
44
44
|
# button themes
|
|
45
|
-
button: "
|
|
45
|
+
button: "px-4 py-2 bg-primary-600 text-white rounded-md hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500",
|
|
46
46
|
# flatpickr
|
|
47
47
|
flatpickr: :input,
|
|
48
48
|
valid_flatpickr: :valid_input,
|
|
@@ -26,9 +26,9 @@ module Plutonium
|
|
|
26
26
|
|
|
27
27
|
def html_attributes = {lang:, data_controller: "color-mode"}
|
|
28
28
|
|
|
29
|
-
def body_attributes = {class:
|
|
29
|
+
def body_attributes = {class: "antialiased min-h-screen bg-gray-50 dark:bg-gray-900"}
|
|
30
30
|
|
|
31
|
-
def main_attributes = {class:
|
|
31
|
+
def main_attributes = {class: "p-4 min-h-screen"}
|
|
32
32
|
|
|
33
33
|
def render_head
|
|
34
34
|
head {
|