keystone_ui 0.71.0 → 0.73.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: 5355c29793674a40bcd010200e66a7f6e99ec08de1b802aab127ad42e7e0d9b7
4
- data.tar.gz: '09001801fe0132be8e69116ab38b2dbe7031978ee144a0f707d35ec711a4e952'
3
+ metadata.gz: d022ceb3f34fcc5f5b576284d6e61e546adc129219760b94cc144520f135e67f
4
+ data.tar.gz: 187d25d879625ded62755e7ad640cfa06c9cf8bcac07d3931c6f75e6fa9b2786
5
5
  SHA512:
6
- metadata.gz: 95ce9153bafe6c8cc3a5d7e84216713f20ef8c23f6d960a97728dd1f431a0fd2f7edf9efc031f47545c588a6ca379ce1b189dd7d72c99e0b3a8946d4ef96a28b
7
- data.tar.gz: 11657cd55a53830686b48b3eaf4bf9240872e4a1754fe2f1e0edf2d827eeb3976424daae2ba499d3b259425aa6e16377c03dabc3e6d2320904ae3d09c0ad2618
6
+ metadata.gz: 96cd19e46f7e460bb112e138df25683af5402f791be5e63923c6fb56abf89f94f78e483dcba245d74884c98692b06fd1df2ec2b3472d5c90dd8381bb2d51eb26
7
+ data.tar.gz: e4b2ca64098f66d7dc4d6dce92901023693265a5686d4ebbf9063dc05687e6e0ca76dc9b9d23af448cecd7d2b7806aef49817fffac51995d4de1335c359b26b1
@@ -5,26 +5,28 @@
5
5
  <% end %>
6
6
  <div class="<%= Keystone::Ui::DataTableComponent::WRAPPER_CLASSES %>">
7
7
  <table class="<%= table_classes %> divide-y divide-gray-300 dark:divide-white/15">
8
- <thead class="<%= head_classes %>">
9
- <tr>
10
- <% header_cells.each do |cell| %>
11
- <th scope="<%= cell[:scope] %>" class="<%= cell[:classes] %>">
12
- <% if cell[:sort_href] %>
13
- <a href="<%= cell[:sort_href] %>" class="<%= Keystone::Ui::DataTableComponent::SORT_LINK_CLASSES %>" data-turbo-action="replace">
8
+ <% if header? %>
9
+ <thead class="<%= head_classes %>">
10
+ <tr>
11
+ <% header_cells.each do |cell| %>
12
+ <th scope="<%= cell[:scope] %>" class="<%= cell[:classes] %>">
13
+ <% if cell[:sort_href] %>
14
+ <a href="<%= cell[:sort_href] %>" class="<%= Keystone::Ui::DataTableComponent::SORT_LINK_CLASSES %>" data-turbo-action="replace">
15
+ <%= cell[:label] %>
16
+ <% if cell[:sort_active] %>
17
+ <span class="<%= Keystone::Ui::DataTableComponent::SORT_ICON_CLASSES %> <%= Keystone::Ui::DataTableComponent::SORT_ICON_ACTIVE %>"><%= (cell[:sort_direction] == :asc ? Keystone::Ui::DataTableComponent::SORT_ASC_ICON : Keystone::Ui::DataTableComponent::SORT_DESC_ICON).html_safe %></span>
18
+ <% else %>
19
+ <span class="<%= Keystone::Ui::DataTableComponent::SORT_ICON_CLASSES %> <%= Keystone::Ui::DataTableComponent::SORT_ICON_INACTIVE %>"><%= Keystone::Ui::DataTableComponent::SORT_NEUTRAL_ICON.html_safe %></span>
20
+ <% end %>
21
+ </a>
22
+ <% else %>
14
23
  <%= cell[:label] %>
15
- <% if cell[:sort_active] %>
16
- <span class="<%= Keystone::Ui::DataTableComponent::SORT_ICON_CLASSES %> <%= Keystone::Ui::DataTableComponent::SORT_ICON_ACTIVE %>"><%= (cell[:sort_direction] == :asc ? Keystone::Ui::DataTableComponent::SORT_ASC_ICON : Keystone::Ui::DataTableComponent::SORT_DESC_ICON).html_safe %></span>
17
- <% else %>
18
- <span class="<%= Keystone::Ui::DataTableComponent::SORT_ICON_CLASSES %> <%= Keystone::Ui::DataTableComponent::SORT_ICON_INACTIVE %>"><%= Keystone::Ui::DataTableComponent::SORT_NEUTRAL_ICON.html_safe %></span>
19
- <% end %>
20
- </a>
21
- <% else %>
22
- <%= cell[:label] %>
23
- <% end %>
24
- </th>
25
- <% end %>
26
- </tr>
27
- </thead>
24
+ <% end %>
25
+ </th>
26
+ <% end %>
27
+ </tr>
28
+ </thead>
29
+ <% end %>
28
30
  <tbody class="<%= body_classes %>"<% if row_detail? %> data-controller="row-detail" data-action="turbo:before-morph-attribute->row-detail#keep"<% end %>>
29
31
  <% if empty? %>
30
32
  <% if @empty_message %>
@@ -63,10 +65,9 @@
63
65
  <% end %>
64
66
  <% if actions? %>
65
67
  <td class="<%= actions_cell_classes %>">
66
- <% row_actions = capture(item, &@actions_block) %>
67
- <% if row_actions.present? %>
68
+ <% if row_actions[idx].present? %>
68
69
  <%= render Keystone::Ui::ActionMenuComponent.new do %>
69
- <%= row_actions %>
70
+ <%= row_actions[idx] %>
70
71
  <% end %>
71
72
  <% end %>
72
73
  </td>
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_support/core_ext/object/blank"
4
+
3
5
  module Keystone
4
6
  module Ui
5
7
  class DataTableComponent < ViewComponent::Base
@@ -32,7 +34,7 @@ module Keystone
32
34
 
33
35
  PHONE_LIST_HEAD_CLASSES = "max-sm:hidden"
34
36
  PHONE_LIST_BLOCK_CLASSES = "max-sm:block"
35
- PHONE_LIST_CELL_CLASSES = "max-sm:block max-sm:text-left max-sm:whitespace-normal"
37
+ PHONE_LIST_CELL_CLASSES = "ks-table-phone-list-cell max-sm:block max-sm:text-left max-sm:whitespace-normal"
36
38
  CELL_LABEL_CLASSES = "ks-caption block sm:hidden"
37
39
 
38
40
  SORT_LINK_CLASSES = "ks-table-sort-link group inline-flex items-center"
@@ -44,7 +46,7 @@ module Keystone
44
46
  SORT_DESC_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 3a.75.75 0 0 1 .75.75v10.638l3.96-4.158a.75.75 0 1 1 1.08 1.04l-5.25 5.5a.75.75 0 0 1-1.08 0l-5.25-5.5a.75.75 0 0 1 1.08-1.04l3.96 4.158V3.75A.75.75 0 0 1 10 3Z" clip-rule="evenodd" /></svg>'
45
47
  SORT_NEUTRAL_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 3a.75.75 0 0 1 .55.24l3.25 3.5a.75.75 0 1 1-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 0 1-1.1-1.02l3.25-3.5A.75.75 0 0 1 10 3Zm-3.76 9.2a.75.75 0 0 1 1.06.04l2.7 2.908 2.7-2.908a.75.75 0 1 1 1.1 1.02l-3.25 3.5a.75.75 0 0 1-1.1 0l-3.25-3.5a.75.75 0 0 1 .04-1.06Z" clip-rule="evenodd" /></svg>'
46
48
 
47
- def initialize(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil, phone_list: false)
49
+ def initialize(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil, phone_list: false, header: true)
48
50
  @items = items.to_a
49
51
  @current_index = @items.index(current_row) unless current_row.nil?
50
52
  @group_by = group_by
@@ -62,6 +64,7 @@ module Keystone
62
64
  @actions_block = nil
63
65
  @link_blocks = {}
64
66
  @phone_list = phone_list
67
+ @header = header
65
68
  end
66
69
 
67
70
  def before_render
@@ -123,8 +126,18 @@ module Keystone
123
126
  phone_list_classes(HEAD_CLASSES, PHONE_LIST_HEAD_CLASSES)
124
127
  end
125
128
 
129
+ def header?
130
+ @header
131
+ end
132
+
126
133
  def actions?
127
- !!@actions_block
134
+ row_actions.any?(&:present?)
135
+ end
136
+
137
+ def row_actions
138
+ return [] unless @actions_block
139
+
140
+ @row_actions ||= @items.map { |item| capture(item, &@actions_block) }
128
141
  end
129
142
 
130
143
  def column_picker
@@ -196,7 +209,7 @@ module Keystone
196
209
  value: resolve_value(item, column.key),
197
210
  classes: wrapped(aligned(tokens.join(" "), column), column)
198
211
  }
199
- cell[:label] = column.header_text if @phone_list
212
+ cell[:label] = column.header_text if phone_labels?
200
213
 
201
214
  link_block = @link_blocks[column.key]
202
215
  cell[:href] = link_block.call(item) if link_block
@@ -243,7 +256,11 @@ module Keystone
243
256
  private
244
257
 
245
258
  def summary_label(index, column)
246
- column.header_text if @phone_list && !index.zero?
259
+ column.header_text if phone_labels? && !index.zero?
260
+ end
261
+
262
+ def phone_labels?
263
+ @phone_list && @header
247
264
  end
248
265
 
249
266
  def phone_list_classes(classes, phone_list_classes)
@@ -1,15 +1,17 @@
1
1
  <div class="ks-value-list">
2
2
  <% rows.each do |row| %>
3
3
  <%= link_to row.fetch(:href), class: ROW_CLASSES do %>
4
- <span class="<%= TEXT_CLASSES %>">
5
- <span class="<%= LABEL_CLASSES %>"><%= row.fetch(:label) %></span>
6
- <% if row[:subtitle] %>
7
- <span class="<%= SUBTITLE_CLASSES %>"><%= row[:subtitle] %></span>
4
+ <span class="<%= STACK_CLASSES %>">
5
+ <span class="<%= TEXT_CLASSES %>">
6
+ <span class="<%= LABEL_CLASSES %>"><%= row.fetch(:label) %></span>
7
+ <% if row[:subtitle] %>
8
+ <span class="<%= SUBTITLE_CLASSES %>"><%= row[:subtitle] %></span>
9
+ <% end %>
10
+ </span>
11
+ <% if row[:badge] %>
12
+ <%= render badge(row) %>
8
13
  <% end %>
9
14
  </span>
10
- <% if row[:badge] %>
11
- <%= render badge(row) %>
12
- <% end %>
13
15
  <% if row[:value] %>
14
16
  <span class="<%= VALUE_CLASSES %>"><%= row[:value] %></span>
15
17
  <% end %>
@@ -4,6 +4,8 @@ module Keystone
4
4
  module Ui
5
5
  class LinkListComponent < ViewComponent::Base
6
6
  ROW_CLASSES = "ks-value-list-row items-center no-underline"
7
+ STACK_CLASSES = "flex min-w-0 flex-1 flex-col-reverse ks-grid-gap-sm sm:contents"
8
+ BADGE_CLASSES = "max-sm:self-start"
7
9
  TEXT_CLASSES = "min-w-0 flex-1"
8
10
  LABEL_CLASSES = "ks-paragraph ks-settings-link-label block"
9
11
  SUBTITLE_CLASSES = "ks-value-list-note"
@@ -16,7 +18,7 @@ module Keystone
16
18
  end
17
19
 
18
20
  def badge(row)
19
- BadgeComponent.new(**row[:badge])
21
+ BadgeComponent.new(**row[:badge], class: BADGE_CLASSES)
20
22
  end
21
23
  end
22
24
  end
@@ -1,13 +1,15 @@
1
- <div class="<%= WRAPPER_CLASSES %>">
2
- <% if @back_url %>
3
- <%= link_to @back_url, class: BACK_LINK_CLASSES, aria: { label: "Back" } do %>
4
- <%= BACK_ICON.html_safe %>
1
+ <div class="<%= ROW_CLASSES %>">
2
+ <div class="<%= WRAPPER_CLASSES %>">
3
+ <% if @back_url %>
4
+ <%= link_to @back_url, class: BACK_LINK_CLASSES, aria: { label: "Back" } do %>
5
+ <%= BACK_ICON.html_safe %>
6
+ <% end %>
5
7
  <% end %>
6
- <% end %>
8
+ </div>
9
+ <span class="<%= TITLE_CLASSES %>">
10
+ <%= @title %>
11
+ <% if @subtitle.present? %>
12
+ <span class="<%= SUBTITLE_CLASSES %>"><%= @subtitle %></span>
13
+ <% end %>
14
+ </span>
7
15
  </div>
8
- <span class="<%= TITLE_CLASSES %>">
9
- <%= @title %>
10
- <% if @subtitle.present? %>
11
- <span class="<%= SUBTITLE_CLASSES %>"><%= @subtitle %></span>
12
- <% end %>
13
- </span>
@@ -15,6 +15,7 @@ module Keystone
15
15
  </svg>
16
16
  SVG
17
17
 
18
+ ROW_CLASSES = "ks-page flex items-center ks-grid-gap-sm lg:hidden print:hidden max-lg:in-[.top-nav]:contents"
18
19
  WRAPPER_CLASSES = "flex items-center lg:hidden print:hidden"
19
20
  BACK_LINK_CLASSES = "ks-mobile-header-back"
20
21
  TITLE_CLASSES = "ks-mobile-header-title flex-[1_1_6rem] min-w-0 self-center lg:hidden truncate"
@@ -9,8 +9,8 @@ module Keystone
9
9
  ACTIONS_CLASSES = "page-header-actions ks-page-header-actions"
10
10
  PHONE_TITLE_CLASSES = "ks-page-header-title max-sm:[body:has(.ks-mobile-header-title)_&]:hidden"
11
11
  PHONE_WRAPPER_CLASSES = "max-sm:flex max-sm:flex-wrap max-sm:items-center max-sm:justify-between"
12
- PHONE_ACTIONS_CLASSES = "max-sm:block"
13
- MENU_ROW_CLASSES = "flex items-center ks-grid-gap-sm"
12
+ PHONE_ACTIONS_CLASSES = "max-sm:flex max-sm:items-center max-sm:basis-full"
13
+ ROW_CLASSES = "sm:flex sm:items-center flex-wrap max-w-full ks-grid-gap-sm"
14
14
  TITLE_ROW_CLASSES = "flex flex-wrap items-center ks-grid-gap-sm"
15
15
 
16
16
  attr_reader :title, :action_url, :action_label, :action_method
@@ -44,7 +44,7 @@ module Keystone
44
44
  end
45
45
 
46
46
  def actions_classes
47
- [ ACTIONS_CLASSES, (menu? ? MENU_ROW_CLASSES : PHONE_ACTIONS_CLASSES if phone?) ].compact.join(" ")
47
+ [ ACTIONS_CLASSES, ROW_CLASSES, (PHONE_ACTIONS_CLASSES if phone?) ].compact.join(" ")
48
48
  end
49
49
 
50
50
  def title_classes
@@ -7,17 +7,21 @@
7
7
  <p class="<%= SUBTITLE_CLASSES %>"><%= @subtitle %></p>
8
8
  <% end %>
9
9
  </div>
10
- <% if @action %>
11
- <a href="<%= @action[:href] %>" class="<%= action_classes %>">
12
- <%= @action[:label] %>
13
- </a>
14
- <% end %>
15
- <% if @menu.any? %>
16
- <%= render Keystone::Ui::ActionMenuComponent.new do %>
17
- <% @menu.each do |item| %>
18
- <%= render Keystone::Ui::ActionMenuItemComponent.new(**item) %>
10
+ <% if @action || @menu.any? %>
11
+ <div class="<%= ACTIONS_CLASSES %>">
12
+ <% if @action %>
13
+ <a href="<%= @action[:href] %>" class="<%= action_classes %>">
14
+ <%= @action[:label] %>
15
+ </a>
19
16
  <% end %>
20
- <% end %>
17
+ <% if @menu.any? %>
18
+ <%= render Keystone::Ui::ActionMenuComponent.new do %>
19
+ <% @menu.each do |item| %>
20
+ <%= render Keystone::Ui::ActionMenuItemComponent.new(**item) %>
21
+ <% end %>
22
+ <% end %>
23
+ <% end %>
24
+ </div>
21
25
  <% end %>
22
26
  </div>
23
27
  <% end %>
@@ -8,6 +8,7 @@ module Keystone
8
8
  TITLE_CLASSES = "ks-section-title"
9
9
  SUBTITLE_CLASSES = "ks-section-subtitle"
10
10
  ACTION_CLASSES = "ks-section-action"
11
+ ACTIONS_CLASSES = "flex items-center shrink-0 ks-grid-gap-sm"
11
12
 
12
13
  def initialize(title: nil, subtitle: nil, action: nil, menu: [], spacing: :md, class: nil)
13
14
  @title = title
@@ -1,12 +1,26 @@
1
1
  <% if link_tabs? %>
2
+ <% tab_row = capture do %>
2
3
  <nav class="<%= classes %>">
3
4
  <% tabs.each do |tab| %>
4
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
6
  <% end %>
6
7
  </nav>
8
+ <% end %>
9
+ <% if summary? %>
10
+ <div class="<%= LAYOUT_CLASSES %>">
11
+ <div class="<%= SUMMARY_CLASSES %>"><%= summary %></div>
12
+ <%= tab_row %>
13
+ <div class="<%= CONTENT_CLASSES %>"><%= content %></div>
14
+ </div>
15
+ <% else %>
16
+ <%= tab_row %>
7
17
  <%= content %>
18
+ <% end %>
8
19
  <% else %>
9
- <div data-controller="tab-switcher">
20
+ <div data-controller="tab-switcher"<% if summary? %> class="<%= LAYOUT_CLASSES %>"<% end %>>
21
+ <% if summary? %>
22
+ <div class="<%= SUMMARY_CLASSES %>"><%= summary %></div>
23
+ <% end %>
10
24
  <div class="<%= classes %>">
11
25
  <% tabs.each_with_index do |tab, index| %>
12
26
  <button
@@ -18,6 +32,10 @@
18
32
  <%= "data-active" if index == 0 %>><%= tab %></button>
19
33
  <% end %>
20
34
  </div>
35
+ <% if summary? %>
36
+ <div class="<%= CONTENT_CLASSES %>"><%= content %></div>
37
+ <% else %>
21
38
  <%= content %>
39
+ <% end %>
22
40
  </div>
23
41
  <% end %>
@@ -3,9 +3,14 @@
3
3
  module Keystone
4
4
  module Ui
5
5
  class TabSwitcherComponent < ViewComponent::Base
6
- TAB_BAR_CLASSES = "ks-tab-bar flex flex-wrap justify-center"
7
- TAB_BASE_CLASSES = "ks-tab text-sm transition"
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
+ 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"
11
+ CONTENT_CLASSES = "max-sm:order-1"
12
+
13
+ renders_one :summary
9
14
 
10
15
  attr_reader :tabs
11
16
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.71.0"
4
+ VERSION = "0.73.0"
5
5
  end
@@ -187,7 +187,11 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
187
187
  actions and menu, and hides its title when the page holds
