keystone_ui 0.73.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d022ceb3f34fcc5f5b576284d6e61e546adc129219760b94cc144520f135e67f
4
- data.tar.gz: 187d25d879625ded62755e7ad640cfa06c9cf8bcac07d3931c6f75e6fa9b2786
3
+ metadata.gz: 6255269764037507da7aeffe23291ddceefb9e418d99ba7fe02f25616a162e42
4
+ data.tar.gz: 93a985c80b1f16d968719874b0db5838958a3d8a184e60ceae4081796d57f445
5
5
  SHA512:
6
- metadata.gz: 96cd19e46f7e460bb112e138df25683af5402f791be5e63923c6fb56abf89f94f78e483dcba245d74884c98692b06fd1df2ec2b3472d5c90dd8381bb2d51eb26
7
- data.tar.gz: e4b2ca64098f66d7dc4d6dce92901023693265a5686d4ebbf9063dc05687e6e0ca76dc9b9d23af448cecd7d2b7806aef49817fffac51995d4de1335c359b26b1
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
- def initialize(label:, href: nil, method: :get, variant: :primary, size: :md, full_width: false, type: :submit, data: nil)
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="ks-caption"><%= text %></p>
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,5 @@
1
+ <div class="<%= facts_classes %>">
2
+ <% facts.each do |fact| %>
3
+ <span class="<%= fact_classes %>"><b class="<%= value_classes %>"><%= fact[:value] %></b> <%= fact[:label] %></span>
4
+ <% end %>
5
+ </div>
@@ -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
- TITLE_BASE_CLASSES
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
@@ -0,0 +1,10 @@
1
+ <div class="<%= classes %>">
2
+ <% if detail? %>
3
+ <div class="<%= detail_classes %>">
4
+ <%= detail %>
5
+ </div>
6
+ <% end %>
7
+ <div class="<%= list_classes %>">
8
+ <%= content %>
9
+ </div>
10
+ </div>
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Keystone
4
+ module Ui
5
+ class ListDetailComponent < ViewComponent::Base
6
+ WRAPPER_CLASSES = "grid grid-cols-1 ks-grid-gap-md"
7
+ SPLIT_CLASSES = "lg:grid-cols-3"
8
+ LIST_CLASSES = "min-w-0 lg:order-first"
9
+ DETAIL_CLASSES = "min-w-0 lg:col-span-2"
10
+
11
+ renders_one :detail
12
+
13
+ def classes
14
+ return WRAPPER_CLASSES unless detail?
15
+
16
+ "#{WRAPPER_CLASSES} #{SPLIT_CLASSES}"
17
+ end
18
+
19
+ def list_classes
20
+ LIST_CLASSES
21
+ end
22
+
23
+ def detail_classes
24
+ DETAIL_CLASSES
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,15 +1,23 @@
1
- <label class="inline-block cursor-pointer relative"<%= ' data-controller="stat-card-info"'.html_safe if info? %>>
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
- <span class="<%= header_classes %>">
5
- <span class="<%= label_classes %>"><%= label %></span>
6
- <% if info? %>
7
- <button type="button" class="<%= info_button_classes %>" data-action="click->stat-card-info#toggle" aria-label="About <%= label %>"><%= info_icon.html_safe %></button>
8
- <span class="<%= disclosure_classes %>" data-stat-card-info-target="panel"><%= info %></span>
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
- </span>
11
- <% if hint? %>
12
- <span class="<%= hint_classes %>"><%= hint %></span>
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
@@ -6,8 +6,8 @@ module Keystone
6
6
  TAB_BAR_CLASSES = "ks-tab-bar flex flex-wrap justify-center max-sm:flex-nowrap max-sm:overflow-x-auto max-sm:justify-start"
7
7
  TAB_BASE_CLASSES = "ks-tab text-sm transition max-sm:shrink-0 max-sm:whitespace-nowrap"
8
8
  PANEL_CLASSES = "hidden"
9
- LAYOUT_CLASSES = "flex flex-col"
10
- SUMMARY_CLASSES = "max-sm:order-1"
9
+ LAYOUT_CLASSES = "max-sm:flex max-sm:flex-col"
10
+ SUMMARY_CLASSES = "max-sm:order-1 max-sm:[&>:first-child]:mt-0 max-sm:[&>:last-child]:mb-0"
11
11
  CONTENT_CLASSES = "max-sm:order-1"
12
12
 
13
13
  renders_one :summary
@@ -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"><%= shown_value(row) %></dd>
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
@@ -81,6 +81,10 @@ module KeystoneUiHelper
81
81
  render Keystone::Ui::GridComponent.new(**args), &block
82
82
  end
83
83
 
84
+ def ui_list_detail(**args, &block)
85
+ render Keystone::Ui::ListDetailComponent.new(**args), &block
86
+ end
87
+
84
88
  def ui_panel(**args, &block)
85
89
  render Keystone::Ui::PanelComponent.new(**args), &block
86
90
  end
@@ -273,6 +277,14 @@ module KeystoneUiHelper
273
277
  render Keystone::Ui::CaptionComponent.new(**args)
274
278
  end
275
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
+
276
288
  def ui_paragraph(**args)
277
289
  render Keystone::Ui::ParagraphComponent.new(**args)
278
290
  end
@@ -15,9 +15,12 @@ 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,
23
+ Keystone::Ui::ListDetailComponent,
21
24
  Keystone::Ui::ModalComponent,
22
25
  Keystone::Ui::SelectComponent,
23
26
  Keystone::Ui::BadgeComponent,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.73.0"
4
+ VERSION = "0.75.0"
5
5
  end
@@ -31,6 +31,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
31
31
  - `ui_breadcrumbs` — a line of links to the pages above the current one, shown from `lg:` up.
32
32
  - `ui_section` — a titled block of content with an optional link and action menu in its header.
33
33
  - `ui_grid` — a responsive grid with a column count per breakpoint.
34
+ - `ui_list_detail` — a list beside the detail of the item picked from it, with the detail above the list below `lg:`.
34
35
  - `ui_panel` — a bordered card surface holding any content.
35
36
  - `ui_card_link` — a panel that is one link as a whole.
36
37
  - `ui_card` — a fixed card of title, summary and call-to-action link.
@@ -69,6 +70,8 @@ not available in the app yet, that is `keystone_ui-install`'s job.
69
70
  - `ui_picture` — an image never taller than half the screen, optionally opening its full-size file.
70
71
  - `ui_heading` — a heading at one of three sizes, with an optional short note on its right.
71
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.
72
75
  - `ui_paragraph` — a paragraph of running text.
73
76
  - `ui_value_list` — rows of a label and its value, such as a ledger or a byline.
74
77
  - `ui_alert` — a banner message, optionally dismissible.
@@ -214,6 +217,12 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
214
217
  `cols:` maps `:default` `:sm` `:md` `:lg` to a count from 1 to 12, such as
215
218
  `{ default: 1, md: 3 }`. `gap:` is `:sm` `:md` `:lg` `:xl`, and passing
216
219
  `gap_x:` or `gap_y:` replaces `gap:` entirely.
220
+ - `ui_list_detail` takes no keywords. The block is the list, and
221
+ `layout.with_detail { ... }` is the picked item's detail, left unset when
222
+ nothing is picked. From `lg:` up the list takes the first third of the
223
+ width and the detail the other two thirds beside it. Below `lg:` the detail
224
+ is drawn above the list. With no detail the list takes the full width at
225
+ every size. Write no Tailwind classes of your own to get either order.
217
226
  - `ui_panel(padding: :md, radius: :lg, shadow: true)` — `padding:` is `:sm`
218
227
  `:md` `:lg` and `radius:` is `:md` `:lg` `:xl`.
219
228
  - `ui_card_link(href:, padding: :md, shadow: true)` — `padding:` is `:sm`
@@ -403,8 +412,8 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
403
412
  needs the enclosing form to be multipart.
404
413
  - `ui_color_picker(name:, value: "#000000", label: nil)` writes the chosen
405
414
  hex value into a hidden input named `name`.
