playbook_ui 14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 → 14.11.1.pre.alpha.play1724darkmodeauditmap5409

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.md +2 -2
  3. data/app/pb_kits/playbook/pb_button/button.html.erb +3 -2
  4. data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +6 -1
  5. data/app/pb_kits/playbook/pb_collapsible/collapsible.html.erb +1 -3
  6. data/app/pb_kits/playbook/pb_collapsible/collapsible.rb +0 -3
  7. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +6 -2
  8. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.md +1 -1
  9. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.html.erb +9 -3
  10. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +0 -1
  11. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +1 -1
  12. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +12 -7
  13. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +14 -9
  14. data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +11 -6
  15. data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +14 -8
  16. data/app/pb_kits/playbook/pb_list/item.html.erb +8 -30
  17. data/app/pb_kits/playbook/pb_list/item.rb +0 -7
  18. data/app/pb_kits/playbook/pb_list/list.html.erb +11 -31
  19. data/app/pb_kits/playbook/pb_list/list.rb +0 -4
  20. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +1 -6
  21. data/app/pb_kits/playbook/pb_map/_map.scss +3 -0
  22. data/app/pb_kits/playbook/pb_map/docs/_map_default.jsx +4 -4
  23. data/app/pb_kits/playbook/pb_map/docs/_map_with_custom_button.jsx +7 -7
  24. data/app/pb_kits/playbook/pb_map/docs/_map_with_plugin.jsx +5 -5
  25. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +12 -30
  26. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +1 -3
  27. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +0 -1
  28. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -3
  29. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +1 -20
  30. data/app/pb_kits/playbook/pb_radio/_radio.scss +8 -12
  31. data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.jsx +3 -8
  32. data/app/pb_kits/playbook/pb_selectable_list/selectable_list.html.erb +3 -17
  33. data/app/pb_kits/playbook/pb_selectable_list/selectable_list.rb +0 -3
  34. data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.html.erb +4 -11
  35. data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.rb +0 -3
  36. data/app/pb_kits/playbook/pb_table/_table.tsx +3 -2
  37. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +2 -2
  38. data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -3
  39. data/app/pb_kits/playbook/pb_table/index.ts +88 -187
  40. data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +0 -12
  41. data/app/pb_kits/playbook/pb_table/table.html.erb +1 -1
  42. data/app/pb_kits/playbook/pb_table/table.rb +2 -17
  43. data/app/pb_kits/playbook/pb_table/table_row.html.erb +1 -20
  44. data/app/pb_kits/playbook/pb_table/table_row.rb +0 -5
  45. data/app/pb_kits/playbook/pb_timeline/_timeline.scss +30 -30
  46. data/dist/chunks/{_typeahead-DjGX1O4K.js → _typeahead-BNULwihE.js} +2 -2
  47. data/dist/chunks/_weekday_stacked-BKWemDAe.js +45 -0
  48. data/dist/chunks/{lib-kMuhBuU7.js → lib-B7sgJtGS.js} +2 -2
  49. data/dist/chunks/{pb_form_validation-DBJ0wZuS.js → pb_form_validation-C5Cc0-1v.js} +1 -1
  50. data/dist/chunks/vendor.js +1 -1
  51. data/dist/playbook-doc.js +1 -1
  52. data/dist/playbook-rails-react-bindings.js +1 -1
  53. data/dist/playbook-rails.js +1 -1
  54. data/dist/playbook.css +1 -1
  55. data/lib/playbook/version.rb +1 -1
  56. metadata +7 -34
  57. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.md +0 -5
  58. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.html.erb +0 -38
  59. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.md +0 -3
  60. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.html.erb +0 -15
  61. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.jsx +0 -24
  62. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.md +0 -1
  63. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.html.erb +0 -74
  64. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_rails.md +0 -3
  65. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.html.erb +0 -74
  66. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_rails.md +0 -3
  67. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.html.erb +0 -47
  68. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_rails.md +0 -2
  69. data/app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts +0 -22
  70. data/dist/chunks/_weekday_stacked-s8bX_aFg.js +0 -45
  71. /data/app/pb_kits/playbook/pb_table/docs/{_table_with_collapsible_react.md → _table_with_collapsible.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a968d08aaa4af48a9fac9eb0fc5191c8d738b7fd5a6514064cc864a25a1e283
4
- data.tar.gz: af0da5b80ce2adb3d94a96caf5d5ed489d35a01f5b15e00a50eb6691ab9f95ff
3
+ metadata.gz: e83117499bb2e6cbb6cea842eca16b0ccb5e6275695a2d26de0f256d23c04071
4
+ data.tar.gz: 9b69eec065deee4a74d8b98ae4042152ee5662ce230cdcd8d73772a77cb48c5c
5
5
  SHA512:
6
- metadata.gz: 42767c7d834ab7d1da43a081d310276dd141f23a53a9ad1a6cb48c52f57f713e802d2e490e6956ecfe6f835b10fe3bf54d953d406fd1054c05e40d55fec12b24
7
- data.tar.gz: c37bd39bfbbfcafa7905258522be6c18c9d96734530a99ae7467c6a2bc427f1cca041b3efdfee89352fc99cc0d51b9fe8e6d7b96da65ec5872bbe3f3feab3bbc
6
+ metadata.gz: ae9fb865c35f071e2a77222453f19650f0c7de2ddae2cdd3560d1404a17ea90bbbea8c57223d17ee5e87b86561ecf65b5041546433a9d105f10ce615ae110f4f
7
+ data.tar.gz: a9c422d27b2373459e97a812436a86c7c91b499afc91429ca445606187e4dd2a658573936a119178b5ca41c9d462f062ea97ab16aa8bbad3bdb212fdad303447
@@ -1,3 +1,3 @@
1
- `sortControl` is an optional prop that can be used to gain greater control over the sort state of the Advanced Table. Tanstack handles sort itself, however it does provide for a way to handle the state manually if needed. Usecases for this include needing to store the sort state so it persists on page reload, set an initial sort state, etc.
1
+ `sortControl` is an optional prop that can be used to gain greater control over the sort state of the Advanced Table. Tanstack handles sort itself, however it does provide for a way to handle the state manually if needed. Usecases for this include needing to store the sort state so it persists on page reload, set an initial sort state, etc.
2
2
 
3
- The sort state must be an object with a single key/value pair, with the key being "desc" and the value being a boolean. The default for sort direction is `desc: true`.
3
+ The sort state must be an object with a single key/value pair, with the key being "desc" and the value being a boolean. The default for sort directino is `desc: true`.
@@ -1,5 +1,6 @@
1
- <%= pb_content_tag(object.tag,
2
- object.tag == "button" ? object.options : object.link_options) do %>
1
+ <%= content_tag(object.tag,
2
+ object.tag == "button" ? object.options : object.link_options,
3
+ **combined_html_options) do %>
3
4
  <% if object.variant === "reaction" %>
4
5
  <% if icon && object.valid_emoji(object.icon) %>
5
6
  <%= pb_rails("flex", props:{ align: "center" }) do %>
@@ -1,4 +1,9 @@
1
- <%= pb_content_tag(:label) do %>
1
+ <%= content_tag(:label, aria: object.aria,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ **combined_html_options
6
+ ) do %>
2
7
  <%= content.presence || object.input %>
3
8
  <% if object.indeterminate %>
4
9
  <span data-pb-checkbox-icon-span="true" class="pb_checkbox_indeterminate">
@@ -1,5 +1,3 @@
1
- <%= pb_content_tag(
2
- object.tag
3
- ) do %>
1
+ <%= pb_content_tag do %>
4
2
  <%= content.presence %>
5
3
  <% end %>
@@ -3,9 +3,6 @@
3
3
  module Playbook
4
4
  module PbCollapsible
5
5
  class Collapsible < Playbook::KitBase
6
- prop :tag, type: Playbook::Props::Enum,
7
- values: %w[h1 h2 h3 h4 h5 h6 p div span tr th td thead col],
8
- default: "div"
9
6
  def classname
10
7
  generate_classname("pb_collapsible_kit")
11
8
  end
@@ -1,5 +1,9 @@
1
- <%= pb_content_tag(:div,
2
- class: object.classname + object.error_class) do %>
1
+ <%= content_tag(:div,
2
+ aria: object.aria,
3
+ class: object.classname + object.error_class,
4
+ data: object.data,
5
+ id: object.id,
6
+ **combined_html_options) do %>
3
7
  <div class="input_wrapper">
4
8
  <% if content.present? %>
5
9
  <%= content %>
@@ -2,4 +2,4 @@ The `defaultDate`/`default_date` prop has a null or empty string value by defaul
2
2
 
3
3
  If you use a Date object without UTC time standardization the Date Picker kit may misinterpret that date as yesterdays date (consequence of timezone differentials and the Javascript Date Object constructor). See [this GitHub issue for more information](https://github.com/powerhome/playbook/issues/1167) and the anti-pattern examples below.
4
4
 
5
- You can leverage the `defaultDate`/`default_date` prop with custom logic in your filter or controller files where the determination of the default value changes based on user interaction. The page can load with an initial default date picker value or placeholder text, then after filter submission save the submitted values as the "new default" (via state or params).
5
+
@@ -6,8 +6,14 @@
6
6
 
7
7
  ] %>
8
8
 
9
- <%= pb_rails("list", props: { enable_drag: true, items: initial_items }) do %>
10
- <% initial_items.each do |item| %>
11
- <%= pb_rails("list/item", props:{drag_id: item[:id]}) do %><%= item[:name] %><% end %>
9
+ <%= pb_rails("draggable", props: {initial_items: initial_items}) do %>
10
+ <%= pb_rails("draggable/draggable_container") do %>
11
+ <%= pb_rails("list", props: {ordered: false}) do %>
12
+ <% initial_items.each do |item| %>
13
+ <%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id]}) do %>
14
+ <%= pb_rails("list/item") do %><%= item[:name] %><% end %>
15
+ <% end %>
16
+ <% end %>
17
+ <% end %>
12
18
  <% end %>
