keystone_ui 0.97.0 → 0.99.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.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/tailwind/keystone_ui_engine/grid_safelist.css +1 -1
  3. data/app/components/keystone/ui/button_row_component.rb +3 -2
  4. data/app/components/keystone/ui/caption_component.html.erb +1 -1
  5. data/app/components/keystone/ui/caption_component.rb +4 -2
  6. data/app/components/keystone/ui/decision_bar_component.html.erb +6 -6
  7. data/app/components/keystone/ui/decision_bar_component.rb +82 -16
  8. data/app/components/keystone/ui/grid_component.rb +18 -3
  9. data/app/components/keystone/ui/link_list_component.rb +3 -2
  10. data/app/components/keystone/ui/mobile_header_component.html.erb +4 -4
  11. data/app/components/keystone/ui/nav_dropdown_component.html.erb +1 -1
  12. data/app/components/keystone/ui/nav_dropdown_component.rb +1 -0
  13. data/app/components/keystone/ui/page_header_component.html.erb +1 -1
  14. data/app/components/keystone/ui/page_header_component.rb +7 -1
  15. data/app/components/keystone/ui/review_card_component.rb +1 -1
  16. data/app/components/keystone/ui/section_component.html.erb +1 -1
  17. data/app/components/keystone/ui/section_component.rb +2 -1
  18. data/app/components/keystone/ui/stat_card_component.html.erb +3 -3
  19. data/app/components/keystone/ui/stat_card_component.rb +19 -3
  20. data/app/components/keystone/ui/tab_switcher_component.html.erb +1 -1
  21. data/app/components/keystone/ui/tab_switcher_component.rb +23 -3
  22. data/app/components/keystone/ui/timeline_component.html.erb +4 -6
  23. data/app/components/keystone/ui/timeline_component.rb +11 -2
  24. data/app/helpers/keystone_ui_helper.rb +2 -2
  25. data/lib/keystone_ui/version.rb +1 -1
  26. data/the_local/agents/keystone_ui-develop.md +66 -26
  27. data/the_local/agents/keystone_ui-info.md +25 -6
  28. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a6d1b9a708eca00e9bbc2d350357bbc6e143412e710d28e5aa0839c3b9e3b25
4
- data.tar.gz: c16b15329182ef72fcfee00f5f93c7c0627e57900d49e7c793ea6c2fe40212af
3
+ metadata.gz: cb91bd02dbb47370be07dad4d4a5052c1a719678e6b4b53407187847ff3a5697
4
+ data.tar.gz: 9a7dfe91f4779e2ae43d3be48a8b3ef2ec7dfdd8f97c74de60dc29491e9b2336
5
5
  SHA512:
6
- metadata.gz: 03e29e1487956c4e3fa22f3446aff808adf896c0f743e76f92d00159825e0323de173afa73d300f453774c59fd8594ffaecb2e4941d9123930b6c45e54beb005
7
- data.tar.gz: b62f7a4d3a0c19f10e9d61801d0d3d77143de191ab5b01791316c6ba87f39717c7a81697bee2456c9039a51a830b17f3cc1e0afd4f802a79eb715295b7f34ee1
6
+ metadata.gz: 5056738e253f18d5f2ca3d732d727a33523cda10054e181e4f2e9a3d6c892d5064ee416edffc2f738bebbe7cc425e8b5add580503dfd36dafbf9f0a9d1b522a8
7
+ data.tar.gz: 40b4f45fc19561b23dbca6e131e071dea1038050eae13470345687baf663157871c4a3036319d747e6a157aaa4e510d61387268c7de6226508997d8897a92c88
@@ -1,4 +1,4 @@
1
1
  /* Safelist: grid-cols classes built from static constants in GridComponent.
2
2
  Belt-and-suspenders — ensures these classes survive JIT purging even if
3
3
  the scanner misses the Ruby hash literals. */
4
- @source inline("grid-cols-1 grid-cols-2 grid-cols-3 grid-cols-4 grid-cols-5 grid-cols-6 grid-cols-7 grid-cols-8 grid-cols-9 grid-cols-10 grid-cols-11 grid-cols-12 sm:grid-cols-1 sm:grid-cols-2 sm:grid-cols-3 sm:grid-cols-4 sm:grid-cols-5 sm:grid-cols-6 sm:grid-cols-7 sm:grid-cols-8 sm:grid-cols-9 sm:grid-cols-10 sm:grid-cols-11 sm:grid-cols-12 md:grid-cols-1 md:grid-cols-2 md:grid-cols-3 md:grid-cols-4 md:grid-cols-5 md:grid-cols-6 md:grid-cols-7 md:grid-cols-8 md:grid-cols-9 md:grid-cols-10 md:grid-cols-11 md:grid-cols-12 lg:grid-cols-1 lg:grid-cols-2 lg:grid-cols-3 lg:grid-cols-4 lg:grid-cols-5 lg:grid-cols-6 lg:grid-cols-7 lg:grid-cols-8 lg:grid-cols-9 lg:grid-cols-10 lg:grid-cols-11 lg:grid-cols-12");
4
+ @source inline("grid-cols-1 grid-cols-2 grid-cols-3 grid-cols-4 grid-cols-5 grid-cols-6 grid-cols-7 grid-cols-8 grid-cols-9 grid-cols-10 grid-cols-11 grid-cols-12 sm:grid-cols-1 sm:grid-cols-2 sm:grid-cols-3 sm:grid-cols-4 sm:grid-cols-5 sm:grid-cols-6 sm:grid-cols-7 sm:grid-cols-8 sm:grid-cols-9 sm:grid-cols-10 sm:grid-cols-11 sm:grid-cols-12 md:grid-cols-1 md:grid-cols-2 md:grid-cols-3 md:grid-cols-4 md:grid-cols-5 md:grid-cols-6 md:grid-cols-7 md:grid-cols-8 md:grid-cols-9 md:grid-cols-10 md:grid-cols-11 md:grid-cols-12 lg:grid-cols-1 lg:grid-cols-2 lg:grid-cols-3 lg:grid-cols-4 lg:grid-cols-5 lg:grid-cols-6 lg:grid-cols-7 lg:grid-cols-8 lg:grid-cols-9 lg:grid-cols-10 lg:grid-cols-11 lg:grid-cols-12 xl:grid-cols-1 xl:grid-cols-2 xl:grid-cols-3 xl:grid-cols-4 xl:grid-cols-5 xl:grid-cols-6 xl:grid-cols-7 xl:grid-cols-8 xl:grid-cols-9 xl:grid-cols-10 xl:grid-cols-11 xl:grid-cols-12 grid-cols-[minmax(0,3fr)_minmax(0,2fr)] sm:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] md:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] xl:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] grid-cols-[minmax(0,2fr)_minmax(0,3fr)] sm:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] lg:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] xl:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]");
@@ -7,12 +7,13 @@ module Keystone
7
7
  EQUAL_WIDTH_CLASSES = "*:flex-1 *:whitespace-nowrap"
8
8
  PHONE_EQUAL_WIDTH_CLASSES = "max-sm:*:flex-1 max-sm:*:whitespace-nowrap"
9
9
 
10
- def initialize(equal_width: false)
10
+ def initialize(equal_width: false, class: nil)
11
11
  @equal_width = equal_width
12
+ @extra_classes = binding.local_variable_get(:class)
12
13
  end
13
14
 
14
15
  def row_classes
15
- [ ROW_CLASSES, equal_width_classes ].compact.join(" ")
16
+ [ ROW_CLASSES, equal_width_classes, @extra_classes ].compact.join(" ")
16
17
  end
17
18
 
18
19
  private
@@ -1 +1 @@
1
- <p class="<%= classes %>"><%= text %></p>
1
+ <p class="<%= classes %>"><%= content || text %></p>
@@ -4,16 +4,18 @@ module Keystone
4
4
  module Ui
5
5
  class CaptionComponent < ViewComponent::Base
6
6
  TONE_CLASSES = { muted: "ks-caption", link: "ks-caption ks-caption-link" }.freeze
7
+ NORMAL_CASE_CLASSES = "ks-caption-normal-case"
7
8
 
8
9
  attr_reader :text
9
10
 
10
- def initialize(text:, tone: :muted)
11
+ def initialize(text: nil, tone: :muted, normal_case: false)
12
+ @normal_case = normal_case
11
13
  @text = text
12
14
  @tone = tone
13
15
  end
14
16
 
15
17
  def classes
16
- TONE_CLASSES.fetch(@tone)
18
+ [ TONE_CLASSES.fetch(@tone), (NORMAL_CASE_CLASSES if @normal_case) ].compact.join(" ")
17
19
  end
18
20
  end
19
21
  end
@@ -1,15 +1,15 @@
1
- <%= form_with url: @url, method: @method, class: FORM_CLASSES do %>
2
- <div class="<%= BAR_CLASSES %>">
1
+ <%= form_with url: @url, method: @method, class: form_classes do %>
2
+ <div class="<%= bar_classes %>">
3
3
  <% if @note %>
4
- <label class="<%= NOTE_CLASSES %>"><span class="<%= NOTE_LABEL_CLASSES %>"><%= @note[:label] %></span><%= render Keystone::Ui::InputComponent.new(name: @note[:name], placeholder: @note[:placeholder]) %></label>
4
+ <label class="<%= note_classes %>"><span class="<%= NOTE_LABEL_CLASSES %>"><%= @note[:label] %></span><%= render Keystone::Ui::InputComponent.new(name: @note[:name], placeholder: @note[:placeholder]) %></label>
5
5
  <% end %>
6
6
  <%= buttons %>
7
7
  </div>
8
8
  <% if @hint %>
9
- <p class="<%= HINT_CLASSES %>"><%= @hint %></p>
9
+ <p class="<%= hint_classes %>"><%= @hint %></p>
10
10
  <% end %>
11
11
  <% end %>
12
- <div class="<%= SPACER_CLASSES %>" data-decision-bar-spacer inert>
13
- <div class="<%= BAR_CLASSES %> <%= BAR_COPY_CLASSES %>"><%= buttons %></div>
12
+ <div class="<%= spacer_classes %>" data-decision-bar-spacer inert>
13
+ <div class="<%= bar_classes %> <%= BAR_COPY_CLASSES %>"><%= buttons %></div>
14
14
  <div class="<%= TAB_BAR_ROOM_CLASSES %>"></div>
15
15
  </div>
@@ -3,22 +3,68 @@
3
3
  module Keystone
4
4
  module Ui
5
5
  class DecisionBarComponent < ViewComponent::Base
6
- FORM_CLASSES = "ks-panel ks-panel-radius-md ks-panel-padding-sm flex flex-wrap items-center ks-grid-gap-sm max-sm:contents"
7
- BAR_CLASSES = "ks-bottom-action max-sm:flex-col ks-grid-gap-sm sm:contents hotwire-native:bottom-0"
8
- PRIMARY_CLASSES = "max-sm:order-first max-sm:*:w-full max-sm:*:min-h-12"
9
- ACTION_CLASSES = "flex *:flex-1"
10
- PHONE_ONLY_CLASSES = "sm:hidden"
11
- PHONE_ORDER_CLASSES = { 1 => "max-sm:order-1", 2 => "max-sm:order-2", 3 => "max-sm:order-3" }.freeze
12
- PHONE_LABEL_CLASSES = "sm:hidden"
13
- FULL_LABEL_CLASSES = "max-sm:hidden"
14
- HINT_CLASSES = "ks-hint basis-full max-sm:hidden"
6
+ FORM_CLASSES = {
7
+ sm: "ks-panel ks-panel-radius-md ks-panel-padding-sm flex flex-wrap items-center ks-grid-gap-sm max-sm:contents",
8
+ md: "ks-panel ks-panel-radius-md ks-panel-padding-sm flex flex-wrap items-center ks-grid-gap-sm max-md:contents",
9
+ lg: "ks-panel ks-panel-radius-md ks-panel-padding-sm flex flex-wrap items-center ks-grid-gap-sm max-lg:contents"
10
+ }.freeze
11
+ BAR_CLASSES = {
12
+ sm: "ks-bottom-action max-sm:flex-col ks-grid-gap-sm sm:contents hotwire-native:bottom-0",
13
+ md: "ks-bottom-action max-md:flex-col ks-grid-gap-sm md:contents hotwire-native:bottom-0",
14
+ lg: "ks-bottom-action max-lg:flex-col ks-grid-gap-sm lg:contents hotwire-native:bottom-0"
15
+ }.freeze
16
+ PRIMARY_CLASSES = {
17
+ sm: "max-sm:order-first max-sm:*:w-full max-sm:*:min-h-12",
18
+ md: "max-md:order-first max-md:*:w-full max-md:*:min-h-12",
19
+ lg: "max-lg:order-first max-lg:*:w-full max-lg:*:min-h-12"
20
+ }.freeze
21
+ ACTION_CLASSES = "flex *:flex-1 *:min-w-0 *:wrap-break-word *:text-center"
22
+ SECONDARY_ROW_CLASSES = {
23
+ sm: "max-sm:*:flex-1 max-sm:*:min-w-0",
24
+ md: "max-md:*:flex-1 max-md:*:min-w-0",
25
+ lg: "max-lg:*:flex-1 max-lg:*:min-w-0"
26
+ }.freeze
27
+ PHONE_ONLY_CLASSES = {
28
+ sm: "sm:hidden",
29
+ md: "md:hidden",
30
+ lg: "lg:hidden"
31
+ }.freeze
32
+ PHONE_ORDER_CLASSES = {
33
+ sm: { 1 => "max-sm:order-1", 2 => "max-sm:order-2", 3 => "max-sm:order-3" }.freeze,
34
+ md: { 1 => "max-md:order-1", 2 => "max-md:order-2", 3 => "max-md:order-3" }.freeze,
35
+ lg: { 1 => "max-lg:order-1", 2 => "max-lg:order-2", 3 => "max-lg:order-3" }.freeze
36
+ }.freeze
37
+ PHONE_LABEL_CLASSES = {
38
+ sm: "sm:hidden",
39
+ md: "md:hidden",
40
+ lg: "lg:hidden"
41
+ }.freeze
42
+ FULL_LABEL_CLASSES = {
43
+ sm: "max-sm:hidden",
44
+ md: "max-md:hidden",
45
+ lg: "max-lg:hidden"
46
+ }.freeze
47
+ HINT_CLASSES = {
48
+ sm: "ks-hint basis-full max-sm:hidden",
49
+ md: "ks-hint basis-full max-md:hidden",
50
+ lg: "ks-hint basis-full max-lg:hidden"
51
+ }.freeze
15
52
  BAR_COPY_CLASSES = "!static invisible"
16
- SPACER_CLASSES = "sm:hidden"
53
+ SPACER_CLASSES = {
54
+ sm: "sm:hidden",
55
+ md: "md:hidden",
56
+ lg: "lg:hidden"
57
+ }.freeze
17
58
  TAB_BAR_ROOM_CLASSES = "hidden h-(--ks-bottom-nav-height) [html:not(.hotwire-native)_body:has(.ks-bottom-nav)_&]:block"
18
59
  NOTE_LABEL_CLASSES = "ks-label shrink-0"
19
- NOTE_CLASSES = "flex flex-1 basis-60 items-center ks-grid-gap-sm max-sm:hidden"
60
+ NOTE_CLASSES = {
61
+ sm: "flex flex-1 basis-60 items-center ks-grid-gap-sm max-sm:hidden",
62
+ md: "flex flex-1 basis-60 items-center ks-grid-gap-sm max-md:hidden",
63
+ lg: "flex flex-1 basis-60 items-center ks-grid-gap-sm max-lg:hidden"
64
+ }.freeze
20
65
 
21
- def initialize(url:, primary:, actions: [], note: nil, hint: nil, method: :post)
66
+ def initialize(url:, primary:, actions: [], note: nil, hint: nil, method: :post, breakpoint: :sm)
67
+ @breakpoint = breakpoint
22
68
  @url = url
23
69
  @primary = primary
24
70
  @actions = actions
@@ -27,6 +73,26 @@ module Keystone
27
73
  @method = method
28
74
  end
29
75
 
