@digitransit-component/digitransit-component-autosuggest-panel 10.0.2 → 11.0.0
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.
- package/lib/index.cjs +1 -1
- package/lib/index.cjs.map +1 -1
- package/lib/index.development.cjs +314 -412
- package/lib/index.js +314 -412
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cx from 'classnames';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import {
|
|
3
|
+
import React, { useState, useReducer, useRef } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { ReactSortable } from 'react-sortablejs';
|
|
6
6
|
import DTAutoSuggest from '@digitransit-component/digitransit-component-autosuggest';
|
|
7
7
|
import Icon, { defaultColors } from '@digitransit-component/digitransit-component-icon';
|
|
@@ -9,41 +9,6 @@ import isEmpty from 'lodash/isEmpty';
|
|
|
9
9
|
import { useSelect } from 'downshift';
|
|
10
10
|
import { createInstance } from 'i18next';
|
|
11
11
|
|
|
12
|
-
function _typeof(o) {
|
|
13
|
-
"@babel/helpers - typeof";
|
|
14
|
-
|
|
15
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
16
|
-
return typeof o;
|
|
17
|
-
} : function (o) {
|
|
18
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
19
|
-
}, _typeof(o);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function toPrimitive(t, r) {
|
|
23
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
24
|
-
var e = t[Symbol.toPrimitive];
|
|
25
|
-
if (void 0 !== e) {
|
|
26
|
-
var i = e.call(t, r);
|
|
27
|
-
if ("object" != _typeof(i)) return i;
|
|
28
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
29
|
-
}
|
|
30
|
-
return ("string" === r ? String : Number)(t);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function toPropertyKey(t) {
|
|
34
|
-
var i = toPrimitive(t, "string");
|
|
35
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function _defineProperty(e, r, t) {
|
|
39
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
40
|
-
value: t,
|
|
41
|
-
enumerable: true,
|
|
42
|
-
configurable: true,
|
|
43
|
-
writable: true
|
|
44
|
-
}) : e[r] = t, e;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
12
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
48
13
|
if (null == r) return {};
|
|
49
14
|
var t = {};
|
|
@@ -93,7 +58,7 @@ function styleInject(css, ref) {
|
|
|
93
58
|
}
|
|
94
59
|
}
|
|
95
60
|
|
|
96
|
-
var css_248z$1 = ".select_combobox-container__l-gXK {\n background-color: #fff;\n border: solid #888 1px;\n display: flex;\n align-items: center;\n border-radius: 5px;\n height: 50px;\n justify-content: space-between;\n flex-grow: 1;\n}\n.select_combobox-container__l-gXK:focus-within {\n border-color: #007ac9;\n}\n.select_combobox-container__l-gXK .select_left-column__NCDpJ {\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n\n.select_combobox-label__QYe0V {\n font-size: 12px;\n line-height: 20px;\n color: #666;\n letter-spacing: -0.48px;\n margin-left: 12px;\n margin-top: 4px;\n}\n\n.select_container__U5yMR {\n position: relative;\n width: 100%;\n height: 100%;\n}\n.select_container__U5yMR > div {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n height: 100%;\n cursor: pointer;\n}\n.select_container__U5yMR .select_suggestion__7in7q {\n font-size: 15px;\n line-height: 49px;\n height: 50px;\n padding: 0 0 0 12px;\n letter-spacing: -0.6px;\n color: #333;\n font-weight: 500;\n}\n.select_container__U5yMR .select_suggestionHighlighted__HV-5T {\n font-size: 15px;\n font-weight: 500;\n background: #f2f5f7;\n}\n.select_container__U5yMR .select_suggestionsContainerOpen__SzPE6 {\n position: absolute;\n background-color: #fff;\n z-index: 20;\n max-height: 250px;\n overflow-x: hidden;\n overflow-y: scroll;\n border-radius: 5px;\n box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.06);\n border: 1px rgba(0, 0, 0, 0.1) solid;\n top: calc(100% + 4px);\n left: 0;\n width: 100%;\n list-style-type: none;\n padding: 0;\n margin: 0;\n}\n.select_container__U5yMR .select_suggestionsContainerOpen__SzPE6 ul {\n padding: 0;\n margin: 0;\n}\n.select_container__U5yMR .select_suggestionsContainerOpen__SzPE6 li:not(:last-child) {\n border-bottom: 1px solid #ddd;\n}\n.select_container__U5yMR .select_input__tiwn5 {\n appearance: none;\n margin: -4px 0 0 0;\n padding-left: 12px;\n border: none;\n height: 26px;\n}\n.select_container__U5yMR .select_input__tiwn5:focus {\n outline: none;\n border: none;\n box-shadow: none;\n background: #fff;\n}\n.select_container__U5yMR .select_input__tiwn5:read-only {\n cursor: pointer;\n background: #fff;\n}\n.select_container__U5yMR .select_input__tiwn5 {\n background: #fff;\n font-weight: 500;\n box-shadow: none;\n font-size: 15px;\n font-stretch: normal;\n font-style: normal;\n line-height: 1.33;\n letter-spacing: -0.6px;\n color: #333;\n}";
|
|
61
|
+
var css_248z$1 = ".select_combobox-container__l-gXK {\n background-color: #fff;\n border: solid #888 1px;\n display: flex;\n align-items: center;\n border-radius: 5px;\n height: 50px;\n justify-content: space-between;\n flex-grow: 1;\n}\n.select_combobox-container__l-gXK:focus-within {\n border-color: #007ac9;\n}\n.select_combobox-container__l-gXK .select_left-column__NCDpJ {\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n\n.select_combobox-label__QYe0V {\n font-size: 12px;\n line-height: 20px;\n color: #666;\n letter-spacing: -0.48px;\n margin-left: 12px;\n margin-top: 4px;\n}\n\n.select_container__U5yMR {\n position: relative;\n width: 100%;\n height: 100%;\n}\n.select_container__U5yMR > div {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n height: 100%;\n cursor: pointer;\n}\n.select_container__U5yMR .select_suggestion__7in7q {\n font-size: 15px;\n line-height: 49px;\n height: 50px;\n padding: 0 0 0 12px;\n letter-spacing: -0.6px;\n color: #333;\n font-weight: 500;\n}\n.select_container__U5yMR .select_suggestionHighlighted__HV-5T {\n font-size: 15px;\n font-weight: 500;\n background: #f2f5f7;\n}\n.select_container__U5yMR .select_suggestionsContainerOpen__SzPE6 {\n position: absolute;\n background-color: #fff;\n z-index: 20;\n max-height: 250px;\n overflow-x: hidden;\n overflow-y: scroll;\n border-radius: 5px;\n box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.06);\n border: 1px rgba(0, 0, 0, 0.1) solid;\n top: calc(100% + 4px);\n left: 0;\n width: 100%;\n list-style-type: none;\n padding: 0;\n margin: 0;\n}\n.select_container__U5yMR .select_suggestionsContainerOpen__SzPE6 ul {\n padding: 0;\n margin: 0;\n}\n.select_container__U5yMR .select_suggestionsContainerOpen__SzPE6 li:not(:last-child) {\n border-bottom: 1px solid #ddd;\n}\n.select_container__U5yMR .select_input__tiwn5 {\n -webkit-appearance: none;\n appearance: none;\n margin: -4px 0 0 0;\n padding-left: 12px;\n border: none;\n height: 26px;\n}\n.select_container__U5yMR .select_input__tiwn5:focus {\n outline: none;\n border: none;\n box-shadow: none;\n background: #fff;\n}\n.select_container__U5yMR .select_input__tiwn5:read-only {\n cursor: pointer;\n background: #fff;\n}\n.select_container__U5yMR .select_input__tiwn5 {\n background: #fff;\n font-weight: 500;\n box-shadow: none;\n font-size: 15px;\n font-stretch: normal;\n font-style: normal;\n line-height: 1.33;\n letter-spacing: -0.6px;\n color: #333;\n}";
|
|
97
62
|
var styles$1 = {"combobox-container":"select_combobox-container__l-gXK","left-column":"select_left-column__NCDpJ","combobox-label":"select_combobox-label__QYe0V","container":"select_container__U5yMR","suggestion":"select_suggestion__7in7q","suggestionHighlighted":"select_suggestionHighlighted__HV-5T","suggestionsContainerOpen":"select_suggestionsContainerOpen__SzPE6","input":"select_input__tiwn5"};
|
|
98
63
|
styleInject(css_248z$1);
|
|
99
64
|
|
|
@@ -243,7 +208,7 @@ const i18n = createInstance({
|
|
|
243
208
|
});
|
|
244
209
|
i18n.init();
|
|
245
210
|
|
|
246
|
-
var css_248z = ".styles_autosuggest-panel__GEaoJ {\n width: 100%;\n}\n\n.styles_autosuggest-searchpanel-text__7O850 {\n font-size: 24px;\n font-weight: var(--font-weight-medium);\n letter-spacing: -0.8px;\n color: #333;\n line-height: 1;\n margin-bottom: 17px;\n margin-top: unset;\n}\n@media screen and (min-width: 768px) {\n .styles_autosuggest-searchpanel-text__7O850 {\n letter-spacing: -0.8px;\n line-height: 27px;\n margin-bottom: 21px;\n }\n}\n\n.styles_origin-input-container__yfozN,\n.styles_destination-input-container__kJPky {\n display: flex;\n flex: 1 0 100%;\n}\n.styles_origin-input-container__yfozN input[type=text],\n.styles_destination-input-container__kJPky input[type=text] {\n margin: 0;\n}\n\n.styles_row__MvzsR {\n display: flex;\n flex-direction: row;\n}\n\n.styles_viapoints-container__fukkW {\n display: flex;\n flex-direction: column;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE {\n display: flex;\n flex: 1 0 100%;\n min-height: 50px;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE:first-child {\n margin-top: 6px;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE:not(:first-child) {\n margin-top: 3px;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE:last-child {\n margin-bottom: 6px;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM {\n display: flex;\n padding: 3px 0;\n flex-direction: column;\n background: #f2f5f7;\n border-radius: 5px;\n width: 100%;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-before__J1O3f {\n display: flex;\n min-width: 27px;\n justify-content: center;\n align-items: center;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-before__J1O3f svg {\n fill: #888;\n height: 20px;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-input-container__fEQi9 {\n display: flex;\n align-items: center;\n width: 100%;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-input-container__fEQi9 input[type=text] {\n margin: 0;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-input-container__fEQi9.styles_viapoint-1__s2wSB > div.styles_viapoint__UnOwm {\n z-index: 15;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-input-container__fEQi9.styles_viapoint-2__JNsq8 > div.styles_viapoint__UnOwm {\n z-index: 14;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-input-container__fEQi9.styles_viapoint-3__tv7Qy > div.styles_viapoint__UnOwm {\n z-index: 13;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-input-container__fEQi9.styles_viapoint-4__v0tfs > div.styles_viapoint__UnOwm {\n z-index: 12;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-input-container__fEQi9.styles_viapoint-5__luT-- > div.styles_viapoint__UnOwm {\n z-index: 11;\n}\n\n.styles_viapoint-slack-time__dV527 {\n font-size: 13px;\n font-weight: normal;\n letter-spacing: -0.36px;\n color: #333;\n padding-left: 27px;\n padding-top: 12px;\n padding-bottom: 10px;\n}\n\n.styles_select-wrapper__zaWty {\n display: flex;\n height: 50px;\n margin-top: 9px;\n padding-left: 27px;\n padding-right: 47px;\n}\n\n.styles_via-point-button-container__kUBm7 {\n display: flex;\n}\n.styles_via-point-button-container__kUBm7 > div:nth-child(1) {\n order: 1;\n border-left: none;\n}\n.styles_via-point-button-container__kUBm7 > div:nth-child(2) {\n order: 2;\n border-left: 1px solid rgba(151, 151, 151, 0.2);\n}\n\n.styles_input-viapoint-slack-container__-LDqu {\n display: flex;\n flex-direction: column;\n}\n\n.styles_itinerary-search-control__1KyCb {\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n max-height: 50px;\n min-width: var(--width);\n}\n.styles_itinerary-search-control__1KyCb + .styles_itinerary-search-control__1KyCb {\n border-left: 1px solid rgba(151, 151, 151, 0.2);\n}\n.styles_itinerary-search-control__1KyCb .styles_opposite__BE7K1 {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n min-width: 40px;\n cursor: pointer;\n}\n.styles_itinerary-search-control__1KyCb .styles_opposite__BE7K1 svg {\n width: 19px;\n height: 17px;\n}\n.styles_itinerary-search-control__1KyCb .styles_add-via-point__7E6zU {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n min-width: 40px;\n cursor: pointer;\n}\n.styles_itinerary-search-control__1KyCb .styles_add-via-point__7E6zU svg {\n width: 20px;\n height: 22px;\n}\n.styles_itinerary-search-control__1KyCb .styles_add-via-point-slack__kddhr {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n min-width: 47px;\n cursor: pointer;\n}\n.styles_itinerary-search-control__1KyCb .styles_add-via-point-slack__kddhr svg {\n width: 18px;\n height: 19px;\n}\n.styles_itinerary-search-control__1KyCb .styles_remove-via-point__1oWx- {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n max-height: 44px;\n min-width: 40px;\n cursor: pointer;\n}\n.styles_itinerary-search-control__1KyCb .styles_remove-via-point__1oWx- svg {\n width: 14px;\n height: 14px;\n}\n\n.styles_combobox-icon__fhYvA {\n color: var(--color);\n border-left: solid #888 1px;\n height: 35px;\n}\n.styles_combobox-icon__fhYvA.styles_time-input-icon__L2TcV {\n padding: 9px 13px 0 13px;\n}\n.styles_combobox-icon__fhYvA.styles_time-input-icon__L2TcV svg {\n width: 18px;\n height: 19px;\n}\n\n.styles_rectangle-container__4Vtuo {\n display: block;\n position: relative;\n height: 9px;\n z-index: 19;\n}\n.styles_rectangle-container__4Vtuo .styles_rectangle__s-y7y {\n position: absolute;\n width: 4px;\n height: 25px;\n border-radius: 2px;\n background-color: #ddd;\n margin-left: 25px;\n margin-top: -9px;\n}\n\n.styles_search-panel-whitespace__RefGL {\n min-width: 40px;\n}";
|
|
211
|
+
var css_248z = ".styles_autosuggest-panel__GEaoJ {\n width: 100%;\n}\n\n.styles_autosuggest-searchpanel-text__7O850 {\n font-size: 24px;\n font-weight: var(--font-weight-medium, 500);\n letter-spacing: -0.8px;\n color: #333;\n line-height: 1;\n margin-bottom: 17px;\n margin-top: unset;\n}\n@media screen and (min-width: 768px) {\n .styles_autosuggest-searchpanel-text__7O850 {\n letter-spacing: -0.8px;\n line-height: 27px;\n margin-bottom: 21px;\n }\n}\n\n.styles_origin-input-container__yfozN,\n.styles_destination-input-container__kJPky {\n display: flex;\n flex: 1 0 100%;\n}\n.styles_origin-input-container__yfozN input[type=text],\n.styles_destination-input-container__kJPky input[type=text] {\n margin: 0;\n}\n\n.styles_row__MvzsR {\n display: flex;\n flex-direction: row;\n}\n\n.styles_viapoints-container__fukkW {\n display: flex;\n flex-direction: column;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE {\n display: flex;\n flex: 1 0 100%;\n min-height: 50px;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE:first-child {\n margin-top: 6px;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE:not(:first-child) {\n margin-top: 3px;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE:last-child {\n margin-bottom: 6px;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM {\n display: flex;\n padding: 3px 0;\n flex-direction: column;\n background: #f2f5f7;\n border-radius: 5px;\n width: 100%;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-before__J1O3f {\n display: flex;\n min-width: 27px;\n justify-content: center;\n align-items: center;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-before__J1O3f svg {\n fill: #888;\n height: 20px;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-input-container__fEQi9 {\n display: flex;\n align-items: center;\n width: 100%;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-input-container__fEQi9 input[type=text] {\n margin: 0;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-input-container__fEQi9.styles_viapoint-1__s2wSB > div.styles_viapoint__UnOwm {\n z-index: 15;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-input-container__fEQi9.styles_viapoint-2__JNsq8 > div.styles_viapoint__UnOwm {\n z-index: 14;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-input-container__fEQi9.styles_viapoint-3__tv7Qy > div.styles_viapoint__UnOwm {\n z-index: 13;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-input-container__fEQi9.styles_viapoint-4__v0tfs > div.styles_viapoint__UnOwm {\n z-index: 12;\n}\n.styles_viapoints-container__fukkW .styles_viapoint-container__O-xAE .styles_light-gray-background__0vkzM .styles_viapoint-input-container__fEQi9.styles_viapoint-5__luT-- > div.styles_viapoint__UnOwm {\n z-index: 11;\n}\n\n.styles_viapoint-slack-time__dV527 {\n font-size: 13px;\n font-weight: normal;\n letter-spacing: -0.36px;\n color: #333;\n padding-left: 27px;\n padding-top: 12px;\n padding-bottom: 10px;\n}\n\n.styles_select-wrapper__zaWty {\n display: flex;\n height: 50px;\n margin-top: 9px;\n padding-left: 27px;\n padding-right: 47px;\n}\n\n.styles_via-point-button-container__kUBm7 {\n display: flex;\n}\n.styles_via-point-button-container__kUBm7 > div:nth-child(1) {\n order: 1;\n border-left: none;\n}\n.styles_via-point-button-container__kUBm7 > div:nth-child(2) {\n order: 2;\n border-left: 1px solid rgba(151, 151, 151, 0.2);\n}\n\n.styles_input-viapoint-slack-container__-LDqu {\n display: flex;\n flex-direction: column;\n}\n\n.styles_itinerary-search-control__1KyCb {\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n max-height: 50px;\n min-width: var(--width);\n}\n.styles_itinerary-search-control__1KyCb + .styles_itinerary-search-control__1KyCb {\n border-left: 1px solid rgba(151, 151, 151, 0.2);\n}\n.styles_itinerary-search-control__1KyCb .styles_opposite__BE7K1 {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n min-width: 40px;\n cursor: pointer;\n}\n.styles_itinerary-search-control__1KyCb .styles_opposite__BE7K1 svg {\n width: 19px;\n height: 17px;\n}\n.styles_itinerary-search-control__1KyCb .styles_add-via-point__7E6zU {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n min-width: 40px;\n cursor: pointer;\n}\n.styles_itinerary-search-control__1KyCb .styles_add-via-point__7E6zU svg {\n width: 20px;\n height: 22px;\n}\n.styles_itinerary-search-control__1KyCb .styles_add-via-point-slack__kddhr {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n min-width: 47px;\n cursor: pointer;\n}\n.styles_itinerary-search-control__1KyCb .styles_add-via-point-slack__kddhr svg {\n width: 18px;\n height: 19px;\n}\n.styles_itinerary-search-control__1KyCb .styles_remove-via-point__1oWx- {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n max-height: 44px;\n min-width: 40px;\n cursor: pointer;\n}\n.styles_itinerary-search-control__1KyCb .styles_remove-via-point__1oWx- svg {\n width: 14px;\n height: 14px;\n}\n\n.styles_combobox-icon__fhYvA {\n color: var(--color);\n border-left: solid #888 1px;\n height: 35px;\n}\n.styles_combobox-icon__fhYvA.styles_time-input-icon__L2TcV {\n padding: 9px 13px 0 13px;\n}\n.styles_combobox-icon__fhYvA.styles_time-input-icon__L2TcV svg {\n width: 18px;\n height: 19px;\n}\n\n.styles_rectangle-container__4Vtuo {\n display: block;\n position: relative;\n height: 9px;\n z-index: 19;\n}\n.styles_rectangle-container__4Vtuo .styles_rectangle__s-y7y {\n position: absolute;\n width: 4px;\n height: 25px;\n border-radius: 2px;\n background-color: #ddd;\n margin-left: 25px;\n margin-top: -9px;\n}\n\n.styles_search-panel-whitespace__RefGL {\n min-width: 40px;\n}";
|
|
247
212
|
var styles = {"autosuggest-panel":"styles_autosuggest-panel__GEaoJ","autosuggest-searchpanel-text":"styles_autosuggest-searchpanel-text__7O850","origin-input-container":"styles_origin-input-container__yfozN","destination-input-container":"styles_destination-input-container__kJPky","row":"styles_row__MvzsR","viapoints-container":"styles_viapoints-container__fukkW","viapoint-container":"styles_viapoint-container__O-xAE","light-gray-background":"styles_light-gray-background__0vkzM","viapoint-before":"styles_viapoint-before__J1O3f","viapoint-input-container":"styles_viapoint-input-container__fEQi9","viapoint-1":"styles_viapoint-1__s2wSB","viapoint":"styles_viapoint__UnOwm","viapoint-2":"styles_viapoint-2__JNsq8","viapoint-3":"styles_viapoint-3__tv7Qy","viapoint-4":"styles_viapoint-4__v0tfs","viapoint-5":"styles_viapoint-5__luT--","viapoint-slack-time":"styles_viapoint-slack-time__dV527","select-wrapper":"styles_select-wrapper__zaWty","via-point-button-container":"styles_via-point-button-container__kUBm7","input-viapoint-slack-container":"styles_input-viapoint-slack-container__-LDqu","itinerary-search-control":"styles_itinerary-search-control__1KyCb","opposite":"styles_opposite__BE7K1","add-via-point":"styles_add-via-point__7E6zU","add-via-point-slack":"styles_add-via-point-slack__kddhr","remove-via-point":"styles_remove-via-point__1oWx-","combobox-icon":"styles_combobox-icon__fhYvA","time-input-icon":"styles_time-input-icon__L2TcV","rectangle-container":"styles_rectangle-container__4Vtuo","rectangle":"styles_rectangle__s-y7y","search-panel-whitespace":"styles_search-panel-whitespace__RefGL"};
|
|
248
213
|
styleInject(css_248z);
|
|
249
214
|
|
|
@@ -280,11 +245,8 @@ const ItinerarySearchControl = _ref => {
|
|
|
280
245
|
}), children));
|
|
281
246
|
};
|
|
282
247
|
const updateViaPointSlack = (activeViaPointSlacks, updatedViaPointIndex, viaPointRemoved = false) => {
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
activeViaPointSlacks.splice(foundAtIndex, 1);
|
|
286
|
-
}
|
|
287
|
-
return viaPointRemoved ? activeViaPointSlacks.map(value => value > updatedViaPointIndex ? value - 1 : value) : activeViaPointSlacks;
|
|
248
|
+
const remaining = activeViaPointSlacks.filter(index => index !== updatedViaPointIndex);
|
|
249
|
+
return viaPointRemoved ? remaining.map(index => index > updatedViaPointIndex ? index - 1 : index) : remaining;
|
|
288
250
|
};
|
|
289
251
|
const isKeyboardSelectionEvent = event => {
|
|
290
252
|
const space = [13, ' ', 'Spacebar'];
|
|
@@ -414,369 +376,319 @@ const locationShape = process.env.NODE_ENV !== "production" ? PropTypes.shape({
|
|
|
414
376
|
lon: PropTypes.number,
|
|
415
377
|
locationSlack: PropTypes.number
|
|
416
378
|
}) : {};
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
379
|
+
const EMPTY_LIST = [];
|
|
380
|
+
const noop = () => {};
|
|
381
|
+
function DTAutosuggestPanel({
|
|
382
|
+
appElement,
|
|
383
|
+
origin,
|
|
384
|
+
destination,
|
|
385
|
+
originPlaceHolder = 'give-origin',
|
|
386
|
+
destinationPlaceHolder = 'give-destination',
|
|
387
|
+
viaPoints: viaPointsProp = null,
|
|
388
|
+
updateViaPoints = noop,
|
|
389
|
+
handleViaPointLocationSelected,
|
|
390
|
+
swapOrder,
|
|
391
|
+
searchPanelText,
|
|
392
|
+
searchContext,
|
|
393
|
+
onSelect,
|
|
394
|
+
onClear,
|
|
395
|
+
addAnalyticsEvent,
|
|
396
|
+
lang,
|
|
397
|
+
disableAutoFocus = false,
|
|
398
|
+
sources = EMPTY_LIST,
|
|
399
|
+
targets = EMPTY_LIST,
|
|
400
|
+
filterResults,
|
|
401
|
+
isMobile = false,
|
|
402
|
+
originMobileLabel = null,
|
|
403
|
+
destinationMobileLabel = null,
|
|
404
|
+
refPoint,
|
|
405
|
+
modeSet,
|
|
406
|
+
colors = defaultColors,
|
|
407
|
+
getAutoSuggestIcons,
|
|
408
|
+
showScroll = false,
|
|
409
|
+
onFocusChange,
|
|
410
|
+
isEmbedded = false,
|
|
411
|
+
showSwapControl = false,
|
|
412
|
+
showViapointControl = false,
|
|
413
|
+
showSlackControl = false
|
|
414
|
+
}) {
|
|
415
|
+
const [t] = useTranslation('translation', {
|
|
416
|
+
i18n
|
|
417
|
+
});
|
|
418
|
+
const [activeSlackInputs, setActiveSlackInputs] = useState([]);
|
|
419
|
+
const [, forceUpdate] = useReducer(count => count + 1, 0);
|
|
420
|
+
const destinationInputRef = useRef(null);
|
|
421
|
+
// viaPoints is edited in place and the parent is notified afterwards, so a
|
|
422
|
+
// missing prop needs an instance-local array instead of a shared default
|
|
423
|
+
const fallbackViaPoints = useRef([]);
|
|
424
|
+
const viaPoints = viaPointsProp || fallbackViaPoints.current;
|
|
425
|
+
const {
|
|
426
|
+
primary
|
|
427
|
+
} = colors;
|
|
428
|
+
const lng = lang;
|
|
429
|
+
const storeDestinationRef = ref => {
|
|
430
|
+
destinationInputRef.current = ref;
|
|
431
|
+
};
|
|
432
|
+
const handleFocusChange = () => {
|
|
433
|
+
if (!destination || !destination.lat) {
|
|
434
|
+
destinationInputRef.current.focus();
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
const updateViaPointList = points => {
|
|
438
|
+
if (points.length === 0) {
|
|
439
|
+
updateViaPoints([]);
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
updateViaPoints(points.filter(vp => !isViaPointEmpty(vp)));
|
|
443
|
+
};
|
|
444
|
+
const handleToggleViaPointSlackClick = viaPointIndex => {
|
|
445
|
+
setActiveSlackInputs(activeSlackInputs.includes(viaPointIndex) ? updateViaPointSlack(activeSlackInputs, viaPointIndex) : activeSlackInputs.concat([viaPointIndex]));
|
|
446
|
+
};
|
|
447
|
+
const handleViaPointSlackTimeSelected = (slackTimeInSeconds, i) => {
|
|
448
|
+
if (addAnalyticsEvent) {
|
|
449
|
+
addAnalyticsEvent({
|
|
450
|
+
action: 'EditViaPointStopDuration',
|
|
451
|
+
category: 'ItinerarySettings',
|
|
452
|
+
name: slackTimeInSeconds / 60
|
|
446
453
|
});
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
style: {
|
|
551
|
-
'--color': primary,
|
|
552
|
-
'--font-weight-medium': fontWeights.medium
|
|
553
|
-
}
|
|
554
|
-
}, ' ', searchPanelText ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h1", {
|
|
555
|
-
className: styles['autosuggest-searchpanel-text']
|
|
556
|
-
}, ' ', searchPanelText)) : null, /*#__PURE__*/React.createElement("div", {
|
|
557
|
-
className: styles['origin-input-container']
|
|
558
|
-
}, /*#__PURE__*/React.createElement(DTAutoSuggest, {
|
|
559
|
-
appElement: this.props.appElement,
|
|
560
|
-
icon: "originEllipse",
|
|
561
|
-
id: "origin",
|
|
562
|
-
autoFocus: disableAutoFocus === true ? false : !this.props.isMobile && !origin?.lat,
|
|
563
|
-
storeRef: this.storeReference,
|
|
564
|
-
refPoint: this.props.refPoint,
|
|
565
|
-
className: getLocationType(origin),
|
|
566
|
-
placeholder: this.props.originPlaceHolder,
|
|
567
|
-
value: value(origin),
|
|
568
|
-
searchContext: searchContext,
|
|
569
|
-
getAutoSuggestIcons: this.props.getAutoSuggestIcons,
|
|
570
|
-
onSelect: this.props.onSelect,
|
|
571
|
-
onClear: this.props.onClear,
|
|
572
|
-
focusChange: onFocusChange || this.handleFocusChange,
|
|
573
|
-
lang: this.props.lang,
|
|
574
|
-
sources: this.props.sources,
|
|
575
|
-
targets: this.props.targets,
|
|
576
|
-
filterResults: this.props.filterResults,
|
|
577
|
-
isMobile: this.props.isMobile,
|
|
578
|
-
colors: this.props.colors,
|
|
579
|
-
mobileLabel: originMobileLabel,
|
|
580
|
-
fontWeights: this.props.fontWeights,
|
|
581
|
-
modeSet: this.props.modeSet,
|
|
582
|
-
showScroll: this.props.showScroll,
|
|
583
|
-
isEmbedded: this.props.isEmbedded
|
|
584
|
-
}), (showSwapControl || showViapointControl) && /*#__PURE__*/React.createElement(ItinerarySearchControl, {
|
|
585
|
-
className: styles.opposite,
|
|
586
|
-
enabled: showSwapControl,
|
|
587
|
-
onClick: () => this.handleSwapOrderClick(),
|
|
588
|
-
onKeyPress: e => isKeyboardSelectionEvent(e) && this.handleSwapOrderClick(),
|
|
589
|
-
"aria-label": t('swap-order-button-label', {
|
|
590
|
-
lng
|
|
591
|
-
})
|
|
592
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
593
|
-
img: "opposite",
|
|
594
|
-
color: primary
|
|
595
|
-
}))), viaPoints.length === 0 && /*#__PURE__*/React.createElement("div", {
|
|
596
|
-
className: styles['rectangle-container']
|
|
597
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
598
|
-
className: styles.rectangle
|
|
599
|
-
})), /*#__PURE__*/React.createElement(ReactSortable, {
|
|
600
|
-
className: styles['viapoints-container'],
|
|
601
|
-
list: viaPoints,
|
|
602
|
-
handle: `.${styles['viapoint-before']}`,
|
|
603
|
-
animation: 200,
|
|
604
|
-
disabled: viaPoints.length <= 1,
|
|
605
|
-
setList: items => {
|
|
606
|
-
const newViaPoints = items.filter(vp => !isViaPointEmpty(vp));
|
|
607
|
-
if (newViaPoints.length > 0) {
|
|
608
|
-
this.props.updateViaPoints(newViaPoints);
|
|
609
|
-
}
|
|
454
|
+
}
|
|
455
|
+
viaPoints[i].locationSlack = Number.parseInt(slackTimeInSeconds, 10);
|
|
456
|
+
updateViaPointList(viaPoints);
|
|
457
|
+
};
|
|
458
|
+
const handleRemoveViaPointClick = viaPointIndex => {
|
|
459
|
+
if (addAnalyticsEvent) {
|
|
460
|
+
addAnalyticsEvent({
|
|
461
|
+
action: 'RemoveJourneyViaPoint',
|
|
462
|
+
category: 'ItinerarySettings',
|
|
463
|
+
name: null
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
viaPoints.splice(viaPointIndex, 1);
|
|
467
|
+
setActiveSlackInputs(updateViaPointSlack(activeSlackInputs, viaPointIndex, true));
|
|
468
|
+
updateViaPointList(viaPoints);
|
|
469
|
+
};
|
|
470
|
+
const handleAddViaPointClick = () => {
|
|
471
|
+
if (addAnalyticsEvent) {
|
|
472
|
+
addAnalyticsEvent({
|
|
473
|
+
action: 'AddJourneyViaPoint',
|
|
474
|
+
category: 'ItinerarySettings',
|
|
475
|
+
name: 'QuickSettingsButton'
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
viaPoints.push(getEmptyViaPointPlaceHolder());
|
|
479
|
+
// re-render so that the placeholder shows up in the panel
|
|
480
|
+
forceUpdate();
|
|
481
|
+
};
|
|
482
|
+
const handleSwapOrderClick = () => {
|
|
483
|
+
if (addAnalyticsEvent) {
|
|
484
|
+
addAnalyticsEvent({
|
|
485
|
+
action: 'SwitchJourneyStartAndEndPointOrder',
|
|
486
|
+
category: 'ItinerarySettings',
|
|
487
|
+
name: null
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
viaPoints.reverse();
|
|
491
|
+
swapOrder();
|
|
492
|
+
};
|
|
493
|
+
const getSlackDisplay = slackInSeconds => `${slackInSeconds / 60} ${t('minute-short', {
|
|
494
|
+
lng
|
|
495
|
+
})}`;
|
|
496
|
+
const slackTime = getSlackTimeOptions(t);
|
|
497
|
+
const getViaPointSlackTimeOrDefault = (viaPoint, defaultValue = 0) => viaPoint && viaPoint.locationSlack || defaultValue;
|
|
498
|
+
const isViaPointSlackTimeInputActive = index => activeSlackInputs.includes(index);
|
|
499
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
500
|
+
className: cx(styles['autosuggest-panel'], isMobile && "small"),
|
|
501
|
+
style: {
|
|
502
|
+
'--color': primary
|
|
503
|
+
}
|
|
504
|
+
}, ' ', searchPanelText ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h1", {
|
|
505
|
+
className: styles['autosuggest-searchpanel-text']
|
|
506
|
+
}, ' ', searchPanelText)) : null, /*#__PURE__*/React.createElement("div", {
|
|
507
|
+
className: styles['origin-input-container']
|
|
508
|
+
}, /*#__PURE__*/React.createElement(DTAutoSuggest, {
|
|
509
|
+
appElement: appElement,
|
|
510
|
+
icon: "originEllipse",
|
|
511
|
+
id: "origin",
|
|
512
|
+
autoFocus: disableAutoFocus === true ? false : !isMobile && !origin?.lat,
|
|
513
|
+
refPoint: refPoint,
|
|
514
|
+
className: getLocationType(origin),
|
|
515
|
+
placeholder: originPlaceHolder,
|
|
516
|
+
value: value(origin),
|
|
517
|
+
searchContext: searchContext,
|
|
518
|
+
getAutoSuggestIcons: getAutoSuggestIcons,
|
|
519
|
+
onSelect: onSelect,
|
|
520
|
+
onClear: onClear,
|
|
521
|
+
focusChange: onFocusChange || handleFocusChange,
|
|
522
|
+
lang: lang,
|
|
523
|
+
sources: sources,
|
|
524
|
+
targets: targets,
|
|
525
|
+
filterResults: filterResults,
|
|
526
|
+
isMobile: isMobile,
|
|
527
|
+
colors: colors,
|
|
528
|
+
mobileLabel: originMobileLabel,
|
|
529
|
+
modeSet: modeSet,
|
|
530
|
+
showScroll: showScroll,
|
|
531
|
+
isEmbedded: isEmbedded
|
|
532
|
+
}), (showSwapControl || showViapointControl) && /*#__PURE__*/React.createElement(ItinerarySearchControl, {
|
|
533
|
+
className: styles.opposite,
|
|
534
|
+
enabled: showSwapControl,
|
|
535
|
+
onClick: () => handleSwapOrderClick(),
|
|
536
|
+
onKeyPress: e => isKeyboardSelectionEvent(e) && handleSwapOrderClick(),
|
|
537
|
+
"aria-label": t('swap-order-button-label', {
|
|
538
|
+
lng
|
|
539
|
+
})
|
|
540
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
541
|
+
img: "opposite",
|
|
542
|
+
color: primary
|
|
543
|
+
}))), viaPoints.length === 0 && /*#__PURE__*/React.createElement("div", {
|
|
544
|
+
className: styles['rectangle-container']
|
|
545
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
546
|
+
className: styles.rectangle
|
|
547
|
+
})), /*#__PURE__*/React.createElement(ReactSortable, {
|
|
548
|
+
className: styles['viapoints-container'],
|
|
549
|
+
list: viaPoints,
|
|
550
|
+
handle: `.${styles['viapoint-before']}`,
|
|
551
|
+
animation: 200,
|
|
552
|
+
disabled: viaPoints.length <= 1,
|
|
553
|
+
setList: items => {
|
|
554
|
+
const newViaPoints = items.filter(vp => !isViaPointEmpty(vp));
|
|
555
|
+
if (newViaPoints.length > 0) {
|
|
556
|
+
updateViaPoints(newViaPoints);
|
|
610
557
|
}
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
558
|
+
}
|
|
559
|
+
}, viaPoints.map((o, i) => /*#__PURE__*/React.createElement("div", {
|
|
560
|
+
className: cx(styles['viapoint-container']),
|
|
561
|
+
key: `viapoint-${i}` // eslint-disable-line
|
|
562
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
563
|
+
className: styles['light-gray-background']
|
|
564
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
565
|
+
className: styles.row
|
|
566
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
567
|
+
className: styles['viapoint-before'],
|
|
568
|
+
style: viaPoints.length > 1 ? {
|
|
569
|
+
cursor: 'move'
|
|
570
|
+
} : {}
|
|
571
|
+
}, viaPoints.length > 1 && /*#__PURE__*/React.createElement(Icon, {
|
|
572
|
+
img: "ellipsis",
|
|
573
|
+
rotate: 90,
|
|
574
|
+
color: primary
|
|
575
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
576
|
+
className: `${styles['viapoint-input-container']} ${styles[`viapoint-${i + 1}`]}`
|
|
577
|
+
}, /*#__PURE__*/React.createElement(DTAutoSuggest, {
|
|
578
|
+
appElement: appElement,
|
|
579
|
+
icon: "mapMarker",
|
|
580
|
+
id: "via-point",
|
|
581
|
+
ariaLabel: t('via-point-index', {
|
|
582
|
+
index: i + 1,
|
|
583
|
+
lng
|
|
584
|
+
}),
|
|
585
|
+
autoFocus: disableAutoFocus === true ? false : !isMobile,
|
|
586
|
+
placeholder: "via-point",
|
|
587
|
+
className: "viapoint",
|
|
588
|
+
searchContext: searchContext,
|
|
589
|
+
refPoint: refPoint,
|
|
590
|
+
value: o && o.address || '',
|
|
591
|
+
onSelect: onSelect,
|
|
592
|
+
onClear: onClear,
|
|
593
|
+
handleViaPoints: item => handleViaPointLocationSelected(item, i),
|
|
594
|
+
lang: lang,
|
|
595
|
+
sources: sources,
|
|
596
|
+
targets: targets,
|
|
597
|
+
filterResults: filterResults,
|
|
598
|
+
getAutoSuggestIcons: getAutoSuggestIcons,
|
|
599
|
+
isMobile: isMobile,
|
|
600
|
+
modeSet: modeSet,
|
|
601
|
+
colors: colors,
|
|
602
|
+
showScroll: showScroll
|
|
603
|
+
})), showSlackControl && /*#__PURE__*/React.createElement(ItinerarySearchControl, {
|
|
604
|
+
className: styles['add-via-point-slack'],
|
|
605
|
+
enabled: showViapointControl,
|
|
606
|
+
onClick: () => handleToggleViaPointSlackClick(i),
|
|
607
|
+
onKeyPress: e => isKeyboardSelectionEvent(e) && handleToggleViaPointSlackClick(i),
|
|
608
|
+
"aria-label": t(isViaPointSlackTimeInputActive(i) ? 'add-via-duration-button-label-open' : 'add-via-duration-button-label-close', {
|
|
609
|
+
index: i + 1,
|
|
610
|
+
lng
|
|
611
|
+
}),
|
|
612
|
+
wide: true
|
|
613
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
614
|
+
img: "time",
|
|
615
|
+
color: primary
|
|
616
|
+
}))), !isViaPointSlackTimeInputActive(i) && viaPoints[i] && viaPoints[i].locationSlack > 0 && /*#__PURE__*/React.createElement("span", {
|
|
617
|
+
className: styles['viapoint-slack-time']
|
|
618
|
+
}, `${t('viapoint-slack-amount', {
|
|
619
|
+
lng
|
|
620
|
+
})}: ${getSlackDisplay(viaPoints[i].locationSlack)}`), /*#__PURE__*/React.createElement("div", {
|
|
621
|
+
className: cx(styles['input-viapoint-slack-container'], !isViaPointSlackTimeInputActive(i) && "collapsed")
|
|
622
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
623
|
+
className: styles['select-wrapper']
|
|
624
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
625
|
+
id: `viapoint-slack-${i}`,
|
|
626
|
+
label: t('viapoint-slack-amount', {
|
|
627
|
+
lng
|
|
628
|
+
}),
|
|
629
|
+
options: slackTime,
|
|
630
|
+
value: getViaPointSlackTimeOrDefault(viaPoints[i]),
|
|
631
|
+
viaPointIndex: i,
|
|
632
|
+
icon: /*#__PURE__*/React.createElement("span", {
|
|
633
|
+
className: `${styles['combobox-icon']} ${styles['time-input-icon']}`
|
|
666
634
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
667
635
|
img: "time",
|
|
668
636
|
color: primary
|
|
669
|
-
}))
|
|
670
|
-
|
|
671
|
-
|
|
637
|
+
})),
|
|
638
|
+
onSlackTimeSelected: handleViaPointSlackTimeSelected
|
|
639
|
+
})))), /*#__PURE__*/React.createElement(ItinerarySearchControl, {
|
|
640
|
+
className: styles['remove-via-point'],
|
|
641
|
+
enabled: showViapointControl,
|
|
642
|
+
onClick: () => handleRemoveViaPointClick(i),
|
|
643
|
+
onKeyPress: e => isKeyboardSelectionEvent(e) && handleRemoveViaPointClick(i),
|
|
644
|
+
"aria-label": t('remove-via-button-label', {
|
|
645
|
+
index: i + 1,
|
|
672
646
|
lng
|
|
673
|
-
})
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
onClear: this.props.onClear,
|
|
718
|
-
refPoint: this.props.refPoint,
|
|
719
|
-
value: value(this.props.destination),
|
|
720
|
-
lang: this.props.lang,
|
|
721
|
-
sources: this.props.sources,
|
|
722
|
-
targets: this.props.targets,
|
|
723
|
-
filterResults: this.props.filterResults,
|
|
724
|
-
isMobile: this.props.isMobile,
|
|
725
|
-
mobileLabel: destinationMobileLabel,
|
|
726
|
-
fontWeights: this.props.fontWeights,
|
|
727
|
-
modeSet: this.props.modeSet,
|
|
728
|
-
colors: this.props.colors,
|
|
729
|
-
showScroll: this.props.showScroll,
|
|
730
|
-
isEmbedded: this.props.isEmbedded
|
|
731
|
-
}), (showSwapControl || showViapointControl) && /*#__PURE__*/React.createElement(ItinerarySearchControl, {
|
|
732
|
-
className: cx(styles['add-via-point'], styles.more, viaPoints.length > 4 && "collapsed"),
|
|
733
|
-
enabled: showViapointControl && viaPoints.length === 0,
|
|
734
|
-
onClick: () => this.handleAddViaPointClick(),
|
|
735
|
-
onKeyPress: e => isKeyboardSelectionEvent(e) && this.handleAddViaPointClick(),
|
|
736
|
-
"aria-label": t('add-via-button-label', {
|
|
737
|
-
lng
|
|
738
|
-
})
|
|
739
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
740
|
-
img: "viapoint",
|
|
741
|
-
width: 1.25,
|
|
742
|
-
height: 1.375,
|
|
743
|
-
color: primary
|
|
744
|
-
}))));
|
|
745
|
-
}
|
|
647
|
+
})
|
|
648
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
649
|
+
img: "trash",
|
|
650
|
+
color: primary
|
|
651
|
+
}))))), /*#__PURE__*/React.createElement("div", {
|
|
652
|
+
className: styles['destination-input-container']
|
|
653
|
+
}, /*#__PURE__*/React.createElement(DTAutoSuggest, {
|
|
654
|
+
appElement: appElement,
|
|
655
|
+
icon: "mapMarker",
|
|
656
|
+
id: "destination",
|
|
657
|
+
autoFocus: disableAutoFocus === true ? false : !isMobile && !Number.isNaN(origin?.lat),
|
|
658
|
+
storeRef: storeDestinationRef,
|
|
659
|
+
placeholder: destinationPlaceHolder,
|
|
660
|
+
className: getLocationType(destination),
|
|
661
|
+
getAutoSuggestIcons: getAutoSuggestIcons,
|
|
662
|
+
searchContext: searchContext,
|
|
663
|
+
onSelect: onSelect,
|
|
664
|
+
onClear: onClear,
|
|
665
|
+
refPoint: refPoint,
|
|
666
|
+
value: value(destination),
|
|
667
|
+
lang: lang,
|
|
668
|
+
sources: sources,
|
|
669
|
+
targets: targets,
|
|
670
|
+
filterResults: filterResults,
|
|
671
|
+
isMobile: isMobile,
|
|
672
|
+
mobileLabel: destinationMobileLabel,
|
|
673
|
+
modeSet: modeSet,
|
|
674
|
+
colors: colors,
|
|
675
|
+
showScroll: showScroll,
|
|
676
|
+
isEmbedded: isEmbedded
|
|
677
|
+
}), (showSwapControl || showViapointControl) && /*#__PURE__*/React.createElement(ItinerarySearchControl, {
|
|
678
|
+
className: cx(styles['add-via-point'], styles.more, viaPoints.length > 4 && "collapsed"),
|
|
679
|
+
enabled: showViapointControl && viaPoints.length === 0,
|
|
680
|
+
onClick: () => handleAddViaPointClick(),
|
|
681
|
+
onKeyPress: e => isKeyboardSelectionEvent(e) && handleAddViaPointClick(),
|
|
682
|
+
"aria-label": t('add-via-button-label', {
|
|
683
|
+
lng
|
|
684
|
+
})
|
|
685
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
686
|
+
img: "viapoint",
|
|
687
|
+
width: 1.25,
|
|
688
|
+
height: 1.375,
|
|
689
|
+
color: primary
|
|
690
|
+
}))));
|
|
746
691
|
}
|
|
747
|
-
_defineProperty(DTAutosuggestPanel, "defaultProps", {
|
|
748
|
-
origin: undefined,
|
|
749
|
-
destination: undefined,
|
|
750
|
-
viaPoints: [],
|
|
751
|
-
originPlaceHolder: 'give-origin',
|
|
752
|
-
destinationPlaceHolder: 'give-destination',
|
|
753
|
-
swapOrder: undefined,
|
|
754
|
-
updateViaPoints: () => {},
|
|
755
|
-
searchPanelText: undefined,
|
|
756
|
-
sources: [],
|
|
757
|
-
targets: [],
|
|
758
|
-
filterResults: undefined,
|
|
759
|
-
onClear: undefined,
|
|
760
|
-
getAutoSuggestIcons: undefined,
|
|
761
|
-
refPoint: undefined,
|
|
762
|
-
addAnalyticsEvent: undefined,
|
|
763
|
-
disableAutoFocus: false,
|
|
764
|
-
isMobile: false,
|
|
765
|
-
handleViaPointLocationSelected: undefined,
|
|
766
|
-
originMobileLabel: null,
|
|
767
|
-
destinationMobileLabel: null,
|
|
768
|
-
modeSet: undefined,
|
|
769
|
-
colors: defaultColors,
|
|
770
|
-
fontWeights: {
|
|
771
|
-
medium: 500
|
|
772
|
-
},
|
|
773
|
-
showScroll: false,
|
|
774
|
-
onFocusChange: undefined,
|
|
775
|
-
isEmbedded: false,
|
|
776
|
-
showSwapControl: false,
|
|
777
|
-
showViapointControl: false,
|
|
778
|
-
showSlackControl: false
|
|
779
|
-
});
|
|
780
692
|
process.env.NODE_ENV !== "production" ? DTAutosuggestPanel.propTypes = {
|
|
781
693
|
appElement: PropTypes.string.isRequired,
|
|
782
694
|
origin: locationShape,
|
|
@@ -806,23 +718,13 @@ process.env.NODE_ENV !== "production" ? DTAutosuggestPanel.propTypes = {
|
|
|
806
718
|
modeSet: PropTypes.string,
|
|
807
719
|
colors: PropTypes.objectOf(PropTypes.string),
|
|
808
720
|
getAutoSuggestIcons: PropTypes.objectOf(PropTypes.func),
|
|
809
|
-
fontWeights: PropTypes.shape({
|
|
810
|
-
medium: PropTypes.number
|
|
811
|
-
}),
|
|
812
721
|
showScroll: PropTypes.bool,
|
|
813
722
|
onFocusChange: PropTypes.func,
|
|
814
723
|
isEmbedded: PropTypes.bool,
|
|
815
724
|
showSwapControl: PropTypes.bool,
|
|
816
725
|
showViapointControl: PropTypes.bool,
|
|
817
|
-
showSlackControl: PropTypes.bool
|
|
818
|
-
t: PropTypes.func.isRequired
|
|
726
|
+
showSlackControl: PropTypes.bool
|
|
819
727
|
} : void 0;
|
|
820
|
-
const DTAutosuggestPanelWithTranslation = withTranslation()(DTAutosuggestPanel);
|
|
821
|
-
var index = props => {
|
|
822
|
-
return /*#__PURE__*/React.createElement(I18nextProvider, {
|
|
823
|
-
i18n: i18n
|
|
824
|
-
}, /*#__PURE__*/React.createElement(DTAutosuggestPanelWithTranslation, props));
|
|
825
|
-
};
|
|
826
728
|
|
|
827
|
-
export {
|
|
729
|
+
export { DTAutosuggestPanel as default, getEmptyViaPointPlaceHolder };
|
|
828
730
|
//# sourceMappingURL=index.js.map
|