playbook_ui 14.15.0.pre.alpha.play1757pbcontenttag6644 → 14.15.0.pre.alpha.play1757pbcontenttag6658

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: 25ff5600e2cd3a2a2cbf8cc62f9808525e723917087c43deaccd24b13f24a9c7
4
- data.tar.gz: 3b2971651ba2e400caed15ffba7a57cce9fc77f9895959f7ebfc62abb4cf0480
3
+ metadata.gz: 917bb0bba320d982c1407a6c005841b97cf6a0004294a59b85fceb43a1db70c3
4
+ data.tar.gz: 16229f56b7b8758da60c47edb141fe76329760c3a547ffc336169ea399823ebc
5
5
  SHA512:
6
- metadata.gz: a3db49637e913fa76193001c87c90f4b61ac56d8aa083dd4d72d3160425c6a847979579eeb83c70eff4333ec6f6fdb6ebbc3896d01f67ccf1c97c0fe63720376
7
- data.tar.gz: 8f5db8ae630bcfbd58356f1fab9ad1c1766f4138289aba457c0470650d76454a9200b3f2d0585210410fcc5a6619d2e896f0dae02192a0c7f34e4dd6a56c2ee1
6
+ metadata.gz: ff12c3bcc7cf0b6e5238f2d701714f63b46e3111433bee69147d09f2e61b3d25a73616dfdbf0df96e6b9ec7cc88b83587c5437c047b9093dd9fe08cd6436eacf
7
+ data.tar.gz: 006d399e62e79ea2c1ce09e56bd2b3d93ce64a077d55a6f677eee2347d82514f0e00b81c503e051944fe0fffc0708149df8a1631a89e979e0b644ba5ae4b33f7
@@ -25,7 +25,7 @@
25
25
  <%= pb_form_with(scope: :example, url: "", method: :get) do |form| %>
26
26
  <%= form.typeahead :example_typeahead, props: { data: { typeahead_example1: true, user: {} }, label: true, placeholder: "Search for a user" } %>
27
27
  <%= form.text_field :example_text_field, props: { label: true } %>
28
- <%= form.phone_number_field :example_phone_number_field, props: { label: "Example phone field" } %>
28
+ <%= form.phone_number_field :example_phone_number_field, props: { label: "Example phone field", hidden_inputs: true } %>
29
29
  <%= form.email_field :example_email_field, props: { label: true } %>
30
30
  <%= form.number_field :example_number_field, props: { label: true } %>
31
31
  <%= form.search_field :example_search_field, props: { label: true } %>
@@ -24,7 +24,7 @@
24
24
  <%= pb_form_with(scope: :example, method: :get, url: "", validate: true) do |form| %>
25
25
  <%= form.typeahead :example_typeahead_validation, props: { data: { typeahead_example2: true, user: {} }, label: true, placeholder: "Search for a user", required: true, validation: { message: "Please select a user." } } %>
26
26
  <%= form.text_field :example_text_field_validation, props: { label: true, required: true } %>
27
- <%= form.phone_number_field :example_phone_number_field_validation, props: { label: "Example phone field" } %>
27
+ <%= form.phone_number_field :example_phone_number_field_validation, props: { label: "Example phone field", hidden_inputs: true } %>
28
28
  <%= form.email_field :example_email_field_validation, props: { label: true, required: true } %>
29
29
  <%= form.number_field :example_number_field_validation, props: { label: true, required: true } %>
30
30
  <%= form.search_field :example_project_number_validation, props: { label: true, required: true, validation: { pattern: "[0-9]{2}-[0-9]{5}", message: "Please enter a valid project number (example: 33-12345)." } } %>
@@ -23,6 +23,7 @@ type PhoneNumberInputProps = {
23
23
  data?: { [key: string]: string },
24
24
  disabled?: boolean,
25
25
  error?: string,
26
+ hiddenInputs?: boolean,
26
27
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
27
28
  id?: string,
28
29
  initialCountry?: string,
@@ -72,6 +73,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
72
73
  dark = false,
73
74
  data = {},
74
75
  disabled = false,
76
+ hiddenInputs = false,
75
77
  htmlOptions = {},
76
78
  id = "",
77
79
  initialCountry = "",
@@ -243,6 +245,10 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
243
245
  countrySearch: false,
244
246
  fixDropdownWidth: false,
245
247
  formatAsYouType: formatAsYouType,
248
+ hiddenInput: hiddenInputs ? () => ({
249
+ phone: `${name}_full`,
250
+ country: `${name}_country_code`,
251
+ }) : null,
246
252
  })
247
253
 
248
254
  itiRef.current = telInputInit;
@@ -1,3 +1,3 @@
1
1
  <%= pb_rails("phone_number_input", props: {
2
- id: "hello"
2
+ id: "hello",
3
3
  }) %>
@@ -0,0 +1,5 @@
1
+ <%= pb_rails("phone_number_input", props: {
2
+ hidden_inputs: true,
3
+ id: "hidden_inputs",
4
+ name: "hidden_inputs",
5
+ }) %>
@@ -0,0 +1 @@
1
+ The `hidden_inputs` boolean prop generates two hidden input fields, {field_name}_full and {field_name}_country_code. The value passed when the form is submitted contains the full phone number including the country code. Because it requires the submission of a form to function, only use this prop on Rails phone number elements within html form tags `<form>/<form>` or [pb_forms](https://playbook.powerapp.cloud/kits/form). Read the [intl-tel-input](https://intl-tel-input.com/examples/hidden-input.html) docs for more information.
@@ -16,4 +16,6 @@ examples:
16
16
  - phone_number_input_initial_country: Initial Country
17
17
  - phone_number_input_only_countries: Limited Countries
18
18
  - phone_number_input_validation: Form Validation
19
- - phone_number_input_format: Format as You Type
19
+ - phone_number_input_format: Format as You Type
20
+ - phone_number_input_hidden_inputs: Hidden Inputs
21
+
@@ -23,6 +23,8 @@ module Playbook
23
23
  default: ""
24
24
  prop :format_as_you_type, type: Playbook::Props::Boolean,
25
25
  default: false
26
+ prop :hidden_inputs, type: Playbook::Props::Boolean,
27
+ default: false
26
28
 
27
29
  def classname
28
30
  generate_classname("pb_phone_number_input")
@@ -35,6 +37,7 @@ module Playbook
35
37
  disabled: disabled,
36
38
  error: error,
37
39
  formatAsYouType: format_as_you_type,
40
+ hiddenInputs: hidden_inputs,
38
41
  initialCountry: initial_country,
39
42
  label: label,
40
43
  name: name,
@@ -1,2 +1,2 @@
1
- <%= pb_content_tag do %><%= content.presence || object.text %><% end %>
1
+ <%= pb_content_tag(object.tag) do %><%= content.presence || object.text %><% end %>
2
2