keystone_ui 0.87.0 → 0.89.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/section_component.html.erb +4 -1
- data/app/components/keystone/ui/section_component.rb +8 -0
- data/app/components/keystone/ui/value_list_component.html.erb +1 -1
- data/app/components/keystone/ui/value_list_component.rb +11 -3
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +30 -8
- data/the_local/agents/keystone_ui-info.md +15 -2
- 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: e0c8795d4dabe0c85c98474df7f1942dbdc24c762a48ec356765f867f59d2916
|
|
4
|
+
data.tar.gz: cfb958e216df85fe5f4f504573958b3ac328860187343efdb92010036edc2527
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 784b3d19b8ea3a6326c5f998edf4806669eddbc824e04fe85d865207ddaffc66a8d60b4e0aae32755173b9b8d2437311544e0a28931cacf7eba1742ce837a279
|
|
7
|
+
data.tar.gz: 2dd897dfc7f62339c3f1746e83250055d9b4b0e44a7ddaf4135aee1ee08b382d2ba35f2df4aee8ed371690de768321f78bf175afba67482abe60c5ad0ff9c08c
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
<div class="<%= classes %>">
|
|
2
2
|
<% if header? %>
|
|
3
|
-
<div class="<%=
|
|
3
|
+
<div class="<%= header_classes %>">
|
|
4
4
|
<div>
|
|
5
5
|
<h2 class="<%= TITLE_CLASSES %>"><%= @title %></h2>
|
|
6
6
|
<% if @subtitle %>
|
|
7
7
|
<p class="<%= SUBTITLE_CLASSES %>"><%= @subtitle %></p>
|
|
8
8
|
<% end %>
|
|
9
9
|
</div>
|
|
10
|
+
<% if aside? %>
|
|
11
|
+
<div class="<%= ASIDE_CLASSES %>"><%= aside %></div>
|
|
12
|
+
<% end %>
|
|
10
13
|
<% if @action || @menu.any? %>
|
|
11
14
|
<div class="<%= ACTIONS_CLASSES %>">
|
|
12
15
|
<% if @action %>
|
|
@@ -5,10 +5,14 @@ module Keystone
|
|
|
5
5
|
class SectionComponent < ViewComponent::Base
|
|
6
6
|
SPACING_CLASSES = { sm: "ks-section-sm", md: "ks-section-md", lg: "ks-section-lg" }.freeze
|
|
7
7
|
HEADER_CLASSES = "ks-section-header"
|
|
8
|
+
HEADER_WITH_ASIDE_CLASSES = "ks-section-header ks-grid-gap-sm max-sm:flex-wrap"
|
|
8
9
|
TITLE_CLASSES = "ks-section-title"
|
|
9
10
|
SUBTITLE_CLASSES = "ks-section-subtitle"
|
|
10
11
|
ACTION_CLASSES = "ks-section-action"
|
|
11
12
|
ACTIONS_CLASSES = "flex items-center shrink-0 ks-grid-gap-sm"
|
|
13
|
+
ASIDE_CLASSES = "ks-heading-note ml-auto max-sm:basis-full max-sm:order-last"
|
|
14
|
+
|
|
15
|
+
renders_one :aside
|
|
12
16
|
|
|
13
17
|
def initialize(title: nil, subtitle: nil, action: nil, menu: [], spacing: :md, class: nil)
|
|
14
18
|
@title = title
|
|
@@ -31,6 +35,10 @@ module Keystone
|
|
|
31
35
|
ACTION_CLASSES
|
|
32
36
|
end
|
|
33
37
|
|
|
38
|
+
def header_classes
|
|
39
|
+
aside? ? HEADER_WITH_ASIDE_CLASSES : HEADER_CLASSES
|
|
40
|
+
end
|
|
41
|
+
|
|
34
42
|
def header?
|
|
35
43
|
!@title.nil?
|
|
36
44
|
end
|
|
@@ -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="
|
|
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
|
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, 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 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, 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
|
---
|
|
@@ -29,7 +29,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
29
29
|
- `ui_show_page` — marks a screen as a detail screen and gives it its Back link and breadcrumbs.
|
|
30
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
|
-
- `ui_section` — a titled block of content with an optional link
|
|
32
|
+
- `ui_section` — a titled block of content with an optional link, action menu and short aside such as a badge in its header.
|
|
33
33
|
- `ui_grid` — a responsive grid with a column count per breakpoint.
|
|
34
34
|
- `ui_list_detail` — a list beside the detail of the item picked from it, with the detail above the list below `lg:`.
|
|
35
35
|
- `ui_panel` — a bordered card surface holding any content.
|
|
@@ -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
|
|
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.
|
|
@@ -230,7 +230,20 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
230
230
|
keywords of `ui_action_menu_item`, and renders an action menu. The link
|
|
231
231
|
and the menu sit side by side at the right edge of the header, the link
|
|
232
232
|
first, at every width. `spacing:` is `:sm` `:md` `:lg`. The header, with its
|
|
233
|
-
`action:` and
|
|
233
|
+
`action:`, `menu:` and aside, renders only when `title:` is given.
|
|
234
|
+
- The block yields the section, and `section.with_aside { ... }` in it puts
|
|
235
|
+
short text or a `ui_badge`, such as a sort order or a step's state, in
|
|
236
|
+
small muted text at the right end of the title line, before the link and
|
|
237
|
+
the menu. Below `sm:` the aside moves to its own line under the title and
|
|
238
|
+
the actions. Use it in place of hand-written markup beside a section's
|
|
239
|
+
title, and ask the developer what the aside shows.
|
|
240
|
+
|
|
241
|
+
```erb
|
|
242
|
+
<%= ui_section(title: "Inbox") do |section| %>
|
|
243
|
+
<% section.with_aside { "sorted by expiry" } %>
|
|
244
|
+
...
|
|
245
|
+
<% end %>
|
|
246
|
+
```
|
|
234
247
|
- `ui_grid(cols: { default: 1 }, gap: :md, gap_x: nil, gap_y: nil)` —
|
|
235
248
|
`cols:` maps `:default` `:sm` `:md` `:lg` to a count from 1 to 12, such as
|
|
236
249
|
`{ default: 1, md: 3 }`. `gap:` is `:sm` `:md` `:lg` `:xl`, and passing
|
|
@@ -689,10 +702,19 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
689
702
|
- `ui_facts(facts:)` — each fact is `{ value:, label: }`, drawn as a small
|
|
690
703
|
box with the count in bold beside its label, in a row that wraps.
|
|
691
704
|
- `ui_paragraph(text:)` shows running text.
|
|
692
|
-
- `ui_value_list(rows:, align: :start)` — each row is
|
|
693
|
-
with optional `note:`, `total: true`, `right: true`
|
|
694
|
-
when the value is `nil` or empty. `right: true`
|
|
695
|
-
after the value, read out as "Right", for an
|
|
705
|
+
- `ui_value_list(rows:, align: :start, columns: false)` — each row is
|
|
706
|
+
`{ label:, value: }` with optional `note:`, `total: true`, `right: true`
|
|
707
|
+
and `fallback:`, shown when the value is `nil` or empty. `right: true`
|
|
708
|
+
draws a green check mark after the value, read out as "Right", for an
|
|
709
|
+
answer that was right. `align: :end` pushes values to the right, as in a
|
|
710
|
+
ledger.
|
|
711
|
+
- With the default `columns: false`, each pair is one row with its label
|
|
712
|
+
beside its value and a line between rows. `columns: true` draws each pair
|
|
713
|
+
as its label in small text directly above its value, with no line between
|
|
714
|
+
pairs, one pair per line below `sm:` and two side by side from `sm:` up. A
|
|
715
|
+
long value wraps inside its own column. Use it for a record's details,
|
|
716
|
+
such as its contact and address fields, and ask the developer which
|
|
717
|
+
layout a screen uses.
|
|
696
718
|
|
|
697
719
|
10. Explain figures.
|
|
698
720
|
|
|
@@ -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,
|
|
@@ -55,7 +55,7 @@ One decision: is keystone_ui set up in the app?
|
|
|
55
55
|
- **Containers take blocks, leaves take keywords.** Page shells, sections,
|
|
56
56
|
panels, grids, forms and tables wrap a block. A button, badge, field, stat or
|
|
57
57
|
bucket is set entirely by keyword arguments. The navigation bar takes named
|
|
58
|
-
slots.
|
|
58
|
+
slots, and a section takes one named slot for its aside.
|
|
59
59
|
- **Options are symbols.** Appearance is chosen by name, such as `variant:`,
|
|
60
60
|
`size:` or `padding:`, and each component accepts its own set. Most raise on a
|
|
61
61
|
symbol they do not know, so a wrong guess fails at render time.
|
|
@@ -97,6 +97,19 @@ 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.
|
|
107
|
+
- **Section headers.** A section's header holds its title and optional
|
|
108
|
+
subtitle, then an optional action link and action menu. A section can also
|
|
109
|
+
carry an aside, a short piece of text or a badge drawn in the header's note
|
|
110
|
+
style at the right end of the title line, before the action and the menu.
|
|
111
|
+
Below `sm:` the aside takes a line of its own under the title and the
|
|
112
|
+
actions. A section with no title draws no header, so its aside is not shown.
|
|
100
113
|
- **Going back.** A form or show page shell needs a way back: a back link, a
|
|
101
114
|
trail of earlier pages shown as breadcrumbs, or a trail the app supplies for
|
|
102
115
|
the request. A nav tab's own page passes an empty trail and shows no back
|