keystone_ui 0.81.0 → 0.82.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: d3516b268acea8768fce1e6047f13603e698cd447fe6e3fa0f22fed56fca71fb
4
- data.tar.gz: 2da41656eefaec66eea22dca56955a7410b91b6cce7c5d5f4459172a86f42de0
3
+ metadata.gz: 466ea40680ab637e61843d16aabb6ffaf755fd4e02cb2c4ebabe6752c515da0f
4
+ data.tar.gz: c46bba20299816139c945b9fe680b45b7402576a71442ce7fe611b72a700242c
5
5
  SHA512:
6
- metadata.gz: 5d4b015f5d4821117e4af16452ac86a0f935b39b365730e093b1d7789641d878bcd691573e1c9efe5618d109743080b88f3389ac2d74b403adb1004ba131dc9e
7
- data.tar.gz: 4baae133e97445b05547688c777a95d10415ad9f5adc0a1af8bd9a0efdbc6317a28a4437a4e449be2f62bb7d3450ea49fee8c959702bfccf1132813d927c80aa
6
+ metadata.gz: 528af89d06fabf10ebcd476f2477fc0df0407607d6cc4879646354f372900497d320348f64cffd74e6919de846f53d597470b56f54ad4e7adb8c7da3fc595a9f
7
+ data.tar.gz: 6f2973cd5fd00fedc3f71de681e2c6c8ea2e61c49f8ae3d515ad308a9207ee3b55b6f177d01ee01bcabd5a79b2253f5e53269c34c794c67ce61a405d6947d2f4
@@ -1,8 +1,8 @@
1
1
  <div class="flex flex-col gap-3">
2
2
  <% rows.each do |row| %>
3
- <div data-timeline-row>
3
+ <div data-timeline-row<% if selected?(row) %> class="<%= SELECTED_ROW_CLASSES %>" aria-current="true"<% end %>>
4
4
  <div class="<%= ROW_TEXT_CLASSES %>">
5
- <span data-timeline-label><%= row[:label] %></span>
5
+ <%= content_tag(row_href(row) ? :a : :span, row[:label], data: { timeline_label: "" }, href: row_href(row)) %>
6
6
  <span data-timeline-duration><%= duration(row) %></span>
7
7
  </div>
8
8
  <div class="<%= TRACK_CLASSES %>">
@@ -10,7 +10,7 @@
10
10
  <% if entry[:queued_at] %>
11
11
  <div class="<%= QUEUED_CLASSES %>" data-timeline-queued style="<%= queued_style(entry) %>"></div>
12
12
  <% end %>
13
- <div class="<%= bar_classes(entry) %>" data-timeline-bar style="<%= bar_style(entry) %>"><% if entry[:failed] %><span class="<%= SCREEN_READER_CLASSES %>">Failed</span><% end %></div>
13
+ <%= content_tag(bar_tag(entry), class: bar_classes(entry), data: { timeline_bar: "" }, style: bar_style(entry), href: entry[:href]) do %><% if entry[:href] %><span class="<%= SCREEN_READER_CLASSES %>"><%= entry[:label] %></span> <% end %><% if entry[:failed] %><span class="<%= SCREEN_READER_CLASSES %>">Failed</span><% end %><% end %>
14
14
  <% end %>
15
15
  </div>
16
16
  </div>
@@ -8,6 +8,7 @@ module Keystone
8
8
  FAILED_CLASSES = "ks-timeline-failed"
9
9
  QUEUED_CLASSES = "ks-timeline-queued absolute inset-y-0"
10
10
  SCREEN_READER_CLASSES = "sr-only"
11
+ SELECTED_ROW_CLASSES = "ks-table-row-current"
11
12
  ROW_TEXT_CLASSES = "ks-meter-label flex justify-between text-sm"
12
13
  AXIS_CLASSES = "ks-meter-label flex justify-between text-xs"
13
14
 
@@ -25,6 +26,14 @@ module Keystone
25
26
  entries.group_by { |entry| entry[:label] }.map { |label, tries| { label: label, tries: tries } }
26
27
  end
27
28
 
29
+ def row_href(row)
30
+ row[:tries].filter_map { |entry| entry[:href] }.last
31
+ end
32
+
33
+ def selected?(row)
34
+ row[:tries].any? { |entry| entry[:selected] }
35
+ end
36
+
28
37
  def queued_style(entry)
29
38
  "left: #{percent(entry[:queued_at] - axis_start)}%; width: #{percent(entry[:started_at] - entry[:queued_at])}%"
30
39
  end
@@ -33,6 +42,10 @@ module Keystone
33
42
  [ BAR_CLASSES, (FAILED_CLASSES if entry[:failed]) ].compact.join(" ")
34
43
  end
35
44
 
45
+ def bar_tag(entry)
46
+ entry[:href] ? :a : :div
47
+ end
48
+
36
49
  def duration(row)
37
50
  written_duration(row[:tries].last[:ended_at] - row[:tries].first[:started_at])
38
51
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.81.0"
4
+ VERSION = "0.82.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 with retries, queued time and failed tries, 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 with retries, queued time, failed tries, 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.
4
4
  tools: Bash, Read, Write, Edit, Grep
5
5
  scope: UI — pages, forms, tables, navigation, dashboards
6
6
  ---
@@ -98,7 +98,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
98
98
  - `ui_funnel` — a conversion funnel drawn as bars or one joined shape.
99
99
  - `ui_bucket` — an upright container filled toward a goal.
100
100
  - `ui_bucket_series` — a wrapping row of buckets.
101
- - `ui_timeline` — rows of timed steps on one shared time axis, each try of a step a bar on its row, with optional queued time and failed tries marked.
101
+ - `ui_timeline` — rows of timed steps on one shared time axis, each try of a step a bar on its row, with optional queued time and failed tries marked, bars and row labels that open an address, and the current row marked.
102
102
  - `ui_pipeline` — a staged flow diagram with buttons and breakable links that post to the app.
103
103
  - `ui_hero` — a marketing hero with title, call-to-action buttons and an aside.
104
104
  - `ui_cta_banner` — a marketing banner holding call-to-action buttons.
@@ -753,7 +753,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
753
753
  - `ui_bucket_series(buckets:)` takes an array of hashes with the keywords
754
754
  of `ui_bucket`, such as `[{ goal: 10, actual: 7, label: "Mon" }, ...]`.
755
755
  - `ui_timeline(entries:)` takes no block. `entries:` is
756
- `[{ label:, started_at:, ended_at:, queued_at: nil, failed: false }, ...]`,
756
+ `[{ label:, started_at:, ended_at:, queued_at: nil, failed: false, href: nil, selected: false }, ...]`,
757
757
  with every time a `Time` value.
758
758
  - It draws one row per label, in the order each label first appears.
759
759
  Entries that share a label, such as the tries of one step, share that
@@ -768,6 +768,16 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
768
768
  - An entry given `failed: true` draws its bar in the danger colour, and
769
769
  screen readers read it as "Failed". Ask the developer which tries count
770
770
  as failed and whether the queued time is shown.
771
+ - An entry given `href:` draws its bar as a link to that address, read out
772
+ by screen readers as the entry's label. A row's label links to the
773
+ `href:` of the row's last entry that has one, and with none it is plain
774
+ text. Ask the developer which page each try opens, such as that try's
775
+ own detail page.
776
+ - An entry given `selected: true` marks its row as the current one: the
777
+ row is drawn in the same tint as `ui_data_table`'s `current_row:` and
778
+ screen readers announce it as the current item. Pass it on the entry the
779
+ page is showing, such as the try whose detail page holds the timeline,
780
+ and on one entry at most.
771
781
  - Each row shows its label and its duration on one line, then its track.
772
782
  The row's duration runs from its first entry's `started_at` to its last
773
783
  entry's `ended_at`, so queued time before the first try is not counted.
@@ -71,7 +71,11 @@ One decision: is keystone_ui set up in the app?
71
71
  try's end. Queued time is drawn as its own segment before the bar, and a
72
72
  failed try is marked failed both in colour and for screen readers. The axis
73
73
  runs from the earliest queued or start time of any entry to the latest end
74
- time.
74
+ time. An entry can carry an address, and then its bar is a link to it whose
75
+ name screen readers announce is the entry's label, and the row's label links
76
+ to the address of the last entry in that row that has one. An entry can be
77
+ marked selected, and the row holding it is drawn in the same tint as a data
78
+ table's current row and announced to screen readers as the current item.
75
79
  - **Going back.** A form or show page shell needs a way back: a back link, a
76
80
  trail of earlier pages shown as breadcrumbs, or a trail the app supplies for
77
81
  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.81.0
4
+ version: 0.82.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider