keystone_ui 0.101.0 → 0.103.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/chip_row_component.html.erb +5 -0
- data/app/components/keystone/ui/chip_row_component.rb +25 -0
- data/app/components/keystone/ui/data_table_component.html.erb +1 -1
- data/app/components/keystone/ui/data_table_component.rb +27 -7
- data/app/components/keystone/ui/decision_bar_component.rb +6 -1
- data/app/components/keystone/ui/figure_component.rb +3 -1
- data/app/components/keystone/ui/link_component.rb +4 -2
- data/app/components/keystone/ui/link_list_component.html.erb +5 -1
- data/app/components/keystone/ui/link_list_component.rb +6 -0
- data/app/components/keystone/ui/stat_card_component.rb +5 -1
- data/app/components/keystone/ui/timeline_component.rb +8 -3
- data/app/components/keystone/ui/value_list_component.html.erb +1 -1
- data/app/components/keystone/ui/value_list_component.rb +11 -2
- 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 +43 -17
- data/the_local/agents/keystone_ui-info.md +10 -0
- data/the_local/interface.yml +1 -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: 6f3c5cfaa2455159d01c665ea49bf74c7a306560666d079e84b03b60c467283b
|
|
4
|
+
data.tar.gz: 3bd502112a0900908c23fd8405ee269ea9a8feec3d9aae04fd088ab1b2624254
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c58aaf7c6818cbe4039798c65684af15609d2eb787edfce9c73784cff371452025237cd5e92e9576db8827520054b0d98947d184b9d8e7813654bef8ef6b2509
|
|
7
|
+
data.tar.gz: 02244b12053757519c9ce3de3e0f1dbd24543878442f4751e31b48628991f46017b7843708624b629acdb562ab77b872a2daf0b515e8020de5644ddf473d9811
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Keystone
|
|
4
|
+
module Ui
|
|
5
|
+
class ChipRowComponent < ViewComponent::Base
|
|
6
|
+
ROW_CLASSES = "ks-chip-row max-sm:grid max-sm:grid-cols-3"
|
|
7
|
+
MONO_VALUE_CLASSES = "font-mono"
|
|
8
|
+
TONE_CLASSES = States::NAMES.to_h { |state| [ state, "ks-chip ks-chip-#{state}" ] }.freeze
|
|
9
|
+
|
|
10
|
+
attr_reader :chips
|
|
11
|
+
|
|
12
|
+
def initialize(chips:)
|
|
13
|
+
@chips = chips
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def value_classes(chip)
|
|
17
|
+
MONO_VALUE_CLASSES if chip[:mono]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def chip_classes(chip)
|
|
21
|
+
TONE_CLASSES.fetch(chip.fetch(:tone))
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<% if empty? %>
|
|
32
32
|
<% if @empty_message %>
|
|
33
33
|
<tr>
|
|
34
|
-
<td class="<%=
|
|
34
|
+
<td class="<%= empty_cell_classes %>" colspan="<%= column_count %>">
|
|
35
35
|
<%= @empty_message %>
|
|
36
36
|
</td>
|
|
37
37
|
</tr>
|
|
@@ -22,6 +22,8 @@ module Keystone
|
|
|
22
22
|
HEADER_CLASSES_FIRST = "ks-table-header ks-table-header-first text-left text-sm"
|
|
23
23
|
HEADER_CLASSES_MIDDLE = "ks-table-header ks-table-header-middle text-left text-sm"
|
|
24
24
|
HEADER_CLASSES_LAST = "ks-table-header ks-table-header-last text-right text-sm"
|
|
25
|
+
HEADING_CAPS_CLASSES = "ks-label-caps"
|
|
26
|
+
COMPACT_CLASSES = "ks-table-compact"
|
|
25
27
|
|
|
26
28
|
ROW_CLASSES_FIRST = "ks-table-cell-first text-sm whitespace-nowrap"
|
|
27
29
|
ROW_CLASSES_MIDDLE = "ks-table-cell-middle text-sm whitespace-nowrap"
|
|
@@ -46,7 +48,7 @@ module Keystone
|
|
|
46
48
|
SORT_DESC_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 3a.75.75 0 0 1 .75.75v10.638l3.96-4.158a.75.75 0 1 1 1.08 1.04l-5.25 5.5a.75.75 0 0 1-1.08 0l-5.25-5.5a.75.75 0 0 1 1.08-1.04l3.96 4.158V3.75A.75.75 0 0 1 10 3Z" clip-rule="evenodd" /></svg>'
|
|
47
49
|
SORT_NEUTRAL_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 3a.75.75 0 0 1 .55.24l3.25 3.5a.75.75 0 1 1-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 0 1-1.1-1.02l3.25-3.5A.75.75 0 0 1 10 3Zm-3.76 9.2a.75.75 0 0 1 1.06.04l2.7 2.908 2.7-2.908a.75.75 0 1 1 1.1 1.02l-3.25 3.5a.75.75 0 0 1-1.1 0l-3.25-3.5a.75.75 0 0 1 .04-1.06Z" clip-rule="evenodd" /></svg>'
|
|
48
50
|
|
|
49
|
-
def initialize(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil, phone_list: false, header: true)
|
|
51
|
+
def initialize(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil, phone_list: false, header: true, heading_caps: false, density: nil)
|
|
50
52
|
@items = items.to_a
|
|
51
53
|
@current_index = @items.index(current_row) unless current_row.nil?
|
|
52
54
|
@group_by = group_by
|
|
@@ -65,6 +67,8 @@ module Keystone
|
|
|
65
67
|
@link_blocks = {}
|
|
66
68
|
@phone_list = phone_list
|
|
67
69
|
@header = header
|
|
70
|
+
@heading_caps = heading_caps
|
|
71
|
+
@density = density
|
|
68
72
|
end
|
|
69
73
|
|
|
70
74
|
def before_render
|
|
@@ -118,8 +122,12 @@ module Keystone
|
|
|
118
122
|
PHONE_LIST_BLOCK_CLASSES if @phone_list
|
|
119
123
|
end
|
|
120
124
|
|
|
125
|
+
def empty_cell_classes
|
|
126
|
+
densified(EMPTY_CELL_CLASSES)
|
|
127
|
+
end
|
|
128
|
+
|
|
121
129
|
def actions_cell_classes
|
|
122
|
-
phone_list_classes(ROW_CLASSES_LAST, PHONE_LIST_BLOCK_CLASSES)
|
|
130
|
+
densified(phone_list_classes(ROW_CLASSES_LAST, PHONE_LIST_BLOCK_CLASSES))
|
|
123
131
|
end
|
|
124
132
|
|
|
125
133
|
def head_classes
|
|
@@ -162,7 +170,7 @@ module Keystone
|
|
|
162
170
|
|
|
163
171
|
cell = {
|
|
164
172
|
label: column.header_text,
|
|
165
|
-
classes: aligned(tokens.join(" "), column),
|
|
173
|
+
classes: densified(heading_classes(aligned(tokens.join(" "), column))),
|
|
166
174
|
scope: "col"
|
|
167
175
|
}
|
|
168
176
|
|
|
@@ -189,7 +197,7 @@ module Keystone
|
|
|
189
197
|
if actions?
|
|
190
198
|
cells << {
|
|
191
199
|
label: "Actions",
|
|
192
|
-
classes: HEADER_CLASSES_LAST,
|
|
200
|
+
classes: densified(heading_classes(HEADER_CLASSES_LAST)),
|
|
193
201
|
scope: "col"
|
|
194
202
|
}
|
|
195
203
|
end
|
|
@@ -207,7 +215,7 @@ module Keystone
|
|
|
207
215
|
|
|
208
216
|
cell = {
|
|
209
217
|
value: resolve_value(item, column.key),
|
|
210
|
-
classes: wrapped(aligned(tokens.join(" "), column), column)
|
|
218
|
+
classes: densified(wrapped(aligned(tokens.join(" "), column), column))
|
|
211
219
|
}
|
|
212
220
|
cell[:label] = column.header_text if phone_labels?
|
|
213
221
|
|
|
@@ -242,14 +250,14 @@ module Keystone
|
|
|
242
250
|
return [] unless @total
|
|
243
251
|
|
|
244
252
|
@columns.map.with_index do |column, index|
|
|
245
|
-
{ value: @total[column.key.to_s], classes: phone_list_classes(aligned(header_classes_for(index), column), PHONE_LIST_CELL_CLASSES), label: summary_label(index, column) }
|
|
253
|
+
{ value: @total[column.key.to_s], classes: densified(phone_list_classes(aligned(header_classes_for(index), column), PHONE_LIST_CELL_CLASSES)), label: summary_label(index, column) }
|
|
246
254
|
end
|
|
247
255
|
end
|
|
248
256
|
|
|
249
257
|
def group_cells(name)
|
|
250
258
|
subtotals = @group_totals.fetch(name.to_s, {}).to_h.transform_keys(&:to_s)
|
|
251
259
|
@columns.map.with_index do |column, index|
|
|
252
|
-
{ value: index.zero? ? name : subtotals[column.key.to_s], classes: phone_list_classes(aligned(header_classes_for(index), column), PHONE_LIST_CELL_CLASSES), label: summary_label(index, column) }
|
|
260
|
+
{ value: index.zero? ? name : subtotals[column.key.to_s], classes: densified(phone_list_classes(aligned(header_classes_for(index), column), PHONE_LIST_CELL_CLASSES)), label: summary_label(index, column) }
|
|
253
261
|
end
|
|
254
262
|
end
|
|
255
263
|
|
|
@@ -289,6 +297,18 @@ module Keystone
|
|
|
289
297
|
end
|
|
290
298
|
end
|
|
291
299
|
|
|
300
|
+
def heading_classes(classes)
|
|
301
|
+
return classes unless @heading_caps
|
|
302
|
+
|
|
303
|
+
[ *classes.split.grep_v("text-sm"), HEADING_CAPS_CLASSES ].join(" ")
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
def densified(classes)
|
|
307
|
+
return classes unless @density == :compact
|
|
308
|
+
|
|
309
|
+
[ *classes.split.map { |token| token == "text-sm" ? "text-xs" : token }, COMPACT_CLASSES ].join(" ")
|
|
310
|
+
end
|
|
311
|
+
|
|
292
312
|
def aligned(classes, column)
|
|
293
313
|
return classes unless column.align
|
|
294
314
|
|
|
@@ -19,6 +19,11 @@ module Keystone
|
|
|
19
19
|
lg: "max-lg:order-first max-lg:*:w-full max-lg:*:min-h-12"
|
|
20
20
|
}.freeze
|
|
21
21
|
ACTION_CLASSES = "flex *:flex-1 *:min-w-0 *:wrap-break-word *:text-center"
|
|
22
|
+
PHONE_ACTION_TEXT_CLASSES = {
|
|
23
|
+
sm: "max-sm:*:text-sm",
|
|
24
|
+
md: "max-md:*:text-sm",
|
|
25
|
+
lg: "max-lg:*:text-sm"
|
|
26
|
+
}.freeze
|
|
22
27
|
SECONDARY_ROW_CLASSES = {
|
|
23
28
|
sm: "max-sm:*:flex-1 max-sm:*:min-w-0",
|
|
24
29
|
md: "max-md:*:flex-1 max-md:*:min-w-0",
|
|
@@ -107,7 +112,7 @@ module Keystone
|
|
|
107
112
|
end
|
|
108
113
|
|
|
109
114
|
def secondary_button(action)
|
|
110
|
-
tag.div(class: [ ACTION_CLASSES, (PHONE_ONLY_CLASSES.fetch(@breakpoint) if action[:phone_only]), phone_order_classes(action) ].compact.join(" ")) do
|
|
115
|
+
tag.div(class: [ ACTION_CLASSES, PHONE_ACTION_TEXT_CLASSES.fetch(@breakpoint), (PHONE_ONLY_CLASSES.fetch(@breakpoint) if action[:phone_only]), phone_order_classes(action) ].compact.join(" ")) do
|
|
111
116
|
render ButtonComponent.new(variant: :secondary, **button_options(action), label: action_label(action))
|
|
112
117
|
end
|
|
113
118
|
end
|
|
@@ -4,14 +4,16 @@ module Keystone
|
|
|
4
4
|
module Ui
|
|
5
5
|
class LinkComponent < ViewComponent::Base
|
|
6
6
|
CLASSES = "ks-link"
|
|
7
|
+
CENTRED_CLASSES = "ks-link block text-center"
|
|
7
8
|
|
|
8
|
-
def initialize(label:, href:)
|
|
9
|
+
def initialize(label:, href:, centred: false)
|
|
9
10
|
@label = label
|
|
10
11
|
@href = href
|
|
12
|
+
@centred = centred
|
|
11
13
|
end
|
|
12
14
|
|
|
13
15
|
def call
|
|
14
|
-
link_to(@label, @href, class: CLASSES)
|
|
16
|
+
link_to(@label, @href, class: @centred ? CENTRED_CLASSES : CLASSES)
|
|
15
17
|
end
|
|
16
18
|
end
|
|
17
19
|
end
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
<span class="<%= TEXT_CLASSES %>">
|
|
6
6
|
<% if row[:top_line] %>
|
|
7
7
|
<span class="<%= TOP_LINE_CLASSES %>">
|
|
8
|
-
|
|
8
|
+
<% if row[:top_line][:type] %>
|
|
9
|
+
<span class="<%= TOP_LINE_TYPE_CLASSES %>"><span class="<%= type_tone_classes(row) %>"><%= row[:top_line][:type][:label] %></span></span>
|
|
10
|
+
<% else %>
|
|
11
|
+
<%= render top_line_badge(row) %>
|
|
12
|
+
<% end %>
|
|
9
13
|
<span class="<%= TOP_LINE_TEXT_CLASSES %>"><%= row[:top_line][:text] %></span>
|
|
10
14
|
</span>
|
|
11
15
|
<% end %>
|
|
@@ -8,6 +8,8 @@ module Keystone
|
|
|
8
8
|
STACK_CLASSES = "flex min-w-0 flex-1 flex-col-reverse ks-grid-gap-sm sm:contents"
|
|
9
9
|
BADGE_CLASSES = "max-sm:self-start"
|
|
10
10
|
TOP_LINE_BADGE_CLASSES = "min-w-0 whitespace-normal"
|
|
11
|
+
TOP_LINE_TYPE_CLASSES = "ks-label-caps min-w-0 whitespace-normal"
|
|
12
|
+
TYPE_TONE_CLASSES = States::NAMES.to_h { |state| [ state, "ks-tone-#{state}" ] }.freeze
|
|
11
13
|
TEXT_CLASSES = "min-w-0 flex-1"
|
|
12
14
|
TOP_LINE_CLASSES = "flex items-center justify-between ks-grid-gap-sm whitespace-nowrap"
|
|
13
15
|
TOP_LINE_TEXT_CLASSES = "ks-value-list-note shrink-0 max-w-full truncate"
|
|
@@ -35,6 +37,10 @@ module Keystone
|
|
|
35
37
|
BadgeComponent.new(**row[:badge], class: BADGE_CLASSES)
|
|
36
38
|
end
|
|
37
39
|
|
|
40
|
+
def type_tone_classes(row)
|
|
41
|
+
TYPE_TONE_CLASSES.fetch(row[:top_line][:type][:tone])
|
|
42
|
+
end
|
|
43
|
+
|
|
38
44
|
def top_line_badge(row)
|
|
39
45
|
BadgeComponent.new(**row[:top_line][:badge], class: TOP_LINE_BADGE_CLASSES)
|
|
40
46
|
end
|
|
@@ -10,6 +10,7 @@ module Keystone
|
|
|
10
10
|
COMPACT_CLASSES = "ks-metric-card ks-metric-card-compact relative"
|
|
11
11
|
LABEL_CLASSES = "ks-stat-card-label text-sm"
|
|
12
12
|
COMPACT_LABEL_CLASSES = "ks-stat-card-label text-xs"
|
|
13
|
+
CAPS_LABEL_CLASSES = "ks-stat-card-label ks-label-caps"
|
|
13
14
|
VALUE_BASE_CLASSES = "ks-stat-card-value text-3xl"
|
|
14
15
|
COMPACT_VALUE_CLASSES = "ks-stat-card-value ks-stat-card-value-compact flex flex-wrap items-baseline text-lg leading-6"
|
|
15
16
|
SUFFIX_CLASSES = "ks-stat-card-suffix text-lg"
|
|
@@ -30,8 +31,9 @@ module Keystone
|
|
|
30
31
|
|
|
31
32
|
attr_reader :label, :value, :suffix, :definition, :calculation, :change, :href, :note
|
|
32
33
|
|
|
33
|
-
def initialize(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil, note: nil, plain: false, fallback: nil, compact: false)
|
|
34
|
+
def initialize(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil, note: nil, plain: false, fallback: nil, compact: false, label_caps: false)
|
|
34
35
|
@compact = compact
|
|
36
|
+
@label_caps = label_caps
|
|
35
37
|
@label = label
|
|
36
38
|
@fallback = fallback
|
|
37
39
|
@note = note
|
|
@@ -60,6 +62,8 @@ module Keystone
|
|
|
60
62
|
end
|
|
61
63
|
|
|
62
64
|
def label_classes
|
|
65
|
+
return CAPS_LABEL_CLASSES if @label_caps
|
|
66
|
+
|
|
63
67
|
@compact ? COMPACT_LABEL_CLASSES : LABEL_CLASSES
|
|
64
68
|
end
|
|
65
69
|
|
|
@@ -23,16 +23,19 @@ module Keystone
|
|
|
23
23
|
PHONE_AXIS_CLASSES = "ks-meter-label flex justify-between text-xs sm:col-span-3 sm:hidden"
|
|
24
24
|
ONE_LINE_AXIS_CLASSES = "ks-meter-label relative h-4 text-xs sm:col-start-2 max-sm:hidden"
|
|
25
25
|
MARK_CLASSES = "absolute top-0 whitespace-nowrap"
|
|
26
|
+
MONO_CLASSES = "font-mono"
|
|
27
|
+
MONO_LABEL_CLASSES = "min-w-0 wrap-break-word font-mono"
|
|
26
28
|
MINIMUM_BAR_PERCENT = 2
|
|
27
29
|
MARK_STEPS = [ 1, 2, 5, 10, 15, 30, 60, 120, 300, 600, 900, 1800, 3600, 7200, 10_800, 21_600, 43_200, 86_400 ].freeze
|
|
28
30
|
MAXIMUM_MARK_INTERVALS = 6
|
|
29
31
|
|
|
30
32
|
attr_reader :entries, :one_line
|
|
31
33
|
|
|
32
|
-
def initialize(entries:, one_line: false)
|
|
34
|
+
def initialize(entries:, one_line: false, text_mono: false)
|
|
33
35
|
entries.each { |entry| check_times(entry) }
|
|
34
36
|
@entries = entries
|
|
35
37
|
@one_line = one_line
|
|
38
|
+
@text_mono = text_mono
|
|
36
39
|
end
|
|
37
40
|
|
|
38
41
|
def track_classes
|
|
@@ -44,7 +47,9 @@ module Keystone
|
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
def label_classes
|
|
47
|
-
ONE_LINE_LABEL_CLASSES if one_line
|
|
50
|
+
return [ ONE_LINE_LABEL_CLASSES, (MONO_CLASSES if @text_mono) ].compact.join(" ") if one_line
|
|
51
|
+
|
|
52
|
+
MONO_LABEL_CLASSES if @text_mono
|
|
48
53
|
end
|
|
49
54
|
|
|
50
55
|
def status_classes
|
|
@@ -98,7 +103,7 @@ module Keystone
|
|
|
98
103
|
end
|
|
99
104
|
|
|
100
105
|
def duration_classes(row)
|
|
101
|
-
WAITING_CLASSES if waiting?(row)
|
|
106
|
+
[ (WAITING_CLASSES if waiting?(row)), (MONO_CLASSES if @text_mono) ].compact.join(" ").presence
|
|
102
107
|
end
|
|
103
108
|
|
|
104
109
|
def duration(row)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<%= row[:label] %>
|
|
6
6
|
<% if row[:note] %><span class="ks-value-list-note"><%= row[:note] %></span><% end %>
|
|
7
7
|
</dt>
|
|
8
|
-
<dd class="
|
|
8
|
+
<dd class="<%= value_classes %>">
|
|
9
9
|
<%= shown_value(row) %>
|
|
10
10
|
<% if row[:right] %>
|
|
11
11
|
<svg aria-label="Right" role="img" class="<%= right_mark_classes %>" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z" clip-rule="evenodd" /></svg>
|
|
@@ -8,11 +8,16 @@ module Keystone
|
|
|
8
8
|
COLUMNS_CLASSES = "grid grid-cols-1 sm:grid-cols-2 ks-grid-gap-sm"
|
|
9
9
|
PAIR_CLASSES = "flex flex-col min-w-0"
|
|
10
10
|
PAIR_LABEL_CLASSES = "ks-value-list-label basis-auto text-xs"
|
|
11
|
+
CAPS_LABEL_CLASSES = "ks-label-caps"
|
|
12
|
+
VALUE_CLASSES = "ks-value-list-value"
|
|
13
|
+
MONO_VALUE_CLASSES = "ks-value-list-value font-mono"
|
|
11
14
|
|
|
12
15
|
attr_reader :rows
|
|
13
16
|
|
|
14
|
-
def initialize(rows:, align: :start, columns: false)
|
|
17
|
+
def initialize(rows:, align: :start, columns: false, label_caps: false, value_mono: false)
|
|
15
18
|
@rows = rows
|
|
19
|
+
@value_mono = value_mono
|
|
20
|
+
@label_caps = label_caps
|
|
16
21
|
@align = align
|
|
17
22
|
@columns = columns
|
|
18
23
|
end
|
|
@@ -30,7 +35,11 @@ module Keystone
|
|
|
30
35
|
end
|
|
31
36
|
|
|
32
37
|
def label_classes
|
|
33
|
-
@columns ? PAIR_LABEL_CLASSES : "ks-value-list-label"
|
|
38
|
+
[ @columns ? PAIR_LABEL_CLASSES : "ks-value-list-label", (CAPS_LABEL_CLASSES if @label_caps) ].compact.join(" ")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def value_classes
|
|
42
|
+
@value_mono ? MONO_VALUE_CLASSES : VALUE_CLASSES
|
|
34
43
|
end
|
|
35
44
|
|
|
36
45
|
def row_classes(row)
|
|
@@ -301,6 +301,10 @@ module KeystoneUiHelper
|
|
|
301
301
|
render Keystone::Ui::PictureComponent.new(**args)
|
|
302
302
|
end
|
|
303
303
|
|
|
304
|
+
def ui_chip_row(**args)
|
|
305
|
+
render Keystone::Ui::ChipRowComponent.new(**args)
|
|
306
|
+
end
|
|
307
|
+
|
|
304
308
|
def ui_heading(**args)
|
|
305
309
|
render Keystone::Ui::HeadingComponent.new(**args)
|
|
306
310
|
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 phone header with a line above its title and a badge at its right end, a page's main action as a phone top-bar icon or a button fixed to the bottom of the screen, a decision bar of a note field and several buttons sent as one form and fixed to the bottom of a phone screen, review cards of an id, score, title, text, finding note and equal-width buttons set three across on a desktop, 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, a queue of links with a type and time above each title and the open one marked, two versions of a text compared line by line side by side or in one column, 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 phone header with a line above its title and a badge at its right end, a page's main action as a phone top-bar icon or a button fixed to the bottom of the screen, a decision bar of a note field and several buttons sent as one form and fixed to the bottom of a phone screen, review cards of an id, score, title, text, finding note and equal-width buttons set three across on a desktop, 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, summary chips coloured by tone, 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, a queue of links with a type and time above each title and the open one marked, two versions of a text compared line by line side by side or in one column, 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
|
---
|
|
@@ -72,7 +72,8 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
72
72
|
- `ui_button_row` — a row of buttons that wraps onto further lines, optionally giving each button an equal share of its width at every width or on a phone only.
|
|
73
73
|
- `ui_badge` — a coloured pill holding a short label.
|
|
74
74
|
- `ui_status_dot` — a small dot coloured by state, with its label read only by screen readers.
|
|
75
|
-
- `ui_figure` — one amount as inline text, coloured as a gain
|
|
75
|
+
- `ui_figure` — one amount or short result as inline text, coloured as a gain, a loss, a warning or information.
|
|
76
|
+
- `ui_chip_row` — a row of summary chips, each a label and value in a tone's colour on a tinted background, three across on a phone.
|
|
76
77
|
- `ui_picture` — an image never taller than half the screen, optionally opening its full-size file.
|
|
77
78
|
- `ui_heading` — a heading at one of three sizes, with an optional short note on its right.
|
|
78
79
|
- `ui_caption` — small uppercase muted text placed above a title or a figure, or a small muted line in normal case that can hold links.
|
|
@@ -417,7 +418,9 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
417
418
|
bar fixed to the bottom of the screen, above `ui_bottom_nav` on a page
|
|
418
419
|
that has one, with the primary button at full width and 48 pixels tall
|
|
419
420
|
above a row of the secondary buttons, each an equal share of the row and
|
|
420
|
-
44 pixels tall.
|
|
421
|
+
44 pixels tall. Their labels are drawn in small text there, so a label
|
|
422
|
+
such as "Send back" stays on one line three across on a 390px-wide
|
|
423
|
+
screen. A label too long for its share wraps inside its
|
|
421
424
|
button, so do not shrink the buttons to keep the row even. The note
|
|
422
425
|
field and hint are not shown below `sm:`. `breakpoint: :md` or
|
|
423
426
|
`breakpoint: :lg` moves the switch between the phone bar and the panel
|
|
@@ -585,8 +588,11 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
585
588
|
|
|
586
589
|
8. Build tables.
|
|
587
590
|
|
|
588
|
-
- `ui_data_table(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil, phone_list: false, header: true)`
|
|
589
|
-
takes a block yielding the table. `
|
|
591
|
+
- `ui_data_table(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil, phone_list: false, header: true, heading_caps: false, density: nil)`
|
|
592
|
+
takes a block yielding the table. `heading_caps: true` draws the column
|
|
593
|
+
headings in small capitals. `density: :compact` draws every heading and
|
|
594
|
+
cell in extra small text with smaller padding, for a wide table in a
|
|
595
|
+
narrow panel, and works with `heading_caps: true`. `items:` are records or hashes, and a
|
|
590
596
|
cell's value is the column key called on the item, or `item[key]`.
|
|
591
597
|
`group_by:` lists rows under heading rows named by that key's value,
|
|
592
598
|
`group_totals:` (`{ "Group name" => { column_key => value } }`) puts
|
|
@@ -710,8 +716,10 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
710
716
|
`equal_width: :phone` does that below `sm:` only, and from `sm:` up each
|
|
711
717
|
button keeps the width of its label. Use it in place of a hand-written
|
|
712
718
|
flex `div` around a set of buttons.
|
|
713
|
-
- `ui_link(label:, href:)` draws a text link in the link
|
|
714
|
-
|
|
719
|
+
- `ui_link(label:, href:, centred: false)` draws a text link in the link
|
|
720
|
+
colour. `centred: true` puts it on its own line with its label in the
|
|
721
|
+
middle, such as a "Finish on desktop" link under a phone page's cards.
|
|
722
|
+
Use it in place of a hand-written `link_to` with colour classes.
|
|
715
723
|
- With `href:` and `method:` `:post` `:patch` `:put` or `:delete`, it
|
|
716
724
|
renders a button inside its own small form that sends that request to
|
|
717
725
|
`href:` when tapped. Do not write a form around it. It cannot sit inside
|
|
@@ -754,7 +762,10 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
754
762
|
badge at the left, apart from the row's `badge:`, and short text at the
|
|
755
763
|
right, such as a type and the time left. It stays on one line and cuts off
|
|
756
764
|
long text, a long badge wraps without squeezing the text beside it, and
|
|
757
|
-
the label and subtitle wrap. `
|
|
765
|
+
the label and subtitle wrap. In place of `badge:`, `top_line:` takes
|
|
766
|
+
`type: { label:, tone: }`, which shows the row's type as small-capital
|
|
767
|
+
text in the tone's colour, such as `{ label: "Approval", tone: :warning }`
|
|
768
|
+
or `{ label: "Failure", tone: :danger }`. `current: true` marks the
|
|
758
769
|
row the person has open with `aria-current` and a tint and accent bar.
|
|
759
770
|
`chevron: false` leaves off every row's chevron, as in a queue beside the
|
|
760
771
|
open item. `new_tab: true` opens every row's link in a new browser tab
|
|
@@ -821,12 +832,14 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
821
832
|
- `ui_facts(facts:)` — each fact is `{ value:, label: }`, drawn as a small
|
|
822
833
|
box with the count in bold beside its label, in a row that wraps.
|
|
823
834
|
- `ui_paragraph(text:)` shows running text.
|
|
824
|
-
- `ui_value_list(rows:, align: :start, columns: false)` — each row is
|
|
835
|
+
- `ui_value_list(rows:, align: :start, columns: false, label_caps: false, value_mono: false)` — each row is
|
|
825
836
|
`{ label:, value: }` with optional `note:`, `total: true`, `right: true`
|
|
826
837
|
and `fallback:`, shown when the value is `nil` or empty. `right: true`
|
|
827
838
|
draws a green check mark after the value, read out as "Right", for an
|
|
828
839
|
answer that was right. `align: :end` pushes values to the right, as in a
|
|
829
|
-
ledger.
|
|
840
|
+
ledger. `label_caps: true` draws the labels in small capitals and
|
|
841
|
+
`value_mono: true` draws the values in a fixed-width font, as for ids,
|
|
842
|
+
model names and run numbers.
|
|
830
843
|
- With the default `columns: false`, each pair is one row with its label
|
|
831
844
|
beside its value and a line between rows. `columns: true` draws each pair
|
|
832
845
|
as its label in small text directly above its value, with no line between
|
|
@@ -837,7 +850,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
837
850
|
|
|
838
851
|
10. Explain figures.
|
|
839
852
|
|
|
840
|
-
- `ui_stat_card(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil, note: nil, plain: false, fallback: nil, compact: false)`
|
|
853
|
+
- `ui_stat_card(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil, note: nil, plain: false, fallback: nil, compact: false, label_caps: false)`
|
|
841
854
|
— `variant:` is `:neutral` `:success` `:danger` `:warning` `:info` and
|
|
842
855
|
colours the value. `change:` is a signed number shown as `▲ 4.2%` in
|
|
843
856
|
green, `▼` in red, or plain at zero. `href:` links the value only, so
|
|
@@ -847,13 +860,24 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
847
860
|
extra small label over a smaller value with its change or note beside
|
|
848
861
|
the value, under half a default card's height. Put compact cards in
|
|
849
862
|
`ui_grid(cols: { default: 1, sm: 2 }, gap: :sm)` inside a panel so they
|
|
850
|
-
sit two across and stack on a phone.
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
`:
|
|
863
|
+
sit two across and stack on a phone. `label_caps: true` draws the label
|
|
864
|
+
in small capitals.
|
|
865
|
+
- `ui_figure(text:, tone: :neutral)` prints one amount or short result
|
|
866
|
+
inline. `tone:` `:neutral` uses the surrounding text colour, `:success`
|
|
867
|
+
green, `:danger` red, `:warning` amber and `:info` blue, such as
|
|
868
|
+
"Waiting" or "Running" for a step's result, and any other symbol raises
|
|
869
|
+
`KeyError`. Its output can go
|
|
854
870
|
anywhere a string is shown, such as a table cell. Use it, not a badge or
|
|
855
871
|
a colour class, for a gain or a loss, and ask the developer which amounts
|
|
856
872
|
are coloured and what counts as a gain.
|
|
873
|
+
- `ui_chip_row(chips:)` shows a row of summary chips. Each chip is
|
|
874
|
+
`{ label:, value:, tone:, mono: false }`, `tone:` one of `:neutral`
|
|
875
|
+
`:success` `:danger` `:warning` `:info`, and draws its label and value
|
|
876
|
+
in that tone's colour on a tinted background. `mono: true` draws the
|
|
877
|
+
value in a fixed-width font. The chips share the row's width equally,
|
|
878
|
+
and on a phone they sit three across with a fourth starting a new line.
|
|
879
|
+
Use it for a few counts or scores above the record they summarise, in
|
|
880
|
+
place of badges or hand-written tinted spans.
|
|
857
881
|
- `ui_calculation(groups:, summary: "How this is worked out")` shows the
|
|
858
882
|
steps behind a figure, closed under a row reading `summary:`. `groups:`
|
|
859
883
|
is `[{ title:, lines: [{ label:, working:, result: }, ...] }, ...]`.
|
|
@@ -923,10 +947,12 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
923
947
|
the fill turns green with `over: :success` or amber with `over: :warning`.
|
|
924
948
|
- `ui_bucket_series(buckets:)` takes an array of hashes with the keywords
|
|
925
949
|
of `ui_bucket`, such as `[{ goal: 10, actual: 7, label: "Mon" }, ...]`.
|
|
926
|
-
- `ui_timeline(entries:, one_line: false)` takes no block. `entries:` is
|
|
950
|
+
- `ui_timeline(entries:, one_line: false, text_mono: false)` takes no block. `entries:` is
|
|
927
951
|
`[{ label:, started_at:, ended_at: nil, queued_at: nil, failed: false, waiting: false, href: nil, selected: false }, ...]`,
|
|
928
952
|
with every time a `Time` value. `one_line:` picks the layout, described
|
|
929
|
-
below.
|
|
953
|
+
below. `text_mono: true` draws the step names and durations in a
|
|
954
|
+
fixed-width font and wraps a long step name inside its row, so a phone
|
|
955
|
+
page does not scroll sideways.
|
|
930
956
|
- It draws one row per label, in the order each label first appears.
|
|
931
957
|
Entries that share a label, such as the tries of one step, share that
|
|
932
958
|
row and each draws its own bar, so pass a step's tries one after another
|
|
@@ -211,6 +211,16 @@ One decision: is keystone_ui set up in the app?
|
|
|
211
211
|
- **Compact stat cards.** A stat card can be drawn compact, a small tile with
|
|
212
212
|
an extra small label and a smaller value, its change or note beside the
|
|
213
213
|
value, for a small grid of figures inside a panel.
|
|
214
|
+
- **Small capitals and fixed width.** A stat card's label, a data table's
|
|
215
|
+
column headings, a value list's labels and a link list row's type can be
|
|
216
|
+
drawn in small capitals, and a value list's values, a timeline's step names
|
|
217
|
+
and durations and a summary chip's value in a fixed-width font. Each is an
|
|
218
|
+
option on its component, off by default.
|
|
219
|
+
- **Compact data tables.** A data table can be drawn compact, with extra
|
|
220
|
+
small text and smaller padding in every heading and cell, so a wide table
|
|
221
|
+
fits a narrow panel with every value on one line.
|
|
222
|
+
- **Summary chips.** A row of summary chips shows a few labelled values, each
|
|
223
|
+
in a tone's colour on a tinted background, three across on a phone.
|
|
214
224
|
- **Unequal grid columns.** A grid goes up to the `xl:` breakpoint, and a
|
|
215
225
|
two-column grid can make its first or its second column wider, three parts
|
|
216
226
|
to two.
|
data/the_local/interface.yml
CHANGED
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.103.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.45.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.45.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: view_component
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -115,6 +115,8 @@ files:
|
|
|
115
115
|
- app/components/keystone/ui/chart_card_component.rb
|
|
116
116
|
- app/components/keystone/ui/checkbox_row_component.html.erb
|
|
117
117
|
- app/components/keystone/ui/checkbox_row_component.rb
|
|
118
|
+
- app/components/keystone/ui/chip_row_component.html.erb
|
|
119
|
+
- app/components/keystone/ui/chip_row_component.rb
|
|
118
120
|
- app/components/keystone/ui/code_component.html.erb
|
|
119
121
|
- app/components/keystone/ui/code_component.rb
|
|
120
122
|
- app/components/keystone/ui/color_picker_component.html.erb
|