polaris_view_components 3.1.4 → 3.2.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/javascripts/polaris_view_components/collapsible_controller.js +11 -0
- data/app/assets/javascripts/polaris_view_components.js +7 -0
- data/app/assets/stylesheets/polaris_view_components/collapsible.pcss +13 -0
- data/app/assets/stylesheets/polaris_view_components.css +7 -1
- data/app/assets/stylesheets/polaris_view_components.pcss +1 -0
- data/app/components/polaris/collapsible_component.rb +25 -1
- data/lib/polaris/view_components/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d60a0f25f554d4bb06daa6044f0f992e6713c79f3b336c6bdb48f042faa7175c
|
|
4
|
+
data.tar.gz: e1be9a266fe881c52fca51f32c0afa6ecd4186159a2fa6e8c29bf59b1de003be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2664bea98f1ec076c3f88f3f168e6239f4c38786efcbacd30f86956d674358fcab0f0958226ae2b68eecb02cae108f63fb33c07e452cf0932d990da5e07e10b3
|
|
7
|
+
data.tar.gz: ab2c981955e6a71d6879e7f4d8b04feb5ba6ab1d139f4065d119408dd134b2670b09b4745eee6bc5d86126ea71565d1a2e9fb0627f900009cb52c63cc7399a41
|
|
@@ -11,9 +11,20 @@ export default class extends Controller {
|
|
|
11
11
|
this.element.style.overflow = "hidden"
|
|
12
12
|
this.element.classList.add("Polaris-Collapsible--isFullyClosed")
|
|
13
13
|
}
|
|
14
|
+
this.updateTriggers()
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
get isClosed() {
|
|
17
18
|
return this.element.classList.contains("Polaris-Collapsible--isFullyClosed")
|
|
18
19
|
}
|
|
20
|
+
|
|
21
|
+
// Private
|
|
22
|
+
|
|
23
|
+
updateTriggers() {
|
|
24
|
+
if (!this.element.id) return
|
|
25
|
+
|
|
26
|
+
document.querySelectorAll(`[aria-controls="${CSS.escape(this.element.id)}"]`).forEach((trigger) => {
|
|
27
|
+
trigger.setAttribute("aria-expanded", !this.isClosed)
|
|
28
|
+
})
|
|
29
|
+
}
|
|
19
30
|
}
|
|
@@ -355,10 +355,17 @@ class Collapsible extends Controller {
|
|
|
355
355
|
this.element.style.overflow = "hidden";
|
|
356
356
|
this.element.classList.add("Polaris-Collapsible--isFullyClosed");
|
|
357
357
|
}
|
|
358
|
+
this.updateTriggers();
|
|
358
359
|
}
|
|
359
360
|
get isClosed() {
|
|
360
361
|
return this.element.classList.contains("Polaris-Collapsible--isFullyClosed");
|
|
361
362
|
}
|
|
363
|
+
updateTriggers() {
|
|
364
|
+
if (!this.element.id) return;
|
|
365
|
+
document.querySelectorAll(`[aria-controls="${CSS.escape(this.element.id)}"]`).forEach((trigger => {
|
|
366
|
+
trigger.setAttribute("aria-expanded", !this.isClosed);
|
|
367
|
+
}));
|
|
368
|
+
}
|
|
362
369
|
}
|
|
363
370
|
|
|
364
371
|
class DataTable extends Controller {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
.Polaris-Collapsible__Trigger {
|
|
2
|
+
.Polaris-Button__Icon:last-child .Polaris-Icon {
|
|
3
|
+
transition: transform var(--p-motion-duration-100) var(--p-motion-ease-out);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
&[aria-expanded="true"] .Polaris-Button__Icon:last-child .Polaris-Icon {
|
|
7
|
+
transform: rotate(180deg);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
& + .Polaris-Collapsible {
|
|
11
|
+
margin-top: var(--p-space-400);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -375,7 +375,13 @@
|
|
|
375
375
|
box-shadow: none;
|
|
376
376
|
}html[class~="Polaris-Summer-Editions-2023"] .Polaris-LegacyCard.Polaris-LegacyCard--borderless::before {
|
|
377
377
|
content: none;
|
|
378
|
-
}.Polaris
|
|
378
|
+
}.Polaris-Collapsible__Trigger .Polaris-Button__Icon:last-child .Polaris-Icon {
|
|
379
|
+
transition: transform var(--p-motion-duration-100) var(--p-motion-ease-out);
|
|
380
|
+
}.Polaris-Collapsible__Trigger[aria-expanded="true"] .Polaris-Button__Icon:last-child .Polaris-Icon {
|
|
381
|
+
transform: rotate(180deg);
|
|
382
|
+
}.Polaris-Collapsible__Trigger + .Polaris-Collapsible {
|
|
383
|
+
margin-top: var(--p-space-400);
|
|
384
|
+
}.Polaris--hidden {
|
|
379
385
|
display: none !important;
|
|
380
386
|
}/* Add missing 1/4 section for layout */@media (min-width: 30.625em) {
|
|
381
387
|
.Polaris-Layout__Section--oneFourth {
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
@import "./polaris_view_components/button.pcss";
|
|
8
8
|
@import "./polaris_view_components/callout_card.pcss";
|
|
9
9
|
@import "./polaris_view_components/card.pcss";
|
|
10
|
+
@import "./polaris_view_components/collapsible.pcss";
|
|
10
11
|
@import "./polaris_view_components/custom.pcss";
|
|
11
12
|
@import "./polaris_view_components/data_table.pcss";
|
|
12
13
|
@import "./polaris_view_components/footer_help.pcss";
|
|
@@ -5,11 +5,14 @@ module Polaris
|
|
|
5
5
|
def initialize(
|
|
6
6
|
expand_on_print: false,
|
|
7
7
|
open: false,
|
|
8
|
+
title: nil,
|
|
8
9
|
**system_arguments
|
|
9
10
|
)
|
|
10
11
|
@expand_on_print = expand_on_print
|
|
11
12
|
@open = open
|
|
13
|
+
@title = title
|
|
12
14
|
@system_arguments = system_arguments
|
|
15
|
+
@system_arguments[:id] ||= "polaris-collapsible-#{SecureRandom.hex(4)}" if @title.present?
|
|
13
16
|
end
|
|
14
17
|
|
|
15
18
|
def system_arguments
|
|
@@ -31,7 +34,28 @@ module Polaris
|
|
|
31
34
|
end
|
|
32
35
|
|
|
33
36
|
def call
|
|
34
|
-
render(Polaris::BaseComponent.new(**system_arguments)) { content }
|
|
37
|
+
collapsible = render(Polaris::BaseComponent.new(**system_arguments)) { content }
|
|
38
|
+
return collapsible if @title.blank?
|
|
39
|
+
|
|
40
|
+
tag.div { safe_join([trigger, collapsible]) }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
def trigger
|
|
46
|
+
id = @system_arguments[:id]
|
|
47
|
+
|
|
48
|
+
polaris_button(
|
|
49
|
+
plain: true,
|
|
50
|
+
disclosure: :down,
|
|
51
|
+
classes: "Polaris-Collapsible__Trigger",
|
|
52
|
+
aria: {expanded: @open, controls: id},
|
|
53
|
+
data: {
|
|
54
|
+
controller: "polaris",
|
|
55
|
+
target: "##{id}",
|
|
56
|
+
action: "polaris#toggleCollapsible"
|
|
57
|
+
}
|
|
58
|
+
) { @title }
|
|
35
59
|
end
|
|
36
60
|
end
|
|
37
61
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: polaris_view_components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dan Gamble
|
|
@@ -690,6 +690,7 @@ files:
|
|
|
690
690
|
- app/assets/stylesheets/polaris_view_components/button.pcss
|
|
691
691
|
- app/assets/stylesheets/polaris_view_components/callout_card.pcss
|
|
692
692
|
- app/assets/stylesheets/polaris_view_components/card.pcss
|
|
693
|
+
- app/assets/stylesheets/polaris_view_components/collapsible.pcss
|
|
693
694
|
- app/assets/stylesheets/polaris_view_components/custom.pcss
|
|
694
695
|
- app/assets/stylesheets/polaris_view_components/data_table.pcss
|
|
695
696
|
- app/assets/stylesheets/polaris_view_components/fonts.pcss
|