playbook_ui 13.31.0.pre.alpha.PLAY882formpillprimaryandneutral3201 → 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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +5 -108
  3. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +2 -11
  4. data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +1 -1
  5. data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +1 -5
  6. data/app/pb_kits/playbook/pb_table/_table.tsx +1 -1
  7. data/app/pb_kits/playbook/pb_table/index.ts +4 -4
  8. data/app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx +1 -1
  9. data/app/pb_kits/playbook/pb_table/subcomponents/_table_cell.tsx +1 -1
  10. data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +1 -1
  11. data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +1 -1
  12. data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +1 -1
  13. data/app/pb_kits/playbook/pb_table/table.test.js +2 -0
  14. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -1
  15. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +1 -1
  16. data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +45 -27
  17. data/app/pb_kits/playbook/pb_textarea/index.tsx +3 -3
  18. data/app/pb_kits/playbook/pb_time/_time.tsx +3 -3
  19. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +1 -1
  20. data/app/pb_kits/playbook/pb_timeline/_item.tsx +1 -1
  21. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +1 -1
  22. data/app/pb_kits/playbook/pb_title/_title.tsx +2 -1
  23. data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +10 -10
  24. data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +1 -1
  25. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +3 -3
  26. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +3 -4
  27. data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +2 -0
  28. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +5 -4
  29. data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +12 -4
  30. data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +11 -7
  31. data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +8 -3
  32. data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +6 -1
  33. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +26 -21
  34. data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +21 -6
  35. data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +13 -6
  36. data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +7 -3
  37. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +2 -0
  38. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +7 -1
  39. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +2 -2
  40. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +1 -1
  41. data/app/pb_kits/playbook/pb_typeahead/index.ts +33 -33
  42. data/app/pb_kits/playbook/pb_user/_user.tsx +1 -1
  43. data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +6 -6
  44. data/app/pb_kits/playbook/pb_user_badge/badges/million-dollar.tsx +236 -235
  45. data/app/pb_kits/playbook/pb_user_badge/badges/veteran.tsx +1 -1
  46. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +68 -63
  47. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +2 -2
  48. data/dist/playbook-rails.js +2 -2
  49. data/lib/playbook/version.rb +1 -1
  50. metadata +1 -2
  51. data/app/pb_kits/playbook/pb_form_pill/_form_pill.test.jsx +0 -53
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58be8143dc1d3b0b8f64fddf26414a5486df02decbd590b04e78a2fd96b5a1a3
4
- data.tar.gz: e109a14b818fc8ea6dc9e1c1c0fd7fd27325481d730c3c3f0a249e5b2334a1c5
3
+ metadata.gz: 38a78ffb832c26d9b4a513f4c0885a1b7c1eed316bc0e93a5796ad4dd114cb37
4
+ data.tar.gz: dae46521d8c237a8f63a2629248660050e4af8690ce28d5bc9c42b1d3be8f6ef
5
5
  SHA512:
6
- metadata.gz: 517fb2d246a141e0490421f1d64a1b719650908e26a16320d9d647e73edde4a286df47c5fbeafc080d48063e744c4d7c1d45fd18e8ab25850d6ac5ec88eb1081
7
- data.tar.gz: aa0c86a28ba3c93000bf2be8c4857332c19fe9137d00c5cfbe8c796068dc3e99f8f34feae53e989143fbb01e6d5286aafbc2abceeef7ce2b825f80150eb32703
6
+ metadata.gz: 5e83fa306341be3e71ebeac1469c66ede7baa1aff2f0327850249460e83ca9176fa69f13f5f40131006dfb7e819181039776ff7ad7bdbf1553c0f4c15e00d258
7
+ data.tar.gz: 6394ff34da19c883d673e67cf2dd62550cc65003c8629658995bbb21497b0fd95f497905f89742bdb2cb1c333e7a2de09e6a3b4c2a3aa4bb4fa6e77cbcdbd031
@@ -8,7 +8,6 @@ $selector: ".pb_form_pill";
8
8
  $pb_form_pill_height: 37px;
9
9
  $form_pill_colors: (
10
10
  primary: map-get($status_color_text, "primary"),
11
- neutral: map-get($status_color_text, "neutral"),
12
11
  );
13
12
 
14
13
 
