baldur 0.2.4 → 0.3.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/README.md +10 -0
- data/TODO.md +27 -6
- data/app/assets/javascripts/baldur/controllers/segmented_tabs_controller.js +53 -2
- data/app/assets/javascripts/baldur/controllers/theme_controller.js +4 -3
- data/app/assets/stylesheets/baldur/application/components/auth-page.css +5 -6
- data/app/assets/stylesheets/baldur/application/components/table.css +17 -7
- data/app/helpers/baldur/ui_helper.rb +11 -2
- data/app/helpers/baldur/ui_helper_feedback.rb +43 -2
- data/app/views/baldur/components/_button.html.erb +4 -0
- data/app/views/baldur/components/_segmented_buttons.html.erb +14 -7
- data/app/views/baldur/components/_snackbar_stack.html.erb +10 -6
- data/app/views/baldur/components/_table.html.erb +6 -4
- data/app/views/baldur/optional/_auth_page.html.erb +2 -2
- data/baldur.gemspec +4 -1
- data/context7.json +17 -0
- data/docs/alerts-and-snackbars.md +72 -0
- data/docs/auth.md +66 -0
- data/docs/forms.md +267 -0
- data/docs/installation.md +63 -0
- data/docs/marketing.md +77 -0
- data/docs/modals-and-panels.md +55 -0
- data/docs/security.md +11 -0
- data/docs/sidebar.md +105 -0
- data/docs/styling.md +34 -0
- data/docs/tables.md +173 -0
- data/docs/tabs-and-segmented-controls.md +509 -0
- data/docs/theme.md +118 -0
- data/lib/baldur/version.rb +1 -1
- data/llms-full.txt +179 -0
- data/llms.txt +35 -0
- data/test/hidden_field_helper_test.rb +23 -0
- data/test/segmented_buttons_helper_test.rb +85 -0
- data/test/snackbar_flash_helper_test.rb +72 -0
- data/test/snackbar_stack_helper_test.rb +121 -0
- data/test/table_helper_test.rb +118 -0
- data/test/text_field_helper_test.rb +40 -0
- data/test/theme_toggle_helper_test.rb +2 -0
- metadata +23 -2
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
require_relative 'test_helper'
|
|
2
|
+
|
|
3
|
+
require 'action_controller'
|
|
4
|
+
|
|
5
|
+
class BaldurTableHelperTest < Minitest::Test
|
|
6
|
+
class TestController < ActionController::Base
|
|
7
|
+
append_view_path File.expand_path('../app/views', __dir__)
|
|
8
|
+
helper Baldur::UiHelper
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_numeric_column_right_aligns_header_and_cell
|
|
12
|
+
html = TestController.render(
|
|
13
|
+
inline: <<~ERB,
|
|
14
|
+
<%= ui_table(
|
|
15
|
+
columns: [
|
|
16
|
+
{ label: "SKU", key: :sku },
|
|
17
|
+
{ label: "Revenue", key: :revenue, numeric: true }
|
|
18
|
+
],
|
|
19
|
+
rows: [
|
|
20
|
+
{ sku: "SKU-001", revenue: "$12,500" }
|
|
21
|
+
],
|
|
22
|
+
empty_state: "No records"
|
|
23
|
+
) %>
|
|
24
|
+
ERB
|
|
25
|
+
formats: [:html]
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
assert_includes html, '<th scope="col" class="px-6 py-4 text-xs font-semibold uppercase tracking-wide text-[color:var(--color-on-surface-variant)] text-right">'
|
|
29
|
+
assert_includes html, '<td class="px-6 py-4 text-sm text-[color:var(--color-on-surface)] text-right">'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_non_numeric_column_stays_left_aligned
|
|
33
|
+
html = TestController.render(
|
|
34
|
+
inline: <<~ERB,
|
|
35
|
+
<%= ui_table(
|
|
36
|
+
columns: [
|
|
37
|
+
{ label: "SKU", key: :sku },
|
|
38
|
+
{ label: "Status", key: :status }
|
|
39
|
+
],
|
|
40
|
+
rows: [
|
|
41
|
+
{ sku: "SKU-001", status: "Active" }
|
|
42
|
+
],
|
|
43
|
+
empty_state: "No records"
|
|
44
|
+
) %>
|
|
45
|
+
ERB
|
|
46
|
+
formats: [:html]
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
refute_includes html, 'text-right'
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def test_numeric_middle_column_right_aligns
|
|
53
|
+
html = TestController.render(
|
|
54
|
+
inline: <<~ERB,
|
|
55
|
+
<%= ui_table(
|
|
56
|
+
columns: [
|
|
57
|
+
{ label: "SKU", key: :sku },
|
|
58
|
+
{ label: "Revenue", key: :revenue, numeric: true },
|
|
59
|
+
{ label: "Status", key: :status }
|
|
60
|
+
],
|
|
61
|
+
rows: [
|
|
62
|
+
{ sku: "SKU-001", revenue: "$12,500", status: "Active" }
|
|
63
|
+
],
|
|
64
|
+
empty_state: "No records"
|
|
65
|
+
) %>
|
|
66
|
+
ERB
|
|
67
|
+
formats: [:html]
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
assert_includes html, '<th scope="col" class="px-6 py-4 text-xs font-semibold uppercase tracking-wide text-[color:var(--color-on-surface-variant)] text-right">'
|
|
71
|
+
assert_includes html, '<td class="px-6 py-4 text-sm text-[color:var(--color-on-surface)] text-right">'
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def test_numeric_sortable_header_keeps_right_aligned_layout
|
|
75
|
+
sort_builder = ->(k, d) { "/products?sort=#{k}&direction=#{d}" }
|
|
76
|
+
html = TestController.render(
|
|
77
|
+
inline: <<~ERB,
|
|
78
|
+
<%= ui_table(
|
|
79
|
+
sort: { key: "revenue", direction: "desc" },
|
|
80
|
+
sort_path_builder: sort_builder,
|
|
81
|
+
columns: [
|
|
82
|
+
{ label: "SKU", key: :sku },
|
|
83
|
+
{ label: "Revenue", key: :revenue, numeric: true, sortable: true, sort_key: "revenue" }
|
|
84
|
+
],
|
|
85
|
+
rows: [
|
|
86
|
+
{ sku: "SKU-001", revenue: "$12,500" }
|
|
87
|
+
],
|
|
88
|
+
empty_state: "No records"
|
|
89
|
+
) %>
|
|
90
|
+
ERB
|
|
91
|
+
formats: [:html],
|
|
92
|
+
locals: { sort_builder: sort_builder }
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
assert_includes html, 'text-right'
|
|
96
|
+
assert_includes html, 'justify-end'
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def test_explicit_cell_class_overrides_numeric
|
|
100
|
+
html = TestController.render(
|
|
101
|
+
inline: <<~ERB,
|
|
102
|
+
<%= ui_table(
|
|
103
|
+
columns: [
|
|
104
|
+
{ label: "SKU", key: :sku },
|
|
105
|
+
{ label: "Revenue", key: :revenue, numeric: true, cell_class: "font-mono" }
|
|
106
|
+
],
|
|
107
|
+
rows: [
|
|
108
|
+
{ sku: "SKU-001", revenue: "$12,500" }
|
|
109
|
+
],
|
|
110
|
+
empty_state: "No records"
|
|
111
|
+
) %>
|
|
112
|
+
ERB
|
|
113
|
+
formats: [:html]
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
assert_includes html, '<td class="px-6 py-4 text-sm text-[color:var(--color-on-surface)] text-right font-mono">'
|
|
117
|
+
end
|
|
118
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require_relative 'test_helper'
|
|
2
|
+
|
|
3
|
+
require 'action_controller'
|
|
4
|
+
|
|
5
|
+
class BaldurTextFieldHelperTest < Minitest::Test
|
|
6
|
+
class TestController < ActionController::Base
|
|
7
|
+
append_view_path File.expand_path('../app/views', __dir__)
|
|
8
|
+
helper Baldur::UiHelper
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_ui_text_field_tag_passes_html5_input_attributes_through_input_options
|
|
12
|
+
html = TestController.render(
|
|
13
|
+
inline: <<~ERB,
|
|
14
|
+
<%= ui_text_field_tag(
|
|
15
|
+
:price,
|
|
16
|
+
12.5,
|
|
17
|
+
label: "Price",
|
|
18
|
+
type: :number,
|
|
19
|
+
input_options: {
|
|
20
|
+
step: :any,
|
|
21
|
+
min: 0,
|
|
22
|
+
max: 100,
|
|
23
|
+
inputmode: "decimal",
|
|
24
|
+
autocomplete: "off"
|
|
25
|
+
}
|
|
26
|
+
) %>
|
|
27
|
+
ERB
|
|
28
|
+
formats: [:html]
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
assert_includes html, 'type="number"'
|
|
32
|
+
assert_includes html, 'name="price"'
|
|
33
|
+
assert_includes html, 'value="12.5"'
|
|
34
|
+
assert_includes html, 'step="any"'
|
|
35
|
+
assert_includes html, 'min="0"'
|
|
36
|
+
assert_includes html, 'max="100"'
|
|
37
|
+
assert_includes html, 'inputmode="decimal"'
|
|
38
|
+
assert_includes html, 'autocomplete="off"'
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -86,6 +86,8 @@ class BaldurAuthPageTopRailTest < Minitest::Test
|
|
|
86
86
|
)
|
|
87
87
|
|
|
88
88
|
refute_includes html, 'auth-page__top-rail'
|
|
89
|
+
assert_includes html, 'auth-page min-h-screen flex items-center justify-center p-6 bg-base-200'
|
|
90
|
+
assert_includes html, 'auth-page__container w-full max-w-lg mx-auto'
|
|
89
91
|
end
|
|
90
92
|
|
|
91
93
|
def test_auth_page_with_top_rail_renders_slot
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: baldur
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Varun Murkar
|
|
@@ -195,6 +195,19 @@ files:
|
|
|
195
195
|
- app/views/baldur/optional/_panel_secondary.html.erb
|
|
196
196
|
- baldur.gemspec
|
|
197
197
|
- config/importmap.rb
|
|
198
|
+
- context7.json
|
|
199
|
+
- docs/alerts-and-snackbars.md
|
|
200
|
+
- docs/auth.md
|
|
201
|
+
- docs/forms.md
|
|
202
|
+
- docs/installation.md
|
|
203
|
+
- docs/marketing.md
|
|
204
|
+
- docs/modals-and-panels.md
|
|
205
|
+
- docs/security.md
|
|
206
|
+
- docs/sidebar.md
|
|
207
|
+
- docs/styling.md
|
|
208
|
+
- docs/tables.md
|
|
209
|
+
- docs/tabs-and-segmented-controls.md
|
|
210
|
+
- docs/theme.md
|
|
198
211
|
- lib/baldur.rb
|
|
199
212
|
- lib/baldur/configuration.rb
|
|
200
213
|
- lib/baldur/engine.rb
|
|
@@ -207,18 +220,26 @@ files:
|
|
|
207
220
|
- lib/generators/baldur/install_google_auth/install_google_auth_generator.rb
|
|
208
221
|
- lib/generators/baldur/install_panel_right/install_panel_right_generator.rb
|
|
209
222
|
- lib/generators/baldur/install_panel_secondary/install_panel_secondary_generator.rb
|
|
223
|
+
- llms-full.txt
|
|
224
|
+
- llms.txt
|
|
210
225
|
- script/verify_host_install
|
|
211
226
|
- test/confirmation_modal_helper_test.rb
|
|
212
227
|
- test/csp_rendering_test.rb
|
|
213
228
|
- test/engine_css_test.rb
|
|
214
229
|
- test/fixtures/shared/_brand_lockup.html.erb
|
|
215
230
|
- test/gemspec_test.rb
|
|
231
|
+
- test/hidden_field_helper_test.rb
|
|
216
232
|
- test/install_generator_test.rb
|
|
217
233
|
- test/install_panel_secondary_generator_test.rb
|
|
218
234
|
- test/marketing_helper_test.rb
|
|
219
235
|
- test/run_all.rb
|
|
236
|
+
- test/segmented_buttons_helper_test.rb
|
|
220
237
|
- test/sidebar_helper_test.rb
|
|
238
|
+
- test/snackbar_flash_helper_test.rb
|
|
239
|
+
- test/snackbar_stack_helper_test.rb
|
|
240
|
+
- test/table_helper_test.rb
|
|
221
241
|
- test/test_helper.rb
|
|
242
|
+
- test/text_field_helper_test.rb
|
|
222
243
|
- test/theme_toggle_helper_test.rb
|
|
223
244
|
- test/tmp/install_generator/app/assets/stylesheets/fonts.css
|
|
224
245
|
- test/tmp/install_generator/app/assets/stylesheets/theme.css
|
|
@@ -273,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
273
294
|
- !ruby/object:Gem::Version
|
|
274
295
|
version: '0'
|
|
275
296
|
requirements: []
|
|
276
|
-
rubygems_version: 4.0.
|
|
297
|
+
rubygems_version: 4.0.14
|
|
277
298
|
specification_version: 4
|
|
278
299
|
summary: Batteries-included Rails UI engine for the importmap, Stimulus, Tailwind
|
|
279
300
|
stack
|