keystone_ui 0.72.0 → 0.74.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 +4 -4
- data/app/components/keystone/ui/list_detail_component.html.erb +10 -0
- data/app/components/keystone/ui/list_detail_component.rb +28 -0
- data/app/components/keystone/ui/tab_switcher_component.html.erb +19 -1
- data/app/components/keystone/ui/tab_switcher_component.rb +7 -2
- data/app/helpers/keystone_ui_helper.rb +4 -0
- data/lib/keystone_ui/safelist.rb +1 -0
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +14 -0
- data/the_local/interface.yml +3 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fd495c0ec1a80aba3c029677f9af5167d739166c082ff3e8a8da6e1c114c4ee9
|
|
4
|
+
data.tar.gz: e6bc445bc552f872e7946fd05ed90c46875b92309ffa0834845f8d7231032b42
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 32f6d18f423f495b596a2b7ae441665d233c6cf60ac2c61398c28da5ce82454f3f1d349c54a69cd2dc60c727e97553b2c026420c7e498071d5c26eec6c6f8345
|
|
7
|
+
data.tar.gz: 06cbbccbd25af32dee5ddd9deb1b93e881029757a46c7c995547bada74af912ffab52e2f9457249c84b310a126c2cbc01b737db34d1e8374f0e49ac7d8d5dced
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Keystone
|
|
4
|
+
module Ui
|
|
5
|
+
class ListDetailComponent < ViewComponent::Base
|
|
6
|
+
WRAPPER_CLASSES = "grid grid-cols-1 ks-grid-gap-md"
|
|
7
|
+
SPLIT_CLASSES = "lg:grid-cols-3"
|
|
8
|
+
LIST_CLASSES = "min-w-0 lg:order-first"
|
|
9
|
+
DETAIL_CLASSES = "min-w-0 lg:col-span-2"
|
|
10
|
+
|
|
11
|
+
renders_one :detail
|
|
12
|
+
|
|
13
|
+
def classes
|
|
14
|
+
return WRAPPER_CLASSES unless detail?
|
|
15
|
+
|
|
16
|
+
"#{WRAPPER_CLASSES} #{SPLIT_CLASSES}"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def list_classes
|
|
20
|
+
LIST_CLASSES
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def detail_classes
|
|
24
|
+
DETAIL_CLASSES
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -1,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 = "max-sm:flex max-sm:flex-col"
|
|
10
|
+
SUMMARY_CLASSES = "max-sm:order-1 max-sm:[&>:first-child]:mt-0 max-sm:[&>:last-child]:mb-0"
|
|
11
|
+
CONTENT_CLASSES = "max-sm:order-1"
|
|
12
|
+
|
|
13
|
+
renders_one :summary
|
|
9
14
|
|
|
10
15
|
attr_reader :tabs
|
|
11
16
|
|
|
@@ -81,6 +81,10 @@ module KeystoneUiHelper
|
|
|
81
81
|
render Keystone::Ui::GridComponent.new(**args), &block
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
+
def ui_list_detail(**args, &block)
|
|
85
|
+
render Keystone::Ui::ListDetailComponent.new(**args), &block
|
|
86
|
+
end
|
|
87
|
+
|
|
84
88
|
def ui_panel(**args, &block)
|
|
85
89
|
render Keystone::Ui::PanelComponent.new(**args), &block
|
|
86
90
|
end
|
data/lib/keystone_ui/safelist.rb
CHANGED
data/lib/keystone_ui/version.rb
CHANGED
|
@@ -31,6 +31,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
31
31
|
- `ui_breadcrumbs` — a line of links to the pages above the current one, shown from `lg:` up.
|
|
32
32
|
- `ui_section` — a titled block of content with an optional link and action menu in its header.
|
|
33
33
|
- `ui_grid` — a responsive grid with a column count per breakpoint.
|
|
34
|
+
- `ui_list_detail` — a list beside the detail of the item picked from it, with the detail above the list below `lg:`.
|
|
34
35
|
- `ui_panel` — a bordered card surface holding any content.
|
|
35
36
|
- `ui_card_link` — a panel that is one link as a whole.
|
|
36
37
|
- `ui_card` — a fixed card of title, summary and call-to-action link.
|
|
@@ -214,6 +215,12 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
214
215
|
`cols:` maps `:default` `:sm` `:md` `:lg` to a count from 1 to 12, such as
|
|
215
216
|
`{ default: 1, md: 3 }`. `gap:` is `:sm` `:md` `:lg` `:xl`, and passing
|
|
216
217
|
`gap_x:` or `gap_y:` replaces `gap:` entirely.
|
|
218
|
+
- `ui_list_detail` takes no keywords. The block is the list, and
|
|
219
|
+
`layout.with_detail { ... }` is the picked item's detail, left unset when
|
|
220
|
+
nothing is picked. From `lg:` up the list takes the first third of the
|
|
221
|
+
width and the detail the other two thirds beside it. Below `lg:` the detail
|
|
222
|
+
is drawn above the list. With no detail the list takes the full width at
|
|
223
|
+
every size. Write no Tailwind classes of your own to get either order.
|
|
217
224
|
- `ui_panel(padding: :md, radius: :lg, shadow: true)` — `padding:` is `:sm`
|
|
218
225
|
`:md` `:lg` and `radius:` is `:md` `:lg` `:xl`.
|
|
219
226
|
- `ui_card_link(href:, padding: :md, shadow: true)` — `padding:` is `:sm`
|
|
@@ -686,6 +693,13 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
686
693
|
following a tab is a Turbo visit that replaces the history entry. The
|
|
687
694
|
app reads the chosen tab from its params and draws only that tab's
|
|
688
695
|
content in the block.
|
|
696
|
+
- `switcher.with_summary { ... }`, set inside the tab switcher's block,
|
|
697
|
+
takes content such as stat cards. From `sm` up it is drawn above the
|
|
698
|
+
tab row, and below `sm` between the tab row and the panel. It is drawn
|
|
699
|
+
once, so do not draw it twice or add width-specific classes for it.
|
|
700
|
+
- Below `sm` every tab switcher's tab row stays on one line, starts at
|
|
701
|
+
the left edge and scrolls sideways, and from `sm` up it wraps and is
|
|
702
|
+
centred.
|
|
689
703
|
- `ui_swipe_deck(items:, empty_title: "All done!", empty_subtitle: nil)`
|
|
690
704
|
takes a block yielding the deck, where `deck.item { |item| ... }` renders
|
|
691
705
|
one card's face. Accepting sends a bubbling `swipe-deck:complete` event
|
data/the_local/interface.yml
CHANGED
|
@@ -24,6 +24,7 @@ develop:
|
|
|
24
24
|
- ui_page
|
|
25
25
|
- ui_section
|
|
26
26
|
- ui_grid
|
|
27
|
+
- ui_list_detail
|
|
27
28
|
- ui_panel
|
|
28
29
|
- ui_card_link
|
|
29
30
|
- ui_input
|
|
@@ -138,6 +139,8 @@ sources:
|
|
|
138
139
|
- app/components/keystone/ui/bucket_series_component.rb
|
|
139
140
|
- app/components/keystone/ui/grid_component.rb
|
|
140
141
|
- app/components/keystone/ui/hero_component.rb
|
|
142
|
+
- app/components/keystone/ui/list_detail_component.rb
|
|
143
|
+
- app/components/keystone/ui/list_detail_component.html.erb
|
|
141
144
|
- app/components/keystone/ui/input_component.rb
|
|
142
145
|
- app/components/keystone/ui/line_chart_component.rb
|
|
143
146
|
- app/components/keystone/ui/mobile_actions_component.rb
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: keystone_ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.74.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tyler Schneider
|
|
@@ -159,6 +159,8 @@ files:
|
|
|
159
159
|
- app/components/keystone/ui/line_chart_component.rb
|
|
160
160
|
- app/components/keystone/ui/link_list_component.html.erb
|
|
161
161
|
- app/components/keystone/ui/link_list_component.rb
|
|
162
|
+
- app/components/keystone/ui/list_detail_component.html.erb
|
|
163
|
+
- app/components/keystone/ui/list_detail_component.rb
|
|
162
164
|
- app/components/keystone/ui/mobile_action_component.rb
|
|
163
165
|
- app/components/keystone/ui/mobile_actions_component.html.erb
|
|
164
166
|
- app/components/keystone/ui/mobile_actions_component.rb
|