playbook_ui 12.4.0.pre.alpha.map1 → 12.4.0
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/index.js +1 -4
- data/app/pb_kits/playbook/pb_button/_button.tsx +2 -2
- data/app/pb_kits/playbook/pb_map/_map.scss +2 -114
- data/app/pb_kits/playbook/pb_map/_map.tsx +2 -42
- data/app/pb_kits/playbook/pb_map/docs/_map_default.jsx +24 -48
- data/app/pb_kits/playbook/pb_map/docs/_map_default.md +4 -4
- data/app/pb_kits/playbook/pb_map/docs/_map_with_plugin.jsx +14 -16
- data/app/pb_kits/playbook/pb_map/docs/example.yml +1 -0
- data/lib/playbook/version.rb +2 -2
- metadata +4 -5
- data/app/pb_kits/playbook/pb_map/pbMapTheme.ts +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c9cb603d0564380dc76fd27efdc587607430f9e349d5288672a6f44ae9cdd7e
|
4
|
+
data.tar.gz: b677f2dfb9bfe0bfc848018c3a84be1f94af01e87372ff4ba0dbf78a50c0857c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5671ee0b58e71684f090dcac6d15c2297d19c071b7f58082badd065319fdf91e27a3884779a8e3c021101515a40c7a9b2c0c07c880b632894faafb23a16322ac
|
7
|
+
data.tar.gz: ea93cf50049661329f814c893e245ceff4d3be4c4bd5ce9264624eafea84d0a82a833d50cebb6e233d90e5e124c60372d68f5516c4ba4269992325b4178e5b86
|
@@ -123,7 +123,4 @@ export { default as PbTable } from './pb_table'
|
|
123
123
|
export { default as PbTextarea } from './pb_textarea'
|
124
124
|
export { default as PbTooltip } from './pb_tooltip'
|
125
125
|
export { default as PbTypeahead } from './pb_typeahead'
|
126
|
-
export { default as dialogHelper } from './pb_dialog/dialogHelper'
|
127
|
-
|
128
|
-
//Theming
|
129
|
-
export {default as mapTheme} from './pb_map/pbMapTheme'
|
126
|
+
export { default as dialogHelper } from './pb_dialog/dialogHelper'
|
@@ -27,9 +27,9 @@ type ButtonPropTypes = {
|
|
27
27
|
size?: 'sm' | 'md' | 'lg',
|
28
28
|
text?: string,
|
29
29
|
type?: 'inline' | null,
|
30
|
-
htmlType
|
30
|
+
htmlType: 'submit' | 'reset' | 'button' | undefined,
|
31
31
|
value?: string | null,
|
32
|
-
variant
|
32
|
+
variant: 'primary' | 'secondary' | 'link',
|
33
33
|
wrapperClass?: string,
|
34
34
|
} & GlobalProps
|
35
35
|
|
@@ -1,120 +1,8 @@
|
|
1
1
|
@import "../tokens/typography";
|
2
|
-
@import "../tokens/colors";
|
2
|
+
@import "../tokens/colors";
|
3
3
|
@import "../tokens/shadows";
|
4
|
-
@import "../tokens/border_radius";
|
5
4
|
|
6
|
-
|
5
|
+
.pb_map {
|
7
6
|
font-family: $font_family_base !important;
|
8
7
|
|
9
|
-
.maplibregl-ctrl-attrib-button {
|
10
|
-
&:focus {
|
11
|
-
box-shadow: unset;
|
12
|
-
}
|
13
|
-
&:focus-visible {
|
14
|
-
box-shadow: 0 0 0 1px $primary_action;
|
15
|
-
}
|
16
|
-
&:hover {
|
17
|
-
box-shadow: $shadow_deep;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
.custom-nav-control {
|
21
|
-
position: absolute;
|
22
|
-
right: $space_xs + 2;
|
23
|
-
top: $space_xs + 2;
|
24
|
-
z-index: 2;
|
25
|
-
|
26
|
-
.custom-nav-control-zoom {
|
27
|
-
border-radius: $border_radius_md;
|
28
|
-
box-shadow: $shadow_deep;
|
29
|
-
background: $card_light;
|
30
|
-
.map-zoom-in-button {
|
31
|
-
border-bottom-left-radius: unset;
|
32
|
-
border-bottom-right-radius: unset;
|
33
|
-
border-bottom: transparent;
|
34
|
-
}
|
35
|
-
.map-zoom-out-button {
|
36
|
-
border-top-left-radius: unset;
|
37
|
-
border-top-right-radius: unset;
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
41
|
-
.map-zoom-in-button,
|
42
|
-
.map-zoom-out-button,
|
43
|
-
.map-flyto-button {
|
44
|
-
border: solid 1px $border_light;
|
45
|
-
cursor: pointer;
|
46
|
-
padding: $space_xs + 2;
|
47
|
-
text-align: center;
|
48
|
-
color: $text_lt_light;
|
49
|
-
background-color: $card_light;
|
50
|
-
|
51
|
-
display: flex;
|
52
|
-
justify-content: center;
|
53
|
-
align-items: center;
|
54
|
-
|
55
|
-
svg {
|
56
|
-
width: $space_xs + 4;
|
57
|
-
height: $space_sm;
|
58
|
-
display: flex;
|
59
|
-
}
|
60
|
-
|
61
|
-
&:hover {
|
62
|
-
background-color: darken($bg_light, 2%);
|
63
|
-
}
|
64
|
-
|
65
|
-
&:focus-visible {
|
66
|
-
border: solid 1px $primary_action;
|
67
|
-
box-shadow: unset;
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
.map-flyto-button {
|
72
|
-
border-radius: $border_radius_md;
|
73
|
-
margin-top: $space_xs;
|
74
|
-
box-shadow: $shadow_deep;
|
75
|
-
background-color: $card_light;
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
.maplibregl-popup-content {
|
80
|
-
padding: $space_sm;
|
81
|
-
background-color: $card_light;
|
82
|
-
box-shadow: $shadow_deeper;
|
83
|
-
}
|
84
|
-
|
85
|
-
&.dark {
|
86
|
-
.maplibregl-canvas {
|
87
|
-
filter: invert(100%) brightness(175%) contrast(80%) sepia(50%) saturate(2)
|
88
|
-
hue-rotate(185deg);
|
89
|
-
}
|
90
|
-
|
91
|
-
.pb_section_separator_kit_card_horizontal::after {
|
92
|
-
background: $border_dark;
|
93
|
-
}
|
94
|
-
.custom-nav-control-zoom {
|
95
|
-
border: solid 1px #0a0527;
|
96
|
-
background: $bg_dark;
|
97
|
-
}
|
98
|
-
|
99
|
-
.maplibregl-popup-content {
|
100
|
-
background-color: $bg_dark;
|
101
|
-
color: $text_dk_default;
|
102
|
-
}
|
103
|
-
|
104
|
-
.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip,
|
105
|
-
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip {
|
106
|
-
border-top-color: $bg_dark;
|
107
|
-
}
|
108
|
-
.map-zoom-in-button,
|
109
|
-
.map-zoom-out-button,
|
110
|
-
.map-flyto-button {
|
111
|
-
color: $text_dk_default;
|
112
|
-
background-color: $bg_dark;
|
113
|
-
border-color: $border_dark;
|
114
|
-
|
115
|
-
&:hover {
|
116
|
-
background-color: #221e3d;
|
117
|
-
}
|
118
|
-
}
|
119
|
-
}
|
120
8
|
}
|
@@ -1,11 +1,8 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
3
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
4
|
-
import { globalProps
|
4
|
+
import { globalProps } from '../utilities/globalProps'
|
5
5
|
|
6
|
-
import Flex from "../pb_flex/_flex"
|
7
|
-
import Icon from '../pb_icon/_icon'
|
8
|
-
import Button from '../pb_button/_button'
|
9
6
|
|
10
7
|
type MapProps = {
|
11
8
|
aria?: { [key: string]: string },
|
@@ -13,12 +10,7 @@ type MapProps = {
|
|
13
10
|
className?: string,
|
14
11
|
data?: { [key: string]: string },
|
15
12
|
id?: string,
|
16
|
-
|
17
|
-
flyTo?: boolean,
|
18
|
-
zoomInClick?: () => {},
|
19
|
-
zoomOutClick?: () => {},
|
20
|
-
flyToClick?: () => {},
|
21
|
-
} & GlobalProps
|
13
|
+
}
|
22
14
|
|
23
15
|
const Map = (props: MapProps) => {
|
24
16
|
const {
|
@@ -27,11 +19,6 @@ const Map = (props: MapProps) => {
|
|
27
19
|
className,
|
28
20
|
data = {},
|
29
21
|
id,
|
30
|
-
zoomBtns = false,
|
31
|
-
flyTo = false,
|
32
|
-
zoomInClick,
|
33
|
-
zoomOutClick,
|
34
|
-
flyToClick
|
35
22
|
} = props
|
36
23
|
|
37
24
|
const ariaProps = buildAriaProps(aria)
|
@@ -45,33 +32,6 @@ const Map = (props: MapProps) => {
|
|
45
32
|
className={classes}
|
46
33
|
id={id}
|
47
34
|
>
|
48
|
-
{
|
49
|
-
zoomBtns ? (
|
50
|
-
<Flex className="custom-nav-control" orientation='column'>
|
51
|
-
<div className="custom-nav-control-zoom">
|
52
|
-
<Button className='map-zoom-in-button'
|
53
|
-
onClick={zoomInClick}
|
54
|
-
>
|
55
|
-
<Icon icon="plus"/>
|
56
|
-
</Button>
|
57
|
-
<Button className='map-zoom-out-button'
|
58
|
-
onClick={zoomOutClick}
|
59
|
-
>
|
60
|
-
<Icon icon="minus"/>
|
61
|
-
</Button>
|
62
|
-
</div>
|
63
|
-
{
|
64
|
-
flyTo ? (
|
65
|
-
<Button className='map-flyto-button'
|
66
|
-
onClick={flyToClick}
|
67
|
-
>
|
68
|
-
<Icon icon="eye"/>
|
69
|
-
</Button>
|
70
|
-
) : null
|
71
|
-
}
|
72
|
-
</Flex>
|
73
|
-
) : null
|
74
|
-
}
|
75
35
|
{children}
|
76
36
|
</div>
|
77
37
|
)
|
@@ -1,64 +1,40 @@
|
|
1
|
-
import React, { useRef, useEffect
|
1
|
+
import React, { useRef, useEffect } from 'react'
|
2
2
|
import { Map } from '../../'
|
3
|
-
|
3
|
+
|
4
4
|
import maplibregl from 'maplibre-gl'
|
5
|
-
import mapTheme from '../pbMapTheme'
|
6
5
|
|
7
|
-
const MapDefault = (
|
6
|
+
const MapDefault = () => {
|
8
7
|
|
9
|
-
//set Map instance to access from outside useEffect
|
10
|
-
const [mapInstance, setMapInstance] = useState(null)
|
11
8
|
const mapContainerRef = useRef(null)
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
//This function is called by the useEffect when map instance first loads
|
25
|
-
const loadMap = ( { target: map }) => {
|
10
|
+
useEffect(() => {
|
11
|
+
if (!maplibregl.supported()) {
|
12
|
+
alert('Your browser does not support MapLibre GL');
|
13
|
+
} else {
|
14
|
+
const map = new maplibregl.Map({
|
15
|
+
container: mapContainerRef.current,
|
16
|
+
style: 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json',
|
17
|
+
center: [-75.379143, 39.831200],
|
18
|
+
zoom: 13,
|
19
|
+
})
|
26
20
|
//set marker/pin
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
.
|
21
|
+
/* eslint-disable-next-line */
|
22
|
+
const marker = new maplibregl.Marker({
|
23
|
+
color: "#0056CF",
|
24
|
+
}).setLngLat([-75.379143, 39.831200])
|
25
|
+
.setPopup(new maplibregl.Popup({className: 'map_popup', closeButton: false}).setHTML(`<h4 class="pb_title_kit_size_4">Hello World!</h4>`)) // add popup
|
31
26
|
.addTo(map);
|
32
27
|
|
28
|
+
//add zoom controls
|
29
|
+
map.addControl(new maplibregl.NavigationControl({showCompass: false}))
|
30
|
+
|
33
31
|
// disable map zoom when using scroll
|
34
32
|
map.scrollZoom.disable();
|
35
|
-
|
36
|
-
//add attributioncontrols
|
37
|
-
map.addControl(new maplibregl.AttributionControl({
|
38
|
-
compact: true
|
39
|
-
}));
|
40
|
-
|
41
|
-
//set map instance
|
42
|
-
setMapInstance(map)
|
43
|
-
}
|
44
|
-
|
45
|
-
useEffect(() => {
|
46
|
-
new maplibregl.Map({
|
47
|
-
container: mapContainerRef.current,
|
48
|
-
center: defaultPosition,
|
49
|
-
...mapTheme.mapConfig
|
50
|
-
}).on('load', loadMap)
|
51
33
|
|
34
|
+
}
|
52
35
|
}, [])
|
53
|
-
|
54
36
|
return (
|
55
|
-
<Map
|
56
|
-
flyToClick={()=> {handleFlyTo(mapInstance)}}
|
57
|
-
zoomBtns
|
58
|
-
zoomInClick={() => {handleZoomIn(mapInstance)}}
|
59
|
-
zoomOutClick={()=> {handleZoomOut(mapInstance)}}
|
60
|
-
{...props}
|
61
|
-
>
|
37
|
+
<Map>
|
62
38
|
<div
|
63
39
|
ref={mapContainerRef}
|
64
40
|
style={{
|
@@ -68,7 +44,7 @@ return (
|
|
68
44
|
top: 0,
|
69
45
|
bottom: 0,
|
70
46
|
}}
|
71
|
-
|
47
|
+
/>
|
72
48
|
</Map>
|
73
49
|
)
|
74
50
|
}
|
@@ -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
|
-
-
|
6
|
-
|
5
|
+
- Include a link to the CSS file as a CDN in your stylesheet using the following syntax:
|
6
|
+
`@import url("https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css");`
|
7
|
+
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
8
|
- To use Maplibre, you must also set a height on the containing div.
|
8
9
|
- You can now use MapLibre within the Map Kit as shown in this example.
|
9
10
|
|
10
11
|
__Notes__ :
|
11
|
-
- The MapLibre Marker allows us to pass it a HEX value as a color prop
|
12
|
-
- To enable custom buttons, set `zoomBtns` and `flyTo` to true and pass in `zoomInClick`, `zoomOutClick` and `flyToClick` as shown in this doc example.
|
12
|
+
- The MapLibre Marker allows us to pass it a HEX value as a color prop. In these doc examples we are using our primary color for the Marker.
|
13
13
|
- `scrollZoom` has been disabled in these doc examples for page usability
|
@@ -2,19 +2,25 @@ 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
|
-
import mapTheme from '../pbMapTheme'
|
7
5
|
|
8
|
-
const MapWithPlugin = (
|
6
|
+
const MapWithPlugin = () => {
|
9
7
|
|
10
8
|
const mapContainerRef = useRef(null)
|
11
9
|
|
12
|
-
|
13
|
-
|
10
|
+
useEffect(() => {
|
11
|
+
if (!maplibregl.supported()) {
|
12
|
+
alert('Your browser does not support MapLibre GL');
|
13
|
+
} else {
|
14
|
+
const map = new maplibregl.Map({
|
15
|
+
container: mapContainerRef.current,
|
16
|
+
style: 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json',
|
17
|
+
center: [-75.379143, 39.831200],
|
18
|
+
zoom: 13,
|
19
|
+
})
|
14
20
|
//set marker/pin
|
15
21
|
/* eslint-disable-next-line */
|
16
22
|
const marker = new maplibregl.Marker({
|
17
|
-
color:
|
23
|
+
color: "#0056CF",
|
18
24
|
}).setLngLat([-75.379143, 39.831200])
|
19
25
|
.setPopup(new maplibregl.Popup({className: 'map_popup', closeButton: false}).setHTML(`<h4 class="pb_title_kit_size_4">Hello World!</h4>`)) // add popup
|
20
26
|
.addTo(map);
|
@@ -34,21 +40,13 @@ const MapWithPlugin = (props) => {
|
|
34
40
|
}
|
35
41
|
});
|
36
42
|
map.addControl(draw);
|
37
|
-
|
38
|
-
|
39
|
-
useEffect(() => {
|
40
|
-
new maplibregl.Map({
|
41
|
-
container: mapContainerRef.current,
|
42
|
-
style: 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json',
|
43
|
-
center: [-75.379143, 39.831200],
|
44
|
-
zoom: 13,
|
45
|
-
}).on('load', loadMap)
|
43
|
+
}
|
46
44
|
}, [])
|
47
45
|
|
48
46
|
|
49
47
|
|
50
48
|
return (
|
51
|
-
<Map
|
49
|
+
<Map>
|
52
50
|
<div
|
53
51
|
ref={mapContainerRef}
|
54
52
|
style={{
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.4.0
|
4
|
+
version: 12.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-02-
|
12
|
+
date: 2023-02-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -1398,7 +1398,6 @@ files:
|
|
1398
1398
|
- app/pb_kits/playbook/pb_map/docs/example.yml
|
1399
1399
|
- app/pb_kits/playbook/pb_map/docs/index.js
|
1400
1400
|
- app/pb_kits/playbook/pb_map/map.test.jsx
|
1401
|
-
- app/pb_kits/playbook/pb_map/pbMapTheme.ts
|
1402
1401
|
- app/pb_kits/playbook/pb_message/_message.jsx
|
1403
1402
|
- app/pb_kits/playbook/pb_message/_message.scss
|
1404
1403
|
- app/pb_kits/playbook/pb_message/_message_mixins.scss
|
@@ -2423,9 +2422,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
2423
2422
|
version: '0'
|
2424
2423
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
2425
2424
|
requirements:
|
2426
|
-
- - "
|
2425
|
+
- - ">="
|
2427
2426
|
- !ruby/object:Gem::Version
|
2428
|
-
version:
|
2427
|
+
version: '0'
|
2429
2428
|
requirements: []
|
2430
2429
|
rubygems_version: 3.3.7
|
2431
2430
|
signing_key:
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import colors from '../tokens/exports/_colors.scss'
|
2
|
-
|
3
|
-
const mapTheme = {
|
4
|
-
marker : colors.primary_action,
|
5
|
-
maptiles: 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json',
|
6
|
-
flyToConfig: {
|
7
|
-
zoom: 13,
|
8
|
-
bearing: 0,
|
9
|
-
curve: 1.42, // change the speed at which it zooms
|
10
|
-
easing: function (t: any) {
|
11
|
-
return t;
|
12
|
-
},
|
13
|
-
essential: true
|
14
|
-
},
|
15
|
-
zoomConfig: { duration:1000 },
|
16
|
-
mapConfig: {
|
17
|
-
style: 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json',
|
18
|
-
zoom: 13,
|
19
|
-
attributionControl: false,
|
20
|
-
}
|
21
|
-
}
|
22
|
-
|
23
|
-
export default mapTheme
|