406
- - `ui_radio_card(name:, value:, label:, hint: nil, info: nil, checked: false)`
407
- 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)`
408
417
  share `hint:` and `info:`. `hint:` is a line always shown under the label.
409
418
  `info:` adds an info button beside the label, named "About <label>" for
410
419
  screen readers, that shows the text in a panel below while hovered and
@@ -413,6 +422,14 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
413
422
  - A checked `ui_checkbox_row` submits `value` under `name`, an unchecked one
414
423
  submits nothing, and rows sharing an array name such as `"shown[]"`
415
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.
416
433
  - `ui_sortable_list(name:, label:, rows:)` is one field inside a `ui_form`,
417
434
  for putting a short list in order. `rows:` is an array of
418
435
  `{ id:, label: }` hashes, `label:` names the list for screen readers, and
@@ -543,10 +560,16 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
543
560
 
544
561
  9. Show content and status.
545
562
 
546
- - `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)`
547
564
  renders a link with `href:` and a button without it. `variant:` is
548
- `:primary` `:secondary` `:danger`, `size:` is `:sm` `:md` `:lg`, and
549
- `type:` applies only to the button.
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.
550
573
  - With `href:` and `method:` `:post` `:patch` `:put` or `:delete`, it
551
574
  renders a button inside its own small form that sends that request to
552
575
  `href:` when tapped. Do not write a form around it. It cannot sit inside
@@ -585,11 +608,16 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
585
608
  - `ui_accordion(items: [])` — `items:` is `[{ question:, answer: }, ...]`.
586
609
  - `ui_heading(text:, size: :md, note: nil)` — `size:` is `:sm` `:md` `:lg`,
587
610
  and `note:` puts a short muted note at the right end of the heading's row.
588
- - `ui_caption(text:)` shows small uppercase muted text above a title or a figure.
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.
589
616
  - `ui_paragraph(text:)` shows running text.
590
617
  - `ui_value_list(rows:, align: :start)` — each row is `{ label:, value: }`
591
- with optional `note:`, `total: true` and `fallback:`, shown when the value
592
- is `nil` or empty. `align: :end` pushes values to the right, as in a ledger.
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.
593
621
 
594
622
  10. Explain figures.
595
623
 
@@ -707,12 +735,13 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
707
735
  13. Build marketing sections.
708
736
 
709
737
  - `ui_hero(title:, subtitle: nil, badge: nil, layout: :split,
710
- 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
711
739
  yields the component, so its `aside` slot can hold an image or panel.
712
740
  `layout:` is `:split` or `:centered`. `height: :screen` keeps the hero at
713
741
  least the full screen height, and `height: :content` draws it only as
714
742
  tall as its content and its padding, for a page with more sections
715
- after it.
743
+ after it. `title_size: :sm` draws the title smaller, as on a quiz's
744
+ intro page.
716
745
  - `ui_cta_banner(title:, subtitle: nil)` takes a block holding the
717
746
  buttons.
718
747
  - `ui_feature_grid(title:, features:, subtitle: nil)` — `features:` is
@@ -24,6 +24,7 @@ develop:
24
24
  - ui_page
25
25
  - ui_section
26
26
  - ui_grid
27
+ - ui_list_detail
27
28
  - ui_panel
28
29
  - ui_card_link
29
30
  - ui_input
@@ -73,6 +74,8 @@ develop:
73
74
  - ui_picture
74
75
  - ui_heading
75
76
  - ui_caption
77
+ - ui_link
78
+ - ui_facts
76
79
  - ui_paragraph
77
80
  - ui_value_list
78
81
  - ui_breakdown
@@ -138,6 +141,8 @@ sources:
138
141
  - app/components/keystone/ui/bucket_series_component.rb
139
142
  - app/components/keystone/ui/grid_component.rb
140
143
  - app/components/keystone/ui/hero_component.rb
144
+ - app/components/keystone/ui/list_detail_component.rb
145
+ - app/components/keystone/ui/list_detail_component.html.erb
141
146
  - app/components/keystone/ui/input_component.rb
142
147
  - app/components/keystone/ui/line_chart_component.rb
143
148
  - app/components/keystone/ui/mobile_actions_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.73.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.32.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.32.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,8 +159,11 @@ 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
165
+ - app/components/keystone/ui/list_detail_component.html.erb
166
+ - app/components/keystone/ui/list_detail_component.rb
162
167
  - app/components/keystone/ui/mobile_action_component.rb
163
168
  - app/components/keystone/ui/mobile_actions_component.html.erb
164
169
  - app/components/keystone/ui/mobile_actions_component.rb