76
+ def bar_classes
77
+ BAR_CLASSES.fetch(@breakpoint)
78
+ end
79
+
80
+ def form_classes
81
+ FORM_CLASSES.fetch(@breakpoint)
82
+ end
83
+
84
+ def note_classes
85
+ NOTE_CLASSES.fetch(@breakpoint)
86
+ end
87
+
88
+ def hint_classes
89
+ HINT_CLASSES.fetch(@breakpoint)
90
+ end
91
+
92
+ def spacer_classes
93
+ SPACER_CLASSES.fetch(@breakpoint)
94
+ end
95
+
30
96
  def buttons
31
97
  safe_join([ secondary_row, primary_button ])
32
98
  end
@@ -34,13 +100,13 @@ module Keystone
34
100
  private
35
101
 
36
102
  def secondary_row
37
- render(ButtonRowComponent.new(equal_width: :phone)) do
103
+ render(ButtonRowComponent.new(class: SECONDARY_ROW_CLASSES.fetch(@breakpoint))) do
38
104
  safe_join(@actions.map { |action| secondary_button(action) })
39
105
  end
40
106
  end
41
107
 
42
108
  def secondary_button(action)
43
- tag.div(class: [ ACTION_CLASSES, (PHONE_ONLY_CLASSES if action[:phone_only]), PHONE_ORDER_CLASSES[action[:phone_order]] ].compact.join(" ")) do
109
+ tag.div(class: [ ACTION_CLASSES, (PHONE_ONLY_CLASSES.fetch(@breakpoint) if action[:phone_only]), PHONE_ORDER_CLASSES.fetch(@breakpoint)[action[:phone_order]] ].compact.join(" ")) do
44
110
  render ButtonComponent.new(variant: :secondary, **action.except(:phone_only, :phone_order, :phone_label), label: action_label(action))
45
111
  end
46
112
  end
@@ -48,11 +114,11 @@ module Keystone
48
114
  def action_label(action)
49
115
  return action[:label] unless action[:phone_label]
50
116
 
51
- safe_join([ tag.span(action[:label], class: FULL_LABEL_CLASSES), tag.span(action[:phone_label], class: PHONE_LABEL_CLASSES) ])
117
+ safe_join([ tag.span(action[:label], class: FULL_LABEL_CLASSES.fetch(@breakpoint)), tag.span(action[:phone_label], class: PHONE_LABEL_CLASSES.fetch(@breakpoint)) ])
52
118
  end
53
119
 
54
120
  def primary_button
55
- tag.div(class: PRIMARY_CLASSES) { render ButtonComponent.new(**@primary) }
121
+ tag.div(class: PRIMARY_CLASSES.fetch(@breakpoint)) { render ButtonComponent.new(**@primary) }
56
122
  end
57
123
  end
58
124
  end
@@ -10,10 +10,17 @@ module Keystone
10
10
  default: { 1 => "grid-cols-1", 2 => "grid-cols-2", 3 => "grid-cols-3", 4 => "grid-cols-4", 5 => "grid-cols-5", 6 => "grid-cols-6", 7 => "grid-cols-7", 8 => "grid-cols-8", 9 => "grid-cols-9", 10 => "grid-cols-10", 11 => "grid-cols-11", 12 => "grid-cols-12" }.freeze,
11
11
  sm: { 1 => "sm:grid-cols-1", 2 => "sm:grid-cols-2", 3 => "sm:grid-cols-3", 4 => "sm:grid-cols-4", 5 => "sm:grid-cols-5", 6 => "sm:grid-cols-6", 7 => "sm:grid-cols-7", 8 => "sm:grid-cols-8", 9 => "sm:grid-cols-9", 10 => "sm:grid-cols-10", 11 => "sm:grid-cols-11", 12 => "sm:grid-cols-12" }.freeze,
12
12
  md: { 1 => "md:grid-cols-1", 2 => "md:grid-cols-2", 3 => "md:grid-cols-3", 4 => "md:grid-cols-4", 5 => "md:grid-cols-5", 6 => "md:grid-cols-6", 7 => "md:grid-cols-7", 8 => "md:grid-cols-8", 9 => "md:grid-cols-9", 10 => "md:grid-cols-10", 11 => "md:grid-cols-11", 12 => "md:grid-cols-12" }.freeze,
13
- lg: { 1 => "lg:grid-cols-1", 2 => "lg:grid-cols-2", 3 => "lg:grid-cols-3", 4 => "lg:grid-cols-4", 5 => "lg:grid-cols-5", 6 => "lg:grid-cols-6", 7 => "lg:grid-cols-7", 8 => "lg:grid-cols-8", 9 => "lg:grid-cols-9", 10 => "lg:grid-cols-10", 11 => "lg:grid-cols-11", 12 => "lg:grid-cols-12" }.freeze
13
+ lg: { 1 => "lg:grid-cols-1", 2 => "lg:grid-cols-2", 3 => "lg:grid-cols-3", 4 => "lg:grid-cols-4", 5 => "lg:grid-cols-5", 6 => "lg:grid-cols-6", 7 => "lg:grid-cols-7", 8 => "lg:grid-cols-8", 9 => "lg:grid-cols-9", 10 => "lg:grid-cols-10", 11 => "lg:grid-cols-11", 12 => "lg:grid-cols-12" }.freeze,
14
+ xl: { 1 => "xl:grid-cols-1", 2 => "xl:grid-cols-2", 3 => "xl:grid-cols-3", 4 => "xl:grid-cols-4", 5 => "xl:grid-cols-5", 6 => "xl:grid-cols-6", 7 => "xl:grid-cols-7", 8 => "xl:grid-cols-8", 9 => "xl:grid-cols-9", 10 => "xl:grid-cols-10", 11 => "xl:grid-cols-11", 12 => "xl:grid-cols-12" }.freeze
14
15
  }.freeze
15
16
 
16
- def initialize(cols: { default: 1 }, gap: :md, gap_x: nil, gap_y: nil)
17
+ WIDE_COL_CLASSES = {
18
+ first: { default: "grid-cols-[minmax(0,3fr)_minmax(0,2fr)]", sm: "sm:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]", md: "md:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]", lg: "lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]", xl: "xl:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]" }.freeze,
19
+ second: { default: "grid-cols-[minmax(0,2fr)_minmax(0,3fr)]", sm: "sm:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]", md: "md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]", lg: "lg:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]", xl: "xl:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]" }.freeze
20
+ }.freeze
21
+
22
+ def initialize(cols: { default: 1 }, gap: :md, gap_x: nil, gap_y: nil, wide: nil)
23
+ @wide = wide
17
24
  @cols = cols
18
25
  @gap = gap
19
26
  @gap_x = gap_x
@@ -29,10 +36,18 @@ module Keystone
29
36
  tokens << GAP_CLASSES.fetch(@gap)
30
37
  end
31
38
  @cols.each do |breakpoint, count|
32
- tokens << COL_CLASSES.fetch(breakpoint).fetch(count)
39
+ tokens << col_class(breakpoint, count)
33
40
  end
34
41
  tokens.join(" ")
35
42
  end
43
+
44
+ private
45
+
46
+ def col_class(breakpoint, count)
47
+ return WIDE_COL_CLASSES.fetch(@wide).fetch(breakpoint) if @wide && count == 2
48
+
49
+ COL_CLASSES.fetch(breakpoint).fetch(count)
50
+ end
36
51
  end
37
52
  end
38
53
  end
@@ -7,9 +7,10 @@ module Keystone
7
7
  CURRENT_ROW_CLASSES = "ks-value-list-row-current"
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
+ TOP_LINE_BADGE_CLASSES = "min-w-0 whitespace-normal"
10
11
  TEXT_CLASSES = "min-w-0 flex-1"
11
12
  TOP_LINE_CLASSES = "flex items-center justify-between ks-grid-gap-sm whitespace-nowrap"
12
- TOP_LINE_TEXT_CLASSES = "ks-value-list-note min-w-0 truncate"
13
+ TOP_LINE_TEXT_CLASSES = "ks-value-list-note shrink-0 max-w-full truncate"
13
14
  LABEL_CLASSES = "ks-paragraph ks-settings-link-label block"
14
15
  SUBTITLE_CLASSES = "ks-value-list-note"
15
16
  VALUE_CLASSES = "ks-value-list-value shrink-0"
@@ -30,7 +31,7 @@ module Keystone
30
31
  end
31
32
 
32
33
  def top_line_badge(row)
33
- BadgeComponent.new(**row[:top_line][:badge])
34
+ BadgeComponent.new(**row[:top_line][:badge], class: TOP_LINE_BADGE_CLASSES)
34
35
  end
35
36
  end
36
37
  end
@@ -1,11 +1,11 @@
1
1
  <div class="<%= ROW_CLASSES %>">
2
- <div class="<%= WRAPPER_CLASSES %>">
3
- <% if @back_url %>
2
+ <% if @back_url %>
3
+ <div class="<%= WRAPPER_CLASSES %>">
4
4
  <%= link_to @back_url, class: BACK_LINK_CLASSES, aria: { label: "Back" } do %>
5
5
  <%= BACK_ICON.html_safe %>
6
6
  <% end %>
7
- <% end %>
8
- </div>
7
+ </div>
8
+ <% end %>
9
9
  <span class="<%= TITLE_CLASSES %>">
10
10
  <% if @overline.present? %>
11
11
  <span class="<%= OVERLINE_CLASSES %>"><%= @overline %></span>
@@ -2,7 +2,7 @@
2
2
  <button type="button"
3
3
  data-action="click->dropdown#toggle click@window->dropdown#hide"
4
4
  class="<%= trigger_classes %>">
5
- <%= @title %>
5
+ <span class="<%= TITLE_CLASSES %>"><%= @title %></span>
6
6
  <%= CARET_ICON.html_safe %>
7
7
  </button>
8
8
  <nav data-dropdown-target="menu" class="<%= MENU_CLASSES %>">
@@ -6,6 +6,7 @@ module Keystone
6
6
  WRAPPER_CLASSES = "ks-nav-dropdown"
7
7
  MENU_CLASSES = "ks-nav-dropdown-menu hidden"
8
8
  TRIGGER_BASE = "ks-nav-dropdown-trigger"
9
+ TITLE_CLASSES = "min-w-0 truncate"
9
10
  ACTIVE_CLASS = "active"
10
11
  CARET_ICON = <<~SVG.freeze
11
12
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="ks-nav-dropdown-caret">
@@ -18,7 +18,7 @@
18
18
  <h1 class="<%= title_classes %>"><%= @title %></h1>
19
19
  <% end %>
20
20
  <% if subtitle? %>
21
- <p class="<%= SUBTITLE_CLASSES %>"><%= subtitle_text %></p>
21
+ <p class="<%= subtitle_classes %>"><%= subtitle_text %></p>
22
22
  <% end %>
23
23
  </div>
24
24
  <% if actions? %>
@@ -6,6 +6,7 @@ module Keystone
6
6
  WRAPPER_CLASSES = "ks-page-header"
7
7
  TITLE_CLASSES = "ks-page-header-title"
8
8
  SUBTITLE_CLASSES = "ks-page-header-subtitle"
9
+ MONO_SUBTITLE_CLASSES = "ks-page-header-subtitle font-mono"
9
10
  ACTIONS_CLASSES = "page-header-actions ks-page-header-actions"
10
11
  PHONE_TITLE_CLASSES = "ks-page-header-title max-sm:[body:has(.ks-mobile-header-title)_&]:hidden"
11
12
  PHONE_WRAPPER_CLASSES = "max-sm:flex max-sm:flex-wrap max-sm:items-center max-sm:justify-between"
@@ -16,7 +17,8 @@ module Keystone
16
17
 
17
18
  attr_reader :title, :action_url, :action_label, :action_method, :action_confirm
18
19
 
19
- def initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, action_confirm: nil, action_at_bottom: false, badges: [], menu: [], class: nil)
20
+ def initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, action_confirm: nil, action_at_bottom: false, badges: [], menu: [], subtitle_mono: false, class: nil)
21
+ @subtitle_mono = subtitle_mono
20
22
  @title = title
21
23
  @subtitle = subtitle
22
24
  @action_url = action_url
@@ -78,6 +80,10 @@ module Keystone
78
80
  !@subtitle.nil?
79
81
  end
80
82
 
83
+ def subtitle_classes
84
+ @subtitle_mono ? MONO_SUBTITLE_CLASSES : SUBTITLE_CLASSES
85
+ end
86
+
81
87
  def subtitle_text
82
88
  @subtitle
83
89
  end
@@ -30,7 +30,7 @@ module Keystone
30
30
 
31
31
  def action_row
32
32
  render(ButtonRowComponent.new(equal_width: true)) do
33
- safe_join(@actions.map { |action| render ButtonComponent.new(variant: :secondary, size: :sm, **action) })
33
+ safe_join(@actions.map { |action| render ButtonComponent.new(variant: :secondary, size: :sm, **action) }, " ")
34
34
  end
35
35
  end
36
36
 
@@ -1,7 +1,7 @@
1
1
  <div class="<%= classes %>">
2
2
  <% if header? %>
3
3
  <div class="<%= header_classes %>">
4
- <div>
4
+ <div class="<%= TITLE_WRAPPER_CLASSES %>">
5
5
  <h2 class="<%= TITLE_CLASSES %>"><%= @title %></h2>
6
6
  <% if @subtitle %>
7
7
  <p class="<%= SUBTITLE_CLASSES %>"><%= @subtitle %></p>
@@ -7,10 +7,11 @@ module Keystone
7
7
  HEADER_CLASSES = "ks-section-header"
8
8
  HEADER_WITH_ASIDE_CLASSES = "ks-section-header ks-grid-gap-sm max-sm:flex-wrap"
9
9
  TITLE_CLASSES = "ks-section-title"
10
+ TITLE_WRAPPER_CLASSES = "min-w-0"
10
11
  SUBTITLE_CLASSES = "ks-section-subtitle"
11
12
  ACTION_CLASSES = "ks-section-action"
12
13
  ACTIONS_CLASSES = "flex items-center shrink-0 ks-grid-gap-sm"
13
- ASIDE_CLASSES = "ks-heading-note ml-auto max-sm:basis-full max-sm:order-last"
14
+ ASIDE_CLASSES = "ks-heading-note ml-auto wrap-normal sm:shrink-0 max-sm:basis-full max-sm:order-last"
14
15
 
15
16
  renders_one :aside
16
17
 
@@ -12,8 +12,8 @@
12
12
  <% end %>
13
13
  </div>
14
14
  <p class="<%= value_classes %>">
15
- <% if missing? %><span class="<%= Keystone::Ui::StatCardComponent::FALLBACK_CLASSES %>"><%= fallback %></span><% elsif link? %><a href="<%= href %>" class="<%= value_link_classes %>"><%= value %></a><% else %><%= value %><% end %><% if suffix? %><span class="<%= suffix_classes %>"> <%= suffix %></span><% end %>
15
+ <% if missing? %><span class="<%= Keystone::Ui::StatCardComponent::FALLBACK_CLASSES %>"><%= fallback %></span><% elsif link? %><a href="<%= href %>" class="<%= value_link_classes %>"><%= value %></a><% else %><%= value %><% end %><% if suffix? %><span class="<%= suffix_classes %>"> <%= suffix %></span><% end %><% if compact? && change? %><span class="<%= compact_change_classes %>"><%= change_label %></span><% end %><% if compact? && note %><span class="<%= Keystone::Ui::StatCardComponent::COMPACT_NOTE_CLASSES %>"><%= note %></span><% end %>
16
16
  </p>
17
- <% if note %><p class="<%= Keystone::Ui::StatCardComponent::NOTE_CLASSES %>"><%= note %></p><% end %>
18
- <p class="<%= change_row_classes %>"><%= change_label %></p>
17
+ <% if note && !compact? %><p class="<%= Keystone::Ui::StatCardComponent::NOTE_CLASSES %>"><%= note %></p><% end %>
18
+ <% unless compact? %><p class="<%= change_row_classes %>"><%= change_label %></p><% end %>
19
19
  </div>
@@ -7,14 +7,19 @@ module Keystone
7
7
  HEADER_CLASSES = "ks-stat-card-header flex items-start justify-between"
8
8
  CARD_CLASSES = "ks-metric-card relative"
9
9
  PLAIN_CLASSES = "ks-metric-plain relative"
10
+ COMPACT_CLASSES = "ks-metric-card ks-metric-card-compact relative"
10
11
  LABEL_CLASSES = "ks-stat-card-label text-sm"
12
+ COMPACT_LABEL_CLASSES = "ks-stat-card-label text-xs"
11
13
  VALUE_BASE_CLASSES = "ks-stat-card-value text-3xl"
14
+ COMPACT_VALUE_CLASSES = "ks-stat-card-value ks-stat-card-value-compact flex flex-wrap items-baseline text-lg leading-6"
12
15
  SUFFIX_CLASSES = "ks-stat-card-suffix text-lg"
13
16
  DISCLOSURE_CLASSES = "ks-stat-card-disclosure hidden peer-hover:block peer-focus-visible:block absolute inset-x-0 top-full z-10 text-sm"
14
17
  CHANGE_ROW_CLASSES = "ks-stat-card-change h-5 text-sm"
18
+ COMPACT_CHANGE_CLASSES = "ks-stat-card-change text-xs"
15
19
  VALUE_LINK_CLASSES = "hover:underline focus:outline-none focus-visible:underline"
16
20
  INFO_BUTTON_CLASSES = "ks-stat-card-info peer shrink-0 transition"
17
21
  NOTE_CLASSES = "ks-stat-card-note text-sm"
22
+ COMPACT_NOTE_CLASSES = "ks-stat-card-note text-xs"
18
23
  FALLBACK_CLASSES = "ks-stat-card-fallback"
19
24
 
20
25
  INFO_ICON = <<~SVG.freeze
@@ -31,7 +36,8 @@ module Keystone
31
36
 
32
37
  attr_reader :label, :value, :suffix, :definition, :calculation, :change, :href, :note
33
38
 
34
- def initialize(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil, note: nil, plain: false, fallback: nil)
39
+ def initialize(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil, note: nil, plain: false, fallback: nil, compact: false)
40
+ @compact = compact
35
41
  @label = label
36
42
  @fallback = fallback
37
43
  @note = note
@@ -54,15 +60,17 @@ module Keystone
54
60
  end
55
61
 
56
62
  def classes
63
+ return COMPACT_CLASSES if @compact
64
+
57
65
  @plain ? PLAIN_CLASSES : CARD_CLASSES
58
66
  end
59
67
 
60
68
  def label_classes
61
- LABEL_CLASSES
69
+ @compact ? COMPACT_LABEL_CLASSES : LABEL_CLASSES
62
70
  end
63
71
 
64
72
  def value_classes
65
- "#{VALUE_BASE_CLASSES} #{VARIANT_CLASSES.fetch(@variant)}"
73
+ "#{@compact ? COMPACT_VALUE_CLASSES : VALUE_BASE_CLASSES} #{VARIANT_CLASSES.fetch(@variant)}"
66
74
  end
67
75
 
68
76
  def suffix_classes
@@ -102,6 +110,14 @@ module Keystone
102
110
  "#{CHANGE_ROW_CLASSES} #{change_classes}"
103
111
  end
104
112
 
113
+ def compact?
114
+ @compact
115
+ end
116
+
117
+ def compact_change_classes
118
+ "#{COMPACT_CHANGE_CLASSES} #{change_classes}"
119
+ end
120
+
105
121
  def change_classes
106
122
  return "ks-tone-muted" if !change? || @change.zero?
107
123
  return "ks-tone-danger" if @change.negative?
@@ -2,7 +2,7 @@
2
2
  <% tab_row = capture do %>
3
3
  <nav class="<%= classes %>">
4
4
  <% tabs.each do |tab| %>
5
- <a href="<%= tab[:href] %>" data-turbo-action="replace" class="<%= tab[:current] ? tab_classes : TAB_BASE_CLASSES %>"<% if tab[:current] %> aria-current="page" data-active<% end %>><%= tab[:label] %></a>
5
+ <a href="<%= tab[:href] %>" data-turbo-action="replace" class="<%= tab[:current] ? tab_classes : base_tab_classes %>"<% if tab[:current] %> aria-current="page" data-active<% end %>><%= tab[:label] %><% if count?(tab) %> <%= count_mark(tab[:count]) %><% end %></a>
6
6
  <% end %>
7
7
  </nav>
8
8
  <% end %>
@@ -4,7 +4,11 @@ module Keystone
4
4
  module Ui
5
5
  class TabSwitcherComponent < ViewComponent::Base
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
+ START_TAB_BAR_CLASSES = "ks-tab-bar flex flex-wrap justify-start max-sm:flex-nowrap max-sm:overflow-x-auto"
8
+ TAB_BAR_CLASSES_BY_ALIGN = { center: TAB_BAR_CLASSES, start: START_TAB_BAR_CLASSES }.freeze
9
+ SHAPE_CLASSES = { pills: "ks-tab-bar-pills", underline: "ks-tab-bar-underline" }.freeze
7
10
  TAB_BASE_CLASSES = "ks-tab text-sm transition max-sm:shrink-0 max-sm:whitespace-nowrap"
11
+ SHAPED_TAB_BASE_CLASSES = "ks-tab transition max-sm:shrink-0 max-sm:whitespace-nowrap"
8
12
  PANEL_CLASSES = "hidden"
9
13
  LAYOUT_CLASSES = "max-sm:flex max-sm:flex-col"
10
14
  SUMMARY_CLASSES = "max-sm:order-1 max-sm:[&>:first-child]:mt-0 max-sm:[&>:last-child]:mb-0"
@@ -14,8 +18,10 @@ module Keystone
14
18
 
15
19
  attr_reader :tabs
16
20
 
17
- def initialize(tabs:)
21
+ def initialize(tabs:, align: :center, shape: nil)
18
22
  @tabs = tabs
23
+ @align = align
24
+ @shape = shape
19
25
  end
20
26
 
21
27
  def link_tabs?
@@ -23,11 +29,25 @@ module Keystone
23
29
  end
24
30
 
25
31
  def classes
26
- TAB_BAR_CLASSES
32
+ [ TAB_BAR_CLASSES_BY_ALIGN.fetch(@align), SHAPE_CLASSES[@shape] ].compact.join(" ")
33
+ end
34
+
35
+ def base_tab_classes
36
+ @shape ? SHAPED_TAB_BASE_CLASSES : TAB_BASE_CLASSES
27
37
  end
28
38
 
29
39
  def tab_classes
30
- "#{TAB_BASE_CLASSES} ks-tab-active"
40
+ "#{base_tab_classes} ks-tab-active"
41
+ end
42
+
43
+ def count?(tab)
44
+ tab[:count].to_i.positive? || (tab[:show_zero] && !tab[:count].nil?)
45
+ end
46
+
47
+ def count_mark(count)
48
+ return render(BadgeComponent.new(label: count.to_s, variant: :info)) unless @shape
49
+
50
+ content_tag(:span, count, class: "ks-tab-count")
31
51
  end
32
52
 
33
53
  def panel_classes
@@ -36,11 +36,9 @@
36
36
  <% end %>
37
37
  <% end %>
38
38
  <% end %>
39
- <% unless one_line %>
40
- <div class="<%= AXIS_CLASSES %>">
41
- <span data-timeline-axis-start><%= axis_start_label %></span>
42
- <span data-timeline-axis-end><%= total_duration %></span>
43
- </div>
44
- <% end %>
39
+ <div class="<%= axis_classes %>">
40
+ <span data-timeline-axis-start><%= axis_start_label %></span>
41
+ <span data-timeline-axis-end><%= axis_end_label %></span>
42
+ </div>
45
43
  </div>
46
44
  <% end %>
@@ -14,13 +14,14 @@ module Keystone
14
14
  TIMELINE_CLASSES = "flex flex-col ks-grid-gap-sm"
15
15
  ONE_LINE_TIMELINE_CLASSES = "sm:grid sm:grid-cols-[fit-content(40%)_1fr_auto]"
16
16
  ONE_LINE_ROW_CLASSES = "grid grid-cols-[1fr_auto] items-center ks-grid-gap-x-sm text-sm sm:col-span-3 sm:grid-cols-subgrid"
17
- ONE_LINE_LABEL_CLASSES = "ks-meter-label min-w-0 truncate sm:mb-0"
17
+ ONE_LINE_LABEL_CLASSES = "ks-meter-label min-w-0 wrap-break-word sm:truncate sm:mb-0"
18
18
  ONE_LINE_TRACK_CLASSES = "col-span-2 row-start-2 sm:col-span-1 sm:col-start-2 sm:row-start-1"
19
19
  ONE_LINE_STATUS_CLASSES = "ks-meter-label justify-self-end sm:mb-0"
20
20
  ROW_TEXT_CLASSES = "ks-meter-label flex justify-between text-sm"
21
21
  AXIS_CLASSES = "ks-meter-label flex justify-between text-xs"
22
22
  ROW_STATUS_CLASSES = "flex items-center ks-grid-gap-sm"
23
- ONE_LINE_AXIS_CLASSES = "ks-meter-label relative h-4 text-xs sm:col-start-2"
23
+ PHONE_AXIS_CLASSES = "ks-meter-label flex justify-between text-xs sm:col-span-3 sm:hidden"
24
+ ONE_LINE_AXIS_CLASSES = "ks-meter-label relative h-4 text-xs sm:col-start-2 max-sm:hidden"
24
25
  MARK_CLASSES = "absolute top-0 whitespace-nowrap"
25
26
  MINIMUM_BAR_PERCENT = 2
26
27
  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
@@ -38,6 +39,10 @@ module Keystone
38
39
  [ TRACK_CLASSES, (ONE_LINE_TRACK_CLASSES if one_line) ].compact.join(" ")
39
40
  end
40
41
 
42
+ def axis_classes
43
+ one_line ? PHONE_AXIS_CLASSES : AXIS_CLASSES
44
+ end
45
+
41
46
  def label_classes
42
47
  ONE_LINE_LABEL_CLASSES if one_line
43
48
  end
@@ -110,6 +115,10 @@ module Keystone
110
115
  (0..mark_intervals).map { |index| { label: written_mark(index * mark_step), style: mark_style(index) } }
111
116
  end
112
117
 
118
+ def axis_end_label
119
+ one_line ? written_mark(scale) : total_duration
120
+ end
121
+
113
122
  def axis_start_label
114
123
  written_mark(0)
115
124
  end
@@ -305,8 +305,8 @@ module KeystoneUiHelper
305
305
  render Keystone::Ui::HeadingComponent.new(**args)
306
306
  end
307
307
 
308
- def ui_caption(**args)
309
- render Keystone::Ui::CaptionComponent.new(**args)
308
+ def ui_caption(**args, &block)
309
+ render Keystone::Ui::CaptionComponent.new(**args), &block
310
310
  end
311
311
 
312
312
  def ui_link(**args)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.97.0"
4
+ VERSION = "0.99.0"
5
5
  end
@@ -30,7 +30,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
30
30
  - `ui_page_header` — the title of a page, with optional badges beside it and a control and action menu on its right, and the screen's main action, which can ask a question first and can move to the bottom of a phone screen.
31
31
  - `ui_breadcrumbs` — a line of links to the pages above the current one, shown from `lg:` up.
32
32
  - `ui_section` — a titled block of content with an optional link, action menu and short aside such as a badge in its header.
33
- - `ui_grid` — a responsive grid with a column count per breakpoint.
33
+ - `ui_grid` — a responsive grid with a column count per breakpoint up to `xl`, and two columns of unequal width when asked.
34
34
  - `ui_list_detail` — a list beside the detail of the item picked from it, with the detail above the list below `lg:`.
35
35
  - `ui_panel` — a bordered card surface holding any content.
36
36
  - `ui_card_link` — a panel that is one link as a whole.
@@ -75,7 +75,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
75
75
  - `ui_figure` — one amount as inline text, coloured as a gain or a loss.
76
76
  - `ui_picture` — an image never taller than half the screen, optionally opening its full-size file.
77
77
  - `ui_heading` — a heading at one of three sizes, with an optional short note on its right.
78
- - `ui_caption` — small uppercase muted text placed above a title or a figure.
78
+ - `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.
79
79
  - `ui_link` — a text link in the link colour.
80
80
  - `ui_facts` — a row of facts, each a count in bold beside its label.
81
81
  - `ui_paragraph` — a paragraph of running text.
@@ -84,7 +84,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
84
84
  - `ui_link_list` — a list of links, each row with a label, an optional subtitle, badge, value and top line, an optional current-row mark, and a chevron that can be left off.
85
85
  - `ui_empty_state` — what a list or section shows when it has nothing in it, with an optional message and action.
86
86
  - `ui_progress` — a labelled progress bar.
87
- - `ui_stat_card` — a single metric tile with optional change, link and info button.
87
+ - `ui_stat_card` — a single metric tile with optional change, link and info button, or a compact tile for a small grid of figures inside a panel.
88
88
  - `ui_copy_button` — a button that copies text to the clipboard.
89
89
  - `ui_code` — a block of code with an optional caption.
90
90
  - `ui_text_diff` — two versions of a text side by side, or in one column, with removed and added lines marked.
@@ -93,7 +93,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
93
93
  - `ui_info` — an inline info button showing a summary, and optional detail, in floating panels.
94
94
  - `ui_breakdown` — a list of amounts ending in their total.
95
95
  - `ui_accordion` — a stack of question-and-answer rows that expand independently.
96
- - `ui_tab_switcher` — a row of tabs that reports which one was selected.
96
+ - `ui_tab_switcher` — a row of tabs that reports which one was selected, or a row of link tabs with optional counts, drawn centred or from the start, as plain tabs, pills or underlined tabs.
97
97
  - `ui_modal` — a hidden dialog the app's own code opens.
98
98
  - `ui_swipe_deck` — a stack of cards accepted or rejected by button or swipe.
99
99
  - `ui_chart_card` — a titled card holding a chart.
@@ -179,7 +179,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
179
179
  - Ask the developer whether a screen shows breadcrumbs and which parent
180
180
  screens its trail names. Ask which screens a navigation tab opens
181
181
  directly, since those pass `trail: []`.
182
- - `ui_page_header(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, action_confirm: nil, action_at_bottom: false, badges: [], menu: [], class: nil)`
182
+ - `ui_page_header(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, action_confirm: nil, action_at_bottom: false, badges: [], menu: [], subtitle_mono: false, class: nil)`
183
183
  takes a block yielding the header. Call
184
184
  `header.action { ... }` in the block to place a control on its right.
185
185
  `action_url:` declares the screen's main action. It publishes that URL and
@@ -195,6 +195,8 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
195
195
  a phone, not the plus icon. It applies only with `action_url:` and is
196
196
  ignored when an `action` block is given. Ask the developer whether a
197
197
  screen's main action needs a question and how it is worded.
198
+ - `subtitle_mono: true` draws the subtitle in a fixed-width font, such as
199
+ a run's id and start time. Use it in place of a monospace class.
198
200
  - `action_at_bottom: true` hides the header's main action, or its `action`
199
201
  block, below `sm:`, for a screen whose phone layout draws the action with
200
202
  `ui_bottom_action`. From `sm:` up the header shows it as before, and the
@@ -238,8 +240,9 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
238
240
  - The block yields the section, and `section.with_aside { ... }` in it puts
239
241
  short text or a `ui_badge`, such as a sort order or a step's state, in
240
242
  small muted text at the right end of the title line, before the link and
241
- the menu. Below `sm:` the aside moves to its own line under the title and
242
- the actions. Use it in place of hand-written markup beside a section's
243
+ the menu. The aside never breaks in the middle of a word, and from `sm:`
244
+ up it keeps its full width while a long title wraps beside it. Below
245
+ `sm:` the aside moves to its own line under the title and the actions. Use it in place of hand-written markup beside a section's
243
246
  title, and ask the developer what the aside shows.
244
247
 
245
248
  ```erb
@@ -248,10 +251,15 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
248
251
  ...
249
252
  <% end %>
250
253
  ```
251
- - `ui_grid(cols: { default: 1 }, gap: :md, gap_x: nil, gap_y: nil)` —
252
- `cols:` maps `:default` `:sm` `:md` `:lg` to a count from 1 to 12, such as
253
- `{ default: 1, md: 3 }`. `gap:` is `:sm` `:md` `:lg` `:xl`, and passing
254
- `gap_x:` or `gap_y:` replaces `gap:` entirely.
254
+ - `ui_grid(cols: { default: 1 }, gap: :md, gap_x: nil, gap_y: nil, wide: nil)` —
255
+ `cols:` maps `:default` `:sm` `:md` `:lg` `:xl` to a count from 1 to 12,
256
+ such as `{ default: 1, md: 3 }`, and below the smallest breakpoint given
257
+ the columns stack. `gap:` is `:sm` `:md` `:lg` `:xl`, and passing
258
+ `gap_x:` or `gap_y:` replaces `gap:` entirely. `wide: :first` or
259
+ `wide: :second` makes that column wider, three parts to two, wherever
260
+ `cols:` gives two columns, such as a wide table beside a narrow panel:
261
+ `ui_grid(cols: { default: 1, xl: 2 }, wide: :first)`. Use it in place of
262
+ hand-written column widths.
255
263
  - `ui_list_detail` takes no keywords. The block is the list, and
256
264
  `layout.with_detail { ... }` is the picked item's detail, left unset when
257
265
  nothing is picked. From `lg:` up the list takes the first third of the
@@ -275,7 +283,9 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
275
283
  keywords drawn as a small secondary button taking an equal share of one
276
284
  row. A `finding:` also draws the card's edge in the warning style.
277
285
  `compact: true` cuts the body to one line with an ellipsis and leaves out
278
- the call-to-action line and the meta line, for a phone list. Below `sm:` each button is at least 44 pixels
286
+ the call-to-action line and the meta line, for a phone list. The buttons
287
+ are separated by a space in the card's text, so copied text and screen
288
+ readers read each label as its own word. Below `sm:` each button is at least 44 pixels
279
289
  tall, and from `sm:` up the buttons are narrowed so three labels fit in a
280
290
  third of the page. Use it in place of a hand-written card of these parts.
281
291
  - `ui_review_card_grid` takes no keywords and a block of `ui_review_card`
@@ -332,7 +342,8 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
332
342
  - `ui_nav_item(label:, href:, active: false, count: nil)` is one desktop
333
343
  link, with `count:` shown in a badge after the label when above zero.
334
344
  `ui_nav_dropdown(title:, area:, active: false)` takes a block holding the
335
- menu links.
345
+ menu links. A title too long for the trigger ends in an ellipsis, so a
346
+ long page title in a phone top bar never widens the page.
336
347
  - `ui_bottom_nav` takes no keywords and a block of
337
348
  `ui_bottom_nav_item(label:, href:, icon:, active: false, count: nil)` calls,
338
349
  where `icon:` is a raw SVG string and `count:` above zero shows in a badge
@@ -341,7 +352,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
341
352
  - `ui_mobile_header(title:, back_url:, subtitle: nil, overline: nil, badge: nil)` is hidden from `lg:`
342
353
  up and goes in the navbar's `mobile_left` slot or directly in the
343
354
  layout's `<header>`. `back_url:` must be passed, and `nil` renders the
344
- title with no back arrow. Outside a top bar it draws the arrow, title and
355
+ title with no back arrow and no space left for one. Outside a top bar it draws the arrow, title and
345
356
  subtitle in one row with `ui_page`'s side margin, ending the text in an
346
357
  ellipsis when too long. Inside an element with the `top-nav` class, such
347
358
  as `ui_navbar`, the arrow and title are laid out by the bar instead: the
@@ -383,7 +394,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
383
394
  both. Add no padding of your own for them. It and `ui_mobile_action`
384
395
  draw the same action, so ask the developer which one a screen shows on a
385
396
  phone.
386
- - `ui_decision_bar(url:, primary:, actions: [], note: nil, hint: nil, method: :post)`
397
+ - `ui_decision_bar(url:, primary:, actions: [], note: nil, hint: nil, method: :post, breakpoint: :sm)`
387
398
  draws one form sending to `url:` with `method:`. `primary:` and each hash
388
399
  in `actions:` are `ui_button` keywords, usually `label:`, `name:` and
389
400
  `value:`, so the button pressed tells the controller which decision was
@@ -402,7 +413,13 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
402
413
  bar fixed to the bottom of the screen, above `ui_bottom_nav` on a page
403
414
  that has one, with the primary button at full width and 48 pixels tall
404
415
  above a row of the secondary buttons, each an equal share of the row and
405
- 44 pixels tall. The note field and hint are not shown below `sm:`. Give
416
+ 44 pixels tall. A label too long for its share wraps inside its
417
+ button, so do not shrink the buttons to keep the row even. The note
418
+ field and hint are not shown below `sm:`. `breakpoint: :md` or
419
+ `breakpoint: :lg` moves the switch between the phone bar and the panel
420
+ from `sm:` (640 pixels) to 768 or 1024 pixels, so it matches a page that
421
+ changes its own layout there. Ask the developer at which width the page
422
+ around the bar changes its layout. Give
406
423
  it three secondary actions at most on a phone so the phone row fits. It stays shown
407
424
  inside a Hotwire Native web view, at the bottom of the web view. It draws
408
425
  an invisible copy of its phone bar in the page's flow, plus the bottom
@@ -673,7 +690,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
673
690
  for a button without `href:`: a link ignores the attribute and stays
674
691
  followable, and a button sending a request does not take it, so to stop
675
692
  either one, do not render it.
676
- - `ui_button_row(equal_width: false) { ... }` draws whatever its block
693
+ - `ui_button_row(equal_width: false, class: nil) { ... }` draws whatever its block
677
694
  renders, usually `ui_button` calls, in one row with a small gap between
678
695
  them, wrapping onto a further line when they do not fit. Below `sm` each
679
696
  item in the row is at least 44 pixels tall, so a button is tall enough to
@@ -728,7 +745,8 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
728
745
  `top_line:` is `{ badge:, text: }`, a line above the label with its own
729
746
  badge at the left, apart from the row's `badge:`, and short text at the
730
747
  right, such as a type and the time left. It stays on one line and cuts off
731
- long text, while the label and subtitle wrap. `current: true` marks the
748
+ long text, a long badge wraps without squeezing the text beside it, and
749
+ the label and subtitle wrap. `current: true` marks the
732
750
  row the person has open with `aria-current` and a tint and accent bar.
733
751
  `chevron: false` leaves off every row's chevron, as in a queue beside the
734
752
  open item. Ask the developer which row is current on each page.
@@ -782,9 +800,14 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
782
800
  - `ui_accordion(items: [])` — `items:` is `[{ question:, answer: }, ...]`.
783
801
  - `ui_heading(text:, size: :md, note: nil)` — `size:` is `:sm` `:md` `:lg`,
784
802
  and `note:` puts a short muted note at the right end of the heading's row.
785
- - `ui_caption(text:, tone: :muted)` shows small uppercase muted text above
786
- a title or a figure. `tone: :link` draws it in the link colour with space
787
- under it, as the label above a quiz question.
803
+ - `ui_caption(text: nil, tone: :muted, normal_case: false)` shows small
804
+ uppercase muted text above a title or a figure. `tone: :link` draws it in
805
+ the link colour with space under it, as the label above a quiz question.
806
+ `normal_case: true` draws a small muted line in the case it was written,
807
+ such as a note under a step's details or a key under a chart. A block
808
+ given to it is drawn in place of `text:`, so the line can hold links, and
809
+ links in a normal-case caption are drawn in the link colour. Use it in
810
+ place of hand-written small grey text.
788
811
  - `ui_facts(facts:)` — each fact is `{ value:, label: }`, drawn as a small
789
812
  box with the count in bold beside its label, in a row that wraps.
790
813
  - `ui_paragraph(text:)` shows running text.
@@ -804,13 +827,17 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
804
827
 
805
828
  10. Explain figures.
806
829
 
807
- - `ui_stat_card(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil, note: nil, plain: false, fallback: nil)`
830
+ - `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)`
808
831
  — `variant:` is `:neutral` `:success` `:danger` `:warning` `:info` and
809
832
  colours the value. `change:` is a signed number shown as `▲ 4.2%` in
810
833
  green, `▼` in red, or plain at zero. `href:` links the value only, so
811
834
  never wrap a stat card in `ui_card_link`. `definition:` and
812
835
  `calculation:` add an info button whose panel shows while hovered or
813
- focused and toggles when tapped.
836
+ focused and toggles when tapped. `compact: true` draws a small tile, an
837
+ extra small label over a smaller value with its change or note beside
838
+ the value, under half a default card's height. Put compact cards in
839
+ `ui_grid(cols: { default: 1, sm: 2 }, gap: :sm)` inside a panel so they
840
+ sit two across and stack on a phone.
814
841
  - `ui_figure(text:, tone: :neutral)` prints one amount inline. `tone:`
815
842
  `:neutral` uses the surrounding text colour, `:success` green and
816
843
  `:danger` red, and any other symbol raises `KeyError`. Its output can go
@@ -951,8 +978,10 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
951
978
  then its track, then its duration. The label column is as wide as the
952
979
  longest label up to 40% of the timeline, a longer label is cut off with
953
980
  an ellipsis, and every row's track has the same width and lines up with
954
- the others. Below `sm:` each row shows its label and duration on one
955
- line with its track on a second line across the full width.
981
+ the others. Below `sm:` it falls back to the default layout: each row
982
+ shows its full label, wrapped when long, and its duration above its
983
+ track, the marks are hidden, and the axis under the rows reads `0s` and
984
+ the axis's last mark.
956
985
  - Above a one-line timeline's first row, in the track column, the axis
957
986
  shows marks at even
958
987
  intervals from `0s`, at the smallest of 1, 2, 5, 10, 15 or 30 seconds,
@@ -998,9 +1027,20 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
998
1027
  takes content such as stat cards. From `sm` up it is drawn above the
999
1028
  tab row, and below `sm` between the tab row and the panel. It is drawn
1000
1029
  once, so do not draw it twice or add width-specific classes for it.
1030
+ - A link tab takes `count:`, drawn after its label when it is above zero
1031
+ in an info badge, as a navigation item draws its count. `show_zero: true`
1032
+ on a tab draws its count of zero too, such as a filter pill reading
1033
+ `Input 0`.
1034
+ - `align: :start` starts the tab row at the left edge on every width
1035
+ instead of centring it from `sm` up.
1036
+ - `shape: :pills` draws each tab as an outlined pill, such as a row of
1037
+ filters, and `shape: :underline` draws the tabs on a line with the
1038
+ chosen tab underlined. In either shape a count is drawn as plain muted
1039
+ text after the label, and the shape sets the tabs' text size, so do not
1040
+ add a text size class.
1001
1041
  - Below `sm` every tab switcher's tab row stays on one line, starts at
1002
1042
  the left edge and scrolls sideways, and from `sm` up it wraps and is
1003
- centred.
1043
+ centred unless `align: :start` is given.
1004
1044
  - `ui_swipe_deck(items:, empty_title: "All done!", empty_subtitle: nil)`
1005
1045
  takes a block yielding the deck, where `deck.item { |item| ... }` renders
1006
1046
  one card's face. Accepting sends a bubbling `swipe-deck:complete` event
@@ -89,14 +89,22 @@ One decision: is keystone_ui set up in the app?
89
89
  rows shows only `0s` and the total duration. A timeline can be drawn one line
90
90
  per row instead: from `sm:` up each row holds its label, its bar and its
91
91
  duration side by side, every row's bar has the same width, and a long label is
92
- cut off with an ellipsis. Below `sm:` the bar moves under the label and
93
- duration. In that layout the axis, drawn above the first row, shows marks at the smallest round time step
92
+ cut off with an ellipsis. Below `sm:` it falls back to the default layout:
93
+ each row shows its full label, wrapped when long, and its duration above its
94
+ bar, and the axis under the rows shows `0s` and the last mark. In that layout the axis, drawn above the first row, shows marks at the smallest round time step
94
95
  that covers the run in six intervals or fewer, and the axis ends at the last mark rather than at the latest
95
96
  time, so bars are placed against that longer axis. An entry can carry an address, and then its bar is a link to it whose
96
97
  name screen readers announce is the entry's label, and the row's label links
97
98
  to the address of the last entry in that row that has one. An entry can be
98
99
  marked selected, and the row holding it is drawn in the same tint as a data
99
100
  table's current row and announced to screen readers as the current item.
101
+ - **Tab rows.** A tab switcher's tabs are either labels switched in the
102
+ browser or links to addresses, with the chosen link drawn as the current
103
+ tab. A link tab can carry a count shown after its label. The row is centred
104
+ on wider screens, or starts at the left edge when asked. It can be drawn as
105
+ plain tabs, as outlined pills such as a row of filters, or as tabs on a line
106
+ with the chosen one underlined. On a phone every row stays on one line and
107
+ scrolls sideways.
100
108
  - **Bar chart groups.** A bar chart's bars can be put in groups, such as one
101
109
  group per version of what produced them. Groups count from oldest to newest
102
110
  in the order they first appear. Every bar of a group shares one tone, and
@@ -118,8 +126,9 @@ One decision: is keystone_ui set up in the app?
118
126
  subtitle, then an optional action link and action menu. A section can also
119
127
  carry an aside, a short piece of text or a badge drawn in the header's note
120
128
  style at the right end of the title line, before the action and the menu.
121
- Below `sm:` the aside takes a line of its own under the title and the
122
- actions. A section with no title draws no header, so its aside is not shown.
129
+ The aside never breaks in the middle of a word, and on wider screens a long
130
+ title wraps beside it while it keeps its full width. Below `sm:` the aside
131
+ takes a line of its own under the title and the actions. A section with no title draws no header, so its aside is not shown.
123
132
  - **Going back.** A form or show page shell needs a way back: a back link, a
124
133
  trail of earlier pages shown as breadcrumbs, or a trail the app supplies for
125
134
  the request. A nav tab's own page passes an empty trail and shows no back
@@ -191,14 +200,24 @@ One decision: is keystone_ui set up in the app?
191
200
  own button below `sm:` so the action is not shown twice. Both forms show
192
201
  nothing when the header names no action, and both are hidden inside a
193
202
  Hotwire Native web view and in print.
203
+ - **Compact stat cards.** A stat card can be drawn compact, a small tile with
204
+ an extra small label and a smaller value, its change or note beside the
205
+ value, for a small grid of figures inside a panel.
206
+ - **Unequal grid columns.** A grid goes up to the `xl:` breakpoint, and a
207
+ two-column grid can make its first or its second column wider, three parts
208
+ to two.
209
+ - **Normal-case notes.** A caption can be a small muted line in the case it
210
+ was written, holding links, and a page header's subtitle can use a
211
+ fixed-width font.
194
212
  - **A decision bar.** A decision bar is one form holding an optional note
195
213
  field, several secondary buttons and one primary button, and the button
196
214
  pressed tells the app which decision was made. On a wider screen it is a
197
215
  panel with all of them on one line that wraps, and an optional hint line
198
216
  under them. On a phone it is a bar fixed to the bottom of the screen, above
199
217
  the bottom tab bar when the page has one, with the primary button at full
200
- width above a row of the secondary buttons in equal shares, and with no note
201
- field or hint. Each secondary button can have a shorter label on a phone, be
218
+ width above a row of the secondary buttons in equal shares, a long label
219
+ wrapping inside its button, and with no note field or hint. The width at
220
+ which it switches between the two can be moved from `sm:` to `md:` or `lg:`. Each secondary button can have a shorter label on a phone, be
202
221
  shown on a phone only, and take another place in the phone row. The page leaves room under its last content so the bar does
203
222
  not cover it. Unlike the main action's bottom bar, it stays shown inside a
204
223
  Hotwire Native web view.
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.97.0
4
+ version: 0.99.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.38.0
18
+ version: 0.42.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.38.0
25
+ version: 0.42.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: view_component
28
28
  requirement: !ruby/object:Gem::Requirement