polaris_view_components 2.2.0 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/polaris_view_components/button_controller.js +10 -8
- data/app/assets/javascripts/polaris_view_components.js +11 -8
- data/app/assets/stylesheets/polaris_view_components/button.pcss +13 -1
- data/app/assets/stylesheets/polaris_view_components.css +9 -3
- data/app/components/polaris/base_radio_button.rb +1 -0
- data/lib/polaris/view_components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10a87c4fe4cbbfe6e134c8d7ccc9ba0747713b633399a47f7677f830941c4b9b
|
4
|
+
data.tar.gz: 6782c0c52aa3df512a0a55efbf563321a0cb753ee987bd6b18089663574c5633
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c2bae435fce1e3e1d9ee88c2fedd06cbf02b2db2f913f87e5cd39c47e07974aec009e17461049d53f137c63df92f2927b37bfceb8adac9ac8b52393ba379aa0
|
7
|
+
data.tar.gz: f57b0604f88283b4661f011dc76ab856ba7b498a7f784f93472f687f3bde14b3d07b94b38ea666f4298d0b286aa32d890a25d4ce4e2ee2378271b81709281fa6
|
@@ -1,28 +1,30 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
|
+
static values = { disabled: Boolean }
|
5
|
+
|
4
6
|
disable(event) {
|
5
|
-
if (this.
|
6
|
-
event.preventDefault()
|
7
|
+
if (this.disabledValue) {
|
8
|
+
if (event) event.preventDefault()
|
7
9
|
} else {
|
8
|
-
this.
|
10
|
+
this.disabledValue = true
|
9
11
|
this.button.classList.add("Polaris-Button--disabled", "Polaris-Button--loading")
|
10
12
|
this.buttonContent.insertAdjacentHTML("afterbegin", this.spinnerHTML)
|
11
13
|
}
|
12
14
|
}
|
13
15
|
|
14
16
|
disableWithoutLoader(event) {
|
15
|
-
if (this.
|
16
|
-
event.preventDefault()
|
17
|
+
if (this.disabledValue) {
|
18
|
+
if (event) event.preventDefault()
|
17
19
|
} else {
|
18
|
-
this.
|
20
|
+
this.disabledValue = true
|
19
21
|
this.button.classList.add("Polaris-Button--disabled")
|
20
22
|
}
|
21
23
|
}
|
22
24
|
|
23
25
|
enable() {
|
24
|
-
if (this.
|
25
|
-
this.
|
26
|
+
if (this.disabledValue) {
|
27
|
+
this.disabledValue = false
|
26
28
|
this.button.classList.remove("Polaris-Button--disabled", "Polaris-Button--loading")
|
27
29
|
if (this.spinner) this.spinner.remove()
|
28
30
|
}
|
@@ -298,26 +298,29 @@ class Autocomplete extends Controller {
|
|
298
298
|
}
|
299
299
|
|
300
300
|
class Button extends Controller {
|
301
|
+
static values={
|
302
|
+
disabled: Boolean
|
303
|
+
};
|
301
304
|
disable(event) {
|
302
|
-
if (this.
|
303
|
-
event.preventDefault();
|
305
|
+
if (this.disabledValue) {
|
306
|
+
if (event) event.preventDefault();
|
304
307
|
} else {
|
305
|
-
this.
|
308
|
+
this.disabledValue = true;
|
306
309
|
this.button.classList.add("Polaris-Button--disabled", "Polaris-Button--loading");
|
307
310
|
this.buttonContent.insertAdjacentHTML("afterbegin", this.spinnerHTML);
|
308
311
|
}
|
309
312
|
}
|
310
313
|
disableWithoutLoader(event) {
|
311
|
-
if (this.
|
312
|
-
event.preventDefault();
|
314
|
+
if (this.disabledValue) {
|
315
|
+
if (event) event.preventDefault();
|
313
316
|
} else {
|
314
|
-
this.
|
317
|
+
this.disabledValue = true;
|
315
318
|
this.button.classList.add("Polaris-Button--disabled");
|
316
319
|
}
|
317
320
|
}
|
318
321
|
enable() {
|
319
|
-
if (this.
|
320
|
-
this.
|
322
|
+
if (this.disabledValue) {
|
323
|
+
this.disabledValue = false;
|
321
324
|
this.button.classList.remove("Polaris-Button--disabled", "Polaris-Button--loading");
|
322
325
|
if (this.spinner) this.spinner.remove();
|
323
326
|
}
|
@@ -54,7 +54,6 @@ html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button {
|
|
54
54
|
}
|
55
55
|
|
56
56
|
/* Destructive */
|
57
|
-
&.Polaris-Button--destructive,
|
58
57
|
&.Polaris-Button--destructive:is(.Polaris-Button--primary) {
|
59
58
|
--pc-button-color: var(--p-color-bg-fill-critical);
|
60
59
|
--pc-button-text: var(--p-color-bg-surface);
|
@@ -68,6 +67,19 @@ html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button {
|
|
68
67
|
}
|
69
68
|
}
|
70
69
|
|
70
|
+
&.Polaris-Button--destructive:not(.Polaris-Button--primary) {
|
71
|
+
--pc-button-text: var(--p-color-text-critical);
|
72
|
+
--pc-button-icon-fill: currentColor;
|
73
|
+
|
74
|
+
&:active {
|
75
|
+
--pc-button-text: var(--p-color-text-critical-active);
|
76
|
+
}
|
77
|
+
|
78
|
+
&:hover {
|
79
|
+
--pc-button-text: var(--p-color-text-critical-hover);
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
71
83
|
/* Primary */
|
72
84
|
&.Polaris-Button--primary {
|
73
85
|
--pc-button-bg-gradient: var(--p-color-button-gradient-bg-fill);
|
@@ -309,16 +309,22 @@
|
|
309
309
|
background: var(--p-color-bg-fill-tertiary);
|
310
310
|
}/* Loading */html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button.Polaris-Button--loading svg {
|
311
311
|
fill: var(--p-color-icon-disabled);
|
312
|
-
}/* Destructive */html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button.Polaris-Button--destructive
|
313
|
-
html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button.Polaris-Button--destructive:is(.Polaris-Button--primary) {
|
312
|
+
}/* Destructive */html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button.Polaris-Button--destructive:is(.Polaris-Button--primary) {
|
314
313
|
--pc-button-color: var(--p-color-bg-fill-critical);
|
315
314
|
--pc-button-text: var(--p-color-bg-surface);
|
316
315
|
--pc-button-color-hover: var(--p-color-bg-fill-critical-hover);
|
317
316
|
--pc-button-color-active: var(--p-color-bg-fill-critical-active);
|
318
317
|
--pc-button-color-depressed: var(--p-color-bg-fill-critical-selected);
|
319
318
|
box-shadow: var(--p-shadow-button-primary-critical);
|
320
|
-
}html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button.Polaris-Button--destructive:
|
319
|
+
}html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button.Polaris-Button--destructive:is(.Polaris-Button--primary):active {
|
321
320
|
background: var(--pc-button-color-active);
|
321
|
+
}html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button.Polaris-Button--destructive:not(.Polaris-Button--primary) {
|
322
|
+
--pc-button-text: var(--p-color-text-critical);
|
323
|
+
--pc-button-icon-fill: currentColor;
|
324
|
+
}html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button.Polaris-Button--destructive:not(.Polaris-Button--primary):active {
|
325
|
+
--pc-button-text: var(--p-color-text-critical-active);
|
326
|
+
}html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button.Polaris-Button--destructive:not(.Polaris-Button--primary):hover {
|
327
|
+
--pc-button-text: var(--p-color-text-critical-hover);
|
322
328
|
}/* Primary */html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button.Polaris-Button--primary {
|
323
329
|
--pc-button-bg-gradient: var(--p-color-button-gradient-bg-fill);
|
324
330
|
--pc-button-color: var(--pc-button-bg-gradient), var(--p-color-bg-fill-brand);
|
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: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Gamble
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-08-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|