13
19
  <% end %>
@@ -11,7 +11,6 @@ examples:
11
11
  rails:
12
12
  - draggable_default_rails: Default
13
13
  - draggable_with_list_rails: Draggable with List Kit
14
- - draggable_with_selectable_list_rails: Draggable with SelectableList Kit
15
14
  - draggable_with_cards_rails: Draggable with Cards
16
15
 
17
16
 
@@ -1 +1 @@
1
- For the `subtle` variant, it is recommended that you set the `Separators` prop to `false` to remove the separator lines between the options for a cleaner look.
1
+ For the `subtle` variant, it is recommended that you set the `Separators` prop to `false` to remove the separator lines between the options for a more cleaner look.
@@ -1,14 +1,19 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.id,
6
+ **combined_html_options) do %>
2
7
  <% if object.label.present? %>
3
8
  <%= pb_rails("caption", props: {text: object.label, margin_bottom:"xs"}) %>
4
9
  <% end %>
5
10
  <div class="dropdown_wrapper<%= error_class %>" style="position: relative">
6
- <input
7
- data-default-value="<%= input_default_value %>"
8
- id="dropdown-selected-option"
9
- name="<%= object.name %>"
10
- style="display: none"
11
- <%= object.required ? "required" : ""%>
11
+ <input
12
+ data-default-value="<%= input_default_value %>"
13
+ id="dropdown-selected-option"
14
+ name="<%= object.name %>"
15
+ style="display: none"
16
+ <%= object.required ? "required" : ""%>
12
17
  />
