playbook_ui 10.23.0.pre.alpha2 → 10.23.0.pre.cachetest

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +0 -1
  3. data/app/pb_kits/playbook/index.js +3 -0
  4. data/app/pb_kits/playbook/pb_avatar/{_avatar.tsx → _avatar.jsx} +14 -13
  5. data/app/pb_kits/playbook/pb_avatar/_avatar.scss +2 -2
  6. data/app/pb_kits/playbook/pb_avatar/avatar.rb +1 -1
  7. data/app/pb_kits/playbook/pb_avatar/avatar.test.js +1 -1
  8. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +1 -1
  9. data/app/pb_kits/playbook/pb_background/_background.jsx +3 -8
  10. data/app/pb_kits/playbook/pb_background/_background.scss +8 -24
  11. data/app/pb_kits/playbook/pb_background/background.rb +6 -6
  12. data/app/pb_kits/playbook/pb_background/docs/_background_image.html.erb +2 -50
  13. data/app/pb_kits/playbook/pb_background/docs/_background_image.jsx +28 -71
  14. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +1 -5
  15. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +0 -1
  16. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.jsx +1 -1
  17. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.jsx +1 -1
  18. data/app/pb_kits/playbook/pb_button/_button.jsx +4 -8
  19. data/app/pb_kits/playbook/pb_button/_button.scss +1 -18
  20. data/app/pb_kits/playbook/pb_button/button.rb +3 -13
  21. data/app/pb_kits/playbook/pb_button/button.test.js +0 -13
  22. data/app/pb_kits/playbook/pb_button/docs/_button_accessibility.html.erb +1 -1
  23. data/app/pb_kits/playbook/pb_button/docs/example.yml +0 -4
  24. data/app/pb_kits/playbook/pb_button/docs/index.js +0 -2
  25. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.jsx +1 -1
  26. data/app/pb_kits/playbook/pb_caption/_caption.jsx +1 -1
  27. data/app/pb_kits/playbook/pb_card/_card.jsx +1 -1
  28. data/app/pb_kits/playbook/pb_card/card.html.erb +1 -1
  29. data/app/pb_kits/playbook/pb_card/card.rb +0 -88
  30. data/app/pb_kits/playbook/pb_card/card_body.rb +1 -1
  31. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +1 -1
  32. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +0 -3
  33. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +0 -1
  34. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +1 -1
  35. data/app/pb_kits/playbook/pb_collapsible/_collapsible.jsx +1 -1
  36. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx +1 -1
  37. data/app/pb_kits/playbook/pb_currency/_currency.jsx +3 -24
  38. data/app/pb_kits/playbook/pb_currency/currency.rb +3 -12
  39. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +1 -1
  40. data/app/pb_kits/playbook/pb_currency/docs/example.yml +0 -2
  41. data/app/pb_kits/playbook/pb_currency/docs/index.js +0 -1
  42. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +1 -1
  43. data/app/pb_kits/playbook/pb_dialog/_dialog.jsx +1 -1
  44. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.jsx +1 -1
  45. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.jsx +1 -1
  46. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.jsx +1 -1
  47. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx +1 -1
  48. data/app/pb_kits/playbook/pb_file_upload/_file_upload.jsx +10 -17
  49. data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.jsx +1 -1
  50. data/app/pb_kits/playbook/pb_flex/_flex.jsx +1 -1
  51. data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +1 -1
  52. data/app/pb_kits/playbook/pb_flex/docs/_flex_align.jsx +1 -1
  53. data/app/pb_kits/playbook/pb_flex/flex_item.rb +24 -2
  54. data/app/pb_kits/playbook/pb_form_group/_form_group.jsx +1 -1
  55. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +0 -2
  56. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -2
  57. data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +0 -3
  58. data/app/pb_kits/playbook/pb_gauge/gauge.rb +0 -1
  59. data/app/pb_kits/playbook/pb_highlight/_highlight.jsx +1 -1
  60. data/app/pb_kits/playbook/pb_icon/_icon.jsx +1 -1
  61. data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
  62. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.jsx +1 -1
  63. data/app/pb_kits/playbook/pb_image/{_image.tsx → _image.jsx} +15 -11
  64. data/app/pb_kits/playbook/pb_image/_image.scss +3 -3
  65. data/app/pb_kits/playbook/pb_image/docs/{_default_image.tsx → _default_image.jsx} +1 -1
  66. data/app/pb_kits/playbook/pb_image/docs/index.js +4 -4
  67. data/app/pb_kits/playbook/pb_image/image.rb +1 -1
  68. data/app/pb_kits/playbook/pb_image/image.test.js +1 -1
  69. data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +1 -1
  70. data/app/pb_kits/playbook/pb_layout/_layout.jsx +1 -1
  71. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +1 -5
  72. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +0 -1
  73. data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +0 -1
  74. data/app/pb_kits/playbook/pb_list/_list.jsx +1 -1
  75. data/app/pb_kits/playbook/pb_list/_list_item.jsx +1 -1
  76. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +1 -1
  77. data/app/pb_kits/playbook/pb_online_status/{_online_status.tsx → _online_status.jsx} +6 -4
  78. data/app/pb_kits/playbook/pb_passphrase/_passphrase.jsx +1 -2
  79. data/app/pb_kits/playbook/pb_pill/_pill.jsx +1 -1
  80. data/app/pb_kits/playbook/pb_popover/_popover.jsx +5 -3
  81. data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +7 -7
  82. data/app/pb_kits/playbook/pb_popover/index.js +9 -4
  83. data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -1
  84. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +1 -1
  85. data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +1 -1
  86. data/app/pb_kits/playbook/pb_radio/_radio.jsx +1 -1
  87. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +93 -83
  88. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
  89. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +8 -15
  90. data/app/pb_kits/playbook/pb_table/_table.jsx +1 -1
  91. data/app/pb_kits/playbook/pb_table/_table_row.jsx +1 -1
  92. data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +1 -1
  93. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -1
  94. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +0 -14
  95. data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +0 -1
  96. data/app/pb_kits/playbook/pb_time/_time.jsx +1 -1
  97. data/app/pb_kits/playbook/pb_title/_title.jsx +1 -1
  98. data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +1 -1
  99. data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +1 -1
  100. data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +1 -1
  101. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.jsx +1 -1
  102. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.jsx +1 -1
  103. data/app/pb_kits/playbook/plugins/pb_chart.js +4 -8
  104. data/app/pb_kits/playbook/types.js +4 -0
  105. data/app/pb_kits/playbook/utilities/globalProps.js +97 -0
  106. data/app/pb_kits/playbook/utilities/{props.ts → props.js} +7 -9
  107. data/lib/playbook/classnames.rb +0 -11
  108. data/lib/playbook/kit_base.rb +0 -22
  109. data/lib/playbook/version.rb +2 -2
  110. metadata +9 -42
  111. data/app/pb_kits/playbook/pb_background/docs/_background_image.md +0 -1
  112. data/app/pb_kits/playbook/pb_button/docs/_button_form.html.erb +0 -1
  113. data/app/pb_kits/playbook/pb_button/docs/_button_form.jsx +0 -14
  114. data/app/pb_kits/playbook/pb_button/docs/_button_size.html.erb +0 -3
  115. data/app/pb_kits/playbook/pb_button/docs/_button_size.jsx +0 -26
  116. data/app/pb_kits/playbook/pb_button/docs/_button_size.md +0 -1
  117. data/app/pb_kits/playbook/pb_currency/currency.test.js +0 -35
  118. data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.html.erb +0 -27
  119. data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.jsx +0 -44
  120. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +0 -215
  121. data/app/pb_kits/playbook/pb_file_upload/fileupload.test.js +0 -40
  122. data/app/pb_kits/playbook/utilities/_align_content.scss +0 -29
  123. data/app/pb_kits/playbook/utilities/_align_items.scss +0 -35
  124. data/app/pb_kits/playbook/utilities/_align_self.scss +0 -29
  125. data/app/pb_kits/playbook/utilities/_flex.scss +0 -15
  126. data/app/pb_kits/playbook/utilities/_flex_direction.scss +0 -19
  127. data/app/pb_kits/playbook/utilities/_flex_grow.scss +0 -9
  128. data/app/pb_kits/playbook/utilities/_flex_shrink.scss +0 -9
  129. data/app/pb_kits/playbook/utilities/_flex_wrap.scss +0 -14
  130. data/app/pb_kits/playbook/utilities/_flexbox.scss +0 -11
  131. data/app/pb_kits/playbook/utilities/_justify_content.scss +0 -23
  132. data/app/pb_kits/playbook/utilities/_justify_self.scss +0 -19
  133. data/app/pb_kits/playbook/utilities/_order.scss +0 -55
  134. data/app/pb_kits/playbook/utilities/globalProps.ts +0 -274
  135. data/lib/playbook/align_content.rb +0 -29
  136. data/lib/playbook/align_items.rb +0 -29
  137. data/lib/playbook/align_self.rb +0 -29
  138. data/lib/playbook/flex.rb +0 -29
  139. data/lib/playbook/flex_direction.rb +0 -29
  140. data/lib/playbook/flex_grow.rb +0 -29
  141. data/lib/playbook/flex_shrink.rb +0 -29
  142. data/lib/playbook/flex_wrap.rb +0 -29
  143. data/lib/playbook/justify_content.rb +0 -29
  144. data/lib/playbook/justify_self.rb +0 -29
  145. data/lib/playbook/order.rb +0 -29
