playbook_ui_docs 15.6.0.pre.rc.3 → 15.6.0.pre.rc.4
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_background/docs/_background_light.html.erb +1 -1
- data/app/pb_kits/playbook/pb_background/docs/_background_light.jsx +0 -1
- data/app/pb_kits/playbook/pb_background/docs/_background_light.md +1 -0
- data/app/pb_kits/playbook/pb_background/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb +34 -4
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +16 -7
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af6164834840e78ca16c3abffd2a09cd8a1ab0d3e2292936112ffcd09fdeffd0
|
|
4
|
+
data.tar.gz: 4ac210d71a4ed68c62ee2659d52310cc1a240ce6353bd0c66d41940bfb219e82
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cfc4928ca858266eebf6ffba85658563fbcb2af95a86e8f18be028b0115cd701410a49f05164d37dd08acdb102f01240b18bd03f49bb68145afcf10287e5f53d
|
|
7
|
+
data.tar.gz: 21e2130b2e580d01c225e00707dc26a6949fdf1d2a8b5a96c5ae4c5f8790079b7dc0e7765525efc1f6c66b2f39a165054b45899582aacf48782fac9f0ed2c0be
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
By default, the Background kit sets background color to 'light' as seen here.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
examples:
|
|
2
2
|
|
|
3
3
|
rails:
|
|
4
|
-
- background_light:
|
|
4
|
+
- background_light: Default
|
|
5
5
|
- background_white: White
|
|
6
6
|
- background_gradient: Gradient
|
|
7
7
|
- background_image: Image
|
|
@@ -11,7 +11,7 @@ examples:
|
|
|
11
11
|
- background_size: Size
|
|
12
12
|
|
|
13
13
|
react:
|
|
14
|
-
- background_light:
|
|
14
|
+
- background_light: Default
|
|
15
15
|
- background_white: White
|
|
16
16
|
- background_gradient: Gradient
|
|
17
17
|
- background_image: Image
|
data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb
CHANGED
|
@@ -1,12 +1,42 @@
|
|
|
1
1
|
<form id="example-form-validation" action="" method="get">
|
|
2
|
-
<%= pb_rails("phone_number_input", props: {
|
|
2
|
+
<%= pb_rails("phone_number_input", props: {
|
|
3
|
+
id: "validation",
|
|
4
|
+
initial_country: "af",
|
|
5
|
+
value: "",
|
|
6
|
+
required: true
|
|
7
|
+
}) %>
|
|
3
8
|
<%= pb_rails("button", props: {html_type: "submit", text: "Save Phone Number"}) %>
|
|
4
9
|
</form>
|
|
5
10
|
|
|
6
11
|
<%= javascript_tag do %>
|
|
7
12
|
document.addEventListener('DOMContentLoaded', function () {
|
|
8
|
-
document.querySelector('#example-form-validation')
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
const form = document.querySelector('#example-form-validation');
|
|
14
|
+
|
|
15
|
+
// Wait for React component to mount
|
|
16
|
+
function waitForComponent() {
|
|
17
|
+
const phoneInput = form.querySelector('#validation');
|
|
18
|
+
|
|
19
|
+
if (!phoneInput) {
|
|
20
|
+
setTimeout(waitForComponent, 100);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Wait for intl-tel-input to initialize, then focus and blur to trigger validation
|
|
25
|
+
setTimeout(function() {
|
|
26
|
+
phoneInput.focus({ preventScroll: true });
|
|
27
|
+
setTimeout(function() {
|
|
28
|
+
phoneInput.blur();
|
|
29
|
+
}, 100);
|
|
30
|
+
}, 500);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
waitForComponent();
|
|
34
|
+
|
|
35
|
+
// Prevent form submission if there are validation errors
|
|
36
|
+
form.addEventListener('submit', function (e) {
|
|
37
|
+
if (e.target.querySelectorAll('[error]:not([error=""])').length > 0) {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
11
41
|
})
|
|
12
42
|
<% end %>
|
|
@@ -10,8 +10,19 @@ const PhoneNumberInputValidation = (props) => {
|
|
|
10
10
|
const [showFormErrors, setShowFormErrors] = useState(false);
|
|
11
11
|
const [phoneNumber, setPhoneNumber] = useState("");
|
|
12
12
|
const [countryCode, setCountryCode] = useState("af");
|
|
13
|
+
const [isValid, setIsValid] = useState(false);
|
|
14
|
+
const [hasInteracted, setHasInteracted] = useState(false);
|
|
15
|
+
|
|
16
|
+
// Start with initial error - will be cleared on blur if valid
|
|
17
|
+
const initialError = (
|
|
18
|
+
<>
|
|
19
|
+
<Icon icon="warning" /> Missing phone number.
|
|
20
|
+
</>
|
|
21
|
+
);
|
|
13
22
|
|
|
14
23
|
const handleOnValidate = (valid) => {
|
|
24
|
+
setIsValid(valid);
|
|
25
|
+
setHasInteracted(true);
|
|
15
26
|
setFormErrors(
|
|
16
27
|
valid ? "" : "Please correct the fields below and try again."
|
|
17
28
|
);
|
|
@@ -23,18 +34,16 @@ const PhoneNumberInputValidation = (props) => {
|
|
|
23
34
|
};
|
|
24
35
|
|
|
25
36
|
const handleOnSubmit = (e) => {
|
|
26
|
-
if (
|
|
37
|
+
if (!isValid) e.preventDefault()
|
|
27
38
|
}
|
|
28
39
|
|
|
29
40
|
useEffect(() => {
|
|
30
41
|
setShowFormErrors(formErrors.length > 0);
|
|
31
42
|
}, [formErrors]);
|
|
32
43
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
</>
|
|
37
|
-
)
|
|
44
|
+
// Only show error prop initially, or if invalid after interaction
|
|
45
|
+
// Clear error prop once valid (component handles validation on blur)
|
|
46
|
+
const shouldShowError = !hasInteracted || (hasInteracted && !isValid);
|
|
38
47
|
|
|
39
48
|
return (
|
|
40
49
|
<form
|
|
@@ -50,7 +59,7 @@ const PhoneNumberInputValidation = (props) => {
|
|
|
50
59
|
/>
|
|
51
60
|
)}
|
|
52
61
|
<PhoneNumberInput
|
|
53
|
-
error={
|
|
62
|
+
error={shouldShowError ? initialError : undefined}
|
|
54
63
|
id="validation"
|
|
55
64
|
initialCountry={countryCode}
|
|
56
65
|
onChange={handleOnChange}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: playbook_ui_docs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 15.6.0.pre.rc.
|
|
4
|
+
version: 15.6.0.pre.rc.4
|
|
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-12-
|
|
12
|
+
date: 2025-12-04 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: playbook_ui
|
|
@@ -220,6 +220,7 @@ files:
|
|
|
220
220
|
- app/pb_kits/playbook/pb_background/docs/_background_image.md
|
|
221
221
|
- app/pb_kits/playbook/pb_background/docs/_background_light.html.erb
|
|
222
222
|
- app/pb_kits/playbook/pb_background/docs/_background_light.jsx
|
|
223
|
+
- app/pb_kits/playbook/pb_background/docs/_background_light.md
|
|
223
224
|
- app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx
|
|
224
225
|
- app/pb_kits/playbook/pb_background/docs/_background_overlay.md
|
|
225
226
|
- app/pb_kits/playbook/pb_background/docs/_background_size.html.erb
|