13
18
  <% if content.present? %>
14
19
  <%= content.presence %>
@@ -1,15 +1,20 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.id,
6
+ **combined_html_options) do %>
2
7
  <%= pb_rails("list", props: {ordered: false, borderless: false}) do %>
3
- <% if content.present? %>
8
+ <% if content.present? %>
4
9
  <%= content.presence %>
5
- <% else %>
10
+ <% else %>
6
11
  <%= pb_rails("list/item", props: {
7
- display: "flex",
8
- justify_content: "center",
9
- padding:"xs",
10
- }) do %>
12
+ display: "flex",
13
+ justify_content: "center",
14
+ padding:"xs",
15
+ }) do %>
11
16
  <%= pb_rails("body", props: {text: "No option"}) %>
12
17
  <% end %>
13
18
  <% end %>
14
- <% end %>
15
- <% end %>
19
+ <% end %>
20
+ <% end %>
@@ -1,10 +1,15 @@
1
- <%= pb_content_tag(:div, id: object.option[:id]) do %>
1
+ <%= content_tag(:div,
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.option[:id],
6
+ **combined_html_options) do %>
2
7
  <%= pb_rails("list/item", props: {
3
- display: "flex",
4
- justify_content: "center",
5
- padding:"none",
8
+ display: "flex",
9
+ justify_content: "center",
10
+ padding:"none",
6
11
  cursor: "pointer"
7
- }) do %>
12
+ }) do %>
8
13
  <div class="dropdown_option_wrapper">