@@ -12,7 +12,6 @@ type GaugeProps = {
12
12
  aria: Object,
13
13
  className?: string,
14
14
  chartData?: array,
15
- dark?: Boolean,
16
15
  data?: Object,
17
16
  disableAnimation: boolean,
18
17
  fullCircle: boolean,
@@ -34,7 +33,6 @@ const Gauge = (props: GaugeProps) => {
34
33
  aria = {},
35
34
  className,
36
35
  chartData = [{ name: 'Name', value: 0 }],
37
- dark = false,
38
36
  data = {},
39
37
  disableAnimation = false,
40
38
  fullCircle = false,
@@ -69,7 +67,6 @@ const Gauge = (props: GaugeProps) => {
69
67
  id: id,
70
68
  chartData: formattedChartData,
71
69
  circumference: fullCircle ? [0, 360] : [-100, 100],
72
- dark,
73
70
  disableAnimation: disableAnimation,
74
71
  height: height,
75
72
  min: min,
@@ -32,7 +32,6 @@ module Playbook
32
32
  id: id,
33
33
  chartData: chart_data_formatted,
34
34
  circumference: full_circle ? [0, 360] : [-100, 100],
35
- dark: dark ? "dark" : "",
36
35
  disableAnimation: disable_animation,
37
36
  height: height,
38
37
  min: min,
@@ -3,7 +3,7 @@
3
3
  import Highlighter from 'react-highlight-words'
4
4
  import React from 'react'
5
5
  import classnames from 'classnames'
6
- import { globalProps } from '../utilities/globalProps'
6
+ import { globalProps } from '../utilities/globalProps.js'
7
7
 
8
8
  type HighlightProps = {
9
9
  className?: string,
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { buildAriaProps, buildDataProps } from '../utilities/props'
6
- import { globalProps } from '../utilities/globalProps'
6
+ import { globalProps } from '../utilities/globalProps.js'
7
7
 
8
8
  type IconProps = {
9
9
  aria?: object,
@@ -73,7 +73,7 @@ module Playbook
73
73
 
74
74
  def render_svg(path)
75
75
  if File.extname(path) == ".svg"
76
- doc = Nokogiri::XML(URI.open(path)) # rubocop:disable Security/Open
76
+ doc = Nokogiri::XML(open(path)) # rubocop:disable Security/Open
77
77
  svg = doc.at_css "svg"
78
78
  svg["class"] = "pb_custom_icon " + object.custom_icon_classname
79
79
  raw doc
@@ -4,7 +4,7 @@ import React from 'react'
4
4
  import classnames from 'classnames'
5
5
 
6
6
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
- import { globalProps } from '../utilities/globalProps'
7
+ import { globalProps } from '../utilities/globalProps.js'
8
8
 
9
9
  import Body from '../pb_body/_body'
10
10
  import Caption from '../pb_caption/_caption'
@@ -1,22 +1,24 @@
1
+ /* @flow */
2
+
1
3
  import React from 'react'
2
4
  import classnames from 'classnames'
3
- import { GlobalProps, globalProps } from '../utilities/globalProps'
5
+ import { globalProps } from '../utilities/globalProps.js'
4
6
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
5
7
 
6
- type ImageType = {
8
+ type ImageProps = {
7
9
  alt?: string,
8
- aria?: {[key: string]: string},
10
+ aria?: object,
9
11
  className?: string,
10
- data?: {[key: string]: string},
12
+ data?: object,
11
13
  id?: string,
12
- onError?: () => void,
13
- size?: "xs" | "sm" | "md" | "lg" | "xl",
14
+ onError?: () => {},
15
+ size: "xs" | "sm" | "md" | "lg" | "xl",
14
16
  rounded?: boolean,
15
- transition?: "blur" | "fade" | "scale",
16
- url?: string,
17
- } & GlobalProps
17
+ transition: "blur" | "fade" | "scale",
18
+ url: string,
19
+ }
18
20
 
19
- const Image = (props: ImageType) => {
21
+ const Image = (props: ImageProps) => {
20
22
  const {
21
23
  alt = '',
22
24
  aria = {},
@@ -32,7 +34,7 @@ const Image = (props: ImageType) => {
32
34
 
33
35
  const ariaProps = buildAriaProps(aria)
34
36
  const classes = classnames(
35
- buildCss('pb_image_kit', size ? `size_${size}` : null),
37
+ buildCss('pb_image_kit', size),
36
38
  'lazyload',
37
39
  transition,
38
40
  { rounded },
@@ -50,7 +52,9 @@ const Image = (props: ImageType) => {
50
52
  data-src={url}
51
53
  id={id}
52
54
  onError={onError}
55
+ rounded={+rounded}
53
56
  src={url}
57
+ transition={transition}
54
58
  />
55
59
  )
56
60
  }
@@ -14,7 +14,7 @@ $image-sizes: (
14
14
  object-fit: cover;
15
15
 
16
16
  @each $name, $size in $image-sizes {
17
- &[class*=size_#{$name}] {
17
+ &[class*=_#{$name}] {
18
18
  width: $size;
19
19
  height: $size;
20
20
  object-fit: cover;
@@ -35,7 +35,7 @@ $image-sizes: (
35
35
  transition: opacity 300ms ease-in;
36
36
  }
37
37
  }
38
-
38
+
39
39
  &.blur {
40
40
  filter: blur(5px);
41
41
  &.lazyloaded {
@@ -44,7 +44,7 @@ $image-sizes: (
44
44
  transition: filter 300ms ease-in;
45
45
  }
46
46
  }
47
-
47
+
48
48
  &.scale {
49
49
  opacity: 0;
50
50
  transform: scale(0.9);
@@ -2,7 +2,7 @@ import React from 'react'
2
2
 
3
3
  import Image from '../_image'
4
4
 
5
- const DefaultImage = (props: any) => {
5
+ const DefaultImage = (props) => {
6
6
  return (
7
7
  <>
8
8
  <br />
@@ -1,4 +1,4 @@
1
- export { default as DefaultImage } from './_default_image'
2
- export { default as RoundedImage } from './_rounded_image'
3
- export { default as CustomErrorImage } from './_custom_error_image'
4
- export { default as TransitionImage } from './_transition_image'
1
+ export { default as DefaultImage } from './_default_image.jsx'
2
+ export { default as RoundedImage } from './_rounded_image.jsx'
3
+ export { default as CustomErrorImage } from './_custom_error_image.jsx'
4
+ export { default as TransitionImage } from './_transition_image.jsx'
@@ -27,7 +27,7 @@ module Playbook
27
27
  end
28
28
 
29
29
  def size_class
30
- size == "none" ? nil : "_size_#{size}"
30
+ size == "none" ? nil : "_#{size}"
31
31
  end
32
32
 
33
33
  def transition_class
@@ -26,7 +26,7 @@ test('default classname', () => {
26
26
 
27
27
  test('size = xs', () => {
28
28
  const kit = renderKit(Image, props, { size: 'xs' })
29
- expect(kit).toHaveClass('pb_image_kit_size_xs lazyload')
29
+ expect(kit).toHaveClass('pb_image_kit_xs lazyload')
30
30
  })
31
31
 
32
32
  test('transition = blur', () => {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
- import { globalProps } from '../utilities/globalProps'
5
+ import { globalProps } from '../utilities/globalProps.js'
6
6
 
7
7
  import { buildAriaProps, buildDataProps } from '../utilities/props'
8
8
 
@@ -4,7 +4,7 @@ import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
6
 
7
- import { globalProps } from '../utilities/globalProps'
7
+ import { globalProps } from '../utilities/globalProps.js'
8
8
 
9
9
  type LayoutPropTypes = {
10
10
  aria?: object,
@@ -3,12 +3,11 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
 
6
- import { globalProps } from '../utilities/globalProps'
6
+ import { globalProps } from '../utilities/globalProps.js'
7
7
  import pbChart from '../plugins/pb_chart'
8
8
 
9
9
  type LineGraphProps = {
10
10
  axisTitle?: string,
11
- dark?: Boolean,
12
11
  xAxisCategories: array,
13
12
  yAxisMin: number,
14
13
  yAxisMax: number,
@@ -32,7 +31,6 @@ type LineGraphProps = {
32
31
  export default class LineGraph extends React.Component<LineGraphProps> {
33
32
  static defaultProps = {
34
33
  className: 'pb_bar_graph',
35
- dark: false,
36
34
  gradient: false,
37
35
  type: 'line',
38
36
  legend: false,
@@ -42,7 +40,6 @@ export default class LineGraph extends React.Component<LineGraphProps> {
42
40
  componentDidMount() {
43
41
  const {
44
42
  axisTitle,
45
- dark,
46
43
  xAxisCategories,
47
44
  yAxisMin,
48
45
  yAxisMax,
@@ -63,7 +60,6 @@ export default class LineGraph extends React.Component<LineGraphProps> {
63
60
  axisTitle: axisTitle,
64
61
  chartData: chartData,
65
62
  colors: colors,
66
- dark,
67
63
  id: id,
68
64
  pointStart: pointStart,
69
65
  subtitle: subTitle,
@@ -11,7 +11,6 @@ const LineGraphDefault = (props) => (
11
11
  <LineGraph
12
12
  axisTitle="Number of Employees"
13
13
  chartData={data}
14
- height="300px"
15
14
  id="line-fixed-height"
16
15
  title="Fixed Height (300px)"
17
16
  xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']}
@@ -32,7 +32,6 @@ module Playbook
32
32
  id: id,
33
33
  className: classname,
34
34
  chartData: chart_data,
35
- dark: dark ? "dark" : "",
36
35
  type: chart_type,
37
36
  title: title,
38
37
  subtitle: subtitle,
@@ -3,7 +3,7 @@
3
3
  import React, { type Node } from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
- import { globalProps } from '../utilities/globalProps'
6
+ import { globalProps } from '../utilities/globalProps.js'
7
7
 
8
8
  type ListProps = {
9
9
  aria?: object,
@@ -3,7 +3,7 @@
3
3
  import React, { type Node } from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
- import { globalProps } from '../utilities/globalProps'
6
+ import { globalProps } from '../utilities/globalProps.js'
7
7
 
8
8
  type ListItemProps = {
9
9
  aria?: object,
@@ -4,7 +4,7 @@ import React from 'react'
4
4
  import classnames from 'classnames'
5
5
 
6
6
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
- import { globalProps } from '../utilities/globalProps'
7
+ import { globalProps } from '../utilities/globalProps.js'
8
8
 
9
9
  import Avatar from '../pb_avatar/_avatar'
10
10
 
@@ -1,16 +1,18 @@
1
+ /* @flow */
2
+
1
3
  import React from 'react'
2
4
  import classnames from 'classnames'
3
- import { GlobalProps, globalProps } from '../utilities/globalProps'
5
+ import { globalProps } from '../utilities/globalProps.js'
4
6
 
5
7
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
8
 
7
9
  type OnlineStatusProps = {
8
- aria?: {[key: string]: string},
10
+ aria?: object,
9
11
  className?: string,
10
- data?: {[key: string]: string | number},
12
+ data?: object,
11
13
  id?: string,
12
14
  status?: "online" | "offline" | "away",
13
- } & GlobalProps
15
+ }
14
16
 
15
17
  const OnlineStatus = (props: OnlineStatusProps) => {
16
18
  const {
@@ -1,11 +1,10 @@
1
1
  /* @flow */
2
- /* eslint-disable react-hooks/rules-of-hooks */
3
2
 
4
3
  import React, { useCallback, useEffect, useMemo, useState } from 'react'
5
4
  import classnames from 'classnames'
6
5
 
7
6
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
8
- import { globalProps } from '../utilities/globalProps'
7
+ import { globalProps } from '../utilities/globalProps.js'
9
8
 
10
9
  import useZxcvbn from './useZxcvbn'
11
10
  import useHaveIBeenPwned from './useHaveIBeenPwned'
@@ -5,7 +5,7 @@ import React from 'react'
5
5
  import classnames from 'classnames'
6
6
  import Title from '../pb_title/_title.jsx'
7
7
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
8
- import { globalProps } from '../utilities/globalProps'
8
+ import { globalProps } from '../utilities/globalProps.js'
9
9
 
10
10
  type PillProps = {
11
11
  aria?: object,
@@ -13,7 +13,7 @@ import {
13
13
  import { buildAriaProps, buildCss, buildDataProps, noop } from '../utilities/props'
14
14
 
15
15
  import classnames from 'classnames'
16
- import { globalProps } from '../utilities/globalProps'
16
+ import { globalProps } from '../utilities/globalProps.js'
17
17
 
18
18
  type PbPopoverProps = {
19
19
  aria?: object,
@@ -150,14 +150,16 @@ export default class PbReactPopover extends React.Component<PbPopoverProps> {
150
150
  const targetIsReference =
151
151
  target.closest('.pb_popover_reference_wrapper') !== null
152
152
 
153
+ if (targetIsReference) return
154
+
153
155
  switch (closeOnClick) {
154
156
  case 'outside':
155
- if (!targetIsPopover || targetIsReference) {
157
+ if (!targetIsPopover) {
156
158
  shouldClosePopover(true)
157
159
  }
158
160
  break
159
161
  case 'inside':
160
- if (targetIsPopover || targetIsReference) {
162
+ if (targetIsPopover) {
161
163
  shouldClosePopover(true)
162
164
  }
163
165
  break
@@ -1,23 +1,23 @@
1
1
  <%= pb_rails("flex", props: {classname: "flex-container", spacing: "between"}) do %>
2
2
  <span>
3
- <%= pb_rails("button", props: { text: "Click Inside", variant: "secondary", id: "inside-popover-1" }) %>
3
+ <%= pb_rails("button", props: { text: "Click Inside", variant: "secondary", id: 'inside-popover-1' }) %>
4
4
  <%= pb_rails("popover", props: {
5
5
  close_on_click: "inside",
6
6
  trigger_element_id: "inside-popover-1",
7
7
  tooltip_id: "inside-tooltip-1",
8
- position: "bottom",
8
+ position: 'bottom',
9
9
  offset: true
10
10
  }) do %>
11
11
  Click on me!
12
12
  <% end %>
13
13
  </span>
14
14
  <span>
15
- <%= pb_rails("button", props: { text: "Click Outside", variant: "secondary", id: "outside-popover-1" }) %>
15
+ <%= pb_rails("button", props: { text: "Click Outside", variant: "secondary", id: 'outside-popover-1' }) %>
16
16
  <%= pb_rails("popover", props: {
17
17
  close_on_click: "outside",
18
18
  trigger_element_id: "outside-popover-1",
19
19
  tooltip_id: "outside-tooltip-1",
20
- position: "left",
20
+ position: 'left',
21
21
  offset: true
22
22
  }) do %>
23
23
  Click anywhere but me!
@@ -27,16 +27,16 @@
27
27
  <%= pb_rails("button", props: {
28
28
  text: "Click Anywhere",
29
29
  variant: "secondary",
30
- id: "any-popover-1"
30
+ id: 'any-popover-1'
31
31
  }) %>
32
32
  <%= pb_rails("popover", props: {
33
33
  close_on_click: "any",
34
34
  trigger_element_id: "any-popover-1",
35
35
  tooltip_id: "any-tooltip-1",
36
- position: "top",
36
+ position: 'top',
37
37
  offset: true
38
38
  }) do %>
39
39
  Click anything!
40
40
  <% end %>
41
41
  </span>
42
- <% end %>
42
+ <% end %>
@@ -36,14 +36,15 @@ export default class PbPopover extends PbEnhancedElement {
36
36
  }
37
37
 
38
38
  setTimeout(() => {
39
- this.toggleTooltip()
40
39
  this.popper.update()
40
+ this.toggleTooltip()
41
41
  }, 0)
42
42
  })
43
43
  }
44
44
 
45
45
  checkCloseTooltip() {
46
46
  document.querySelector('body').addEventListener('click', ({ target }) => {
47
+ const isTriggerElement = target.closest(`#${this.triggerElementId}`) !== null
47
48
  const isTooltipElement = target.closest(`#${this.tooltipId}`) !== null
48
49
 
49
50
  switch (this.closeOnClick) {
@@ -51,17 +52,21 @@ export default class PbPopover extends PbEnhancedElement {
51
52
  this.hideTooltip()
52
53
  break
53
54
  case 'outside':
54
- if (!isTooltipElement) {
55
+ if (isTooltipElement) {
56
+ this.checkCloseTooltip()
57
+ } else {
55
58
  this.hideTooltip()
56
59
  }
57
60
  break
58
61
  case 'inside':
59
- if (isTooltipElement) {
62
+ if (isTooltipElement || isTriggerElement) {
60
63
  this.hideTooltip()
64
+ } else {
65
+ this.checkCloseTooltip()
61
66
  }
62
67
  break
63
68
  }
64
- }, true)
69
+ }, { once: true })
65
70
  }
66
71
 
67
72
  hideTooltip() {
@@ -3,7 +3,7 @@
3
3
  class: object.classname,
4
4
  data: object.data,
5
5
  id: object.id) do %>
6
- <div class="pb_popover_tooltip hide" id="<%= object.tooltip_id %>" role="tooltip" style="<%= object.z_index_helper %>">
6
+ <div class="pb_popover_tooltip" id="<%= object.tooltip_id %>" role="tooltip" style="<%= object.z_index_helper %>">
7
7
  <div class="pb_popover_body <%= object.width_height_class_helper %> <%= object.popover_spacing_helper %>" style="<%= object.width_height_helper %>">
8
8
  <%= content.presence %>
9
9
  </div>
@@ -2,7 +2,7 @@
2
2
  import React from 'react'
3
3
  import classnames from 'classnames'
4
4
  import { buildCss } from '../utilities/props'
5
- import { globalProps } from '../utilities/globalProps'
5
+ import { globalProps } from '../utilities/globalProps.js'
6
6
 
7
7
  type ProgressSimpleProps = {
8
8
  align?: "left" | "center" | "right",
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { buildCss } from '../utilities/props'
6
- import { globalProps } from '../utilities/globalProps'
6
+ import { globalProps } from '../utilities/globalProps.js'
7
7
 
8
8
  type ProgressStepProps = {
9
9
  className?: string,
@@ -5,7 +5,7 @@ import React, { forwardRef } from 'react'
5
5
  import Body from '../pb_body/_body.jsx'
6
6
  import classnames from 'classnames'
7
7
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
8
- import { globalProps } from '../utilities/globalProps'
8
+ import { globalProps } from '../utilities/globalProps.js'
9
9
 
10
10
  type RadioProps = {
11
11
  aria?: object,