keystone_ui 0.98.0 → 0.99.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/assets/tailwind/keystone_ui_engine/grid_safelist.css +1 -1
- data/app/components/keystone/ui/button_row_component.rb +3 -2
- data/app/components/keystone/ui/caption_component.html.erb +1 -1
- data/app/components/keystone/ui/caption_component.rb +4 -2
- data/app/components/keystone/ui/decision_bar_component.html.erb +6 -6
- data/app/components/keystone/ui/decision_bar_component.rb +82 -16
- data/app/components/keystone/ui/grid_component.rb +18 -3
- data/app/components/keystone/ui/link_list_component.rb +3 -2
- data/app/components/keystone/ui/mobile_header_component.html.erb +4 -4
- data/app/components/keystone/ui/nav_dropdown_component.html.erb +1 -1
- data/app/components/keystone/ui/nav_dropdown_component.rb +1 -0
- data/app/components/keystone/ui/page_header_component.html.erb +1 -1
- data/app/components/keystone/ui/page_header_component.rb +7 -1
- data/app/components/keystone/ui/review_card_component.rb +1 -1
- data/app/components/keystone/ui/section_component.html.erb +1 -1
- data/app/components/keystone/ui/section_component.rb +2 -1
- data/app/components/keystone/ui/stat_card_component.html.erb +3 -3
- data/app/components/keystone/ui/stat_card_component.rb +19 -3
- data/app/components/keystone/ui/tab_switcher_component.html.erb +1 -1
- data/app/components/keystone/ui/tab_switcher_component.rb +4 -0
- data/app/components/keystone/ui/timeline_component.html.erb +4 -6
- data/app/components/keystone/ui/timeline_component.rb +11 -2
- data/app/helpers/keystone_ui_helper.rb +2 -2
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +56 -25
- data/the_local/agents/keystone_ui-info.md +18 -6
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cb91bd02dbb47370be07dad4d4a5052c1a719678e6b4b53407187847ff3a5697
|
|
4
|
+
data.tar.gz: 9a7dfe91f4779e2ae43d3be48a8b3ef2ec7dfdd8f97c74de60dc29491e9b2336
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5056738e253f18d5f2ca3d732d727a33523cda10054e181e4f2e9a3d6c892d5064ee416edffc2f738bebbe7cc425e8b5add580503dfd36dafbf9f0a9d1b522a8
|
|
7
|
+
data.tar.gz: 40b4f45fc19561b23dbca6e131e071dea1038050eae13470345687baf663157871c4a3036319d747e6a157aaa4e510d61387268c7de6226508997d8897a92c88
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/* Safelist: grid-cols classes built from static constants in GridComponent.
|
|
2
2
|
Belt-and-suspenders — ensures these classes survive JIT purging even if
|
|
3
3
|
the scanner misses the Ruby hash literals. */
|
|
4
|
-
@source inline("grid-cols-1 grid-cols-2 grid-cols-3 grid-cols-4 grid-cols-5 grid-cols-6 grid-cols-7 grid-cols-8 grid-cols-9 grid-cols-10 grid-cols-11 grid-cols-12 sm:grid-cols-1 sm:grid-cols-2 sm:grid-cols-3 sm:grid-cols-4 sm:grid-cols-5 sm:grid-cols-6 sm:grid-cols-7 sm:grid-cols-8 sm:grid-cols-9 sm:grid-cols-10 sm:grid-cols-11 sm:grid-cols-12 md:grid-cols-1 md:grid-cols-2 md:grid-cols-3 md:grid-cols-4 md:grid-cols-5 md:grid-cols-6 md:grid-cols-7 md:grid-cols-8 md:grid-cols-9 md:grid-cols-10 md:grid-cols-11 md:grid-cols-12 lg:grid-cols-1 lg:grid-cols-2 lg:grid-cols-3 lg:grid-cols-4 lg:grid-cols-5 lg:grid-cols-6 lg:grid-cols-7 lg:grid-cols-8 lg:grid-cols-9 lg:grid-cols-10 lg:grid-cols-11 lg:grid-cols-12");
|
|
4
|
+
@source inline("grid-cols-1 grid-cols-2 grid-cols-3 grid-cols-4 grid-cols-5 grid-cols-6 grid-cols-7 grid-cols-8 grid-cols-9 grid-cols-10 grid-cols-11 grid-cols-12 sm:grid-cols-1 sm:grid-cols-2 sm:grid-cols-3 sm:grid-cols-4 sm:grid-cols-5 sm:grid-cols-6 sm:grid-cols-7 sm:grid-cols-8 sm:grid-cols-9 sm:grid-cols-10 sm:grid-cols-11 sm:grid-cols-12 md:grid-cols-1 md:grid-cols-2 md:grid-cols-3 md:grid-cols-4 md:grid-cols-5 md:grid-cols-6 md:grid-cols-7 md:grid-cols-8 md:grid-cols-9 md:grid-cols-10 md:grid-cols-11 md:grid-cols-12 lg:grid-cols-1 lg:grid-cols-2 lg:grid-cols-3 lg:grid-cols-4 lg:grid-cols-5 lg:grid-cols-6 lg:grid-cols-7 lg:grid-cols-8 lg:grid-cols-9 lg:grid-cols-10 lg:grid-cols-11 lg:grid-cols-12 xl:grid-cols-1 xl:grid-cols-2 xl:grid-cols-3 xl:grid-cols-4 xl:grid-cols-5 xl:grid-cols-6 xl:grid-cols-7 xl:grid-cols-8 xl:grid-cols-9 xl:grid-cols-10 xl:grid-cols-11 xl:grid-cols-12 grid-cols-[minmax(0,3fr)_minmax(0,2fr)] sm:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] md:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] xl:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] grid-cols-[minmax(0,2fr)_minmax(0,3fr)] sm:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] lg:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] xl:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]");
|
|
@@ -7,12 +7,13 @@ module Keystone
|
|
|
7
7
|
EQUAL_WIDTH_CLASSES = "*:flex-1 *:whitespace-nowrap"
|
|
8
8
|
PHONE_EQUAL_WIDTH_CLASSES = "max-sm:*:flex-1 max-sm:*:whitespace-nowrap"
|
|
9
9
|
|
|
10
|
-
def initialize(equal_width: false)
|
|
10
|
+
def initialize(equal_width: false, class: nil)
|
|
11
11
|
@equal_width = equal_width
|
|
12
|
+
@extra_classes = binding.local_variable_get(:class)
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def row_classes
|
|
15
|
-
[ ROW_CLASSES, equal_width_classes ].compact.join(" ")
|
|
16
|
+
[ ROW_CLASSES, equal_width_classes, @extra_classes ].compact.join(" ")
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<p class="<%= classes %>"><%= text %></p>
|
|
1
|
+
<p class="<%= classes %>"><%= content || text %></p>
|
|
@@ -4,16 +4,18 @@ module Keystone
|
|
|
4
4
|
module Ui
|
|
5
5
|
class CaptionComponent < ViewComponent::Base
|
|
6
6
|
TONE_CLASSES = { muted: "ks-caption", link: "ks-caption ks-caption-link" }.freeze
|
|
7
|
+
NORMAL_CASE_CLASSES = "ks-caption-normal-case"
|
|
7
8
|
|
|
8
9
|
attr_reader :text
|
|
9
10
|
|
|
10
|
-
def initialize(text
|
|
11
|
+
def initialize(text: nil, tone: :muted, normal_case: false)
|
|
12
|
+
@normal_case = normal_case
|
|
11
13
|
@text = text
|
|
12
14
|
@tone = tone
|
|
13
15
|
end
|
|
14
16
|
|
|
15
17
|
def classes
|
|
16
|
-
TONE_CLASSES.fetch(@tone)
|
|
18
|
+
[ TONE_CLASSES.fetch(@tone), (NORMAL_CASE_CLASSES if @normal_case) ].compact.join(" ")
|
|
17
19
|
end
|
|
18
20
|
end
|
|
19
21
|
end
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<%= form_with url: @url, method: @method, class:
|
|
2
|
-
<div class="<%=
|
|
1
|
+
<%= form_with url: @url, method: @method, class: form_classes do %>
|
|
2
|
+
<div class="<%= bar_classes %>">
|
|
3
3
|
<% if @note %>
|
|
4
|
-
<label class="<%=
|
|
4
|
+
<label class="<%= note_classes %>"><span class="<%= NOTE_LABEL_CLASSES %>"><%= @note[:label] %></span><%= render Keystone::Ui::InputComponent.new(name: @note[:name], placeholder: @note[:placeholder]) %></label>
|
|
5
5
|
<% end %>
|
|
6
6
|
<%= buttons %>
|
|
7
7
|
</div>
|
|
8
8
|
<% if @hint %>
|
|
9
|
-
<p class="<%=
|
|
9
|
+
<p class="<%= hint_classes %>"><%= @hint %></p>
|
|
10
10
|
<% end %>
|
|
11
11
|
<% end %>
|
|
12
|
-
<div class="<%=
|
|
13
|
-
<div class="<%=
|
|
12
|
+
<div class="<%= spacer_classes %>" data-decision-bar-spacer inert>
|
|
13
|
+
<div class="<%= bar_classes %> <%= BAR_COPY_CLASSES %>"><%= buttons %></div>
|
|
14
14
|
<div class="<%= TAB_BAR_ROOM_CLASSES %>"></div>
|
|
15
15
|
</div>
|
|
@@ -3,22 +3,68 @@
|
|
|
3
3
|
module Keystone
|
|
4
4
|
module Ui
|
|
5
5
|
class DecisionBarComponent < ViewComponent::Base
|
|
6
|
-
FORM_CLASSES =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
FORM_CLASSES = {
|
|
7
|
+
sm: "ks-panel ks-panel-radius-md ks-panel-padding-sm flex flex-wrap items-center ks-grid-gap-sm max-sm:contents",
|
|
8
|
+
md: "ks-panel ks-panel-radius-md ks-panel-padding-sm flex flex-wrap items-center ks-grid-gap-sm max-md:contents",
|
|
9
|
+
lg: "ks-panel ks-panel-radius-md ks-panel-padding-sm flex flex-wrap items-center ks-grid-gap-sm max-lg:contents"
|
|
10
|
+
}.freeze
|
|
11
|
+
BAR_CLASSES = {
|
|
12
|
+
sm: "ks-bottom-action max-sm:flex-col ks-grid-gap-sm sm:contents hotwire-native:bottom-0",
|
|
13
|
+
md: "ks-bottom-action max-md:flex-col ks-grid-gap-sm md:contents hotwire-native:bottom-0",
|
|
14
|
+
lg: "ks-bottom-action max-lg:flex-col ks-grid-gap-sm lg:contents hotwire-native:bottom-0"
|
|
15
|
+
}.freeze
|
|
16
|
+
PRIMARY_CLASSES = {
|
|
17
|
+
sm: "max-sm:order-first max-sm:*:w-full max-sm:*:min-h-12",
|
|
18
|
+
md: "max-md:order-first max-md:*:w-full max-md:*:min-h-12",
|
|
19
|
+
lg: "max-lg:order-first max-lg:*:w-full max-lg:*:min-h-12"
|
|
20
|
+
}.freeze
|
|
21
|
+
ACTION_CLASSES = "flex *:flex-1 *:min-w-0 *:wrap-break-word *:text-center"
|
|
22
|
+
SECONDARY_ROW_CLASSES = {
|
|
23
|
+
sm: "max-sm:*:flex-1 max-sm:*:min-w-0",
|
|
24
|
+
md: "max-md:*:flex-1 max-md:*:min-w-0",
|
|
25
|
+
lg: "max-lg:*:flex-1 max-lg:*:min-w-0"
|
|
26
|
+
}.freeze
|
|
27
|
+
PHONE_ONLY_CLASSES = {
|
|
28
|
+
sm: "sm:hidden",
|
|
29
|
+
md: "md:hidden",
|
|
30
|
+
lg: "lg:hidden"
|
|
31
|
+
}.freeze
|
|
32
|
+
PHONE_ORDER_CLASSES = {
|
|
33
|
+
sm: { 1 => "max-sm:order-1", 2 => "max-sm:order-2", 3 => "max-sm:order-3" }.freeze,
|
|
34
|
+
md: { 1 => "max-md:order-1", 2 => "max-md:order-2", 3 => "max-md:order-3" }.freeze,
|
|
35
|
+
lg: { 1 => "max-lg:order-1", 2 => "max-lg:order-2", 3 => "max-lg:order-3" }.freeze
|
|
36
|
+
}.freeze
|
|
37
|
+
PHONE_LABEL_CLASSES = {
|
|
38
|
+
sm: "sm:hidden",
|
|
39
|
+
md: "md:hidden",
|
|
40
|
+
lg: "lg:hidden"
|
|
41
|
+
}.freeze
|
|
42
|
+
FULL_LABEL_CLASSES = {
|
|
43
|
+
sm: "max-sm:hidden",
|
|
44
|
+
md: "max-md:hidden",
|
|
45
|
+
lg: "max-lg:hidden"
|
|
46
|
+
}.freeze
|
|
47
|
+
HINT_CLASSES = {
|
|
48
|
+
sm: "ks-hint basis-full max-sm:hidden",
|
|
49
|
+
md: "ks-hint basis-full max-md:hidden",
|
|
50
|
+
lg: "ks-hint basis-full max-lg:hidden"
|
|
51
|
+
}.freeze
|
|
15
52
|
BAR_COPY_CLASSES = "!static invisible"
|
|
16
|
-
SPACER_CLASSES =
|
|
53
|
+
SPACER_CLASSES = {
|
|
54
|
+
sm: "sm:hidden",
|
|
55
|
+
md: "md:hidden",
|
|
56
|
+
lg: "lg:hidden"
|
|
57
|
+
}.freeze
|
|
17
58
|
TAB_BAR_ROOM_CLASSES = "hidden h-(--ks-bottom-nav-height) [html:not(.hotwire-native)_body:has(.ks-bottom-nav)_&]:block"
|
|
18
59
|
NOTE_LABEL_CLASSES = "ks-label shrink-0"
|
|
19
|
-
NOTE_CLASSES =
|
|
60
|
+
NOTE_CLASSES = {
|
|
61
|
+
sm: "flex flex-1 basis-60 items-center ks-grid-gap-sm max-sm:hidden",
|
|
62
|
+
md: "flex flex-1 basis-60 items-center ks-grid-gap-sm max-md:hidden",
|
|
63
|
+
lg: "flex flex-1 basis-60 items-center ks-grid-gap-sm max-lg:hidden"
|
|
64
|
+
}.freeze
|
|
20
65
|
|
|
21
|
-
def initialize(url:, primary:, actions: [], note: nil, hint: nil, method: :post)
|
|
66
|
+
def initialize(url:, primary:, actions: [], note: nil, hint: nil, method: :post, breakpoint: :sm)
|
|
67
|
+
@breakpoint = breakpoint
|
|
22
68
|
@url = url
|
|
23
69
|
@primary = primary
|
|
24
70
|
@actions = actions
|
|
@@ -27,6 +73,26 @@ module Keystone
|
|
|
27
73
|
@method = method
|
|
28
74
|
end
|
|
29
75
|
|
|
76
|
+
def bar_classes
|
|
77
|
+
BAR_CLASSES.fetch(@breakpoint)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def form_classes
|
|
81
|
+
FORM_CLASSES.fetch(@breakpoint)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def note_classes
|
|
85
|
+
NOTE_CLASSES.fetch(@breakpoint)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def hint_classes
|
|
89
|
+
HINT_CLASSES.fetch(@breakpoint)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def spacer_classes
|
|
93
|
+
SPACER_CLASSES.fetch(@breakpoint)
|
|
94
|
+
end
|
|
95
|
+
|
|
30
96
|
def buttons
|
|
31
97
|
safe_join([ secondary_row, primary_button ])
|
|
32
98
|
end
|
|
@@ -34,13 +100,13 @@ module Keystone
|
|
|
34
100
|
private
|
|
35
101
|
|
|
36
102
|
def secondary_row
|
|
37
|
-
render(ButtonRowComponent.new(
|
|
103
|
+
render(ButtonRowComponent.new(class: SECONDARY_ROW_CLASSES.fetch(@breakpoint))) do
|
|
38
104
|
safe_join(@actions.map { |action| secondary_button(action) })
|
|
39
105
|
end
|
|
40
106
|
end
|
|
41
107
|
|
|
42
108
|
def secondary_button(action)
|
|
43
|
-
tag.div(class: [ ACTION_CLASSES, (PHONE_ONLY_CLASSES if action[:phone_only]), PHONE_ORDER_CLASSES[action[:phone_order]] ].compact.join(" ")) do
|
|
109
|
+
tag.div(class: [ ACTION_CLASSES, (PHONE_ONLY_CLASSES.fetch(@breakpoint) if action[:phone_only]), PHONE_ORDER_CLASSES.fetch(@breakpoint)[action[:phone_order]] ].compact.join(" ")) do
|
|
44
110
|
render ButtonComponent.new(variant: :secondary, **action.except(:phone_only, :phone_order, :phone_label), label: action_label(action))
|
|
45
111
|
end
|
|
46
112
|
end
|
|
@@ -48,11 +114,11 @@ module Keystone
|
|
|
48
114
|
def action_label(action)
|
|
49
115
|
return action[:label] unless action[:phone_label]
|
|
50
116
|
|
|
51
|
-
safe_join([ tag.span(action[:label], class: FULL_LABEL_CLASSES), tag.span(action[:phone_label], class: PHONE_LABEL_CLASSES) ])
|
|
117
|
+
safe_join([ tag.span(action[:label], class: FULL_LABEL_CLASSES.fetch(@breakpoint)), tag.span(action[:phone_label], class: PHONE_LABEL_CLASSES.fetch(@breakpoint)) ])
|
|
52
118
|
end
|
|
53
119
|
|
|
54
120
|
def primary_button
|
|
55
|
-
tag.div(class: PRIMARY_CLASSES) { render ButtonComponent.new(**@primary) }
|
|
121
|
+
tag.div(class: PRIMARY_CLASSES.fetch(@breakpoint)) { render ButtonComponent.new(**@primary) }
|
|
56
122
|
end
|
|
57
123
|
end
|
|
58
124
|
end
|
|
@@ -10,10 +10,17 @@ module Keystone
|
|
|
10
10
|
default: { 1 => "grid-cols-1", 2 => "grid-cols-2", 3 => "grid-cols-3", 4 => "grid-cols-4", 5 => "grid-cols-5", 6 => "grid-cols-6", 7 => "grid-cols-7", 8 => "grid-cols-8", 9 => "grid-cols-9", 10 => "grid-cols-10", 11 => "grid-cols-11", 12 => "grid-cols-12" }.freeze,
|
|
11
11
|
sm: { 1 => "sm:grid-cols-1", 2 => "sm:grid-cols-2", 3 => "sm:grid-cols-3", 4 => "sm:grid-cols-4", 5 => "sm:grid-cols-5", 6 => "sm:grid-cols-6", 7 => "sm:grid-cols-7", 8 => "sm:grid-cols-8", 9 => "sm:grid-cols-9", 10 => "sm:grid-cols-10", 11 => "sm:grid-cols-11", 12 => "sm:grid-cols-12" }.freeze,
|
|
12
12
|
md: { 1 => "md:grid-cols-1", 2 => "md:grid-cols-2", 3 => "md:grid-cols-3", 4 => "md:grid-cols-4", 5 => "md:grid-cols-5", 6 => "md:grid-cols-6", 7 => "md:grid-cols-7", 8 => "md:grid-cols-8", 9 => "md:grid-cols-9", 10 => "md:grid-cols-10", 11 => "md:grid-cols-11", 12 => "md:grid-cols-12" }.freeze,
|
|
13
|
-
lg: { 1 => "lg:grid-cols-1", 2 => "lg:grid-cols-2", 3 => "lg:grid-cols-3", 4 => "lg:grid-cols-4", 5 => "lg:grid-cols-5", 6 => "lg:grid-cols-6", 7 => "lg:grid-cols-7", 8 => "lg:grid-cols-8", 9 => "lg:grid-cols-9", 10 => "lg:grid-cols-10", 11 => "lg:grid-cols-11", 12 => "lg:grid-cols-12" }.freeze
|
|
13
|
+
lg: { 1 => "lg:grid-cols-1", 2 => "lg:grid-cols-2", 3 => "lg:grid-cols-3", 4 => "lg:grid-cols-4", 5 => "lg:grid-cols-5", 6 => "lg:grid-cols-6", 7 => "lg:grid-cols-7", 8 => "lg:grid-cols-8", 9 => "lg:grid-cols-9", 10 => "lg:grid-cols-10", 11 => "lg:grid-cols-11", 12 => "lg:grid-cols-12" }.freeze,
|
|
14
|
+
xl: { 1 => "xl:grid-cols-1", 2 => "xl:grid-cols-2", 3 => "xl:grid-cols-3", 4 => "xl:grid-cols-4", 5 => "xl:grid-cols-5", 6 => "xl:grid-cols-6", 7 => "xl:grid-cols-7", 8 => "xl:grid-cols-8", 9 => "xl:grid-cols-9", 10 => "xl:grid-cols-10", 11 => "xl:grid-cols-11", 12 => "xl:grid-cols-12" }.freeze
|
|
14
15
|
}.freeze
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
WIDE_COL_CLASSES = {
|
|
18
|
+
first: { default: "grid-cols-[minmax(0,3fr)_minmax(0,2fr)]", sm: "sm:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]", md: "md:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]", lg: "lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]", xl: "xl:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]" }.freeze,
|
|
19
|
+
second: { default: "grid-cols-[minmax(0,2fr)_minmax(0,3fr)]", sm: "sm:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]", md: "md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]", lg: "lg:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]", xl: "xl:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]" }.freeze
|
|
20
|
+
}.freeze
|
|
21
|
+
|
|
22
|
+
def initialize(cols: { default: 1 }, gap: :md, gap_x: nil, gap_y: nil, wide: nil)
|
|
23
|
+
@wide = wide
|
|
17
24
|
@cols = cols
|
|
18
25
|
@gap = gap
|
|
19
26
|
@gap_x = gap_x
|
|
@@ -29,10 +36,18 @@ module Keystone
|
|
|
29
36
|
tokens << GAP_CLASSES.fetch(@gap)
|
|
30
37
|
end
|
|
31
38
|
@cols.each do |breakpoint, count|
|
|
32
|
-
tokens <<
|
|
39
|
+
tokens << col_class(breakpoint, count)
|
|
33
40
|
end
|
|
34
41
|
tokens.join(" ")
|
|
35
42
|
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def col_class(breakpoint, count)
|
|
47
|
+
return WIDE_COL_CLASSES.fetch(@wide).fetch(breakpoint) if @wide && count == 2
|
|
48
|
+
|
|
49
|
+
COL_CLASSES.fetch(breakpoint).fetch(count)
|
|
50
|
+
end
|
|
36
51
|
end
|
|
37
52
|
end
|
|
38
53
|
end
|
|
@@ -7,9 +7,10 @@ module Keystone
|
|
|
7
7
|
CURRENT_ROW_CLASSES = "ks-value-list-row-current"
|
|
8
8
|
STACK_CLASSES = "flex min-w-0 flex-1 flex-col-reverse ks-grid-gap-sm sm:contents"
|
|
9
9
|
BADGE_CLASSES = "max-sm:self-start"
|
|
10
|
+
TOP_LINE_BADGE_CLASSES = "min-w-0 whitespace-normal"
|
|
10
11
|
TEXT_CLASSES = "min-w-0 flex-1"
|
|
11
12
|
TOP_LINE_CLASSES = "flex items-center justify-between ks-grid-gap-sm whitespace-nowrap"
|
|
12
|
-
TOP_LINE_TEXT_CLASSES = "ks-value-list-note
|
|
13
|
+
TOP_LINE_TEXT_CLASSES = "ks-value-list-note shrink-0 max-w-full truncate"
|
|
13
14
|
LABEL_CLASSES = "ks-paragraph ks-settings-link-label block"
|
|
14
15
|
SUBTITLE_CLASSES = "ks-value-list-note"
|
|
15
16
|
VALUE_CLASSES = "ks-value-list-value shrink-0"
|
|
@@ -30,7 +31,7 @@ module Keystone
|
|
|
30
31
|
end
|
|
31
32
|
|
|
32
33
|
def top_line_badge(row)
|
|
33
|
-
BadgeComponent.new(**row[:top_line][:badge])
|
|
34
|
+
BadgeComponent.new(**row[:top_line][:badge], class: TOP_LINE_BADGE_CLASSES)
|
|
34
35
|
end
|
|
35
36
|
end
|
|
36
37
|
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<div class="<%= ROW_CLASSES %>">
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
<% if @back_url %>
|
|
3
|
+
<div class="<%= WRAPPER_CLASSES %>">
|
|
4
4
|
<%= link_to @back_url, class: BACK_LINK_CLASSES, aria: { label: "Back" } do %>
|
|
5
5
|
<%= BACK_ICON.html_safe %>
|
|
6
6
|
<% end %>
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
</div>
|
|
8
|
+
<% end %>
|
|
9
9
|
<span class="<%= TITLE_CLASSES %>">
|
|
10
10
|
<% if @overline.present? %>
|
|
11
11
|
<span class="<%= OVERLINE_CLASSES %>"><%= @overline %></span>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<button type="button"
|
|
3
3
|
data-action="click->dropdown#toggle click@window->dropdown#hide"
|
|
4
4
|
class="<%= trigger_classes %>">
|
|
5
|
-
<%= @title
|
|
5
|
+
<span class="<%= TITLE_CLASSES %>"><%= @title %></span>
|
|
6
6
|
<%= CARET_ICON.html_safe %>
|
|
7
7
|
</button>
|
|
8
8
|
<nav data-dropdown-target="menu" class="<%= MENU_CLASSES %>">
|
|
@@ -6,6 +6,7 @@ module Keystone
|
|
|
6
6
|
WRAPPER_CLASSES = "ks-nav-dropdown"
|
|
7
7
|
MENU_CLASSES = "ks-nav-dropdown-menu hidden"
|
|
8
8
|
TRIGGER_BASE = "ks-nav-dropdown-trigger"
|
|
9
|
+
TITLE_CLASSES = "min-w-0 truncate"
|
|
9
10
|
ACTIVE_CLASS = "active"
|
|
10
11
|
CARET_ICON = <<~SVG.freeze
|
|
11
12
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="ks-nav-dropdown-caret">
|
|
@@ -6,6 +6,7 @@ module Keystone
|
|
|
6
6
|
WRAPPER_CLASSES = "ks-page-header"
|
|
7
7
|
TITLE_CLASSES = "ks-page-header-title"
|
|
8
8
|
SUBTITLE_CLASSES = "ks-page-header-subtitle"
|
|
9
|
+
MONO_SUBTITLE_CLASSES = "ks-page-header-subtitle font-mono"
|
|
9
10
|
ACTIONS_CLASSES = "page-header-actions ks-page-header-actions"
|
|
10
11
|
PHONE_TITLE_CLASSES = "ks-page-header-title max-sm:[body:has(.ks-mobile-header-title)_&]:hidden"
|
|
11
12
|
PHONE_WRAPPER_CLASSES = "max-sm:flex max-sm:flex-wrap max-sm:items-center max-sm:justify-between"
|
|
@@ -16,7 +17,8 @@ module Keystone
|
|
|
16
17
|
|
|
17
18
|
attr_reader :title, :action_url, :action_label, :action_method, :action_confirm
|
|
18
19
|
|
|
19
|
-
def initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, action_confirm: nil, action_at_bottom: false, badges: [], menu: [], class: nil)
|
|
20
|
+
def initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, action_confirm: nil, action_at_bottom: false, badges: [], menu: [], subtitle_mono: false, class: nil)
|
|
21
|
+
@subtitle_mono = subtitle_mono
|
|
20
22
|
@title = title
|
|
21
23
|
@subtitle = subtitle
|
|
22
24
|
@action_url = action_url
|
|
@@ -78,6 +80,10 @@ module Keystone
|
|
|
78
80
|
!@subtitle.nil?
|
|
79
81
|
end
|
|
80
82
|
|
|
83
|
+
def subtitle_classes
|
|
84
|
+
@subtitle_mono ? MONO_SUBTITLE_CLASSES : SUBTITLE_CLASSES
|
|
85
|
+
end
|
|
86
|
+
|
|
81
87
|
def subtitle_text
|
|
82
88
|
@subtitle
|
|
83
89
|
end
|
|
@@ -30,7 +30,7 @@ module Keystone
|
|
|
30
30
|
|
|
31
31
|
def action_row
|
|
32
32
|
render(ButtonRowComponent.new(equal_width: true)) do
|
|
33
|
-
safe_join(@actions.map { |action| render ButtonComponent.new(variant: :secondary, size: :sm, **action) })
|
|
33
|
+
safe_join(@actions.map { |action| render ButtonComponent.new(variant: :secondary, size: :sm, **action) }, " ")
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div class="<%= classes %>">
|
|
2
2
|
<% if header? %>
|
|
3
3
|
<div class="<%= header_classes %>">
|
|
4
|
-
<div>
|
|
4
|
+
<div class="<%= TITLE_WRAPPER_CLASSES %>">
|
|
5
5
|
<h2 class="<%= TITLE_CLASSES %>"><%= @title %></h2>
|
|
6
6
|
<% if @subtitle %>
|
|
7
7
|
<p class="<%= SUBTITLE_CLASSES %>"><%= @subtitle %></p>
|
|
@@ -7,10 +7,11 @@ module Keystone
|
|
|
7
7
|
HEADER_CLASSES = "ks-section-header"
|
|
8
8
|
HEADER_WITH_ASIDE_CLASSES = "ks-section-header ks-grid-gap-sm max-sm:flex-wrap"
|
|
9
9
|
TITLE_CLASSES = "ks-section-title"
|
|
10
|
+
TITLE_WRAPPER_CLASSES = "min-w-0"
|
|
10
11
|
SUBTITLE_CLASSES = "ks-section-subtitle"
|
|
11
12
|
ACTION_CLASSES = "ks-section-action"
|
|
12
13
|
ACTIONS_CLASSES = "flex items-center shrink-0 ks-grid-gap-sm"
|
|
13
|
-
ASIDE_CLASSES = "ks-heading-note ml-auto max-sm:basis-full max-sm:order-last"
|
|
14
|
+
ASIDE_CLASSES = "ks-heading-note ml-auto wrap-normal sm:shrink-0 max-sm:basis-full max-sm:order-last"
|
|
14
15
|
|
|
15
16
|
renders_one :aside
|
|
16
17
|
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
<% end %>
|
|
13
13
|
</div>
|
|
14
14
|
<p class="<%= value_classes %>">
|
|
15
|
-
<% if missing? %><span class="<%= Keystone::Ui::StatCardComponent::FALLBACK_CLASSES %>"><%= fallback %></span><% elsif link? %><a href="<%= href %>" class="<%= value_link_classes %>"><%= value %></a><% else %><%= value %><% end %><% if suffix? %><span class="<%= suffix_classes %>"> <%= suffix %></span><% end %>
|
|
15
|
+
<% if missing? %><span class="<%= Keystone::Ui::StatCardComponent::FALLBACK_CLASSES %>"><%= fallback %></span><% elsif link? %><a href="<%= href %>" class="<%= value_link_classes %>"><%= value %></a><% else %><%= value %><% end %><% if suffix? %><span class="<%= suffix_classes %>"> <%= suffix %></span><% end %><% if compact? && change? %><span class="<%= compact_change_classes %>"><%= change_label %></span><% end %><% if compact? && note %><span class="<%= Keystone::Ui::StatCardComponent::COMPACT_NOTE_CLASSES %>"><%= note %></span><% end %>
|
|
16
16
|
</p>
|
|
17
|
-
<% if note %><p class="<%= Keystone::Ui::StatCardComponent::NOTE_CLASSES %>"><%= note %></p><% end %>
|
|
18
|
-
|
|
17
|
+
<% if note && !compact? %><p class="<%= Keystone::Ui::StatCardComponent::NOTE_CLASSES %>"><%= note %></p><% end %>
|
|
18
|
+
<% unless compact? %><p class="<%= change_row_classes %>"><%= change_label %></p><% end %>
|
|
19
19
|
</div>
|
|
@@ -7,14 +7,19 @@ module Keystone
|
|
|
7
7
|
HEADER_CLASSES = "ks-stat-card-header flex items-start justify-between"
|
|
8
8
|
CARD_CLASSES = "ks-metric-card relative"
|
|
9
9
|
PLAIN_CLASSES = "ks-metric-plain relative"
|
|
10
|
+
COMPACT_CLASSES = "ks-metric-card ks-metric-card-compact relative"
|
|
10
11
|
LABEL_CLASSES = "ks-stat-card-label text-sm"
|
|
12
|
+
COMPACT_LABEL_CLASSES = "ks-stat-card-label text-xs"
|
|
11
13
|
VALUE_BASE_CLASSES = "ks-stat-card-value text-3xl"
|
|
14
|
+
COMPACT_VALUE_CLASSES = "ks-stat-card-value ks-stat-card-value-compact flex flex-wrap items-baseline text-lg leading-6"
|
|
12
15
|
SUFFIX_CLASSES = "ks-stat-card-suffix text-lg"
|
|
13
16
|
DISCLOSURE_CLASSES = "ks-stat-card-disclosure hidden peer-hover:block peer-focus-visible:block absolute inset-x-0 top-full z-10 text-sm"
|
|
14
17
|
CHANGE_ROW_CLASSES = "ks-stat-card-change h-5 text-sm"
|
|
18
|
+
COMPACT_CHANGE_CLASSES = "ks-stat-card-change text-xs"
|
|
15
19
|
VALUE_LINK_CLASSES = "hover:underline focus:outline-none focus-visible:underline"
|
|
16
20
|
INFO_BUTTON_CLASSES = "ks-stat-card-info peer shrink-0 transition"
|
|
17
21
|
NOTE_CLASSES = "ks-stat-card-note text-sm"
|
|
22
|
+
COMPACT_NOTE_CLASSES = "ks-stat-card-note text-xs"
|
|
18
23
|
FALLBACK_CLASSES = "ks-stat-card-fallback"
|
|
19
24
|
|
|
20
25
|
INFO_ICON = <<~SVG.freeze
|
|
@@ -31,7 +36,8 @@ module Keystone
|
|
|
31
36
|
|
|
32
37
|
attr_reader :label, :value, :suffix, :definition, :calculation, :change, :href, :note
|
|
33
38
|
|
|
34
|
-
def initialize(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil, note: nil, plain: false, fallback: nil)
|
|
39
|
+
def initialize(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil, note: nil, plain: false, fallback: nil, compact: false)
|
|
40
|
+
@compact = compact
|
|
35
41
|
@label = label
|
|
36
42
|
@fallback = fallback
|
|
37
43
|
@note = note
|
|
@@ -54,15 +60,17 @@ module Keystone
|
|
|
54
60
|
end
|
|
55
61
|
|
|
56
62
|
def classes
|
|
63
|
+
return COMPACT_CLASSES if @compact
|
|
64
|
+
|
|
57
65
|
@plain ? PLAIN_CLASSES : CARD_CLASSES
|
|
58
66
|
end
|
|
59
67
|
|
|
60
68
|
def label_classes
|
|
61
|
-
LABEL_CLASSES
|
|
69
|
+
@compact ? COMPACT_LABEL_CLASSES : LABEL_CLASSES
|
|
62
70
|
end
|
|
63
71
|
|
|
64
72
|
def value_classes
|
|
65
|
-
"#{VALUE_BASE_CLASSES} #{VARIANT_CLASSES.fetch(@variant)}"
|
|
73
|
+
"#{@compact ? COMPACT_VALUE_CLASSES : VALUE_BASE_CLASSES} #{VARIANT_CLASSES.fetch(@variant)}"
|
|
66
74
|
end
|
|
67
75
|
|
|
68
76
|
def suffix_classes
|
|
@@ -102,6 +110,14 @@ module Keystone
|
|
|
102
110
|
"#{CHANGE_ROW_CLASSES} #{change_classes}"
|
|
103
111
|
end
|
|
104
112
|
|
|
113
|
+
def compact?
|
|
114
|
+
@compact
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def compact_change_classes
|
|
118
|
+
"#{COMPACT_CHANGE_CLASSES} #{change_classes}"
|
|
119
|
+
end
|
|
120
|
+
|
|
105
121
|
def change_classes
|
|
106
122
|
return "ks-tone-muted" if !change? || @change.zero?
|
|
107
123
|
return "ks-tone-danger" if @change.negative?
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<% tab_row = capture do %>
|
|
3
3
|
<nav class="<%= classes %>">
|
|
4
4
|
<% tabs.each do |tab| %>
|
|
5
|
-
<a href="<%= tab[:href] %>" data-turbo-action="replace" class="<%= tab[:current] ? tab_classes : base_tab_classes %>"<% if tab[:current] %> aria-current="page" data-active<% end %>><%= tab[:label] %><% if
|
|
5
|
+
<a href="<%= tab[:href] %>" data-turbo-action="replace" class="<%= tab[:current] ? tab_classes : base_tab_classes %>"<% if tab[:current] %> aria-current="page" data-active<% end %>><%= tab[:label] %><% if count?(tab) %> <%= count_mark(tab[:count]) %><% end %></a>
|
|
6
6
|
<% end %>
|
|
7
7
|
</nav>
|
|
8
8
|
<% end %>
|
|
@@ -40,6 +40,10 @@ module Keystone
|
|
|
40
40
|
"#{base_tab_classes} ks-tab-active"
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
def count?(tab)
|
|
44
|
+
tab[:count].to_i.positive? || (tab[:show_zero] && !tab[:count].nil?)
|
|
45
|
+
end
|
|
46
|
+
|
|
43
47
|
def count_mark(count)
|
|
44
48
|
return render(BadgeComponent.new(label: count.to_s, variant: :info)) unless @shape
|
|
45
49
|
|
|
@@ -36,11 +36,9 @@
|
|
|
36
36
|
<% end %>
|
|
37
37
|
<% end %>
|
|
38
38
|
<% end %>
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</div>
|
|
44
|
-
<% end %>
|
|
39
|
+
<div class="<%= axis_classes %>">
|
|
40
|
+
<span data-timeline-axis-start><%= axis_start_label %></span>
|
|
41
|
+
<span data-timeline-axis-end><%= axis_end_label %></span>
|
|
42
|
+
</div>
|
|
45
43
|
</div>
|
|
46
44
|
<% end %>
|
|
@@ -14,13 +14,14 @@ module Keystone
|
|
|
14
14
|
TIMELINE_CLASSES = "flex flex-col ks-grid-gap-sm"
|
|
15
15
|
ONE_LINE_TIMELINE_CLASSES = "sm:grid sm:grid-cols-[fit-content(40%)_1fr_auto]"
|
|
16
16
|
ONE_LINE_ROW_CLASSES = "grid grid-cols-[1fr_auto] items-center ks-grid-gap-x-sm text-sm sm:col-span-3 sm:grid-cols-subgrid"
|
|
17
|
-
ONE_LINE_LABEL_CLASSES = "ks-meter-label min-w-0 truncate sm:mb-0"
|
|
17
|
+
ONE_LINE_LABEL_CLASSES = "ks-meter-label min-w-0 wrap-break-word sm:truncate sm:mb-0"
|
|
18
18
|
ONE_LINE_TRACK_CLASSES = "col-span-2 row-start-2 sm:col-span-1 sm:col-start-2 sm:row-start-1"
|
|
19
19
|
ONE_LINE_STATUS_CLASSES = "ks-meter-label justify-self-end sm:mb-0"
|
|
20
20
|
ROW_TEXT_CLASSES = "ks-meter-label flex justify-between text-sm"
|
|
21
21
|
AXIS_CLASSES = "ks-meter-label flex justify-between text-xs"
|
|
22
22
|
ROW_STATUS_CLASSES = "flex items-center ks-grid-gap-sm"
|
|
23
|
-
|
|
23
|
+
PHONE_AXIS_CLASSES = "ks-meter-label flex justify-between text-xs sm:col-span-3 sm:hidden"
|
|
24
|
+
ONE_LINE_AXIS_CLASSES = "ks-meter-label relative h-4 text-xs sm:col-start-2 max-sm:hidden"
|
|
24
25
|
MARK_CLASSES = "absolute top-0 whitespace-nowrap"
|
|
25
26
|
MINIMUM_BAR_PERCENT = 2
|
|
26
27
|
MARK_STEPS = [ 1, 2, 5, 10, 15, 30, 60, 120, 300, 600, 900, 1800, 3600, 7200, 10_800, 21_600, 43_200, 86_400 ].freeze
|
|
@@ -38,6 +39,10 @@ module Keystone
|
|
|
38
39
|
[ TRACK_CLASSES, (ONE_LINE_TRACK_CLASSES if one_line) ].compact.join(" ")
|
|
39
40
|
end
|
|
40
41
|
|
|
42
|
+
def axis_classes
|
|
43
|
+
one_line ? PHONE_AXIS_CLASSES : AXIS_CLASSES
|
|
44
|
+
end
|
|
45
|
+
|
|
41
46
|
def label_classes
|
|
42
47
|
ONE_LINE_LABEL_CLASSES if one_line
|
|
43
48
|
end
|
|
@@ -110,6 +115,10 @@ module Keystone
|
|
|
110
115
|
(0..mark_intervals).map { |index| { label: written_mark(index * mark_step), style: mark_style(index) } }
|
|
111
116
|
end
|
|
112
117
|
|
|
118
|
+
def axis_end_label
|
|
119
|
+
one_line ? written_mark(scale) : total_duration
|
|
120
|
+
end
|
|
121
|
+
|
|
113
122
|
def axis_start_label
|
|
114
123
|
written_mark(0)
|
|
115
124
|
end
|
|
@@ -305,8 +305,8 @@ module KeystoneUiHelper
|
|
|
305
305
|
render Keystone::Ui::HeadingComponent.new(**args)
|
|
306
306
|
end
|
|
307
307
|
|
|
308
|
-
def ui_caption(**args)
|
|
309
|
-
render Keystone::Ui::CaptionComponent.new(**args)
|
|
308
|
+
def ui_caption(**args, &block)
|
|
309
|
+
render Keystone::Ui::CaptionComponent.new(**args), &block
|
|
310
310
|
end
|
|
311
311
|
|
|
312
312
|
def ui_link(**args)
|
data/lib/keystone_ui/version.rb
CHANGED
|
@@ -30,7 +30,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
30
30
|
- `ui_page_header` — the title of a page, with optional badges beside it and a control and action menu on its right, and the screen's main action, which can ask a question first and can move to the bottom of a phone screen.
|
|
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, action menu and short aside such as a badge in its header.
|
|
33
|
-
- `ui_grid` — a responsive grid with a column count per breakpoint.
|
|
33
|
+
- `ui_grid` — a responsive grid with a column count per breakpoint up to `xl`, and two columns of unequal width when asked.
|
|
34
34
|
- `ui_list_detail` — a list beside the detail of the item picked from it, with the detail above the list below `lg:`.
|
|
35
35
|
- `ui_panel` — a bordered card surface holding any content.
|
|
36
36
|
- `ui_card_link` — a panel that is one link as a whole.
|
|
@@ -75,7 +75,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
75
75
|
- `ui_figure` — one amount as inline text, coloured as a gain or a loss.
|
|
76
76
|
- `ui_picture` — an image never taller than half the screen, optionally opening its full-size file.
|
|
77
77
|
- `ui_heading` — a heading at one of three sizes, with an optional short note on its right.
|
|
78
|
-
- `ui_caption` — small uppercase muted text placed above a title or a figure.
|
|
78
|
+
- `ui_caption` — small uppercase muted text placed above a title or a figure, or a small muted line in normal case that can hold links.
|
|
79
79
|
- `ui_link` — a text link in the link colour.
|
|
80
80
|
- `ui_facts` — a row of facts, each a count in bold beside its label.
|
|
81
81
|
- `ui_paragraph` — a paragraph of running text.
|
|
@@ -84,7 +84,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
84
84
|
- `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.
|
|
85
85
|
- `ui_empty_state` — what a list or section shows when it has nothing in it, with an optional message and action.
|
|
86
86
|
- `ui_progress` — a labelled progress bar.
|
|
87
|
-
- `ui_stat_card` — a single metric tile with optional change, link and info button.
|
|
87
|
+
- `ui_stat_card` — a single metric tile with optional change, link and info button, or a compact tile for a small grid of figures inside a panel.
|
|
88
88
|
- `ui_copy_button` — a button that copies text to the clipboard.
|
|
89
89
|
- `ui_code` — a block of code with an optional caption.
|
|
90
90
|
- `ui_text_diff` — two versions of a text side by side, or in one column, with removed and added lines marked.
|
|
@@ -179,7 +179,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
179
179
|
- Ask the developer whether a screen shows breadcrumbs and which parent
|
|
180
180
|
screens its trail names. Ask which screens a navigation tab opens
|
|
181
181
|
directly, since those pass `trail: []`.
|
|
182
|
-
- `ui_page_header(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, action_confirm: nil, action_at_bottom: false, badges: [], menu: [], class: nil)`
|
|
182
|
+
- `ui_page_header(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, action_confirm: nil, action_at_bottom: false, badges: [], menu: [], subtitle_mono: false, class: nil)`
|
|
183
183
|
takes a block yielding the header. Call
|
|
184
184
|
`header.action { ... }` in the block to place a control on its right.
|
|
185
185
|
`action_url:` declares the screen's main action. It publishes that URL and
|
|
@@ -195,6 +195,8 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
195
195
|
a phone, not the plus icon. It applies only with `action_url:` and is
|
|
196
196
|
ignored when an `action` block is given. Ask the developer whether a
|
|
197
197
|
screen's main action needs a question and how it is worded.
|
|
198
|
+
- `subtitle_mono: true` draws the subtitle in a fixed-width font, such as
|
|
199
|
+
a run's id and start time. Use it in place of a monospace class.
|
|
198
200
|
- `action_at_bottom: true` hides the header's main action, or its `action`
|
|
199
201
|
block, below `sm:`, for a screen whose phone layout draws the action with
|
|
200
202
|
`ui_bottom_action`. From `sm:` up the header shows it as before, and the
|
|
@@ -238,8 +240,9 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
238
240
|
- The block yields the section, and `section.with_aside { ... }` in it puts
|
|
239
241
|
short text or a `ui_badge`, such as a sort order or a step's state, in
|
|
240
242
|
small muted text at the right end of the title line, before the link and
|
|
241
|
-
the menu.
|
|
242
|
-
|
|
243
|
+
the menu. The aside never breaks in the middle of a word, and from `sm:`
|
|
244
|
+
up it keeps its full width while a long title wraps beside it. Below
|
|
245
|
+
`sm:` the aside moves to its own line under the title and the actions. Use it in place of hand-written markup beside a section's
|
|
243
246
|
title, and ask the developer what the aside shows.
|
|
244
247
|
|
|
245
248
|
```erb
|
|
@@ -248,10 +251,15 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
248
251
|
...
|
|
249
252
|
<% end %>
|
|
250
253
|
```
|
|
251
|
-
- `ui_grid(cols: { default: 1 }, gap: :md, gap_x: nil, gap_y: nil)` —
|
|
252
|
-
`cols:` maps `:default` `:sm` `:md` `:lg` to a count from 1 to 12,
|
|
253
|
-
`{ default: 1, md: 3 }
|
|
254
|
-
`
|
|
254
|
+
- `ui_grid(cols: { default: 1 }, gap: :md, gap_x: nil, gap_y: nil, wide: nil)` —
|
|
255
|
+
`cols:` maps `:default` `:sm` `:md` `:lg` `:xl` to a count from 1 to 12,
|
|
256
|
+
such as `{ default: 1, md: 3 }`, and below the smallest breakpoint given
|
|
257
|
+
the columns stack. `gap:` is `:sm` `:md` `:lg` `:xl`, and passing
|
|
258
|
+
`gap_x:` or `gap_y:` replaces `gap:` entirely. `wide: :first` or
|
|
259
|
+
`wide: :second` makes that column wider, three parts to two, wherever
|
|
260
|
+
`cols:` gives two columns, such as a wide table beside a narrow panel:
|
|
261
|
+
`ui_grid(cols: { default: 1, xl: 2 }, wide: :first)`. Use it in place of
|
|
262
|
+
hand-written column widths.
|
|
255
263
|
- `ui_list_detail` takes no keywords. The block is the list, and
|
|
256
264
|
`layout.with_detail { ... }` is the picked item's detail, left unset when
|
|
257
265
|
nothing is picked. From `lg:` up the list takes the first third of the
|
|
@@ -275,7 +283,9 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
275
283
|
keywords drawn as a small secondary button taking an equal share of one
|
|
276
284
|
row. A `finding:` also draws the card's edge in the warning style.
|
|
277
285
|
`compact: true` cuts the body to one line with an ellipsis and leaves out
|
|
278
|
-
the call-to-action line and the meta line, for a phone list.
|
|
286
|
+
the call-to-action line and the meta line, for a phone list. The buttons
|
|
287
|
+
are separated by a space in the card's text, so copied text and screen
|
|
288
|
+
readers read each label as its own word. Below `sm:` each button is at least 44 pixels
|
|
279
289
|
tall, and from `sm:` up the buttons are narrowed so three labels fit in a
|
|
280
290
|
third of the page. Use it in place of a hand-written card of these parts.
|
|
281
291
|
- `ui_review_card_grid` takes no keywords and a block of `ui_review_card`
|
|
@@ -332,7 +342,8 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
332
342
|
- `ui_nav_item(label:, href:, active: false, count: nil)` is one desktop
|
|
333
343
|
link, with `count:` shown in a badge after the label when above zero.
|
|
334
344
|
`ui_nav_dropdown(title:, area:, active: false)` takes a block holding the
|
|
335
|
-
menu links.
|
|
345
|
+
menu links. A title too long for the trigger ends in an ellipsis, so a
|
|
346
|
+
long page title in a phone top bar never widens the page.
|
|
336
347
|
- `ui_bottom_nav` takes no keywords and a block of
|
|
337
348
|
`ui_bottom_nav_item(label:, href:, icon:, active: false, count: nil)` calls,
|
|
338
349
|
where `icon:` is a raw SVG string and `count:` above zero shows in a badge
|
|
@@ -341,7 +352,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
341
352
|
- `ui_mobile_header(title:, back_url:, subtitle: nil, overline: nil, badge: nil)` is hidden from `lg:`
|
|
342
353
|
up and goes in the navbar's `mobile_left` slot or directly in the
|
|
343
354
|
layout's `<header>`. `back_url:` must be passed, and `nil` renders the
|
|
344
|
-
title with no back arrow. Outside a top bar it draws the arrow, title and
|
|
355
|
+
title with no back arrow and no space left for one. Outside a top bar it draws the arrow, title and
|
|
345
356
|
subtitle in one row with `ui_page`'s side margin, ending the text in an
|
|
346
357
|
ellipsis when too long. Inside an element with the `top-nav` class, such
|
|
347
358
|
as `ui_navbar`, the arrow and title are laid out by the bar instead: the
|
|
@@ -383,7 +394,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
383
394
|
both. Add no padding of your own for them. It and `ui_mobile_action`
|
|
384
395
|
draw the same action, so ask the developer which one a screen shows on a
|
|
385
396
|
phone.
|
|
386
|
-
- `ui_decision_bar(url:, primary:, actions: [], note: nil, hint: nil, method: :post)`
|
|
397
|
+
- `ui_decision_bar(url:, primary:, actions: [], note: nil, hint: nil, method: :post, breakpoint: :sm)`
|
|
387
398
|
draws one form sending to `url:` with `method:`. `primary:` and each hash
|
|
388
399
|
in `actions:` are `ui_button` keywords, usually `label:`, `name:` and
|
|
389
400
|
`value:`, so the button pressed tells the controller which decision was
|
|
@@ -402,7 +413,13 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
402
413
|
bar fixed to the bottom of the screen, above `ui_bottom_nav` on a page
|
|
403
414
|
that has one, with the primary button at full width and 48 pixels tall
|
|
404
415
|
above a row of the secondary buttons, each an equal share of the row and
|
|
405
|
-
44 pixels tall.
|
|
416
|
+
44 pixels tall. A label too long for its share wraps inside its
|
|
417
|
+
button, so do not shrink the buttons to keep the row even. The note
|
|
418
|
+
field and hint are not shown below `sm:`. `breakpoint: :md` or
|
|
419
|
+
`breakpoint: :lg` moves the switch between the phone bar and the panel
|
|
420
|
+
from `sm:` (640 pixels) to 768 or 1024 pixels, so it matches a page that
|
|
421
|
+
changes its own layout there. Ask the developer at which width the page
|
|
422
|
+
around the bar changes its layout. Give
|
|
406
423
|
it three secondary actions at most on a phone so the phone row fits. It stays shown
|
|
407
424
|
inside a Hotwire Native web view, at the bottom of the web view. It draws
|
|
408
425
|
an invisible copy of its phone bar in the page's flow, plus the bottom
|
|
@@ -673,7 +690,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
673
690
|
for a button without `href:`: a link ignores the attribute and stays
|
|
674
691
|
followable, and a button sending a request does not take it, so to stop
|
|
675
692
|
either one, do not render it.
|
|
676
|
-
- `ui_button_row(equal_width: false) { ... }` draws whatever its block
|
|
693
|
+
- `ui_button_row(equal_width: false, class: nil) { ... }` draws whatever its block
|
|
677
694
|
renders, usually `ui_button` calls, in one row with a small gap between
|
|
678
695
|
them, wrapping onto a further line when they do not fit. Below `sm` each
|
|
679
696
|
item in the row is at least 44 pixels tall, so a button is tall enough to
|
|
@@ -728,7 +745,8 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
728
745
|
`top_line:` is `{ badge:, text: }`, a line above the label with its own
|
|
729
746
|
badge at the left, apart from the row's `badge:`, and short text at the
|
|
730
747
|
right, such as a type and the time left. It stays on one line and cuts off
|
|
731
|
-
long text,
|
|
748
|
+
long text, a long badge wraps without squeezing the text beside it, and
|
|
749
|
+
the label and subtitle wrap. `current: true` marks the
|
|
732
750
|
row the person has open with `aria-current` and a tint and accent bar.
|
|
733
751
|
`chevron: false` leaves off every row's chevron, as in a queue beside the
|
|
734
752
|
open item. Ask the developer which row is current on each page.
|
|
@@ -782,9 +800,14 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
782
800
|
- `ui_accordion(items: [])` — `items:` is `[{ question:, answer: }, ...]`.
|
|
783
801
|
- `ui_heading(text:, size: :md, note: nil)` — `size:` is `:sm` `:md` `:lg`,
|
|
784
802
|
and `note:` puts a short muted note at the right end of the heading's row.
|
|
785
|
-
- `ui_caption(text
|
|
786
|
-
a title or a figure. `tone: :link` draws it in
|
|
787
|
-
under it, as the label above a quiz question.
|
|
803
|
+
- `ui_caption(text: nil, tone: :muted, normal_case: false)` shows small
|
|
804
|
+
uppercase muted text above a title or a figure. `tone: :link` draws it in
|
|
805
|
+
the link colour with space under it, as the label above a quiz question.
|
|
806
|
+
`normal_case: true` draws a small muted line in the case it was written,
|
|
807
|
+
such as a note under a step's details or a key under a chart. A block
|
|
808
|
+
given to it is drawn in place of `text:`, so the line can hold links, and
|
|
809
|
+
links in a normal-case caption are drawn in the link colour. Use it in
|
|
810
|
+
place of hand-written small grey text.
|
|
788
811
|
- `ui_facts(facts:)` — each fact is `{ value:, label: }`, drawn as a small
|
|
789
812
|
box with the count in bold beside its label, in a row that wraps.
|
|
790
813
|
- `ui_paragraph(text:)` shows running text.
|
|
@@ -804,13 +827,17 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
804
827
|
|
|
805
828
|
10. Explain figures.
|
|
806
829
|
|
|
807
|
-
- `ui_stat_card(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil, note: nil, plain: false, fallback: nil)`
|
|
830
|
+
- `ui_stat_card(label:, value:, variant: :neutral, suffix: nil, definition: nil, calculation: nil, change: nil, href: nil, note: nil, plain: false, fallback: nil, compact: false)`
|
|
808
831
|
— `variant:` is `:neutral` `:success` `:danger` `:warning` `:info` and
|
|
809
832
|
colours the value. `change:` is a signed number shown as `▲ 4.2%` in
|
|
810
833
|
green, `▼` in red, or plain at zero. `href:` links the value only, so
|
|
811
834
|
never wrap a stat card in `ui_card_link`. `definition:` and
|
|
812
835
|
`calculation:` add an info button whose panel shows while hovered or
|
|
813
|
-
focused and toggles when tapped.
|
|
836
|
+
focused and toggles when tapped. `compact: true` draws a small tile, an
|
|
837
|
+
extra small label over a smaller value with its change or note beside
|
|
838
|
+
the value, under half a default card's height. Put compact cards in
|
|
839
|
+
`ui_grid(cols: { default: 1, sm: 2 }, gap: :sm)` inside a panel so they
|
|
840
|
+
sit two across and stack on a phone.
|
|
814
841
|
- `ui_figure(text:, tone: :neutral)` prints one amount inline. `tone:`
|
|
815
842
|
`:neutral` uses the surrounding text colour, `:success` green and
|
|
816
843
|
`:danger` red, and any other symbol raises `KeyError`. Its output can go
|
|
@@ -951,8 +978,10 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
951
978
|
then its track, then its duration. The label column is as wide as the
|
|
952
979
|
longest label up to 40% of the timeline, a longer label is cut off with
|
|
953
980
|
an ellipsis, and every row's track has the same width and lines up with
|
|
954
|
-
the others. Below `sm:`
|
|
955
|
-
|
|
981
|
+
the others. Below `sm:` it falls back to the default layout: each row
|
|
982
|
+
shows its full label, wrapped when long, and its duration above its
|
|
983
|
+
track, the marks are hidden, and the axis under the rows reads `0s` and
|
|
984
|
+
the axis's last mark.
|
|
956
985
|
- Above a one-line timeline's first row, in the track column, the axis
|
|
957
986
|
shows marks at even
|
|
958
987
|
intervals from `0s`, at the smallest of 1, 2, 5, 10, 15 or 30 seconds,
|
|
@@ -999,7 +1028,9 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
999
1028
|
tab row, and below `sm` between the tab row and the panel. It is drawn
|
|
1000
1029
|
once, so do not draw it twice or add width-specific classes for it.
|
|
1001
1030
|
- A link tab takes `count:`, drawn after its label when it is above zero
|
|
1002
|
-
in an info badge, as a navigation item draws its count.
|
|
1031
|
+
in an info badge, as a navigation item draws its count. `show_zero: true`
|
|
1032
|
+
on a tab draws its count of zero too, such as a filter pill reading
|
|
1033
|
+
`Input 0`.
|
|
1003
1034
|
- `align: :start` starts the tab row at the left edge on every width
|
|
1004
1035
|
instead of centring it from `sm` up.
|
|
1005
1036
|
- `shape: :pills` draws each tab as an outlined pill, such as a row of
|
|
@@ -89,8 +89,9 @@ One decision: is keystone_ui set up in the app?
|
|
|
89
89
|
rows shows only `0s` and the total duration. A timeline can be drawn one line
|
|
90
90
|
per row instead: from `sm:` up each row holds its label, its bar and its
|
|
91
91
|
duration side by side, every row's bar has the same width, and a long label is
|
|
92
|
-
cut off with an ellipsis. Below `sm:`
|
|
93
|
-
|
|
92
|
+
cut off with an ellipsis. Below `sm:` it falls back to the default layout:
|
|
93
|
+
each row shows its full label, wrapped when long, and its duration above its
|
|
94
|
+
bar, and the axis under the rows shows `0s` and the last mark. In that layout the axis, drawn above the first row, shows marks at the smallest round time step
|
|
94
95
|
that covers the run in six intervals or fewer, and the axis ends at the last mark rather than at the latest
|
|
95
96
|
time, so bars are placed against that longer axis. An entry can carry an address, and then its bar is a link to it whose
|
|
96
97
|
name screen readers announce is the entry's label, and the row's label links
|
|
@@ -125,8 +126,9 @@ One decision: is keystone_ui set up in the app?
|
|
|
125
126
|
subtitle, then an optional action link and action menu. A section can also
|
|
126
127
|
carry an aside, a short piece of text or a badge drawn in the header's note
|
|
127
128
|
style at the right end of the title line, before the action and the menu.
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
The aside never breaks in the middle of a word, and on wider screens a long
|
|
130
|
+
title wraps beside it while it keeps its full width. Below `sm:` the aside
|
|
131
|
+
takes a line of its own under the title and the actions. A section with no title draws no header, so its aside is not shown.
|
|
130
132
|
- **Going back.** A form or show page shell needs a way back: a back link, a
|
|
131
133
|
trail of earlier pages shown as breadcrumbs, or a trail the app supplies for
|
|
132
134
|
the request. A nav tab's own page passes an empty trail and shows no back
|
|
@@ -198,14 +200,24 @@ One decision: is keystone_ui set up in the app?
|
|
|
198
200
|
own button below `sm:` so the action is not shown twice. Both forms show
|
|
199
201
|
nothing when the header names no action, and both are hidden inside a
|
|
200
202
|
Hotwire Native web view and in print.
|
|
203
|
+
- **Compact stat cards.** A stat card can be drawn compact, a small tile with
|
|
204
|
+
an extra small label and a smaller value, its change or note beside the
|
|
205
|
+
value, for a small grid of figures inside a panel.
|
|
206
|
+
- **Unequal grid columns.** A grid goes up to the `xl:` breakpoint, and a
|
|
207
|
+
two-column grid can make its first or its second column wider, three parts
|
|
208
|
+
to two.
|
|
209
|
+
- **Normal-case notes.** A caption can be a small muted line in the case it
|
|
210
|
+
was written, holding links, and a page header's subtitle can use a
|
|
211
|
+
fixed-width font.
|
|
201
212
|
- **A decision bar.** A decision bar is one form holding an optional note
|
|
202
213
|
field, several secondary buttons and one primary button, and the button
|
|
203
214
|
pressed tells the app which decision was made. On a wider screen it is a
|
|
204
215
|
panel with all of them on one line that wraps, and an optional hint line
|
|
205
216
|
under them. On a phone it is a bar fixed to the bottom of the screen, above
|
|
206
217
|
the bottom tab bar when the page has one, with the primary button at full
|
|
207
|
-
width above a row of the secondary buttons in equal shares,
|
|
208
|
-
|
|
218
|
+
width above a row of the secondary buttons in equal shares, a long label
|
|
219
|
+
wrapping inside its button, and with no note field or hint. The width at
|
|
220
|
+
which it switches between the two can be moved from `sm:` to `md:` or `lg:`. Each secondary button can have a shorter label on a phone, be
|
|
209
221
|
shown on a phone only, and take another place in the phone row. The page leaves room under its last content so the bar does
|
|
210
222
|
not cover it. Unlike the main action's bottom bar, it stays shown inside a
|
|
211
223
|
Hotwire Native web view.
|
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.99.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.42.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.42.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: view_component
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|