@digitransit-component/digitransit-component-autosuggest-panel 11.0.1 → 13.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.js CHANGED
@@ -1,14 +1,50 @@
1
1
  import cx from 'classnames';
2
2
  import PropTypes from 'prop-types';
3
- import React, { useState, useReducer, useRef } from 'react';
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__*/React.createElement("div", {
96
- className: styles$1['combobox-container']
97
- }, /*#__PURE__*/React.createElement("div", {
98
- className: styles$1.container
99
- }, /*#__PURE__*/React.createElement("div", getToggleButtonProps(), /*#__PURE__*/React.createElement("span", {
100
- className: styles$1['left-column']
101
- }, /*#__PURE__*/React.createElement("label", Object.assign({}, getLabelProps(), {
102
- className: styles$1['combobox-label']
103
- }), label), /*#__PURE__*/React.createElement("div", {
104
- className: styles$1.input
105
- }, /*#__PURE__*/React.createElement("span", null, selectedItem.displayName))), icon), /*#__PURE__*/React.createElement("ul", Object.assign({
106
- className: cx(styles$1.suggestionsContainerOpen, !isOpen && 'hidden')
107
- }, getMenuProps()), isOpen && options.map((option, index) => /*#__PURE__*/React.createElement("li", Object.assign({
108
- key: option.value,
109
- className: cx(styles$1.suggestion, index === highlightedIndex && styles$1.suggestionHighlighted)
110
- }, getItemProps({
111
- index
112
- })), /*#__PURE__*/React.createElement("span", null, option.displayName))))));
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__*/React.createElement("div", {
288
+ return /*#__PURE__*/jsx("div", {
235
289
  className: styles['itinerary-search-control'],
236
290
  style: {
237
291
  '--width': wide ? '47px' : '40px'
238
- }
239
- }, onClick && enabled && /*#__PURE__*/React.createElement("div", Object.assign({}, rest, {
240
- className: className,
241
- onClick: onClick,
242
- onKeyPress: onKeyPress,
243
- role: "button",
244
- tabIndex: "0"
245
- }), children));
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__*/React.createElement("div", {
555
+ return /*#__PURE__*/jsxs("div", {
500
556
  className: cx(styles['autosuggest-panel'], isMobile && "small"),
501
557
  style: {
502
558
  '--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);
557
- }
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']}`
634
- }, /*#__PURE__*/React.createElement(Icon, {
635
- img: "time",
636
- color: primary
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,
646
- lng
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
- }))));
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,