keystone_ui 0.76.0 → 0.77.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/bottom_action_component.rb +36 -0
- 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 +17 -2
- data/the_local/agents/keystone_ui-info.md +9 -1
- data/the_local/agents/keystone_ui-install.md +1 -1
- data/the_local/interface.yml +2 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 27865b2e7f95837a7c915aea020f129702dd705cea1dbc53cfb65f54039de0ac
|
|
4
|
+
data.tar.gz: fc80893a3e533c51f238cc4ac4e2162f567557a3ebb620fd959ab46be72dd196
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5f7f08636bb8c78b3f5e8036f4decf9fa5781628c9d4fba01c748a409fb421840295b0914ae64629a8a9fbfdab0cf64f3f7fa4fa94494ef8dc3ad0ad4fb25c54
|
|
7
|
+
data.tar.gz: bd4a3ff320b6628a12bdf0a2678542885bbb1b679aecc8e0d5d8e89cc05280417631db2945f5eac98794352321765d66be7ae0d4a55d6ff3c8df40becf1eb039
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Keystone
|
|
4
|
+
module Ui
|
|
5
|
+
class BottomActionComponent < ViewComponent::Base
|
|
6
|
+
BAR_CLASSES = "ks-bottom-action sm:hidden hotwire-native:hidden print:hidden"
|
|
7
|
+
SPACER_CLASSES = "sm:hidden hotwire-native:hidden print:hidden"
|
|
8
|
+
BAR_COPY_CLASSES = "!static invisible"
|
|
9
|
+
TAB_BAR_ROOM_CLASSES = "hidden h-(--ks-bottom-nav-height) [body:has(.ks-bottom-nav)_&]:block"
|
|
10
|
+
|
|
11
|
+
def render?
|
|
12
|
+
content_for?(:mobile_action_url)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def call
|
|
16
|
+
safe_join([ tag.div(class: BAR_CLASSES) { render button }, spacer ])
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def spacer
|
|
22
|
+
tag.div(class: SPACER_CLASSES, inert: true, data: { bottom_action_spacer: true }) do
|
|
23
|
+
safe_join([ tag.div(class: "#{BAR_CLASSES} #{BAR_COPY_CLASSES}") { render button }, tag.div(class: TAB_BAR_ROOM_CLASSES) ])
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def button
|
|
28
|
+
ButtonComponent.new(label: content_for(:mobile_action_label), href: content_for(:mobile_action_url), method: action_method, full_width: true)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def action_method
|
|
32
|
+
content_for?(:mobile_action_method) ? content_for(:mobile_action_method).to_sym : :get
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -161,6 +161,10 @@ module KeystoneUiHelper
|
|
|
161
161
|
render Keystone::Ui::MobileActionComponent.new
|
|
162
162
|
end
|
|
163
163
|
|
|
164
|
+
def ui_bottom_action
|
|
165
|
+
render Keystone::Ui::BottomActionComponent.new
|
|
166
|
+
end
|
|
167
|
+
|
|
164
168
|
def ui_navbar(**args, &block)
|
|
165
169
|
render Keystone::Ui::NavbarComponent.new(**args), &block
|
|
166
170
|
end
|
data/lib/keystone_ui/safelist.rb
CHANGED
|
@@ -51,6 +51,7 @@ module Keystone
|
|
|
51
51
|
Keystone::Ui::FormPageComponent,
|
|
52
52
|
Keystone::Ui::MobileActionsComponent,
|
|
53
53
|
Keystone::Ui::MobileActionComponent,
|
|
54
|
+
Keystone::Ui::BottomActionComponent,
|
|
54
55
|
Keystone::Ui::MobileHeaderComponent,
|
|
55
56
|
Keystone::Ui::ShowPageComponent,
|
|
56
57
|
Keystone::Ui::OptionCardComponent,
|
data/lib/keystone_ui/version.rb
CHANGED
|
@@ -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, action menus for a record's Edit and Delete, dashboards with stat cards, charts, funnels, goal buckets and timelines of timed steps, amounts shown in green or red as a gain or loss, pictures held to half the screen, 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 page's main action as a phone top-bar icon or a button fixed to the bottom of the screen, action menus for a record's Edit and Delete, dashboards with stat cards, charts, funnels, goal buckets and timelines of timed steps, amounts shown in green or red as a gain or loss, pictures held to half the screen, 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
|
---
|
|
@@ -44,6 +44,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
44
44
|
- `ui_mobile_header` — a mobile back arrow and a title beside it.
|
|
45
45
|
- `ui_mobile_actions` — an ellipsis menu of actions shown only below `lg:`.
|
|
46
46
|
- `ui_mobile_action` — a plus icon link to the action a screen's page header publishes, for the phone top bar.
|
|
47
|
+
- `ui_bottom_action` — a full-width button for the action a screen's page header publishes, in a bar fixed to the bottom of a phone screen.
|
|
47
48
|
- `ui_action_menu` — an ellipsis menu of actions shown at every screen size.
|
|
48
49
|
- `ui_action_menu_item` — one action in an action menu, as a link or a button sending a method.
|
|
49
50
|
- `ui_settings_link` — a full-width settings row with a chevron.
|
|
@@ -310,6 +311,20 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
310
311
|
a Hotwire Native web view, so give native users another way to reach the
|
|
311
312
|
action, such as `ui_mobile_actions`. The layout must also write the
|
|
312
313
|
`hotwire-native` class on `<html>` and declare that Tailwind variant.
|
|
314
|
+
- `ui_bottom_action` takes no keywords and no block. It draws the
|
|
315
|
+
`action_url:` a screen gives `ui_page_header` as a full-width `ui_button`
|
|
316
|
+
labelled with its `action_label:`, in a bar fixed to the bottom of the
|
|
317
|
+
screen, above `ui_bottom_nav` on a page that has one. With
|
|
318
|
+
`action_method:` the button sends that method as `ui_button` does, so it
|
|
319
|
+
cannot sit inside a form. It draws nothing when the screen gives no
|
|
320
|
+
`action_url:`, so call it after `ui_page_header` has run, such as in the
|
|
321
|
+
layout after `yield`. It is hidden from `sm:` up, inside a Hotwire Native
|
|
322
|
+
web view and in print, like `ui_mobile_action`. It also draws an invisible
|
|
323
|
+
copy of the bar in the page's flow, plus the bottom nav's height when the
|
|
324
|
+
page has a `ui_bottom_nav`, so the page's last content scrolls clear of
|
|
325
|
+
both. Add no padding of your own for them. It and `ui_mobile_action`
|
|
326
|
+
draw the same action, so ask the developer which one a screen shows on a
|
|
327
|
+
phone.
|
|
313
328
|
- `ui_settings_link(label:, href:)` renders one settings row.
|
|
314
329
|
- `ui_theme_toggle` takes no keywords and no block. Its buttons switch the
|
|
315
330
|
theme at once and store the choice in the `keystone_theme` cookie for a
|
|
@@ -793,7 +808,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
793
808
|
and swipe deck render only what is registered through the object they yield,
|
|
794
809
|
so anything else emitted in their block is dropped.
|
|
795
810
|
- **Check both screen sizes.** Page headers with no badges or menu, mobile headers, mobile actions,
|
|
796
|
-
bottom navigation, breadcrumbs and `ui_navigation`'s bars render on one side
|
|
811
|
+
the bottom action, bottom navigation, breadcrumbs and `ui_navigation`'s bars render on one side
|
|
797
812
|
of `lg:` or `sm:` only, so a screen needs both treatments.
|
|
798
813
|
- Out of scope: installing or upgrading the gem, its configuration, the theme
|
|
799
814
|
attributes on the layout, and the palette, which belong to
|
|
@@ -93,6 +93,14 @@ One decision: is keystone_ui set up in the app?
|
|
|
93
93
|
submits an empty id and shows the new record's fields the page placed inside
|
|
94
94
|
the dropdown, and picking a match afterwards hides them again. The arrow keys
|
|
95
95
|
move through the list, Enter picks, and Escape closes it.
|
|
96
|
+
- **A page's main action on a phone.** A page header can name one main action:
|
|
97
|
+
a label, an address and an optional HTTP method. The header shows it as a
|
|
98
|
+
button and also publishes it to the layout. Below `sm:` the layout can show it
|
|
99
|
+
again as a plus icon in the top bar, or as a full-width button in a bar fixed
|
|
100
|
+
to the bottom of the screen, above the bottom tab bar when the page has one. The page leaves room under
|
|
101
|
+
its last content so the bar does not cover it. Both forms show nothing when
|
|
102
|
+
the header names no action, and both are hidden inside a Hotwire Native web
|
|
103
|
+
view and in print.
|
|
96
104
|
- **Action menus.** Each action is a label, an address and an HTTP method. A
|
|
97
105
|
plain visit is a link, and any other method is a button, so an action that
|
|
98
106
|
changes data is never a bare link. A delete asks for confirmation by default.
|
|
@@ -119,4 +127,4 @@ One decision: is keystone_ui set up in the app?
|
|
|
119
127
|
Stimulus controllers, so a host writes no JavaScript. Components that post,
|
|
120
128
|
such as the column picker and the pipeline, post to endpoints the host or
|
|
121
129
|
another gem owns.
|
|
122
|
-
- Ruby >= 3.2, ViewComponent >= 2.0 and < 5, keystone_ui-styles >= 0.
|
|
130
|
+
- Ruby >= 3.2, ViewComponent >= 2.0 and < 5, keystone_ui-styles >= 0.34.0.
|
|
@@ -50,7 +50,7 @@ built on ViewComponent; hook it in before building any screen with those helpers
|
|
|
50
50
|
## How to use it
|
|
51
51
|
|
|
52
52
|
1. Confirm the prerequisites: Ruby >= 3.2 and **tailwindcss-rails v4+** in the
|
|
53
|
-
host app. The gem brings ViewComponent and keystone_ui-styles 0.
|
|
53
|
+
host app. The gem brings ViewComponent and keystone_ui-styles 0.34.0 or later with it.
|
|
54
54
|
Tailwind does not have to be initialized first, because the generator creates
|
|
55
55
|
the stylesheet if it is missing.
|
|
56
56
|
|
data/the_local/interface.yml
CHANGED
|
@@ -42,6 +42,7 @@ develop:
|
|
|
42
42
|
- ui_mobile_header
|
|
43
43
|
- ui_mobile_actions
|
|
44
44
|
- ui_mobile_action
|
|
45
|
+
- ui_bottom_action
|
|
45
46
|
- ui_action_menu
|
|
46
47
|
- ui_action_menu_item
|
|
47
48
|
- ui_navbar
|
|
@@ -148,6 +149,7 @@ sources:
|
|
|
148
149
|
- app/components/keystone/ui/line_chart_component.rb
|
|
149
150
|
- app/components/keystone/ui/mobile_actions_component.rb
|
|
150
151
|
- app/components/keystone/ui/mobile_action_component.rb
|
|
152
|
+
- app/components/keystone/ui/bottom_action_component.rb
|
|
151
153
|
- app/components/keystone/ui/action_menu_component.rb
|
|
152
154
|
- app/components/keystone/ui/action_menu_item_component.rb
|
|
153
155
|
- app/components/keystone/ui/mobile_header_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.77.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.
|
|
18
|
+
version: 0.34.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.
|
|
25
|
+
version: 0.34.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: view_component
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -87,6 +87,7 @@ files:
|
|
|
87
87
|
- app/components/keystone/ui/badge_component.rb
|
|
88
88
|
- app/components/keystone/ui/bar_chart_component.html.erb
|
|
89
89
|
- app/components/keystone/ui/bar_chart_component.rb
|
|
90
|
+
- app/components/keystone/ui/bottom_action_component.rb
|
|
90
91
|
- app/components/keystone/ui/bottom_nav_component.html.erb
|
|
91
92
|
- app/components/keystone/ui/bottom_nav_component.rb
|
|
92
93
|
- app/components/keystone/ui/bottom_nav_item_component.html.erb
|