keystone_ui 0.87.0 → 0.88.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: 94679872bb456fe1af2afe9da20383d24a17015d610a237ff0459ebc3ed30853
4
- data.tar.gz: f75346f3b8067fd199f91d0b8e6199d6fb2b0f0044d9a82b2b7df7cfc0231dfd
3
+ metadata.gz: c8ea6aa2299d863f411c5f22e46fa98df485e1667b0fda9c574da8ab1104b103
4
+ data.tar.gz: 3d66e41c286179babed63f8273d90d611d801911bdae47000db12e2504f8cff9
5
5
  SHA512:
6
- metadata.gz: e66fe72413ad1c5afdc9355fe1da64e877c2d30d9a14f33608e811ad0d788bb3bd580f1a5e6d902e5d30057de247300781fc7aa697b05566d7374c210ca40f3d
7
- data.tar.gz: 07cbacf662f77376e819bde19ac1da4c09852e48eed8f7568dfd24353e421aa8dd84f748b355e0f56304fd9a7461183cecf70371003a9d232ac9b3d02e8400f2
6
+ metadata.gz: 75fd1ca16b9f93ecc6daf4efe9730b8c9d655f044a680a5873ae044f48cd2e36ddd240a58898960e48f1190d468f19fc50d3c61cfbfac69dd3cbe5deb744b450
7
+ data.tar.gz: b402b759296da5e5c2102e28eb1bf2bb847c39253348b047d80a79f24f1100a5b31e46a34ce7ab710bce78ee324cc958debc6dbaab9a6d310cb134a23b2118f4
@@ -1,7 +1,7 @@
1
1
  <dl class="<%= classes %>">
2
2
  <% rows.each do |row| %>
3
3
  <div class="<%= row_classes(row) %>">
4
- <dt class="ks-value-list-label">
4
+ <dt class="<%= label_classes %>">
5
5
  <%= row[:label] %>
6
6
  <% if row[:note] %><span class="ks-value-list-note"><%= row[:note] %></span><% end %>
7
7
  </dt>
@@ -5,16 +5,20 @@ module Keystone
5
5
  class ValueListComponent < ViewComponent::Base
6
6
  ALIGN_CLASSES = { start: nil, end: "ks-value-list-end" }.freeze
7
7
  RIGHT_MARK_CLASSES = "ks-tone-success inline size-5 align-text-bottom"
8
+ COLUMNS_CLASSES = "grid grid-cols-1 sm:grid-cols-2 ks-grid-gap-sm"
9
+ PAIR_CLASSES = "flex flex-col min-w-0"
10
+ PAIR_LABEL_CLASSES = "ks-value-list-label basis-auto text-xs"
8
11
 
9
12
  attr_reader :rows
10
13
 
11
- def initialize(rows:, align: :start)
14
+ def initialize(rows:, align: :start, columns: false)
12
15
  @rows = rows
13
16
  @align = align
17
+ @columns = columns
14
18
  end
15
19
 
16
20
  def classes
17
- [ "ks-value-list", ALIGN_CLASSES.fetch(@align) ].compact.join(" ")
21
+ [ "ks-value-list", ALIGN_CLASSES.fetch(@align), (COLUMNS_CLASSES if @columns) ].compact.join(" ")
18
22
  end
19
23
 
20
24
  def shown_value(row)
@@ -25,8 +29,12 @@ module Keystone
25
29
  RIGHT_MARK_CLASSES
26
30
  end
27
31
 
32
+ def label_classes
33
+ @columns ? PAIR_LABEL_CLASSES : "ks-value-list-label"
34
+ end
35
+
28
36
  def row_classes(row)
29
- [ "ks-value-list-row", ("ks-value-list-total" if row[:total]) ].compact.join(" ")
37
+ [ @columns ? PAIR_CLASSES : "ks-value-list-row", ("ks-value-list-total" if row[:total]) ].compact.join(" ")
30
38
  end
31
39
  end
32
40
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.87.0"
4
+ VERSION = "0.88.0"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: keystone_ui-develop
3
- description: Use PROACTIVELY for building or editing screens in a Rails app that has keystone_ui — page shells with Back links and breadcrumbs, forms and fields, a search field that picks a record or enters a new one, data tables with saved columns, desktop navigation, sidebars and bottom tabs, a page's main action as a phone top-bar icon or a button fixed to the bottom of the screen, a question asked before a button or main action goes ahead, action menus for a record's Edit and Delete, dashboards with stat cards, charts, funnels, goal buckets and timelines of timed steps, drawn one line per step with a marked time axis if wanted, with retries and their count, queued time, failed tries, steps still running, steps waiting on approval, links to each try and the current step marked, amounts shown in green or red as a gain or loss, status dots coloured by state, pictures held to half the screen, two versions of a text compared line by line side by side, info buttons and breakdowns, marketing sections, a light/dark theme switch — MUST BE USED instead of hand-writing ERB and Tailwind for UI.
3
+ description: Use PROACTIVELY for building or editing screens in a Rails app that has keystone_ui — page shells with Back links and breadcrumbs, forms and fields, a search field that picks a record or enters a new one, data tables with saved columns, desktop navigation, sidebars and bottom tabs, a page's main action as a phone top-bar icon or a button fixed to the bottom of the screen, a question asked before a button or main action goes ahead, action menus for a record's Edit and Delete, dashboards with stat cards, charts, funnels, goal buckets and timelines of timed steps, drawn one line per step with a marked time axis if wanted, with retries and their count, queued time, failed tries, steps still running, steps waiting on approval, links to each try and the current step marked, amounts shown in green or red as a gain or loss, status dots coloured by state, pictures held to half the screen, a record's details as labelled values in rows or in two columns, two versions of a text compared line by line side by side, info buttons and breakdowns, marketing sections, a light/dark theme switch — MUST BE USED instead of hand-writing ERB and Tailwind for UI.
4
4
  tools: Bash, Read, Write, Edit, Grep
5
5
  scope: UI — pages, forms, tables, navigation, dashboards
6
6
  ---
@@ -75,7 +75,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
75
75
  - `ui_link` — a text link in the link colour.
76
76
  - `ui_facts` — a row of facts, each a count in bold beside its label.
77
77
  - `ui_paragraph` — a paragraph of running text.
78
- - `ui_value_list` — rows of a label and its value, such as a ledger or a byline.
78
+ - `ui_value_list` — labelled values, as rows of a label beside its value, such as a ledger or a byline, or as columns of a label above its value.
79
79
  - `ui_alert` — a banner message, optionally dismissible.
80
80
  - `ui_link_list` — a list of links, each row with a label, an optional subtitle, badge and value, and a chevron.
81
81
  - `ui_empty_state` — what a list or section shows when it has nothing in it, with an optional message and action.
@@ -689,10 +689,19 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
689
689
  - `ui_facts(facts:)` — each fact is `{ value:, label: }`, drawn as a small
690
690
  box with the count in bold beside its label, in a row that wraps.
691
691
  - `ui_paragraph(text:)` shows running text.
692
- - `ui_value_list(rows:, align: :start)` — each row is `{ label:, value: }`
693
- with optional `note:`, `total: true`, `right: true` and `fallback:`, shown
694
- when the value is `nil` or empty. `right: true` draws a green check mark
695
- after the value, read out as "Right", for an answer that was right. `align: :end` pushes values to the right, as in a ledger.
692
+ - `ui_value_list(rows:, align: :start, columns: false)` — each row is
693
+ `{ label:, value: }` with optional `note:`, `total: true`, `right: true`
694
+ and `fallback:`, shown when the value is `nil` or empty. `right: true`
695
+ draws a green check mark after the value, read out as "Right", for an
696
+ answer that was right. `align: :end` pushes values to the right, as in a
697
+ ledger.
698
+ - With the default `columns: false`, each pair is one row with its label
699
+ beside its value and a line between rows. `columns: true` draws each pair
700
+ as its label in small text directly above its value, with no line between
701
+ pairs, one pair per line below `sm:` and two side by side from `sm:` up. A
702
+ long value wraps inside its own column. Use it for a record's details,
703
+ such as its contact and address fields, and ask the developer which
704
+ layout a screen uses.
696
705
 
697
706
  10. Explain figures.
698
707
 
@@ -13,7 +13,7 @@ nothing and gives no steps.
13
13
  keystone_ui is a Rails engine gem that supplies a host app's UI as view helpers
14
14
  built on ViewComponent. Screens are built from named pieces — page shells,
15
15
  sections, panels, grids, forms and fields, search dropdowns, data tables, navigation, cards,
16
- badges, status dots, stat tiles, charts, timelines, funnels, goal buckets, pipelines, breakdowns, code blocks,
16
+ badges, status dots, value lists, stat tiles, charts, timelines, funnels, goal buckets, pipelines, breakdowns, code blocks,
17
17
  text diffs and info buttons —
18
18
  instead of hand-written ERB and Tailwind. Every class the UI renders lives in the
19
19
  gem, so two pages built from the same helpers cannot disagree about spacing,
@@ -97,6 +97,13 @@ One decision: is keystone_ui set up in the app?
97
97
  to the address of the last entry in that row that has one. An entry can be
98
98
  marked selected, and the row holding it is drawn in the same tint as a data
99
99
  table's current row and announced to screen readers as the current item.
100
+ - **Value lists.** A value list shows labelled values, each a label and a value
101
+ with an optional note, a fallback shown when the value is empty, a total
102
+ marking and a check mark for a value that is right. By default each pair is a
103
+ row with its label beside its value and a line between rows. A value list can
104
+ lay its pairs in columns instead: one column on a phone and two from `sm:` up,
105
+ each label in small text directly above its value, a long value wrapping
106
+ inside its own column, and no line between pairs.
100
107
  - **Going back.** A form or show page shell needs a way back: a back link, a
101
108
  trail of earlier pages shown as breadcrumbs, or a trail the app supplies for
102
109
  the request. A nav tab's own page passes an empty trail and shows no back
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.87.0
4
+ version: 0.88.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider