tramway 2.2 → 2.2.1
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 +39 -1
- data/app/components/tailwind_component.rb +45 -5
- data/app/components/tailwinds/back_button_component.html.haml +1 -1
- data/app/components/tailwinds/back_button_component.rb +6 -0
- data/app/components/tailwinds/badge_component.rb +7 -4
- data/app/components/tailwinds/button_component.rb +13 -10
- data/app/components/tailwinds/containers/main_component.html.haml +2 -0
- data/app/components/tailwinds/containers/main_component.rb +14 -0
- data/app/components/tailwinds/containers/narrow_component.html.haml +1 -1
- data/app/components/tailwinds/containers/narrow_component.rb +7 -0
- data/app/components/tailwinds/flash_component.html.haml +3 -3
- data/app/components/tailwinds/flash_component.rb +19 -0
- data/app/components/tailwinds/form/date_field_component.html.haml +2 -3
- data/app/components/tailwinds/form/file_field_component.html.haml +2 -2
- data/app/components/tailwinds/form/label_component.html.haml +1 -1
- data/app/components/tailwinds/form/label_component.rb +6 -0
- data/app/components/tailwinds/form/multiselect/dropdown_container.html.haml +1 -1
- data/app/components/tailwinds/form/multiselect/dropdown_container.rb +7 -1
- data/app/components/tailwinds/form/multiselect/item_container.html.haml +3 -3
- data/app/components/tailwinds/form/multiselect/item_container.rb +21 -1
- data/app/components/tailwinds/form/multiselect/select_as_input.html.haml +2 -3
- data/app/components/tailwinds/form/multiselect/select_as_input.rb +8 -3
- data/app/components/tailwinds/form/multiselect/selected_item_template.html.haml +1 -1
- data/app/components/tailwinds/form/multiselect/selected_item_template.rb +8 -1
- data/app/components/tailwinds/form/multiselect_component.html.haml +3 -3
- data/app/components/tailwinds/form/multiselect_component.rb +20 -0
- data/app/components/tailwinds/form/number_field_component.html.haml +1 -3
- data/app/components/tailwinds/form/select_component.html.haml +1 -4
- data/app/components/tailwinds/form/submit_button_component.html.haml +2 -3
- data/app/components/tailwinds/form/submit_button_component.rb +1 -1
- data/app/components/tailwinds/form/text_area_component.html.haml +1 -3
- data/app/components/tailwinds/form/text_field_component.html.haml +1 -3
- data/app/components/tailwinds/nav/item_component.rb +4 -1
- data/app/components/tailwinds/navbar_component.html.haml +4 -4
- data/app/components/tailwinds/navbar_component.rb +25 -0
- data/app/components/tailwinds/pagination/base.rb +6 -4
- data/app/components/tailwinds/pagination/gap_component.html.haml +1 -1
- data/app/components/tailwinds/pagination/gap_component.rb +5 -0
- data/app/components/tailwinds/pagination/page_component.html.haml +1 -1
- data/app/components/tailwinds/pagination/page_component.rb +7 -0
- data/app/components/tailwinds/table/cell_component.html.haml +1 -1
- data/app/components/tailwinds/table/cell_component.rb +7 -0
- data/app/components/tailwinds/table/header_component.html.haml +2 -2
- data/app/components/tailwinds/table/header_component.rb +11 -0
- data/app/components/tailwinds/table/row/preview_component.html.haml +2 -2
- data/app/components/tailwinds/table/row/preview_component.rb +11 -0
- data/app/components/tailwinds/table/row_component.html.haml +1 -1
- data/app/components/tailwinds/table/row_component.rb +17 -5
- data/app/components/tailwinds/table_component.html.haml +1 -1
- data/app/components/tailwinds/table_component.rb +6 -0
- data/app/components/tailwinds/title_component.html.haml +1 -1
- data/app/components/tailwinds/title_component.rb +6 -0
- data/app/components/tramway/base_component.rb +13 -0
- data/config/tailwind.config.js +87 -76
- data/lib/tramway/config.rb +2 -1
- data/lib/tramway/helpers/views_helper.rb +13 -1
- data/lib/tramway/version.rb +1 -1
- metadata +4 -2
|
@@ -9,10 +9,12 @@ module Tailwinds
|
|
|
9
9
|
option :remote
|
|
10
10
|
|
|
11
11
|
def pagination_classes(klass: nil)
|
|
12
|
-
default_classes =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
default_classes = theme_classes(
|
|
13
|
+
classic: [
|
|
14
|
+
'cursor-pointer', 'px-3', 'py-2', 'font-medium', 'rounded-xl', 'text-gray-700', 'bg-gray-100',
|
|
15
|
+
'shadow-md', 'hover:bg-gray-200', 'dark:bg-gray-800', 'dark:text-gray-200', 'dark:hover:bg-gray-700'
|
|
16
|
+
]
|
|
17
|
+
)
|
|
16
18
|
|
|
17
19
|
(default_classes + [klass]).join(' ')
|
|
18
20
|
end
|
|
@@ -4,6 +4,11 @@ module Tailwinds
|
|
|
4
4
|
module Pagination
|
|
5
5
|
# Kaminari gap component for rendering a gap in a pagination
|
|
6
6
|
class GapComponent < Tramway::BaseComponent
|
|
7
|
+
def gap_classes
|
|
8
|
+
theme_classes(
|
|
9
|
+
classic: 'page gap px-3 py-2 text-sm font-medium text-gray-600 sm:flex hidden dark:text-gray-400'
|
|
10
|
+
)
|
|
11
|
+
end
|
|
7
12
|
end
|
|
8
13
|
end
|
|
9
14
|
end
|
|
@@ -5,6 +5,13 @@ module Tailwinds
|
|
|
5
5
|
# Kaminari page component for rendering a page button in a pagination
|
|
6
6
|
class PageComponent < Tailwinds::Pagination::Base
|
|
7
7
|
option :page
|
|
8
|
+
|
|
9
|
+
def current_page_classes
|
|
10
|
+
theme_classes(
|
|
11
|
+
classic: 'px-3 py-2 font-medium rounded-xl text-gray-700 bg-gray-200 shadow-inner ' \
|
|
12
|
+
'dark:bg-gray-700 dark:text-gray-100'
|
|
13
|
+
)
|
|
14
|
+
end
|
|
8
15
|
end
|
|
9
16
|
end
|
|
10
17
|
end
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
%div{ class: cell_classes }
|
|
2
2
|
= content
|
|
@@ -4,6 +4,13 @@ module Tailwinds
|
|
|
4
4
|
module Table
|
|
5
5
|
# Component for rendering a cell in a table
|
|
6
6
|
class CellComponent < Tramway::BaseComponent
|
|
7
|
+
def cell_classes
|
|
8
|
+
theme_classes(
|
|
9
|
+
classic: 'div-table-cell md:block first:block hidden px-6 py-4 font-medium text-gray-700 text-base ' \
|
|
10
|
+
'dark:text-gray-100'
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
7
14
|
def around_render
|
|
8
15
|
ensure_view_context_accessor
|
|
9
16
|
previous_flag = view_context.tramway_inside_cell
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
%div{ class: "#{header_row_classes} md:grid-cols-#{columns_count}", aria: { label: "Table Header" }, role: "row" }
|
|
2
2
|
- if headers.any?
|
|
3
3
|
- headers.each do |header|
|
|
4
|
-
.div-table-cell
|
|
4
|
+
.div-table-cell{ class: header_cell_classes }
|
|
5
5
|
= header
|
|
6
6
|
- else
|
|
7
7
|
= content
|
|
@@ -10,6 +10,17 @@ module Tailwinds
|
|
|
10
10
|
def columns_count
|
|
11
11
|
headers.present? ? headers.size : columns
|
|
12
12
|
end
|
|
13
|
+
|
|
14
|
+
def header_row_classes
|
|
15
|
+
theme_classes(
|
|
16
|
+
classic: 'div-table-row grid text-small gap-4 bg-gray-200 text-gray-600 grid-cols-1 ' \
|
|
17
|
+
'dark:bg-gray-800 dark:text-gray-300'
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def header_cell_classes
|
|
22
|
+
'div-table-cell py-4 px-6 first:block hidden md:block'
|
|
23
|
+
end
|
|
13
24
|
end
|
|
14
25
|
end
|
|
15
26
|
end
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
animation: roll-up 0.5s ease-in-out;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
#roll-up
|
|
17
|
-
%button
|
|
16
|
+
#roll-up{ class: preview_classes }
|
|
17
|
+
%button{ class: close_button_classes, "data-action" => "click->preview#close", "data-controller" => "preview" }
|
|
18
18
|
✕
|
|
@@ -5,6 +5,17 @@ module Tailwinds
|
|
|
5
5
|
module Row
|
|
6
6
|
# Row component for rendering a row in a table
|
|
7
7
|
class PreviewComponent < Tramway::BaseComponent
|
|
8
|
+
def preview_classes
|
|
9
|
+
theme_classes(
|
|
10
|
+
classic: 'fixed hidden inset-x-0 bottom-0 shadow-lg z-50 bg-gray-100 animate-roll-up h-1/2'
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def close_button_classes
|
|
15
|
+
theme_classes(
|
|
16
|
+
classic: 'absolute top-4 right-4 text-gray-500 hover:text-gray-700'
|
|
17
|
+
)
|
|
18
|
+
end
|
|
8
19
|
end
|
|
9
20
|
end
|
|
10
21
|
end
|
|
@@ -25,14 +25,26 @@ module Tailwinds
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def desktop_row_classes(cells_count)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
theme_classes(
|
|
29
|
+
classic: [
|
|
30
|
+
'div-table-row', 'grid', 'gap-4', 'border-b', 'last:border-b-0', 'bg-gray-100',
|
|
31
|
+
'border-gray-200', "md:grid-cols-#{cells_count}", 'grid-cols-1',
|
|
32
|
+
'dark:bg-gray-900', 'dark:border-gray-700'
|
|
33
|
+
]
|
|
34
|
+
).join(' ')
|
|
32
35
|
end
|
|
33
36
|
|
|
34
37
|
def link_row_classes
|
|
35
|
-
|
|
38
|
+
theme_classes(
|
|
39
|
+
classic: 'cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-800'
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def cell_classes
|
|
44
|
+
theme_classes(
|
|
45
|
+
classic: 'div-table-cell px-6 py-4 font-medium text-gray-700 text-xs sm:text-base ' \
|
|
46
|
+
'dark:text-gray-100'
|
|
47
|
+
)
|
|
36
48
|
end
|
|
37
49
|
end
|
|
38
50
|
end
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
- width_class = options[:class]&.include?('w-') ? '' : 'w-full'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
%div{ class: "#{table_classes} #{options[:class]} #{width_class}".strip, **options.except(:class) }
|
|
6
6
|
= content
|
|
@@ -4,5 +4,11 @@ module Tailwinds
|
|
|
4
4
|
# Table component for rendering a table
|
|
5
5
|
class TableComponent < Tramway::BaseComponent
|
|
6
6
|
option :options, optional: true, default: -> { {} }
|
|
7
|
+
|
|
8
|
+
def table_classes
|
|
9
|
+
theme_classes(
|
|
10
|
+
classic: 'div-table text-left rtl:text-right text-gray-500 dark:text-gray-300'
|
|
11
|
+
)
|
|
12
|
+
end
|
|
7
13
|
end
|
|
8
14
|
end
|
|
@@ -11,5 +11,18 @@ module Tramway
|
|
|
11
11
|
include Tramway::Helpers::ComponentHelper
|
|
12
12
|
include Tramway::Helpers::DecorateHelper
|
|
13
13
|
include Tramway::Helpers::ViewsHelper
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def tramway_theme
|
|
18
|
+
Tramway.config.theme.to_sym
|
|
19
|
+
rescue NoMethodError
|
|
20
|
+
:classic
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def theme_classes(mapping = {}, fallback: :classic, **keyword_mapping)
|
|
24
|
+
resolved_mapping = mapping.merge(keyword_mapping)
|
|
25
|
+
resolved_mapping.fetch(tramway_theme) { resolved_mapping.fetch(fallback) }
|
|
26
|
+
end
|
|
14
27
|
end
|
|
15
28
|
end
|
data/config/tailwind.config.js
CHANGED
|
@@ -13,14 +13,13 @@ module.exports = {
|
|
|
13
13
|
'last:border-b-0',
|
|
14
14
|
'md:block',
|
|
15
15
|
'first:block',
|
|
16
|
+
'rounded-t-xl',
|
|
16
17
|
|
|
17
18
|
// === Visibility and typography helpers ===
|
|
18
19
|
'hidden',
|
|
19
|
-
'xl:hidden',
|
|
20
20
|
'text-xl',
|
|
21
21
|
'text-4xl',
|
|
22
22
|
'font-bold',
|
|
23
|
-
'text-right',
|
|
24
23
|
|
|
25
24
|
// === Grid templates used for configurable layouts ===
|
|
26
25
|
'grid',
|
|
@@ -50,6 +49,7 @@ module.exports = {
|
|
|
50
49
|
'mx-auto',
|
|
51
50
|
'align-center',
|
|
52
51
|
'justify-center',
|
|
52
|
+
'min-h-dvh',
|
|
53
53
|
|
|
54
54
|
// === Flexbox layout utilities ===
|
|
55
55
|
'flex',
|
|
@@ -68,7 +68,6 @@ module.exports = {
|
|
|
68
68
|
'sm:flex',
|
|
69
69
|
|
|
70
70
|
// === Sizing utilities ===
|
|
71
|
-
'w-2/3',
|
|
72
71
|
'w-full',
|
|
73
72
|
'w-fit',
|
|
74
73
|
'w-8',
|
|
@@ -81,104 +80,124 @@ module.exports = {
|
|
|
81
80
|
'px-4',
|
|
82
81
|
'px-3',
|
|
83
82
|
'px-2',
|
|
84
|
-
'py-8',
|
|
85
83
|
'py-4',
|
|
86
84
|
'py-2',
|
|
87
85
|
'py-1',
|
|
86
|
+
'mb-4',
|
|
88
87
|
'mb-2',
|
|
89
88
|
'mt-8',
|
|
90
89
|
'mt-2',
|
|
91
90
|
|
|
92
91
|
// === Pagination styles ===
|
|
93
|
-
'bg-white',
|
|
94
|
-
'rounded-md',
|
|
95
|
-
'hover:bg-purple-100',
|
|
96
|
-
'hover:bg-gray-100',
|
|
97
92
|
'hover:bg-gray-300',
|
|
98
|
-
'hover:text-gray-800',
|
|
99
93
|
|
|
100
94
|
// === Dark mode pagination styles ===
|
|
101
|
-
'text-white',
|
|
102
|
-
'bg-gray-800',
|
|
103
|
-
'hover:bg-gray-700',
|
|
104
95
|
'bg-gray-900',
|
|
105
|
-
'bg-gray-700',
|
|
106
96
|
'text-gray-400',
|
|
107
|
-
'
|
|
97
|
+
'text-gray-500',
|
|
98
|
+
'text-gray-600',
|
|
99
|
+
'text-gray-700',
|
|
100
|
+
'hover:text-gray-600',
|
|
108
101
|
'placeholder-gray-400',
|
|
102
|
+
'placeholder-gray-500',
|
|
109
103
|
|
|
110
104
|
// === Button and badge helpers ===
|
|
111
|
-
'bg-purple-700',
|
|
112
105
|
'rounded',
|
|
113
106
|
'rounded-full',
|
|
114
|
-
'rounded-
|
|
107
|
+
'rounded-xl',
|
|
115
108
|
'font-medium',
|
|
116
|
-
'font-
|
|
109
|
+
'font-semibold',
|
|
117
110
|
'text-xs',
|
|
118
111
|
'whitespace-nowrap',
|
|
119
112
|
'h-fit',
|
|
120
113
|
'gap-1',
|
|
121
114
|
'h-10',
|
|
115
|
+
'shadow-md',
|
|
116
|
+
'shadow-inner',
|
|
117
|
+
'shadow-lg',
|
|
118
|
+
'h-12',
|
|
122
119
|
|
|
123
120
|
// === Button color presets ===
|
|
124
|
-
'bg-gray-
|
|
125
|
-
'bg-gray-
|
|
126
|
-
'
|
|
127
|
-
'
|
|
128
|
-
|
|
129
|
-
'bg-
|
|
130
|
-
|
|
131
|
-
'
|
|
132
|
-
'
|
|
133
|
-
|
|
134
|
-
'bg-
|
|
135
|
-
|
|
136
|
-
'
|
|
137
|
-
'
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
'bg-green-
|
|
141
|
-
'bg-green-
|
|
142
|
-
'hover:bg-green-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
'bg-orange-
|
|
146
|
-
'bg-orange-
|
|
147
|
-
|
|
148
|
-
'
|
|
149
|
-
|
|
150
|
-
'bg-red-
|
|
151
|
-
'bg-red-
|
|
152
|
-
|
|
153
|
-
'
|
|
154
|
-
'
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
'bg-
|
|
158
|
-
'
|
|
159
|
-
'hover:bg-
|
|
160
|
-
|
|
161
|
-
'bg-
|
|
162
|
-
'bg-
|
|
163
|
-
'hover:bg-
|
|
164
|
-
'
|
|
165
|
-
|
|
166
|
-
'bg-
|
|
167
|
-
'
|
|
168
|
-
'hover:bg-yellow-700',
|
|
169
|
-
'hover:bg-yellow-800',
|
|
121
|
+
'bg-gray-100',
|
|
122
|
+
'bg-gray-200',
|
|
123
|
+
'bg-gray-300',
|
|
124
|
+
'bg-gray-900',
|
|
125
|
+
'hover:bg-gray-200',
|
|
126
|
+
'hover:bg-gray-300',
|
|
127
|
+
|
|
128
|
+
'bg-blue-100',
|
|
129
|
+
'bg-blue-200',
|
|
130
|
+
'hover:bg-blue-200',
|
|
131
|
+
'hover:bg-blue-300',
|
|
132
|
+
|
|
133
|
+
'bg-zinc-100',
|
|
134
|
+
'bg-zinc-200',
|
|
135
|
+
'hover:bg-zinc-300',
|
|
136
|
+
|
|
137
|
+
'bg-green-100',
|
|
138
|
+
'bg-green-200',
|
|
139
|
+
'hover:bg-green-300',
|
|
140
|
+
|
|
141
|
+
'bg-orange-100',
|
|
142
|
+
'bg-orange-200',
|
|
143
|
+
'hover:bg-orange-300',
|
|
144
|
+
|
|
145
|
+
'bg-red-100',
|
|
146
|
+
'bg-red-200',
|
|
147
|
+
'hover:bg-red-200',
|
|
148
|
+
'hover:bg-red-300',
|
|
149
|
+
|
|
150
|
+
'bg-violet-100',
|
|
151
|
+
'bg-violet-200',
|
|
152
|
+
'hover:bg-violet-300',
|
|
153
|
+
|
|
154
|
+
'bg-indigo-100',
|
|
155
|
+
'bg-indigo-200',
|
|
156
|
+
'hover:bg-indigo-300',
|
|
157
|
+
|
|
158
|
+
'bg-yellow-100',
|
|
159
|
+
'bg-yellow-200',
|
|
160
|
+
'hover:bg-yellow-300',
|
|
161
|
+
'bg-teal-100',
|
|
162
|
+
'bg-teal-900',
|
|
163
|
+
'bg-purple-300',
|
|
164
|
+
'text-purple-700',
|
|
170
165
|
|
|
171
166
|
// === Button Disabled state ===
|
|
172
|
-
'bg-gray-
|
|
167
|
+
'bg-gray-200',
|
|
173
168
|
'text-gray-400',
|
|
174
|
-
'text-gray-
|
|
169
|
+
'text-gray-500',
|
|
170
|
+
'text-gray-700',
|
|
171
|
+
'text-gray-800',
|
|
172
|
+
'text-blue-800',
|
|
173
|
+
'text-zinc-800',
|
|
174
|
+
'text-green-800',
|
|
175
|
+
'text-orange-800',
|
|
176
|
+
'text-red-800',
|
|
177
|
+
'text-violet-800',
|
|
178
|
+
'text-indigo-800',
|
|
179
|
+
'text-yellow-800',
|
|
180
|
+
'text-teal-800',
|
|
175
181
|
|
|
176
182
|
// === Form state helpers ===
|
|
177
|
-
'disabled:bg-gray-100',
|
|
178
183
|
'disabled:text-gray-400',
|
|
179
184
|
'disabled:cursor-not-allowed',
|
|
180
|
-
'
|
|
181
|
-
'
|
|
185
|
+
'disabled:bg-gray-200',
|
|
186
|
+
'disabled:text-gray-500',
|
|
187
|
+
'focus:ring-gray-300',
|
|
188
|
+
'focus:ring-gray-600',
|
|
189
|
+
'ring-gray-200',
|
|
190
|
+
'ring-gray-700',
|
|
191
|
+
'border-gray-200',
|
|
192
|
+
'border-gray-300',
|
|
193
|
+
'border-gray-700',
|
|
194
|
+
'hover:border-gray-300',
|
|
195
|
+
'border-teal-200',
|
|
196
|
+
'border-teal-700',
|
|
197
|
+
|
|
198
|
+
// === Form size helpers ===
|
|
199
|
+
'px-5',
|
|
200
|
+
'py-3',
|
|
182
201
|
|
|
183
202
|
// === Multiselect dropdown positioning ===
|
|
184
203
|
'absolute',
|
|
@@ -186,7 +205,6 @@ module.exports = {
|
|
|
186
205
|
'shadow',
|
|
187
206
|
'top-11',
|
|
188
207
|
'z-40',
|
|
189
|
-
'left-0',
|
|
190
208
|
'max-h-select',
|
|
191
209
|
'overflow-y-auto',
|
|
192
210
|
'cursor-pointer',
|
|
@@ -199,34 +217,27 @@ module.exports = {
|
|
|
199
217
|
'border-l',
|
|
200
218
|
'border-l-2',
|
|
201
219
|
'border-transparent',
|
|
202
|
-
'border-teal-300',
|
|
203
|
-
'hover:border-teal-100',
|
|
204
220
|
'bg-teal-100',
|
|
205
221
|
'bg-transparent',
|
|
206
|
-
'text-teal-700',
|
|
207
222
|
'leading-6',
|
|
208
223
|
'leading-none',
|
|
209
224
|
'appearance-none',
|
|
210
225
|
'outline-none',
|
|
211
226
|
'h-full',
|
|
212
227
|
'm-1',
|
|
213
|
-
'hover:bg-teal-100',
|
|
214
228
|
|
|
215
229
|
// === Flash message styles ===
|
|
216
230
|
'fixed',
|
|
217
|
-
'top-6',
|
|
218
231
|
'right-4',
|
|
219
232
|
'z-50',
|
|
220
233
|
'space-y-2',
|
|
221
234
|
'flash',
|
|
222
235
|
'opacity-100',
|
|
223
|
-
'bg-green-700',
|
|
224
236
|
'text-white',
|
|
225
237
|
'px-4',
|
|
226
238
|
'py-2',
|
|
227
239
|
'rounded',
|
|
228
240
|
'shadow',
|
|
229
|
-
'bg-yellow-700',
|
|
230
241
|
'text-black'
|
|
231
242
|
],
|
|
232
243
|
}
|
data/lib/tramway/config.rb
CHANGED
|
@@ -6,11 +6,13 @@ module Tramway
|
|
|
6
6
|
module ViewsHelper
|
|
7
7
|
include Tramway::Helpers::ComponentHelper
|
|
8
8
|
|
|
9
|
+
FORM_SIZES = %i[small middle large].freeze
|
|
10
|
+
|
|
9
11
|
def tramway_form_for(object, *, size: :middle, **options, &)
|
|
10
12
|
form_for(
|
|
11
13
|
object,
|
|
12
14
|
*,
|
|
13
|
-
**options.merge(builder: Tailwinds::Form::Builder, size:),
|
|
15
|
+
**options.merge(builder: Tailwinds::Form::Builder, size: normalize_form_size(size)),
|
|
14
16
|
&
|
|
15
17
|
)
|
|
16
18
|
end
|
|
@@ -57,6 +59,10 @@ module Tramway
|
|
|
57
59
|
end
|
|
58
60
|
end
|
|
59
61
|
|
|
62
|
+
def tramway_main_container(**options, &)
|
|
63
|
+
component 'tailwinds/containers/main', options:, &
|
|
64
|
+
end
|
|
65
|
+
|
|
60
66
|
def tramway_badge(text:, type: nil, color: nil)
|
|
61
67
|
component 'tailwinds/badge',
|
|
62
68
|
text:,
|
|
@@ -71,6 +77,12 @@ module Tramway
|
|
|
71
77
|
def tramway_flash(text:, type:, **options)
|
|
72
78
|
component 'tailwinds/flash', text:, type:, options:
|
|
73
79
|
end
|
|
80
|
+
|
|
81
|
+
private
|
|
82
|
+
|
|
83
|
+
def normalize_form_size(size)
|
|
84
|
+
FORM_SIZES.include?(size) ? size : :middle
|
|
85
|
+
end
|
|
74
86
|
end
|
|
75
87
|
end
|
|
76
88
|
end
|
data/lib/tramway/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tramway
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kalashnikovisme
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-01-
|
|
12
|
+
date: 2026-01-14 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: anyway_config
|
|
@@ -150,6 +150,8 @@ files:
|
|
|
150
150
|
- app/components/tailwinds/base_component.rb
|
|
151
151
|
- app/components/tailwinds/button_component.html.haml
|
|
152
152
|
- app/components/tailwinds/button_component.rb
|
|
153
|
+
- app/components/tailwinds/containers/main_component.html.haml
|
|
154
|
+
- app/components/tailwinds/containers/main_component.rb
|
|
153
155
|
- app/components/tailwinds/containers/narrow_component.html.haml
|
|
154
156
|
- app/components/tailwinds/containers/narrow_component.rb
|
|
155
157
|
- app/components/tailwinds/flash_component.html.haml
|