@entur/travel 6.3.14-beta.0 → 6.3.14-beta.10

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.
@@ -1,487 +1,378 @@
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;
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]);
13
+ }
14
+ return n;
15
+ }, _extends.apply(null, arguments);
9
16
  }
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;
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;
72
25
  }
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
- );
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));
100
50
  };
101
- const getTransportStyle = (mode) => {
51
+
52
+ var getTransportStyle = function getTransportStyle(mode) {
102
53
  switch (mode) {
103
- case "metro":
54
+ case 'metro':
104
55
  return {
105
56
  Icon: MetroIcon,
106
- pattern: "line",
107
- ariaLabel: "T-bane"
57
+ pattern: 'line',
58
+ ariaLabel: 'T-bane'
108
59
  };
109
- case "bus":
110
- case "neutral":
60
+ case 'bus':
61
+ case 'neutral':
111
62
  return {
112
63
  Icon: BusIcon,
113
- pattern: "dashed",
114
- ariaLabel: "Buss"
64
+ pattern: 'dashed',
65
+ ariaLabel: 'Buss'
115
66
  };
116
- case "plane":
117
- case "air":
67
+ case 'plane':
68
+ case 'air':
118
69
  return {
119
70
  Icon: PlaneIcon,
120
- pattern: "line",
121
- ariaLabel: "Fly"
71
+ pattern: 'line',
72
+ ariaLabel: 'Fly'
122
73
  };
123
- case "helicopter":
74
+ case 'helicopter':
124
75
  return {
125
76
  Icon: HelicopterIcon,
126
- pattern: "line",
127
- ariaLabel: "Helikopter"
77
+ pattern: 'line',
78
+ ariaLabel: 'Helikopter'
128
79
  };
129
- case "tram":
80
+ case 'tram':
130
81
  return {
131
82
  Icon: TramIcon,
132
- pattern: "line",
133
- ariaLabel: "Trikk"
83
+ pattern: 'line',
84
+ ariaLabel: 'Trikk'
134
85
  };
135
- case "funicular":
86
+ case 'funicular':
136
87
  return {
137
88
  Icon: FunicularIcon,
138
- pattern: "line",
139
- ariaLabel: "Taubane"
89
+ pattern: 'line',
90
+ ariaLabel: 'Taubane'
140
91
  };
141
- case "cableway":
92
+ case 'cableway':
142
93
  return {
143
94
  Icon: CablewayIcon,
144
- pattern: "line",
145
- ariaLabel: "Gondol"
95
+ pattern: 'line',
96
+ ariaLabel: 'Gondol'
146
97
  };
147
- case "taxi":
98
+ case 'taxi':
148
99
  return {
149
100
  Icon: TaxiIcon,
150
- pattern: "dashed",
151
- ariaLabel: "Taxi"
101
+ pattern: 'dashed',
102
+ ariaLabel: 'Taxi'
152
103
  };
153
- case "bicycle":
154
- case "citybike":
104
+ case 'bicycle':
105
+ case 'citybike':
155
106
  return {
156
107
  Icon: BicycleIcon,
157
- pattern: "dashed",
158
- ariaLabel: "Sykkel"
108
+ pattern: 'dashed',
109
+ ariaLabel: 'Sykkel'
159
110
  };
160
- case "walk":
111
+ case 'walk':
161
112
  return {
162
113
  Icon: WalkIcon,
163
- pattern: "dotted",
164
- ariaLabel: "Gange"
114
+ pattern: 'dotted',
115
+ ariaLabel: 'Gange'
165
116
  };
166
- case "train":
167
- case "rail":
117
+ case 'train':
118
+ case 'rail':
168
119
  return {
169
120
  Icon: TrainIcon,
170
- pattern: "line",
171
- ariaLabel: "Tog"
121
+ pattern: 'line',
122
+ ariaLabel: 'Tog'
172
123
  };
173
- case "ferry":
174
- case "water":
124
+ case 'ferry':
125
+ case 'water':
175
126
  return {
176
127
  Icon: FerryIcon,
177
- pattern: "wave",
178
- ariaLabel: "Ferge"
128
+ pattern: 'wave',
129
+ ariaLabel: 'Ferge'
179
130
  };
180
- case "carferry":
131
+ case 'carferry':
181
132
  return {
182
133
  Icon: CarferryIcon,
183
- pattern: "wave",
184
- ariaLabel: "Bilferge"
134
+ pattern: 'wave',
135
+ ariaLabel: 'Bilferge'
185
136
  };
186
- case "mobility":
137
+ case 'mobility':
187
138
  return {
188
139
  Icon: MobilityIcon,
189
- pattern: "line",
190
- ariaLabel: "El-sparkesykkel"
140
+ pattern: 'line',
141
+ ariaLabel: 'El-sparkesykkel'
191
142
  };
192
- case "airportLinkBus":
193
- case "airportlinkbus":
143
+ case 'airportLinkBus':
144
+ case 'airportlinkbus':
194
145
  return {
195
146
  Icon: BusIcon,
196
- pattern: "dashed",
197
- ariaLabel: "Flybuss"
147
+ pattern: 'dashed',
148
+ ariaLabel: 'Flybuss'
198
149
  };
199
- case "airportLinkRail":
200
- case "airportlinkrail":
150
+ case 'airportLinkRail':
151
+ case 'airportlinkrail':
201
152
  return {
202
153
  Icon: TrainIcon,
203
- pattern: "line",
204
- ariaLabel: "Flytog"
154
+ pattern: 'line',
155
+ ariaLabel: 'Flytog'
205
156
  };
206
- case "none":
157
+ case 'none':
207
158
  return {
208
159
  Icon: React.Fragment,
209
- pattern: "line",
210
- ariaLabel: ""
160
+ pattern: 'line',
161
+ ariaLabel: ''
211
162
  };
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
- );
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.");
228
171
  default:
229
- throw Error("Please select a transport for the Travel component.");
172
+ throw Error('Please select a transport for the Travel component.');
230
173
  }
231
174
  };
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(() => {
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 () {
258
212
  if (transportIsSet) {
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
- );
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)');
266
220
  }
267
- if (alert === "error") {
221
+ // Error
222
+ if (alert === 'error') {
223
+ var _tagRef$current2;
268
224
  colorToSet = isContrast ? errorContrastBackgroundColor : errorBackgroundColor;
269
225
  textColorToSet = isContrast ? errorContrastTextColor : errorTextColor;
270
- tagRef.current?.style.setProperty("--text-color", `${textColorToSet}`);
226
+ (_tagRef$current2 = tagRef.current) == null || _tagRef$current2.style.setProperty('--text-color', "" + textColorToSet);
271
227
  } else {
272
228
  colorToSet = isContrast ? contrastBackgroundColor : backgroundColor;
273
229
  }
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
230
+ (_tagRef$current3 = tagRef.current) == null || _tagRef$current3.style.setProperty('--background-color', "" + colorToSet);
345
231
  }
346
- );
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);
347
266
  if (label) {
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
- );
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);
360
271
  }
361
272
  return TravelTagWithoutLabel;
362
273
  };
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
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
379
288
  }
380
- );
289
+ }, rest));
381
290
  };
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
- ]
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
427
317
  }
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
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
449
327
  }
450
- );
328
+ }));
451
329
  };
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
- );
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));
477
349
  };
478
- warnAboutMissingStyles("travel");
479
- export {
480
- LegBone,
481
- LegLine,
482
- TravelHeader,
483
- TravelLeg,
484
- TravelSwitch,
485
- TravelTag
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);
486
373
  };
374
+
375
+ warnAboutMissingStyles('travel');
376
+
377
+ export { LegBone, LegLine, TravelHeader, TravelLeg, TravelSwitch, TravelTag };
487
378
  //# sourceMappingURL=travel.esm.js.map