playbook_ui 14.11.0 → 14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5392

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +2 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +33 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +1 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
  7. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.scss +9 -11
  8. data/app/pb_kits/playbook/pb_badge/_badge.scss +2 -4
  9. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.scss +1 -3
  10. data/app/pb_kits/playbook/pb_button/_button.scss +1 -3
  11. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +2 -4
  12. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_input_styles.scss +1 -3
  13. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_overrides.scss +3 -5
  14. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.scss +4 -6
  15. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss +2 -4
  16. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.html.erb +38 -0
  17. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.md +3 -0
  18. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +1 -0
  19. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +8 -10
  20. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +4 -6
  21. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss +1 -3
  22. data/app/pb_kits/playbook/pb_label_value/_label_value.scss +2 -4
  23. data/app/pb_kits/playbook/pb_message/_message_mixins.scss +1 -3
  24. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +1 -3
  25. data/app/pb_kits/playbook/pb_passphrase/_passphrase.scss +3 -5
  26. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +8 -10
  27. data/app/pb_kits/playbook/pb_pill/_pill.scss +2 -4
  28. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.scss +2 -4
  29. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.scss +2 -4
  30. data/app/pb_kits/playbook/pb_select/_select.scss +3 -5
  31. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +3 -5
  32. data/app/pb_kits/playbook/pb_selectable_list/selectable_list.html.erb +17 -3
  33. data/app/pb_kits/playbook/pb_selectable_list/selectable_list.rb +3 -0
  34. data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.html.erb +11 -4
  35. data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.rb +3 -0
  36. data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +6 -5
  37. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -3
  38. data/app/pb_kits/playbook/pb_textarea/_textarea.scss +1 -3
  39. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.scss +4 -5
  40. data/app/pb_kits/playbook/pb_timeline/_timeline.scss +2 -4
  41. data/app/pb_kits/playbook/pb_toggle/_toggle.scss +3 -5
  42. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -2
  43. data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +12 -4
  44. data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +5 -1
  45. data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +8 -3
  46. data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +6 -1
  47. data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +21 -6
  48. data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +13 -6
  49. data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +7 -3
  50. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +2 -0
  51. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +4 -2
  52. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +5 -5
  53. data/dist/chunks/{_typeahead-C2iCBqxQ.js → _typeahead-BNULwihE.js} +1 -1
  54. data/dist/chunks/{_weekday_stacked-E-5KcEkc.js → _weekday_stacked-BKWemDAe.js} +1 -1
  55. data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
  56. data/dist/chunks/vendor.js +1 -1
  57. data/dist/playbook-doc.js +1 -1
  58. data/dist/playbook-rails-react-bindings.js +1 -1
  59. data/dist/playbook-rails.js +1 -1
  60. data/dist/playbook.css +1 -1
  61. data/lib/playbook/version.rb +2 -2
  62. metadata +10 -6
  63. data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
  64. /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_table_props.md → _advanced_table_table_props_react.md} +0 -0
@@ -1,5 +1,3 @@
1
- @use "sass:math";
2
-
3
1
  @import "../pb_textarea/textarea_mixin";
4
2
  @import "../pb_button/_button_mixins";
5
3
  @import "../tokens/border_radius";
@@ -96,7 +94,7 @@
96
94
  .trix-button--icon {
97
95
  height: $space_lg;
98
96
  width: $space_lg;
99
- margin: math.div($space_xs, 2);
97
+ margin: $space_xs / 2;
100
98
  border-radius: $border_rad_heavier;
101
99
  &::before {
102
100
  background-size: auto;
@@ -106,7 +104,7 @@
106
104
  background: $white;
107
105
  border: 1px solid #E4E8F0;
108
106
  border-bottom: none;
109
- padding: math.div($space_xs, 2);
107
+ padding: $space_xs / 2;
110
108
  border-top-left-radius: $border_rad_heavier;
111
109
  border-top-right-radius: $border_rad_heavier;
112
110
  .trix-button-group {
@@ -1,5 +1,3 @@
1
- @use "sass:math";
2
-
3
1
  @import "../pb_body/body_mixins";
4
2
  @import "../pb_textarea/textarea_mixin";
5
3
  @import "../tokens/titles";
@@ -83,7 +81,7 @@
83
81
  display: block;
84
82
  &.error {
85
83
  [class*=pb_body_kit] {
86
- margin-top: math.div($space_xs, 2);
84
+ margin-top: $space_xs / 2;
87
85
  }
88
86
  > select:first-child {
89
87
  border-color: $error;
@@ -135,7 +133,7 @@
135
133
  box-shadow: none;
136
134
  border-color: transparent;
137
135
  padding: 4px 8px;
138
- padding-right: $space_lg;
136
+ padding-right: $space_lg;
139
137
  border-radius: 4px;
140
138
  option {
141
139
  background-color: $white;
@@ -242,7 +240,7 @@
242
240
  border-color: transparent;
243
241
  background: transparent;
244
242
  padding: 4px 8px;
245
- padding-right: $space_lg;
243
+ padding-right: $space_lg;
246
244
  border-radius: 4px;
247
245
  option {
248
246
  background-color: $white;
@@ -1,5 +1,3 @@
1
- @use "sass:math";
2
-
3
1
  @import "../tokens/animation-curves";
4
2
  @import "../tokens/colors";
5
3
  @import "../tokens/opacity";
@@ -62,7 +60,7 @@ $pb_selectable_paddings: (
62
60
  align-items: center;
63
61
  height: $pb_selectable_card_indicator_size;
64
62
  width: $pb_selectable_card_indicator_size;
65
- border-radius: (math.div($pb_selectable_card_indicator_size, 2)) + (math.div($pb_selectable_card_border, 2));
63
+ border-radius: $pb_selectable_card_indicator_size/2 + $pb_selectable_card_border/2;
66
64
  border-width: $pb_selectable_card_border;
67
65
  border-style: solid;
68
66
  border-color: $white;
@@ -71,8 +69,8 @@ $pb_selectable_paddings: (
71
69
  font-size: $font_smaller;
72
70
  text-align: center;
73
71
  position: absolute;
74
- top: -(math.div($pb_selectable_card_indicator_size, 2));
75
- right: -(math.div($pb_selectable_card_indicator_size, 2));
72
+ top: -($pb_selectable_card_indicator_size/2);
73
+ right: -($pb_selectable_card_indicator_size/2);
76
74
  opacity: 0;
77
75
  }
78
76
  }
@@ -4,9 +4,23 @@
4
4
  data: object.data,
5
5
  id: object.id,
6
6
  **combined_html_options) do %>
7
- <%= pb_rails("list") do %>
8
- <% object.items.each do |item| %>
9
- <%= pb_rails("selectable_list/selectable_list_item", props: item.merge(variant: object.variant, id: object.get_id(item)) )%>
7
+ <% if enable_drag %>
8
+ <%= pb_rails("draggable", props: {initial_items: object.items}) do %>
9
+ <%= pb_rails("draggable/draggable_container") do %>
10
+ <%= pb_rails("list", props: {ordered: false}) do %>
11
+ <% object.items.each do |item| %>
12
+ <%= pb_rails("draggable/draggable_item", props: {drag_id: item[:drag_id]}) do %>
13
+ <%= pb_rails("selectable_list/selectable_list_item", props: item.merge(variant: object.variant, id: object.get_id(item), drag_id: item[:drag_id]) )%>
14
+ <% end %>
15
+ <% end %>
16
+ <% end %>
17
+ <% end %>
18
+ <% end %>
19
+ <% else %>
20
+ <%= pb_rails("list") do %>
21
+ <% object.items.each do |item| %>
22
+ <%= pb_rails("selectable_list/selectable_list_item", props: item.merge(variant: object.variant, id: object.get_id(item)) )%>
23
+ <% end %>
10
24
  <% end %>
11
25
  <% end %>
12
26
  <% end %>
@@ -14,6 +14,9 @@ module Playbook
14
14
  prop :items, type: Playbook::Props::Array,
15
15
  default: []
16
16
 
17
+ prop :enable_drag, type: Playbook::Props::Boolean,
18
+ default: false
19
+
17
20
  def classname
18
21
  generate_classname("pb_selectable_list_kit")
19
22
  end
@@ -4,6 +4,13 @@
4
4
  data: object.data,
5
5
  id: object.id,
6
6
  **combined_html_options) do %>
7
+ <% if object.drag_id && object.drag_handle %>
8
+ <span style="vertical-align: middle;">
9
+ <%= pb_rails("body") do %>
10
+ <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>
11
+ <% end %>
12
+ </span>
13
+ <% end %>
7
14
  <% if object.variant == "radio"%>
8
15
  <%= pb_rails("radio", props: { text: object.text, checked: object.checked, input_options: object.input_options } ) %>
9
16
  <% if content.present? %>
@@ -19,10 +26,10 @@
19
26
  <% if object.variant == "checkbox"%>
20
27
  <script>
21
28
  var checkboxElement = document.querySelector("#<%=object.id%> input[type=checkbox]")
22
-
29
+
23
30
  checkboxElement.addEventListener("change", (evt) => {
24
31
  var listItemElement = document.querySelector("#<%=object.id%>")
25
-
32
+
26
33
  if (evt.target.checked) {
27
34
  listItemElement.classList.add("checked_item");
28
35
  } else {
@@ -34,9 +41,9 @@
34
41
  <script>
35
42
  var radioElement = document.querySelector("#<%=object.id%> input[type=radio]")
36
43
 
37
- radioElement.addEventListener("change", () => {
44
+ radioElement.addEventListener("change", () => {
38
45
  var radios = radioElement.closest("ul").querySelectorAll("input[type=radio]")
39
-
46
+
40
47
  radios.forEach((radio) => {
41
48
  if (radio.checked) {
42
49
  radio.closest("li").classList.add("checked_item");
@@ -6,6 +6,9 @@ module Playbook
6
6
  prop :tabindex
7
7
  prop :checked, type: Playbook::Props::Boolean,
8
8
  default: false
9
+ prop :drag_handle, type: Playbook::Props::Boolean,
10
+ default: true
11
+ prop :drag_id, type: Playbook::Props::String
9
12
  prop :name, type: Playbook::Props::String
10
13
  prop :text, type: Playbook::Props::String
11
14
  prop :value, type: Playbook::Props::String
@@ -1,7 +1,7 @@
1
1
  @import "../../tokens/screen_sizes";
2
+ @import "../../tokens/border_radius";
2
3
 
3
4
  .table-responsive-scroll {
4
- display: block;
5
5
  overflow-x: scroll;
6
6
 
7
7
  // hides duplicate scroll bar for those that see two (byproduct of repeated table-responsive-scroll class
@@ -27,11 +27,12 @@
27
27
  // Responsive Styles
28
28
  @media (max-width: 1600px) {
29
29
  &[class*="table-responsive-scroll"] {
30
- border-radius: 4px;
31
- box-shadow: 1px 0 0 0px $border_light,
30
+ &:has(> table.table-card) {
31
+ border-radius: $border_rad_light;
32
+ box-shadow: 1px 0 0 0px $border_light,
32
33
  -1px 0 0 0px $border_light
33
- }
34
-
34
+ }
35
+ }
35
36
  &[class^=pb_table].table-sm.table-card thead tr th:first-child,
36
37
  &[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:first-child {
37
38
  border-left-width: 0px;
@@ -1,5 +1,3 @@
1
- @use "sass:math";
2
-
3
1
  @import "../pb_textarea/textarea_mixin";
4
2
  @import "../tokens/titles";
5
3
  @import "../tokens/colors";
@@ -102,7 +100,7 @@
102
100
  &.error {
103
101
  .text_input_wrapper {
104
102
  [class*="pb_body_kit"] {
105
- margin-top: math.div($space_xs, 2);
103
+ margin-top: $space_xs / 2;
106
104
  }
107
105
  input,
108
106
  .text_input {
@@ -1,5 +1,3 @@
1
- @use "sass:math";
2
-
3
1
  @import "../pb_body/body_mixins";
4
2
  @import "./textarea_mixin";
5
3
  @import "../tokens/spacing";
@@ -62,7 +60,7 @@
62
60
 
63
61
  &.error {
64
62
  [class*=pb_body_kit] {
65
- margin-top: math.div($space_xs, 2);
63
+ margin-top: $space_xs / 2;
66
64
  }
67
65
  textarea {
68
66
  border-color: $error;
@@ -1,4 +1,3 @@
1
- @use "sass:math";
2
1
 
3
2
  [class^=pb_time_range_inline_kit] {
4
3
  &[class*=_center] {
@@ -23,14 +22,14 @@
23
22
  display: flex;
24
23
  align-items: center;
25
24
  [class*=pb_time_range_inline_arrow] {
26
- margin-left: math.div($space_xs, 2);
27
- margin-right:math.div($space_xs, 2);
25
+ margin-left: $space_xs/2;
26
+ margin-right: $space_xs/2;
28
27
  }
29
28
  [class*=pb_time_range_inline_timezone] {
30
- margin-left: math.div($space_xs, 2);
29
+ margin-left: $space_xs/2;
31
30
  }
32
31
  [class*=pb_time_range_inline_icon] {
33
- margin-right: math.div($space_xs, 2);
32
+ margin-right: $space_xs/2;
34
33
  }
35
34
  }
36
35
  }
@@ -1,14 +1,12 @@
1
- @use "sass:math";
2
-
3
1
  @import "../tokens/colors";
4
2
  @import "../tokens/spacing";
5
3
  @import "../tokens/opacity";
6
4
  @import "../tokens/typography";
7
5
 
8
6
  $connector_width: 2px;
9
- $icon_margin: math.div($space_xs, 2);
7
+ $icon_margin: $space_xs/2;
10
8
  $icon_height: 28px;
11
- $height_from_top: (math.div($icon_height, 2)) - (math.div($connector_width, 2));
9
+ $height_from_top: $icon_height/2 - $connector_width/2;
12
10
 
13
11
  // Add gap variables
14
12
  $gap_xs: $height_from_top + $space_xs;
@@ -1,5 +1,3 @@
1
- @use "sass:math";
2
-
3
1
  @import "../tokens/colors";
4
2
 
5
3
  $color_checkbox_success: $data_1;
@@ -10,7 +8,7 @@ $transition: .2s ease-in-out;
10
8
  [class^=pb_toggle_kit] {
11
9
  position: relative;
12
10
  $width: 44px;
13
- $height: math.div($width, 2);
11
+ $height: $width / 2;
14
12
  $border_success: 3px solid $color_checkbox_success;
15
13
  $border_default: 3px solid $color_checkbox_default;
16
14
 
@@ -29,7 +27,7 @@ $transition: .2s ease-in-out;
29
27
  &:after {
30
28
  transition: $transition;
31
29
  content: "";
32
- width: math.div($width, 2) - 4px;
30
+ width: $width / 2 - 4px;
33
31
  height: $height - 4px;
34
32
  background-color: $color_checkbox_default;
35
33
  border-radius: 50%;
@@ -70,7 +68,7 @@ $transition: .2s ease-in-out;
70
68
  background-color: $color_checkbox_success;
71
69
 
72
70
  &:after {
73
- left: math.div($width, 2) + 2px;
71
+ left: $width / 2 + 2px;
74
72
  background-color: $white;
75
73
  }
76
74
  }
@@ -42,8 +42,8 @@ type TypeaheadProps = {
42
42
  id?: string,
43
43
  label?: string,
44
44
  loadOptions?: string | Noop,
45
- getOptionLabel?: string | (() => any),
46
- getOptionValue?: string | (() => any),
45
+ getOptionLabel?: string | (() => string),
46
+ getOptionValue?: string | (() => string),
47
47
  name?: string,
48
48
  marginBottom?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
49
49
  pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
@@ -109,6 +109,7 @@ const Typeahead = ({
109
109
  multiKit: '',
110
110
  onCreateOption: null as null,
111
111
  plusIcon: false,
112
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
112
113
  onMultiValueClick: (_option: SelectValueType): any => undefined,
113
114
  pillColor: pillColor,
114
115
  ...props,
@@ -1,16 +1,24 @@
1
1
  import React, { useEffect } from 'react'
2
2
  import { components } from 'react-select'
3
3
 
4
- const ClearContainer = (props: any) => {
4
+ type ClearContainerProps = {
5
+ children: React.ReactNode,
6
+ selectProps?: {
7
+ id: string,
8
+ },
9
+ clearValue: () => void,
10
+ }
11
+
12
+ const ClearContainer = (props: ClearContainerProps): React.ReactElement => {
5
13
  const { selectProps, clearValue } = props
6
14
  useEffect(() => {
7
15
  document.addEventListener(`pb-typeahead-kit-${selectProps.id}:clear`, clearValue)
8
- }, [true])
16
+ }, [clearValue, selectProps.id])
9
17
 
10
18
  return (
11
19
  <components.ClearIndicator
12
- className="clear_indicator"
13
- {...props}
20
+ className="clear_indicator"
21
+ {...props}
14
22
  />
15
23
  )
16
24
  }
@@ -5,7 +5,11 @@ import Flex from '../../pb_flex/_flex'
5
5
  import TextInput from '../../pb_text_input/_text_input'
6
6
 
7
7
  type Props = {
8
- selectProps: any,
8
+ selectProps: {
9
+ dark?: boolean,
10
+ label: string,
11
+ error?: string,
12
+ },
9
13
  }
10
14
 
11
15
  const TypeaheadControl = (props: Props) => (
@@ -1,10 +1,15 @@
1
1
  import React from 'react'
2
2
  import { components } from 'react-select'
3
3
 
4
- const IndicatorsContainer = (props: any) => (
4
+ type IndicatorsContainerProps = {
5
+ children: React.ReactNode,
6
+ }
7
+
8
+
9
+ const IndicatorsContainer = (props: IndicatorsContainerProps): React.ReactElement => (
5
10
  <components.IndicatorsContainer
6
- className="text_input_indicators"
7
- {...props}
11
+ className="text_input_indicators"
12
+ {...props}
8
13
  />
9
14
  )
10
15
 
@@ -1,7 +1,12 @@
1
1
  import React from 'react'
2
2
  import { components } from 'react-select'
3
3
 
4
- const MenuList = (props: any) => {
4
+ type MenuListProps = {
5
+ children: React.ReactNode,
6
+ footer: React.ReactNode,
7
+ }
8
+
9
+ const MenuList = (props: MenuListProps): React.ReactElement => {
5
10
  return (
6
11
  <components.MenuList {...props}>
7
12
  {props.children}
@@ -3,7 +3,22 @@ import { components } from 'react-select'
3
3
 
4
4
  import User from '../../pb_user/_user'
5
5
 
6
- const Option = (props: any) => {
6
+ type OptionProps = {
7
+ children: React.ReactNode,
8
+ label?: string,
9
+ data: {
10
+ imageUrl?: string,
11
+ },
12
+ selectProps: {
13
+ dark?: boolean,
14
+ valueComponent?: (data: {
15
+ imageUrl?: string,
16
+ }) => React.ReactNode,
17
+ },
18
+ }
19
+
20
+
21
+ const Option = (props: OptionProps): React.ReactElement => {
7
22
  const {
8
23
  imageUrl,
9
24
  } = props.data
@@ -14,11 +29,11 @@ const Option = (props: any) => {
14
29
  <>
15
30
  {!valueComponent && imageUrl &&
16
31
  <User
17
- align="left"
18
- avatarUrl={imageUrl}
19
- dark={props.selectProps.dark}
20
- name={props.label}
21
- orientation="horizontal"
32
+ align="left"
33
+ avatarUrl={imageUrl}
34
+ dark={props.selectProps.dark}
35
+ name={props.label}
36
+ orientation="horizontal"
22
37
  />
23
38
  }
24
39
 
@@ -4,19 +4,26 @@ import { components } from 'react-select'
4
4
  import Flex from '../../pb_flex/_flex'
5
5
  import Icon from '../../pb_icon/_icon'
6
6
 
7
- const Placeholder = (props: any) => (
7
+ type PlaceholderProps = {
8
+ children: React.ReactNode,
9
+ selectProps: {
10
+ plusIcon?: boolean,
11
+ },
12
+ }
13
+
14
+ const Placeholder = (props: PlaceholderProps): React.ReactElement => (
8
15
  <>
9
16
  <Flex
10
- align="center"
11
- className="placeholder"
17
+ align="center"
18
+ className="placeholder"
12
19
  >
13
20
  <components.IndicatorsContainer
14
- {...props}
21
+ {...props}
15
22
  />
16
23
  {props.selectProps.plusIcon &&
17
24
  <Icon
18
- className="typeahead-plus-icon"
19
- icon="plus"
25
+ className="typeahead-plus-icon"
26
+ icon="plus"
20
27
  />
21
28
  }
22
29
  </Flex>
@@ -1,10 +1,14 @@
1
1
  import React from 'react'
2
2
  import { components } from 'react-select'
3
3
 
4
- const ValueContainer = (props: any) => (
4
+ type ValueContainerProps = {
5
+ children: React.ReactNode,
6
+ }
7
+
8
+ const ValueContainer = (props: ValueContainerProps): React.ReactElement => (
5
9
  <components.ValueContainer
6
- className="text_input_value_container"
7
- {...props}
10
+ className="text_input_value_container"
11
+ {...props}
8
12
  />
9
13
  )
10
14
 
@@ -1,3 +1,5 @@
1
+ /* eslint-disable react/no-multi-comp */
2
+
1
3
  import React, { useState } from 'react'
2
4
 
3
5
  import {
@@ -45,8 +45,7 @@ const promiseOptions = (inputValue) =>
45
45
 
46
46
  const TypeaheadWithPillsAsync = (props) => {
47
47
  const [users, setUsers] = useState([])
48
- const handleOnChange = (value) => setUsers(formatUsers(value))
49
- const formatValue = (users) => formatUsers(users)
48
+
50
49
  const formatUsers = (users) => {
51
50
  const results = () => (users.map((user) => {
52
51
  if (Object.keys(user)[0] === 'name' || Object.keys(user)[1] === 'id'){
@@ -58,6 +57,9 @@ const TypeaheadWithPillsAsync = (props) => {
58
57
  return results()
59
58
  }
60
59
 
60
+ const handleOnChange = (value) => setUsers(formatUsers(value))
61
+ const formatValue = (users) => formatUsers(users)
62
+
61
63
  return (
62
64
  <>
63
65
  {users && users.length > 0 && (
@@ -83,13 +83,13 @@ const TypeaheadWithPillsAsyncCustomOptions = (props) => {
83
83
  onChange={handleOnChange}
84
84
  onMultiValueClick={handleOnMultiValueClick}
85
85
  placeholder="type the name of a Github user"
86
- valueComponent={(props) => (
86
+ valueComponent={({imageUrl, label, territory, type}) => (
87
87
  <User
88
88
  avatar
89
- avatarUrl={props.imageUrl}
90
- name={props.label}
91
- territory={props.territory}
92
- title={props.type}
89
+ avatarUrl={imageUrl}
90
+ name={label}
91
+ territory={territory}
92
+ title={type}
93
93
  />
94
94
  )}
95
95
  {...props}