keystone_ui 0.95.0 → 0.97.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/app/components/keystone/ui/bar_chart_component.html.erb +14 -10
- data/app/components/keystone/ui/bar_chart_component.rb +59 -4
- data/app/components/keystone/ui/review_card_component.html.erb +24 -0
- data/app/components/keystone/ui/review_card_component.rb +50 -0
- data/app/components/keystone/ui/review_card_grid_component.rb +13 -0
- data/app/helpers/keystone_ui_helper.rb +8 -0
- data/lib/keystone_ui/safelist.rb +2 -0
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +35 -5
- data/the_local/agents/keystone_ui-info.md +21 -0
- data/the_local/interface.yml +5 -0
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a6d1b9a708eca00e9bbc2d350357bbc6e143412e710d28e5aa0839c3b9e3b25
|
|
4
|
+
data.tar.gz: c16b15329182ef72fcfee00f5f93c7c0627e57900d49e7c793ea6c2fe40212af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 03e29e1487956c4e3fa22f3446aff808adf896c0f743e76f92d00159825e0323de173afa73d300f453774c59fd8594ffaecb2e4941d9123930b6c45e54beb005
|
|
7
|
+
data.tar.gz: b62f7a4d3a0c19f10e9d61801d0d3d77143de191ab5b01791316c6ba87f39717c7a81697bee2456c9039a51a830b17f3cc1e0afd4f802a79eb715295b7f34ee1
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
<div class="<%=
|
|
1
|
+
<div class="<%= frame_classes %>" role="img">
|
|
2
2
|
<div class="<%= Keystone::Ui::BarChartComponent::PLOT_ROW_CLASSES %>">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
<% unless strip? %>
|
|
4
|
+
<svg class="<%= Keystone::Ui::BarChartComponent::AXIS_CLASSES %>">
|
|
5
|
+
<% ticks.each do |tick| %>
|
|
6
|
+
<text class="ks-bar-chart-text" data-axis-tick x="100%" dx="-6" y="<%= tick[:y].round(2) %>%" dominant-baseline="middle" text-anchor="end"><%= tick[:label] %></text>
|
|
7
|
+
<% end %>
|
|
8
|
+
</svg>
|
|
9
|
+
<% end %>
|
|
8
10
|
<div class="<%= Keystone::Ui::BarChartComponent::PLOT_CLASSES %>">
|
|
9
11
|
<svg class="<%= Keystone::Ui::BarChartComponent::LAYER_CLASSES %>" viewBox="0 0 100 100" preserveAspectRatio="none">
|
|
10
|
-
<%
|
|
12
|
+
<% grid_lines.each do |tick| %>
|
|
11
13
|
<line class="ks-bar-chart-grid" x1="0" x2="100" y1="<%= tick[:y].round(2) %>" y2="<%= tick[:y].round(2) %>" vector-effect="non-scaling-stroke"></line>
|
|
12
14
|
<% end %>
|
|
13
15
|
<% drawn_bars.each do |bar| %>
|
|
@@ -24,10 +26,12 @@
|
|
|
24
26
|
</div>
|
|
25
27
|
</div>
|
|
26
28
|
<div class="<%= Keystone::Ui::BarChartComponent::LABEL_ROW_CLASSES %>">
|
|
27
|
-
|
|
29
|
+
<% unless strip? %>
|
|
30
|
+
<span class="<%= Keystone::Ui::BarChartComponent::LABEL_SPACER_CLASSES %>"></span>
|
|
31
|
+
<% end %>
|
|
28
32
|
<svg class="<%= Keystone::Ui::BarChartComponent::LABELS_CLASSES %>">
|
|
29
|
-
<%
|
|
30
|
-
<text class="ks-bar-chart-text" data-bar-label x="<%= bar[:
|
|
33
|
+
<% labelled_bars.each do |bar| %>
|
|
34
|
+
<text class="ks-bar-chart-text" data-bar-label x="<%= bar[:label_x].round(2) %>%" y="100%" dy="-6" text-anchor="<%= bar[:label_anchor] %>"><%= bar[:label] %></text>
|
|
31
35
|
<% end %>
|
|
32
36
|
</svg>
|
|
33
37
|
</div>
|
|
@@ -4,6 +4,7 @@ module Keystone
|
|
|
4
4
|
module Ui
|
|
5
5
|
class BarChartComponent < ViewComponent::Base
|
|
6
6
|
FRAME_CLASSES = "ks-bar-chart flex aspect-[5/2] max-h-80 w-full flex-col"
|
|
7
|
+
STRIP_FRAME_CLASSES = "ks-bar-chart flex h-[114px] w-full flex-col"
|
|
7
8
|
PLOT_ROW_CLASSES = "flex min-h-0 flex-1"
|
|
8
9
|
AXIS_CLASSES = "h-full w-10 shrink-0 overflow-visible"
|
|
9
10
|
PLOT_CLASSES = "relative min-w-0 flex-1"
|
|
@@ -14,14 +15,25 @@ module Keystone
|
|
|
14
15
|
FULL = 100.0
|
|
15
16
|
HEADROOM = 8.0
|
|
16
17
|
BAR_SHARE = 0.7
|
|
18
|
+
STRIP_BAR_SHARE = 0.92
|
|
17
19
|
TICK_COUNT = 4
|
|
18
20
|
ROUND_STEPS = [ 1, 2, 2.5, 5, 10 ].freeze
|
|
21
|
+
GROUP_TONES = 5
|
|
19
22
|
|
|
20
23
|
attr_reader :bars
|
|
21
24
|
|
|
22
|
-
def initialize(bars:, show_values: false)
|
|
25
|
+
def initialize(bars:, show_values: false, strip: false)
|
|
23
26
|
@bars = bars
|
|
24
27
|
@show_values = show_values
|
|
28
|
+
@strip = strip
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def strip?
|
|
32
|
+
@strip
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def frame_classes
|
|
36
|
+
strip? ? STRIP_FRAME_CLASSES : FRAME_CLASSES
|
|
25
37
|
end
|
|
26
38
|
|
|
27
39
|
def show_values?
|
|
@@ -31,12 +43,26 @@ module Keystone
|
|
|
31
43
|
def drawn_bars
|
|
32
44
|
bars.each_with_index.map do |bar, index|
|
|
33
45
|
height = bar[:value].to_f / axis_max * (FULL - HEADROOM)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
46
|
+
x = (index * band) + (band * (1 - bar_share) / 2)
|
|
47
|
+
center = (index * band) + (band / 2)
|
|
48
|
+
{ x: x, y: FULL - height, width: band * bar_share, height: height, center: center,
|
|
49
|
+
label: bar[:label], label_x: bar.key?(:group) ? x : center, label_anchor: bar.key?(:group) ? "start" : "middle", value: bar[:value],
|
|
50
|
+
classes: [ "ks-bar-chart-bar", ("ks-bar-chart-bar-shaded" if bar[:shaded]), group_class(bar) ].compact.join(" ") }
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def labelled_bars
|
|
55
|
+
drawn_bars.each_with_index.filter_map do |bar, index|
|
|
56
|
+
next unless starts_group?(index)
|
|
57
|
+
|
|
58
|
+
newest_group_start?(index) ? bar.merge(label_x: FULL, label_anchor: "end") : bar
|
|
37
59
|
end
|
|
38
60
|
end
|
|
39
61
|
|
|
62
|
+
def grid_lines
|
|
63
|
+
strip? ? [ { y: FULL } ] : ticks
|
|
64
|
+
end
|
|
65
|
+
|
|
40
66
|
def ticks
|
|
41
67
|
(0..(axis_max / step).round).map do |position|
|
|
42
68
|
value = (step * position).round(6)
|
|
@@ -46,6 +72,35 @@ module Keystone
|
|
|
46
72
|
|
|
47
73
|
private
|
|
48
74
|
|
|
75
|
+
def bar_share
|
|
76
|
+
strip? ? STRIP_BAR_SHARE : BAR_SHARE
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def newest_group_start?(index)
|
|
80
|
+
groups.size > 1 && bars[index].key?(:group) && bars[index][:group] == groups.last
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def starts_group?(index)
|
|
84
|
+
index.zero? || !bars[index].key?(:group) || bars[index][:group] != bars[index - 1][:group]
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def group_class(bar)
|
|
88
|
+
return unless bar.key?(:group)
|
|
89
|
+
|
|
90
|
+
"ks-bar-chart-bar-group-#{group_tone(groups.index(bar[:group]))}"
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def group_tone(position)
|
|
94
|
+
return GROUP_TONES if groups.size == 1
|
|
95
|
+
return [ 1, position - groups.size + 1 + GROUP_TONES ].max if groups.size > GROUP_TONES
|
|
96
|
+
|
|
97
|
+
1 + (position * (GROUP_TONES - 1).to_f / (groups.size - 1)).round
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def groups
|
|
101
|
+
@groups ||= bars.map { |bar| bar[:group] }.uniq
|
|
102
|
+
end
|
|
103
|
+
|
|
49
104
|
def axis_max
|
|
50
105
|
step * (largest / step).ceil
|
|
51
106
|
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<article class="<%= card_classes %>">
|
|
2
|
+
<div class="<%= HEADER_CLASSES %>">
|
|
3
|
+
<span class="<%= ID_CLASSES %>"><%= @id %></span>
|
|
4
|
+
<% if @score %>
|
|
5
|
+
<span class="<%= score_classes %>"><%= @score %></span>
|
|
6
|
+
<% end %>
|
|
7
|
+
</div>
|
|
8
|
+
<h3 class="<%= TITLE_CLASSES %>"><%= @title %></h3>
|
|
9
|
+
<% if @body %>
|
|
10
|
+
<p class="<%= body_classes %>"><%= @body %></p>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% if @cta && !@compact %>
|
|
13
|
+
<p class="<%= CTA_CLASSES %>"><%= @cta %></p>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% if @meta && !@compact %>
|
|
16
|
+
<p class="<%= META_CLASSES %>"><%= @meta %></p>
|
|
17
|
+
<% end %>
|
|
18
|
+
<% if @finding %>
|
|
19
|
+
<p class="<%= FINDING_CLASSES %>"><%= @finding %></p>
|
|
20
|
+
<% end %>
|
|
21
|
+
<% if @actions.any? %>
|
|
22
|
+
<%= action_row %>
|
|
23
|
+
<% end %>
|
|
24
|
+
</article>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Keystone
|
|
4
|
+
module Ui
|
|
5
|
+
class ReviewCardComponent < ViewComponent::Base
|
|
6
|
+
CARD_CLASSES = "ks-card ks-panel-padding-sm flex flex-col ks-grid-gap-sm sm:[&_.ks-button]:min-w-0 sm:[&_.ks-button]:text-xs"
|
|
7
|
+
WARNING_CLASSES = "ks-card-warning"
|
|
8
|
+
HEADER_CLASSES = "flex justify-between items-baseline ks-grid-gap-sm text-xs"
|
|
9
|
+
ID_CLASSES = "font-mono ks-tone-muted"
|
|
10
|
+
TITLE_CLASSES = "ks-card-title text-base leading-snug"
|
|
11
|
+
BODY_CLASSES = "ks-card-summary mt-0 text-xs leading-normal"
|
|
12
|
+
COMPACT_BODY_CLASSES = "truncate"
|
|
13
|
+
CTA_CLASSES = "ks-card-link text-xs"
|
|
14
|
+
META_CLASSES = "ks-card-meta font-mono text-xs ks-tone-muted"
|
|
15
|
+
FINDING_CLASSES = "ks-alert ks-alert-warning text-xs"
|
|
16
|
+
TONE_CLASSES = { muted: "ks-tone-muted", neutral: "ks-tone-neutral", success: "ks-tone-success", warning: "ks-tone-warning", danger: "ks-tone-danger", info: "ks-tone-info" }.freeze
|
|
17
|
+
|
|
18
|
+
def initialize(id:, title:, score: nil, score_tone: :muted, body: nil, cta: nil, meta: nil, finding: nil, actions: [], compact: false)
|
|
19
|
+
@id = id
|
|
20
|
+
@title = title
|
|
21
|
+
@score = score
|
|
22
|
+
@score_tone = score_tone
|
|
23
|
+
@body = body
|
|
24
|
+
@cta = cta
|
|
25
|
+
@meta = meta
|
|
26
|
+
@finding = finding
|
|
27
|
+
@actions = actions
|
|
28
|
+
@compact = compact
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def action_row
|
|
32
|
+
render(ButtonRowComponent.new(equal_width: true)) do
|
|
33
|
+
safe_join(@actions.map { |action| render ButtonComponent.new(variant: :secondary, size: :sm, **action) })
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def card_classes
|
|
38
|
+
[ CARD_CLASSES, (WARNING_CLASSES if @finding) ].compact.join(" ")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def body_classes
|
|
42
|
+
[ BODY_CLASSES, (COMPACT_BODY_CLASSES if @compact) ].compact.join(" ")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def score_classes
|
|
46
|
+
TONE_CLASSES.fetch(@score_tone)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Keystone
|
|
4
|
+
module Ui
|
|
5
|
+
class ReviewCardGridComponent < ViewComponent::Base
|
|
6
|
+
COLUMNS = { default: 1, lg: 3 }.freeze
|
|
7
|
+
|
|
8
|
+
def call
|
|
9
|
+
render(GridComponent.new(cols: COLUMNS, gap: :sm)) { content }
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -65,6 +65,14 @@ module KeystoneUiHelper
|
|
|
65
65
|
render Keystone::Ui::CardComponent.new(**args)
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
+
def ui_review_card(**args)
|
|
69
|
+
render Keystone::Ui::ReviewCardComponent.new(**args)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def ui_review_card_grid(&block)
|
|
73
|
+
render Keystone::Ui::ReviewCardGridComponent.new, &block
|
|
74
|
+
end
|
|
75
|
+
|
|
68
76
|
def ui_button(**args)
|
|
69
77
|
render Keystone::Ui::ButtonComponent.new(**args)
|
|
70
78
|
end
|
data/lib/keystone_ui/safelist.rb
CHANGED
|
@@ -58,6 +58,8 @@ module Keystone
|
|
|
58
58
|
Keystone::Ui::ShowPageComponent,
|
|
59
59
|
Keystone::Ui::OptionCardComponent,
|
|
60
60
|
Keystone::Ui::RadioCardComponent,
|
|
61
|
+
Keystone::Ui::ReviewCardComponent,
|
|
62
|
+
Keystone::Ui::ReviewCardGridComponent,
|
|
61
63
|
Keystone::Ui::SearchSelectComponent,
|
|
62
64
|
Keystone::Ui::CheckboxRowComponent,
|
|
63
65
|
Keystone::Ui::ProgressComponent,
|
data/lib/keystone_ui/version.rb
CHANGED
|
@@ -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 phone header with a line above its title and a badge at its right end, a page's main action as a phone top-bar icon or a button fixed to the bottom of the screen, a decision bar of a note field and several buttons sent as one form and fixed to the bottom of a phone 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 short note or badge at the right of a section's title, a record's details as labelled values in rows or in two columns, a queue of links with a type and time above each title and the open one marked, two versions of a text compared line by line side by side or in one column, 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 phone header with a line above its title and a badge at its right end, a page's main action as a phone top-bar icon or a button fixed to the bottom of the screen, a decision bar of a note field and several buttons sent as one form and fixed to the bottom of a phone screen, review cards of an id, score, title, text, finding note and equal-width buttons set three across on a desktop, 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 short note or badge at the right of a section's title, a record's details as labelled values in rows or in two columns, a queue of links with a type and time above each title and the open one marked, two versions of a text compared line by line side by side or in one column, 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
|
---
|
|
@@ -35,6 +35,8 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
35
35
|
- `ui_panel` — a bordered card surface holding any content.
|
|
36
36
|
- `ui_card_link` — a panel that is one link as a whole.
|
|
37
37
|
- `ui_card` — a fixed card of title, summary and call-to-action link.
|
|
38
|
+
- `ui_review_card` — a card for one reviewed item: id and score, title, text, call-to-action line, meta line, finding note and equal-width buttons.
|
|
39
|
+
- `ui_review_card_grid` — review cards three across from `lg:` up and one per row below it.
|
|
38
40
|
- `ui_navbar` — a navigation bar with named slots for desktop and mobile.
|
|
39
41
|
- `ui_navigation` — draws the app's declared navigation groups as a top bar or a sidebar around the page content.
|
|
40
42
|
- `ui_nav_item` — one desktop navigation link.
|
|
@@ -96,7 +98,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
96
98
|
- `ui_swipe_deck` — a stack of cards accepted or rejected by button or swipe.
|
|
97
99
|
- `ui_chart_card` — a titled card holding a chart.
|
|
98
100
|
- `ui_line_chart` — a line chart with one line per series, over labels or dates.
|
|
99
|
-
- `ui_bar_chart` — a bar chart drawn on the server, which needs no JavaScript and prints.
|
|
101
|
+
- `ui_bar_chart` — a bar chart drawn on the server, which needs no JavaScript and prints, with bars optionally grouped into tones from oldest to newest and one label per group, and optionally drawn as a short strip with no value axis.
|
|
100
102
|
- `ui_funnel` — a conversion funnel drawn as bars or one joined shape.
|
|
101
103
|
- `ui_bucket` — an upright container filled toward a goal.
|
|
102
104
|
- `ui_bucket_series` — a wrapping row of buckets.
|
|
@@ -263,6 +265,22 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
263
265
|
- `ui_card(title:, summary:, link:, cta: "Read more", edge_to_edge: false, class: nil)`
|
|
264
266
|
takes no block. `edge_to_edge: true` drops the side border and corner
|
|
265
267
|
rounding below `sm:` so the card spans the full width on mobile.
|
|
268
|
+
- `ui_review_card(id:, title:, score: nil, score_tone: :muted, body: nil, cta: nil, meta: nil, finding: nil, actions: [], compact: false)`
|
|
269
|
+
takes no block. Its header line shows `id:` at the left in a monospaced
|
|
270
|
+
font and `score:` at the right in `score_tone:`, one of `:muted`
|
|
271
|
+
`:neutral` `:success` `:warning` `:danger` `:info`. Then come `title:`,
|
|
272
|
+
`body:`, `cta:` as a line of text in the link colour (not a link),
|
|
273
|
+
`meta:` in a monospaced font with a divider above it, `finding:` as a
|
|
274
|
+
note in the warning style, and `actions:`, each a hash of `ui_button`
|
|
275
|
+
keywords drawn as a small secondary button taking an equal share of one
|
|
276
|
+
row. A `finding:` also draws the card's edge in the warning style.
|
|
277
|
+
`compact: true` cuts the body to one line with an ellipsis and leaves out
|
|
278
|
+
the call-to-action line and the meta line, for a phone list. Below `sm:` each button is at least 44 pixels
|
|
279
|
+
tall, and from `sm:` up the buttons are narrowed so three labels fit in a
|
|
280
|
+
third of the page. Use it in place of a hand-written card of these parts.
|
|
281
|
+
- `ui_review_card_grid` takes no keywords and a block of `ui_review_card`
|
|
282
|
+
calls, and sets them three across from `lg:` up and one per row below
|
|
283
|
+
it. Use it in place of `ui_grid` column counts for review cards.
|
|
266
284
|
|
|
267
285
|
5. Wire navigation in the layout.
|
|
268
286
|
|
|
@@ -825,10 +843,22 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
825
843
|
|
|
826
844
|
- `ui_chart_card(title:, height: :md)` takes a block holding a chart, with
|
|
827
845
|
`height:` `:sm` `:md` `:lg`.
|
|
828
|
-
- `ui_bar_chart(bars:, show_values: false)` — `bars:` is
|
|
829
|
-
`[{ label:, value:, shaded: }, ...]`, where `shaded: true` draws
|
|
830
|
-
faded. It is drawn on the server as an SVG, so use it, not
|
|
846
|
+
- `ui_bar_chart(bars:, show_values: false, strip: false)` — `bars:` is
|
|
847
|
+
`[{ label:, value:, shaded:, group: }, ...]`, where `shaded: true` draws
|
|
848
|
+
a bar faded. It is drawn on the server as an SVG, so use it, not
|
|
831
849
|
`ui_line_chart`, for a chart that must print or show without JavaScript.
|
|
850
|
+
- Give bars `group:`, such as the version that produced each one, to show
|
|
851
|
+
groups of bars. Groups count from oldest to newest in the order their
|
|
852
|
+
values first appear, and run in tones from grey to the accent, with no
|
|
853
|
+
two of five or fewer groups sharing a tone. With more than five, every
|
|
854
|
+
group older than the newest four is grey. Only a group's first bar
|
|
855
|
+
writes its label, starting at its left edge, so pass `""` for the rest,
|
|
856
|
+
such as `{ label: "v21 → 0.80", value: 0.66, group: "v21" }` followed by
|
|
857
|
+
`{ label: "", value: 0.68, group: "v21" }`. The newest group's label
|
|
858
|
+
ends at the chart's right edge. Never colour bars by hand.
|
|
859
|
+
- Pass `strip: true` for a short strip of bars 114px tall with no value
|
|
860
|
+
axis and no grid lines, only a baseline, and the bars nearly touching,
|
|
861
|
+
such as a trend under a page's main content.
|
|
832
862
|
- `ui_line_chart(series:, labels: nil, dates: nil, height: :md)` —
|
|
833
863
|
`series:` is `[{ name:, data:, color:, dashed: }, ...]`, where `color:`
|
|
834
864
|
is a CSS colour and `dashed: true` is optional. Pass exactly one of
|
|
@@ -97,6 +97,16 @@ 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
|
+
- **Bar chart groups.** A bar chart's bars can be put in groups, such as one
|
|
101
|
+
group per version of what produced them. Groups count from oldest to newest
|
|
102
|
+
in the order they first appear. Every bar of a group shares one tone, and
|
|
103
|
+
the tones run from grey for the oldest to the accent for the newest, with
|
|
104
|
+
no two of five or fewer groups sharing one. Past five, every group older
|
|
105
|
+
than the newest four is grey. Only the first bar of each group carries a
|
|
106
|
+
label under the axis, starting at that bar's left edge, apart from the
|
|
107
|
+
newest group's label, which ends at the chart's right edge. A bar chart can
|
|
108
|
+
also be drawn as a short strip with no value axis and no grid lines, only a
|
|
109
|
+
baseline, and its bars nearly touching.
|
|
100
110
|
- **Value lists.** A value list shows labelled values, each a label and a value
|
|
101
111
|
with an optional note, a fallback shown when the value is empty, a total
|
|
102
112
|
marking and a check mark for a value that is right. By default each pair is a
|
|
@@ -155,6 +165,17 @@ One decision: is keystone_ui set up in the app?
|
|
|
155
165
|
of its width, keeping each label on one line, so the row wraps only when a
|
|
156
166
|
label no longer fits. It can do that on a phone only, leaving each button
|
|
157
167
|
the width of its label on a wider screen.
|
|
168
|
+
- **Review cards.** A review card shows one item someone reviews, such as
|
|
169
|
+
one of several variants compared side by side. A header line holds a short
|
|
170
|
+
id at the left and a score or status at the right, coloured by tone, above
|
|
171
|
+
a title, body text, an optional call-to-action line and an optional line of
|
|
172
|
+
short details with a divider above it. An optional finding note is drawn
|
|
173
|
+
in the warning style, and the card's edge is then drawn in the warning
|
|
174
|
+
style too. An optional row of buttons gives each button an equal share.
|
|
175
|
+
A compact form cuts the body text to one line with an ellipsis and leaves
|
|
176
|
+
out the call-to-action line and the details line, for a phone. A review card grid sets the cards three across
|
|
177
|
+
on a desktop and one per row on a phone, where each button is at least a
|
|
178
|
+
phone's tap height.
|
|
158
179
|
- **Confirmation.** A button can carry a confirmation question, and the
|
|
159
180
|
browser asks it before following the link or sending the form. Nothing is
|
|
160
181
|
sent when the user cancels.
|
data/the_local/interface.yml
CHANGED
|
@@ -21,6 +21,8 @@ develop:
|
|
|
21
21
|
- ui_status_dot
|
|
22
22
|
- ui_copy_button
|
|
23
23
|
- ui_card
|
|
24
|
+
- ui_review_card
|
|
25
|
+
- ui_review_card_grid
|
|
24
26
|
- ui_button
|
|
25
27
|
- ui_button_row
|
|
26
28
|
- ui_data_table
|
|
@@ -114,6 +116,9 @@ sources:
|
|
|
114
116
|
- app/components/keystone/ui/button_row_component.rb
|
|
115
117
|
- app/components/keystone/ui/button_row_component.html.erb
|
|
116
118
|
- app/components/keystone/ui/card_component.rb
|
|
119
|
+
- app/components/keystone/ui/review_card_component.rb
|
|
120
|
+
- app/components/keystone/ui/review_card_component.html.erb
|
|
121
|
+
- app/components/keystone/ui/review_card_grid_component.rb
|
|
117
122
|
- app/components/keystone/ui/card_link_component.rb
|
|
118
123
|
- app/components/keystone/ui/chart_card_component.rb
|
|
119
124
|
- app/components/keystone/ui/checkbox_row_component.rb
|
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.
|
|
4
|
+
version: 0.97.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.
|
|
18
|
+
version: 0.38.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.
|
|
25
|
+
version: 0.38.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: view_component
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -203,6 +203,9 @@ files:
|
|
|
203
203
|
- app/components/keystone/ui/progress_component.rb
|
|
204
204
|
- app/components/keystone/ui/radio_card_component.html.erb
|
|
205
205
|
- app/components/keystone/ui/radio_card_component.rb
|
|
206
|
+
- app/components/keystone/ui/review_card_component.html.erb
|
|
207
|
+
- app/components/keystone/ui/review_card_component.rb
|
|
208
|
+
- app/components/keystone/ui/review_card_grid_component.rb
|
|
206
209
|
- app/components/keystone/ui/saved_layout.rb
|
|
207
210
|
- app/components/keystone/ui/search_select_component.html.erb
|
|
208
211
|
- app/components/keystone/ui/search_select_component.rb
|