9
14
  <% if content.present? %>
10
15
  <%= content.presence %>
@@ -13,4 +18,4 @@
13
18
  <% end %>
14
19
  </div>
15
20
  <% end %>
16
- <% end %>
21
+ <% end %>
@@ -1,16 +1,21 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.id,
6
+ **combined_html_options) do %>
2
7
  <% if content.present? %>
3
8
  <div style="display: inline-block" tabindex="0" data-dropdown-custom-trigger>
4
9
  <%= content.presence %>
5
10
  </div>
6
11
  <% else %>
7
12
  <%= pb_rails("flex", props: {
8
- align: "center",
9
- border_radius:"lg",
10
- classname: object.trigger_wrapper_classes,
11
- cursor: "pointer",
12
- justify: "between",
13
- padding_x:"sm",
13
+ align: "center",
14
+ border_radius:"lg",
15
+ classname: object.trigger_wrapper_classes,
16
+ cursor: "pointer",
17
+ justify: "between",
18
+ padding_x:"sm",
14
19
  padding_y:"xs",
15
20
  html_options: {tabindex:"0"}
16
21
  }) do %>
@@ -18,7 +23,7 @@
18
23
  <%= pb_rails("flex", props: {align: "center"}) do %>
19
24
  <% if object.custom_display.present? %>
20
25
  <%= pb_rails("flex", props: {align: "center"}) do %>
21
- <div id="dropdown_trigger_custom_display" style="display: none;">
26
+ <div id="dropdown_trigger_custom_display" style="display: none;">
22
27
  <%= object.custom_display %>
23
28
  </div>
24
29
  <%= pb_rails("body", props: {text: object.default_display_placeholder, id: "dropdown_trigger_display"}) %>
@@ -35,3 +40,4 @@
35
40
  <% end %>
36
41
  <% end %>
37
42
  <% end %>
43
+
@@ -1,32 +1,10 @@
1
- <% if object.draggable? %>
2
- <%= pb_rails("draggable/draggable_item", props:{drag_id: object.drag_id}) do %>
3
- <%= content_tag(:li,
4
- aria: object.aria,
5
- class: object.classname,
6
- data: object.data,
7
- id: object.id,
8
- tabindex: object.tabindex,
9
- **combined_html_options
10
- ) do %>
11
- <% if object.drag_handle %>
12
- <span style="vertical-align: middle;">
13
- <%= pb_rails("body") do %>
14
- <svg width="auto" height="auto" viewBox="0 0 31 25" fill="none" xmlns="http://www.w3.org/2000/svg" color="currentColor" class="pb_custom_icon svg-inline--fa vertical_align_middle svg_fw"><path d="M12.904 6.355a1.48 1.48 0 01-1.5-1.5c0-.796.656-1.5 1.5-1.5.797 0 1.5.704 1.5 1.5 0 .844-.703 1.5-1.5 1.5zm0 7.5a1.48 1.48 0 01-1.5-1.5c0-.796.656-1.5 1.5-1.5.797 0 1.5.704 1.5 1.5 0 .844-.703 1.5-1.5 1.5zm1.5 6c0 .844-.703 1.5-1.5 1.5a1.48 1.48 0 01-1.5-1.5c0-.796.656-1.5 1.5-1.5.797 0 1.5.704 1.5 1.5zm4.5-13.5a1.48 1.48 0 01-1.5-1.5c0-.796.657-1.5 1.5-1.5.797 0 1.5.704 1.5 1.5 0 .844-.703 1.5-1.5 1.5zm1.5 6c0 .844-.703 1.5-1.5 1.5a1.48 1.48 0 01-1.5-1.5c0-.796.657-1.5 1.5-1.5.797 0 1.5.704 1.5 1.5zm-1.5 9a1.48 1.48 0 01-1.5-1.5c0-.796.657-1.5 1.5-1.5.797 0 1.5.704 1.5 1.5 0 .844-.703 1.5-1.5 1.5z" fill="#242B42"></path></svg>
15
- <% end %>
16
- </span>
17
- <% end %>
18
- <%= content.presence %>
19
- <% end %>
20
- <% end %>
21
- <% else %>
22
- <%= content_tag(:li,
23
- aria: object.aria,
24
- class: object.classname,
25
- data: object.data,
26
- id: object.id,
27
- tabindex: object.tabindex,
28
- **combined_html_options
29
- ) do %>
1
+ <%= content_tag(:li,
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.id,
6
+ tabindex: object.tabindex,
7
+ **combined_html_options
8
+ ) do %>
30
9
  <%= content.presence %>
31
- <% end %>
32
10
  <% end %>
@@ -3,18 +3,11 @@
3
3
  module Playbook
4
4
  module PbList
5
5
  class Item < Playbook::KitBase
6
- prop :drag_handle, type: Playbook::Props::Boolean,
7
- default: true
8
- prop :drag_id, type: Playbook::Props::String
9
6
  prop :tabindex
10
7
 
11
8
  def classname
12
9
  generate_classname("pb_item_kit")
13
10
  end
14
-
15
- def draggable?
16
- drag_id.present?
17
- end
18
11
  end
19
12
  end
20
13
  end
@@ -1,33 +1,13 @@
1
- <% if object.enable_drag %>
2
- <%= pb_rails("draggable", props: {initial_items: object.items}) do %>
3
- <%= pb_rails("draggable/draggable_container") do %>
4
- <%= content_tag(:div, class: object.list_classname) do %>
5
- <%= content_tag(:"#{object.ordered_class}",
6
- aria: object.aria,
7
- class: object.classname,
8
- data: object.data,
9
- id: object.id,
10
- role: object.role,
11
- tabindex: object.tabindex,
12
- **combined_html_options
13
- ) do %>
14
- <%= content.presence %>
15
- <% end %>
16
- <% end %>
17
- <% end %>
18
- <% end %>
19
- <% else %>
20
- <%= content_tag(:div, class: object.list_classname) do %>
21
- <%= content_tag(:"#{object.ordered_class}",
22
- aria: object.aria,
23
- class: object.classname,
24
- data: object.data,
25
- id: object.id,
26
- role: object.role,
27
- tabindex: object.tabindex,
28
- **combined_html_options
29
- ) do %>
30
- <%= content.presence %>
31
- <% end %>
1
+ <%= content_tag(:div, class: object.list_classname) do %>
2
+ <%= content_tag(:"#{object.ordered_class}",
3
+ aria: object.aria,
4
+ class: object.classname,
5
+ data: object.data,
6
+ id: object.id,
7
+ role: object.role,
8
+ tabindex: object.tabindex,
9
+ **combined_html_options
10
+ ) do %>
11
+ <%= content.presence %>
32
12
  <% end %>
33
13
  <% end %>
@@ -7,10 +7,6 @@ module Playbook
7
7
  default: false
8
8
  prop :dark, type: Playbook::Props::Boolean,
9
9
  default: false
10
- prop :enable_drag, type: Playbook::Props::Boolean,
11
- default: false
12
- prop :items, type: Playbook::Props::Array,
13
- default: []
14
10
  prop :layout, type: Playbook::Props::Enum,
15
11
  values: ["left", "right", ""],
