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