@@ -24,71 +23,34 @@ $form_pill_colors: (
24
23
  cursor: pointer;
25
24
  @each $color_name, $color_value in $form_pill_colors {
26
25
  &[class*=_#{$color_name}] {
27
- background-color: mix($color_value, $card_light, 10%);
28
- @if ($color_name == "neutral") {
29
- background-color: $white;
30
- border: 1px solid $border_light;
31
- }
26
+ background-color: rgba($color_value, $opacity-1);
32
27
  transition: background-color 0.2s ease;
33
28
  box-shadow: none;
34
29
  @media (hover:hover) {
35
30
  &:hover {
36
- background-color: mix($color_value, $card_light, 20%);
37
- @if ($color_name == "neutral") {
38
- background-color: mix($neutral, $card_light, 20%);
39
- border: 1px solid $border_light;
40
- }
41
- }
42
- &:active {
43
- background-color: mix($color_value, $card_light, 30%);
44
- @if ($color_name == "neutral") {
45
- background-color: mix($neutral, $card_light, 30%);
46
- }
31
+ background-color: rgba($color_value, $opacity-2);
47
32
  }
48
33
  }
49
34
  #{$selector}_text {
50
35
  color: $color_value;
51
- @if ($color_name == "neutral") {
52
- color: $text_lt_default;
53
- }
54
36
  padding-left: $space-sm;
55
- padding-right: $space-sm/2;
37
+ padding-right: $space-sm/4;
56
38
  }
57
39
  #{$selector}_close {
58
40
  color: $color_value;
59
- padding-left: $space-sm/4;
41
+ padding-left: $space-sm/2;
60
42
  padding-right: $space-sm/4;
61
43
  display: flex;
62
44
  align-items: center;
63
- // I had to temporarily change height to 27px so new hover state darker background forms a circle not an oval
64
- // before size change (ticket 2 of 4) - change back to 100% when $pb_form_pill_height changed to 27px from 37px
65
- height: 27px;
66
- border-radius: 70px;
45
+ height: 100%;
67
46
  cursor: pointer;
68
- &:hover {
69
- background-color: mix($color_value, $card_light, 40%);
70
- @if ($color_name == "neutral") {
71
- background-color: mix($neutral, $card_light, 60%);
72
- }
73
- }
74
47
  }
75
48
  #{$selector}_tag {
76
49
  color: $color_value;
77
50
  padding-left: $space-sm;
78
- @if ($color_name == "neutral") {
79
- color: $text_lt_default;
80
- }
81
51
  }
82
52
  }
83
53
  }
84
- &:focus {
85
- outline: $primary solid 2px;
86
- outline-offset: -1px;
87
- }
88
- &:focus-visible {
89
- outline: $primary solid 2px;
90
- outline-offset: -1px;
91
- }
92
54
  &.small {
93
55
  height: fit-content;
94
56
  height: -moz-fit-content;
@@ -108,71 +70,6 @@ $form_pill_colors: (
108
70
  &::before { line-height: 21px; }
109
71
  }
110
72
  }
111
- &.dark {
112
- @each $color_name, $color_value in $form_pill_colors {
113
- // In dark mode, the base patterns below are needed for the next tickets for success, warning, error, info.
114
- // Primary and Neutral are exceptions to the general rule in the handoff
115
- &[class*=_#{$color_name}] {
116
- // background-color: mix($color_value, $card_dark, 10%);
117
- // .pb_form_pill_tag {
118
- // color: $color_name;
119
- // }
120
- // .pb_form_pill_close {
121
- // color: $color_name;
122
- // &:hover {
123
- // background-color: mix($color_value, $card_dark, 40%);
124
- // }
125
- // }
126
- // &:hover {
127
- // background-color: mix($color_value, $card_dark, 20%);
128
- // }
129
- // &:active {
130
- // background-color: mix($color_value, $card_dark, 30%);
131
- // }
132
- @if ($color_name == "neutral") {
133
- background-color: transparent;
134
- border: 1px solid $border_dark;
135
- .pb_form_pill_text, .pb_form_pill_tag {
136
- color: $text_dk_default;
137
- }
138
- .pb_form_pill_close {
139
- color: $text_dk_default;
140
- &:hover {
141
- background-color: mix($neutral, $card_dark, 40%);
142
- }
143
- }
144
- &:hover {
145
- background-color: mix($white, $card_dark, 10%);
146
- }
147
- &:active {
148
- background-color: mix($white, $card_dark, 20%);
149
- }
150
- &:focus {
151
- border: 1px solid $primary;
152
- }
153
- }
154
- @if ($color_name == "primary") {
155
- background-color: mix($active_dark, $card_dark, 10%);
156
- .pb_form_pill_text, .pb_form_pill_tag {
157
- color: $active_dark;
158
- }
159
- .pb_form_pill_close {
160
- color: $active_dark;
161
- &:hover {
162
- background-color: mix($active_dark, $card_dark, 40%);
163
- }
164
- }
165
- &:hover {
166
- background-color: mix($active_dark, $card_dark, 20px);
167
- }
168
- &:active {
169
- background-color: mix($active_dark, $card_dark, 30%);
170
- }
171
- }
172
- }
173
- }
174
- }
175
-
176
73
  &[class*=lowercase] {
177
74
  text-transform: lowercase;
178
75
  }
