playbook_ui_docs 12.24.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown756 → 12.24.0.pre.alpha.play824745
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_date/docs/example.yml +4 -4
- data/app/pb_kits/playbook/pb_date/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb +14 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +60 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_time/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_time/docs/index.js +0 -1
- data/dist/playbook-doc.js +199 -199
- metadata +4 -10
- data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.html.erb +0 -30
- data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +0 -47
- data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.md +0 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick.html.erb +0 -8
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick.jsx +0 -18
- data/app/pb_kits/playbook/pb_time/docs/_time_unstyled.html.erb +0 -37
- data/app/pb_kits/playbook/pb_time/docs/_time_unstyled.jsx +0 -58
- data/app/pb_kits/playbook/pb_time/docs/_time_unstyled.md +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52a2c02ada7d89a73e58cbedaef142d4907534b3085b51b8726f07e1c0d4f1a5
|
4
|
+
data.tar.gz: 9e2066b01463934124325e98d6d967aeaccfdb3fe49598433221b651d8ca8cf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c7aa25bdd4d98e3cf2678be00e1ef1d3db37f16dc633da4a2633ecf53f8eb02f283bc43cad97f48aa5f8a65504b9712a28c620fa4511d3a908e09a226ad3dbe
|
7
|
+
data.tar.gz: a580dcb426e190b669306cb04493575861f23109ff6dea2d1eeb761ae198b544b9833fb8b4dac79299a026913a831c5cdaaa3bafe5b627d77047100b617ebaab
|
@@ -1,14 +1,14 @@
|
|
1
1
|
examples:
|
2
|
-
|
2
|
+
|
3
3
|
rails:
|
4
4
|
- date_default: Default
|
5
5
|
- date_variants: Variants
|
6
6
|
- date_alignment: Alignment
|
7
7
|
- date_timezone: Timezones
|
8
|
-
|
9
|
-
|
8
|
+
|
9
|
+
|
10
10
|
react:
|
11
11
|
- date_default: Default
|
12
12
|
- date_variants: Variants
|
13
13
|
- date_alignment: Alignment
|
14
|
-
|
14
|
+
|
@@ -8,7 +8,6 @@ examples:
|
|
8
8
|
- date_picker_input: Input Field
|
9
9
|
- date_picker_label: Label
|
10
10
|
- date_picker_range: Range
|
11
|
-
- date_picker_quick_pick: Range (Quick Pick)
|
12
11
|
- date_picker_format: Format
|
13
12
|
- date_picker_disabled: Disabled Dates
|
14
13
|
- date_picker_min_max: Min Max
|
@@ -34,7 +33,6 @@ examples:
|
|
34
33
|
- date_picker_on_change: onChange
|
35
34
|
- date_picker_on_close: onClose
|
36
35
|
- date_picker_range: Range
|
37
|
-
- date_picker_quick_pick: Range (Quick Pick)
|
38
36
|
- date_picker_format: Format
|
39
37
|
- date_picker_disabled: Disabled Dates
|
40
38
|
- date_picker_min_max: Min Max
|
@@ -19,5 +19,4 @@ export { default as DatePickerWeek } from './_date_picker_week.jsx'
|
|
19
19
|
export { default as DatePickerPositions } from './_date_picker_positions.jsx'
|
20
20
|
export { default as DatePickerPositionsElement } from './_date_picker_positions_element.jsx'
|
21
21
|
export { default as DatePickerAllowInput } from './_date_picker_allow_input'
|
22
|
-
export { default as
|
23
|
-
export { default as DatePickerOnClose } from './_date_picker_on_close.jsx'
|
22
|
+
export { default as DatePickerOnClose } from './_date_picker_on_close.jsx'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<form id="example-form-validation" action="" method="get">
|
2
|
+
<%= pb_rails("phone_number_input", props: { error: "Missing phone number.", id: "validation", initial_country: "af", value: "", required: true }) %>
|
3
|
+
<%= pb_rails("button", props: {html_type: "submit", text: "Save Phone Number"}) %>
|
4
|
+
</form>
|
5
|
+
|
6
|
+
<% content_for(:pb_js) do %>
|
7
|
+
<%= javascript_tag do %>
|
8
|
+
document.addEventListener('DOMContentLoaded', function () {
|
9
|
+
document.querySelector('#example-form-validation').addEventListener('submit', function (e) {
|
10
|
+
if (e.target.querySelectorAll('[error]:not([error=""])').length > 0) e.preventDefault();
|
11
|
+
})
|
12
|
+
})
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
2
|
+
import { Button, FixedConfirmationToast, PhoneNumberInput } from "../../";
|
3
|
+
|
4
|
+
const PhoneNumberInputValidation = (props) => {
|
5
|
+
const [formErrors, setFormErrors] = useState("");
|
6
|
+
const [showFormErrors, setShowFormErrors] = useState(false);
|
7
|
+
const [phoneNumber, setPhoneNumber] = useState("");
|
8
|
+
const [countryCode, setCountryCode] = useState("af");
|
9
|
+
|
10
|
+
const handleOnValidate = (valid) => {
|
11
|
+
setFormErrors(
|
12
|
+
valid ? "" : "Please correct the fields below and try again."
|
13
|
+
);
|
14
|
+
};
|
15
|
+
|
16
|
+
const handleOnChange = ({ iso2, number }) => {
|
17
|
+
setCountryCode(iso2);
|
18
|
+
setPhoneNumber(number);
|
19
|
+
};
|
20
|
+
|
21
|
+
const handleOnSubmit = (e) => {
|
22
|
+
if (showFormErrors) e.preventDefault()
|
23
|
+
}
|
24
|
+
|
25
|
+
useEffect(() => {
|
26
|
+
setShowFormErrors(formErrors.length > 0);
|
27
|
+
}, [formErrors]);
|
28
|
+
|
29
|
+
return (
|
30
|
+
<form
|
31
|
+
action=""
|
32
|
+
method="get"
|
33
|
+
onSubmit={handleOnSubmit}
|
34
|
+
>
|
35
|
+
{showFormErrors && (
|
36
|
+
<FixedConfirmationToast
|
37
|
+
marginBottom="md"
|
38
|
+
status="error"
|
39
|
+
text={formErrors}
|
40
|
+
/>
|
41
|
+
)}
|
42
|
+
<PhoneNumberInput
|
43
|
+
error="Missing phone number."
|
44
|
+
id="validation"
|
45
|
+
initialCountry={countryCode}
|
46
|
+
onChange={handleOnChange}
|
47
|
+
onValidate={handleOnValidate}
|
48
|
+
required
|
49
|
+
value={phoneNumber}
|
50
|
+
{...props}
|
51
|
+
/>
|
52
|
+
<Button
|
53
|
+
htmlType="submit"
|
54
|
+
text="Save Phone Number"
|
55
|
+
/>
|
56
|
+
</form>
|
57
|
+
);
|
58
|
+
};
|
59
|
+
|
60
|
+
export default PhoneNumberInputValidation;
|
@@ -5,9 +5,11 @@ examples:
|
|
5
5
|
- phone_number_input_preferred_countries: Preferred Countries
|
6
6
|
- phone_number_input_initial_country: Initial Country
|
7
7
|
- phone_number_input_only_countries: Limited Countries
|
8
|
+
- phone_number_input_validation: Form Validation
|
8
9
|
|
9
10
|
rails:
|
10
11
|
- phone_number_input_default: Default
|
11
12
|
- phone_number_input_preferred_countries: Preferred Countries
|
12
13
|
- phone_number_input_initial_country: Initial Country
|
13
|
-
- phone_number_input_only_countries: Limited Countries
|
14
|
+
- phone_number_input_only_countries: Limited Countries
|
15
|
+
- phone_number_input_validation: Form Validation
|
@@ -2,3 +2,4 @@ export { default as PhoneNumberInputDefault } from './_phone_number_input_defaul
|
|
2
2
|
export { default as PhoneNumberInputPreferredCountries } from './_phone_number_input_preferred_countries'
|
3
3
|
export { default as PhoneNumberInputInitialCountry } from './_phone_number_input_initial_country'
|
4
4
|
export { default as PhoneNumberInputOnlyCountries } from './_phone_number_input_only_countries'
|
5
|
+
export { default as PhoneNumberInputValidation } from './_phone_number_input_validation'
|
@@ -6,7 +6,6 @@ examples:
|
|
6
6
|
- time_timestamp: Timestamp Values
|
7
7
|
- time_timezone: Handling Timezones
|
8
8
|
- time_align: Alignment
|
9
|
-
- time_unstyled: Unstyled
|
10
9
|
|
11
10
|
react:
|
12
11
|
- time_default: Default
|
@@ -14,4 +13,3 @@ examples:
|
|
14
13
|
- time_timestamp: Timestamp Values
|
15
14
|
- time_timezone: Handling Timezones
|
16
15
|
- time_align: Alignment
|
17
|
-
- time_unstyled: Unstyled
|
@@ -3,4 +3,3 @@ export { default as TimeSizes } from './_time_sizes.jsx'
|
|
3
3
|
export { default as TimeTimestamp } from './_time_timestamp.jsx'
|
4
4
|
export { default as TimeAlign } from './_time_align.jsx'
|
5
5
|
export { default as TimeTimezone } from './_time_timezone.jsx'
|
6
|
-
export { default as TimeUnstyled } from './_time_unstyled.jsx'
|