polaris_view_components 2.2.0 → 2.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d31c4bdf79eb1b9306c46f8506c57a26fdaffb6af1ddf0d5ae48f560faffeb9
4
- data.tar.gz: fa9fe8d5d9450fcb128970910a3b5ec1828d5cafda8a80bc745e41122a81ca60
3
+ metadata.gz: 10a87c4fe4cbbfe6e134c8d7ccc9ba0747713b633399a47f7677f830941c4b9b
4
+ data.tar.gz: 6782c0c52aa3df512a0a55efbf563321a0cb753ee987bd6b18089663574c5633
5
5
  SHA512:
6
- metadata.gz: 825ec26adbde83a5f56f3288bb5c2c4294c741a28965f90d25fa28b2acfdb29cae9b1efdb9692f29bf1599d35dc39ed55653cab78eabbb2fdb12a8acdb082603
7
- data.tar.gz: 3447d874bdc8b3905f63b5bdcdb1a1d063d706451e71a5ce063b7d33694a0b1be5576416f25e1d74919760e302bd283571c52ac78a52173f85f091e16126a067
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.button.disabled) {
6
- event.preventDefault()
7
+ if (this.disabledValue) {
8
+ if (event) event.preventDefault()
7
9
  } else {
8
- this.button.disabled = true
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.button.disabled) {
16
- event.preventDefault()
17
+ if (this.disabledValue) {
18
+ if (event) event.preventDefault()
17
19
  } else {
18
- this.button.disabled = true
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.button.disabled) {
25
- this.button.disabled = false
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.button.disabled) {
303
- event.preventDefault();
305
+ if (this.disabledValue) {
306
+ if (event) event.preventDefault();
304
307
  } else {
305
- this.button.disabled = true;
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.button.disabled) {
312
- event.preventDefault();
314
+ if (this.disabledValue) {
315
+ if (event) event.preventDefault();
313
316
  } else {
314
- this.button.disabled = true;
317
+ this.disabledValue = true;
315
318
  this.button.classList.add("Polaris-Button--disabled");
316
319
  }
317
320
  }
318
321
  enable() {
319
- if (this.button.disabled) {
320
- this.button.disabled = false;
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:active, html[class~="Polaris-Summer-Editions-2023"] .Polaris-Button.Polaris-Button--destructive:is(.Polaris-Button--primary):active {
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);
@@ -23,6 +23,7 @@ module Polaris
23
23
  opts[:disabled] = true if @disabled
24
24
  opts[:aria] ||= {}
25
25
  opts[:aria][:checked] = @checked
26
+ opts[:checked] = @checked
26
27
  opts[:class] = opts.delete(:classes)
27
28
  end
28
29
  end
@@ -1,5 +1,5 @@
1
1
  module Polaris
2
2
  module ViewComponents
3
- VERSION = "2.2.0"
3
+ VERSION = "2.2.2"
4
4
  end
5
5
  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: 2.2.0
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-07-30 00:00:00.000000000 Z
12
+ date: 2024-08-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails