keystone_ui 0.79.0 → 0.81.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/bottom_action_component.rb +1 -1
- data/app/components/keystone/ui/button_component.rb +8 -2
- data/app/components/keystone/ui/page_header_component.html.erb +12 -4
- data/app/components/keystone/ui/page_header_component.rb +9 -2
- data/app/components/keystone/ui/timeline_component.html.erb +9 -4
- data/app/components/keystone/ui/timeline_component.rb +20 -5
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +63 -25
- data/the_local/agents/keystone_ui-info.md +24 -9
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d3516b268acea8768fce1e6047f13603e698cd447fe6e3fa0f22fed56fca71fb
|
|
4
|
+
data.tar.gz: 2da41656eefaec66eea22dca56955a7410b91b6cce7c5d5f4459172a86f42de0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5d4b015f5d4821117e4af16452ac86a0f935b39b365730e093b1d7789641d878bcd691573e1c9efe5618d109743080b88f3389ac2d74b403adb1004ba131dc9e
|
|
7
|
+
data.tar.gz: 4baae133e97445b05547688c777a95d10415ad9f5adc0a1af8bd9a0efdbc6317a28a4437a4e449be2f62bb7d3450ea49fee8c959702bfccf1132813d927c80aa
|
|
@@ -25,7 +25,7 @@ module Keystone
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def button
|
|
28
|
-
ButtonComponent.new(label: content_for(:mobile_action_label), href: content_for(:mobile_action_url), method: action_method, full_width: true)
|
|
28
|
+
ButtonComponent.new(label: content_for(:mobile_action_label), href: content_for(:mobile_action_url), method: action_method, confirm: content_for(:mobile_action_confirm), full_width: true)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def action_method
|
|
@@ -20,7 +20,7 @@ module Keystone
|
|
|
20
20
|
|
|
21
21
|
TEXT_CLASSES = "ks-text-button"
|
|
22
22
|
|
|
23
|
-
def initialize(label:, href: nil, method: :get, variant: :primary, size: :md, full_width: false, type: :submit, data: nil, name: nil, value: nil, hidden: false)
|
|
23
|
+
def initialize(label:, href: nil, method: :get, variant: :primary, size: :md, full_width: false, type: :submit, data: nil, name: nil, value: nil, hidden: false, confirm: nil)
|
|
24
24
|
@label = label
|
|
25
25
|
@href = href
|
|
26
26
|
@method = method.to_sym
|
|
@@ -32,6 +32,7 @@ module Keystone
|
|
|
32
32
|
@name = name
|
|
33
33
|
@value = value
|
|
34
34
|
@hidden = hidden
|
|
35
|
+
@confirm = confirm
|
|
35
36
|
end
|
|
36
37
|
|
|
37
38
|
def classes
|
|
@@ -59,6 +60,7 @@ module Keystone
|
|
|
59
60
|
options[:href] = @href
|
|
60
61
|
end
|
|
61
62
|
options[:data] = @data if @data
|
|
63
|
+
options[:data] = (@data || {}).merge(turbo_confirm: @confirm) if @confirm
|
|
62
64
|
options[:hidden] = true if @hidden
|
|
63
65
|
options
|
|
64
66
|
end
|
|
@@ -68,11 +70,15 @@ module Keystone
|
|
|
68
70
|
end
|
|
69
71
|
|
|
70
72
|
def call
|
|
71
|
-
return button_to(@href, method: @method, class: classes, form_class: form_classes) { @label } if request?
|
|
73
|
+
return button_to(@href, method: @method, class: classes, form_class: form_classes, form: form_options) { @label } if request?
|
|
72
74
|
|
|
73
75
|
content_tag(tag_name, @label, **tag_options)
|
|
74
76
|
end
|
|
75
77
|
|
|
78
|
+
def form_options
|
|
79
|
+
@confirm ? { data: { turbo_confirm: @confirm } } : {}
|
|
80
|
+
end
|
|
81
|
+
|
|
76
82
|
def form_classes
|
|
77
83
|
FULL_WIDTH_CLASSES if @full_width
|
|
78
84
|
end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<% content_for :mobile_action_url, action_url %>
|
|
4
4
|
<% content_for :mobile_action_label, action_label %>
|
|
5
5
|
<% content_for :mobile_action_method, action_method.to_s if action_method %>
|
|
6
|
+
<% content_for :mobile_action_confirm, action_confirm if action_confirm %>
|
|
6
7
|
<% end %>
|
|
7
8
|
<div class="<%= wrapper_classes %>">
|
|
8
9
|
<div>
|
|
@@ -22,10 +23,17 @@
|
|
|
22
23
|
</div>
|
|
23
24
|
<% if actions? %>
|
|
24
25
|
<div class="<%= actions_classes %>">
|
|
25
|
-
<%
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
<% main_action = capture do %>
|
|
27
|
+
<% if action? %>
|
|
28
|
+
<%= @action_block.call %>
|
|
29
|
+
<% elsif action_url %>
|
|
30
|
+
<%= render Keystone::Ui::ButtonComponent.new(label: action_label, href: action_url, method: action_method || :get, confirm: action_confirm) %>
|
|
31
|
+
<% end %>
|
|
32
|
+
<% end %>
|
|
33
|
+
<% if main_action_classes %>
|
|
34
|
+
<div class="<%= main_action_classes %>"><%= main_action %></div>
|
|
35
|
+
<% else %>
|
|
36
|
+
<%= main_action %>
|
|
29
37
|
<% end %>
|
|
30
38
|
<% if menu? %>
|
|
31
39
|
<%= render Keystone::Ui::ActionMenuComponent.new do %>
|
|
@@ -12,15 +12,18 @@ module Keystone
|
|
|
12
12
|
PHONE_ACTIONS_CLASSES = "max-sm:flex max-sm:items-center max-sm:basis-full"
|
|
13
13
|
ROW_CLASSES = "sm:flex sm:items-center flex-wrap max-w-full ks-grid-gap-sm"
|
|
14
14
|
TITLE_ROW_CLASSES = "flex flex-wrap items-center ks-grid-gap-sm"
|
|
15
|
+
MAIN_ACTION_AT_BOTTOM_CLASSES = "contents max-sm:hidden"
|
|
15
16
|
|
|
16
|
-
attr_reader :title, :action_url, :action_label, :action_method
|
|
17
|
+
attr_reader :title, :action_url, :action_label, :action_method, :action_confirm
|
|
17
18
|
|
|
18
|
-
def initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, badges: [], menu: [], class: nil)
|
|
19
|
+
def initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, action_confirm: nil, action_at_bottom: false, badges: [], menu: [], class: nil)
|
|
19
20
|
@title = title
|
|
20
21
|
@subtitle = subtitle
|
|
21
22
|
@action_url = action_url
|
|
22
23
|
@action_label = action_label
|
|
23
24
|
@action_method = action_method
|
|
25
|
+
@action_confirm = action_confirm
|
|
26
|
+
@action_at_bottom = action_at_bottom
|
|
24
27
|
@badges = badges
|
|
25
28
|
@menu = menu
|
|
26
29
|
@action_block = nil
|
|
@@ -43,6 +46,10 @@ module Keystone
|
|
|
43
46
|
!!@action_block
|
|
44
47
|
end
|
|
45
48
|
|
|
49
|
+
def main_action_classes
|
|
50
|
+
MAIN_ACTION_AT_BOTTOM_CLASSES if @action_at_bottom
|
|
51
|
+
end
|
|
52
|
+
|
|
46
53
|
def actions_classes
|
|
47
54
|
[ ACTIONS_CLASSES, ROW_CLASSES, (PHONE_ACTIONS_CLASSES if phone?) ].compact.join(" ")
|
|
48
55
|
end
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
<div class="flex flex-col gap-3">
|
|
2
|
-
<%
|
|
2
|
+
<% rows.each do |row| %>
|
|
3
3
|
<div data-timeline-row>
|
|
4
4
|
<div class="<%= ROW_TEXT_CLASSES %>">
|
|
5
|
-
<span data-timeline-label><%=
|
|
6
|
-
<span data-timeline-duration><%= duration(
|
|
5
|
+
<span data-timeline-label><%= row[:label] %></span>
|
|
6
|
+
<span data-timeline-duration><%= duration(row) %></span>
|
|
7
7
|
</div>
|
|
8
8
|
<div class="<%= TRACK_CLASSES %>">
|
|
9
|
-
|
|
9
|
+
<% row[:tries].each do |entry| %>
|
|
10
|
+
<% if entry[:queued_at] %>
|
|
11
|
+
<div class="<%= QUEUED_CLASSES %>" data-timeline-queued style="<%= queued_style(entry) %>"></div>
|
|
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>
|
|
14
|
+
<% end %>
|
|
10
15
|
</div>
|
|
11
16
|
</div>
|
|
12
17
|
<% end %>
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
module Keystone
|
|
4
4
|
module Ui
|
|
5
5
|
class TimelineComponent < ViewComponent::Base
|
|
6
|
-
TRACK_CLASSES = "ks-
|
|
7
|
-
BAR_CLASSES = "ks-
|
|
6
|
+
TRACK_CLASSES = "ks-timeline-track relative w-full h-2 overflow-hidden"
|
|
7
|
+
BAR_CLASSES = "ks-timeline-bar absolute inset-y-0"
|
|
8
|
+
FAILED_CLASSES = "ks-timeline-failed"
|
|
9
|
+
QUEUED_CLASSES = "ks-timeline-queued absolute inset-y-0"
|
|
10
|
+
SCREEN_READER_CLASSES = "sr-only"
|
|
8
11
|
ROW_TEXT_CLASSES = "ks-meter-label flex justify-between text-sm"
|
|
9
12
|
AXIS_CLASSES = "ks-meter-label flex justify-between text-xs"
|
|
10
13
|
|
|
@@ -18,8 +21,20 @@ module Keystone
|
|
|
18
21
|
"left: #{percent(entry[:started_at] - axis_start)}%; width: #{percent(entry[:ended_at] - entry[:started_at])}%"
|
|
19
22
|
end
|
|
20
23
|
|
|
21
|
-
def
|
|
22
|
-
|
|
24
|
+
def rows
|
|
25
|
+
entries.group_by { |entry| entry[:label] }.map { |label, tries| { label: label, tries: tries } }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def queued_style(entry)
|
|
29
|
+
"left: #{percent(entry[:queued_at] - axis_start)}%; width: #{percent(entry[:started_at] - entry[:queued_at])}%"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def bar_classes(entry)
|
|
33
|
+
[ BAR_CLASSES, (FAILED_CLASSES if entry[:failed]) ].compact.join(" ")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def duration(row)
|
|
37
|
+
written_duration(row[:tries].last[:ended_at] - row[:tries].first[:started_at])
|
|
23
38
|
end
|
|
24
39
|
|
|
25
40
|
def total_duration
|
|
@@ -41,7 +56,7 @@ module Keystone
|
|
|
41
56
|
end
|
|
42
57
|
|
|
43
58
|
def axis_start
|
|
44
|
-
@axis_start ||= entries.map { |entry| entry[:started_at] }.min
|
|
59
|
+
@axis_start ||= entries.map { |entry| entry[:queued_at] || entry[:started_at] }.min
|
|
45
60
|
end
|
|
46
61
|
|
|
47
62
|
def axis_end
|
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 page's main action as a phone top-bar icon or a button fixed to the bottom of the screen, action menus for a record's Edit and Delete, dashboards with stat cards, charts, funnels, goal buckets and timelines of timed steps, 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 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.
|
|
4
4
|
tools: Bash, Read, Write, Edit, Grep
|
|
5
5
|
scope: UI — pages, forms, tables, navigation, dashboards
|
|
6
6
|
---
|
|
@@ -27,7 +27,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
27
27
|
- `ui_page` — the outer wrapper of a screen, holding the page's content.
|
|
28
28
|
- `ui_form_page` — marks a screen as a form screen and gives it its title, Back link and breadcrumbs.
|
|
29
29
|
- `ui_show_page` — marks a screen as a detail screen and gives it its Back link and breadcrumbs.
|
|
30
|
-
- `ui_page_header` — the title of a page, with optional badges beside it and a control and action menu on its right.
|
|
30
|
+
- `ui_page_header` — the title of a page, with optional badges beside it and a control and action menu on its right, and the screen's main action, which can ask a question first and can move to the bottom of a phone screen.
|
|
31
31
|
- `ui_breadcrumbs` — a line of links to the pages above the current one, shown from `lg:` up.
|
|
32
32
|
- `ui_section` — a titled block of content with an optional link and action menu in its header.
|
|
33
33
|
- `ui_grid` — a responsive grid with a column count per breakpoint.
|
|
@@ -65,7 +65,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
65
65
|
- `ui_data_table` — a table of records with links, row actions, sorting, hideable columns and the viewer's own row marked.
|
|
66
66
|
- `Keystone::Ui::Column` — a table column with options a `{ key: "Label" }` hash cannot carry.
|
|
67
67
|
- `ui_column_picker` — a Columns menu that saves which columns are hidden and their order to an app endpoint.
|
|
68
|
-
- `ui_button` — a link or a button styled as a button, or a button sending a POST, PATCH or DELETE request.
|
|
68
|
+
- `ui_button` — a link or a button styled as a button, or a button sending a POST, PATCH or DELETE request, optionally asking a question before it goes ahead.
|
|
69
69
|
- `ui_badge` — a coloured pill holding a short label.
|
|
70
70
|
- `ui_status_dot` — a small dot coloured by state, with its label read only by screen readers.
|
|
71
71
|
- `ui_figure` — one amount as inline text, coloured as a gain or a loss.
|
|
@@ -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, each a bar
|
|
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.
|
|
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.
|
|
@@ -175,15 +175,28 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
175
175
|
- Ask the developer whether a screen shows breadcrumbs and which parent
|
|
176
176
|
screens its trail names. Ask which screens a navigation tab opens
|
|
177
177
|
directly, since those pass `trail: []`.
|
|
178
|
-
- `ui_page_header(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, badges: [], menu: [], class: nil)`
|
|
178
|
+
- `ui_page_header(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, action_confirm: nil, action_at_bottom: false, badges: [], menu: [], class: nil)`
|
|
179
179
|
takes a block yielding the header. Call
|
|
180
180
|
`header.action { ... }` in the block to place a control on its right.
|
|
181
181
|
`action_url:` declares the screen's main action. It publishes that URL and
|
|
182
|
-
label for `ui_mobile_action` to pick up, and with
|
|
183
|
-
header draws them as a button. An `action` block is
|
|
184
|
-
are given. `action_method:`, such as `:post`, makes
|
|
185
|
-
that method: the header's button and
|
|
186
|
-
forms posting to `action_url:`.
|
|
182
|
+
label for `ui_mobile_action` and `ui_bottom_action` to pick up, and with
|
|
183
|
+
no `action` block the header draws them as a button. An `action` block is
|
|
184
|
+
drawn alone when both are given. `action_method:`, such as `:post`, makes
|
|
185
|
+
the main action send that method: the header's button and
|
|
186
|
+
`ui_mobile_action`'s icon become forms posting to `action_url:`.
|
|
187
|
+
- `action_confirm:` is a question Turbo asks before the main action goes
|
|
188
|
+
ahead, on the header's button and on `ui_bottom_action`'s button, as
|
|
189
|
+
`ui_button`'s `confirm:` does. `ui_mobile_action`'s plus icon does not ask
|
|
190
|
+
it, so a screen whose action needs a question shows `ui_bottom_action` on
|
|
191
|
+
a phone, not the plus icon. It applies only with `action_url:` and is
|
|
192
|
+
ignored when an `action` block is given. Ask the developer whether a
|
|
193
|
+
screen's main action needs a question and how it is worded.
|
|
194
|
+
- `action_at_bottom: true` hides the header's main action, or its `action`
|
|
195
|
+
block, below `sm:`, for a screen whose phone layout draws the action with
|
|
196
|
+
`ui_bottom_action`. From `sm:` up the header shows it as before, and the
|
|
197
|
+
menu and badges are unaffected. With the default `false` the main action
|
|
198
|
+
shows at every width. Pass it on every screen whose layout calls
|
|
199
|
+
`ui_bottom_action`, so the phone does not show the action twice.
|
|
187
200
|
- `badges:` is `[{ label:, variant: }, ...]`, each drawn as a `ui_badge`
|
|
188
201
|
beside the title, with `variant:` taking the badge's values. `menu:` is
|
|
189
202
|
`[{ label:, href:, method: }, ...]`, each hash taking the keywords of
|
|
@@ -193,8 +206,9 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
193
206
|
action. A header given badges or a menu is shown there with its badges,
|
|
194
207
|
actions and menu, and hides its title when the page holds
|
|
195
208
|
`ui_mobile_header`'s title. Its action then shows below `sm:` beside
|
|
196
|
-
`ui_mobile_action`'s plus icon
|
|
197
|
-
|
|
209
|
+
`ui_mobile_action`'s plus icon or `ui_bottom_action`'s button unless
|
|
210
|
+
`action_at_bottom: true` hides it there, so ask the developer whether a
|
|
211
|
+
screen with both keeps both. Below `sm:` the actions and menu sit side by side
|
|
198
212
|
on their own full-width row under the title and badges, and from `sm:` up
|
|
199
213
|
they sit side by side on the right, with or without a menu. At every
|
|
200
214
|
width buttons that do not fit wrap onto another line, so the header never
|
|
@@ -311,14 +325,17 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
311
325
|
with its `action_label:`, and draws nothing when the screen gives none. It
|
|
312
326
|
is hidden from `sm:` up, where the page header shows the action, and inside
|
|
313
327
|
a Hotwire Native web view, so give native users another way to reach the
|
|
314
|
-
action, such as `ui_mobile_actions`.
|
|
315
|
-
`hotwire-native` class on `<html>` and declare
|
|
328
|
+
action, such as `ui_mobile_actions`. It never asks `action_confirm:`. The
|
|
329
|
+
layout must also write the `hotwire-native` class on `<html>` and declare
|
|
330
|
+
that Tailwind variant.
|
|
316
331
|
- `ui_bottom_action` takes no keywords and no block. It draws the
|
|
317
332
|
`action_url:` a screen gives `ui_page_header` as a full-width `ui_button`
|
|
318
333
|
labelled with its `action_label:`, in a bar fixed to the bottom of the
|
|
319
334
|
screen, above `ui_bottom_nav` on a page that has one. With
|
|
320
335
|
`action_method:` the button sends that method as `ui_button` does, so it
|
|
321
|
-
cannot sit inside a form.
|
|
336
|
+
cannot sit inside a form. With `action_confirm:` the button asks that
|
|
337
|
+
question before it goes ahead. Give those screens' page headers
|
|
338
|
+
`action_at_bottom: true`. It draws nothing when the screen gives no
|
|
322
339
|
`action_url:`, so call it after `ui_page_header` has run, such as in the
|
|
323
340
|
layout after `yield`. It is hidden from `sm:` up, inside a Hotwire Native
|
|
324
341
|
web view and in print, like `ui_mobile_action`. It also draws an invisible
|
|
@@ -578,7 +595,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
578
595
|
|
|
579
596
|
9. Show content and status.
|
|
580
597
|
|
|
581
|
-
- `ui_button(label:, href: nil, method: :get, variant: :primary, size: :md, full_width: false, type: :submit, data: nil, name: nil, value: nil, hidden: false)`
|
|
598
|
+
- `ui_button(label:, href: nil, method: :get, variant: :primary, size: :md, full_width: false, type: :submit, data: nil, name: nil, value: nil, hidden: false, confirm: nil)`
|
|
582
599
|
renders a link with `href:` and a button without it. `variant:` is
|
|
583
600
|
`:primary` `:secondary` `:danger` `:text`, `size:` is `:sm` `:md` `:lg`,
|
|
584
601
|
and `type:`, `name:` and `value:` apply only to the button.
|
|
@@ -596,6 +613,12 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
596
613
|
- `full_width: true` makes the button as wide as its row at every screen
|
|
597
614
|
width, and for a button sending a request its form too. Use it for large
|
|
598
615
|
choices stacked down a phone screen.
|
|
616
|
+
- `confirm:` is a question Turbo asks before the button goes ahead. On a
|
|
617
|
+
button sending a request it is set on the button's own form, and on a
|
|
618
|
+
link or a plain button it is set on the element, merged into `data:`.
|
|
619
|
+
With no `confirm:` nothing is asked, whatever the method, unlike
|
|
620
|
+
`ui_action_menu_item`. Ask the developer which buttons need a question
|
|
621
|
+
and how it is worded.
|
|
599
622
|
- `ui_picture(src:, alt:, full_size_url: nil)` shows an image centred and
|
|
600
623
|
never taller than half the visible screen, so what follows it stays in
|
|
601
624
|
view. `alt:` is the text read out in place of the image. With
|
|
@@ -730,14 +753,28 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
730
753
|
- `ui_bucket_series(buckets:)` takes an array of hashes with the keywords
|
|
731
754
|
of `ui_bucket`, such as `[{ goal: 10, actual: 7, label: "Mon" }, ...]`.
|
|
732
755
|
- `ui_timeline(entries:)` takes no block. `entries:` is
|
|
733
|
-
`[{ label:, started_at:, ended_at: }, ...]
|
|
734
|
-
with
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
and
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
756
|
+
`[{ label:, started_at:, ended_at:, queued_at: nil, failed: false }, ...]`,
|
|
757
|
+
with every time a `Time` value.
|
|
758
|
+
- It draws one row per label, in the order each label first appears.
|
|
759
|
+
Entries that share a label, such as the tries of one step, share that
|
|
760
|
+
row and each draws its own bar, so pass a step's tries one after another
|
|
761
|
+
in the order they ran.
|
|
762
|
+
- Every bar is placed by its entry's `started_at` and `ended_at` on one
|
|
763
|
+
axis shared by all rows. The axis runs from the earliest `queued_at` or
|
|
764
|
+
`started_at` of any entry to the latest `ended_at`.
|
|
765
|
+
- An entry given `queued_at:` also draws the time from `queued_at` to
|
|
766
|
+
`started_at` before its bar, in the queued colour. Leave it out when the
|
|
767
|
+
wait is not known.
|
|
768
|
+
- An entry given `failed: true` draws its bar in the danger colour, and
|
|
769
|
+
screen readers read it as "Failed". Ask the developer which tries count
|
|
770
|
+
as failed and whether the queued time is shown.
|
|
771
|
+
- Each row shows its label and its duration on one line, then its track.
|
|
772
|
+
The row's duration runs from its first entry's `started_at` to its last
|
|
773
|
+
entry's `ended_at`, so queued time before the first try is not counted.
|
|
774
|
+
- Under the rows the axis reads `0s` on the left and the whole span on the
|
|
775
|
+
right. Durations are written as `1h 0m 5s`, leaving out leading zero
|
|
776
|
+
units, and a zero duration is `0s`.
|
|
777
|
+
- It needs at least one entry and a span longer than zero, so do not render
|
|
741
778
|
it for an empty list or for entries that all start and end at one moment.
|
|
742
779
|
- `ui_pipeline(title:, boxes:, links:, subtitle: nil)` — `boxes:` is
|
|
743
780
|
`[{ label:, count:, accent:, action: }, ...]`, with `accent:` one of
|
|
@@ -806,7 +843,8 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
806
843
|
figure in plain colour, a joined funnel with no band, a locked column the
|
|
807
844
|
others show through, a Columns menu with no greyed name for a hidden
|
|
808
845
|
column, a table row whose caret does not open its detail, a text diff whose
|
|
809
|
-
removed and added rows look like its shared rows,
|
|
846
|
+
removed and added rows look like its shared rows, a timeline whose failed
|
|
847
|
+
tries or queued time look like its other bars, or a status dot
|
|
810
848
|
that draws nothing — the app's Stimulus controllers or keystone_ui-styles version are
|
|
811
849
|
out of date. Stop and hand that part to `keystone_ui-install`, and add no
|
|
812
850
|
classes to fix it.
|
|
@@ -60,10 +60,18 @@ One decision: is keystone_ui set up in the app?
|
|
|
60
60
|
symbol they do not know, so a wrong guess fails at render time.
|
|
61
61
|
- **Numbers and text are different inputs.** Progress bars, funnels, buckets
|
|
62
62
|
and timelines do arithmetic, so they take numbers, and a bucket raises on
|
|
63
|
-
`"9,000"`. A timeline takes each
|
|
64
|
-
|
|
63
|
+
`"9,000"`. A timeline takes each entry's times and works out every duration,
|
|
64
|
+
bar position and its axis from them. A
|
|
65
65
|
breakdown, a calculation and a toned figure take already-formatted text, show
|
|
66
66
|
it as written and add nothing up.
|
|
67
|
+
- **Timelines.** A timeline entry is one try at a step: a label, a start time,
|
|
68
|
+
an end time, and optionally the time it was queued and whether it failed.
|
|
69
|
+
Entries sharing a label are drawn as several bars on one row, in the order
|
|
70
|
+
given, and the row's duration runs from its first try's start to its last
|
|
71
|
+
try's end. Queued time is drawn as its own segment before the bar, and a
|
|
72
|
+
failed try is marked failed both in colour and for screen readers. The axis
|
|
73
|
+
runs from the earliest queued or start time of any entry to the latest end
|
|
74
|
+
time.
|
|
67
75
|
- **Going back.** A form or show page shell needs a way back: a back link, a
|
|
68
76
|
trail of earlier pages shown as breadcrumbs, or a trail the app supplies for
|
|
69
77
|
the request. A nav tab's own page passes an empty trail and shows no back
|
|
@@ -94,14 +102,21 @@ One decision: is keystone_ui set up in the app?
|
|
|
94
102
|
submits an empty id and shows the new record's fields the page placed inside
|
|
95
103
|
the dropdown, and picking a match afterwards hides them again. The arrow keys
|
|
96
104
|
move through the list, Enter picks, and Escape closes it.
|
|
105
|
+
- **Confirmation.** A button can carry a confirmation question, and the
|
|
106
|
+
browser asks it before following the link or sending the form. Nothing is
|
|
107
|
+
sent when the user cancels.
|
|
97
108
|
- **A page's main action on a phone.** A page header can name one main action:
|
|
98
|
-
a label, an address
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
a label, an address, an optional HTTP method and an optional confirmation
|
|
110
|
+
question. The header shows it as a button and also publishes it to the
|
|
111
|
+
layout. Below `sm:` the layout can show it again as a plus icon in the top
|
|
112
|
+
bar, or as a full-width button in a bar fixed to the bottom of the screen,
|
|
113
|
+
above the bottom tab bar when the page has one. The bottom bar asks the
|
|
114
|
+
header's confirmation question before sending, and the plus icon does not.
|
|
115
|
+
The page leaves room under its last content so the bar does not cover it.
|
|
116
|
+
A header can mark its action as belonging at the bottom, and then hides its
|
|
117
|
+
own button below `sm:` so the action is not shown twice. Both forms show
|
|
118
|
+
nothing when the header names no action, and both are hidden inside a
|
|
119
|
+
Hotwire Native web view and in print.
|
|
105
120
|
- **Action menus.** Each action is a label, an address and an HTTP method. A
|
|
106
121
|
plain visit is a link, and any other method is a button, so an action that
|
|
107
122
|
changes data is never a bare link. A delete asks for confirmation by default.
|