keystone_ui 0.21.0 → 0.21.1

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: 3ebe6bbc917891684b563a1981daf0cc0b32a747143f52d72af17bd2a9df2e7d
4
- data.tar.gz: 0320fdf4a5c56b52e6919641022b1fbd05dd2ccdcb5c8b91553f696d3ab3e115
3
+ metadata.gz: 2c400b566f0760e79b2808012f91e7b4d978ec0ad7e7caa8b83dc0e18b1007ec
4
+ data.tar.gz: 594c632edd55b0ae49c62226ae0e8ebdcc38469827abf0f508c87f9812f79aa2
5
5
  SHA512:
6
- metadata.gz: b6b75345f8165d8ae02e9d7a7e6fe24a015f37f07437082dcad6d3543fa17b56013073ef9c69729be5b330b1959f69e0bb33d628df176d01fe69ae296c33713a
7
- data.tar.gz: 04b8b2e35b0d24fcb507d0293142aba61723ed1737478da8376bce4b6533b97fe12ca2efe9a629c92916b1aba4fdee8f47ec7bbf85c8e74bb39e60d409ae9375
6
+ metadata.gz: ed9434328fd13e5c1a48060beba4174ebb78d72b36fbec129389571c40661a58ef5adc6e1245e19186a92a31738a80e4ba4896390b883b909d45d33ce1de93d9
7
+ data.tar.gz: 9ae4ec9ec70310c666b8c3bd810517099e5d03566f04763c706df9193b705d512c585f0b64427db6999acd0318f88047f24af0dcc6cea65971abbf6a8c558dd6
@@ -3,14 +3,16 @@
3
3
  <% content_for :form_page_back_url, @back_url %>
4
4
 
5
5
  <% if @trail %>
6
- <%= render Keystone::Ui::BreadcrumbsComponent.new(trail: @trail, current: @title) %>
6
+ <% content_for :keystone_page_header, render(Keystone::Ui::BreadcrumbsComponent.new(trail: @trail, current: @title)) %>
7
7
  <% else %>
8
- <%= render Keystone::Ui::DesktopBackLinkComponent.new(url: @back_url) %>
8
+ <% content_for :keystone_page_header, render(Keystone::Ui::DesktopBackLinkComponent.new(url: @back_url)) %>
9
9
  <% end %>
10
10
 
11
- <div class="<%= DESKTOP_WRAPPER_CLASSES %>">
12
- <h1 class="<%= TITLE_CLASSES %>"><%= @title %></h1>
13
- <% if subtitle? %>
14
- <p class="<%= SUBTITLE_CLASSES %>"><%= @subtitle %></p>
15
- <% end %>
16
- </div>
11
+ <% content_for :keystone_page_header do %>
12
+ <div class="<%= DESKTOP_WRAPPER_CLASSES %>">
13
+ <h1 class="<%= TITLE_CLASSES %>"><%= @title %></h1>
14
+ <% if subtitle? %>
15
+ <p class="<%= SUBTITLE_CLASSES %>"><%= @subtitle %></p>
16
+ <% end %>
17
+ </div>
18
+ <% end %>
@@ -1,3 +1,4 @@
1
1
  <div class="<%= classes %>">
2
+ <%= content_for(:keystone_page_header) %>
2
3
  <%= content %>
3
4
  </div>
@@ -4,7 +4,7 @@
4
4
  <% content_for :show_page_subtitle, @subtitle if @subtitle.present? %>
5
5
 
6
6
  <% if @trail %>
7
- <%= render Keystone::Ui::BreadcrumbsComponent.new(trail: @trail, current: @title) %>
7
+ <% content_for :keystone_page_header, render(Keystone::Ui::BreadcrumbsComponent.new(trail: @trail, current: @title)) %>
8
8
  <% else %>
9
- <%= render Keystone::Ui::DesktopBackLinkComponent.new(url: @back_url) %>
9
+ <% content_for :keystone_page_header, render(Keystone::Ui::DesktopBackLinkComponent.new(url: @back_url)) %>
10
10
  <% end %>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.21.0"
4
+ VERSION = "0.21.1"
5
5
  end
@@ -42,7 +42,9 @@ outer element. See Conventions before using it.
42
42
  - `ui_page(max_width: :full, padding: :standard, top_offset: nil, class: nil)` —
43
43
  takes a block. The outer wrapper for a screen. `max_width:` `:sm` `:md` `:lg`
44
44
  `:xl` `:full`; `padding:` `:standard` or `:none`; `top_offset:` `:sm` `:md`
45
- `:lg` `:xl` to clear a fixed navbar.
45
+ `:lg` `:xl` to clear a fixed navbar. When `ui_form_page` or `ui_show_page` was
46
+ called earlier on the same screen, `ui_page` renders their back link or
47
+ breadcrumbs, and the form page's title, at its top, above the block.
46
48
  - `ui_section(title: nil, subtitle: nil, action: nil, spacing: :md, class: nil)`
47
49
  — takes a block. A titled block of content with an optional right-aligned
48
50
  link. `action:` is `{ label:, href: }`; `spacing:` `:sm` `:md` `:lg`.
@@ -63,17 +65,21 @@ outer element. See Conventions before using it.
63
65
  the right; only what `action` receives is rendered. Passing `action_url:`
64
66
  publishes that URL and label for a mobile navbar to pick up.
65
67
  - `ui_form_page(title:, back_url:, subtitle: nil, trail: nil)` — the shell