16
12
  default: ""
@@ -12,7 +12,6 @@ type LoadingInlineProps = {
12
12
  aria?: { [key: string]: string },
13
13
  className?: string,
14
14
  data?: { [key: string]: string },
15
- dark?: boolean,
16
15
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
17
16
  id?: string,
18
17
  text?: string,
@@ -24,7 +23,6 @@ const LoadingInline = (props: LoadingInlineProps) => {
24
23
  aria = {},
25
24
  className,
26
25
  data = {},
27
- dark = false,
28
26
  htmlOptions = {},
29
27
  id,
30
28
  text = ' Loading',
@@ -47,10 +45,7 @@ const LoadingInline = (props: LoadingInlineProps) => {
47
45
  className={classes}
48
46
  id={id}
49
47
  >
50
- <Body
51
- color="light"
52
- dark={dark}
53
- >
48
+ <Body color="light">
54
49
  <Icon
55
50
  aria={{ label: 'loading icon' }}
56
51
  fixedWidth
@@ -3,6 +3,7 @@
3
3
  @import "../tokens/shadows";
4
4
  @import "../tokens/border_radius";
5
5
  @import "./_pb_map_button_mixin.scss";
6
+ @import "../tokens/titles";
6
7
 
7
8
  [class*="pb_map"] {
8
9
  .pb_map-custom-button {
@@ -159,6 +160,7 @@
159
160
  }
160
161
 
161
162
  .maplibregl-popup-content {
163
+ @include pb_title_4;
162
164
  padding: $space_sm;
163
165
  background-color: $card_light;
164
166
  box-shadow: $shadow_deeper;
@@ -194,6 +196,7 @@
194
196
  }
195
197
 
196
198
  .maplibregl-popup-content {
199
+ @include pb_title_4;
197
200
  background-color: $bg_dark;
198
201
  color: $text_dk_default;
199
202
  }
@@ -25,12 +25,12 @@ const MapDefault = (props) => {
25
25
  new maplibregl.Marker({
26
26
  color: mapTheme.marker,
27
27
  }).setLngLat(defaultPosition)
28
- .setPopup(new maplibregl.Popup({closeButton: false}).setHTML(`<h4 class="pb_title_kit_size_4">Hello World!</h4>`)) // add popup
28
+ .setPopup(new maplibregl.Popup({closeButton: false}).setHTML('Hello World!')) // add popup
29
29
  .addTo(map);
30
30
 
31
31
  // disable map zoom when using scroll
32
32
  map.scrollZoom.disable();
33
-
33
+
34
34
  //add attributioncontrols
35
35
  map.addControl(new maplibregl.AttributionControl({
36
36
  compact: true
@@ -49,7 +49,7 @@ const MapDefault = (props) => {
49
49
 
50
50
  }, [])
51
51
 
52
- return (
52
+ return (
53
53
  <Map flyTo
54
54
  flyToClick={()=> {handleFlyTo(mapInstance)}}
55
55
  zoomBtns
@@ -63,7 +63,7 @@ return (
63
63
  position: 'absolute',
64
64
  left: 0,
65
65
  right: 0,
66
- top: 0,
66
+ top: 0,
67
67
  bottom: 0,
68
68
  }}
69
69
  />
@@ -25,12 +25,12 @@ const MapWithCustomButton = (props) => {
25
25
  new maplibregl.Marker({
26
26
  color: mapTheme.marker,
27
27
  }).setLngLat(defaultPosition)
28
- .setPopup(new maplibregl.Popup({closeButton: false}).setHTML(`<h4 class="pb_title_kit_size_4">Hello World!</h4>`)) // add popup
28
+ .setPopup(new maplibregl.Popup({closeButton: false}).setHTML('Hello World!')) // add popup
29
29
  .addTo(map);
30
30
 
31
31
  // disable map zoom when using scroll
32
32
  map.scrollZoom.disable();
33
-
33
+
34
34
  //add attributioncontrols
35
35
  map.addControl(new maplibregl.AttributionControl({
36
36
  compact: true
@@ -49,8 +49,8 @@ const MapWithCustomButton = (props) => {
49
49
 
50
50
  }, [])
51
51
 
52
- return (
53
- <Map
52
+ return (
53
+ <Map
54
54
  {...props}
55
55
  >
56
56
  <Map.Controls flyTo
@@ -59,10 +59,10 @@ return (
59
59
  zoomInClick={() => {handleZoomIn(mapInstance)}}
60
60
  zoomOutClick={()=> {handleZoomOut(mapInstance)}}
61
61
  >
62
- <MapCustomButton icon="home"
62
+ <MapCustomButton icon="home"
63
63
  onClick={() => alert("button clicked!")}
64
64
  />
65
- <MapCustomButton icon="search"
65
+ <MapCustomButton icon="search"
66
66
  onClick={() => alert("button clicked!")}
67
67
  />
68
68
  </Map.Controls>
@@ -72,7 +72,7 @@ return (
72
72
  position: 'absolute',
73
73
  left: 0,
74
74
  right: 0,
75
- top: 0,
75
+ top: 0,
76
76
  bottom: 0,
77
77
  }}
78
78
  />
@@ -25,7 +25,7 @@ const MapWithPlugin = (props) => {
25
25
  new maplibregl.Marker({
26
26
  color: mapTheme.marker,
27
27
  }).setLngLat(defaultPosition)
28
- .setPopup(new maplibregl.Popup({className: 'map_popup', closeButton: false}).setHTML(`<h4 class="pb_title_kit_size_4">Hello World!</h4>`)) // add popup
28
+ .setPopup(new maplibregl.Popup({className: 'map_popup', closeButton: false}).setHTML('Hello World!')) // add popup
29
29
  .addTo(map);
30
30
 
31
31
  //add maplibre default zoom controls
@@ -48,7 +48,7 @@ const MapWithPlugin = (props) => {
48
48
  map.addControl(new maplibregl.AttributionControl({
49
49
  compact: true
50
50
  }));
51
-
51
+
52
52
  //set map instance
53
53
  setMapInstance(map)
54
54
  }
@@ -62,8 +62,8 @@ const MapWithPlugin = (props) => {
62
62
  }, [])
63
63
 
64
64
 
65
-
66
- return (
65
+
66
+ return (
67
67
  <Map flyTo
68
68
  flyToClick={()=> {handleFlyTo(mapInstance)}}
69
69
  zoomBtns
@@ -77,7 +77,7 @@ return (
77
77
  position: 'absolute',
78
78
  left: 0,
79
79
  right: 0,
80
- top: 0,
80
+ top: 0,
81
81
  bottom: 0,
82
82
  }}
83
83
  />
@@ -35,7 +35,6 @@ type PhoneNumberInputProps = {
35
35
  preferredCountries?: string[],
36
36
  required?: boolean,
37
37
  value?: string,
38
- formatAsYouType?: boolean,
39
38
  }
40
39
 
41
40
  enum ValidationError {
@@ -88,7 +87,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
88
87
  required = false,
89
88
  preferredCountries = [],
90
89
  value = "",
91
- formatAsYouType = false,
92
90
  } = props
93
91
 
94
92
  const ariaProps = buildAriaProps(aria)
@@ -101,8 +99,8 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
101
99
  )
102
100
 
103
101
  const inputRef = useRef<HTMLInputElement>()
104
- const itiRef = useRef<any>(null);
105
102
  const [inputValue, setInputValue] = useState(value)
103
+ const [itiInit, setItiInit] = useState<any>()
106
104
  const [error, setError] = useState(props.error)
107
105
  const [dropDownIsOpen, setDropDownIsOpen] = useState(false)
108
106
  const [selectedData, setSelectedData] = useState()
@@ -132,12 +130,8 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
132
130
  }
133
131
  })
134
132
 
135
- const unformatNumber = (formattedNumber: any) => {
136
- return formattedNumber.replace(/\D/g, "")
137
- }
138
-
139
133
  const showFormattedError = (reason = '') => {
140
- const countryName = itiRef.current.getSelectedCountryData().name
134
+ const countryName = itiInit.getSelectedCountryData().name
141
135
  const reasonText = reason.length > 0 ? ` (${reason})` : ''
142
136
  setError(`Invalid ${countryName} phone number${reasonText}`)
143
137
  return true
@@ -195,12 +189,12 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
195
189
  }
196
190
 
197
191
  const validateErrors = () => {
198
- if (itiRef.current) isValid(itiRef.current.isValidNumber())
199
- if (validateOnlyNumbers(itiRef.current)) return
200
- if (validateTooLongNumber(itiRef.current)) return
201
- if (validateTooShortNumber(itiRef.current)) return
202
- if (validateUnhandledError(itiRef.current)) return
203
- if (validateMissingAreaCode(itiRef.current)) return
192
+ if (itiInit) isValid(itiInit.isValidNumber())
193
+ if (validateOnlyNumbers(itiInit)) return
194
+ if (validateTooLongNumber(itiInit)) return
195
+ if (validateTooShortNumber(itiInit)) return
196
+ if (validateUnhandledError(itiInit)) return
197
+ if (validateMissingAreaCode(itiInit)) return
204
198
  }
205
199
 
206
200
  const getCurrentSelectedData = (itiInit: any, inputValue: string) => {
@@ -209,16 +203,10 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
209
203
 
210
204
  const handleOnChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
211
205
  setInputValue(evt.target.value)
212
- let phoneNumberData
213
- if (formatAsYouType) {
214
- const formattedPhoneNumberData = getCurrentSelectedData(itiRef.current, evt.target.value)
215
- phoneNumberData = {...formattedPhoneNumberData, number: unformatNumber(formattedPhoneNumberData.number)}
216
- } else {
217
- phoneNumberData = getCurrentSelectedData(itiRef.current, evt.target.value)
218
- }
206
+ const phoneNumberData = getCurrentSelectedData(itiInit, evt.target.value)
219
207
  setSelectedData(phoneNumberData)
220
208
  onChange(phoneNumberData)
221
- isValid(itiRef.current.isValidNumber())
209
+ isValid(itiInit.isValidNumber())
222
210
  }
223
211
 
224
212
  // Separating Concerns as React Docs Recommend
@@ -242,11 +230,9 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
242
230
  onlyCountries,
243
231
  countrySearch: false,
244
232
  fixDropdownWidth: false,
245
- formatAsYouType: formatAsYouType,
233
+ formatAsYouType: false,
246
234
  })
247
235
 
248
- itiRef.current = telInputInit;
249
-
250
236
  inputRef.current.addEventListener("countrychange", (evt: Event) => {
251
237
  const phoneNumberData = getCurrentSelectedData(telInputInit, (evt.target as HTMLInputElement).value)
252
238
  setSelectedData(phoneNumberData)
@@ -257,11 +243,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
257
243
  inputRef.current.addEventListener("open:countrydropdown", () => setDropDownIsOpen(true))
258
244
  inputRef.current.addEventListener("close:countrydropdown", () => setDropDownIsOpen(false))
259
245
 
260
- if (formatAsYouType) {
261
- inputRef.current?.addEventListener("input", (evt) => {
262
- handleOnChange(evt as unknown as React.ChangeEvent<HTMLInputElement>);
263
- });
264
- }
246
+ setItiInit(telInputInit)
265
247
  }, [])
266
248
 
267
249
  let textInputProps: {[key: string]: any} = {
@@ -8,12 +8,10 @@ examples:
8
8
  - phone_number_input_validation: Form Validation
9
9
  - phone_number_input_clear_field: Clearing the Input Field
10
10
  - phone_number_input_access_input_element: Accessing the Input Element
11
- - phone_number_input_format: Format as You Type
12
11
 
13
12
  rails:
14
13
  - phone_number_input_default: Default
15
14
  - phone_number_input_preferred_countries: Preferred Countries
16
15
  - phone_number_input_initial_country: Initial Country
17
16
  - phone_number_input_only_countries: Limited Countries
18
- - phone_number_input_validation: Form Validation
19
- - phone_number_input_format: Format as You Type
17
+ - phone_number_input_validation: Form Validation