keystone_ui 0.88.0 → 0.90.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/button_component.rb +3 -1
- data/app/components/keystone/ui/button_row_component.html.erb +1 -0
- data/app/components/keystone/ui/button_row_component.rb +18 -0
- data/app/components/keystone/ui/section_component.html.erb +4 -1
- data/app/components/keystone/ui/section_component.rb +8 -0
- data/app/helpers/keystone_ui_helper.rb +4 -0
- data/lib/keystone_ui/safelist.rb +1 -0
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +33 -4
- data/the_local/agents/keystone_ui-info.md +23 -3
- data/the_local/interface.yml +3 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1c3f95cdbbb27481fe12911fa11395742ee4bfb0fb3cbb77fec7832985093b68
|
|
4
|
+
data.tar.gz: 8cf15938ac60e90882941dacb48f1e0a5c35900e33af1cb40835d049ad9d3796
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab5aca82b8f0ba3c3307195344a85a3acef2d618d2840c81d95bea64e5e4d26bc050692b64e511ffd86f64936c952cf6e78ee73de2d05adc50a780569442dad5
|
|
7
|
+
data.tar.gz: c8038723aa399bc9b3785f95b32fa75a6b7185afced5b3410dfbad6b04a5e121c05dab814c93ac8deffbdc09c33791ad235e3c612c49a39c8bb3e5784848e914
|
|
@@ -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, confirm: nil)
|
|
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, disabled: false)
|
|
24
24
|
@label = label
|
|
25
25
|
@href = href
|
|
26
26
|
@method = method.to_sym
|
|
@@ -33,6 +33,7 @@ module Keystone
|
|
|
33
33
|
@value = value
|
|
34
34
|
@hidden = hidden
|
|
35
35
|
@confirm = confirm
|
|
36
|
+
@disabled = disabled
|
|
36
37
|
end
|
|
37
38
|
|
|
38
39
|
def classes
|
|
@@ -62,6 +63,7 @@ module Keystone
|
|
|
62
63
|
options[:data] = @data if @data
|
|
63
64
|
options[:data] = (@data || {}).merge(turbo_confirm: @confirm) if @confirm
|
|
64
65
|
options[:hidden] = true if @hidden
|
|
66
|
+
options[:disabled] = true if @disabled
|
|
65
67
|
options
|
|
66
68
|
end
|
|
67
69
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="<%= row_classes %>"><%= content %></div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Keystone
|
|
4
|
+
module Ui
|
|
5
|
+
class ButtonRowComponent < ViewComponent::Base
|
|
6
|
+
ROW_CLASSES = "flex flex-wrap ks-grid-gap-sm max-sm:*:min-h-11 [&>form]:flex [&>form>*]:flex-1"
|
|
7
|
+
EQUAL_WIDTH_CLASSES = "*:flex-1 *:whitespace-nowrap"
|
|
8
|
+
|
|
9
|
+
def initialize(equal_width: false)
|
|
10
|
+
@equal_width = equal_width
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def row_classes
|
|
14
|
+
[ ROW_CLASSES, (EQUAL_WIDTH_CLASSES if @equal_width) ].compact.join(" ")
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -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
|
|
@@ -69,6 +69,10 @@ module KeystoneUiHelper
|
|
|
69
69
|
render Keystone::Ui::ButtonComponent.new(**args)
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
+
def ui_button_row(**args, &block)
|
|
73
|
+
render Keystone::Ui::ButtonRowComponent.new(**args), &block
|
|
74
|
+
end
|
|
75
|
+
|
|
72
76
|
def ui_data_table(**args, &block)
|
|
73
77
|
render Keystone::Ui::DataTableComponent.new(**args), &block
|
|
74
78
|
end
|
data/lib/keystone_ui/safelist.rb
CHANGED
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, 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.
|
|
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.
|
|
@@ -66,6 +66,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
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
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
|
+
- `ui_button_row` — a row of buttons that wraps onto further lines, optionally giving each button an equal share of its width.
|
|
69
70
|
- `ui_badge` — a coloured pill holding a short label.
|
|
70
71
|
- `ui_status_dot` — a small dot coloured by state, with its label read only by screen readers.
|
|
71
72
|
- `ui_figure` — one amount as inline text, coloured as a gain or a loss.
|
|
@@ -230,7 +231,20 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
230
231
|
keywords of `ui_action_menu_item`, and renders an action menu. The link
|
|
231
232
|
and the menu sit side by side at the right edge of the header, the link
|
|
232
233
|
first, at every width. `spacing:` is `:sm` `:md` `:lg`. The header, with its
|
|
233
|
-
`action:` and
|
|
234
|
+
`action:`, `menu:` and aside, renders only when `title:` is given.
|
|
235
|
+
- The block yields the section, and `section.with_aside { ... }` in it puts
|
|
236
|
+
short text or a `ui_badge`, such as a sort order or a step's state, in
|
|
237
|
+
small muted text at the right end of the title line, before the link and
|
|
238
|
+
the menu. Below `sm:` the aside moves to its own line under the title and
|
|
239
|
+
the actions. Use it in place of hand-written markup beside a section's
|
|
240
|
+
title, and ask the developer what the aside shows.
|
|
241
|
+
|
|
242
|
+
```erb
|
|
243
|
+
<%= ui_section(title: "Inbox") do |section| %>
|
|
244
|
+
<% section.with_aside { "sorted by expiry" } %>
|
|
245
|
+
...
|
|
246
|
+
<% end %>
|
|
247
|
+
```
|
|
234
248
|
- `ui_grid(cols: { default: 1 }, gap: :md, gap_x: nil, gap_y: nil)` —
|
|
235
249
|
`cols:` maps `:default` `:sm` `:md` `:lg` to a count from 1 to 12, such as
|
|
236
250
|
`{ default: 1, md: 3 }`. `gap:` is `:sm` `:md` `:lg` `:xl`, and passing
|
|
@@ -595,7 +609,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
595
609
|
|
|
596
610
|
9. Show content and status.
|
|
597
611
|
|
|
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)`
|
|
612
|
+
- `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, disabled: false)`
|
|
599
613
|
renders a link with `href:` and a button without it. `variant:` is
|
|
600
614
|
`:primary` `:secondary` `:danger` `:text`, `size:` is `:sm` `:md` `:lg`,
|
|
601
615
|
and `type:`, `name:` and `value:` apply only to the button.
|
|
@@ -603,6 +617,21 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
603
617
|
as a Back or Previous control under a form. A button given `name:` and
|
|
604
618
|
`value:` submits them with its form when pressed. `hidden: true` draws it
|
|
605
619
|
with the `hidden` attribute, for the app's own script to show.
|
|
620
|
+
- `disabled: true` draws a button without `href:` with the `disabled`
|
|
621
|
+
attribute, so it cannot be pressed and does not submit its form. It is
|
|
622
|
+
for a button without `href:`: a link ignores the attribute and stays
|
|
623
|
+
followable, and a button sending a request does not take it, so to stop
|
|
624
|
+
either one, do not render it.
|
|
625
|
+
- `ui_button_row(equal_width: false) { ... }` draws whatever its block
|
|
626
|
+
renders, usually `ui_button` calls, in one row with a small gap between
|
|
627
|
+
them, wrapping onto a further line when they do not fit. Below `sm` each
|
|
628
|
+
item in the row is at least 44 pixels tall, so a button is tall enough to
|
|
629
|
+
tap on a phone. A `ui_button` sending a request, whose own small form is
|
|
630
|
+
what sits in the row, fills that form, so it takes the same share and
|
|
631
|
+
height as a link or plain button beside it. `equal_width: true` gives each
|
|
632
|
+
item an equal share of the row's width and keeps each label on one line,
|
|
633
|
+
so the row wraps only when a label no longer fits in its share. Use it in
|
|
634
|
+
place of a hand-written flex `div` around a set of buttons.
|
|
606
635
|
- `ui_link(label:, href:)` draws a text link in the link colour. Use it in
|
|
607
636
|
place of a hand-written `link_to` with colour classes.
|
|
608
637
|
- With `href:` and `method:` `:post` `:patch` `:put` or `:delete`, it
|
|
@@ -12,7 +12,7 @@ nothing and gives no steps.
|
|
|
12
12
|
|
|
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
|
-
sections, panels, grids, forms and fields, search dropdowns, data tables, navigation, cards,
|
|
15
|
+
sections, panels, grids, forms and fields, buttons and rows of buttons, search dropdowns, data tables, navigation, cards,
|
|
16
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
|
|
@@ -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.
|
|
@@ -104,13 +104,23 @@ One decision: is keystone_ui set up in the app?
|
|
|
104
104
|
lay its pairs in columns instead: one column on a phone and two from `sm:` up,
|
|
105
105
|
each label in small text directly above its value, a long value wrapping
|
|
106
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.
|
|
107
113
|
- **Going back.** A form or show page shell needs a way back: a back link, a
|
|
108
114
|
trail of earlier pages shown as breadcrumbs, or a trail the app supplies for
|
|
109
115
|
the request. A nav tab's own page passes an empty trail and shows no back
|
|
110
116
|
link. A page with none of these raises `KeystoneUi::MissingBackLink`, and a
|
|
111
117
|
trail link missing a label or an address raises `KeystoneUi::IncompleteTrail`.
|
|
112
118
|
- **Navigation.** The app declares navigation groups, each a label and its tabs,
|
|
113
|
-
and each tab a key, label, address and permission check.
|
|
119
|
+
and each tab a key, label, address and permission check. A tab can also be
|
|
120
|
+
declared on its own, outside any group, and is then drawn as a single link
|
|
121
|
+
with no menu or group label. A tab can carry a count, and a count above zero
|
|
122
|
+
is shown as a badge after its label, as a bottom tab bar item's count is
|
|
123
|
+
shown over its icon. Tabs the user may
|
|
114
124
|
not see are left out, and a group left with no tabs is left out. A saved
|
|
115
125
|
preference can place the navigation as a top bar or a left or right sidebar
|
|
116
126
|
and set the order of groups and tabs. A supplier names the current tab, which
|
|
@@ -134,6 +144,16 @@ One decision: is keystone_ui set up in the app?
|
|
|
134
144
|
submits an empty id and shows the new record's fields the page placed inside
|
|
135
145
|
the dropdown, and picking a match afterwards hides them again. The arrow keys
|
|
136
146
|
move through the list, Enter picks, and Escape closes it.
|
|
147
|
+
- **Buttons.** A button with an address is a link, or a small form when its
|
|
148
|
+
HTTP method is anything other than a plain visit. A button with no address
|
|
149
|
+
is a form button, which can carry a name and value, start hidden, or be
|
|
150
|
+
disabled so it cannot be pressed.
|
|
151
|
+
- **Button rows.** A button row lays out buttons side by side and wraps them
|
|
152
|
+
onto further lines when they run out of room. Below `sm:` each button in it
|
|
153
|
+
is at least a phone's tap height, and a button that sends a request fills its
|
|
154
|
+
share of the row like a link does. A row can give each button an equal share
|
|
155
|
+
of its width, keeping each label on one line, so the row wraps only when a
|
|
156
|
+
label no longer fits.
|
|
137
157
|
- **Confirmation.** A button can carry a confirmation question, and the
|
|
138
158
|
browser asks it before following the link or sending the form. Nothing is
|
|
139
159
|
sent when the user cancels.
|
data/the_local/interface.yml
CHANGED
|
@@ -22,6 +22,7 @@ develop:
|
|
|
22
22
|
- ui_copy_button
|
|
23
23
|
- ui_card
|
|
24
24
|
- ui_button
|
|
25
|
+
- ui_button_row
|
|
25
26
|
- ui_data_table
|
|
26
27
|
- ui_page
|
|
27
28
|
- ui_section
|
|
@@ -109,6 +110,8 @@ sources:
|
|
|
109
110
|
- app/components/keystone/ui/bottom_nav_component.rb
|
|
110
111
|
- app/components/keystone/ui/bottom_nav_item_component.rb
|
|
111
112
|
- app/components/keystone/ui/button_component.rb
|
|
113
|
+
- app/components/keystone/ui/button_row_component.rb
|
|
114
|
+
- app/components/keystone/ui/button_row_component.html.erb
|
|
112
115
|
- app/components/keystone/ui/card_component.rb
|
|
113
116
|
- app/components/keystone/ui/card_link_component.rb
|
|
114
117
|
- app/components/keystone/ui/chart_card_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.90.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tyler Schneider
|
|
@@ -101,6 +101,8 @@ files:
|
|
|
101
101
|
- app/components/keystone/ui/bucket_series_component.html.erb
|
|
102
102
|
- app/components/keystone/ui/bucket_series_component.rb
|
|
103
103
|
- app/components/keystone/ui/button_component.rb
|
|
104
|
+
- app/components/keystone/ui/button_row_component.html.erb
|
|
105
|
+
- app/components/keystone/ui/button_row_component.rb
|
|
104
106
|
- app/components/keystone/ui/calculation_component.html.erb
|
|
105
107
|
- app/components/keystone/ui/calculation_component.rb
|
|
106
108
|
- app/components/keystone/ui/caption_component.html.erb
|