playbook_ui 12.3.1 → 12.4.0.pre.alpha.map1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +1 -1
- data/app/pb_kits/playbook/data/menu.yml +1 -0
- data/app/pb_kits/playbook/index.js +5 -1
- data/app/pb_kits/playbook/pb_button/_button.tsx +2 -2
- data/app/pb_kits/playbook/pb_dashboard_value/{_dashboard_value.jsx → _dashboard_value.tsx} +12 -14
- data/app/pb_kits/playbook/pb_date_time_stacked/{_date_time_stacked.jsx → _date_time_stacked.tsx} +2 -6
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.jsx +5 -2
- data/app/pb_kits/playbook/pb_dialog/_dialog.scss +2 -0
- data/app/pb_kits/playbook/pb_map/_map.scss +114 -2
- data/app/pb_kits/playbook/pb_map/_map.tsx +42 -2
- data/app/pb_kits/playbook/pb_map/docs/_map_default.jsx +48 -24
- 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 +16 -14
- data/app/pb_kits/playbook/pb_map/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_map/pbMapTheme.ts +23 -0
- data/app/pb_kits/playbook/pb_person/{_person.jsx → _person.tsx} +6 -8
- data/app/pb_kits/playbook/pb_person/person.test.js +43 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +102 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +155 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.jsx +10 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.md +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_initial_country.jsx +12 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_initial_country.md +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_only_countries.jsx +13 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_only_countries.md +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.jsx +13 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.md +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +4 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +74 -0
- data/app/pb_kits/playbook/pb_phone_number_input/types.d.ts +1 -0
- data/app/pb_kits/playbook/pb_radio/_radio.scss +19 -11
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +1 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -1
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on.html.erb +7 -6
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on.jsx +8 -8
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +1 -1
- data/app/pb_kits/playbook/pb_title_count/{_title_count.jsx → _title_count.tsx} +7 -5
- data/app/pb_kits/playbook/pb_title_count/title_count.test.js +69 -0
- data/app/pb_kits/playbook/playbook-doc.js +2 -0
- data/app/pb_kits/playbook/tokens/_colors.scss +24 -24
- data/lib/playbook/version.rb +2 -2
- metadata +26 -9
- /data/app/pb_kits/playbook/pb_dashboard_value/{dashboardValueSettings.js → dashboardValueSettings.ts} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cfb56ccfe4d074f937f3852aca075561d3c1bfcc5d17dba3387cd7c83d65e2d3
|
|
4
|
+
data.tar.gz: 782e95a4369e896264d23ed06aa3abd7b51ac4998cf88a0b196964ccdf95c7b5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e568396ef02503818d31e36846f0bb92c69e0857dd7a7c10b4c8d7de0187cf5adf29c87092f4fc29804efaaa5816e0d08198699843bb6755bedcff83220dd205
|
|
7
|
+
data.tar.gz: 746452d8c6cffee0eec29e9864283b81d6fc63df8218eee2f5ed5c320916026ca63076f7add17ef57b51a1a0e16dbf600d1ae2dfa5e393e2e4c256c675304bc0
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
@import 'pb_passphrase/passphrase';
|
|
62
62
|
@import 'pb_person/person';
|
|
63
63
|
@import 'pb_person_contact/person_contact';
|
|
64
|
+
@import 'pb_phone_number_input/phone_number_input';
|
|
64
65
|
@import 'pb_pill/pill';
|
|
65
66
|
@import 'pb_popover/popover';
|
|
66
67
|
@import 'pb_progress_pills/progress_pills';
|
|
@@ -106,4 +107,3 @@
|
|
|
106
107
|
@import './utilities/display';
|
|
107
108
|
@import './utilities/flexbox';
|
|
108
109
|
@import './utilities/focus';
|
|
109
|
-
|
|
@@ -69,6 +69,7 @@ export { default as Passphrase } from './pb_passphrase/_passphrase'
|
|
|
69
69
|
export { default as PbReactPopover } from './pb_popover/_popover'
|
|
70
70
|
export { default as Person } from './pb_person/_person'
|
|
71
71
|
export { default as PersonContact } from './pb_person_contact/_person_contact'
|
|
72
|
+
export { default as PhoneNumberInput} from './pb_phone_number_input/_phone_number_input'
|
|
72
73
|
export { default as Pill } from './pb_pill/_pill'
|
|
73
74
|
export { default as ProgressPills } from './pb_progress_pills/_progress_pills'
|
|
74
75
|
export { default as ProgressSimple } from './pb_progress_simple/_progress_simple'
|
|
@@ -122,4 +123,7 @@ export { default as PbTable } from './pb_table'
|
|
|
122
123
|
export { default as PbTextarea } from './pb_textarea'
|
|
123
124
|
export { default as PbTooltip } from './pb_tooltip'
|
|
124
125
|
export { default as PbTypeahead } from './pb_typeahead'
|
|
125
|
-
export { default as dialogHelper } from './pb_dialog/dialogHelper'
|
|
126
|
+
export { default as dialogHelper } from './pb_dialog/dialogHelper'
|
|
127
|
+
|
|
128
|
+
//Theming
|
|
129
|
+
export {default as mapTheme} from './pb_map/pbMapTheme'
|
|
@@ -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,5 +1,3 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
1
|
import React from 'react'
|
|
4
2
|
import classnames from 'classnames'
|
|
5
3
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
|
@@ -11,22 +9,22 @@ import StatValue from '../pb_stat_value/_stat_value'
|
|
|
11
9
|
|
|
12
10
|
type DashboardValueProps = {
|
|
13
11
|
align?: 'left' | 'center' | 'right',
|
|
14
|
-
aria?:
|
|
12
|
+
aria?: { [key: string]: string },
|
|
15
13
|
className?: string,
|
|
16
|
-
data?:
|
|
14
|
+
data?: { [key: string]: string },
|
|
17
15
|
id?: string,
|
|
18
16
|
statChange?: {
|
|
19
|
-
change
|
|
20
|
-
value?: string |
|
|
17
|
+
change? : 'increase' | 'decrease' | 'neutral',
|
|
18
|
+
value?: string | number
|
|
21
19
|
},
|
|
22
20
|
statLabel?: string,
|
|
23
21
|
statValue?: {
|
|
24
22
|
unit?: string,
|
|
25
|
-
value?: string |
|
|
23
|
+
value?: string | number
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
const DashboardValue = (props: DashboardValueProps) => {
|
|
27
|
+
const DashboardValue = (props: DashboardValueProps): React.ReactElement => {
|
|
30
28
|
const {
|
|
31
29
|
align = 'left',
|
|
32
30
|
aria = {},
|
|
@@ -53,21 +51,21 @@ const DashboardValue = (props: DashboardValueProps) => {
|
|
|
53
51
|
className={classes}
|
|
54
52
|
id={id}
|
|
55
53
|
>
|
|
56
|
-
|
|
54
|
+
{ statLabel &&
|
|
57
55
|
<Body color="light">{statLabel}</Body>
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
}
|
|
57
|
+
{ statValue &&
|
|
60
58
|
<StatValue
|
|
61
59
|
unit={statValue.unit}
|
|
62
60
|
value={statValue.value}
|
|
63
61
|
/>
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
}
|
|
63
|
+
{ statChange &&
|
|
66
64
|
<StatChange
|
|
67
65
|
change={statChange.change}
|
|
68
66
|
value={statChange.value}
|
|
69
67
|
/>
|
|
70
|
-
|
|
68
|
+
}
|
|
71
69
|
</div>
|
|
72
70
|
)
|
|
73
71
|
}
|
data/app/pb_kits/playbook/pb_date_time_stacked/{_date_time_stacked.jsx → _date_time_stacked.tsx}
RENAMED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
/* @flow */
|
|
3
|
-
|
|
4
2
|
import React from 'react'
|
|
5
3
|
|
|
6
4
|
import { buildCss } from '../utilities/props'
|
|
@@ -20,7 +18,7 @@ type DateTimeStackedProps = {
|
|
|
20
18
|
timeZone?: string,
|
|
21
19
|
}
|
|
22
20
|
|
|
23
|
-
const DateTimeStacked = (props: DateTimeStackedProps) => {
|
|
21
|
+
const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
|
|
24
22
|
if (props.date) deprecatedProps('Date Time Stacked', ['date'])
|
|
25
23
|
|
|
26
24
|
const {
|
|
@@ -34,7 +32,7 @@ const DateTimeStacked = (props: DateTimeStackedProps) => {
|
|
|
34
32
|
|
|
35
33
|
return (
|
|
36
34
|
<Flex
|
|
37
|
-
inline=
|
|
35
|
+
inline={false}
|
|
38
36
|
vertical="stretch"
|
|
39
37
|
{...props}
|
|
40
38
|
>
|
|
@@ -44,7 +42,6 @@ const DateTimeStacked = (props: DateTimeStackedProps) => {
|
|
|
44
42
|
bold
|
|
45
43
|
dark={dark}
|
|
46
44
|
date={date || datetime}
|
|
47
|
-
timeZone={timeZone}
|
|
48
45
|
/>
|
|
49
46
|
</FlexItem>
|
|
50
47
|
|
|
@@ -57,7 +54,6 @@ const DateTimeStacked = (props: DateTimeStackedProps) => {
|
|
|
57
54
|
className={classes}
|
|
58
55
|
dark={dark}
|
|
59
56
|
date={date || datetime}
|
|
60
|
-
tag="caption"
|
|
61
57
|
timeZone={timeZone}
|
|
62
58
|
/>
|
|
63
59
|
</FlexItem>
|
|
@@ -9,17 +9,20 @@ const DateTimeStackedDefault = (props) => (
|
|
|
9
9
|
{...props}
|
|
10
10
|
/>
|
|
11
11
|
<br />
|
|
12
|
+
<DateTimeStacked
|
|
13
|
+
datetime={new Date(2018, 2, 20)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
<br />
|
|
12
17
|
<DateTimeStacked
|
|
13
18
|
datetime={new Date()}
|
|
14
19
|
timeZone="Asia/Tokyo"
|
|
15
|
-
|
|
16
20
|
{...props}
|
|
17
21
|
/>
|
|
18
22
|
<br />
|
|
19
23
|
<DateTimeStacked
|
|
20
24
|
datetime={new Date()}
|
|
21
25
|
timeZone="America/Denver"
|
|
22
|
-
|
|
23
26
|
{...props}
|
|
24
27
|
/>
|
|
25
28
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
@import "../tokens/border_radius";
|
|
6
6
|
@import "../tokens/spacing";
|
|
7
7
|
@import "../tokens/animation-curves";
|
|
8
|
+
@import "../tokens/positioning";
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
@@ -119,6 +120,7 @@
|
|
|
119
120
|
position: sticky;
|
|
120
121
|
top: 0;
|
|
121
122
|
background-color: $white;
|
|
123
|
+
z-index: $z_8;
|
|
122
124
|
}
|
|
123
125
|
|
|
124
126
|
// @include pb_card;
|
|
@@ -1,8 +1,120 @@
|
|
|
1
1
|
@import "../tokens/typography";
|
|
2
|
-
@import "../tokens/colors";
|
|
2
|
+
@import "../tokens/colors";
|
|
3
3
|
@import "../tokens/shadows";
|
|
4
|
+
@import "../tokens/border_radius";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
[class*="pb_map"] {
|
|
6
7
|
font-family: $font_family_base !important;
|
|
7
8
|
|
|
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
|
+
}
|
|
8
120
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import classnames from 'classnames'
|
|
3
3
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
|
4
|
-
import { globalProps } from '../utilities/globalProps'
|
|
4
|
+
import { globalProps, 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'
|
|
6
9
|
|
|
7
10
|
type MapProps = {
|
|
8
11
|
aria?: { [key: string]: string },
|
|
@@ -10,7 +13,12 @@ type MapProps = {
|
|
|
10
13
|
className?: string,
|
|
11
14
|
data?: { [key: string]: string },
|
|
12
15
|
id?: string,
|
|
13
|
-
|
|
16
|
+
zoomBtns?: boolean,
|
|
17
|
+
flyTo?: boolean,
|
|
18
|
+
zoomInClick?: () => {},
|
|
19
|
+
zoomOutClick?: () => {},
|
|
20
|
+
flyToClick?: () => {},
|
|
21
|
+
} & GlobalProps
|
|
14
22
|
|
|
15
23
|
const Map = (props: MapProps) => {
|
|
16
24
|
const {
|
|
@@ -19,6 +27,11 @@ const Map = (props: MapProps) => {
|
|
|
19
27
|
className,
|
|
20
28
|
data = {},
|
|
21
29
|
id,
|
|
30
|
+
zoomBtns = false,
|
|
31
|
+
flyTo = false,
|
|
32
|
+
zoomInClick,
|
|
33
|
+
zoomOutClick,
|
|
34
|
+
flyToClick
|
|
22
35
|
} = props
|
|
23
36
|
|
|
24
37
|
const ariaProps = buildAriaProps(aria)
|
|
@@ -32,6 +45,33 @@ const Map = (props: MapProps) => {
|
|
|
32
45
|
className={classes}
|
|
33
46
|
id={id}
|
|
34
47
|
>
|
|
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
|
+
}
|
|
35
75
|
{children}
|
|
36
76
|
</div>
|
|
37
77
|
)
|
|
@@ -1,40 +1,64 @@
|
|
|
1
|
-
import React, { useRef, useEffect } from 'react'
|
|
1
|
+
import React, { useRef, useEffect, useState } from 'react'
|
|
2
2
|
import { Map } from '../../'
|
|
3
|
-
|
|
3
|
+
import "maplibre-gl/dist/maplibre-gl.css"
|
|
4
4
|
import maplibregl from 'maplibre-gl'
|
|
5
|
+
import mapTheme from '../pbMapTheme'
|
|
5
6
|
|
|
6
|
-
const MapDefault = () => {
|
|
7
|
+
const MapDefault = (props) => {
|
|
7
8
|
|
|
9
|
+
//set Map instance to access from outside useEffect
|
|
10
|
+
const [mapInstance, setMapInstance] = useState(null)
|
|
8
11
|
const mapContainerRef = useRef(null)
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
//Set default position
|
|
14
|
+
const defaultPosition = [-75.379143, 39.831200]
|
|
15
|
+
|
|
16
|
+
// linking Maplibre methods to PB custom zoom in, zoom out, and fly to buttons
|
|
17
|
+
const handleZoomIn = (map) => {map.zoomIn({...mapTheme.zoomConfig})}
|
|
18
|
+
const handleZoomOut = (map) => {map.zoomOut({...mapTheme.zoomConfig})}
|
|
19
|
+
const handleFlyTo = (map) => {map.flyTo({
|
|
20
|
+
center: defaultPosition,
|
|
21
|
+
... mapTheme.flyToConfig
|
|
22
|
+
});}
|
|
23
|
+
|
|
24
|
+
//This function is called by the useEffect when map instance first loads
|
|
25
|
+
const loadMap = ( { target: map }) => {
|
|
20
26
|
//set marker/pin
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}).
|
|
25
|
-
.setPopup(new maplibregl.Popup({className: 'map_popup', closeButton: false}).setHTML(`<h4 class="pb_title_kit_size_4">Hello World!</h4>`)) // add popup
|
|
27
|
+
new maplibregl.Marker({
|
|
28
|
+
color: mapTheme.marker,
|
|
29
|
+
}).setLngLat(defaultPosition)
|
|
30
|
+
.setPopup(new maplibregl.Popup({closeButton: false}).setHTML(`<h4 class="pb_title_kit_size_4">Hello World!</h4>`)) // add popup
|
|
26
31
|
.addTo(map);
|
|
27
32
|
|
|
28
|
-
//add zoom controls
|
|
29
|
-
map.addControl(new maplibregl.NavigationControl({showCompass: false}))
|
|
30
|
-
|
|
31
33
|
// disable map zoom when using scroll
|
|
32
34
|
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)
|
|
33
51
|
|
|
34
|
-
}
|
|
35
52
|
}, [])
|
|
53
|
+
|
|
36
54
|
return (
|
|
37
|
-
<Map
|
|
55
|
+
<Map flyTo
|
|
56
|
+
flyToClick={()=> {handleFlyTo(mapInstance)}}
|
|
57
|
+
zoomBtns
|
|
58
|
+
zoomInClick={() => {handleZoomIn(mapInstance)}}
|
|
59
|
+
zoomOutClick={()=> {handleZoomOut(mapInstance)}}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
38
62
|
<div
|
|
39
63
|
ref={mapContainerRef}
|
|
40
64
|
style={{
|
|
@@ -44,7 +68,7 @@ return (
|
|
|
44
68
|
top: 0,
|
|
45
69
|
bottom: 0,
|
|
46
70
|
}}
|
|
47
|
-
|
|
71
|
+
/>
|
|
48
72
|
</Map>
|
|
49
73
|
)
|
|
50
74
|
}
|
|
@@ -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
|
-
|
|
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' />`
|
|
5
|
+
- import the maplibre-gl CSS using `import "maplibre-gl/dist/maplibre-gl.css"` OR 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
|
+
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' />`
|
|
8
7
|
- To use Maplibre, you must also set a height on the containing div.
|
|
9
8
|
- You can now use MapLibre within the Map Kit as shown in this example.
|
|
10
9
|
|
|
11
10
|
__Notes__ :
|
|
12
|
-
- The MapLibre Marker allows us to pass it a HEX value as a color prop
|
|
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
|
+
- To enable custom buttons, set `zoomBtns` and `flyTo` to true and pass in `zoomInClick`, `zoomOutClick` and `flyToClick` as shown in this doc example.
|
|
13
13
|
- `scrollZoom` has been disabled in these doc examples for page usability
|
|
@@ -2,25 +2,19 @@ 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'
|
|
5
7
|
|
|
6
|
-
const MapWithPlugin = () => {
|
|
8
|
+
const MapWithPlugin = (props) => {
|
|
7
9
|
|
|
8
10
|
const mapContainerRef = useRef(null)
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
})
|
|
12
|
+
//This function should contain all maplibre related code
|
|
13
|
+
const loadMap = ( { target: map }) => {
|
|
20
14
|
//set marker/pin
|
|
21
15
|
/* eslint-disable-next-line */
|
|
22
16
|
const marker = new maplibregl.Marker({
|
|
23
|
-
color:
|
|
17
|
+
color: mapTheme.marker,
|
|
24
18
|
}).setLngLat([-75.379143, 39.831200])
|
|
25
19
|
.setPopup(new maplibregl.Popup({className: 'map_popup', closeButton: false}).setHTML(`<h4 class="pb_title_kit_size_4">Hello World!</h4>`)) // add popup
|
|
26
20
|
.addTo(map);
|
|
@@ -40,13 +34,21 @@ const MapWithPlugin = () => {
|
|
|
40
34
|
}
|
|
41
35
|
});
|
|
42
36
|
map.addControl(draw);
|
|
43
|
-
|
|
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)
|
|
44
46
|
}, [])
|
|
45
47
|
|
|
46
48
|
|
|
47
49
|
|
|
48
50
|
return (
|
|
49
|
-
<Map>
|
|
51
|
+
<Map {...props} >
|
|
50
52
|
<div
|
|
51
53
|
ref={mapContainerRef}
|
|
52
54
|
style={{
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
1
|
import React from 'react'
|
|
4
2
|
import classnames from 'classnames'
|
|
5
3
|
|
|
@@ -14,15 +12,15 @@ import Body from '../pb_body/_body'
|
|
|
14
12
|
import Title from '../pb_title/_title'
|
|
15
13
|
|
|
16
14
|
type PersonProps = {
|
|
17
|
-
aria?:
|
|
18
|
-
className?: string |
|
|
19
|
-
data?:
|
|
15
|
+
aria?: { [key: string]: string },
|
|
16
|
+
className?: string | string[],
|
|
17
|
+
data?: { [key: string]: string },
|
|
20
18
|
firstName: string,
|
|
21
19
|
id?: string,
|
|
22
20
|
lastName: string,
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
const Person = (props: PersonProps) => {
|
|
23
|
+
const Person = (props: PersonProps): React.ReactElement => {
|
|
26
24
|
const {
|
|
27
25
|
aria = {},
|
|
28
26
|
className,
|
|
@@ -52,13 +50,13 @@ const Person = (props: PersonProps) => {
|
|
|
52
50
|
>
|
|
53
51
|
{firstName}
|
|
54
52
|
</Body>
|
|
55
|
-
|
|
53
|
+
{lastName &&
|
|
56
54
|
<Title
|
|
57
55
|
className="pb_person_first"
|
|
58
56
|
size={4}
|
|
59
57
|
text={` ${lastName}`}
|
|
60
58
|
/>
|
|
61
|
-
|
|
59
|
+
}
|
|
62
60
|
</div>
|
|
63
61
|
)
|
|
64
62
|
}
|