playbook_ui 10.19.0.pre.popover.alpha1 → 10.21.0.pre.alpha.jg1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_background/_background.jsx +7 -2
- data/app/pb_kits/playbook/pb_background/_background.scss +24 -8
- data/app/pb_kits/playbook/pb_background/background.rb +6 -6
- data/app/pb_kits/playbook/pb_background/docs/_background_image.html.erb +50 -2
- data/app/pb_kits/playbook/pb_background/docs/_background_image.jsx +71 -28
- data/app/pb_kits/playbook/pb_background/docs/_background_image.md +1 -0
- data/app/pb_kits/playbook/pb_body/_body.jsx +3 -1
- data/app/pb_kits/playbook/pb_button/_button.jsx +3 -3
- data/app/pb_kits/playbook/pb_button/_button.scss +0 -17
- data/app/pb_kits/playbook/pb_button/button.rb +3 -6
- data/app/pb_kits/playbook/pb_button/button.test.js +0 -13
- data/app/pb_kits/playbook/pb_button/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_button/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_caption/_caption.jsx +2 -1
- data/app/pb_kits/playbook/pb_caption/_caption.scss +7 -0
- data/app/pb_kits/playbook/pb_caption/caption.rb +5 -2
- data/app/pb_kits/playbook/pb_date/_date.jsx +1 -1
- data/app/pb_kits/playbook/pb_date/date.html.erb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.jsx +3 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +1 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +3 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.js +10 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_month_and_year.html.erb +5 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_month_and_year.jsx +18 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_month_and_year.md +1 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_month_and_year_styles.scss +127 -0
- data/app/pb_kits/playbook/pb_image/_image.jsx +12 -14
- data/app/pb_kits/playbook/pb_image/docs/_custom_error_image.html.erb +1 -0
- data/app/pb_kits/playbook/pb_image/docs/_default_image.jsx +48 -35
- data/app/pb_kits/playbook/pb_image/docs/_rounded_image.jsx +46 -35
- data/app/pb_kits/playbook/pb_legend/_legend.jsx +1 -7
- data/app/pb_kits/playbook/pb_legend/_legend.scss +6 -2
- data/app/pb_kits/playbook/pb_legend/docs/_legend_colors.html.erb +4 -0
- data/app/pb_kits/playbook/pb_legend/docs/_legend_colors.jsx +29 -0
- data/app/pb_kits/playbook/pb_legend/docs/_legend_colors.md +2 -0
- data/app/pb_kits/playbook/pb_legend/docs/_legend_default.html.erb +2 -2
- data/app/pb_kits/playbook/pb_legend/docs/_legend_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_legend/docs/example.yml +4 -4
- data/app/pb_kits/playbook/pb_legend/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_legend/legend.rb +1 -2
- data/app/pb_kits/playbook/pb_legend/legend.test.js +29 -0
- data/app/pb_kits/playbook/pb_popover/_popover.jsx +4 -2
- data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +7 -7
- data/app/pb_kits/playbook/pb_popover/index.js +9 -4
- data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -1
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.scss +6 -2
- data/app/pb_kits/playbook/pb_section_separator/_section_separator_mixin.scss +0 -2
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +3 -3
- data/app/pb_kits/playbook/pb_title/_title.jsx +2 -1
- data/app/pb_kits/playbook/pb_title/title.html.erb +2 -3
- data/app/pb_kits/playbook/pb_title/title.rb +5 -2
- data/lib/playbook/version.rb +2 -2
- metadata +11 -5
- data/app/pb_kits/playbook/pb_button/docs/_button_size.html.erb +0 -3
- data/app/pb_kits/playbook/pb_button/docs/_button_size.jsx +0 -26
- data/app/pb_kits/playbook/pb_button/docs/_button_size.md +0 -1
@@ -0,0 +1,127 @@
|
|
1
|
+
@import "../../tokens/colors";
|
2
|
+
|
3
|
+
|
4
|
+
.numInput {
|
5
|
+
border-left: none !important;
|
6
|
+
}
|
7
|
+
|
8
|
+
// Manual Import
|
9
|
+
.flatpickr-monthSelect-months {
|
10
|
+
margin: 10px 1px 3px 1px;
|
11
|
+
flex-wrap: wrap;
|
12
|
+
}
|
13
|
+
|
14
|
+
.flatpickr-monthSelect-month {
|
15
|
+
background: none;
|
16
|
+
border: 1px solid transparent;
|
17
|
+
border-radius: 4px;
|
18
|
+
-webkit-box-sizing: border-box;
|
19
|
+
box-sizing: border-box;
|
20
|
+
color: $text_lt_default;
|
21
|
+
cursor: pointer;
|
22
|
+
display: inline-block;
|
23
|
+
font-weight: 400;
|
24
|
+
margin: 0.5px;
|
25
|
+
justify-content: center;
|
26
|
+
padding: 10px;
|
27
|
+
position: relative;
|
28
|
+
-webkit-box-pack: center;
|
29
|
+
-webkit-justify-content: center;
|
30
|
+
-ms-flex-pack: center;
|
31
|
+
text-align: center;
|
32
|
+
width: 33%;
|
33
|
+
}
|
34
|
+
|
35
|
+
.flatpickr-monthSelect-month.flatpickr-disabled {
|
36
|
+
color: #eee;
|
37
|
+
}
|
38
|
+
|
39
|
+
.flatpickr-monthSelect-month.flatpickr-disabled:hover,
|
40
|
+
.flatpickr-monthSelect-month.flatpickr-disabled:focus {
|
41
|
+
cursor: not-allowed;
|
42
|
+
background: none !important;
|
43
|
+
}
|
44
|
+
|
45
|
+
.flatpickr-monthSelect-theme-dark {
|
46
|
+
background: #3f4458;
|
47
|
+
}
|
48
|
+
|
49
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-current-month input.cur-year {
|
50
|
+
color: #fff;
|
51
|
+
}
|
52
|
+
|
53
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-months .flatpickr-prev-month,
|
54
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-months .flatpickr-next-month {
|
55
|
+
color: #fff;
|
56
|
+
fill: #fff;
|
57
|
+
}
|
58
|
+
|
59
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month {
|
60
|
+
color: rgba(255, 255, 255, 0.95);
|
61
|
+
}
|
62
|
+
|
63
|
+
.flatpickr-monthSelect-month.today {
|
64
|
+
border-color: #959ea9;
|
65
|
+
}
|
66
|
+
|
67
|
+
.flatpickr-monthSelect-month.inRange,
|
68
|
+
.flatpickr-monthSelect-month.inRange.today,
|
69
|
+
.flatpickr-monthSelect-month:hover,
|
70
|
+
.flatpickr-monthSelect-month:focus {
|
71
|
+
background: $active_light;
|
72
|
+
font-weight: $bold;
|
73
|
+
color: $text_lt_default;
|
74
|
+
cursor: pointer;
|
75
|
+
outline: 0;
|
76
|
+
}
|
77
|
+
|
78
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.inRange,
|
79
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:hover,
|
80
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:focus {
|
81
|
+
background: #646c8c;
|
82
|
+
border-color: #646c8c;
|
83
|
+
}
|
84
|
+
|
85
|
+
.flatpickr-monthSelect-month.today:hover,
|
86
|
+
.flatpickr-monthSelect-month.today:focus {
|
87
|
+
background: #959ea9;
|
88
|
+
border-color: #959ea9;
|
89
|
+
color: #fff;
|
90
|
+
}
|
91
|
+
|
92
|
+
.flatpickr-monthSelect-month.selected,
|
93
|
+
.flatpickr-monthSelect-month.startRange,
|
94
|
+
.flatpickr-monthSelect-month.endRange {
|
95
|
+
background-color: $primary;
|
96
|
+
font-weight: $bold;
|
97
|
+
box-shadow: none;
|
98
|
+
color: #fff;
|
99
|
+
border-color: $primary;
|
100
|
+
}
|
101
|
+
|
102
|
+
.flatpickr-monthSelect-month.startRange {
|
103
|
+
border-radius: 50px 0 0 50px;
|
104
|
+
}
|
105
|
+
|
106
|
+
.flatpickr-monthSelect-month.endRange {
|
107
|
+
border-radius: 0 50px 50px 0;
|
108
|
+
}
|
109
|
+
|
110
|
+
.flatpickr-monthSelect-month.startRange.endRange {
|
111
|
+
border-radius: 50px;
|
112
|
+
}
|
113
|
+
|
114
|
+
.flatpickr-monthSelect-month.inRange {
|
115
|
+
border-radius: 0;
|
116
|
+
box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;
|
117
|
+
}
|
118
|
+
|
119
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.selected,
|
120
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.startRange,
|
121
|
+
.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.endRange {
|
122
|
+
background: #80cbc4;
|
123
|
+
-webkit-box-shadow: none;
|
124
|
+
box-shadow: none;
|
125
|
+
color: #fff;
|
126
|
+
border-color: #80cbc4;
|
127
|
+
}
|
@@ -44,20 +44,18 @@ const Image = (props: ImageProps) => {
|
|
44
44
|
const dataProps = buildDataProps(data)
|
45
45
|
|
46
46
|
return (
|
47
|
-
<
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
/>
|
60
|
-
</div>
|
47
|
+
<img
|
48
|
+
{...ariaProps}
|
49
|
+
{...dataProps}
|
50
|
+
alt={alt}
|
51
|
+
className={classes}
|
52
|
+
data-src={url}
|
53
|
+
id={id}
|
54
|
+
onError={onError}
|
55
|
+
rounded={+rounded}
|
56
|
+
src={url}
|
57
|
+
transition={transition}
|
58
|
+
/>
|
61
59
|
)
|
62
60
|
}
|
63
61
|
|
@@ -5,41 +5,54 @@ import Image from '../_image'
|
|
5
5
|
const DefaultImage = (props) => {
|
6
6
|
return (
|
7
7
|
<>
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
8
|
+
<br />
|
9
|
+
<div>
|
10
|
+
<Image
|
11
|
+
alt="picture of a misty forest"
|
12
|
+
size="xs"
|
13
|
+
url="https://unsplash.it/500/400/?image=634"
|
14
|
+
{...props}
|
15
|
+
/>
|
16
|
+
</div>
|
17
|
+
<div>
|
18
|
+
<Image
|
19
|
+
alt="picture of a misty forest"
|
20
|
+
size="sm"
|
21
|
+
url="https://unsplash.it/500/400/?image=634"
|
22
|
+
{...props}
|
23
|
+
/>
|
24
|
+
</div>
|
25
|
+
<div>
|
26
|
+
<Image
|
27
|
+
alt="picture of a misty forest"
|
28
|
+
size="md"
|
29
|
+
url="https://unsplash.it/500/400/?image=634"
|
30
|
+
{...props}
|
31
|
+
/>
|
32
|
+
</div>
|
33
|
+
<div>
|
34
|
+
<Image
|
35
|
+
alt="picture of a misty forest"
|
36
|
+
size="lg"
|
37
|
+
url="https://unsplash.it/500/400/?image=634"
|
38
|
+
{...props}
|
39
|
+
/>
|
40
|
+
</div>
|
41
|
+
<div>
|
42
|
+
<Image
|
43
|
+
alt="picture of a misty forest"
|
44
|
+
size="xl"
|
45
|
+
url="https://unsplash.it/500/400/?image=634"
|
46
|
+
{...props}
|
47
|
+
/>
|
48
|
+
</div>
|
49
|
+
<div>
|
50
|
+
<Image
|
51
|
+
alt="picture of a misty forest"
|
52
|
+
url="https://unsplash.it/500/400/?image=634"
|
53
|
+
{...props}
|
54
|
+
/>
|
55
|
+
</div>
|
43
56
|
</>
|
44
57
|
)
|
45
58
|
}
|
@@ -5,41 +5,52 @@ import Image from '../_image'
|
|
5
5
|
const RoundedImage = (props) => {
|
6
6
|
return (
|
7
7
|
<>
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
<
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
8
|
+
<br />
|
9
|
+
<div>
|
10
|
+
<Image
|
11
|
+
alt=""
|
12
|
+
rounded
|
13
|
+
size="xs"
|
14
|
+
url="https://unsplash.it/500/400/?image=634"
|
15
|
+
{...props}
|
16
|
+
/>
|
17
|
+
</div>
|
18
|
+
<div>
|
19
|
+
<Image
|
20
|
+
alt=""
|
21
|
+
rounded
|
22
|
+
size="sm"
|
23
|
+
url="https://unsplash.it/500/400/?image=634"
|
24
|
+
{...props}
|
25
|
+
/>
|
26
|
+
</div>
|
27
|
+
<div>
|
28
|
+
<Image
|
29
|
+
alt=""
|
30
|
+
rounded
|
31
|
+
size="md"
|
32
|
+
url="https://unsplash.it/500/400/?image=634"
|
33
|
+
{...props}
|
34
|
+
/>
|
35
|
+
</div>
|
36
|
+
<div>
|
37
|
+
<Image
|
38
|
+
alt=""
|
39
|
+
rounded
|
40
|
+
size="lg"
|
41
|
+
url="https://unsplash.it/500/400/?image=634"
|
42
|
+
{...props}
|
43
|
+
/>
|
44
|
+
</div>
|
45
|
+
<div>
|
46
|
+
<Image
|
47
|
+
alt=""
|
48
|
+
rounded
|
49
|
+
size="xl"
|
50
|
+
url="https://unsplash.it/500/400/?image=634"
|
51
|
+
{...props}
|
52
|
+
/>
|
53
|
+
</div>
|
43
54
|
</>
|
44
55
|
)
|
45
56
|
}
|
@@ -12,13 +12,7 @@ import Title from '../pb_title/_title'
|
|
12
12
|
type LegendProps = {
|
13
13
|
aria?: object,
|
14
14
|
className?: string,
|
15
|
-
color?:
|
16
|
-
| "data_2"
|
17
|
-
| "data_3"
|
18
|
-
| "data_4"
|
19
|
-
| "data_5"
|
20
|
-
| "data_6"
|
21
|
-
| "data_7",
|
15
|
+
color?: string,
|
22
16
|
dark?: boolean,
|
23
17
|
data?: object,
|
24
18
|
id?: string,
|
@@ -20,5 +20,9 @@
|
|
20
20
|
}
|
21
21
|
|
22
22
|
[class^=pb_legend_kit] {
|
23
|
-
@include indicator-colors($data_colors)
|
24
|
-
|
23
|
+
@include indicator-colors($data_colors);
|
24
|
+
@include indicator-colors($status_colors);
|
25
|
+
@include indicator-colors($product_colors);
|
26
|
+
@include indicator-colors($category_colors)
|
27
|
+
|
28
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<%= pb_rails("legend", props: { color: "data_8", text: "Windows" }) %>
|
2
|
+
<%= pb_rails("legend", props: { color: "warning", text: "Windows" }) %>
|
3
|
+
<%= pb_rails("legend", props: { color: "windows", text: "Windows" }) %>
|
4
|
+
<%= pb_rails("legend", props: { color: "category_7", text: "Windows" }) %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Legend } from '../..'
|
3
|
+
|
4
|
+
const LegendColors = (props) => (
|
5
|
+
<div>
|
6
|
+
<Legend
|
7
|
+
color="data_8"
|
8
|
+
text="Windows"
|
9
|
+
{...props}
|
10
|
+
/>
|
11
|
+
<Legend
|
12
|
+
color="warning"
|
13
|
+
text="Windows"
|
14
|
+
{...props}
|
15
|
+
/>
|
16
|
+
<Legend
|
17
|
+
color="windows"
|
18
|
+
text="Windows"
|
19
|
+
{...props}
|
20
|
+
/>
|
21
|
+
<Legend
|
22
|
+
color="category_7"
|
23
|
+
text="Windows"
|
24
|
+
{...props}
|
25
|
+
/>
|
26
|
+
</div>
|
27
|
+
)
|
28
|
+
|
29
|
+
export default LegendColors
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% labels = %W[Windows Doors Roofing Siding Solar Gutters Insulation Other] %>
|
2
2
|
|
3
|
-
<% (
|
4
|
-
<%= pb_rails("legend", props: { color: "data_#{n}", text: "#{labels[n]}" }) %>
|
3
|
+
<% (0..7).each do |n, i| %>
|
4
|
+
<%= pb_rails("legend", props: { color: "data_#{n + 1}", text: "#{labels[n]}" }) %>
|
5
5
|
<% end %>
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
2
2
|
|
3
3
|
import Legend from '../_legend'
|
4
4
|
|
5
|
-
const products = ['Windows', 'Doors', 'Roofing', 'Siding', 'Solar Gutters', 'Insulation', 'Other']
|
5
|
+
const products = ['Windows', 'Doors', 'Roofing', 'Siding', 'Solar', 'Gutters', 'Insulation', 'Other']
|
6
6
|
|
7
7
|
const LegendDefault = (props) => (
|
8
8
|
<div>
|
@@ -3,8 +3,7 @@
|
|
3
3
|
module Playbook
|
4
4
|
module PbLegend
|
5
5
|
class Legend < Playbook::KitBase
|
6
|
-
prop :color, type: Playbook::Props::
|
7
|
-
values: (1..7).map { |n| "data_#{n}" },
|
6
|
+
prop :color, type: Playbook::Props::String,
|
8
7
|
default: "data_1"
|
9
8
|
prop :prefix_text
|
10
9
|
prop :text, required: true
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
3
|
+
|
4
|
+
import Legend from './_legend'
|
5
|
+
|
6
|
+
test('returns namespaced class name', () => {
|
7
|
+
render(
|
8
|
+
<Legend
|
9
|
+
data={{ testid: 'primary-test' }}
|
10
|
+
text="Test colors"
|
11
|
+
/>
|
12
|
+
)
|
13
|
+
|
14
|
+
const kit = screen.getByTestId('primary-test')
|
15
|
+
expect(kit).toHaveClass('pb_legend_kit_data_1')
|
16
|
+
})
|
17
|
+
|
18
|
+
test('color prop', () => {
|
19
|
+
render(
|
20
|
+
<Legend
|
21
|
+
color="category_17"
|
22
|
+
data={{ testid: 'primary-test' }}
|
23
|
+
text="Test colors"
|
24
|
+
/>
|
25
|
+
)
|
26
|
+
|
27
|
+
const kit = screen.getByTestId('primary-test')
|
28
|
+
expect(kit).toHaveClass('pb_legend_kit_category_17')
|
29
|
+
})
|
@@ -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
|
157
|
+
if (!targetIsPopover) {
|
156
158
|
shouldClosePopover(true)
|
157
159
|
}
|
158
160
|
break
|
159
161
|
case 'inside':
|
160
|
-
if (targetIsPopover
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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 (
|
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
|
-
}, { once: 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
|
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>
|
@@ -36,13 +36,15 @@ $section_colors_dark: (
|
|
36
36
|
justify-content: center;
|
37
37
|
}
|
38
38
|
&[class*=_vertical] {
|
39
|
+
margin-left: $space_xs;
|
40
|
+
margin-right: $space_xs;
|
39
41
|
&::after {
|
40
42
|
@include section_separator_vertical(false);
|
41
43
|
}
|
42
44
|
}
|
43
|
-
|
45
|
+
|
44
46
|
// Dark =========================
|
45
|
-
|
47
|
+
|
46
48
|
&.dark {
|
47
49
|
&::after {
|
48
50
|
@include section_separator_horizontal(true);
|
@@ -59,6 +61,8 @@ $section_colors_dark: (
|
|
59
61
|
}
|
60
62
|
}
|
61
63
|
&[class*=_vertical] {
|
64
|
+
margin-left: $space_xs;
|
65
|
+
margin-right: $space_xs;
|
62
66
|
&::after {
|
63
67
|
@include section_separator_vertical(true);
|
64
68
|
}
|