keystone_ui 0.89.0 → 0.91.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/timeline_component.rb +2 -1
- 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 +18 -2
- data/the_local/agents/keystone_ui-info.md +17 -3
- data/the_local/interface.yml +3 -0
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f09a621fcad17f9df319563b9bd9930a6782fdf8ba9721258ed464d69a749b29
|
|
4
|
+
data.tar.gz: 040667ef0b3556f75dcd9cbfabdb9f1048f641317a95e23402b0e0c900689811
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c54c88339b33025ed7b127c010bb02ca62fd4812ddee1b6ade127ea6db371cfa92823dc23dbae00ad91af170faae43b9c53256a85cbfa339a1e69f66790eaf18
|
|
7
|
+
data.tar.gz: 6f24aff529bc396da614cbc3218de08b9be47cb8f7a2ad1411d2ef27521cfe414e5149ce20317562b21f6ee6065f0480e7bf2cd7decea41efde3251729bd7d73
|
|
@@ -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
|
|
@@ -8,6 +8,7 @@ module Keystone
|
|
|
8
8
|
FAILED_CLASSES = "ks-timeline-failed"
|
|
9
9
|
WAITING_CLASSES = "ks-tone-warning"
|
|
10
10
|
QUEUED_CLASSES = "ks-timeline-queued absolute inset-y-0"
|
|
11
|
+
WAITING_BAR_CLASSES = "ks-timeline-waiting absolute inset-y-0"
|
|
11
12
|
SCREEN_READER_CLASSES = "sr-only"
|
|
12
13
|
SELECTED_ROW_CLASSES = "ks-table-row-current"
|
|
13
14
|
TIMELINE_CLASSES = "flex flex-col ks-grid-gap-sm"
|
|
@@ -78,7 +79,7 @@ module Keystone
|
|
|
78
79
|
end
|
|
79
80
|
|
|
80
81
|
def bar_classes(entry)
|
|
81
|
-
return
|
|
82
|
+
return WAITING_BAR_CLASSES if entry[:waiting]
|
|
82
83
|
|
|
83
84
|
[ BAR_CLASSES, (FAILED_CLASSES if entry[:failed]) ].compact.join(" ")
|
|
84
85
|
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
|
@@ -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.
|
|
@@ -608,7 +609,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
608
609
|
|
|
609
610
|
9. Show content and status.
|
|
610
611
|
|
|
611
|
-
- `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)`
|
|
612
613
|
renders a link with `href:` and a button without it. `variant:` is
|
|
613
614
|
`:primary` `:secondary` `:danger` `:text`, `size:` is `:sm` `:md` `:lg`,
|
|
614
615
|
and `type:`, `name:` and `value:` apply only to the button.
|
|
@@ -616,6 +617,21 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
616
617
|
as a Back or Previous control under a form. A button given `name:` and
|
|
617
618
|
`value:` submits them with its form when pressed. `hidden: true` draws it
|
|
618
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.
|
|
619
635
|
- `ui_link(label:, href:)` draws a text link in the link colour. Use it in
|
|
620
636
|
place of a hand-written `link_to` with colour classes.
|
|
621
637
|
- With `href:` and `method:` `:post` `:patch` `:put` or `:delete`, it
|
|
@@ -817,7 +833,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
817
833
|
- An entry given `waiting: true` is a try paused before it can go on, such
|
|
818
834
|
as a step waiting for approval. Its bar runs from its `started_at` to the
|
|
819
835
|
end of the axis, which on a one-line timeline is its last mark, in the
|
|
820
|
-
|
|
836
|
+
waiting colour, in place of the danger colour even
|
|
821
837
|
when it is also `failed: true`. Its row writes `waiting` in the warning
|
|
822
838
|
tone in place of the duration, and shows no "Running" dot. A row holding
|
|
823
839
|
any waiting entry is a waiting row.
|
|
@@ -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
|
|
@@ -76,7 +76,7 @@ One decision: is keystone_ui set up in the app?
|
|
|
76
76
|
segment before the bar, and a failed try is marked failed both in colour and
|
|
77
77
|
for screen readers. An entry can be marked waiting, for a try that has not
|
|
78
78
|
started running: its bar runs from its start to the end of the axis in the
|
|
79
|
-
|
|
79
|
+
waiting colour, and its row shows the word `waiting` in the warning tone in
|
|
80
80
|
place of a duration, with no running dot. The axis
|
|
81
81
|
runs from the earliest queued or start time of any entry to the latest end
|
|
82
82
|
or start time. An entry with no end time is still running: its bar runs to
|
|
@@ -116,7 +116,11 @@ One decision: is keystone_ui set up in the app?
|
|
|
116
116
|
link. A page with none of these raises `KeystoneUi::MissingBackLink`, and a
|
|
117
117
|
trail link missing a label or an address raises `KeystoneUi::IncompleteTrail`.
|
|
118
118
|
- **Navigation.** The app declares navigation groups, each a label and its tabs,
|
|
119
|
-
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
|
|
120
124
|
not see are left out, and a group left with no tabs is left out. A saved
|
|
121
125
|
preference can place the navigation as a top bar or a left or right sidebar
|
|
122
126
|
and set the order of groups and tabs. A supplier names the current tab, which
|
|
@@ -140,6 +144,16 @@ One decision: is keystone_ui set up in the app?
|
|
|
140
144
|
submits an empty id and shows the new record's fields the page placed inside
|
|
141
145
|
the dropdown, and picking a match afterwards hides them again. The arrow keys
|
|
142
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.
|
|
143
157
|
- **Confirmation.** A button can carry a confirmation question, and the
|
|
144
158
|
browser asks it before following the link or sending the form. Nothing is
|
|
145
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.91.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.35.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.35.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: view_component
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -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
|