playbook_ui 12.4.0.pre.alpha.map1 → 12.5.0.pre.alpha.filter1
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_date_picker/_date_picker.tsx +37 -33
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +72 -0
- data/app/pb_kits/playbook/pb_filter/Filter/{FilterBackground.jsx → FilterBackground.tsx} +12 -14
- data/app/pb_kits/playbook/pb_filter/Filter/{FilterDouble.jsx → FilterDouble.tsx} +7 -8
- data/app/pb_kits/playbook/pb_filter/Filter/{FilterSingle.jsx → FilterSingle.tsx} +25 -25
- data/app/pb_kits/playbook/pb_filter/Filter/{FiltersPopover.jsx → FiltersPopover.tsx} +13 -11
- data/app/pb_kits/playbook/pb_filter/Filter/{ResultsCount.jsx → ResultsCount.tsx} +39 -14
- data/app/pb_kits/playbook/pb_filter/Filter/{SortMenu.jsx → SortMenu.tsx} +6 -6
- data/app/pb_kits/playbook/pb_filter/Filter/{index.jsx → index.tsx} +17 -10
- data/app/pb_kits/playbook/pb_filter/{_filter.jsx → _filter.tsx} +0 -2
- data/app/pb_kits/playbook/pb_list/_list.tsx +2 -2
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +55 -0
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.test.js +41 -0
- data/app/pb_kits/playbook/pb_map/docs/_map_default.jsx +0 -1
- data/app/pb_kits/playbook/pb_map/docs/_map_default.md +3 -3
- data/app/pb_kits/playbook/pb_map/docs/_map_with_plugin.jsx +7 -6
- data/app/pb_kits/playbook/pb_message/{_message.jsx → _message.tsx} +35 -35
- data/app/pb_kits/playbook/pb_message/message.test.js +63 -0
- data/app/pb_kits/playbook/pb_passphrase/{_passphrase.jsx → _passphrase.tsx} +56 -56
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.html.erb +3 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.html.erb +15 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +43 -0
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +36 -35
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.scss +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +4 -0
- data/app/pb_kits/playbook/playbook-rails-react-bindings.js +2 -0
- data/lib/playbook/version.rb +2 -2
- metadata +19 -14
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx +0 -76
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.jsx +0 -37
@@ -0,0 +1,41 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
3
|
+
import LoadingInline from './_loading_inline'
|
4
|
+
|
5
|
+
const testId = "loadingInline"
|
6
|
+
|
7
|
+
test('should render custom class and data', () => {
|
8
|
+
render(
|
9
|
+
<LoadingInline
|
10
|
+
className='custom-class'
|
11
|
+
data={{ testid: testId }}
|
12
|
+
/>
|
13
|
+
)
|
14
|
+
|
15
|
+
const kit = screen.getByTestId(testId)
|
16
|
+
expect(kit).toHaveClass('custom-class')
|
17
|
+
})
|
18
|
+
|
19
|
+
test('should render id', () => {
|
20
|
+
render(
|
21
|
+
<LoadingInline
|
22
|
+
data={{ testid: testId }}
|
23
|
+
id={testId}
|
24
|
+
/>
|
25
|
+
)
|
26
|
+
|
27
|
+
const kit = screen.getByTestId(testId)
|
28
|
+
expect(kit).toHaveProperty('id', testId)
|
29
|
+
})
|
30
|
+
|
31
|
+
test('should render aria-label', () => {
|
32
|
+
render(
|
33
|
+
<LoadingInline
|
34
|
+
aria={{ label: testId }}
|
35
|
+
data={{ testid: testId }}
|
36
|
+
/>
|
37
|
+
)
|
38
|
+
|
39
|
+
const kit = screen.getByTestId(testId)
|
40
|
+
expect(kit).toHaveAttribute('aria-label', testId)
|
41
|
+
})
|
@@ -2,12 +2,12 @@ This kit provides a wrapping class to place around the MapLibre library. Complet
|
|
2
2
|
|
3
3
|
Basic setup to start using MapLibre:
|
4
4
|
- Install the npm package using `yarn add maplibre-gl`
|
5
|
-
-
|
5
|
+
- To include the maplibre css, include a link to the CSS file as a CDN in your stylesheet using the following syntax: `@import url("https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css");`
|
6
6
|
OR include it as a link in the <head> tag `<link href='https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css' rel='stylesheet' />`
|
7
|
-
- To use Maplibre, you must also set a height on the containing div.
|
8
7
|
- You can now use MapLibre within the Map Kit as shown in this example.
|
9
8
|
|
10
9
|
__Notes__ :
|
11
|
-
- The MapLibre Marker allows us to pass it a HEX value as a color prop but for Playbook styling we recommend importing our `MapTheme` file and passing `mapTheme.marker` to the Marker color prop.
|
12
10
|
- To enable custom buttons, set `zoomBtns` and `flyTo` to true and pass in `zoomInClick`, `zoomOutClick` and `flyToClick` as shown in this doc example.
|
11
|
+
- Use `mapTheme.marker` to set the Marker color.
|
12
|
+
- To use Maplibre, you must also set a height and width to the containing div (.pb_map) and set position to 'relative'.
|
13
13
|
- `scrollZoom` has been disabled in these doc examples for page usability
|
@@ -2,12 +2,14 @@ import React, { useRef, useEffect } from 'react'
|
|
2
2
|
import { Map } from '../../'
|
3
3
|
import maplibregl from 'maplibre-gl'
|
4
4
|
import MapboxDraw from "@mapbox/mapbox-gl-draw";
|
5
|
-
import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css'
|
6
5
|
import mapTheme from '../pbMapTheme'
|
7
6
|
|
8
7
|
const MapWithPlugin = (props) => {
|
8
|
+
//set Map instance to access from outside useEffect
|
9
|
+
const mapContainerRef = useRef(null)
|
9
10
|
|
10
|
-
|
11
|
+
//Set default position
|
12
|
+
const defaultPosition = [-75.379143, 39.831200]
|
11
13
|
|
12
14
|
//This function should contain all maplibre related code
|
13
15
|
const loadMap = ( { target: map }) => {
|
@@ -15,11 +17,11 @@ const MapWithPlugin = (props) => {
|
|
15
17
|
/* eslint-disable-next-line */
|
16
18
|
const marker = new maplibregl.Marker({
|
17
19
|
color: mapTheme.marker,
|
18
|
-
}).setLngLat(
|
20
|
+
}).setLngLat(defaultPosition)
|
19
21
|
.setPopup(new maplibregl.Popup({className: 'map_popup', closeButton: false}).setHTML(`<h4 class="pb_title_kit_size_4">Hello World!</h4>`)) // add popup
|
20
22
|
.addTo(map);
|
21
23
|
|
22
|
-
//add zoom controls
|
24
|
+
//add maplibre default zoom controls
|
23
25
|
map.addControl(new maplibregl.NavigationControl({showCompass: false}))
|
24
26
|
|
25
27
|
// disable map zoom when using scroll
|
@@ -39,9 +41,8 @@ const MapWithPlugin = (props) => {
|
|
39
41
|
useEffect(() => {
|
40
42
|
new maplibregl.Map({
|
41
43
|
container: mapContainerRef.current,
|
42
|
-
style: 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json',
|
43
44
|
center: [-75.379143, 39.831200],
|
44
|
-
|
45
|
+
...mapTheme.mapConfig
|
45
46
|
}).on('load', loadMap)
|
46
47
|
}, [])
|
47
48
|
|
@@ -13,11 +13,11 @@ import Timestamp from '../pb_timestamp/_timestamp'
|
|
13
13
|
import Title from '../pb_title/_title'
|
14
14
|
|
15
15
|
type MessageProps = {
|
16
|
-
aria:
|
16
|
+
aria: { [key: string]: string },
|
17
17
|
avatarName?: string,
|
18
|
-
avatarStatus?:
|
18
|
+
avatarStatus?: "away" | "offline" | "online",
|
19
19
|
avatarUrl?: string,
|
20
|
-
children?:
|
20
|
+
children?: React.ReactChild[] | React.ReactChild,
|
21
21
|
className?: string,
|
22
22
|
data?: object,
|
23
23
|
id?: string,
|
@@ -61,53 +61,53 @@ const Message = (props: MessageProps) => {
|
|
61
61
|
|
62
62
|
return (
|
63
63
|
<div
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
{...ariaProps}
|
65
|
+
{...dataProps}
|
66
|
+
className={classes}
|
67
|
+
id={id}
|
68
68
|
>
|
69
|
-
|
69
|
+
{shouldDisplayAvatar &&
|
70
70
|
<Avatar
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
imageUrl={avatarUrl}
|
72
|
+
name={avatarName}
|
73
|
+
size="xs"
|
74
|
+
status={avatarStatus}
|
75
75
|
/>
|
76
|
-
|
76
|
+
}
|
77
77
|
<div className="content_wrapper">
|
78
78
|
<Flex
|
79
|
-
|
80
|
-
|
79
|
+
justify={alignTimestamp === 'left' ? 'none' : 'between'}
|
80
|
+
orientation="row"
|
81
81
|
>
|
82
|
-
|
82
|
+
{label &&
|
83
83
|
<Title
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
className="message_title"
|
85
|
+
size={4}
|
86
|
+
text={label}
|
87
87
|
/>
|
88
|
-
|
88
|
+
}
|
89
89
|
<Timestamp
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
className={`pull-${alignTimestamp} ${timestampObject ? 'message_humanized_time' : null}`}
|
91
|
+
text={timestamp}
|
92
|
+
timestamp={''}
|
93
|
+
timezone={timezone}
|
93
94
|
/>
|
94
|
-
|
95
|
+
{timestampObject &&
|
95
96
|
<Timestamp
|
96
|
-
|
97
|
-
|
98
|
-
|
97
|
+
className={`pull-${alignTimestamp} message_timestamp`}
|
98
|
+
text={''}
|
99
|
+
timestamp={timestampObject}
|
100
|
+
timezone={timezone}
|
99
101
|
/>
|
100
|
-
|
102
|
+
}
|
101
103
|
</Flex>
|
102
|
-
|
104
|
+
{message &&
|
103
105
|
<Body
|
104
|
-
|
105
|
-
|
106
|
+
className="pb_message_body"
|
107
|
+
text={message}
|
106
108
|
/>
|
107
|
-
|
108
|
-
|
109
|
-
{ children }
|
110
|
-
</If>
|
109
|
+
}
|
110
|
+
{children}
|
111
111
|
</div>
|
112
112
|
</div>
|
113
113
|
)
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
3
|
+
import Message from './_message'
|
4
|
+
import Image from './../pb_image/_image'
|
5
|
+
|
6
|
+
const testId = "message"
|
7
|
+
|
8
|
+
const MessageDefault = () => {
|
9
|
+
return (
|
10
|
+
<>
|
11
|
+
<Message
|
12
|
+
avatarName="Becca Jacobs"
|
13
|
+
avatarUrl="https://randomuser.me/api/portraits/women/50.jpg"
|
14
|
+
className='custom-class'
|
15
|
+
data={{ testid: testId }}
|
16
|
+
label="Lucille Sanchez"
|
17
|
+
message="Application for Kate Smith is waiting for your approval"
|
18
|
+
timestamp="2 days ago"
|
19
|
+
>
|
20
|
+
<Image
|
21
|
+
alt="picture of a misty forest"
|
22
|
+
size="md"
|
23
|
+
url="https://unsplash.it/500/400/?image=634"
|
24
|
+
/>
|
25
|
+
</Message>
|
26
|
+
</>
|
27
|
+
)
|
28
|
+
}
|
29
|
+
|
30
|
+
test('should render message', () => {
|
31
|
+
render(<MessageDefault />)
|
32
|
+
|
33
|
+
const kit = screen.getByText('Application for Kate Smith is waiting for your approval')
|
34
|
+
expect(kit).toBeInTheDocument()
|
35
|
+
})
|
36
|
+
|
37
|
+
test('should render label', () => {
|
38
|
+
render(<MessageDefault />)
|
39
|
+
|
40
|
+
const kit = screen.getByText('Lucille Sanchez')
|
41
|
+
expect(kit).toBeInTheDocument()
|
42
|
+
})
|
43
|
+
|
44
|
+
test('should render timestamp', () => {
|
45
|
+
render(<MessageDefault />)
|
46
|
+
|
47
|
+
const kit = screen.getByText('2 days ago')
|
48
|
+
expect(kit).toBeInTheDocument()
|
49
|
+
})
|
50
|
+
|
51
|
+
test('should render custom class and data', () => {
|
52
|
+
render(<MessageDefault />)
|
53
|
+
|
54
|
+
const kit = screen.getByTestId(testId)
|
55
|
+
expect(kit).toHaveClass('custom-class')
|
56
|
+
})
|
57
|
+
|
58
|
+
test('should render a children', () => {
|
59
|
+
render(<MessageDefault />)
|
60
|
+
|
61
|
+
const kit = screen.getByAltText('picture of a misty forest')
|
62
|
+
expect(kit).toBeInTheDocument()
|
63
|
+
})
|
@@ -15,7 +15,7 @@ import PbReactPopover from '../pb_popover/_popover'
|
|
15
15
|
import TextInput from '../pb_text_input/_text_input'
|
16
16
|
|
17
17
|
type PassphraseProps = {
|
18
|
-
aria?:
|
18
|
+
aria?: { [key: string]: string },
|
19
19
|
confirmation?: boolean,
|
20
20
|
className?: string,
|
21
21
|
data?: object,
|
@@ -23,7 +23,7 @@ type PassphraseProps = {
|
|
23
23
|
id?: string,
|
24
24
|
inputProps?: {},
|
25
25
|
label?: string,
|
26
|
-
onChange: (String) => void,
|
26
|
+
onChange: (inputValue: String) => void,
|
27
27
|
showTipsBelow?: "always" | "xs" | "sm" | "md" | "lg" | "xl",
|
28
28
|
tips?: Array<string>,
|
29
29
|
uncontrolled?: boolean,
|
@@ -40,7 +40,7 @@ const Passphrase = (props: PassphraseProps) => {
|
|
40
40
|
id,
|
41
41
|
inputProps = {},
|
42
42
|
label = confirmation ? "Confirm Passphrase" : "Passphrase",
|
43
|
-
onChange = () => {},
|
43
|
+
onChange = () => { },
|
44
44
|
showTipsBelow = "always",
|
45
45
|
tips = [],
|
46
46
|
uncontrolled = false,
|
@@ -62,11 +62,11 @@ const Passphrase = (props: PassphraseProps) => {
|
|
62
62
|
)
|
63
63
|
|
64
64
|
const toggleShowPopover = () => setShowPopover(!showPopover)
|
65
|
-
const handleShouldClosePopover = (shouldClosePopover) => {
|
65
|
+
const handleShouldClosePopover = (shouldClosePopover: boolean) => {
|
66
66
|
setShowPopover(!shouldClosePopover)
|
67
67
|
}
|
68
68
|
|
69
|
-
const toggleShowPassphrase = (e) => {
|
69
|
+
const toggleShowPassphrase = (e: React.MouseEvent<HTMLElement>) => {
|
70
70
|
e.preventDefault()
|
71
71
|
setShowPassphrase(!showPassphrase)
|
72
72
|
}
|
@@ -86,54 +86,54 @@ const Passphrase = (props: PassphraseProps) => {
|
|
86
86
|
|
87
87
|
const popoverReference = (
|
88
88
|
<CircleIconButton
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
89
|
+
className={tipClass}
|
90
|
+
dark={dark}
|
91
|
+
icon="info-circle"
|
92
|
+
onClick={toggleShowPopover}
|
93
|
+
variant="link"
|
94
94
|
/>
|
95
95
|
)
|
96
96
|
|
97
97
|
return (
|
98
|
-
<div
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
98
|
+
<div
|
99
|
+
{...ariaProps}
|
100
|
+
{...dataProps}
|
101
|
+
className={classes}
|
102
|
+
id={id}
|
103
103
|
>
|
104
104
|
<label>
|
105
105
|
<Flex align="baseline">
|
106
|
-
<Caption
|
107
|
-
|
108
|
-
|
106
|
+
<Caption
|
107
|
+
className="passphrase-label"
|
108
|
+
text={label}
|
109
109
|
/>
|
110
|
-
|
110
|
+
{tips.length > 0 && !confirmation &&
|
111
111
|
<PbReactPopover
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
112
|
+
className="passphrase-tips"
|
113
|
+
closeOnClick="outside"
|
114
|
+
placement="right"
|
115
|
+
reference={popoverReference}
|
116
|
+
shouldClosePopover={handleShouldClosePopover}
|
117
|
+
show={showPopover}
|
118
118
|
>
|
119
|
-
<Flex
|
120
|
-
|
121
|
-
|
119
|
+
<Flex
|
120
|
+
align="center"
|
121
|
+
orientation="column"
|
122
122
|
>
|
123
|
-
<Caption
|
124
|
-
|
125
|
-
|
123
|
+
<Caption
|
124
|
+
marginBottom="xs"
|
125
|
+
text="Tips for a good passphrase"
|
126
126
|
/>
|
127
127
|
<div>
|
128
128
|
{tips.map((tip, i) => (
|
129
|
-
<Caption
|
130
|
-
|
131
|
-
|
132
|
-
|
129
|
+
<Caption
|
130
|
+
key={i}
|
131
|
+
marginBottom="xs"
|
132
|
+
size="xs"
|
133
133
|
>
|
134
|
-
<Icon
|
135
|
-
|
136
|
-
|
134
|
+
<Icon
|
135
|
+
icon="shield-check"
|
136
|
+
marginRight="xs"
|
137
137
|
/>
|
138
138
|
{tip}
|
139
139
|
</Caption>
|
@@ -141,34 +141,34 @@ const Passphrase = (props: PassphraseProps) => {
|
|
141
141
|
</div>
|
142
142
|
</Flex>
|
143
143
|
</PbReactPopover>
|
144
|
-
|
144
|
+
}
|
145
145
|
</Flex>
|
146
146
|
<div className="passphrase-text-input-wrapper">
|
147
147
|
<TextInput
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
148
|
+
className="passphrase-text-input"
|
149
|
+
dark={dark}
|
150
|
+
marginBottom="xs"
|
151
|
+
onChange={handleChange}
|
152
|
+
placeholder="Enter a passphrase..."
|
153
|
+
type={showPassphrase ? "text" : "password"}
|
154
|
+
value={displayValue}
|
155
|
+
{...inputProps}
|
156
156
|
/>
|
157
|
-
<span
|
158
|
-
|
159
|
-
|
157
|
+
<span
|
158
|
+
className="show-passphrase-icon"
|
159
|
+
onClick={toggleShowPassphrase}
|
160
160
|
>
|
161
161
|
<Body
|
162
|
-
|
163
|
-
|
164
|
-
|
162
|
+
className={showPassphrase ? "hide-icon" : ""}
|
163
|
+
color="light"
|
164
|
+
dark={dark}
|
165
165
|
>
|
166
166
|
<Icon icon="eye-slash" />
|
167
167
|
</Body>
|
168
168
|
<Body
|
169
|
-
|
170
|
-
|
171
|
-
|
169
|
+
className={showPassphrase ? "" : "hide-icon"}
|
170
|
+
color="light"
|
171
|
+
dark={dark}
|
172
172
|
>
|
173
173
|
<Icon icon="eye" />
|
174
174
|
</Body>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= react_component("PhoneNumberInput", object.phone_number_input_options) %>
|
2
|
+
|
3
|
+
<script>
|
4
|
+
const formatToGlobalCountryName = () => {
|
5
|
+
return countryName.split('(')[0].trim()
|
6
|
+
}
|
7
|
+
|
8
|
+
const formatAllCountries = () => {
|
9
|
+
let countryData = window.intlTelInputGlobals.getCountryData()
|
10
|
+
for (let i = 0; i < countryData.length; i++) {
|
11
|
+
let country = countryData[i]
|
12
|
+
country.name = formatToGlobalCountryName(country.name)
|
13
|
+
}
|
14
|
+
}
|
15
|
+
</script>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbPhoneNumberInput
|
5
|
+
class PhoneNumberInput < Playbook::KitBase
|
6
|
+
prop :disabled, type: Playbook::Props::Boolean,
|
7
|
+
default: false
|
8
|
+
prop :initial_country, type: Playbook::Props::String,
|
9
|
+
default: ""
|
10
|
+
prop :is_valid
|
11
|
+
prop :label, type: Playbook::Props::String,
|
12
|
+
default: ""
|
13
|
+
prop :name, type: Playbook::Props::String,
|
14
|
+
default: ""
|
15
|
+
prop :onchange
|
16
|
+
prop :only_countries, type: Playbook::Props::Array,
|
17
|
+
default: []
|
18
|
+
prop :preferred_countries, type: Playbook::Props::Array,
|
19
|
+
default: []
|
20
|
+
prop :value, type: Playbook::Props::String,
|
21
|
+
default: ""
|
22
|
+
|
23
|
+
def classname
|
24
|
+
generate_classname("pb_phone_number_input")
|
25
|
+
end
|
26
|
+
|
27
|
+
def phone_number_input_options
|
28
|
+
{
|
29
|
+
id: id,
|
30
|
+
disabled: disabled,
|
31
|
+
initialCountry: initial_country,
|
32
|
+
isValid: is_valid,
|
33
|
+
label: label,
|
34
|
+
name: name,
|
35
|
+
onChange: onchange,
|
36
|
+
onlyCountries: only_countries,
|
37
|
+
preferredCountries: preferred_countries,
|
38
|
+
value: value,
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import React, { useEffect } from "react";
|
2
2
|
import ReactDOM from "react-dom";
|
3
|
-
|
4
3
|
import {
|
5
4
|
Popper,
|
6
5
|
Manager as PopperManager,
|
@@ -23,14 +22,14 @@ type PbPopoverProps = {
|
|
23
22
|
aria?: { [key: string]: string };
|
24
23
|
className?: string;
|
25
24
|
closeOnClick?: "outside" | "inside" | "any";
|
26
|
-
data?:
|
25
|
+
data?: { [key: string]: string },
|
27
26
|
id?: string;
|
28
27
|
offset?: boolean;
|
29
28
|
reference: PopperReference & any;
|
30
29
|
show?: boolean;
|
31
|
-
shouldClosePopover?: (arg0: boolean) =>
|
32
|
-
} & GlobalProps &
|
33
|
-
|
30
|
+
shouldClosePopover?: (arg0: boolean) => void;
|
31
|
+
} & GlobalProps & Omit<PopperProps<any>, 'children'>
|
32
|
+
& { children?: React.ReactChild[] | React.ReactChild }
|
34
33
|
|
35
34
|
// Prop enabled default modifiers here
|
36
35
|
// https://popper.js.org/docs/v2/modifiers
|
@@ -100,31 +99,31 @@ const Popover = (props: PbPopoverProps) => {
|
|
100
99
|
|
101
100
|
return (
|
102
101
|
<Popper
|
103
|
-
|
104
|
-
|
105
|
-
|
102
|
+
modifiers={popoverModifiers({ modifiers, offset })}
|
103
|
+
placement={placement}
|
104
|
+
referenceElement={referenceElement}
|
106
105
|
>
|
107
106
|
{({ placement, ref, style }) => {
|
108
107
|
return (
|
109
108
|
<div
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
109
|
+
{...ariaProps}
|
110
|
+
{...dataProps}
|
111
|
+
className={classes}
|
112
|
+
data-placement={placement}
|
113
|
+
id={id}
|
114
|
+
ref={ref}
|
115
|
+
style={Object.assign({}, style, zIndexStyle)}
|
117
116
|
>
|
118
117
|
<div
|
119
|
-
|
118
|
+
className={classnames(`${buildCss("pb_popover_tooltip")} show`)}
|
120
119
|
>
|
121
120
|
<div
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
121
|
+
className={classnames(
|
122
|
+
"pb_popover_body",
|
123
|
+
popoverSpacing,
|
124
|
+
overflowHandling
|
125
|
+
)}
|
126
|
+
style={widthHeightStyles()}
|
128
127
|
>
|
129
128
|
{children}
|
130
129
|
</div>
|
@@ -192,17 +191,17 @@ const PbReactPopover = (props: PbPopoverProps) => {
|
|
192
191
|
|
193
192
|
const popoverComponent = (
|
194
193
|
<Popover
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
194
|
+
className={className}
|
195
|
+
maxHeight={maxHeight}
|
196
|
+
maxWidth={maxWidth}
|
197
|
+
minHeight={minHeight}
|
198
|
+
minWidth={minWidth}
|
199
|
+
modifiers={modifiers}
|
200
|
+
offset={offset}
|
201
|
+
placement={placement}
|
202
|
+
referenceElement={referenceElement}
|
203
|
+
zIndex={zIndex}
|
204
|
+
{...props}
|
206
205
|
>
|
207
206
|
{children}
|
208
207
|
</Popover>
|
@@ -214,7 +213,9 @@ const PbReactPopover = (props: PbPopoverProps) => {
|
|
214
213
|
{reference && !referenceElement && (
|
215
214
|
<PopperReference>
|
216
215
|
{({ ref }) => (
|
217
|
-
<span
|
216
|
+
<span
|
217
|
+
className="pb_popover_reference_wrapper"
|
218
|
+
ref={ref}>
|
218
219
|
<reference.type {...reference.props} />
|
219
220
|
</span>
|
220
221
|
)}
|
@@ -236,4 +237,4 @@ const PbReactPopover = (props: PbPopoverProps) => {
|
|
236
237
|
);
|
237
238
|
};
|
238
239
|
|
239
|
-
export default PbReactPopover;
|
240
|
+
export default PbReactPopover;
|