keystone_ui 0.74.0 → 0.75.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 +11 -1
- data/app/components/keystone/ui/caption_component.html.erb +1 -1
- data/app/components/keystone/ui/caption_component.rb +8 -1
- data/app/components/keystone/ui/checkbox_row_component.html.erb +1 -1
- data/app/components/keystone/ui/checkbox_row_component.rb +6 -1
- data/app/components/keystone/ui/facts_component.html.erb +5 -0
- data/app/components/keystone/ui/facts_component.rb +29 -0
- data/app/components/keystone/ui/hero_component.rb +7 -2
- data/app/components/keystone/ui/link_component.rb +18 -0
- data/app/components/keystone/ui/radio_card_component.html.erb +18 -10
- data/app/components/keystone/ui/radio_card_component.rb +25 -2
- data/app/components/keystone/ui/value_list_component.html.erb +6 -1
- data/app/components/keystone/ui/value_list_component.rb +5 -0
- data/app/helpers/keystone_ui_helper.rb +8 -0
- data/lib/keystone_ui/safelist.rb +2 -0
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +32 -10
- data/the_local/interface.yml +2 -0
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6255269764037507da7aeffe23291ddceefb9e418d99ba7fe02f25616a162e42
|
|
4
|
+
data.tar.gz: 93a985c80b1f16d968719874b0db5838958a3d8a184e60ceae4081796d57f445
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 84a9e06052c60efcdbcca6451ef323d586a9f02ca6dc61841b5d4f25746cf690d73899624986bb2c5824054d41686e3f61f736ceaf9e8bcce3ec6450c22d05d5
|
|
7
|
+
data.tar.gz: 6737b46c2482e27b48c1bd6cc1d03da0fb2bd834c5d3f58f03ee1f64b1e60159b6e859404559ddc989327b9907d1a89116b08aff309afc5c5d5cf9e3ed6aec2d
|
|
@@ -18,7 +18,9 @@ module Keystone
|
|
|
18
18
|
|
|
19
19
|
FULL_WIDTH_CLASSES = "w-full"
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
TEXT_CLASSES = "ks-text-button"
|
|
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)
|
|
22
24
|
@label = label
|
|
23
25
|
@href = href
|
|
24
26
|
@method = method.to_sym
|
|
@@ -27,9 +29,14 @@ module Keystone
|
|
|
27
29
|
@size = size
|
|
28
30
|
@type = type.to_s
|
|
29
31
|
@data = data
|
|
32
|
+
@name = name
|
|
33
|
+
@value = value
|
|
34
|
+
@hidden = hidden
|
|
30
35
|
end
|
|
31
36
|
|
|
32
37
|
def classes
|
|
38
|
+
return TEXT_CLASSES if @variant == :text
|
|
39
|
+
|
|
33
40
|
variant_css = if @variant == :primary
|
|
34
41
|
"ks-button-primary"
|
|
35
42
|
else
|
|
@@ -46,10 +53,13 @@ module Keystone
|
|
|
46
53
|
options = { class: classes }
|
|
47
54
|
if button?
|
|
48
55
|
options[:type] = @type
|
|
56
|
+
options[:name] = @name if @name
|
|
57
|
+
options[:value] = @value if @value
|
|
49
58
|
else
|
|
50
59
|
options[:href] = @href
|
|
51
60
|
end
|
|
52
61
|
options[:data] = @data if @data
|
|
62
|
+
options[:hidden] = true if @hidden
|
|
53
63
|
options
|
|
54
64
|
end
|
|
55
65
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<p class="
|
|
1
|
+
<p class="<%= classes %>"><%= text %></p>
|
|
@@ -3,10 +3,17 @@
|
|
|
3
3
|
module Keystone
|
|
4
4
|
module Ui
|
|
5
5
|
class CaptionComponent < ViewComponent::Base
|
|
6
|
+
TONE_CLASSES = { muted: "ks-caption", link: "ks-caption ks-caption-link" }.freeze
|
|
7
|
+
|
|
6
8
|
attr_reader :text
|
|
7
9
|
|
|
8
|
-
def initialize(text:)
|
|
10
|
+
def initialize(text:, tone: :muted)
|
|
9
11
|
@text = text
|
|
12
|
+
@tone = tone
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def classes
|
|
16
|
+
TONE_CLASSES.fetch(@tone)
|
|
10
17
|
end
|
|
11
18
|
end
|
|
12
19
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<label class="<%= row_classes %> relative"<%= ' data-controller="stat-card-info"'.html_safe if info? %>>
|
|
2
|
-
<input type="checkbox" name="<%= name %>" value="<%= value %>" <%= "checked" if checked? %> class="<%= input_classes %>">
|
|
2
|
+
<input type="checkbox" name="<%= name %>" value="<%= value %>" <%= "checked" if checked? %> <%= "disabled" if disabled? %> class="<%= input_classes %>">
|
|
3
3
|
<span>
|
|
4
4
|
<span class="<%= header_classes %>">
|
|
5
5
|
<span class="<%= label_classes %>"><%= label %></span>
|
|
@@ -13,19 +13,24 @@ module Keystone
|
|
|
13
13
|
|
|
14
14
|
attr_reader :name, :value, :label, :hint, :info
|
|
15
15
|
|
|
16
|
-
def initialize(name:, value:, label:, hint: nil, info: nil, checked: false)
|
|
16
|
+
def initialize(name:, value:, label:, hint: nil, info: nil, checked: false, disabled: false)
|
|
17
17
|
@name = name
|
|
18
18
|
@value = value
|
|
19
19
|
@label = label
|
|
20
20
|
@hint = hint
|
|
21
21
|
@info = info
|
|
22
22
|
@checked = checked
|
|
23
|
+
@disabled = disabled
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
def checked?
|
|
26
27
|
@checked
|
|
27
28
|
end
|
|
28
29
|
|
|
30
|
+
def disabled?
|
|
31
|
+
@disabled
|
|
32
|
+
end
|
|
33
|
+
|
|
29
34
|
def hint?
|
|
30
35
|
!@hint.nil?
|
|
31
36
|
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Keystone
|
|
4
|
+
module Ui
|
|
5
|
+
class FactsComponent < ViewComponent::Base
|
|
6
|
+
FACTS_CLASSES = "ks-facts flex flex-wrap"
|
|
7
|
+
FACT_CLASSES = "ks-fact"
|
|
8
|
+
VALUE_CLASSES = "ks-tone-neutral"
|
|
9
|
+
|
|
10
|
+
attr_reader :facts
|
|
11
|
+
|
|
12
|
+
def initialize(facts:)
|
|
13
|
+
@facts = facts
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def facts_classes
|
|
17
|
+
FACTS_CLASSES
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def fact_classes
|
|
21
|
+
FACT_CLASSES
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def value_classes
|
|
25
|
+
VALUE_CLASSES
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -14,6 +14,10 @@ module Keystone
|
|
|
14
14
|
CENTERED_CLASSES = "flex flex-col items-center text-center"
|
|
15
15
|
|
|
16
16
|
TITLE_BASE_CLASSES = "ks-hero-title text-4xl tracking-tight sm:text-5xl lg:text-6xl"
|
|
17
|
+
TITLE_SIZE_CLASSES = {
|
|
18
|
+
lg: TITLE_BASE_CLASSES,
|
|
19
|
+
sm: "ks-hero-title text-3xl tracking-tight md:text-4xl"
|
|
20
|
+
}.freeze
|
|
17
21
|
SUBTITLE_BASE_CLASSES = "ks-hero-subtitle max-w-lg text-lg"
|
|
18
22
|
BADGE_BASE_CLASSES = "ks-hero-badge inline-flex w-fit items-center text-sm"
|
|
19
23
|
ACTIONS_CLASSES = "ks-hero-actions flex flex-wrap"
|
|
@@ -22,7 +26,7 @@ module Keystone
|
|
|
22
26
|
|
|
23
27
|
attr_reader :title, :subtitle, :badge
|
|
24
28
|
|
|
25
|
-
def initialize(title:, subtitle: nil, badge: nil, layout: :split, height: :screen)
|
|
29
|
+
def initialize(title:, subtitle: nil, badge: nil, layout: :split, height: :screen, title_size: :lg)
|
|
26
30
|
raise ArgumentError, "a hero's height is :screen or :content, got #{height.inspect}" unless %i[screen content].include?(height)
|
|
27
31
|
|
|
28
32
|
@title = title
|
|
@@ -30,6 +34,7 @@ module Keystone
|
|
|
30
34
|
@badge = badge
|
|
31
35
|
@layout = layout
|
|
32
36
|
@height = height
|
|
37
|
+
@title_size = title_size
|
|
33
38
|
end
|
|
34
39
|
|
|
35
40
|
def classes
|
|
@@ -53,7 +58,7 @@ module Keystone
|
|
|
53
58
|
end
|
|
54
59
|
|
|
55
60
|
def title_classes
|
|
56
|
-
|
|
61
|
+
TITLE_SIZE_CLASSES.fetch(@title_size)
|
|
57
62
|
end
|
|
58
63
|
|
|
59
64
|
def subtitle_classes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Keystone
|
|
4
|
+
module Ui
|
|
5
|
+
class LinkComponent < ViewComponent::Base
|
|
6
|
+
CLASSES = "ks-link"
|
|
7
|
+
|
|
8
|
+
def initialize(label:, href:)
|
|
9
|
+
@label = label
|
|
10
|
+
@href = href
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def call
|
|
14
|
+
link_to(@label, @href, class: CLASSES)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
<label class="
|
|
2
|
-
<input type="radio" name="<%= name %>" value="<%= value %>" <%= "checked" if checked? %> class="peer sr-only"
|
|
1
|
+
<label class="<%= wrapper_classes %>"<%= ' data-controller="stat-card-info"'.html_safe if info? %>>
|
|
2
|
+
<input type="radio" name="<%= name %>" value="<%= value %>" <%= "checked" if checked? %> class="peer sr-only"<%= ' onchange="this.form.requestSubmit()"'.html_safe if submits? %>>
|
|
3
3
|
<span class="<%= classes %>">
|
|
4
|
-
|
|
5
|
-
<span class="<%=
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
<% body = capture do %>
|
|
5
|
+
<span class="<%= header_classes %>">
|
|
6
|
+
<span class="<%= label_classes %>"><%= label %></span>
|
|
7
|
+
<% if info? %>
|
|
8
|
+
<button type="button" class="<%= info_button_classes %>" data-action="click->stat-card-info#toggle" aria-label="About <%= label %>"><%= info_icon.html_safe %></button>
|
|
9
|
+
<span class="<%= disclosure_classes %>" data-stat-card-info-target="panel"><%= info %></span>
|
|
10
|
+
<% end %>
|
|
11
|
+
</span>
|
|
12
|
+
<% if hint? %>
|
|
13
|
+
<span class="<%= hint_classes %>"><%= hint %></span>
|
|
9
14
|
<% end %>
|
|
10
|
-
|
|
11
|
-
<% if
|
|
12
|
-
<span class="<%=
|
|
15
|
+
<% end %>
|
|
16
|
+
<% if show_value? %>
|
|
17
|
+
<span class="<%= value_classes %>"><%= value %></span>
|
|
18
|
+
<span><%= body %></span>
|
|
19
|
+
<% else %>
|
|
20
|
+
<%= body %>
|
|
13
21
|
<% end %>
|
|
14
22
|
</span>
|
|
15
23
|
</label>
|
|
@@ -4,29 +4,48 @@ module Keystone
|
|
|
4
4
|
module Ui
|
|
5
5
|
class RadioCardComponent < ViewComponent::Base
|
|
6
6
|
BASE_CLASSES = "ks-radio-card inline-flex flex-col cursor-pointer transition"
|
|
7
|
+
WRAPPER_CLASSES = "inline-block cursor-pointer relative"
|
|
8
|
+
FULL_WIDTH_WRAPPER_CLASSES = "block cursor-pointer relative"
|
|
9
|
+
FULL_WIDTH_CLASSES = "ks-radio-card ks-radio-card-block flex items-start cursor-pointer transition"
|
|
7
10
|
HIGHLIGHT_CLASSES = "ks-radio-card-highlight"
|
|
8
11
|
HEADER_CLASSES = "ks-radio-card-header flex items-start justify-between"
|
|
9
12
|
LABEL_CLASSES = "ks-radio-card-label block"
|
|
10
13
|
HINT_CLASSES = "ks-radio-card-hint block text-sm"
|
|
11
14
|
INFO_BUTTON_CLASSES = "ks-radio-card-info peer shrink-0"
|
|
12
15
|
DISCLOSURE_CLASSES = "ks-radio-card-disclosure hidden peer-hover:block absolute inset-x-0 top-full z-10 text-sm"
|
|
16
|
+
VALUE_CLASSES = "ks-radio-card-value shrink-0"
|
|
13
17
|
INFO_ICON = Keystone::Ui::StatCardComponent::INFO_ICON
|
|
14
18
|
|
|
15
19
|
attr_reader :name, :value, :label, :hint, :info
|
|
16
20
|
|
|
17
|
-
def initialize(name:, value:, label:, hint: nil, info: nil, checked: false)
|
|
21
|
+
def initialize(name:, value:, label:, hint: nil, info: nil, checked: false, submits: false, show_value: false, full_width: false)
|
|
18
22
|
@name = name
|
|
19
23
|
@value = value
|
|
20
24
|
@label = label
|
|
21
25
|
@hint = hint
|
|
22
26
|
@info = info
|
|
23
27
|
@checked = checked
|
|
28
|
+
@submits = submits
|
|
29
|
+
@show_value = show_value
|
|
30
|
+
@full_width = full_width
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def show_value?
|
|
34
|
+
@show_value
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def value_classes
|
|
38
|
+
VALUE_CLASSES
|
|
24
39
|
end
|
|
25
40
|
|
|
26
41
|
def checked?
|
|
27
42
|
@checked
|
|
28
43
|
end
|
|
29
44
|
|
|
45
|
+
def submits?
|
|
46
|
+
@submits
|
|
47
|
+
end
|
|
48
|
+
|
|
30
49
|
def hint?
|
|
31
50
|
!@hint.nil?
|
|
32
51
|
end
|
|
@@ -47,8 +66,12 @@ module Keystone
|
|
|
47
66
|
DISCLOSURE_CLASSES
|
|
48
67
|
end
|
|
49
68
|
|
|
69
|
+
def wrapper_classes
|
|
70
|
+
@full_width ? FULL_WIDTH_WRAPPER_CLASSES : WRAPPER_CLASSES
|
|
71
|
+
end
|
|
72
|
+
|
|
50
73
|
def classes
|
|
51
|
-
"#{BASE_CLASSES} #{HIGHLIGHT_CLASSES}"
|
|
74
|
+
"#{@full_width ? FULL_WIDTH_CLASSES : BASE_CLASSES} #{HIGHLIGHT_CLASSES}"
|
|
52
75
|
end
|
|
53
76
|
|
|
54
77
|
def header_classes
|
|
@@ -5,7 +5,12 @@
|
|
|
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="ks-value-list-value"
|
|
8
|
+
<dd class="ks-value-list-value">
|
|
9
|
+
<%= shown_value(row) %>
|
|
10
|
+
<% if row[:right] %>
|
|
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>
|
|
12
|
+
<% end %>
|
|
13
|
+
</dd>
|
|
9
14
|
</div>
|
|
10
15
|
<% end %>
|
|
11
16
|
</dl>
|
|
@@ -4,6 +4,7 @@ module Keystone
|
|
|
4
4
|
module Ui
|
|
5
5
|
class ValueListComponent < ViewComponent::Base
|
|
6
6
|
ALIGN_CLASSES = { start: nil, end: "ks-value-list-end" }.freeze
|
|
7
|
+
RIGHT_MARK_CLASSES = "ks-tone-success inline size-5 align-text-bottom"
|
|
7
8
|
|
|
8
9
|
attr_reader :rows
|
|
9
10
|
|
|
@@ -20,6 +21,10 @@ module Keystone
|
|
|
20
21
|
row[:value].to_s.empty? ? row[:fallback] : row[:value]
|
|
21
22
|
end
|
|
22
23
|
|
|
24
|
+
def right_mark_classes
|
|
25
|
+
RIGHT_MARK_CLASSES
|
|
26
|
+
end
|
|
27
|
+
|
|
23
28
|
def row_classes(row)
|
|
24
29
|
[ "ks-value-list-row", ("ks-value-list-total" if row[:total]) ].compact.join(" ")
|
|
25
30
|
end
|
|
@@ -277,6 +277,14 @@ module KeystoneUiHelper
|
|
|
277
277
|
render Keystone::Ui::CaptionComponent.new(**args)
|
|
278
278
|
end
|
|
279
279
|
|
|
280
|
+
def ui_link(**args)
|
|
281
|
+
render Keystone::Ui::LinkComponent.new(**args)
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def ui_facts(**args)
|
|
285
|
+
render Keystone::Ui::FactsComponent.new(**args)
|
|
286
|
+
end
|
|
287
|
+
|
|
280
288
|
def ui_paragraph(**args)
|
|
281
289
|
render Keystone::Ui::ParagraphComponent.new(**args)
|
|
282
290
|
end
|
data/lib/keystone_ui/safelist.rb
CHANGED
|
@@ -15,6 +15,8 @@ module Keystone
|
|
|
15
15
|
Keystone::Ui::CtaBannerComponent,
|
|
16
16
|
Keystone::Ui::FeatureGridComponent,
|
|
17
17
|
Keystone::Ui::CaptionComponent,
|
|
18
|
+
Keystone::Ui::LinkComponent,
|
|
19
|
+
Keystone::Ui::FactsComponent,
|
|
18
20
|
Keystone::Ui::FigureComponent,
|
|
19
21
|
Keystone::Ui::HeadingComponent,
|
|
20
22
|
Keystone::Ui::HeroComponent,
|
data/lib/keystone_ui/version.rb
CHANGED
|
@@ -70,6 +70,8 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
70
70
|
- `ui_picture` — an image never taller than half the screen, optionally opening its full-size file.
|
|
71
71
|
- `ui_heading` — a heading at one of three sizes, with an optional short note on its right.
|
|
72
72
|
- `ui_caption` — small uppercase muted text placed above a title or a figure.
|
|
73
|
+
- `ui_link` — a text link in the link colour.
|
|
74
|
+
- `ui_facts` — a row of facts, each a count in bold beside its label.
|
|
73
75
|
- `ui_paragraph` — a paragraph of running text.
|
|
74
76
|
- `ui_value_list` — rows of a label and its value, such as a ledger or a byline.
|
|
75
77
|
- `ui_alert` — a banner message, optionally dismissible.
|
|
@@ -410,8 +412,8 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
410
412
|
needs the enclosing form to be multipart.
|
|
411
413
|
- `ui_color_picker(name:, value: "#000000", label: nil)` writes the chosen
|
|
412
414
|
hex value into a hidden input named `name`.
|
|
413
|
-
- `ui_radio_card(name:, value:, label:, hint: nil, info: nil, checked: false)`
|
|
414
|
-
and `ui_checkbox_row(name:, value:, label:, hint: nil, info: nil, checked: false)`
|
|
415
|
+
- `ui_radio_card(name:, value:, label:, hint: nil, info: nil, checked: false, submits: false, show_value: false, full_width: false)`
|
|
416
|
+
and `ui_checkbox_row(name:, value:, label:, hint: nil, info: nil, checked: false, disabled: false)`
|
|
415
417
|
share `hint:` and `info:`. `hint:` is a line always shown under the label.
|
|
416
418
|
`info:` adds an info button beside the label, named "About <label>" for
|
|
417
419
|
screen readers, that shows the text in a panel below while hovered and
|
|
@@ -420,6 +422,14 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
420
422
|
- A checked `ui_checkbox_row` submits `value` under `name`, an unchecked one
|
|
421
423
|
submits nothing, and rows sharing an array name such as `"shown[]"`
|
|
422
424
|
submit the checked values as a list.
|
|
425
|
+
- `submits: true` on `ui_radio_card` submits its form as soon as the card
|
|
426
|
+
is chosen, so a question answered by one choice needs no Next button.
|
|
427
|
+
- `show_value: true` on `ui_radio_card` draws the answer's value in a small
|
|
428
|
+
tag before its label. `full_width: true` makes the card fill its row with
|
|
429
|
+
the tag and label side by side. Stack quiz answers with
|
|
430
|
+
`ui_grid(cols: 1, gap: :sm)`.
|
|
431
|
+
- `disabled: true` on `ui_checkbox_row` draws its checkbox disabled, and a
|
|
432
|
+
disabled checkbox submits nothing.
|
|
423
433
|
- `ui_sortable_list(name:, label:, rows:)` is one field inside a `ui_form`,
|
|
424
434
|
for putting a short list in order. `rows:` is an array of
|
|
425
435
|
`{ id:, label: }` hashes, `label:` names the list for screen readers, and
|
|
@@ -550,10 +560,16 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
550
560
|
|
|
551
561
|
9. Show content and status.
|
|
552
562
|
|
|
553
|
-
- `ui_button(label:, href: nil, method: :get, variant: :primary, size: :md, full_width: false, type: :submit, data: nil)`
|
|
563
|
+
- `ui_button(label:, href: nil, method: :get, variant: :primary, size: :md, full_width: false, type: :submit, data: nil, name: nil, value: nil, hidden: false)`
|
|
554
564
|
renders a link with `href:` and a button without it. `variant:` is
|
|
555
|
-
`:primary` `:secondary` `:danger`, `size:` is `:sm` `:md` `:lg`,
|
|
556
|
-
`type:`
|
|
565
|
+
`:primary` `:secondary` `:danger` `:text`, `size:` is `:sm` `:md` `:lg`,
|
|
566
|
+
and `type:`, `name:` and `value:` apply only to the button.
|
|
567
|
+
- `variant: :text` draws the button as small, underlined, muted text, such
|
|
568
|
+
as a Back or Previous control under a form. A button given `name:` and
|
|
569
|
+
`value:` submits them with its form when pressed. `hidden: true` draws it
|
|
570
|
+
with the `hidden` attribute, for the app's own script to show.
|
|
571
|
+
- `ui_link(label:, href:)` draws a text link in the link colour. Use it in
|
|
572
|
+
place of a hand-written `link_to` with colour classes.
|
|
557
573
|
- With `href:` and `method:` `:post` `:patch` `:put` or `:delete`, it
|
|
558
574
|
renders a button inside its own small form that sends that request to
|
|
559
575
|
`href:` when tapped. Do not write a form around it. It cannot sit inside
|
|
@@ -592,11 +608,16 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
592
608
|
- `ui_accordion(items: [])` — `items:` is `[{ question:, answer: }, ...]`.
|
|
593
609
|
- `ui_heading(text:, size: :md, note: nil)` — `size:` is `:sm` `:md` `:lg`,
|
|
594
610
|
and `note:` puts a short muted note at the right end of the heading's row.
|
|
595
|
-
- `ui_caption(text:)` shows small uppercase muted text above
|
|
611
|
+
- `ui_caption(text:, tone: :muted)` shows small uppercase muted text above
|
|
612
|
+
a title or a figure. `tone: :link` draws it in the link colour with space
|
|
613
|
+
under it, as the label above a quiz question.
|
|
614
|
+
- `ui_facts(facts:)` — each fact is `{ value:, label: }`, drawn as a small
|
|
615
|
+
box with the count in bold beside its label, in a row that wraps.
|
|
596
616
|
- `ui_paragraph(text:)` shows running text.
|
|
597
617
|
- `ui_value_list(rows:, align: :start)` — each row is `{ label:, value: }`
|
|
598
|
-
with optional `note:`, `total: true` and `fallback:`, shown
|
|
599
|
-
is `nil` or empty. `
|
|
618
|
+
with optional `note:`, `total: true`, `right: true` and `fallback:`, shown
|
|
619
|
+
when the value is `nil` or empty. `right: true` draws a green check mark
|
|
620
|
+
after the value, read out as "Right", for an answer that was right. `align: :end` pushes values to the right, as in a ledger.
|
|
600
621
|
|
|
601
622
|
10. Explain figures.
|
|
602
623
|
|
|
@@ -714,12 +735,13 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
714
735
|
13. Build marketing sections.
|
|
715
736
|
|
|
716
737
|
- `ui_hero(title:, subtitle: nil, badge: nil, layout: :split,
|
|
717
|
-
height: :screen)` takes a block holding the call-to-action buttons and
|
|
738
|
+
height: :screen, title_size: :lg)` takes a block holding the call-to-action buttons and
|
|
718
739
|
yields the component, so its `aside` slot can hold an image or panel.
|
|
719
740
|
`layout:` is `:split` or `:centered`. `height: :screen` keeps the hero at
|
|
720
741
|
least the full screen height, and `height: :content` draws it only as
|
|
721
742
|
tall as its content and its padding, for a page with more sections
|
|
722
|
-
after it.
|
|
743
|
+
after it. `title_size: :sm` draws the title smaller, as on a quiz's
|
|
744
|
+
intro page.
|
|
723
745
|
- `ui_cta_banner(title:, subtitle: nil)` takes a block holding the
|
|
724
746
|
buttons.
|
|
725
747
|
- `ui_feature_grid(title:, features:, subtitle: nil)` — `features:` is
|
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.75.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.33.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.33.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: view_component
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -131,6 +131,8 @@ files:
|
|
|
131
131
|
- app/components/keystone/ui/disclosure_component.rb
|
|
132
132
|
- app/components/keystone/ui/empty_state_component.html.erb
|
|
133
133
|
- app/components/keystone/ui/empty_state_component.rb
|
|
134
|
+
- app/components/keystone/ui/facts_component.html.erb
|
|
135
|
+
- app/components/keystone/ui/facts_component.rb
|
|
134
136
|
- app/components/keystone/ui/feature_grid_component.html.erb
|
|
135
137
|
- app/components/keystone/ui/feature_grid_component.rb
|
|
136
138
|
- app/components/keystone/ui/figure_component.html.erb
|
|
@@ -157,6 +159,7 @@ files:
|
|
|
157
159
|
- app/components/keystone/ui/input_component.rb
|
|
158
160
|
- app/components/keystone/ui/line_chart_component.html.erb
|
|
159
161
|
- app/components/keystone/ui/line_chart_component.rb
|
|
162
|
+
- app/components/keystone/ui/link_component.rb
|
|
160
163
|
- app/components/keystone/ui/link_list_component.html.erb
|
|
161
164
|
- app/components/keystone/ui/link_list_component.rb
|
|
162
165
|
- app/components/keystone/ui/list_detail_component.html.erb
|