keystone_ui 0.29.3 → 0.29.5
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/javascripts/keystone_ui/info_controller.js +6 -8
- data/app/components/keystone/ui/breakdown_component.html.erb +5 -3
- data/app/components/keystone/ui/breakdown_component.rb +5 -3
- data/app/components/keystone/ui/info_component.rb +2 -2
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +17 -9
- data/the_local/agents/keystone_ui-info.md +10 -3
- 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: 5df45efe6cf162e4a96fa164e01d6ccdf623f8a84d14c530fd5dca4b42eec941
|
|
4
|
+
data.tar.gz: f1366496636edb0d10f9e50c4b75c4dddc21801634cce63ba67cf4bfe009dfd6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f249e58a7511397eab772a9e1c9c54c323c0583ddafe41c4da6741d54d8ee57e3590d9c400f75fbd7f5a71d4aa4b0fa30cb0f6223ee6ab817b0240ab539b976b
|
|
7
|
+
data.tar.gz: dd617c68d26134469be161339b9c0158a2cd39f4f95ee29d9f6e3546f85b4e60cc4009a2d30d431f31792c3dea9752489df8e48032493b5dde5ab872e5a12135
|
|
@@ -4,8 +4,7 @@ export default class extends Controller {
|
|
|
4
4
|
static targets = ["button", "summary", "detail"]
|
|
5
5
|
|
|
6
6
|
peek() {
|
|
7
|
-
this.summaryTarget
|
|
8
|
-
this.place(this.summaryTarget)
|
|
7
|
+
this.show(this.summaryTarget)
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
unpeek() {
|
|
@@ -15,8 +14,7 @@ export default class extends Controller {
|
|
|
15
14
|
toggle(event) {
|
|
16
15
|
event.stopPropagation()
|
|
17
16
|
const shown = this.hasDetailTarget ? this.detailTarget : this.summaryTarget
|
|
18
|
-
shown.classList.
|
|
19
|
-
if (!shown.classList.contains("hidden")) this.place(shown)
|
|
17
|
+
shown.classList.contains("hidden") ? this.show(shown) : shown.classList.add("hidden")
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
hide(event) {
|
|
@@ -28,13 +26,13 @@ export default class extends Controller {
|
|
|
28
26
|
if (this.hasDetailTarget) this.detailTarget.classList.add("hidden")
|
|
29
27
|
}
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
show(shown) {
|
|
30
|
+
Object.assign(shown.style, { position: "fixed", right: "auto" })
|
|
31
|
+
shown.classList.remove("hidden")
|
|
32
32
|
const button = this.buttonTarget.getBoundingClientRect()
|
|
33
33
|
Object.assign(shown.style, {
|
|
34
|
-
position: "fixed",
|
|
35
34
|
top: `${button.bottom}px`,
|
|
36
|
-
left: `${Math.max(8, button.right - shown.offsetWidth)}px
|
|
37
|
-
right: "auto"
|
|
35
|
+
left: `${Math.max(8, button.right - shown.offsetWidth)}px`
|
|
38
36
|
})
|
|
39
37
|
}
|
|
40
38
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
<span class="
|
|
1
|
+
<span class="<%= Keystone::Ui::BreakdownComponent::BREAKDOWN_CLASSES %>">
|
|
2
2
|
<% lines.each do |line| %>
|
|
3
3
|
<span class="<%= Keystone::Ui::BreakdownComponent::LINE_CLASSES %>">
|
|
4
|
-
<span class="<%= Keystone::Ui::BreakdownComponent::AMOUNT_CLASSES %>"><%= line[:amount] %></span
|
|
4
|
+
<span class="<%= Keystone::Ui::BreakdownComponent::AMOUNT_CLASSES %>"><%= line[:amount] %></span>
|
|
5
|
+
<span class="<%= Keystone::Ui::BreakdownComponent::LABEL_CLASSES %>"><%= line[:label] %></span>
|
|
5
6
|
</span>
|
|
6
7
|
<% end %>
|
|
7
8
|
<span class="<%= Keystone::Ui::BreakdownComponent::TOTAL_CLASSES %>">
|
|
8
|
-
<span class="<%= Keystone::Ui::BreakdownComponent::AMOUNT_CLASSES %>
|
|
9
|
+
<span class="<%= Keystone::Ui::BreakdownComponent::AMOUNT_CLASSES %> <%= Keystone::Ui::BreakdownComponent::SUM_CLASSES %>"><%= total[:amount] %></span>
|
|
10
|
+
<span class="<%= Keystone::Ui::BreakdownComponent::LABEL_CLASSES %> <%= Keystone::Ui::BreakdownComponent::SUM_CLASSES %>"><%= total[:label] %></span>
|
|
9
11
|
</span>
|
|
10
12
|
</span>
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
module Keystone
|
|
4
4
|
module Ui
|
|
5
5
|
class BreakdownComponent < ViewComponent::Base
|
|
6
|
-
LINE_CLASSES = "ks-breakdown-line
|
|
7
|
-
AMOUNT_CLASSES = "ks-breakdown-amount
|
|
6
|
+
LINE_CLASSES = "ks-breakdown-line"
|
|
7
|
+
AMOUNT_CLASSES = "ks-breakdown-amount"
|
|
8
8
|
LABEL_CLASSES = "ks-breakdown-label"
|
|
9
|
-
|
|
9
|
+
BREAKDOWN_CLASSES = "ks-breakdown"
|
|
10
|
+
TOTAL_CLASSES = "ks-breakdown-total"
|
|
11
|
+
SUM_CLASSES = "ks-breakdown-sum"
|
|
10
12
|
|
|
11
13
|
attr_reader :lines, :total
|
|
12
14
|
|
|
@@ -5,8 +5,8 @@ module Keystone
|
|
|
5
5
|
class InfoComponent < ViewComponent::Base
|
|
6
6
|
BUTTON_CLASSES = RadioCardComponent::INFO_BUTTON_CLASSES
|
|
7
7
|
ICON = RadioCardComponent::INFO_ICON
|
|
8
|
-
SUMMARY_CLASSES = "ks-info-summary ks-radio-card-disclosure hidden z-30 w-64 text-sm"
|
|
9
|
-
DETAIL_CLASSES = "ks-info-detail ks-radio-card-disclosure hidden z-30 w-
|
|
8
|
+
SUMMARY_CLASSES = "ks-info-summary ks-info-popup ks-radio-card-disclosure hidden z-30 w-64 text-sm"
|
|
9
|
+
DETAIL_CLASSES = "ks-info-detail ks-info-popup ks-radio-card-disclosure hidden z-30 w-80 text-sm"
|
|
10
10
|
|
|
11
11
|
def initialize(summary:)
|
|
12
12
|
@summary = summary
|
data/lib/keystone_ui/version.rb
CHANGED
|
@@ -278,8 +278,11 @@ outer element. See Conventions before using it.
|
|
|
278
278
|
summary itself. A second tap closes what the first opened, a click anywhere
|
|
279
279
|
else on the page closes the detail panel, and scrolling the page closes both
|
|
280
280
|
panels. Each panel opens just under the button with its right edge on the
|
|
281
|
-
button's right edge,
|
|
282
|
-
|
|
281
|
+
button's right edge, the first time it opens as well as every later time,
|
|
282
|
+
and stays at least 8 pixels from the left edge of the screen. The detail
|
|
283
|
+
panel is wider than the summary panel, and the text in both wraps, so pass
|
|
284
|
+
plain sentences and add no line breaks or widths of your own. The panels are
|
|
285
|
+
placed against the screen, so the button can sit
|
|
283
286
|
inside a table or any other container that clips its contents without the
|
|
284
287
|
panels being cut off. Both panels render inside a `<span>`, so the block may
|
|
285
288
|
hold text and inline elements only, such as a `ui_breakdown`, and never a
|
|
@@ -287,12 +290,14 @@ outer element. See Conventions before using it.
|
|
|
287
290
|
controllers registered, and without them the button shows nothing.
|
|
288
291
|
- `ui_breakdown(lines:, total:)` — no block. A list of amounts ending in their
|
|
289
292
|
total. `lines:` is `[{ amount:, label: }, ...]` and `total:` is one
|
|
290
|
-
`{ amount:, label: }`, both required. Each line renders its amount
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
`
|
|
293
|
+
`{ amount:, label: }`, both required. Each line renders its amount with its
|
|
294
|
+
label beside it, and the total renders last, set apart from the lines above
|
|
295
|
+
it. Every value is printed as given and nothing is added up, so compute the
|
|
296
|
+
total and format numbers and currency before passing them. How the amounts
|
|
297
|
+
and labels line up, and how the total is set apart, come from the
|
|
298
|
+
`ks-breakdown` classes in the keystone_ui-styles gem, and the helper sets no
|
|
299
|
+
widths or spacing of its own. It renders inline elements only, so it can sit
|
|
300
|
+
inside a `ui_info` block.
|
|
296
301
|
- `ui_accordion(items: [])` — a stack of independently expandable rows. `items:`
|
|
297
302
|
is `[{ question:, answer: }, ...]`.
|
|
298
303
|
- `ui_tab_switcher(tabs:)` — takes a block. `tabs:` is an array of label strings;
|
|
@@ -427,7 +432,10 @@ outer element. See Conventions before using it.
|
|
|
427
432
|
lists, and the wording of the summary, are the app's own, so ask the
|
|
428
433
|
developer rather than pick. If an info button shows nothing when hovered or
|
|
429
434
|
tapped, the gem's Stimulus controllers are not registered, so stop and hand
|
|
430
|
-
that part to `keystone_ui-install`.
|
|
435
|
+
that part to `keystone_ui-install`. If a breakdown renders as one run of
|
|
436
|
+
text with no columns and no separate total, the app's keystone_ui-styles
|
|
437
|
+
version does not define the `ks-breakdown` classes, so stop and hand that
|
|
438
|
+
part to `keystone_ui-install` as well, and add no classes to fix it.
|
|
431
439
|
A field whose value must be one of a fixed list is a `:select` with
|
|
432
440
|
`options:`, and a field that accepts any text and offers common values is a
|
|
433
441
|
text field with `suggestions:`. Which one a field is, and which values it
|
|
@@ -96,15 +96,22 @@ holds the catalog.
|
|
|
96
96
|
under the button, and the summary stays the hover text. Both popups are
|
|
97
97
|
placed against the screen, not against the element the button sits in, so a
|
|
98
98
|
table or any other container that clips its contents does not cut them off.
|
|
99
|
-
Each opens under the button with its right edge on the button's,
|
|
100
|
-
|
|
99
|
+
Each opens under the button with its right edge on the button's, the first
|
|
100
|
+
time as well as every later time, and is kept on the screen when the button
|
|
101
|
+
is near the left edge. The detail panel is wider than the summary. Both carry
|
|
102
|
+
one shared popup class from keystone_ui-styles, which decides how their text
|
|
103
|
+
wraps and how they fit a narrow screen. A second tap closes
|
|
101
104
|
what the first opened, a click anywhere else closes the detail, and
|
|
102
105
|
scrolling the page closes both.
|
|
103
106
|
- **A breakdown is text.** A breakdown lists amounts, each beside a label
|
|
104
107
|
saying what it is, and ends with a total set apart from the lines above it.
|
|
105
108
|
Every line and the total are an amount and a label, passed as
|
|
106
109
|
already-formatted text and shown as written. The component adds nothing up,
|
|
107
|
-
so the total is whatever it is given.
|
|
110
|
+
so the total is whatever it is given. Its whole layout comes from
|
|
111
|
+
keystone_ui-styles' `ks-breakdown` classes: how the amounts and labels line
|
|
112
|
+
up, and how the total is set apart. The component sets no widths or spacing
|
|
113
|
+
of its own, so a breakdown looks right only with a keystone_ui-styles version
|
|
114
|
+
that defines those classes. It has no button and no hidden state of
|
|
108
115
|
its own, and it can be placed inside an info button's detail.
|
|
109
116
|
- **Suggestions.** A form field can carry a list of suggested values. The
|
|
110
117
|
browser offers them while the field's text is typed, and the user can still
|
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.29.
|
|
4
|
+
version: 0.29.5
|
|
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.9.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.9.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: view_component
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|