@@ -5,7 +5,7 @@ import Title from '../pb_title/_title'
5
5
  import Icon from '../pb_icon/_icon'
6
6
  import Avatar from '../pb_avatar/_avatar'
7
7
  import { globalProps, GlobalProps } from '../utilities/globalProps'
8
- import { buildDataProps, buildHtmlProps } from '../utilities/props'
8
+ import { buildHtmlProps } from '../utilities/props'
9
9
 
10
10
  type FormPillProps = {
11
11
  className?: string,
@@ -18,9 +18,6 @@ type FormPillProps = {
18
18
  avatarUrl?: string,
19
19
  size?: string,
20
20
  textTransform?: 'none' | 'lowercase',
21
- color?: "primary" | "neutral",
22
- data?: {[key: string]: string},
23
- tabIndex?: number,
24
21
  closeProps?: {
25
22
  onClick?: React.MouseEventHandler<HTMLSpanElement>,
26
23
  onMouseDown?: React.MouseEventHandler<HTMLSpanElement>,
@@ -39,26 +36,20 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
39
36
  closeProps = {},
40
37
  size = '',
41
38
  textTransform = 'none',
42
- color = "primary",
43
- data = {},
44
- tabIndex,
45
39
  } = props
46
40
  const css = classnames(
47
- `pb_form_pill_kit_${color}`,
41
+ `pb_form_pill_kit_${'primary'}`,
48
42
  globalProps(props),
49
43
  className,
50
44
  size === 'small' ? 'small' : null,
51
45
  textTransform,
52
46
  )
53
47
 
54
- const dataProps = buildDataProps(data)
55
48
  const htmlProps = buildHtmlProps(htmlOptions)
56
49
 
57
50
  return (
58
51
  <div className={css}
59
52
  id={id}
60
- tabIndex={tabIndex}
61
- {...dataProps}
62
53
  {...htmlProps}
63
54
  >
64
55
  {name &&
@@ -1,4 +1,4 @@
1
- <%= content_tag(:div, id: object.id, data: object.data, class: object.classname + object.size_class, tabindex: object.tabindex, **combined_html_options) do %>
1
+ <%= content_tag(:div, id: object.id, data: object.data, class: object.classname + object.size_class, **combined_html_options) do %>
2
2
  <% if object.name.present? %>
3
3
  <%= pb_rails("avatar", props: { name: object.name, image_url: object.avatar_url, size: "xs" }) %>
4
4
  <%= pb_rails("title", props: { text: object.name, size: 4, classname: "pb_form_pill_text" }) %>
@@ -11,13 +11,9 @@ module Playbook
11
11
  prop :text_transform, type: Playbook::Props::Enum,
12
12
  values: %w[none lowercase],
13
13
  default: "none"
14
- prop :color, type: Playbook::Props::Enum,
15
- values: %w[primary neutral],
16
- default: "primary"
17
- prop :tabindex
18
14
 
19
15
  def classname
20
- generate_classname("pb_form_pill_kit", color, name, text, text_transform)
16
+ generate_classname("pb_form_pill_kit", "primary", name, text, text_transform)
21
17
  end
22
18
 
23
19
  def display_text
@@ -33,7 +33,7 @@ type TableProps = {
33
33
  verticalBorder?: boolean,
34
34
  } & GlobalProps
35
35
 
36
- const Table = (props: TableProps) => {
36
+ const Table = (props: TableProps): React.ReactElement => {
37
37
  const {
38
38
  aria = {},
39
39
  children,
@@ -1,19 +1,19 @@
1
1
  import PbEnhancedElement from '../pb_enhanced_element'
2
2
 
3
3
  export default class PbTable extends PbEnhancedElement {
4
- static get selector() {
4
+ static get selector(): string {
5
5
  return '.table-responsive-collapse'
6
6
  }
7
7
 
8
- connect() {
8
+ connect(): void {
9
9
  const tables = document.querySelectorAll('.table-responsive-collapse');
10
10
 
11
11
  // Each Table
12
12
  [].forEach.call(tables, (table: HTMLTableElement) => {
13
13
  // Header Titles
14
- let headers: string[] = [];
14
+ const headers: string[] = [];
15
15
  [].forEach.call(table.querySelectorAll('th'), (header: HTMLTableCellElement) => {
16
- let colSpan = header.colSpan
16
+ const colSpan = header.colSpan
17
17
  for (let i = 0; i < colSpan; i++) {
18
18
  headers.push(header.textContent.replace(/\r?\n|\r/, ''));
19
19
  }
@@ -17,7 +17,7 @@ type TableBodyPropTypes = {
17
17
  tag?: "table" | "div";
18
18
  };
19
19
 
20
- const TableBody = (props: TableBodyPropTypes) => {
20
+ const TableBody = (props: TableBodyPropTypes): React.ReactElement => {
21
21
  const {
22
22
  aria = {},
23
23
  children,
@@ -18,7 +18,7 @@ type TableCellPropTypes = {
18
18
  text?: string
19
19
  };
20
20
 
21
- const TableCell = (props: TableCellPropTypes) => {
21
+ const TableCell = (props: TableCellPropTypes): React.ReactElement => {
22
22
  const {
23
23
  aria = {},
24
24
  children,
@@ -17,7 +17,7 @@ type TableHeadPropTypes = {
17
17
  tag?: "table" | "div";
18
18
  };
19
19
 
20
- const TableHead = (props: TableHeadPropTypes) => {
20
+ const TableHead = (props: TableHeadPropTypes): React.ReactElement => {
21
21
  const {
22
22
  aria = {},
23
23
  children,
@@ -18,7 +18,7 @@ type TableHeaderPropTypes = {
18
18
  text?: string;
19
19
  };
20
20
 
21
- const TableHeader = (props: TableHeaderPropTypes) => {
21
+ const TableHeader = (props: TableHeaderPropTypes): React.ReactElement => {
22
22
  const {
23
23
  aria = {},
24
24
  children,
@@ -19,7 +19,7 @@ type TableRowPropTypes = {
19
19
  tag?: "table" | "div";
20
20
  };
21
21
 
22
- const TableRow = (props: TableRowPropTypes) => {
22
+ const TableRow = (props: TableRowPropTypes): React.ReactElement => {
23
23
  const {
24
24
  aria = {},
25
25
  children,
@@ -1,3 +1,5 @@
1
+ /* eslint-disable react/no-multi-comp */
2
+
1
3
  import React from "react";
2
4
  import { ensureAccessible, renderKit, render, screen } from "../utilities/test-utils"
3
5
 
@@ -107,7 +107,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
107
107
  required={required}
108
108
  type={type}
109
109
  value={value}
110
- />)
110
+ />)
111
111
  )
112
112
 
113
113
  const addOnInput = (
@@ -5,12 +5,12 @@ import TextInput from '../../pb_text_input/_text_input'
5
5
  import Title from '../../pb_title/_title'
6
6
 
7
7
  const TextInputDefault = (props) => {
8
+ const [firstName, setFirstName] = useState('')
8
9
  const handleOnChangeFirstName = ({ target }) => {
9
10
  setFirstName(target.value)
10
11
  }
11
12
  const ref = React.createRef()
12
13
 
13
- const [firstName, setFirstName] = useState('')
14
14
  const [formFields, setFormFields] = useState({
15
15
  firstName: 'Jane',
16
16
  lastName: 'Doe',
@@ -52,14 +52,15 @@ const Textarea = ({
52
52
  label,
53
53
  maxCharacters,
54
54
  name,
55
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
55
56
  onChange = () => {},
56
57
  placeholder,
57
58
  required,
58
59
  rows = 4,
59
60
  value,
60
61
  ...props
61
- }: TextareaProps, ref: any) => {
62
- ref = useRef<HTMLTextAreaElement>(null)
62
+ }: TextareaProps) => {
63
+ const ref = useRef<HTMLTextAreaElement>(null)
63
64
  useEffect(() => {
64
65
  if (ref.current && resize === 'auto') {
65
66
  PbTextarea.addMatch(ref.current)
@@ -71,58 +72,75 @@ const Textarea = ({
71
72
  const resizeClass = `resize_${resize}`
72
73
  const classes = classnames('pb_textarea_kit', errorClass, inlineClass, resizeClass, globalProps(props), className)
73
74
  const noCount = typeof characterCount !== 'undefined'
74
- const ariaProps: {[key: string]: any} = buildAriaProps(aria)
75
- const dataProps: {[key: string]: any} = buildDataProps(data)
75
+ const ariaProps: {[key: string]: string} = buildAriaProps(aria)
76
+ const dataProps: {[key: string]: string} = buildDataProps(data)
76
77
  const htmlProps = buildHtmlProps(htmlOptions)
77
- const characterCounter = () => {
78
- return maxCharacters && characterCount ? `${checkIfZero(characterCount)} / ${maxCharacters}` : `${checkIfZero(characterCount)}`
79
- }
80
-
81
78
  const checkIfZero = (characterCount: string | number) => {
82
79
  return characterCount == 0 ? characterCount.toString() : characterCount
83
80
  }
81
+ const characterCounter = () => {
82
+ return maxCharacters && characterCount ? `${checkIfZero(characterCount)} / ${maxCharacters}` : `${checkIfZero(characterCount)}`
83
+ }
84
84
 
85
85
  return (
86
86
  <div
87
- {...ariaProps}
88
- {...dataProps}
89
- {...htmlProps}
90
- className={classes}
87
+ {...ariaProps}
88
+ {...dataProps}
89
+ {...htmlProps}
90
+ className={classes}
91
91
  >
92
92
  <Caption text={label} />
93
93
  {children || (
94
94
  <textarea
95
- className="pb_textarea_kit"
96
- disabled={disabled}
97
- name={name}
98
- onChange={onChange}
99
- placeholder={placeholder}
100
- ref={ref}
101
- required={required}
102
- rows={rows}
103
- value={value}
104
- {...props}
95
+ className="pb_textarea_kit"
96
+ disabled={disabled}
97
+ name={name}
98
+ onChange={onChange}
99
+ placeholder={placeholder}
100
+ ref={ref}
101
+ required={required}
102
+ rows={rows}
103
+ value={value}
104
+ {...props}
105
105
  />
106
106
  )}
107
107
 
108
108
  {error ? (
109
109
  <>
110
110
  {characterCount ? (
111
- <Flex spacing="between" vertical="center">
111
+ <Flex
112
+ spacing="between"
113
+ vertical="center"
114
+ >
112
115
  <FlexItem>
113
- <Body margin="none" status="negative" text={error} />
116
+ <Body
117
+ margin="none"
118
+ status="negative"
119
+ text={error}
120
+ />
114
121
  </FlexItem>
115
122
  <FlexItem>
116
- <Caption margin="none" size="xs" text={characterCounter()} />
123
+ <Caption
124
+ margin="none"
125
+ size="xs"
126
+ text={characterCounter()}
127
+ />
117
128
  </FlexItem>
118
129
  </Flex>
119
130
  ) : (
120
- <Body status="negative" text={error} />
131
+ <Body
132
+ status="negative"
133
+ text={error}
134
+ />
121
135
  )}
122
136
  </>
123
137
  ) : (
124
138
  noCount && (
125
- <Caption margin="none" size="xs" text={characterCounter()} />
139
+ <Caption
140
+ margin="none"
141
+ size="xs"
142
+ text={characterCounter()}
143
+ />
126
144
  )
127
145
  )}
128
146
  </div>
@@ -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,
@@ -26,7 +26,7 @@ const TimelineItem = ({
26
26
  iconColor = 'default',
27
27
  lineStyle = 'solid',
28
28
  ...props
29
- }: ItemProps) => {
29
+ }: ItemProps): React.ReactElement => {
30
30
  const timelineItemCss = buildCss('pb_timeline_item_kit', lineStyle)
31
31
 
32
32
  const htmlProps = buildHtmlProps(htmlOptions)
@@ -27,7 +27,7 @@ const Timeline = ({
27
27
  orientation = 'horizontal',
28
28
  showDate = false,
29
29
  ...props
30
- }: TimelineProps) => {
30
+ }: TimelineProps): React.ReactElement => {
31
31
  const ariaProps = buildAriaProps(aria)
32
32
  const dataProps = buildDataProps(data)
33
33
  const htmlProps = buildHtmlProps(htmlOptions)
@@ -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';