@digitransit-component/digitransit-component-autosuggest-panel 11.0.1 → 12.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 +300 -226
- package/lib/index.js +293 -217
- package/lib/index.js.map +1 -1
- package/package.json +9 -6
package/lib/index.js
CHANGED
|
@@ -1,14 +1,50 @@
|
|
|
1
1
|
import cx from 'classnames';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
3
|
+
import { useState, useReducer, useRef } from 'react';
|
|
4
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';
|
|
8
8
|
import isEmpty from 'lodash/isEmpty';
|
|
9
9
|
import { useSelect } from 'downshift';
|
|
10
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
11
|
import { createInstance } from 'i18next';
|
|
11
12
|
|
|
13
|
+
function _typeof(o) {
|
|
14
|
+
"@babel/helpers - typeof";
|
|
15
|
+
|
|
16
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
17
|
+
return typeof o;
|
|
18
|
+
} : function (o) {
|
|
19
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
20
|
+
}, _typeof(o);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function toPrimitive(t, r) {
|
|
24
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
25
|
+
var e = t[Symbol.toPrimitive];
|
|
26
|
+
if (void 0 !== e) {
|
|
27
|
+
var i = e.call(t, r);
|
|
28
|
+
if ("object" != _typeof(i)) return i;
|
|
29
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
30
|
+
}
|
|
31
|
+
return ("string" === r ? String : Number)(t);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function toPropertyKey(t) {
|
|
35
|
+
var i = toPrimitive(t, "string");
|
|
36
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function _defineProperty(e, r, t) {
|
|
40
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
41
|
+
value: t,
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true
|
|
45
|
+
}) : e[r] = t, e;
|
|
46
|
+
}
|
|
47
|
+
|
|
12
48
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
13
49
|
if (null == r) return {};
|
|
14
50
|
var t = {};
|
|
@@ -62,6 +98,8 @@ var css_248z$1 = ".select_combobox-container__l-gXK {\n background-color: #fff;
|
|
|
62
98
|
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"};
|
|
63
99
|
styleInject(css_248z$1);
|
|
64
100
|
|
|
101
|
+
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
102
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
65
103
|
const Select = ({
|
|
66
104
|
value,
|
|
67
105
|
options,
|
|
@@ -92,24 +130,38 @@ const Select = ({
|
|
|
92
130
|
onSlackTimeSelected(newItem.value, viaPointIndex);
|
|
93
131
|
}
|
|
94
132
|
});
|
|
95
|
-
return /*#__PURE__*/
|
|
96
|
-
className: styles$1['combobox-container']
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
133
|
+
return /*#__PURE__*/jsx("div", {
|
|
134
|
+
className: styles$1['combobox-container'],
|
|
135
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
136
|
+
className: styles$1.container,
|
|
137
|
+
children: [/*#__PURE__*/jsxs("div", _objectSpread$1(_objectSpread$1({}, getToggleButtonProps()), {}, {
|
|
138
|
+
children: [/*#__PURE__*/jsxs("span", {
|
|
139
|
+
className: styles$1['left-column'],
|
|
140
|
+
children: [/*#__PURE__*/jsx("label", _objectSpread$1(_objectSpread$1({}, getLabelProps()), {}, {
|
|
141
|
+
className: styles$1['combobox-label'],
|
|
142
|
+
children: label
|
|
143
|
+
})), /*#__PURE__*/jsx("div", {
|
|
144
|
+
className: styles$1.input,
|
|
145
|
+
children: /*#__PURE__*/jsx("span", {
|
|
146
|
+
children: selectedItem.displayName
|
|
147
|
+
})
|
|
148
|
+
})]
|
|
149
|
+
}), icon]
|
|
150
|
+
})), /*#__PURE__*/jsx("ul", _objectSpread$1(_objectSpread$1({
|
|
151
|
+
className: cx(styles$1.suggestionsContainerOpen, !isOpen && 'hidden')
|
|
152
|
+
}, getMenuProps()), {}, {
|
|
153
|
+
children: isOpen && options.map((option, index) => /*#__PURE__*/jsx("li", _objectSpread$1(_objectSpread$1({
|
|
154
|
+
className: cx(styles$1.suggestion, index === highlightedIndex && styles$1.suggestionHighlighted)
|
|
155
|
+
}, getItemProps({
|
|
156
|
+
index
|
|
157
|
+
})), {}, {
|
|
158
|
+
children: /*#__PURE__*/jsx("span", {
|
|
159
|
+
children: option.displayName
|
|
160
|
+
})
|
|
161
|
+
}), option.value))
|
|
162
|
+
}))]
|
|
163
|
+
})
|
|
164
|
+
});
|
|
113
165
|
};
|
|
114
166
|
process.env.NODE_ENV !== "production" ? Select.propTypes = {
|
|
115
167
|
value: PropTypes.number.isRequired,
|
|
@@ -213,6 +265,8 @@ var styles = {"autosuggest-panel":"styles_autosuggest-panel__GEaoJ","autosuggest
|
|
|
213
265
|
styleInject(css_248z);
|
|
214
266
|
|
|
215
267
|
const _excluded = ["children", "className", "enabled", "onClick", "onKeyPress", "wide"];
|
|
268
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
269
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
216
270
|
const getEmptyViaPointPlaceHolder = () => ({});
|
|
217
271
|
const isViaPointEmpty = viaPoint => {
|
|
218
272
|
if (viaPoint === undefined || isEmpty(viaPoint)) {
|
|
@@ -231,18 +285,20 @@ const ItinerarySearchControl = _ref => {
|
|
|
231
285
|
wide = false
|
|
232
286
|
} = _ref,
|
|
233
287
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
234
|
-
return /*#__PURE__*/
|
|
288
|
+
return /*#__PURE__*/jsx("div", {
|
|
235
289
|
className: styles['itinerary-search-control'],
|
|
236
290
|
style: {
|
|
237
291
|
'--width': wide ? '47px' : '40px'
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
292
|
+
},
|
|
293
|
+
children: onClick && enabled && /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({}, rest), {}, {
|
|
294
|
+
className: className,
|
|
295
|
+
onClick: onClick,
|
|
296
|
+
onKeyPress: onKeyPress,
|
|
297
|
+
role: "button",
|
|
298
|
+
tabIndex: "0",
|
|
299
|
+
children: children
|
|
300
|
+
}))
|
|
301
|
+
});
|
|
246
302
|
};
|
|
247
303
|
const updateViaPointSlack = (activeViaPointSlacks, updatedViaPointIndex, viaPointRemoved = false) => {
|
|
248
304
|
const remaining = activeViaPointSlacks.filter(index => index !== updatedViaPointIndex);
|
|
@@ -496,198 +552,218 @@ function DTAutosuggestPanel({
|
|
|
496
552
|
const slackTime = getSlackTimeOptions(t);
|
|
497
553
|
const getViaPointSlackTimeOrDefault = (viaPoint, defaultValue = 0) => viaPoint && viaPoint.locationSlack || defaultValue;
|
|
498
554
|
const isViaPointSlackTimeInputActive = index => activeSlackInputs.includes(index);
|
|
499
|
-
return /*#__PURE__*/
|
|
555
|
+
return /*#__PURE__*/jsxs("div", {
|
|
500
556
|
className: cx(styles['autosuggest-panel'], isMobile && "small"),
|
|
501
557
|
style: {
|
|
502
558
|
'--color': primary
|
|
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
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
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
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
559
|
+
},
|
|
560
|
+
children: [' ', searchPanelText ? /*#__PURE__*/jsx("div", {
|
|
561
|
+
children: /*#__PURE__*/jsxs("h1", {
|
|
562
|
+
className: styles['autosuggest-searchpanel-text'],
|
|
563
|
+
children: [' ', searchPanelText]
|
|
564
|
+
})
|
|
565
|
+
}) : null, /*#__PURE__*/jsxs("div", {
|
|
566
|
+
className: styles['origin-input-container'],
|
|
567
|
+
children: [/*#__PURE__*/jsx(DTAutoSuggest, {
|
|
568
|
+
appElement: appElement,
|
|
569
|
+
icon: "originEllipse",
|
|
570
|
+
id: "origin",
|
|
571
|
+
autoFocus: disableAutoFocus === true ? false : !isMobile && !origin?.lat,
|
|
572
|
+
refPoint: refPoint,
|
|
573
|
+
className: getLocationType(origin),
|
|
574
|
+
placeholder: originPlaceHolder,
|
|
575
|
+
value: value(origin),
|
|
576
|
+
searchContext: searchContext,
|
|
577
|
+
getAutoSuggestIcons: getAutoSuggestIcons,
|
|
578
|
+
onSelect: onSelect,
|
|
579
|
+
onClear: onClear,
|
|
580
|
+
focusChange: onFocusChange || handleFocusChange,
|
|
581
|
+
lang: lang,
|
|
582
|
+
sources: sources,
|
|
583
|
+
targets: targets,
|
|
584
|
+
filterResults: filterResults,
|
|
585
|
+
isMobile: isMobile,
|
|
586
|
+
colors: colors,
|
|
587
|
+
mobileLabel: originMobileLabel,
|
|
588
|
+
modeSet: modeSet,
|
|
589
|
+
showScroll: showScroll,
|
|
590
|
+
isEmbedded: isEmbedded
|
|
591
|
+
}), (showSwapControl || showViapointControl) && /*#__PURE__*/jsx(ItinerarySearchControl, {
|
|
592
|
+
className: styles.opposite,
|
|
593
|
+
enabled: showSwapControl,
|
|
594
|
+
onClick: () => handleSwapOrderClick(),
|
|
595
|
+
onKeyPress: e => isKeyboardSelectionEvent(e) && handleSwapOrderClick(),
|
|
596
|
+
"aria-label": t('swap-order-button-label', {
|
|
597
|
+
lng
|
|
598
|
+
}),
|
|
599
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
600
|
+
img: "opposite",
|
|
601
|
+
color: primary
|
|
602
|
+
})
|
|
603
|
+
})]
|
|
604
|
+
}), viaPoints.length === 0 && /*#__PURE__*/jsx("div", {
|
|
605
|
+
className: styles['rectangle-container'],
|
|
606
|
+
children: /*#__PURE__*/jsx("div", {
|
|
607
|
+
className: styles.rectangle
|
|
608
|
+
})
|
|
609
|
+
}), /*#__PURE__*/jsx(ReactSortable, {
|
|
610
|
+
className: styles['viapoints-container'],
|
|
611
|
+
list: viaPoints,
|
|
612
|
+
handle: `.${styles['viapoint-before']}`,
|
|
613
|
+
animation: 200,
|
|
614
|
+
disabled: viaPoints.length <= 1,
|
|
615
|
+
setList: items => {
|
|
616
|
+
const newViaPoints = items.filter(vp => !isViaPointEmpty(vp));
|
|
617
|
+
if (newViaPoints.length > 0) {
|
|
618
|
+
updateViaPoints(newViaPoints);
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
children: viaPoints.map((o, i) => /*#__PURE__*/jsxs("div", {
|
|
622
|
+
className: cx(styles['viapoint-container']),
|
|
623
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
624
|
+
className: styles['light-gray-background'],
|
|
625
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
626
|
+
className: styles.row,
|
|
627
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
628
|
+
className: styles['viapoint-before'],
|
|
629
|
+
style: viaPoints.length > 1 ? {
|
|
630
|
+
cursor: 'move'
|
|
631
|
+
} : {},
|
|
632
|
+
children: viaPoints.length > 1 && /*#__PURE__*/jsx(Icon, {
|
|
633
|
+
img: "ellipsis",
|
|
634
|
+
rotate: 90,
|
|
635
|
+
color: primary
|
|
636
|
+
})
|
|
637
|
+
}), /*#__PURE__*/jsx("div", {
|
|
638
|
+
className: `${styles['viapoint-input-container']} ${styles[`viapoint-${i + 1}`]}`,
|
|
639
|
+
children: /*#__PURE__*/jsx(DTAutoSuggest, {
|
|
640
|
+
appElement: appElement,
|
|
641
|
+
icon: "mapMarker",
|
|
642
|
+
id: "via-point",
|
|
643
|
+
ariaLabel: t('via-point-index', {
|
|
644
|
+
index: i + 1,
|
|
645
|
+
lng
|
|
646
|
+
}),
|
|
647
|
+
autoFocus: disableAutoFocus === true ? false : !isMobile,
|
|
648
|
+
placeholder: "via-point",
|
|
649
|
+
className: "viapoint",
|
|
650
|
+
searchContext: searchContext,
|
|
651
|
+
refPoint: refPoint,
|
|
652
|
+
value: o && o.address || '',
|
|
653
|
+
onSelect: onSelect,
|
|
654
|
+
onClear: onClear,
|
|
655
|
+
handleViaPoints: item => handleViaPointLocationSelected(item, i),
|
|
656
|
+
lang: lang,
|
|
657
|
+
sources: sources,
|
|
658
|
+
targets: targets,
|
|
659
|
+
filterResults: filterResults,
|
|
660
|
+
getAutoSuggestIcons: getAutoSuggestIcons,
|
|
661
|
+
isMobile: isMobile,
|
|
662
|
+
modeSet: modeSet,
|
|
663
|
+
colors: colors,
|
|
664
|
+
showScroll: showScroll
|
|
665
|
+
})
|
|
666
|
+
}), showSlackControl && /*#__PURE__*/jsx(ItinerarySearchControl, {
|
|
667
|
+
className: styles['add-via-point-slack'],
|
|
668
|
+
enabled: showViapointControl,
|
|
669
|
+
onClick: () => handleToggleViaPointSlackClick(i),
|
|
670
|
+
onKeyPress: e => isKeyboardSelectionEvent(e) && handleToggleViaPointSlackClick(i),
|
|
671
|
+
"aria-label": t(isViaPointSlackTimeInputActive(i) ? 'add-via-duration-button-label-open' : 'add-via-duration-button-label-close', {
|
|
672
|
+
index: i + 1,
|
|
673
|
+
lng
|
|
674
|
+
}),
|
|
675
|
+
wide: true,
|
|
676
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
677
|
+
img: "time",
|
|
678
|
+
color: primary
|
|
679
|
+
})
|
|
680
|
+
})]
|
|
681
|
+
}), !isViaPointSlackTimeInputActive(i) && viaPoints[i] && viaPoints[i].locationSlack > 0 && /*#__PURE__*/jsx("span", {
|
|
682
|
+
className: styles['viapoint-slack-time'],
|
|
683
|
+
children: `${t('viapoint-slack-amount', {
|
|
684
|
+
lng
|
|
685
|
+
})}: ${getSlackDisplay(viaPoints[i].locationSlack)}`
|
|
686
|
+
}), /*#__PURE__*/jsx("div", {
|
|
687
|
+
className: cx(styles['input-viapoint-slack-container'], !isViaPointSlackTimeInputActive(i) && "collapsed"),
|
|
688
|
+
children: /*#__PURE__*/jsx("div", {
|
|
689
|
+
className: styles['select-wrapper'],
|
|
690
|
+
children: /*#__PURE__*/jsx(Select, {
|
|
691
|
+
id: `viapoint-slack-${i}`,
|
|
692
|
+
label: t('viapoint-slack-amount', {
|
|
693
|
+
lng
|
|
694
|
+
}),
|
|
695
|
+
options: slackTime,
|
|
696
|
+
value: getViaPointSlackTimeOrDefault(viaPoints[i]),
|
|
697
|
+
viaPointIndex: i,
|
|
698
|
+
icon: /*#__PURE__*/jsx("span", {
|
|
699
|
+
className: `${styles['combobox-icon']} ${styles['time-input-icon']}`,
|
|
700
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
701
|
+
img: "time",
|
|
702
|
+
color: primary
|
|
703
|
+
})
|
|
704
|
+
}),
|
|
705
|
+
onSlackTimeSelected: handleViaPointSlackTimeSelected
|
|
706
|
+
})
|
|
707
|
+
})
|
|
708
|
+
})]
|
|
709
|
+
}), /*#__PURE__*/jsx(ItinerarySearchControl, {
|
|
710
|
+
className: styles['remove-via-point'],
|
|
711
|
+
enabled: showViapointControl,
|
|
712
|
+
onClick: () => handleRemoveViaPointClick(i),
|
|
713
|
+
onKeyPress: e => isKeyboardSelectionEvent(e) && handleRemoveViaPointClick(i),
|
|
714
|
+
"aria-label": t('remove-via-button-label', {
|
|
715
|
+
index: i + 1,
|
|
716
|
+
lng
|
|
717
|
+
}),
|
|
718
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
719
|
+
img: "trash",
|
|
720
|
+
color: primary
|
|
721
|
+
})
|
|
722
|
+
})]
|
|
723
|
+
}, `viapoint-${i}`))
|
|
724
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
725
|
+
className: styles['destination-input-container'],
|
|
726
|
+
children: [/*#__PURE__*/jsx(DTAutoSuggest, {
|
|
727
|
+
appElement: appElement,
|
|
728
|
+
icon: "mapMarker",
|
|
729
|
+
id: "destination",
|
|
730
|
+
autoFocus: disableAutoFocus === true ? false : !isMobile && !Number.isNaN(origin?.lat),
|
|
731
|
+
storeRef: storeDestinationRef,
|
|
732
|
+
placeholder: destinationPlaceHolder,
|
|
733
|
+
className: getLocationType(destination),
|
|
734
|
+
getAutoSuggestIcons: getAutoSuggestIcons,
|
|
735
|
+
searchContext: searchContext,
|
|
736
|
+
onSelect: onSelect,
|
|
737
|
+
onClear: onClear,
|
|
738
|
+
refPoint: refPoint,
|
|
739
|
+
value: value(destination),
|
|
740
|
+
lang: lang,
|
|
741
|
+
sources: sources,
|
|
742
|
+
targets: targets,
|
|
743
|
+
filterResults: filterResults,
|
|
744
|
+
isMobile: isMobile,
|
|
745
|
+
mobileLabel: destinationMobileLabel,
|
|
746
|
+
modeSet: modeSet,
|
|
747
|
+
colors: colors,
|
|
748
|
+
showScroll: showScroll,
|
|
749
|
+
isEmbedded: isEmbedded
|
|
750
|
+
}), (showSwapControl || showViapointControl) && /*#__PURE__*/jsx(ItinerarySearchControl, {
|
|
751
|
+
className: cx(styles['add-via-point'], styles.more, viaPoints.length > 4 && "collapsed"),
|
|
752
|
+
enabled: showViapointControl && viaPoints.length === 0,
|
|
753
|
+
onClick: () => handleAddViaPointClick(),
|
|
754
|
+
onKeyPress: e => isKeyboardSelectionEvent(e) && handleAddViaPointClick(),
|
|
755
|
+
"aria-label": t('add-via-button-label', {
|
|
756
|
+
lng
|
|
757
|
+
}),
|
|
758
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
759
|
+
img: "viapoint",
|
|
760
|
+
width: 1.25,
|
|
761
|
+
height: 1.375,
|
|
762
|
+
color: primary
|
|
763
|
+
})
|
|
764
|
+
})]
|
|
765
|
+
})]
|
|
766
|
+
});
|
|
691
767
|
}
|
|
692
768
|
process.env.NODE_ENV !== "production" ? DTAutosuggestPanel.propTypes = {
|
|
693
769
|
appElement: PropTypes.string.isRequired,
|