66
- marker for a form screen. Renders a "Back" link to `back_url` shown from `lg:`
67
- up, then the title and subtitle shown from `md:` up, and publishes the title
68
- and back URL so the navbar can render mobile header context. Passing `trail:`
69
- replaces the "Back" link with breadcrumbs: the trail's links followed by
70
- `title` unlinked, as `ui_breadcrumbs` renders them. `back_url:` is still
71
- required with a trail, because the mobile header still uses it.
68
+ marker for a form screen. It renders nothing where it is called. It publishes
69
+ the title and back URL so the navbar can render mobile header context, and
70
+ hands `ui_page` a "Back" link to `back_url` shown from `lg:` up, then the
71
+ title and subtitle shown from `md:` up. Call it before `ui_page`, outside
72
+ `ui_page`'s block, or none of that appears. Passing `trail:` replaces the
73
+ "Back" link with breadcrumbs: the trail's links followed by `title` unlinked,
74
+ as `ui_breadcrumbs` renders them. `back_url:` is still required with a trail,
75
+ because the mobile header still uses it.
72
76
  - `ui_show_page(title:, back_url:, subtitle: nil, trail: nil)` — the shell marker
73
- for a detail screen. Renders a "Back" link to `back_url` shown from `lg:` up,
74
- and publishes the title, subtitle, and back URL for the navbar. It renders no
75
- title, so pair it with `ui_page_header` for the desktop title. `trail:` works
76
- as it does on `ui_form_page`, ending the breadcrumbs with `title` unlinked.
77
+ for a detail screen. It renders nothing where it is called. It publishes the
78
+ title, subtitle, and back URL for the navbar, and hands `ui_page` a "Back"
79
+ link to `back_url` shown from `lg:` up. Call it before `ui_page`, outside
80
+ `ui_page`'s block. It shows no title, so put `ui_page_header` inside the
81
+ `ui_page` block for the desktop title. `trail:` works as it does on
82
+ `ui_form_page`, ending the breadcrumbs with `title` unlinked.
77
83
  - `ui_breadcrumbs(trail:, current: nil)` — a line of links shown only from `lg:`
78
84
  up. `trail:` is `[[label, href], ...]`, from the top level down, and each pair
79
85
  renders as a link, separated by `›`. `current:` is the page being shown,
@@ -300,12 +306,25 @@ outer element. See Conventions before using it.
300
306
  composition before inventing one; that screen is the house style.
301
307
 
302
308
  3. Pick the page shell for what you are building:
303
- - a form screen → `ui_form_page`
304
- - a detail screen → `ui_show_page`
309
+ - a form screen → `ui_form_page`, then `ui_page` holding the form
310
+ - a detail screen → `ui_show_page`, then `ui_page` holding `ui_page_header`
311
+ and the details
305
312
  - anything else → `ui_page`, with `ui_page_header` for the desktop title.
306
313
 
307
- `ui_form_page` and `ui_show_page` render the desktop "Back" link themselves,
308
- so never add a second back link or button to those screens. Whether a screen
314
+ ```erb
315
+ <%= ui_form_page(title: "New quote", back_url: quotes_path) %>
316
+ <%= ui_page(max_width: :md) do %>
317
+ <%= ui_form(action: quotes_path) do %>
318
+ ...
319
+ <% end %>
320
+ <% end %>
321
+ ```
322
+
323
+ The shell call always comes first and sits outside `ui_page`'s block,
324
+ because `ui_page` renders what the shell handed it at its own top. A form or
325
+ detail screen without `ui_page` shows no desktop "Back" link or form title.
326
+ Those shells supply the desktop "Back" link themselves, so never add a
327
+ second back link or button to those screens. Whether a screen
309
328
  shows that "Back" link or breadcrumbs, and which parent screens the trail
310
329
  names, is the developer's choice, so ask before passing `trail:`. Below `lg:` the
311
330
  back link comes from `ui_mobile_header`, which the navbar renders from the
@@ -26,9 +26,11 @@ separate mobile and desktop treatments (a bottom tab bar and mobile header on
26
26
  small screens, a full navigation bar from the `lg:` breakpoint up), because
27
27
  these apps are often viewed in a native webview. The form and show page shells
28
28
  follow the same split for going back: the mobile header carries the back link on
29
- small screens, and the shell renders a "Back" link above the title from `lg:` up.
30
- Given a trail of earlier pages instead, the shell renders breadcrumbs there in
31
- place of that link, ending with the page's own title.
29
+ small screens, and from `lg:` up the shell shows a "Back" link. Given a trail of
30
+ earlier pages instead, the shell shows breadcrumbs in place of that link, ending
31
+ with the page's own title. That link or those breadcrumbs, and the form page's
32
+ title, appear at the top of the page container, inside its width and padding, so
33
+ a page using either shell also uses the page container.
32
34
 
33
35
  ## Interface
34
36
 
@@ -114,6 +114,7 @@ sources:
114
114
  - app/components/keystone/ui/navbar_component.rb
115
115
  - app/components/keystone/ui/option_card_component.rb
116
116
  - app/components/keystone/ui/page_component.rb
117
+ - app/components/keystone/ui/page_component.html.erb
117
118
  - app/components/keystone/ui/page_header_component.rb
118
119
  - app/components/keystone/ui/panel_component.rb
119
120
  - app/components/keystone/ui/pipeline_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.21.0
4
+ version: 0.21.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider