playbook_ui 13.30.0 → 13.31.0.pre.alpha.PLAY10863202

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +59 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.md +6 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -2
  5. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +4 -4
  6. data/app/pb_kits/playbook/pb_background/background.html.erb +2 -11
  7. data/app/pb_kits/playbook/pb_body/body.html.erb +1 -6
  8. data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb +1 -6
  9. data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb +1 -6
  10. data/app/pb_kits/playbook/pb_caption/caption.html.erb +1 -6
  11. data/app/pb_kits/playbook/pb_card/_card.tsx +4 -3
  12. data/app/pb_kits/playbook/pb_card/card.html.erb +1 -7
  13. data/app/pb_kits/playbook/pb_collapsible/index.js +6 -1
  14. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default_swift.md +33 -0
  15. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_props_swift.md +18 -0
  16. data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +6 -1
  17. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_default.jsx +4 -1
  18. data/app/pb_kits/playbook/pb_detail/detail.html.erb +1 -6
  19. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +1 -6
  20. data/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb +1 -6
  21. data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +2 -5
  22. data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +1 -6
  23. data/app/pb_kits/playbook/pb_draggable/_draggable.scss +2 -4
  24. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +84 -50
  25. data/app/pb_kits/playbook/pb_draggable/context/types.ts +31 -0
  26. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +15 -19
  27. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.md +5 -3
  28. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.jsx +5 -1
  29. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.jsx +11 -4
  30. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.md +8 -2
  31. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx +2 -2
  32. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.md +5 -1
  33. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx +6 -4
  34. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.md +5 -0
  35. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +142 -15
  36. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +6 -5
  37. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +18 -0
  38. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +228 -218
  39. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.html.erb +9 -0
  40. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx +34 -0
  41. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -0
  42. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +2 -1
  43. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +16 -12
  44. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +9 -0
  45. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +17 -2
  46. data/app/pb_kits/playbook/pb_dropdown/index.js +33 -4
  47. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +9 -3
  48. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_custom_icon.html.erb +32 -0
  49. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_custom_icon.jsx +48 -0
  50. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
  51. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -0
  52. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +16 -11
  53. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +72 -0
  54. data/app/pb_kits/playbook/pb_flex/flex.html.erb +1 -5
  55. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +9 -0
  56. data/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb +1 -6
  57. data/app/pb_kits/playbook/pb_highlight/highlight.html.erb +1 -5
  58. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb +1 -5
  59. data/app/pb_kits/playbook/pb_icon/_icon.tsx +37 -6
  60. data/app/pb_kits/playbook/pb_icon/docs/_icon_default.html.erb +1 -1
  61. data/app/pb_kits/playbook/pb_icon/docs/_icon_default.jsx +2 -3
  62. data/app/pb_kits/playbook/pb_icon/icon.rb +21 -1
  63. data/app/pb_kits/playbook/pb_icon/icon_aliases.json +39 -0
  64. data/app/pb_kits/playbook/pb_list/_list.tsx +4 -4
  65. data/app/pb_kits/playbook/pb_list/_list_item.tsx +7 -3
  66. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.html.erb +1 -1
  67. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +1 -0
  68. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +3 -1
  69. data/app/pb_kits/playbook/pb_nav/item.html.erb +1 -1
  70. data/app/pb_kits/playbook/pb_nav/item.rb +1 -0
  71. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.html.erb +24 -0
  72. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +4 -4
  73. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_multi_directional.html.erb +11 -0
  74. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +4 -0
  75. data/app/pb_kits/playbook/pb_overlay/overlay.html.erb +27 -0
  76. data/app/pb_kits/playbook/pb_overlay/overlay.rb +110 -0
  77. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +8 -23
  78. data/app/pb_kits/playbook/pb_selectable_list/_item.tsx +7 -3
  79. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +3 -3
  80. data/app/pb_kits/playbook/pb_table/_table.tsx +1 -1
  81. data/app/pb_kits/playbook/pb_table/index.ts +4 -4
  82. data/app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx +1 -1
  83. data/app/pb_kits/playbook/pb_table/subcomponents/_table_cell.tsx +1 -1
  84. data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +1 -1
  85. data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +1 -1
  86. data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +1 -1
  87. data/app/pb_kits/playbook/pb_table/table.test.js +2 -0
  88. data/app/pb_kits/playbook/pb_table/table_header.html.erb +16 -2
  89. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -1
  90. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +1 -1
  91. data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +45 -27
  92. data/app/pb_kits/playbook/pb_textarea/index.tsx +3 -3
  93. data/app/pb_kits/playbook/pb_time/_time.tsx +3 -3
  94. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +1 -1
  95. data/app/pb_kits/playbook/pb_timeline/_item.tsx +12 -11
  96. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +9 -7
  97. data/app/pb_kits/playbook/pb_title/_title.tsx +2 -1
  98. data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +10 -10
  99. data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +1 -1
  100. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +3 -3
  101. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +3 -4
  102. data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +2 -0
  103. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +5 -4
  104. data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +12 -4
  105. data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +11 -7
  106. data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +8 -3
  107. data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +6 -1
  108. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +26 -21
  109. data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +21 -6
  110. data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +13 -6
  111. data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +7 -3
  112. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +2 -0
  113. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +7 -1
  114. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +2 -2
  115. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +1 -1
  116. data/app/pb_kits/playbook/pb_typeahead/index.ts +33 -33
  117. data/app/pb_kits/playbook/pb_user/_user.tsx +1 -1
  118. data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +6 -6
  119. data/app/pb_kits/playbook/pb_user_badge/badges/million-dollar.tsx +236 -235
  120. data/app/pb_kits/playbook/pb_user_badge/badges/veteran.tsx +1 -1
  121. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +68 -63
  122. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +2 -2
  123. data/app/pb_kits/playbook/utilities/globalProps.ts +1 -0
  124. data/dist/menu.yml +566 -472
  125. data/dist/playbook-rails.js +7 -7
  126. data/lib/playbook/version.rb +2 -2
  127. metadata +21 -5
@@ -3,16 +3,16 @@ import PbEnhancedElement from '../pb_enhanced_element'
3
3
  export default class PbTextarea extends PbEnhancedElement {
4
4
  style: {[key: string]: string}
5
5
  scrollHeight: string
6
- static get selector() {
6
+ static get selector(): string {
7
7
  return '.resize_auto textarea'
8
8
  }
9
9
 
10
- onInput() {
10
+ onInput(): void {
11
11
  this.style.height = 'auto'
12
12
  this.style.height = (this.scrollHeight) + 'px'
13
13
  }
14
14
 
15
- connect() {
15
+ connect(): void {
16
16
  this.element.setAttribute('style', 'height:' + (this.element.scrollHeight) + 'px;overflow-y:hidden;')
17
17
  this.element.addEventListener('input', this.onInput, false)
18
18
  }
@@ -24,7 +24,7 @@ type TimeProps = {
24
24
  unstyled?: boolean;
25
25
  } & GlobalProps
26
26
 
27
- const Time = (props: TimeProps) => {
27
+ const Time = (props: TimeProps): React.ReactElement => {
28
28
  const {
29
29
  align,
30
30
  className,
@@ -47,8 +47,8 @@ const Time = (props: TimeProps) => {
47
47
 
48
48
  return (
49
49
  <div
50
- {...htmlProps}
51
- className={classes}
50
+ {...htmlProps}
51
+ className={classes}
52
52
  >
53
53
  {showIcon && (
54
54
  unstyled
@@ -36,7 +36,7 @@ const dateTimeIso = (dateValue: Date) => {
36
36
  return DateTime.toIso(dateValue)
37
37
  }
38
38
 
39
- const TimeRangeInline = (props: TimeRangeInlineProps) => {
39
+ const TimeRangeInline = (props: TimeRangeInlineProps): React.ReactElement => {
40
40
  const {
41
41
  aria = {},
42
42
  className,
@@ -2,6 +2,7 @@ import React from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
4
  import { buildCss, buildHtmlProps } from '../utilities/props'
5
+ import { globalProps, GlobalProps } from "../utilities/globalProps";
5
6
 
6
7
  import DateStacked from '../pb_date_stacked/_date_stacked'
7
8
  import IconCircle from '../pb_icon_circle/_icon_circle'
@@ -14,7 +15,7 @@ type ItemProps = {
14
15
  icon?: string,
15
16
  iconColor?: 'default' | 'royal' | 'blue' | 'purple' | 'teal' | 'red' | 'yellow' | 'green',
16
17
  lineStyle?: 'solid' | 'dotted',
17
- }
18
+ } & GlobalProps
18
19
 
19
20
  const TimelineItem = ({
20
21
  className,
@@ -24,31 +25,31 @@ const TimelineItem = ({
24
25
  icon = 'user',
25
26
  iconColor = 'default',
26
27
  lineStyle = 'solid',
27
-
28
- }: ItemProps) => {
28
+ ...props
29
+ }: ItemProps): React.ReactElement => {
29
30
  const timelineItemCss = buildCss('pb_timeline_item_kit', lineStyle)
30
31
 
31
32
  const htmlProps = buildHtmlProps(htmlOptions)
32
33
 
33
34
  return (
34
35
  <div
35
- {...htmlProps}
36
- className={classnames(timelineItemCss, className)}
36
+ {...htmlProps}
37
+ className={classnames(timelineItemCss, globalProps(props), className)}
37
38
  >
38
39
  <div className="pb_timeline_item_left_block">
39
40
  {date &&
40
41
  <DateStacked
41
- align="center"
42
- date={date}
43
- size="sm"
42
+ align="center"
43
+ date={date}
44
+ size="sm"
44
45
  />
45
46
  }
46
47
  </div>
47
48
  <div className="pb_timeline_item_step">
48
49
  <IconCircle
49
- icon={icon}
50
- size="xs"
51
- variant={iconColor}
50
+ icon={icon}
51
+ size="xs"
52
+ variant={iconColor}
52
53
  />
53
54
  <div className="pb_timeline_item_connector" />
54
55
  </div>
@@ -2,6 +2,7 @@ import React from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
4
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
5
+ import { GlobalProps, globalProps } from '../utilities/globalProps'
5
6
 
6
7
  import TimelineItem from './_item'
7
8
 
@@ -14,7 +15,7 @@ type TimelineProps = {
14
15
  id?: string,
15
16
  orientation?: string,
16
17
  showDate?: boolean,
17
- }
18
+ } & GlobalProps
18
19
 
19
20
  const Timeline = ({
20
21
  aria = {},
@@ -25,7 +26,8 @@ const Timeline = ({
25
26
  id,
26
27
  orientation = 'horizontal',
27
28
  showDate = false,
28
- }: TimelineProps) => {
29
+ ...props
30
+ }: TimelineProps): React.ReactElement => {
29
31
  const ariaProps = buildAriaProps(aria)
30
32
  const dataProps = buildDataProps(data)
31
33
  const htmlProps = buildHtmlProps(htmlOptions)
@@ -33,11 +35,11 @@ const Timeline = ({
33
35
  const timelineCss = buildCss('pb_timeline_kit', `_${orientation}`, dateStyle)
34
36
  return (
35
37
  <div
36
- {...ariaProps}
37
- {...dataProps}
38
- {...htmlProps}
39
- className={classnames(timelineCss, className)}
40
- id={id}
38
+ {...ariaProps}
39
+ {...dataProps}
40
+ {...htmlProps}
41
+ className={classnames(timelineCss, globalProps(props), className)}
42
+ id={id}
41
43
  >
42
44
  {children}
43
45
  </div>
@@ -62,7 +62,8 @@ const Title = (props: TitleProps): React.ReactElement => {
62
62
  buildResponsiveSizeCss(),
63
63
  className
64
64
  )
65
- const Tag: React.ReactElement | any = `${tag}`
65
+ // eslint-disable-next-line jsx-control-statements/jsx-jcs-no-undef
66
+ const Tag: keyof JSX.IntrinsicElements = `${tag}`
66
67
 
67
68
  return (
68
69
  <Tag
@@ -18,7 +18,7 @@ type TitleDetailProps = {
18
18
  title: string,
19
19
  } & GlobalProps
20
20
 
21
- const TitleDetail = (props: TitleDetailProps) => {
21
+ const TitleDetail = (props: TitleDetailProps): React.ReactElement => {
22
22
  const {
23
23
  align = "left",
24
24
  aria = {},
@@ -37,19 +37,19 @@ const TitleDetail = (props: TitleDetailProps) => {
37
37
 
38
38
  return (
39
39
  <div
40
- {...ariaProps}
41
- {...dataProps}
42
- {...htmlProps}
43
- className={classnames(pbCss, globalProps(props), className)}
44
- id={id}
40
+ {...ariaProps}
41
+ {...dataProps}
42
+ {...htmlProps}
43
+ className={classnames(pbCss, globalProps(props), className)}
44
+ id={id}
45
45
  >
46
46
  <Title
47
- size={4}
48
- text={title}
47
+ size={4}
48
+ text={title}
49
49
  />
50
50
  <Body
51
- color="light"
52
- text={detail}
51
+ color="light"
52
+ text={detail}
53
53
  />
54
54
  </div>
55
55
  )
@@ -42,7 +42,7 @@ const Toggle = ({
42
42
  size = 'sm',
43
43
  value,
44
44
  ...props
45
- }: Props) => {
45
+ }: Props): React.ReactElement => {
46
46
  const ariaProps = buildAriaProps(aria)
47
47
  const dataProps = buildDataProps(data)
48
48
  const htmlProps = buildHtmlProps(htmlOptions)
@@ -20,7 +20,7 @@ import Flex from "../pb_flex/_flex"
20
20
  type TooltipProps = {
21
21
  aria?: { [key: string]: string },
22
22
  className?: string | string[],
23
- children: JSX.Element,
23
+ children: React.ReactNode,
24
24
  data?: { [key: string]: string },
25
25
  delay?: number | Partial<{open: number; close: number}>,
26
26
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
@@ -50,8 +50,8 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
50
50
  ...rest
51
51
  } = props
52
52
 
53
- const dataProps: { [key: string]: any } = buildDataProps(data)
54
- const ariaProps: { [key: string]: any } = buildAriaProps(aria)
53
+ const dataProps: { [key: string]: string } = buildDataProps(data)
54
+ const ariaProps: { [key: string]: string } = buildAriaProps(aria)
55
55
  const htmlProps = buildHtmlProps(htmlOptions)
56
56
 
57
57
  const css = classnames(
@@ -52,7 +52,7 @@ const TreemapChart = ({
52
52
  tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.value}</b>',
53
53
  type = "treemap",
54
54
  ...props
55
- }: TreemapChartProps) => {
55
+ }: TreemapChartProps): React.ReactElement => {
56
56
 
57
57
  const ariaProps = buildAriaProps(aria)
58
58
  const dataProps = buildDataProps(data)
@@ -95,11 +95,10 @@ const TreemapChart = ({
95
95
  },
96
96
  };
97
97
 
98
- const [options, setOptions] = useState({});
98
+ const [options, setOptions] = useState(() => merge(staticOptions, customOptions));
99
99
 
100
100
  useEffect(() => {
101
-
102
- setOptions(merge(staticOptions, customOptions));
101
+ setOptions(prevOptions => merge(prevOptions, { series: [{ data: chartData }] }));
103
102
  }, [chartData]);
104
103
 
105
104
  return (
@@ -1,3 +1,5 @@
1
+ /* eslint-disable no-console */
2
+
1
3
  import React from 'react';
2
4
  import { render, screen } from '../utilities/test-utils';
3
5
  import TreemapChart from './_treemap_chart';
@@ -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
  }
49
49
 
@@ -77,7 +77,7 @@ const Typeahead = ({
77
77
  id,
78
78
  loadOptions = noop,
79
79
  ...props
80
- }: TypeaheadProps) => {
80
+ }: TypeaheadProps): React.ReactElement => {
81
81
  const selectProps = {
82
82
  cacheOptions: true,
83
83
  components: {
@@ -104,7 +104,8 @@ const Typeahead = ({
104
104
  multiKit: '',
105
105
  onCreateOption: null as null,
106
106
  plusIcon: false,
107
- onMultiValueClick: (_option: SelectValueType): any => undefined,
107
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
108
+ onMultiValueClick: (_option: SelectValueType): void => undefined,
108
109
  ...props,
109
110
  }
110
111
 
@@ -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,20 +5,24 @@ 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
- const TypeaheadControl = (props: Props) => (
15
+ const TypeaheadControl = (props: Props): React.ReactElement => (
12
16
  <div className="pb_typeahead_wrapper">
13
17
  <TextInput
14
- dark={props.selectProps.dark}
15
- error={props.selectProps.error}
16
- label={props.selectProps.label}
18
+ dark={props.selectProps.dark}
19
+ error={props.selectProps.error}
20
+ label={props.selectProps.label}
17
21
  >
18
22
  <Flex>
19
23
  <components.Control
20
- className="text_input"
21
- {...props}
24
+ className="text_input"
25
+ {...props}
22
26
  />
23
27
  </Flex>
24
28
  </TextInput>
@@ -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}
@@ -7,12 +7,17 @@ import { SelectValueType } from '../_typeahead'
7
7
 
8
8
  type Props = {
9
9
  data: SelectValueType,
10
- multiValueTemplate: any,
11
- removeProps: any,
12
- selectProps: any,
10
+ removeProps?: {
11
+ onClick?: React.MouseEventHandler<HTMLSpanElement>,
12
+ onMouseDown?: React.MouseEventHandler<HTMLSpanElement>,
13
+ onTouchEnd?: React.TouchEventHandler<HTMLSpanElement>,
14
+ },
15
+ selectProps: {
16
+ multiKit?: string,
17
+ },
13
18
  }
14
19
 
15
- const MultiValue = (props: Props) => {
20
+ const MultiValue = (props: Props): React.ReactElement => {
16
21
  const { removeProps } = props
17
22
  const { imageUrl, label } = props.data
18
23
  const { multiKit } = props.selectProps
@@ -27,36 +32,36 @@ const MultiValue = (props: Props) => {
27
32
 
28
33
  return (
29
34
  <components.MultiValueContainer
30
- className="text_input_multivalue_container"
31
- {...props}
35
+ className="text_input_multivalue_container"
36
+ {...props}
32
37
  >
33
38
  {multiKit === 'badge' &&
34
39
  <Badge
35
- closeProps={removeProps}
36
- removeIcon
37
- text={label}
38
- variant="primary"
40
+ closeProps={removeProps}
41
+ removeIcon
42
+ text={label}
43
+ variant="primary"
39
44
  />
40
45
  }
41
46
 
42
47
  {multiKit !== 'badge' && imageUrl &&
43
48
  <FormPill
44
- avatarUrl={imageUrl}
45
- closeProps={removeProps}
46
- marginRight="xs"
47
- name={label}
48
- size={multiKit === 'smallPill' ? 'small' : ''}
49
- text=''
49
+ avatarUrl={imageUrl}
50
+ closeProps={removeProps}
51
+ marginRight="xs"
52
+ name={label}
53
+ size={multiKit === 'smallPill' ? 'small' : ''}
54
+ text=''
50
55
  />
51
56
  }
52
57
 
53
58
  {multiKit !== 'badge' && !imageUrl &&
54
59
  <FormPill
55
- closeProps={removeProps}
56
- marginRight="xs"
57
- name=''
58
- size={multiKit === 'smallPill' ? 'small' : ''}
59
- text={label}
60
+ closeProps={removeProps}
61
+ marginRight="xs"
62
+ name=''
63
+ size={multiKit === 'smallPill' ? 'small' : ''}
64
+ text={label}
60
65
  />
61
66
  }
62
67
  </components.MultiValueContainer>
@@ -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 {
@@ -14,6 +14,12 @@ import {
14
14
  Typeahead,
15
15
  } from '../..'
16
16
 
17
+ type TypeAheadWithHighlightProps = {
18
+ data: {
19
+ name: String,
20
+ },
21
+ };
22
+
17
23
  const USERS = [
18
24
  {
19
25
  name: "Wade Winningham",
@@ -37,7 +43,7 @@ const USERS = [
37
43
  },
38
44
  ];
39
45
 
40
- const TypeaheadWithHighlight = (props) => {
46
+ const TypeaheadWithHighlight = (props: TypeAheadWithHighlightProps) => {
41
47
  const [selectedUser, setSelectedUser] = useState()
42
48
 
43
49
  const formatOptionLabel = ({name, territory, title}, {inputValue}) => {
@@ -47,8 +47,6 @@ const promiseOptions = (inputValue) =>
47
47
 
48
48
  const TypeaheadWithPillsAsync = (props) => {
49
49
  const [users, setUsers] = useState([])
50
- const handleOnChange = (value) => setUsers(formatUsers(value))
51
- const formatValue = (users) => formatUsers(users)
52
50
  const formatUsers = (users) => {
53
51
  const results = () => (users.map((user) => {
54
52
  if (Object.keys(user)[0] === 'name' || Object.keys(user)[1] === 'id'){
@@ -59,6 +57,8 @@ const TypeaheadWithPillsAsync = (props) => {
59
57
  }))
60
58
  return results()
61
59
  }
60
+ const handleOnChange = (value) => setUsers(formatUsers(value))
61
+ const formatValue = (users) => formatUsers(users)
62
62
 
63
63
  return (
64
64
  <>
@@ -48,7 +48,7 @@ const promiseOptions = (inputValue) =>
48
48
 
49
49
  const TypeaheadWithPillsAsyncCustomOptions = (props) => {
50
50
  const [users, setUsers] = useState([])
51
- const handleOnChange = (value) => setUsers(value)
51
+ const handleOnChange = (value) => {setUsers(value)}
52
52
 
53
53
  /**
54
54
  *