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