188
188
  `ui_mobile_header`'s title. Its action then shows below `sm:` beside
189
189
  `ui_mobile_action`'s plus icon, so ask the developer whether a screen
190
- with both keeps both.
190
+ with both keeps both. Below `sm:` the actions and menu sit side by side
191
+ on their own full-width row under the title and badges, and from `sm:` up
192
+ they sit side by side on the right, with or without a menu. At every
193
+ width buttons that do not fit wrap onto another line, so the header never
194
+ makes the page wider than the screen.
191
195
  - `ui_breadcrumbs(trail:, current: nil)` renders `trail:` as links separated
192
196
  by `›`, then `current:` unlinked and marked as the current page, shown
193
197
  only from `lg:` up. On a form or detail screen pass `trail:` to the shell
@@ -200,10 +204,11 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
200
204
  4. Lay out the body. Each of these takes a block and they nest.
201
205
 
202
206
  - `ui_section(title: nil, subtitle: nil, action: nil, menu: [], spacing: :md, class: nil)`
203
- — `action:` is `{ label:, href: }` and renders a right-aligned link.
207
+ — `action:` is `{ label:, href: }` and renders a link.
204
208
  `menu:` is `[{ label:, href:, method: }, ...]`, each hash taking the
205
- keywords of `ui_action_menu_item`, and renders an action menu at the right
206
- of the header. `spacing:` is `:sm` `:md` `:lg`. The header, with its
209
+ keywords of `ui_action_menu_item`, and renders an action menu. The link
210
+ and the menu sit side by side at the right edge of the header, the link
211
+ first, at every width. `spacing:` is `:sm` `:md` `:lg`. The header, with its
207
212
  `action:` and `menu:`, renders only when `title:` is given.
208
213
  - `ui_grid(cols: { default: 1 }, gap: :md, gap_x: nil, gap_y: nil)` —
209
214
  `cols:` maps `:default` `:sm` `:md` `:lg` to a count from 1 to 12, such as
@@ -274,14 +279,19 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
274
279
  over the icon. The bar is hidden from `lg:` up and inside a
275
280
  Hotwire Native web view.
276
281
  - `ui_mobile_header(title:, back_url:, subtitle: nil)` is hidden from `lg:`
277
- up and goes in the navbar's `mobile_left` slot. `back_url:` must be
278
- passed, and `nil` renders the title with no back arrow. The title and
279
- subtitle sit between the arrow and the right-side controls, start at the
280
- left, and end in an ellipsis when too long. In `ui_navbar`, controls that
281
- leave less than 6rem for the title move to a second row under it. In a
282
- hand-written top bar, make the header a direct child of the bar's flex
283
- row, and add `max-lg:has-[.ks-mobile-header-title]:flex-wrap` to the bar if
284
- its controls can fill its width.
282
+ up and goes in the navbar's `mobile_left` slot or directly in the
283
+ layout's `<header>`. `back_url:` must be passed, and `nil` renders the
284
+ title with no back arrow. Outside a top bar it draws the arrow, title and
285
+ subtitle in one row with `ui_page`'s side margin, ending the text in an
286
+ ellipsis when too long. Inside an element with the `top-nav` class, such
287
+ as `ui_navbar`, the arrow and title are laid out by the bar instead: the
288
+ title and subtitle sit between the arrow and the right-side controls,
289
+ start at the left, and end in an ellipsis when too long. In `ui_navbar`,
290
+ controls that leave less than 6rem for the title move to a second row
291
+ under it. In a hand-written top bar, give the bar the `top-nav` class,
292
+ make the header a direct child of the bar's flex row, and add
293
+ `max-lg:has-[.ks-mobile-header-title]:flex-wrap` to the bar if its
294
+ controls can fill its width.
285
295
  - `ui_mobile_action` takes no keywords and no block, and goes in the top
286
296
  bar's right side, such as the navbar's `mobile_right` slot. It draws a plus
287
297
  icon linking to the `action_url:` a screen gives `ui_page_header`, named
@@ -435,7 +445,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
435
445
 
436
446
  8. Build tables.
437
447
 
438
- - `ui_data_table(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil, phone_list: false)`
448
+ - `ui_data_table(items:, columns:, empty_message: nil, sort: nil, sort_direction: nil, sort_url: nil, hidden_columns: [], key: nil, group_by: nil, group_totals: {}, total: nil, current_row: nil, phone_list: false, header: true)`
439
449
  takes a block yielding the table. `items:` are records or hashes, and a
440
450
  cell's value is the column key called on the item, or `item[key]`.
441
451
  `group_by:` lists rows under heading rows named by that key's value,
@@ -452,6 +462,10 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
452
462
  From `sm:` up the table is unchanged, and a table without it is unchanged
453
463
  at every width. It is chosen table by table, so ask the developer which
454
464
  tables show as a list on a phone.
465
+ - `header: false` draws no heading row, for a table of labels and their
466
+ values such as a record's details. With `phone_list: true` it also drops
467
+ the column heading label from every cell, subtotal and total below `sm:`,
468
+ so each row shows only its label and its value.
455
469
  - `columns:` takes `{ key: "Label" }` hashes when every column is plain.
456
470
  Switch the whole set to `Keystone::Ui::Column` objects once one column
457
471
  needs an option.
@@ -467,9 +481,10 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
467
481
  table locks its first column.
468
482
  - In the block, `table.link(:column_key) { |item| url }` turns a column's
469
483
  cells into links, and `table.actions { |item| ... }` adds a right-aligned
470
- actions column whose block holds only `ui_action_menu_item` calls. With no
471
- actions column, the last column is right-aligned, so put a column of
472
- amounts last.
484
+ actions column whose block holds only `ui_action_menu_item` calls. When
485
+ the block renders nothing for every row, the table draws no actions
486
+ column. With no actions column, the last column is right-aligned, so put
487
+ a column of amounts last.
473
488
  - `table.row_colour { |item| ... }` tints a whole row. The block returns
474
489
  `:danger`, `:warning`, `:success`, `:info` or `nil` for each item. A named
475
490
  colour tints every cell of that row in the same colour as the badge of
@@ -553,6 +568,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
553
568
  adds a close button.
554
569
  - `ui_link_list(rows:)` — each row is `{ label:, href:, subtitle: nil,
555
570
  badge: nil, value: nil }`, and `badge:` takes `ui_badge`'s `{ label:, variant: }`.
571
+ A row's badge sits above its label below `sm` and beside it from `sm` up.
556
572
  Use it for a list of records that each open their own page, in place of a
557
573
  hand-written `<ul>` of links.
558
574
  - `ui_empty_state(title:, message: nil, action: nil)` — `action:` is
@@ -670,6 +686,13 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
670
686
  following a tab is a Turbo visit that replaces the history entry. The
671
687
  app reads the chosen tab from its params and draws only that tab's
672
688
  content in the block.
689
+ - `switcher.with_summary { ... }`, set inside the tab switcher's block,
690
+ takes content such as stat cards. From `sm` up it is drawn above the
691
+ tab row, and below `sm` between the tab row and the panel. It is drawn
692
+ once, so do not draw it twice or add width-specific classes for it.
693
+ - Below `sm` every tab switcher's tab row stays on one line, starts at
694
+ the left edge and scrolls sideways, and from `sm` up it wraps and is
695
+ centred.
673
696
  - `ui_swipe_deck(items:, empty_title: "All done!", empty_subtitle: nil)`
674
697
  takes a block yielding the deck, where `deck.item { |item| ... }` renders
675
698
  one card's face. Accepting sends a bubbling `swipe-deck:complete` event
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.71.0
4
+ version: 0.73.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.29.0
18
+ version: 0.32.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.29.0
25
+ version: 0.32.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: view_component
28
28
  requirement: !ruby/object:Gem::Requirement