@entur/travel 6.3.14-beta.3 → 6.3.14-beta.5
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/dist/LegBone.d.ts +33 -0
- package/dist/LegLine.d.ts +13 -0
- package/dist/TravelHeader.d.ts +22 -0
- package/dist/TravelLeg.d.ts +11 -0
- package/dist/TravelSwitch.d.ts +23 -0
- package/dist/TravelTag.d.ts +26 -0
- package/dist/index.d.ts +7 -132
- package/dist/index.js +8 -0
- package/dist/pattern/dashed-horizontal.svg +3 -0
- package/dist/pattern/dashed-vertical.svg +3 -0
- package/dist/pattern/dotted.svg +3 -0
- package/dist/pattern/line.svg +3 -0
- package/dist/pattern/wave-horizontal.svg +3 -0
- package/dist/pattern/wave-vertical.svg +3 -0
- package/dist/styles.css +283 -277
- package/dist/travel.cjs.development.js +387 -0
- package/dist/travel.cjs.development.js.map +1 -0
- package/dist/travel.cjs.production.min.js +2 -0
- package/dist/travel.cjs.production.min.js.map +1 -0
- package/dist/travel.esm.js +301 -343
- package/dist/travel.esm.js.map +1 -1
- package/dist/utils.d.ts +16 -0
- package/package.json +14 -24
- package/dist/travel.cjs.js +0 -420
- package/dist/travel.cjs.js.map +0 -1
package/dist/travel.esm.js
CHANGED
|
@@ -1,420 +1,378 @@
|
|
|
1
|
-
import { warnAboutMissingStyles } from
|
|
2
|
-
import {
|
|
3
|
-
import classNames from
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
className,
|
|
14
|
-
noWrap,
|
|
15
|
-
...rest
|
|
16
|
-
}) => {
|
|
17
|
-
return /* @__PURE__ */ jsxs(
|
|
18
|
-
Element,
|
|
19
|
-
{
|
|
20
|
-
className: classNames("eds-travel-header", className, {
|
|
21
|
-
"eds-travel-header--large": size === "large",
|
|
22
|
-
"eds-travel-header--medium": size === "medium",
|
|
23
|
-
"eds-travel-header--no-wrap": noWrap
|
|
24
|
-
}),
|
|
25
|
-
"aria-label": `Fra ${from}, til ${to}`,
|
|
26
|
-
...rest,
|
|
27
|
-
children: [
|
|
28
|
-
/* @__PURE__ */ jsx("span", { className: "eds-travel-header__from", children: from }),
|
|
29
|
-
/* @__PURE__ */ jsx("span", { className: "eds-travel-header__to", children: to })
|
|
30
|
-
]
|
|
1
|
+
import { warnAboutMissingStyles } from '@entur/utils';
|
|
2
|
+
import React, { useRef, cloneElement, useEffect } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { TrainIcon, BusIcon, MobilityIcon, CarferryIcon, FerryIcon, WalkIcon, BicycleIcon, TaxiIcon, CablewayIcon, FunicularIcon, TramIcon, HelicopterIcon, PlaneIcon, MetroIcon, CloseSmallIcon, ValidationInfoFilledIcon, ValidationErrorFilledIcon, ValidationExclamationCircleFilledIcon } from '@entur/icons';
|
|
5
|
+
import { useContrast } from '@entur/layout';
|
|
6
|
+
import { Switch } from '@entur/form';
|
|
7
|
+
|
|
8
|
+
function _extends() {
|
|
9
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
10
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
11
|
+
var t = arguments[e];
|
|
12
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
31
13
|
}
|
|
32
|
-
|
|
14
|
+
return n;
|
|
15
|
+
}, _extends.apply(null, arguments);
|
|
16
|
+
}
|
|
17
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
18
|
+
if (null == r) return {};
|
|
19
|
+
var t = {};
|
|
20
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
21
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
22
|
+
t[n] = r[n];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var _excluded$5 = ["as", "from", "to", "size", "className", "noWrap"];
|
|
28
|
+
var TravelHeader = function TravelHeader(_ref) {
|
|
29
|
+
var _ref$as = _ref.as,
|
|
30
|
+
Element = _ref$as === void 0 ? 'div' : _ref$as,
|
|
31
|
+
from = _ref.from,
|
|
32
|
+
to = _ref.to,
|
|
33
|
+
_ref$size = _ref.size,
|
|
34
|
+
size = _ref$size === void 0 ? 'large' : _ref$size,
|
|
35
|
+
className = _ref.className,
|
|
36
|
+
noWrap = _ref.noWrap,
|
|
37
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
38
|
+
return React.createElement(Element, _extends({
|
|
39
|
+
className: classNames('eds-travel-header', className, {
|
|
40
|
+
'eds-travel-header--large': size === 'large',
|
|
41
|
+
'eds-travel-header--medium': size === 'medium',
|
|
42
|
+
'eds-travel-header--no-wrap': noWrap
|
|
43
|
+
}),
|
|
44
|
+
"aria-label": "Fra " + from + ", til " + to
|
|
45
|
+
}, rest), React.createElement("span", {
|
|
46
|
+
className: "eds-travel-header__from"
|
|
47
|
+
}, from), React.createElement("span", {
|
|
48
|
+
className: "eds-travel-header__to"
|
|
49
|
+
}, to));
|
|
33
50
|
};
|
|
34
|
-
|
|
51
|
+
|
|
52
|
+
var getTransportStyle = function getTransportStyle(mode) {
|
|
35
53
|
switch (mode) {
|
|
36
|
-
case
|
|
54
|
+
case 'metro':
|
|
37
55
|
return {
|
|
38
56
|
Icon: MetroIcon,
|
|
39
|
-
pattern:
|
|
40
|
-
ariaLabel:
|
|
57
|
+
pattern: 'line',
|
|
58
|
+
ariaLabel: 'T-bane'
|
|
41
59
|
};
|
|
42
|
-
case
|
|
43
|
-
case
|
|
60
|
+
case 'bus':
|
|
61
|
+
case 'neutral':
|
|
44
62
|
return {
|
|
45
63
|
Icon: BusIcon,
|
|
46
|
-
pattern:
|
|
47
|
-
ariaLabel:
|
|
64
|
+
pattern: 'dashed',
|
|
65
|
+
ariaLabel: 'Buss'
|
|
48
66
|
};
|
|
49
|
-
case
|
|
50
|
-
case
|
|
67
|
+
case 'plane':
|
|
68
|
+
case 'air':
|
|
51
69
|
return {
|
|
52
70
|
Icon: PlaneIcon,
|
|
53
|
-
pattern:
|
|
54
|
-
ariaLabel:
|
|
71
|
+
pattern: 'line',
|
|
72
|
+
ariaLabel: 'Fly'
|
|
55
73
|
};
|
|
56
|
-
case
|
|
74
|
+
case 'helicopter':
|
|
57
75
|
return {
|
|
58
76
|
Icon: HelicopterIcon,
|
|
59
|
-
pattern:
|
|
60
|
-
ariaLabel:
|
|
77
|
+
pattern: 'line',
|
|
78
|
+
ariaLabel: 'Helikopter'
|
|
61
79
|
};
|
|
62
|
-
case
|
|
80
|
+
case 'tram':
|
|
63
81
|
return {
|
|
64
82
|
Icon: TramIcon,
|
|
65
|
-
pattern:
|
|
66
|
-
ariaLabel:
|
|
83
|
+
pattern: 'line',
|
|
84
|
+
ariaLabel: 'Trikk'
|
|
67
85
|
};
|
|
68
|
-
case
|
|
86
|
+
case 'funicular':
|
|
69
87
|
return {
|
|
70
88
|
Icon: FunicularIcon,
|
|
71
|
-
pattern:
|
|
72
|
-
ariaLabel:
|
|
89
|
+
pattern: 'line',
|
|
90
|
+
ariaLabel: 'Taubane'
|
|
73
91
|
};
|
|
74
|
-
case
|
|
92
|
+
case 'cableway':
|
|
75
93
|
return {
|
|
76
94
|
Icon: CablewayIcon,
|
|
77
|
-
pattern:
|
|
78
|
-
ariaLabel:
|
|
95
|
+
pattern: 'line',
|
|
96
|
+
ariaLabel: 'Gondol'
|
|
79
97
|
};
|
|
80
|
-
case
|
|
98
|
+
case 'taxi':
|
|
81
99
|
return {
|
|
82
100
|
Icon: TaxiIcon,
|
|
83
|
-
pattern:
|
|
84
|
-
ariaLabel:
|
|
101
|
+
pattern: 'dashed',
|
|
102
|
+
ariaLabel: 'Taxi'
|
|
85
103
|
};
|
|
86
|
-
case
|
|
87
|
-
case
|
|
104
|
+
case 'bicycle':
|
|
105
|
+
case 'citybike':
|
|
88
106
|
return {
|
|
89
107
|
Icon: BicycleIcon,
|
|
90
|
-
pattern:
|
|
91
|
-
ariaLabel:
|
|
108
|
+
pattern: 'dashed',
|
|
109
|
+
ariaLabel: 'Sykkel'
|
|
92
110
|
};
|
|
93
|
-
case
|
|
111
|
+
case 'walk':
|
|
94
112
|
return {
|
|
95
113
|
Icon: WalkIcon,
|
|
96
|
-
pattern:
|
|
97
|
-
ariaLabel:
|
|
114
|
+
pattern: 'dotted',
|
|
115
|
+
ariaLabel: 'Gange'
|
|
98
116
|
};
|
|
99
|
-
case
|
|
100
|
-
case
|
|
117
|
+
case 'train':
|
|
118
|
+
case 'rail':
|
|
101
119
|
return {
|
|
102
120
|
Icon: TrainIcon,
|
|
103
|
-
pattern:
|
|
104
|
-
ariaLabel:
|
|
121
|
+
pattern: 'line',
|
|
122
|
+
ariaLabel: 'Tog'
|
|
105
123
|
};
|
|
106
|
-
case
|
|
107
|
-
case
|
|
124
|
+
case 'ferry':
|
|
125
|
+
case 'water':
|
|
108
126
|
return {
|
|
109
127
|
Icon: FerryIcon,
|
|
110
|
-
pattern:
|
|
111
|
-
ariaLabel:
|
|
128
|
+
pattern: 'wave',
|
|
129
|
+
ariaLabel: 'Ferge'
|
|
112
130
|
};
|
|
113
|
-
case
|
|
131
|
+
case 'carferry':
|
|
114
132
|
return {
|
|
115
133
|
Icon: CarferryIcon,
|
|
116
|
-
pattern:
|
|
117
|
-
ariaLabel:
|
|
134
|
+
pattern: 'wave',
|
|
135
|
+
ariaLabel: 'Bilferge'
|
|
118
136
|
};
|
|
119
|
-
case
|
|
137
|
+
case 'mobility':
|
|
120
138
|
return {
|
|
121
139
|
Icon: MobilityIcon,
|
|
122
|
-
pattern:
|
|
123
|
-
ariaLabel:
|
|
140
|
+
pattern: 'line',
|
|
141
|
+
ariaLabel: 'El-sparkesykkel'
|
|
124
142
|
};
|
|
125
|
-
case
|
|
126
|
-
case
|
|
143
|
+
case 'airportLinkBus':
|
|
144
|
+
case 'airportlinkbus':
|
|
127
145
|
return {
|
|
128
146
|
Icon: BusIcon,
|
|
129
|
-
pattern:
|
|
130
|
-
ariaLabel:
|
|
147
|
+
pattern: 'dashed',
|
|
148
|
+
ariaLabel: 'Flybuss'
|
|
131
149
|
};
|
|
132
|
-
case
|
|
133
|
-
case
|
|
150
|
+
case 'airportLinkRail':
|
|
151
|
+
case 'airportlinkrail':
|
|
134
152
|
return {
|
|
135
153
|
Icon: TrainIcon,
|
|
136
|
-
pattern:
|
|
137
|
-
ariaLabel:
|
|
154
|
+
pattern: 'line',
|
|
155
|
+
ariaLabel: 'Flytog'
|
|
138
156
|
};
|
|
139
|
-
case
|
|
157
|
+
case 'none':
|
|
140
158
|
return {
|
|
141
159
|
Icon: React.Fragment,
|
|
142
|
-
pattern:
|
|
143
|
-
ariaLabel:
|
|
160
|
+
pattern: 'line',
|
|
161
|
+
ariaLabel: ''
|
|
144
162
|
};
|
|
145
|
-
case
|
|
146
|
-
throw Error(
|
|
147
|
-
|
|
148
|
-
);
|
|
149
|
-
case
|
|
150
|
-
throw Error(
|
|
151
|
-
|
|
152
|
-
);
|
|
153
|
-
case "car":
|
|
154
|
-
throw Error(
|
|
155
|
-
`transport type 'car' is deprecated: Please use 'taxi' instead.`
|
|
156
|
-
);
|
|
157
|
-
case "foot":
|
|
158
|
-
throw Error(
|
|
159
|
-
`transport type 'foot' is deprecated: Please use 'walk' instead.`
|
|
160
|
-
);
|
|
163
|
+
case 'scooter':
|
|
164
|
+
throw Error("transport type 'scooter' is deprecated: Please use 'mobility' instead.");
|
|
165
|
+
case 'bike':
|
|
166
|
+
throw Error("transport type 'bike' is deprecated: Please use 'bicycle' instead.");
|
|
167
|
+
case 'car':
|
|
168
|
+
throw Error("transport type 'car' is deprecated: Please use 'taxi' instead.");
|
|
169
|
+
case 'foot':
|
|
170
|
+
throw Error("transport type 'foot' is deprecated: Please use 'walk' instead.");
|
|
161
171
|
default:
|
|
162
|
-
throw Error(
|
|
172
|
+
throw Error('Please select a transport for the Travel component.');
|
|
163
173
|
}
|
|
164
174
|
};
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
175
|
+
|
|
176
|
+
var _excluded$4 = ["children", "className", "alert", "transport", "label", "labelPlacement", "onClose"];
|
|
177
|
+
var TravelTag = function TravelTag(_ref) {
|
|
178
|
+
var _classNames;
|
|
179
|
+
var children = _ref.children,
|
|
180
|
+
className = _ref.className,
|
|
181
|
+
_ref$alert = _ref.alert,
|
|
182
|
+
alert = _ref$alert === void 0 ? 'none' : _ref$alert,
|
|
183
|
+
_ref$transport = _ref.transport,
|
|
184
|
+
transport = _ref$transport === void 0 ? 'none' : _ref$transport,
|
|
185
|
+
label = _ref.label,
|
|
186
|
+
_ref$labelPlacement = _ref.labelPlacement,
|
|
187
|
+
labelPlacement = _ref$labelPlacement === void 0 ? 'right' : _ref$labelPlacement,
|
|
188
|
+
_ref$onClose = _ref.onClose,
|
|
189
|
+
onClose = _ref$onClose === void 0 ? undefined : _ref$onClose,
|
|
190
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
191
|
+
var isContrast = useContrast();
|
|
192
|
+
var isClosable = onClose ? true : false;
|
|
193
|
+
var transportIsSet = transport !== 'none';
|
|
194
|
+
var alertIsSet = alert !== 'none';
|
|
195
|
+
var tagRef = useRef(null);
|
|
196
|
+
var numberOfChildren = React.Children.count(children);
|
|
197
|
+
var _getTransportStyle = getTransportStyle(transport),
|
|
198
|
+
Icon = _getTransportStyle.Icon,
|
|
199
|
+
ariaLabelForTranportIcon = _getTransportStyle.ariaLabel;
|
|
200
|
+
var deCapitalizeTransport = transport.toLowerCase();
|
|
201
|
+
var IconWithAriaHidden = cloneElement(React.createElement(Icon, null), {
|
|
202
|
+
'aria-hidden': 'true'
|
|
203
|
+
});
|
|
204
|
+
var backgroundColor = 'var(--components-travel-traveltag-standard-tagfill-' + deCapitalizeTransport + ')';
|
|
205
|
+
var contrastBackgroundColor = 'var(--components-travel-traveltag-contrast-tagfill-' + deCapitalizeTransport + ')';
|
|
206
|
+
// Error colors
|
|
207
|
+
var errorBackgroundColor = 'var(--components-travel-traveltag-standard-tagfill-' + deCapitalizeTransport + '-cancled)';
|
|
208
|
+
var errorContrastBackgroundColor = 'var(--components-travel-traveltag-contrast-tagfill-' + deCapitalizeTransport + '-cancled)';
|
|
209
|
+
var errorContrastTextColor = 'var(--components-travel-traveltag-contrast-text-line-' + deCapitalizeTransport + '-cancled)';
|
|
210
|
+
var errorTextColor = 'var(--components-travel-traveltag-standard-text-line-' + deCapitalizeTransport + '-cancled)';
|
|
211
|
+
useEffect(function () {
|
|
191
212
|
if (transportIsSet) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
);
|
|
213
|
+
var _tagRef$current3;
|
|
214
|
+
var colorToSet;
|
|
215
|
+
var textColorToSet;
|
|
216
|
+
// Walk has another icon/text color then the other transports
|
|
217
|
+
if (transport === 'walk') {
|
|
218
|
+
var _tagRef$current;
|
|
219
|
+
(_tagRef$current = tagRef.current) == null || _tagRef$current.style.setProperty('--text-color', 'var(--components-travel-traveltag-standard-icon-walk)');
|
|
199
220
|
}
|
|
200
|
-
|
|
221
|
+
// Error
|
|
222
|
+
if (alert === 'error') {
|
|
223
|
+
var _tagRef$current2;
|
|
201
224
|
colorToSet = isContrast ? errorContrastBackgroundColor : errorBackgroundColor;
|
|
202
225
|
textColorToSet = isContrast ? errorContrastTextColor : errorTextColor;
|
|
203
|
-
tagRef.current
|
|
226
|
+
(_tagRef$current2 = tagRef.current) == null || _tagRef$current2.style.setProperty('--text-color', "" + textColorToSet);
|
|
204
227
|
} else {
|
|
205
228
|
colorToSet = isContrast ? contrastBackgroundColor : backgroundColor;
|
|
206
229
|
}
|
|
207
|
-
tagRef.current
|
|
208
|
-
}
|
|
209
|
-
}, [
|
|
210
|
-
transportIsSet,
|
|
211
|
-
isContrast,
|
|
212
|
-
backgroundColor,
|
|
213
|
-
contrastBackgroundColor,
|
|
214
|
-
errorBackgroundColor,
|
|
215
|
-
alert
|
|
216
|
-
]);
|
|
217
|
-
const TravelTagWithoutLabel = /* @__PURE__ */ jsxs(
|
|
218
|
-
"div",
|
|
219
|
-
{
|
|
220
|
-
className: classNames("eds-travel-tag", {
|
|
221
|
-
"eds-travel-tag--closable": isClosable,
|
|
222
|
-
"eds-travel-tag--alert": alertIsSet,
|
|
223
|
-
"eds-travel-tag--alert--error": alert === "error",
|
|
224
|
-
"eds-travel-tag--transport": transportIsSet,
|
|
225
|
-
"eds-travel-tag--icon-and-text": numberOfChildren > 1 || transportIsSet && numberOfChildren > 0,
|
|
226
|
-
className
|
|
227
|
-
}),
|
|
228
|
-
ref: tagRef,
|
|
229
|
-
"aria-label": `${ariaLabelForTranportIcon} ${children} ${alertIsSet ? alert : ""}`,
|
|
230
|
-
role: "img",
|
|
231
|
-
...rest,
|
|
232
|
-
children: [
|
|
233
|
-
IconWithAriaHidden,
|
|
234
|
-
children,
|
|
235
|
-
isClosable && /* @__PURE__ */ jsx(
|
|
236
|
-
"button",
|
|
237
|
-
{
|
|
238
|
-
onClick: onClose,
|
|
239
|
-
type: "button",
|
|
240
|
-
className: "eds-travel-tag__close-button",
|
|
241
|
-
children: /* @__PURE__ */ jsx(CloseSmallIcon, { inline: true })
|
|
242
|
-
}
|
|
243
|
-
),
|
|
244
|
-
alertIsSet && /* @__PURE__ */ jsxs("span", { className: "eds-travel-tag__alert", children: [
|
|
245
|
-
alert === "info" && /* @__PURE__ */ jsx(
|
|
246
|
-
ValidationInfoFilledIcon,
|
|
247
|
-
{
|
|
248
|
-
"aria-hidden": true,
|
|
249
|
-
className: "eds-travel-tag__alert-info-icon"
|
|
250
|
-
}
|
|
251
|
-
),
|
|
252
|
-
alert === "error" && /* @__PURE__ */ jsx(
|
|
253
|
-
ValidationErrorFilledIcon,
|
|
254
|
-
{
|
|
255
|
-
"aria-hidden": true,
|
|
256
|
-
className: "eds-travel-tag__alert-error-icon"
|
|
257
|
-
}
|
|
258
|
-
),
|
|
259
|
-
alert === "warning" && /* @__PURE__ */ jsx(
|
|
260
|
-
ValidationExclamationCircleFilledIcon,
|
|
261
|
-
{
|
|
262
|
-
"aria-hidden": true,
|
|
263
|
-
className: "eds-travel-tag__alert-exclamation-icon"
|
|
264
|
-
}
|
|
265
|
-
)
|
|
266
|
-
] })
|
|
267
|
-
]
|
|
268
|
-
}
|
|
269
|
-
);
|
|
270
|
-
const Label = /* @__PURE__ */ jsx(
|
|
271
|
-
"div",
|
|
272
|
-
{
|
|
273
|
-
className: classNames("eds-travel-tag__label", {
|
|
274
|
-
[`eds-travel-tag__label--${labelPlacement}`]: label,
|
|
275
|
-
[`eds-travel-tag__label--${labelPlacement}--with-alert`]: label && alertIsSet
|
|
276
|
-
}),
|
|
277
|
-
children: label
|
|
230
|
+
(_tagRef$current3 = tagRef.current) == null || _tagRef$current3.style.setProperty('--background-color', "" + colorToSet);
|
|
278
231
|
}
|
|
279
|
-
);
|
|
232
|
+
}, [transportIsSet, isContrast, backgroundColor, contrastBackgroundColor, errorBackgroundColor, alert]);
|
|
233
|
+
var TravelTagWithoutLabel = React.createElement("div", _extends({
|
|
234
|
+
className: classNames('eds-travel-tag', {
|
|
235
|
+
'eds-travel-tag--closable': isClosable,
|
|
236
|
+
'eds-travel-tag--alert': alertIsSet,
|
|
237
|
+
'eds-travel-tag--alert--error': alert === 'error',
|
|
238
|
+
'eds-travel-tag--transport': transportIsSet,
|
|
239
|
+
'eds-travel-tag--icon-and-text': numberOfChildren > 1 || transportIsSet && numberOfChildren > 0,
|
|
240
|
+
className: className
|
|
241
|
+
}),
|
|
242
|
+
ref: tagRef,
|
|
243
|
+
"aria-label": ariaLabelForTranportIcon + " " + children + " " + (alertIsSet ? alert : ''),
|
|
244
|
+
role: "img"
|
|
245
|
+
}, rest), IconWithAriaHidden, children, isClosable && React.createElement("button", {
|
|
246
|
+
onClick: onClose,
|
|
247
|
+
type: "button",
|
|
248
|
+
className: "eds-travel-tag__close-button"
|
|
249
|
+
}, React.createElement(CloseSmallIcon, {
|
|
250
|
+
inline: true
|
|
251
|
+
})), alertIsSet && React.createElement("span", {
|
|
252
|
+
className: "eds-travel-tag__alert"
|
|
253
|
+
}, alert === 'info' && React.createElement(ValidationInfoFilledIcon, {
|
|
254
|
+
"aria-hidden": true,
|
|
255
|
+
className: "eds-travel-tag__alert-info-icon"
|
|
256
|
+
}), alert === 'error' && React.createElement(ValidationErrorFilledIcon, {
|
|
257
|
+
"aria-hidden": true,
|
|
258
|
+
className: "eds-travel-tag__alert-error-icon"
|
|
259
|
+
}), alert === 'warning' && React.createElement(ValidationExclamationCircleFilledIcon, {
|
|
260
|
+
"aria-hidden": true,
|
|
261
|
+
className: "eds-travel-tag__alert-exclamation-icon"
|
|
262
|
+
})));
|
|
263
|
+
var Label = React.createElement("div", {
|
|
264
|
+
className: classNames('eds-travel-tag__label', (_classNames = {}, _classNames["eds-travel-tag__label--" + labelPlacement] = label, _classNames["eds-travel-tag__label--" + labelPlacement + "--with-alert"] = label && alertIsSet, _classNames))
|
|
265
|
+
}, label);
|
|
280
266
|
if (label) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
{
|
|
284
|
-
|
|
285
|
-
[`eds-travel-tag__wrapper--label-position-${labelPlacement}`]: label
|
|
286
|
-
}),
|
|
287
|
-
children: [
|
|
288
|
-
TravelTagWithoutLabel,
|
|
289
|
-
Label
|
|
290
|
-
]
|
|
291
|
-
}
|
|
292
|
-
);
|
|
267
|
+
var _classNames2;
|
|
268
|
+
return React.createElement("div", {
|
|
269
|
+
className: classNames('eds-travel-tag__wrapper', (_classNames2 = {}, _classNames2["eds-travel-tag__wrapper--label-position-" + labelPlacement] = label, _classNames2))
|
|
270
|
+
}, TravelTagWithoutLabel, Label);
|
|
293
271
|
}
|
|
294
272
|
return TravelTagWithoutLabel;
|
|
295
273
|
};
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
style: { backgroundColor: color },
|
|
311
|
-
...rest
|
|
274
|
+
|
|
275
|
+
var _excluded$3 = ["color", "direction", "pattern", "className"];
|
|
276
|
+
var LegLine = function LegLine(_ref) {
|
|
277
|
+
var _classNames;
|
|
278
|
+
var color = _ref.color,
|
|
279
|
+
_ref$direction = _ref.direction,
|
|
280
|
+
direction = _ref$direction === void 0 ? 'horizontal' : _ref$direction,
|
|
281
|
+
pattern = _ref.pattern,
|
|
282
|
+
className = _ref.className,
|
|
283
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
284
|
+
return React.createElement("div", _extends({
|
|
285
|
+
className: classNames('eds-leg-line', className, (_classNames = {}, _classNames["eds-leg-line--" + pattern] = pattern, _classNames["eds-leg-line--" + direction] = direction, _classNames)),
|
|
286
|
+
style: {
|
|
287
|
+
backgroundColor: color
|
|
312
288
|
}
|
|
313
|
-
);
|
|
289
|
+
}, rest));
|
|
314
290
|
};
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
),
|
|
343
|
-
showLine && /* @__PURE__ */ jsx(
|
|
344
|
-
LegLine,
|
|
345
|
-
{
|
|
346
|
-
className: `eds-leg-bone__line`,
|
|
347
|
-
direction,
|
|
348
|
-
color,
|
|
349
|
-
pattern
|
|
350
|
-
}
|
|
351
|
-
),
|
|
352
|
-
showStop && /* @__PURE__ */ jsx(
|
|
353
|
-
"div",
|
|
354
|
-
{
|
|
355
|
-
className: `eds-leg-bone__stop`,
|
|
356
|
-
style: { backgroundColor: endColor || color }
|
|
357
|
-
}
|
|
358
|
-
)
|
|
359
|
-
]
|
|
291
|
+
|
|
292
|
+
var _excluded$2 = ["direction", "pattern", "color", "startColor", "endColor", "showStart", "showStop", "showLine", "className"];
|
|
293
|
+
var LegBone = function LegBone(_ref) {
|
|
294
|
+
var direction = _ref.direction,
|
|
295
|
+
pattern = _ref.pattern,
|
|
296
|
+
color = _ref.color,
|
|
297
|
+
startColor = _ref.startColor,
|
|
298
|
+
endColor = _ref.endColor,
|
|
299
|
+
_ref$showStart = _ref.showStart,
|
|
300
|
+
showStart = _ref$showStart === void 0 ? true : _ref$showStart,
|
|
301
|
+
_ref$showStop = _ref.showStop,
|
|
302
|
+
showStop = _ref$showStop === void 0 ? true : _ref$showStop,
|
|
303
|
+
_ref$showLine = _ref.showLine,
|
|
304
|
+
showLine = _ref$showLine === void 0 ? true : _ref$showLine,
|
|
305
|
+
className = _ref.className,
|
|
306
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
307
|
+
return React.createElement("div", _extends({
|
|
308
|
+
className: classNames(className, 'eds-leg-bone', [{
|
|
309
|
+
'eds-leg-bone--vertical': direction === 'vertical'
|
|
310
|
+
}, {
|
|
311
|
+
'eds-leg-bone--horizontal': direction === 'horizontal'
|
|
312
|
+
}])
|
|
313
|
+
}, rest), showStart && React.createElement("div", {
|
|
314
|
+
className: "eds-leg-bone__start",
|
|
315
|
+
style: {
|
|
316
|
+
backgroundColor: startColor || color
|
|
360
317
|
}
|
|
361
|
-
)
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
const isContrast = useContrast();
|
|
371
|
-
const deCapitalizeTransport = transport.toLowerCase();
|
|
372
|
-
const backgroundColor = "var(--components-travel-travelleg-standard-" + deCapitalizeTransport + ")";
|
|
373
|
-
const contrastBackgroundColor = "var(--components-travel-travelleg-contrast-" + deCapitalizeTransport + ")";
|
|
374
|
-
return /* @__PURE__ */ jsx(
|
|
375
|
-
LegBone,
|
|
376
|
-
{
|
|
377
|
-
direction,
|
|
378
|
-
pattern,
|
|
379
|
-
color: isContrast ? contrastBackgroundColor : backgroundColor,
|
|
380
|
-
className,
|
|
381
|
-
...rest
|
|
318
|
+
}), showLine && React.createElement(LegLine, {
|
|
319
|
+
className: "eds-leg-bone__line",
|
|
320
|
+
direction: direction,
|
|
321
|
+
color: color,
|
|
322
|
+
pattern: pattern
|
|
323
|
+
}), showStop && React.createElement("div", {
|
|
324
|
+
className: "eds-leg-bone__stop",
|
|
325
|
+
style: {
|
|
326
|
+
backgroundColor: endColor || color
|
|
382
327
|
}
|
|
383
|
-
);
|
|
328
|
+
}));
|
|
384
329
|
};
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
icon: /* @__PURE__ */ jsx(Icon, {}),
|
|
405
|
-
size,
|
|
406
|
-
...rest,
|
|
407
|
-
children
|
|
408
|
-
}
|
|
409
|
-
);
|
|
330
|
+
|
|
331
|
+
var _excluded$1 = ["className", "transport", "direction"];
|
|
332
|
+
var TravelLeg = function TravelLeg(_ref) {
|
|
333
|
+
var className = _ref.className,
|
|
334
|
+
transport = _ref.transport,
|
|
335
|
+
direction = _ref.direction,
|
|
336
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
337
|
+
var _getTransportStyle = getTransportStyle(transport),
|
|
338
|
+
pattern = _getTransportStyle.pattern;
|
|
339
|
+
var isContrast = useContrast();
|
|
340
|
+
var deCapitalizeTransport = transport.toLowerCase();
|
|
341
|
+
var backgroundColor = 'var(--components-travel-travelleg-standard-' + deCapitalizeTransport + ')';
|
|
342
|
+
var contrastBackgroundColor = 'var(--components-travel-travelleg-contrast-' + deCapitalizeTransport + ')';
|
|
343
|
+
return React.createElement(LegBone, _extends({
|
|
344
|
+
direction: direction,
|
|
345
|
+
pattern: pattern,
|
|
346
|
+
color: isContrast ? contrastBackgroundColor : backgroundColor,
|
|
347
|
+
className: className
|
|
348
|
+
}, rest));
|
|
410
349
|
};
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
350
|
+
|
|
351
|
+
var _excluded = ["className", "children", "labelPlacement", "transport", "size"];
|
|
352
|
+
var TravelSwitch = function TravelSwitch(_ref) {
|
|
353
|
+
var className = _ref.className,
|
|
354
|
+
children = _ref.children,
|
|
355
|
+
_ref$labelPlacement = _ref.labelPlacement,
|
|
356
|
+
labelPlacement = _ref$labelPlacement === void 0 ? 'right' : _ref$labelPlacement,
|
|
357
|
+
transport = _ref.transport,
|
|
358
|
+
size = _ref.size,
|
|
359
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
360
|
+
var _getTransportStyle = getTransportStyle(transport),
|
|
361
|
+
Icon = _getTransportStyle.Icon;
|
|
362
|
+
var deCapitalizeTransport = transport.toLowerCase();
|
|
363
|
+
var backgroundColor = 'var(--components-travel-travelswitch-standard-backgroundtrue-' + deCapitalizeTransport + ')';
|
|
364
|
+
var contrastBackgroundColor = 'var(--components-travel-travelswitch-contrast-backgroundtrue-' + deCapitalizeTransport + ')';
|
|
365
|
+
return React.createElement(Switch, _extends({
|
|
366
|
+
className: className,
|
|
367
|
+
labelPlacement: labelPlacement,
|
|
368
|
+
color: backgroundColor,
|
|
369
|
+
contrastColor: contrastBackgroundColor,
|
|
370
|
+
icon: React.createElement(Icon, null),
|
|
371
|
+
size: size
|
|
372
|
+
}, rest), children);
|
|
419
373
|
};
|
|
374
|
+
|
|
375
|
+
warnAboutMissingStyles('travel');
|
|
376
|
+
|
|
377
|
+
export { LegBone, LegLine, TravelHeader, TravelLeg, TravelSwitch, TravelTag };
|
|
420
378
|
//# sourceMappingURL=travel.esm.js.map
|