keystone_ui 0.94.0 → 0.95.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: 4947e9dd58a43eddd271d963c9398e29fa2f75f1e3087eb08595bb435d1ac6ca
4
- data.tar.gz: 0e4cb6faa7d3032195f15650dfbd234c04e88f791bb9c5f118d9f7b175d07c4b
3
+ metadata.gz: 04c11d9c46c1a257a56b70a575ce82d1b42f6173be503bf450aae5f455d58084
4
+ data.tar.gz: a5b020f2a8eb2634626b6a7b3a6dcf891660fbcc8494e2c7f924a7ad4cea1672
5
5
  SHA512:
6
- metadata.gz: baa3227236068d2825147f507a553fd00461ae879c29cc73d5a1df10d7692b1da6aa23cda4273f46282cdc41a23a1f17562a0dbf2aaa47f8b17824e4cfc7ed2c
7
- data.tar.gz: 004fe496f216548caa10e552304c39ae4b2ef8c75596e8c14dcf61895f7ade0d3a0c106aacf3915c0c37d08fa10006590ed8a7d38b79727bdc4e1e934a884cb4
6
+ metadata.gz: 5b096a567e0f8760c19208f9e185ba149006fab0e04c436d935fb3af5a80b92db18b0676f31d9469d85a5f3341254ddee2ec6ba848dc55b1578dd7e4e289d984
7
+ data.tar.gz: badc61c1eec2c324c027882f36f57cc66d1ee6f891648e9a575131a022dec3ddb9a735cb8d2405ac47d644af309b3a6f19f474721805d5ee6e471937a245f463
@@ -1,8 +1,14 @@
1
1
  <div class="ks-value-list">
2
2
  <% rows.each do |row| %>
3
- <%= link_to row.fetch(:href), class: ROW_CLASSES do %>
3
+ <%= link_to row.fetch(:href), **row_options(row) do %>
4
4
  <span class="<%= STACK_CLASSES %>">
5
5
  <span class="<%= TEXT_CLASSES %>">
6
+ <% if row[:top_line] %>
7
+ <span class="<%= TOP_LINE_CLASSES %>">
8
+ <%= render top_line_badge(row) %>
9
+ <span class="<%= TOP_LINE_TEXT_CLASSES %>"><%= row[:top_line][:text] %></span>
10
+ </span>
11
+ <% end %>
6
12
  <span class="<%= LABEL_CLASSES %>"><%= row.fetch(:label) %></span>
7
13
  <% if row[:subtitle] %>
8
14
  <span class="<%= SUBTITLE_CLASSES %>"><%= row[:subtitle] %></span>
@@ -15,7 +21,9 @@
15
21
  <% if row[:value] %>
16
22
  <span class="<%= VALUE_CLASSES %>"><%= row[:value] %></span>
17
23
  <% end %>
18
- <%= Keystone::Ui::SettingsLinkComponent::CHEVRON_ICON.html_safe %>
24
+ <% if chevron %>
25
+ <%= Keystone::Ui::SettingsLinkComponent::CHEVRON_ICON.html_safe %>
26
+ <% end %>
19
27
  <% end %>
20
28
  <% end %>
21
29
  </div>
@@ -4,22 +4,34 @@ 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
+ CURRENT_ROW_CLASSES = "ks-value-list-row-current"
7
8
  STACK_CLASSES = "flex min-w-0 flex-1 flex-col-reverse ks-grid-gap-sm sm:contents"
8
9
  BADGE_CLASSES = "max-sm:self-start"
9
10
  TEXT_CLASSES = "min-w-0 flex-1"
11
+ 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"
10
13
  LABEL_CLASSES = "ks-paragraph ks-settings-link-label block"
11
14
  SUBTITLE_CLASSES = "ks-value-list-note"
12
15
  VALUE_CLASSES = "ks-value-list-value shrink-0"
13
16
 
14
- attr_reader :rows
17
+ attr_reader :rows, :chevron
15
18
 
16
- def initialize(rows:)
19
+ def initialize(rows:, chevron: true)
17
20
  @rows = rows
21
+ @chevron = chevron
22
+ end
23
+
24
+ def row_options(row)
25
+ { class: [ ROW_CLASSES, (CURRENT_ROW_CLASSES if row[:current]) ].compact.join(" "), aria: { current: ("true" if row[:current]) } }
18
26
  end
19
27
 
20
28
  def badge(row)
21
29
  BadgeComponent.new(**row[:badge], class: BADGE_CLASSES)
22
30
  end
31
+
32
+ def top_line_badge(row)
33
+ BadgeComponent.new(**row[:top_line][:badge])
34
+ end
23
35
  end
24
36
  end
25
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.94.0"
4
+ VERSION = "0.95.0"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: keystone_ui-develop
3
- description: Use PROACTIVELY for building or editing screens in a Rails app that has keystone_ui — page shells with Back links and breadcrumbs, forms and fields, a search field that picks a record or enters a new one, data tables with saved columns, desktop navigation, sidebars and bottom tabs, a phone header with a line above its title and a badge at its right end, a page's main action as a phone top-bar icon or a button fixed to the bottom of the screen, a decision bar of a note field and several buttons sent as one form and fixed to the bottom of a phone screen, a question asked before a button or main action goes ahead, action menus for a record's Edit and Delete, dashboards with stat cards, charts, funnels, goal buckets and timelines of timed steps, drawn one line per step with a marked time axis if wanted, with retries and their count, queued time, failed tries, steps still running, steps waiting on approval, links to each try and the current step marked, amounts shown in green or red as a gain or loss, status dots coloured by state, pictures held to half the screen, a short note or badge at the right of a section's title, a record's details as labelled values in rows or in two columns, two versions of a text compared line by line side by side or in one column, info buttons and breakdowns, marketing sections, a light/dark theme switch — MUST BE USED instead of hand-writing ERB and Tailwind for UI.
3
+ description: Use PROACTIVELY for building or editing screens in a Rails app that has keystone_ui — page shells with Back links and breadcrumbs, forms and fields, a search field that picks a record or enters a new one, data tables with saved columns, desktop navigation, sidebars and bottom tabs, a phone header with a line above its title and a badge at its right end, a page's main action as a phone top-bar icon or a button fixed to the bottom of the screen, a decision bar of a note field and several buttons sent as one form and fixed to the bottom of a phone screen, a question asked before a button or main action goes ahead, action menus for a record's Edit and Delete, dashboards with stat cards, charts, funnels, goal buckets and timelines of timed steps, drawn one line per step with a marked time axis if wanted, with retries and their count, queued time, failed tries, steps still running, steps waiting on approval, links to each try and the current step marked, amounts shown in green or red as a gain or loss, status dots coloured by state, pictures held to half the screen, a short note or badge at the right of a section's title, a record's details as labelled values in rows or in two columns, a queue of links with a type and time above each title and the open one marked, two versions of a text compared line by line side by side or in one column, info buttons and breakdowns, marketing sections, a light/dark theme switch — MUST BE USED instead of hand-writing ERB and Tailwind for UI.
4
4
  tools: Bash, Read, Write, Edit, Grep
5
5
  scope: UI — pages, forms, tables, navigation, dashboards
6
6
  ---
@@ -79,7 +79,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
79
79
  - `ui_paragraph` — a paragraph of running text.
80
80
  - `ui_value_list` — labelled values, as rows of a label beside its value, such as a ledger or a byline, or as columns of a label above its value.
81
81
  - `ui_alert` — a banner message, optionally dismissible.
82
- - `ui_link_list` — a list of links, each row with a label, an optional subtitle, badge and value, and a chevron.
82
+ - `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.
83
83
  - `ui_empty_state` — what a list or section shows when it has nothing in it, with an optional message and action.
84
84
  - `ui_progress` — a labelled progress bar.
85
85
  - `ui_stat_card` — a single metric tile with optional change, link and info button.
@@ -703,9 +703,17 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
703
703
  - `ui_alert(message:, type: :info, title: nil, dismissible: false, class: nil)`
704
704
  — `type:` is `:info` `:success` `:warning` `:error`, and `dismissible: true`
705
705
  adds a close button.
706
- - `ui_link_list(rows:)` — each row is `{ label:, href:, subtitle: nil,
707
- badge: nil, value: nil }`, and `badge:` takes `ui_badge`'s `{ label:, variant: }`.
706
+ - `ui_link_list(rows:, chevron: true)` — each row is `{ label:, href:,
707
+ subtitle: nil, badge: nil, value: nil, top_line: nil, current: false }`,
708
+ and `badge:` takes `ui_badge`'s `{ label:, variant: }`.
708
709
  A row's badge sits above its label below `sm` and beside it from `sm` up.
710
+ `top_line:` is `{ badge:, text: }`, a line above the label with its own
711
+ badge at the left, apart from the row's `badge:`, and short text at the
712
+ right, such as a type and the time left. It stays on one line and cuts off
713
+ long text, while the label and subtitle wrap. `current: true` marks the
714
+ row the person has open with `aria-current` and a tint and accent bar.
715
+ `chevron: false` leaves off every row's chevron, as in a queue beside the
716
+ open item. Ask the developer which row is current on each page.
709
717
  Use it for a list of records that each open their own page, in place of a
710
718
  hand-written `<ul>` of links.
711
719
  - `ui_empty_state(title:, message: nil, action: nil)` — `action:` is
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.94.0
4
+ version: 0.95.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.35.0
18
+ version: 0.36.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.35.0
25
+ version: 0.36.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: view_component
28
28
  requirement: !ruby/object:Gem::Requirement