playbook_ui_docs 12.24.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown756 → 12.24.0.pre.alpha.play824745

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: d6225c80e9ea2e1261123264578e16b2447f1be58186099f52c6a45a656d55c4
4
- data.tar.gz: a4703e71bbac0e4689611a54777cceddefd5737297d267572062ce60ea498384
3
+ metadata.gz: 52a2c02ada7d89a73e58cbedaef142d4907534b3085b51b8726f07e1c0d4f1a5
4
+ data.tar.gz: 9e2066b01463934124325e98d6d967aeaccfdb3fe49598433221b651d8ca8cf9
5
5
  SHA512:
6
- metadata.gz: eae58736f2a0c22060768c6144d9615376e7f6f8a319c2bc4d371ed5109ccc2d5babba4bb5b4fa1a5feb7285ec758ef99d69b19a689baa112de7d5a3329f95a4
7
- data.tar.gz: 3d8d644d3e1abbd3e518a6ad0eab22c81e3907d32eaa2db8241752d4b911d548b45acf556f325bbe33f467ccefd07d21035fbbd05f41c098c87da42cac2081d2
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
- - date_unstyled: Unstyled
9
-
8
+
9
+
10
10
  react:
11
11
  - date_default: Default
12
12
  - date_variants: Variants
13
13
  - date_alignment: Alignment
14
- - date_unstyled: Unstyled
14
+
@@ -1,4 +1,3 @@
1
1
  export { default as DateDefault } from './_date_default.jsx'
2
2
  export { default as DateVariants } from './_date_variants.jsx'
3
3
  export { default as DateAlignment } from './_date_alignment.jsx'
4
- export { default as DateUnstyled } from './_date_unstyled.jsx'
@@ -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 DatePickerQuickPick } from './_date_picker_quick_pick'
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'