keystone_ui 0.43.0 → 0.44.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebff0095e42a243e35a441d1fd749813728e8abe011529ec23cb599602312c45
4
- data.tar.gz: 0fc80932c6f8b9ea4c8511fa4ba83e9989eb97e4a74cbe9339999efdd8f62249
3
+ metadata.gz: 399e1a496d6abbf8fc37149cbf05ea62223222c1cf6b5678dc400b286a17f06a
4
+ data.tar.gz: 5d7566e89343b57e8a35a6693e4fe6107184203299a880d58eab541b6ff16d81
5
5
  SHA512:
6
- metadata.gz: f9b81f7b07775c5ba362010016b5dacd0bb9a298620723cb20fee5fbd2ee96da12211256da33f4bb72029e8bfcc3392e6b5d42fad8efceb33a48d11642cbf99a
7
- data.tar.gz: b0debeea715db19ec6aaac0731abd03bd7f4670a9f2a979f0a541a72588cccb2324b2569f3962c70812af5b0c514af17e57adcb46de28f509a27a173b84cd2fc
6
+ metadata.gz: e0e0ab5ac2704a8612ec78bd80987d61ddfaee104cf0eedf976075e8ea28b4d64ac26990e061055165d334f06c8951b0eb8083b6005cb666dd8d47fec7ec5a7f
7
+ data.tar.gz: 8de679cd46c03c8c8856196fc1d73d87def5ab3910c7b142d744ab7fca02c8b011f0cea93a2a2b42979d677b84c7448c32880d2ab6783851506188622bba7c30
@@ -0,0 +1,11 @@
1
+ <dl class="<%= classes %>">
2
+ <% rows.each do |row| %>
3
+ <div class="<%= row_classes(row) %>">
4
+ <dt class="ks-value-list-label">
5
+ <%= row[:label] %>
6
+ <% if row[:note] %><span class="ks-value-list-note"><%= row[:note] %></span><% end %>
7
+ </dt>
8
+ <dd class="ks-value-list-value"><%= shown_value(row) %></dd>
9
+ </div>
10
+ <% end %>
11
+ </dl>
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Keystone
4
+ module Ui
5
+ class ValueListComponent < ViewComponent::Base
6
+ ALIGN_CLASSES = { start: nil, end: "ks-value-list-end" }.freeze
7
+
8
+ attr_reader :rows
9
+
10
+ def initialize(rows:, align: :start)
11
+ @rows = rows
12
+ @align = align
13
+ end
14
+
15
+ def classes
16
+ [ "ks-value-list", ALIGN_CLASSES.fetch(@align) ].compact.join(" ")
17
+ end
18
+
19
+ def shown_value(row)
20
+ row[:value].to_s.empty? ? row[:fallback] : row[:value]
21
+ end
22
+
23
+ def row_classes(row)
24
+ [ "ks-value-list-row", ("ks-value-list-total" if row[:total]) ].compact.join(" ")
25
+ end
26
+ end
27
+ end
28
+ end
@@ -249,6 +249,10 @@ module KeystoneUiHelper
249
249
  render Keystone::Ui::ParagraphComponent.new(**args)
250
250
  end
251
251
 
252
+ def ui_value_list(**args)
253
+ render Keystone::Ui::ValueListComponent.new(**args)
254
+ end
255
+
252
256
  def ui_info(**args, &block)
253
257
  render(Keystone::Ui::InfoComponent.new(**args), &block)
254
258
  end
@@ -32,6 +32,7 @@ module Keystone
32
32
  Keystone::Ui::CardLinkComponent,
33
33
  Keystone::Ui::InputComponent,
34
34
  Keystone::Ui::TextareaComponent,
35
+ Keystone::Ui::ValueListComponent,
35
36
  Keystone::Ui::FormFieldComponent,
36
37
  Keystone::Ui::PageHeaderComponent,
37
38
  Keystone::Ui::ParagraphComponent,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.43.0"
4
+ VERSION = "0.44.0"
5
5
  end
@@ -66,6 +66,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
66
66
  - `ui_heading` — a heading at one of three sizes, with an optional short note on its right.
67
67
  - `ui_caption` — small uppercase muted text placed above a title or a figure.
68
68
  - `ui_paragraph` — a paragraph of running text.
69
+ - `ui_value_list` — rows of a label and its value, such as a ledger or a byline.
69
70
  - `ui_alert` — a banner message, optionally dismissible.
70
71
  - `ui_progress` — a labelled progress bar.
71
72
  - `ui_stat_card` — a single metric tile with optional change, link and info button.
@@ -404,6 +405,9 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
404
405
  and `note:` puts a short muted note at the right end of the heading's row.
405
406
  - `ui_caption(text:)` shows small uppercase muted text above a title or a figure.
406
407
  - `ui_paragraph(text:)` shows running text.
408
+ - `ui_value_list(rows:, align: :start)` — each row is `{ label:, value: }`
409
+ with optional `note:`, `total: true` and `fallback:`, shown when the value
410
+ is `nil` or empty. `align: :end` pushes values to the right, as in a ledger.
407
411
 
408
412
  10. Explain figures.
409
413
 
@@ -67,6 +67,7 @@ develop:
67
67
  - ui_heading
68
68
  - ui_caption
69
69
  - ui_paragraph
70
+ - ui_value_list
70
71
  - ui_breakdown
71
72
  - ui_theme_toggle
72
73
  - Keystone::Ui::Column
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keystone_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.43.0
4
+ version: 0.44.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: 0.19.0
18
+ version: 0.20.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: 0.19.0
25
+ version: 0.20.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: view_component
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -202,6 +202,8 @@ files:
202
202
  - app/components/keystone/ui/textarea_component.rb
203
203
  - app/components/keystone/ui/theme_toggle_component.html.erb
204
204
  - app/components/keystone/ui/theme_toggle_component.rb
205
+ - app/components/keystone/ui/value_list_component.html.erb
206
+ - app/components/keystone/ui/value_list_component.rb
205
207
  - app/helpers/keystone_ui_helper.rb
206
208
  - config/importmap.rb
207
209
  - lib/generators/keystone/install_generator.rb