playbook_ui 12.26.1.pre.alpha.PLAY860PhoneNumInputOptions836 → 12.26.1.pre.alpha.play716popoverkitcloseonclickissue833

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,6 @@ module Playbook
10
10
  require_relative "builder/form_field_builder"
11
11
  require_relative "builder/select_field"
12
12
  require_relative "builder/typeahead_field"
13
- require_relative "builder/intl_telephone_field"
14
13
 
15
14
  prepend(FormFieldBuilder.new(:email_field, kit_name: "text_input"))
16
15
  prepend(FormFieldBuilder.new(:number_field, kit_name: "text_input"))
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "12.26.1"
5
- VERSION = "12.26.1.pre.alpha.PLAY860PhoneNumInputOptions836"
5
+ VERSION = "12.26.1.pre.alpha.play716popoverkitcloseonclickissue833"
6
6
  end
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: 12.26.1.pre.alpha.PLAY860PhoneNumInputOptions836
4
+ version: 12.26.1.pre.alpha.play716popoverkitcloseonclickissue833
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -1588,10 +1588,6 @@ files:
1588
1588
  - app/pb_kits/playbook/pb_person_contact/person_contact.test.js
1589
1589
  - app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss
1590
1590
  - app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx
1591
- - app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
1592
- - app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.md
1593
- - app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_clear_field.jsx
1594
- - app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_clear_field.md
1595
1591
  - app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.html.erb
1596
1592
  - app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.jsx
1597
1593
  - app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.md
@@ -1604,8 +1600,6 @@ files:
1604
1600
  - app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.html.erb
1605
1601
  - app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.jsx
1606
1602
  - app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.md
1607
- - app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb
1608
- - app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx
1609
1603
  - app/pb_kits/playbook/pb_phone_number_input/docs/example.yml
1610
1604
  - app/pb_kits/playbook/pb_phone_number_input/docs/index.js
1611
1605
  - app/pb_kits/playbook/pb_phone_number_input/phone_number_input.html.erb
@@ -2417,7 +2411,6 @@ files:
2417
2411
  - app/pb_kits/playbook/utilities/flexbox_global_props/_justify_self.scss
2418
2412
  - app/pb_kits/playbook/utilities/flexbox_global_props/_order.scss
2419
2413
  - app/pb_kits/playbook/utilities/globalProps.ts
2420
- - app/pb_kits/playbook/utilities/object.ts
2421
2414
  - app/pb_kits/playbook/utilities/props.ts
2422
2415
  - app/pb_kits/playbook/utilities/test-utils.js
2423
2416
  - app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js
@@ -2456,7 +2449,6 @@ files:
2456
2449
  - lib/playbook/forms/builder/collection_select_field.rb
2457
2450
  - lib/playbook/forms/builder/date_picker_field.rb
2458
2451
  - lib/playbook/forms/builder/form_field_builder.rb
2459
- - lib/playbook/forms/builder/intl_telephone_field.rb
2460
2452
  - lib/playbook/forms/builder/select_field.rb
2461
2453
  - lib/playbook/forms/builder/typeahead_field.rb
2462
2454
  - lib/playbook/justify_content.rb
@@ -1,26 +0,0 @@
1
- import React, { useEffect, useRef } from 'react'
2
- import { Body, PhoneNumberInput } from '../..'
3
-
4
- const PhoneNumberInputAccessInputElement = (props) => {
5
- // 1. Create a ref - this accesses the kit's input element.
6
- const ref = useRef()
7
-
8
- // 2. Add any event listener to ref.current.inputNode() inside a useEffect hook.
9
- useEffect(() => {
10
- ref.current.inputNode().addEventListener("click", () => alert("Clicked!"))
11
- })
12
-
13
- // 3. Pass the ref to the ref prop.
14
- return (
15
- <>
16
- <Body text="Click the input field below:" />
17
- <PhoneNumberInput
18
- id="access-input-element"
19
- ref={ref}
20
- {...props}
21
- />
22
- </>
23
- )
24
- }
25
-
26
- export default PhoneNumberInputAccessInputElement
@@ -1,3 +0,0 @@
1
- To access the kit's input element attributes or add event listeners, create a `ref` inside your parent component, pass it to the kit's `ref` prop, and use `ref.current.inputNode()` with your desired attribute or event listener inside a `useEffect` hook. `useEffect` is necessary because the `ref` will be initially `undefined`.
2
-
3
- `inputNode()` is a custom function inside the kit that returns the input DOM element and its attributes. For example, to get the `name` attribute, use `ref.current.inputNode().name`
@@ -1,30 +0,0 @@
1
- import React, { useRef } from 'react'
2
- import { Button, PhoneNumberInput } from '../..'
3
-
4
- const PhoneNumberInputClearField = (props) => {
5
- // 1. Create a ref - this accesses the kit's input element.
6
- const ref = useRef()
7
-
8
- // 2. Use clearField() to clear the field.
9
- const handleClick = () => {
10
- ref.current.clearField()
11
- }
12
-
13
- // 3. Pass the ref to the ref prop.
14
- return (
15
- <>
16
- <PhoneNumberInput
17
- id="clear-field"
18
- ref={ref}
19
- {...props}
20
- />
21
-
22
- <Button
23
- onClick={handleClick}
24
- text="Clear the Input Field"
25
- />
26
- </>
27
- )
28
- }
29
-
30
- export default PhoneNumberInputClearField
@@ -1,3 +0,0 @@
1
- To clear a number inside the input element, create a `ref` inside your parent component, pass it to the kit's `ref` prop, and use `ref.current.clearField()`.
2
-
3
- `clearField()` is a custom function inside the kit to clear numbers and the error message while still providing validation.
@@ -1,14 +0,0 @@
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 %>
@@ -1,60 +0,0 @@
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;
@@ -1,3 +0,0 @@
1
- /* 🛠️ Any commonly used lodash functions can be added here. 🤙 */
2
-
3
- export const isEmpty = (obj: Record<string, unknown>): boolean => Object.keys(obj).length < 1
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Playbook
4
- module Forms
5
- class Builder
6
- def intl_telephone(name, props: {})
7
- props[:name] = name
8
- @template.pb_rails("phone_number_input", props: props)
9
- end
10
- end
11
- end
12
- end