playbook_ui 15.0.0.pre.alpha.stimulusbutton10763 → 15.1.0.pre.alpha.PLAY2425textinputaccessibility10907
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/pb_kits/playbook/pb_button/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +4 -0
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +1 -1
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.rb +1 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +14 -6
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.html.erb +8 -4
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +5 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.md +1 -0
- data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +3 -1
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +6 -0
- data/dist/chunks/{_line_graph-C9stNsP3.js → _line_graph-BnK1i7QI.js} +1 -1
- data/dist/chunks/{_typeahead-D3MtsWXG.js → _typeahead-pbS3fEzb.js} +1 -1
- data/dist/chunks/{_weekday_stacked-BMwekyel.js → _weekday_stacked-x-syST1P.js} +2 -2
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +2 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +2 -2
- metadata +6 -10
- data/app/pb_kits/playbook/pb_button/docs/_button_managed_disabled.html.erb +0 -29
- data/app/pb_kits/playbook/pb_button/docs/_button_managed_disabled.md +0 -5
- data/app/pb_kits/playbook/pb_button/docs/_button_managed_disabled_helper.html.erb +0 -18
- data/app/pb_kits/playbook/pb_button/docs/_button_managed_disabled_helper.md +0 -5
- data/app/pb_kits/playbook/pb_button/index.js +0 -99
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: playbook_ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 15.
|
|
4
|
+
version: 15.1.0.pre.alpha.PLAY2425textinputaccessibility10907
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Power UX
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2025-09-
|
|
12
|
+
date: 2025-09-30 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: actionpack
|
|
@@ -628,10 +628,6 @@ files:
|
|
|
628
628
|
- app/pb_kits/playbook/pb_button/docs/_button_loading.html.erb
|
|
629
629
|
- app/pb_kits/playbook/pb_button/docs/_button_loading.jsx
|
|
630
630
|
- app/pb_kits/playbook/pb_button/docs/_button_loading.md
|
|
631
|
-
- app/pb_kits/playbook/pb_button/docs/_button_managed_disabled.html.erb
|
|
632
|
-
- app/pb_kits/playbook/pb_button/docs/_button_managed_disabled.md
|
|
633
|
-
- app/pb_kits/playbook/pb_button/docs/_button_managed_disabled_helper.html.erb
|
|
634
|
-
- app/pb_kits/playbook/pb_button/docs/_button_managed_disabled_helper.md
|
|
635
631
|
- app/pb_kits/playbook/pb_button/docs/_button_options.html.erb
|
|
636
632
|
- app/pb_kits/playbook/pb_button/docs/_button_options.jsx
|
|
637
633
|
- app/pb_kits/playbook/pb_button/docs/_button_props_swift.md
|
|
@@ -646,7 +642,6 @@ files:
|
|
|
646
642
|
- app/pb_kits/playbook/pb_button/docs/_footer.md
|
|
647
643
|
- app/pb_kits/playbook/pb_button/docs/example.yml
|
|
648
644
|
- app/pb_kits/playbook/pb_button/docs/index.js
|
|
649
|
-
- app/pb_kits/playbook/pb_button/index.js
|
|
650
645
|
- app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.scss
|
|
651
646
|
- app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.tsx
|
|
652
647
|
- app/pb_kits/playbook/pb_button_toolbar/_button_toolbar_dark.scss
|
|
@@ -3180,6 +3175,7 @@ files:
|
|
|
3180
3175
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_custom.jsx
|
|
3181
3176
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_default.html.erb
|
|
3182
3177
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx
|
|
3178
|
+
- app/pb_kits/playbook/pb_text_input/docs/_text_input_default.md
|
|
3183
3179
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_default_swift.md
|
|
3184
3180
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_disabled.html.erb
|
|
3185
3181
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_disabled.jsx
|
|
@@ -3707,9 +3703,9 @@ files:
|
|
|
3707
3703
|
- app/pb_kits/playbook/utilities/test/globalProps/truncate.test.js
|
|
3708
3704
|
- app/pb_kits/playbook/utilities/text.ts
|
|
3709
3705
|
- app/pb_kits/playbook/utilities/validEmojiChecker.ts
|
|
3710
|
-
- dist/chunks/_line_graph-
|
|
3711
|
-
- dist/chunks/_typeahead-
|
|
3712
|
-
- dist/chunks/_weekday_stacked-
|
|
3706
|
+
- dist/chunks/_line_graph-BnK1i7QI.js
|
|
3707
|
+
- dist/chunks/_typeahead-pbS3fEzb.js
|
|
3708
|
+
- dist/chunks/_weekday_stacked-x-syST1P.js
|
|
3713
3709
|
- dist/chunks/componentRegistry-DzmmLR2x.js
|
|
3714
3710
|
- dist/chunks/lazysizes-B7xYodB-.js
|
|
3715
3711
|
- dist/chunks/lib-QZuu1ltS.js
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<br/>
|
|
2
|
-
<%= pb_rails("button", props: { text: "Disable Buttons", variant: "link", id: "toggle-disabled-demo" }) %>
|
|
3
|
-
<%= pb_rails("button", props: { text: "Enable Buttons", variant: "link", id: "toggle-enabled-demo" }) %>
|
|
4
|
-
<br/>
|
|
5
|
-
<%= pb_rails("button", props: { text: "I am a Normal Button", id: "normal_managed_button", data:{pb_button_managed: true}, margin_bottom: "lg" }) %>
|
|
6
|
-
<br/>
|
|
7
|
-
<%= pb_rails("button", props: { text: "I am an <a> Button", id: "a_tag_managed_button", tag:"a", data:{pb_button_managed: true}, link: "http://google.com", margin_right: "lg" }) %>
|
|
8
|
-
|
|
9
|
-
<script>
|
|
10
|
-
document.addEventListener('DOMContentLoaded', function () {
|
|
11
|
-
const disableTrigger = document.querySelector('#toggle-disabled-demo')
|
|
12
|
-
const enableTrigger = document.querySelector('#toggle-enabled-demo')
|
|
13
|
-
|
|
14
|
-
// Managed Buttons
|
|
15
|
-
const btn = document.querySelector('#normal_managed_button');
|
|
16
|
-
const link = document.querySelector('#a_tag_managed_button');
|
|
17
|
-
|
|
18
|
-
disableTrigger.addEventListener('click', (e) => {
|
|
19
|
-
// Disable both default button and a tag button
|
|
20
|
-
btn.setAttribute('disabled', true)
|
|
21
|
-
link.setAttribute('aria-disabled', 'true')
|
|
22
|
-
});
|
|
23
|
-
enableTrigger.addEventListener('click', (e) => {
|
|
24
|
-
// Enable both default button and a tag button
|
|
25
|
-
btn.removeAttribute('disabled')
|
|
26
|
-
link.removeAttribute('aria-disabled')
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
</script>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
If needing to toggle the disabled state of the Button dynmically, you can now do so in rails using the `pb-button-managed` data attribute.
|
|
2
|
-
|
|
3
|
-
If your button has `data:{ pb-button-managed: true }` on it, you can then toggle state via attributes: for buttons set/remove disabled, for links set/remove aria-disabled="true". This will handle disabling the button, preventing clicks as well as all style changes so you don't have to.
|
|
4
|
-
|
|
5
|
-
Click to enable or disable the buttons above and view the code snippet below for details!
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<%= pb_rails("button", props: { text: "Disable Button", variant: "link", id: "toggle-disabled-demo-with-helper" }) %>
|
|
2
|
-
<%= pb_rails("button", props: { text: "Enable Button", variant: "link", id: "toggle-enabled-demo-with-helper" }) %>
|
|
3
|
-
<br/>
|
|
4
|
-
<%= pb_rails("button", props: { text: "Watch me Change!", id: "managed_button_with_helper", data:{pb_button_managed: true} }) %>
|
|
5
|
-
|
|
6
|
-
<script>
|
|
7
|
-
document.addEventListener('DOMContentLoaded', function () {
|
|
8
|
-
const demoBtn = document.querySelector('#managed_button_with_helper')
|
|
9
|
-
|
|
10
|
-
const disable = document.querySelector('#toggle-disabled-demo-with-helper')
|
|
11
|
-
const enable = document.querySelector('#toggle-enabled-demo-with-helper')
|
|
12
|
-
|
|
13
|
-
disable.addEventListener('click', (e) => {demoBtn._pbButton.disable()});
|
|
14
|
-
|
|
15
|
-
enable.addEventListener('click', (e) => {demoBtn._pbButton.enable()});
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
</script>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
The disabled state for the button can also be toggled via small helpers available through the `pb-button-managed` data attribute.
|
|
2
|
-
|
|
3
|
-
If your button has `data:{ pb-button-managed: true }` on it, you can then toggle state via the provided `_pbButton.disable()` and `_pbButton.enable()` helpers as shoen in the code snippet below.
|
|
4
|
-
|
|
5
|
-
Click to enable or disable the buttons above!
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import PbEnhancedElement from "../pb_enhanced_element"
|
|
2
|
-
|
|
3
|
-
const BUTTON_SELECTOR = "[data-pb-button-managed]"
|
|
4
|
-
|
|
5
|
-
export default class PbButton extends PbEnhancedElement {
|
|
6
|
-
static get selector() {
|
|
7
|
-
return BUTTON_SELECTOR
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
connect() {
|
|
11
|
-
this._attrManaged = this._attributesPresent()
|
|
12
|
-
this.element._pbButton = this
|
|
13
|
-
|
|
14
|
-
this._onClick = (e) => {
|
|
15
|
-
if (this.isDisabled()) {
|
|
16
|
-
e.preventDefault()
|
|
17
|
-
e.stopImmediatePropagation()
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
this.element.addEventListener("click", this._onClick, true)
|
|
21
|
-
|
|
22
|
-
if (this._attrManaged) this._syncClassesFromAttributes()
|
|
23
|
-
|
|
24
|
-
this._observer = new MutationObserver(() => {
|
|
25
|
-
this._attrManaged = true
|
|
26
|
-
this._syncClassesFromAttributes()
|
|
27
|
-
})
|
|
28
|
-
this._observer.observe(this.element, {
|
|
29
|
-
attributes: true,
|
|
30
|
-
attributeFilter: ["disabled", "aria-disabled"],
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
disconnect() {
|
|
35
|
-
this.element.removeEventListener("click", this._onClick, true)
|
|
36
|
-
this._observer?.disconnect()
|
|
37
|
-
delete this.element._pbButton
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
disable() { this.setDisabled(true) }
|
|
41
|
-
enable() { this.setDisabled(false) }
|
|
42
|
-
|
|
43
|
-
setDisabled(state) {
|
|
44
|
-
if (this._isButton()) {
|
|
45
|
-
state
|
|
46
|
-
? this.element.setAttribute("disabled", "disabled")
|
|
47
|
-
: this.element.removeAttribute("disabled")
|
|
48
|
-
} else {
|
|
49
|
-
state
|
|
50
|
-
? this.element.setAttribute("aria-disabled", "true")
|
|
51
|
-
: this.element.removeAttribute("aria-disabled")
|
|
52
|
-
}
|
|
53
|
-
this._attrManaged = true
|
|
54
|
-
this._applyClassState(state)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
isDisabled() {
|
|
58
|
-
if (this._isButton()) {
|
|
59
|
-
if (this.element.hasAttribute("disabled")) return true
|
|
60
|
-
if (this._attrManaged && !this.element.hasAttribute("disabled")) return false
|
|
61
|
-
} else {
|
|
62
|
-
const aria = this.element.getAttribute("aria-disabled")
|
|
63
|
-
if (aria === "true") return true
|
|
64
|
-
if (this._attrManaged && aria !== "true") return false
|
|
65
|
-
}
|
|
66
|
-
return this.element.classList.contains("pb_button_disabled")
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
_isButton() {
|
|
70
|
-
return this.element.tagName === "BUTTON"
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
_attributesPresent() {
|
|
74
|
-
return this.element.hasAttribute("disabled") || this.element.hasAttribute("aria-disabled")
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
_syncClassesFromAttributes() {
|
|
78
|
-
const state = this._attrDisabledState()
|
|
79
|
-
const disabled = (state === null) ? false : state
|
|
80
|
-
this._applyClassState(disabled)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
_attrDisabledState() {
|
|
84
|
-
if (this._isButton()) {
|
|
85
|
-
return this.element.hasAttribute("disabled") ? true : null
|
|
86
|
-
} else {
|
|
87
|
-
const aria = this.element.getAttribute("aria-disabled")
|
|
88
|
-
if (aria === "true") return true
|
|
89
|
-
if (aria === "false") return false
|
|
90
|
-
return this.element.hasAttribute("aria-disabled") ? false : null
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
_applyClassState(disabled) {
|
|
95
|
-
this.element.classList.toggle("pb_button_disabled", !!disabled)
|
|
96
|
-
this.element.classList.toggle("pb_button_enabled", !disabled)
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|