playbook_ui 12.4.0 → 12.5.0.pre.alpha.datepickerinput1
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 +4 -1
- data/app/pb_kits/playbook/pb_button/_button.tsx +2 -2
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +9 -6
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +76 -55
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +1 -0
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_input_styles.scss +68 -0
- 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/_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 +47 -24
- data/app/pb_kits/playbook/pb_map/docs/_map_default.md +5 -5
- data/app/pb_kits/playbook/pb_map/docs/_map_with_plugin.jsx +20 -17
- 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_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 +3 -3
- 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 +14 -7
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.jsx +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d384648066bfca20bd817be4065e8d4710f06672a2a335e451a7748b60c2a74
|
4
|
+
data.tar.gz: 5b95638a4466aedc9ad816b84b22fda494c6c3556ad78bcb9b8053a3a18766fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfb26ce98684faae10c092af1ae16e9f8b3b5641343a5c60164eb489290c1e328e355c3c400822adc0366965ba9d00d4600073b3791b5ef754a6150baa00445e
|
7
|
+
data.tar.gz: c09f2ff8f7b8b8e3f803021421783fc98d931d838e0485c4b0345ac3d654999a08fa07e038e3be68ff2947aba85c4e070e4e80327c8a14fc60dc9e6a26270851
|
@@ -123,4 +123,7 @@ 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'
|
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
|
|
@@ -5,8 +5,7 @@
|
|
5
5
|
@import "./sass_partials/inline_styles";
|
6
6
|
@import "./sass_partials/month_and_year_styles";
|
7
7
|
@import "./sass_partials/time_selection_styles";
|
8
|
-
|
9
|
-
|
8
|
+
@import "./sass_partials/input_styles";
|
10
9
|
|
11
10
|
[class^=pb_date_picker_kit] {
|
12
11
|
.input_wrapper {
|
@@ -20,8 +19,10 @@
|
|
20
19
|
@import "./sass_partials/calendar_input_icon";
|
21
20
|
}
|
22
21
|
|
23
|
-
&:focus,
|
24
|
-
|
22
|
+
&:focus,
|
23
|
+
:focus-within {
|
24
|
+
div.cal_icon_wrapper,
|
25
|
+
input.date_picker_input {
|
25
26
|
@include transition_default;
|
26
27
|
border-color: $primary;
|
27
28
|
}
|
@@ -33,18 +34,20 @@
|
|
33
34
|
@import "./sass_partials/header_styles";
|
34
35
|
@import "./sass_partials/overrides";
|
35
36
|
|
36
|
-
.
|
37
|
+
.date_picker_input.flatpickr-input {
|
37
38
|
text-overflow: ellipsis;
|
38
39
|
padding-right: $space_xl + 10 !important;
|
39
40
|
}
|
41
|
+
|
40
42
|
// Calendar Shadow and Border
|
41
43
|
.flatpickr-calendar {
|
42
44
|
box-shadow: $shadow_deeper;
|
43
45
|
border: 1px solid $border_light;
|
44
46
|
}
|
47
|
+
|
45
48
|
// Hide Caret
|
46
49
|
&:before,
|
47
50
|
&:after {
|
48
51
|
content: none;
|
49
52
|
}
|
50
|
-
}
|
53
|
+
}
|
@@ -5,16 +5,16 @@ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
|
5
5
|
import { deprecatedProps, globalProps, GlobalProps } from '../utilities/globalProps'
|
6
6
|
|
7
7
|
import datePickerHelper from './date_picker_helper'
|
8
|
-
|
9
8
|
import Icon from '../pb_icon/_icon'
|
10
|
-
import
|
9
|
+
import Caption from '../pb_caption/_caption'
|
10
|
+
import Body from '../pb_body/_body'
|
11
11
|
|
12
12
|
type DatePickerProps = {
|
13
13
|
allowInput?: boolean,
|
14
|
-
aria?: {[key: string]: string},
|
14
|
+
aria?: { [key: string]: string },
|
15
15
|
className?: string,
|
16
16
|
dark?: boolean,
|
17
|
-
data?:
|
17
|
+
data?: { [key: string]: string },
|
18
18
|
defaultDate?: string,
|
19
19
|
disableDate?: number[],
|
20
20
|
disableInput?: boolean,
|
@@ -27,15 +27,15 @@ type DatePickerProps = {
|
|
27
27
|
hideLabel?: boolean,
|
28
28
|
id?: string,
|
29
29
|
inLine?: boolean,
|
30
|
-
inputAria?:
|
31
|
-
inputData?:
|
32
|
-
inputOnChange?: (
|
30
|
+
inputAria?: { [key: string]: string },
|
31
|
+
inputData?: { [key: string]: string },
|
32
|
+
inputOnChange?: (e: React.FormEvent<HTMLInputElement>) => void,
|
33
33
|
inputValue?: any,
|
34
34
|
label?: string,
|
35
35
|
maxDate: string,
|
36
36
|
minDate: string,
|
37
37
|
name: string,
|
38
|
-
pickerId?:
|
38
|
+
pickerId?: string,
|
39
39
|
placeholder?: string,
|
40
40
|
positionElement?: HTMLElement | null,
|
41
41
|
scrollContainer?: string,
|
@@ -47,7 +47,7 @@ type DatePickerProps = {
|
|
47
47
|
yearRange?: number[],
|
48
48
|
} & GlobalProps
|
49
49
|
|
50
|
-
const DatePicker = (props: DatePickerProps) => {
|
50
|
+
const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
51
51
|
if (props.plugins) deprecatedProps('Date Picker', ['plugins'])
|
52
52
|
|
53
53
|
const {
|
@@ -67,9 +67,9 @@ const DatePicker = (props: DatePickerProps) => {
|
|
67
67
|
hideIcon = false,
|
68
68
|
hideLabel = false,
|
69
69
|
id,
|
70
|
-
inLine =
|
71
|
-
inputAria,
|
72
|
-
inputData,
|
70
|
+
inLine = false,
|
71
|
+
inputAria = {},
|
72
|
+
inputData = {},
|
73
73
|
inputOnChange,
|
74
74
|
inputValue,
|
75
75
|
label = 'Date Picker',
|
@@ -77,7 +77,7 @@ const DatePicker = (props: DatePickerProps) => {
|
|
77
77
|
minDate,
|
78
78
|
mode = 'single',
|
79
79
|
name,
|
80
|
-
onChange = () => {},
|
80
|
+
onChange = () => { void 0 },
|
81
81
|
pickerId,
|
82
82
|
placeholder = 'Select Date',
|
83
83
|
plugins = false,
|
@@ -87,11 +87,14 @@ const DatePicker = (props: DatePickerProps) => {
|
|
87
87
|
selectionType = '',
|
88
88
|
showTimezone = false,
|
89
89
|
staticPosition = true,
|
90
|
-
yearRange = [
|
90
|
+
yearRange = [1900, 2100],
|
91
91
|
} = props
|
92
92
|
|
93
93
|
const ariaProps = buildAriaProps(aria)
|
94
94
|
const dataProps = buildDataProps(data)
|
95
|
+
const inputAriaProps = buildAriaProps(inputAria)
|
96
|
+
const inputDataProps = buildDataProps(inputData)
|
97
|
+
|
95
98
|
const classes = classnames(
|
96
99
|
buildCss('pb_date_picker_kit'),
|
97
100
|
globalProps(props),
|
@@ -128,13 +131,13 @@ const DatePicker = (props: DatePickerProps) => {
|
|
128
131
|
|
129
132
|
const iconWrapperClass = () => {
|
130
133
|
let base = 'cal_icon_wrapper'
|
131
|
-
if (dark){
|
134
|
+
if (dark) {
|
132
135
|
base += ' dark'
|
133
136
|
}
|
134
|
-
if (hideLabel){
|
137
|
+
if (hideLabel) {
|
135
138
|
base += ' no_label_shift'
|
136
139
|
}
|
137
|
-
if (error){
|
140
|
+
if (error) {
|
138
141
|
base += ' error'
|
139
142
|
}
|
140
143
|
return base
|
@@ -142,57 +145,75 @@ const DatePicker = (props: DatePickerProps) => {
|
|
142
145
|
|
143
146
|
return (
|
144
147
|
<div
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
148
|
+
{...ariaProps}
|
149
|
+
{...dataProps}
|
150
|
+
className={classes}
|
151
|
+
id={id}
|
149
152
|
>
|
150
|
-
<div
|
151
|
-
|
152
|
-
|
153
|
+
<div
|
154
|
+
{...inputAriaProps}
|
155
|
+
{...inputDataProps}
|
156
|
+
className="input_wrapper">
|
157
|
+
|
158
|
+
<Caption
|
159
|
+
className="pb_date_picker_kit_label"
|
160
|
+
text={hideLabel ? null : label}
|
161
|
+
/>
|
162
|
+
|
163
|
+
<div className="date_picker_input_wrapper">
|
164
|
+
<input
|
153
165
|
autoComplete="off"
|
154
|
-
|
155
|
-
data={inputData}
|
166
|
+
className="date_picker_input"
|
156
167
|
disabled={disableInput}
|
157
|
-
error={error}
|
158
168
|
id={pickerId}
|
159
|
-
label={hideLabel ? null : label}
|
160
169
|
name={name}
|
161
170
|
onChange={inputOnChange}
|
162
171
|
placeholder={placeholder}
|
163
172
|
value={inputValue}
|
164
|
-
|
173
|
+
/>
|
174
|
+
|
175
|
+
{error && <Body
|
176
|
+
status="negative"
|
177
|
+
text={error}
|
178
|
+
variant={null}
|
179
|
+
/>
|
180
|
+
}
|
181
|
+
</div>
|
165
182
|
|
166
183
|
{!hideIcon &&
|
167
184
|
<div
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
<Icon
|
172
|
-
className="cal_icon"
|
173
|
-
icon="calendar-alt"
|
174
|
-
/>
|
175
|
-
</div>
|
176
|
-
}
|
177
|
-
|
178
|
-
|
179
|
-
{ hideIcon && inLine ? <><div
|
180
|
-
className={iconWrapperClass()}
|
181
|
-
id={`${pickerId}-icon-plus`}
|
182
|
-
>
|
183
|
-
<Icon
|
184
|
-
className="date-picker-plus-icon"
|
185
|
-
icon="plus" />
|
186
|
-
</div><div
|
187
|
-
className={iconWrapperClass()}
|
188
|
-
id={`${pickerId}-angle-down`}
|
189
|
-
>
|
185
|
+
className={iconWrapperClass()}
|
186
|
+
id={`cal-icon-${pickerId}`}
|
187
|
+
>
|
190
188
|
<Icon
|
191
|
-
className="
|
192
|
-
icon="
|
193
|
-
|
194
|
-
|
189
|
+
className="cal_icon"
|
190
|
+
icon="calendar-alt"
|
191
|
+
/>
|
192
|
+
</div>
|
193
|
+
}
|
195
194
|
|
195
|
+
{hideIcon && inLine ?
|
196
|
+
<div>
|
197
|
+
<div
|
198
|
+
className={iconWrapperClass()}
|
199
|
+
id={`${pickerId}-icon-plus`}
|
200
|
+
>
|
201
|
+
<Icon
|
202
|
+
className="date-picker-plus-icon"
|
203
|
+
icon="plus"
|
204
|
+
/>
|
205
|
+
</div>
|
206
|
+
<div
|
207
|
+
className={iconWrapperClass()}
|
208
|
+
id={`${pickerId}-angle-down`}
|
209
|
+
>
|
210
|
+
<Icon
|
211
|
+
className="angle_down_icon"
|
212
|
+
icon="angle-down"
|
213
|
+
/>
|
214
|
+
</div>
|
215
|
+
</div>
|
216
|
+
: null}
|
196
217
|
</div>
|
197
218
|
</div>
|
198
219
|
)
|
@@ -112,6 +112,7 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
112
112
|
// ===========================================================
|
113
113
|
|
114
114
|
flatpickr(`#${pickerId}`, {
|
115
|
+
allowInput,
|
115
116
|
closeOnSelect,
|
116
117
|
disableMobile: true,
|
117
118
|
dateFormat: getDateFormat(),
|
@@ -0,0 +1,68 @@
|
|
1
|
+
@import "../../pb_textarea/textarea_mixin";
|
2
|
+
|
3
|
+
[class^=pb_date_picker_kit] {
|
4
|
+
margin-bottom: $space_sm;
|
5
|
+
|
6
|
+
.pb_date_picker_kit_label {
|
7
|
+
margin-bottom: $space_xs;
|
8
|
+
display: block;
|
9
|
+
}
|
10
|
+
|
11
|
+
.date_picker_input_wrapper {
|
12
|
+
display: block;
|
13
|
+
|
14
|
+
input::placeholder,
|
15
|
+
.date_picker_input .placeholder {
|
16
|
+
@include pb_body_light;
|
17
|
+
}
|
18
|
+
|
19
|
+
input,
|
20
|
+
.date_picker_input {
|
21
|
+
max-height: 45px;
|
22
|
+
@include pb_textarea_light;
|
23
|
+
overflow: hidden;
|
24
|
+
}
|
25
|
+
|
26
|
+
input:hover,
|
27
|
+
.date_picker_input:hover {
|
28
|
+
background-color: rgba($focus_input_light, $opacity_5);
|
29
|
+
}
|
30
|
+
|
31
|
+
input:focus,
|
32
|
+
.date_picker_input:focus,
|
33
|
+
input:-webkit-autofill:focus,
|
34
|
+
.date_picker_input:-webkit-autofill:focus {
|
35
|
+
@include pb_textarea_focus;
|
36
|
+
@include transition_default;
|
37
|
+
border-color: $primary;
|
38
|
+
background-color: rgba($focus_input_light, $opacity_5);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
&.error {
|
43
|
+
.date_picker_input_wrapper {
|
44
|
+
[class*=pb_body_kit] {
|
45
|
+
margin-top: $space_xs / 2;
|
46
|
+
}
|
47
|
+
|
48
|
+
input,
|
49
|
+
.date_picker_input {
|
50
|
+
border-color: $error;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
&.inline {
|
56
|
+
.date_picker_input_wrapper input::placeholder,
|
57
|
+
.date_picker_input_wrapper .date_picker_input .placeholder {
|
58
|
+
opacity: 1;
|
59
|
+
}
|
60
|
+
|
61
|
+
&:not(:hover) {
|
62
|
+
.date_picker_input_wrapper input:not(:focus) {
|
63
|
+
background-color: transparent;
|
64
|
+
border-color: transparent;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import classnames from 'classnames'
|
3
|
+
|
4
|
+
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
5
|
+
import { globalProps } from '../utilities/globalProps'
|
6
|
+
|
7
|
+
import Body from '../pb_body/_body'
|
8
|
+
import Icon from '../pb_icon/_icon'
|
9
|
+
|
10
|
+
type LoadingInlineProps = {
|
11
|
+
align?: "left" | "center" | "right",
|
12
|
+
aria?: { [key: string]: string },
|
13
|
+
className?: string,
|
14
|
+
data?: { [key: string]: string },
|
15
|
+
id?: string,
|
16
|
+
}
|
17
|
+
|
18
|
+
const LoadingInline = (props: LoadingInlineProps) => {
|
19
|
+
const {
|
20
|
+
align = 'left',
|
21
|
+
aria = {},
|
22
|
+
className,
|
23
|
+
data = {},
|
24
|
+
id,
|
25
|
+
} = props
|
26
|
+
|
27
|
+
const ariaProps = buildAriaProps(aria)
|
28
|
+
const dataProps = buildDataProps(data)
|
29
|
+
const classes = classnames(
|
30
|
+
buildCss(`pb_loading_inline_kit_${align}`),
|
31
|
+
globalProps(props),
|
32
|
+
className
|
33
|
+
)
|
34
|
+
|
35
|
+
return (
|
36
|
+
<div
|
37
|
+
{...ariaProps}
|
38
|
+
{...dataProps}
|
39
|
+
className={classes}
|
40
|
+
id={id}
|
41
|
+
>
|
42
|
+
<Body color="light">
|
43
|
+
<Icon
|
44
|
+
aria={{ label: 'loading icon' }}
|
45
|
+
fixedWidth
|
46
|
+
icon="spinner"
|
47
|
+
pulse
|
48
|
+
/>
|
49
|
+
{' Loading'}
|
50
|
+
</Body>
|
51
|
+
</div>
|
52
|
+
)
|
53
|
+
}
|
54
|
+
|
55
|
+
export default LoadingInline
|
@@ -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
|
+
})
|
@@ -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
|
)
|