@entur/travel 6.1.6 → 6.1.8

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.
@@ -7,7 +7,6 @@ var React = require('react');
7
7
  var classNames = require('classnames');
8
8
  var icons = require('@entur/icons');
9
9
  var layout = require('@entur/layout');
10
- var tokens = require('@entur/tokens');
11
10
  var form = require('@entur/form');
12
11
 
13
12
  function _extends() {
@@ -67,16 +66,12 @@ var getTransportStyle = function getTransportStyle(mode) {
67
66
  case 'metro':
68
67
  return {
69
68
  Icon: icons.MetroIcon,
70
- backgroundColor: tokens.colors.transport["default"].metro,
71
- contrastBackgroundColor: tokens.colors.transport.contrast.metro,
72
69
  pattern: 'line',
73
70
  ariaLabel: 'T-bane'
74
71
  };
75
72
  case 'bus':
76
73
  return {
77
74
  Icon: icons.BusIcon,
78
- backgroundColor: tokens.colors.transport["default"].bus,
79
- contrastBackgroundColor: tokens.colors.transport.contrast.bus,
80
75
  pattern: 'dashed',
81
76
  ariaLabel: 'Buss'
82
77
  };
@@ -84,64 +79,48 @@ var getTransportStyle = function getTransportStyle(mode) {
84
79
  case 'air':
85
80
  return {
86
81
  Icon: icons.PlaneIcon,
87
- backgroundColor: tokens.colors.transport["default"].plane,
88
- contrastBackgroundColor: tokens.colors.transport.contrast.plane,
89
82
  pattern: 'line',
90
83
  ariaLabel: 'Fly'
91
84
  };
92
85
  case 'helicopter':
93
86
  return {
94
87
  Icon: icons.HelicopterIcon,
95
- backgroundColor: tokens.colors.transport["default"].helicopter,
96
- contrastBackgroundColor: tokens.colors.transport.contrast.helicopter,
97
88
  pattern: 'line',
98
89
  ariaLabel: 'Helikopter'
99
90
  };
100
91
  case 'tram':
101
92
  return {
102
93
  Icon: icons.TramIcon,
103
- backgroundColor: tokens.colors.transport["default"].tram,
104
- contrastBackgroundColor: tokens.colors.transport.contrast.tram,
105
94
  pattern: 'line',
106
95
  ariaLabel: 'Trikk'
107
96
  };
108
97
  case 'funicular':
109
98
  return {
110
99
  Icon: icons.FunicularIcon,
111
- backgroundColor: tokens.colors.transport["default"].funicular,
112
- contrastBackgroundColor: tokens.colors.transport.contrast.funicular,
113
100
  pattern: 'line',
114
101
  ariaLabel: 'Taubane'
115
102
  };
116
103
  case 'cableway':
117
104
  return {
118
105
  Icon: icons.CablewayIcon,
119
- backgroundColor: tokens.colors.transport["default"].cableway,
120
- contrastBackgroundColor: tokens.colors.transport.contrast.cableway,
121
106
  pattern: 'line',
122
107
  ariaLabel: 'Gondol'
123
108
  };
124
109
  case 'taxi':
125
110
  return {
126
111
  Icon: icons.TaxiIcon,
127
- backgroundColor: tokens.colors.transport["default"].taxi,
128
- contrastBackgroundColor: tokens.colors.transport.contrast.taxi,
129
112
  pattern: 'dashed',
130
113
  ariaLabel: 'Taxi'
131
114
  };
132
115
  case 'bicycle':
133
116
  return {
134
117
  Icon: icons.BicycleIcon,
135
- backgroundColor: tokens.colors.transport["default"].bicycle,
136
- contrastBackgroundColor: tokens.colors.transport.contrast.bicycle,
137
- pattern: 'line',
118
+ pattern: 'dashed',
138
119
  ariaLabel: 'Sykkel'
139
120
  };
140
121
  case 'walk':
141
122
  return {
142
123
  Icon: icons.WalkIcon,
143
- backgroundColor: tokens.colors.transport["default"].walk,
144
- contrastBackgroundColor: tokens.colors.transport.contrast.walk,
145
124
  pattern: 'dotted',
146
125
  ariaLabel: 'Gange'
147
126
  };
@@ -149,8 +128,6 @@ var getTransportStyle = function getTransportStyle(mode) {
149
128
  case 'rail':
150
129
  return {
151
130
  Icon: icons.TrainIcon,
152
- backgroundColor: tokens.colors.transport["default"].train,
153
- contrastBackgroundColor: tokens.colors.transport.contrast.train,
154
131
  pattern: 'line',
155
132
  ariaLabel: 'Tog'
156
133
  };
@@ -158,48 +135,36 @@ var getTransportStyle = function getTransportStyle(mode) {
158
135
  case 'water':
159
136
  return {
160
137
  Icon: icons.FerryIcon,
161
- backgroundColor: tokens.colors.transport["default"].ferry,
162
- contrastBackgroundColor: tokens.colors.transport.contrast.ferry,
163
138
  pattern: 'wave',
164
139
  ariaLabel: 'Ferge'
165
140
  };
166
141
  case 'carferry':
167
142
  return {
168
143
  Icon: icons.CarferryIcon,
169
- backgroundColor: tokens.colors.transport["default"].carferry,
170
- contrastBackgroundColor: tokens.colors.transport.contrast.carferry,
171
144
  pattern: 'wave',
172
145
  ariaLabel: 'Bilferge'
173
146
  };
174
147
  case 'mobility':
175
148
  return {
176
149
  Icon: icons.MobilityIcon,
177
- backgroundColor: tokens.colors.transport["default"].mobility,
178
- contrastBackgroundColor: tokens.colors.transport.contrast.mobility,
179
150
  pattern: 'line',
180
151
  ariaLabel: 'El-sparkesykkel'
181
152
  };
182
153
  case 'airportLinkBus':
183
154
  return {
184
155
  Icon: icons.BusIcon,
185
- backgroundColor: tokens.colors.transport["default"].plane,
186
- contrastBackgroundColor: tokens.colors.transport.contrast.plane,
187
156
  pattern: 'dashed',
188
157
  ariaLabel: 'Flybuss'
189
158
  };
190
159
  case 'airportLinkRail':
191
160
  return {
192
161
  Icon: icons.TrainIcon,
193
- backgroundColor: tokens.colors.transport["default"].plane,
194
- contrastBackgroundColor: tokens.colors.transport.contrast.plane,
195
162
  pattern: 'line',
196
163
  ariaLabel: 'Flytog'
197
164
  };
198
165
  case 'none':
199
166
  return {
200
167
  Icon: React.Fragment,
201
- backgroundColor: tokens.colors.brand.blue,
202
- contrastBackgroundColor: tokens.colors.brand.white,
203
168
  pattern: 'line',
204
169
  ariaLabel: ''
205
170
  };
@@ -218,7 +183,7 @@ var getTransportStyle = function getTransportStyle(mode) {
218
183
 
219
184
  var _excluded$4 = ["children", "className", "alert", "transport", "label", "labelPlacement", "onClose"];
220
185
  var TravelTag = function TravelTag(_ref) {
221
- var _rest$ariaLabel, _classNames;
186
+ var _classNames;
222
187
  var children = _ref.children,
223
188
  className = _ref.className,
224
189
  _ref$alert = _ref.alert,
@@ -239,15 +204,40 @@ var TravelTag = function TravelTag(_ref) {
239
204
  var numberOfChildren = React.Children.count(children);
240
205
  var _getTransportStyle = getTransportStyle(transport),
241
206
  Icon = _getTransportStyle.Icon,
242
- contrastBackgroundColor = _getTransportStyle.contrastBackgroundColor,
243
- backgroundColor = _getTransportStyle.backgroundColor,
244
- ariaLabel = _getTransportStyle.ariaLabel;
207
+ ariaLabelForTranportIcon = _getTransportStyle.ariaLabel;
208
+ var deCapitalizeTransport = transport.toLowerCase();
209
+ var IconWithAriaHidden = React.cloneElement(React.createElement(Icon, null), {
210
+ 'aria-hidden': 'true'
211
+ });
212
+ var backgroundColor = 'var(--components-travel-traveltag-standard-tagfill-' + deCapitalizeTransport + ')';
213
+ var contrastBackgroundColor = 'var(--components-travel-traveltag-contrast-tagfill-' + deCapitalizeTransport + ')';
214
+ // Error colors
215
+ var errorBackgroundColor = 'var(--components-travel-traveltag-standard-tagfill-' + deCapitalizeTransport + '-cancled)';
216
+ var errorContrastBackgroundColor = 'var(--components-travel-traveltag-contrast-tagfill-' + deCapitalizeTransport + '-cancled)';
217
+ var errorContrastTextColor = 'var(--components-travel-traveltag-contrast-text-line-' + deCapitalizeTransport + '-cancled)';
218
+ var errorTextColor = 'var(--components-travel-traveltag-standard-text-line-' + deCapitalizeTransport + '-cancled)';
245
219
  React.useEffect(function () {
246
220
  if (transportIsSet) {
247
- var _tagRef$current;
248
- (_tagRef$current = tagRef.current) == null ? void 0 : _tagRef$current.style.setProperty('--background-color', isContrast ? contrastBackgroundColor : backgroundColor);
221
+ var _tagRef$current3;
222
+ var colorToSet;
223
+ var textColorToSet;
224
+ // Walk has another icon/text color then the other transports
225
+ if (transport === 'walk') {
226
+ var _tagRef$current;
227
+ (_tagRef$current = tagRef.current) == null ? void 0 : _tagRef$current.style.setProperty('--text-color', 'var(--components-travel-traveltag-standard-icon-walk)');
228
+ }
229
+ // Error
230
+ if (alert === 'error') {
231
+ var _tagRef$current2;
232
+ colorToSet = isContrast ? errorContrastBackgroundColor : errorBackgroundColor;
233
+ textColorToSet = isContrast ? errorContrastTextColor : errorTextColor;
234
+ (_tagRef$current2 = tagRef.current) == null ? void 0 : _tagRef$current2.style.setProperty('--text-color', "" + textColorToSet);
235
+ } else {
236
+ colorToSet = isContrast ? contrastBackgroundColor : backgroundColor;
237
+ }
238
+ (_tagRef$current3 = tagRef.current) == null ? void 0 : _tagRef$current3.style.setProperty('--background-color', "" + colorToSet);
249
239
  }
250
- }, [tagRef.current, backgroundColor]);
240
+ }, [transportIsSet, isContrast, backgroundColor, contrastBackgroundColor, errorBackgroundColor, alert]);
251
241
  var TravelTagWithoutLabel = React.createElement("div", _extends({
252
242
  className: classNames('eds-travel-tag', {
253
243
  'eds-travel-tag--closable': isClosable,
@@ -257,13 +247,10 @@ var TravelTag = function TravelTag(_ref) {
257
247
  'eds-travel-tag--icon-and-text': numberOfChildren > 1 || transportIsSet && numberOfChildren > 0,
258
248
  className: className
259
249
  }),
260
- ref: tagRef
261
- }, rest, {
262
- "aria-label": (_rest$ariaLabel = rest['aria-label']) != null ? _rest$ariaLabel : ariaLabel + (alertIsSet ? " " + alert : ''),
250
+ ref: tagRef,
251
+ "aria-label": ariaLabelForTranportIcon + " " + children + " " + (alertIsSet ? alert : ''),
263
252
  role: "img"
264
- }), React.createElement(Icon, {
265
- "aria-hidden": true
266
- }), children, isClosable && React.createElement("button", {
253
+ }, rest), IconWithAriaHidden, children, isClosable && React.createElement("button", {
267
254
  onClick: onClose,
268
255
  type: "button",
269
256
  className: "eds-travel-tag__close-button"
@@ -356,10 +343,12 @@ var TravelLeg = function TravelLeg(_ref) {
356
343
  direction = _ref.direction,
357
344
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
358
345
  var _getTransportStyle = getTransportStyle(transport),
359
- backgroundColor = _getTransportStyle.backgroundColor,
360
- contrastBackgroundColor = _getTransportStyle.contrastBackgroundColor,
361
346
  pattern = _getTransportStyle.pattern;
362
347
  var isContrast = layout.useContrast();
348
+ var deCapitalizeTransport = transport.toLowerCase();
349
+ console.log('deCapitalizeTransport', deCapitalizeTransport);
350
+ var backgroundColor = 'var(--components-travel-travelleg-standard-' + deCapitalizeTransport + ')';
351
+ var contrastBackgroundColor = 'var(--components-travel-travelleg-contrast-' + deCapitalizeTransport + ')';
363
352
  return React.createElement(LegBone, _extends({
364
353
  direction: direction,
365
354
  pattern: pattern,
@@ -378,9 +367,10 @@ var TravelSwitch = function TravelSwitch(_ref) {
378
367
  size = _ref.size,
379
368
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
380
369
  var _getTransportStyle = getTransportStyle(transport),
381
- backgroundColor = _getTransportStyle.backgroundColor,
382
- contrastBackgroundColor = _getTransportStyle.contrastBackgroundColor,
383
370
  Icon = _getTransportStyle.Icon;
371
+ var deCapitalizeTransport = transport.toLowerCase();
372
+ var backgroundColor = 'var(--components-travel-travelswitch-standard-backgroundtrue-' + deCapitalizeTransport + ')';
373
+ var contrastBackgroundColor = 'var(--components-travel-travelswitch-contrast-backgroundtrue-' + deCapitalizeTransport + ')';
384
374
  return React.createElement(form.Switch, _extends({
385
375
  className: className,
386
376
  labelPlacement: labelPlacement,
@@ -1 +1 @@
1
- {"version":3,"file":"travel.cjs.development.js","sources":["../src/TravelHeader.tsx","../src/utils.ts","../src/TravelTag.tsx","../src/LegLine.tsx","../src/LegBone.tsx","../src/TravelLeg.tsx","../src/TravelSwitch.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport './TravelHeader.scss';\n\nexport type TravelHeaderProps = {\n /** HTML-elementet eller React-komponenten som lager elementet\n * @default 'div'\n */\n as?: string | React.ElementType;\n /** Destinasjonen man reiser fra */\n from: React.ReactNode;\n /** Destinasjonen man reiser til */\n to: React.ReactNode;\n /**Størrelsen på komponenten\n * @default 'large'\n */\n size?: 'large' | 'medium';\n /** Plassere til og fra på samme linje */\n noWrap?: boolean;\n /**Ekstra klassenavn */\n className?: string;\n [key: string]: any;\n};\n\nexport const TravelHeader: React.FC<TravelHeaderProps> = ({\n as: Element = 'div',\n from,\n to,\n size = 'large',\n className,\n noWrap,\n ...rest\n}) => {\n return (\n <Element\n className={classNames('eds-travel-header', className, {\n 'eds-travel-header--large': size === 'large',\n 'eds-travel-header--medium': size === 'medium',\n 'eds-travel-header--no-wrap': noWrap,\n })}\n aria-label={`Fra ${from}, til ${to}`}\n {...rest}\n >\n <span className=\"eds-travel-header__from\">{from}</span>\n <span className=\"eds-travel-header__to\">{to}</span>\n </Element>\n );\n};\n","import React from 'react';\nimport { colors } from '@entur/tokens';\nimport {\n BusIcon,\n FerryIcon,\n CarferryIcon,\n TramIcon,\n PlaneIcon,\n TrainIcon,\n BicycleIcon,\n MobilityIcon,\n MetroIcon,\n HelicopterIcon,\n FunicularIcon,\n CablewayIcon,\n TaxiIcon,\n WalkIcon,\n} from '@entur/icons';\n\nimport type { IconProps } from '@entur/icons';\n\nexport type Transport =\n | 'metro'\n | 'bus'\n | 'plane'\n | 'helicopter'\n | 'tram'\n | 'funicular'\n | 'cableway'\n | 'taxi'\n | 'bicycle'\n | 'walk'\n | 'train'\n | 'ferry'\n | 'carferry'\n | 'mobility'\n | 'airportLinkBus'\n | 'airportLinkRail'\n | 'rail'\n | 'water'\n | 'air'\n | 'none';\n\ntype transportStyleResult = {\n Icon: React.FC<IconProps>;\n backgroundColor: string;\n contrastBackgroundColor: string;\n pattern: 'line' | 'wave' | 'dashed' | 'dotted';\n ariaLabel: string;\n};\n\nexport const getTransportStyle = (mode: string): transportStyleResult => {\n switch (mode) {\n case 'metro':\n return {\n Icon: MetroIcon,\n backgroundColor: colors.transport.default.metro,\n contrastBackgroundColor: colors.transport.contrast.metro,\n pattern: 'line',\n ariaLabel: 'T-bane',\n };\n case 'bus':\n return {\n Icon: BusIcon,\n backgroundColor: colors.transport.default.bus,\n contrastBackgroundColor: colors.transport.contrast.bus,\n pattern: 'dashed',\n ariaLabel: 'Buss',\n };\n case 'plane':\n case 'air':\n return {\n Icon: PlaneIcon,\n backgroundColor: colors.transport.default.plane,\n contrastBackgroundColor: colors.transport.contrast.plane,\n pattern: 'line',\n ariaLabel: 'Fly',\n };\n case 'helicopter':\n return {\n Icon: HelicopterIcon,\n backgroundColor: colors.transport.default.helicopter,\n contrastBackgroundColor: colors.transport.contrast.helicopter,\n pattern: 'line',\n ariaLabel: 'Helikopter',\n };\n case 'tram':\n return {\n Icon: TramIcon,\n backgroundColor: colors.transport.default.tram,\n contrastBackgroundColor: colors.transport.contrast.tram,\n pattern: 'line',\n ariaLabel: 'Trikk',\n };\n case 'funicular':\n return {\n Icon: FunicularIcon,\n backgroundColor: colors.transport.default.funicular,\n contrastBackgroundColor: colors.transport.contrast.funicular,\n pattern: 'line',\n ariaLabel: 'Taubane',\n };\n case 'cableway':\n return {\n Icon: CablewayIcon,\n backgroundColor: colors.transport.default.cableway,\n contrastBackgroundColor: colors.transport.contrast.cableway,\n pattern: 'line',\n ariaLabel: 'Gondol',\n };\n case 'taxi':\n return {\n Icon: TaxiIcon,\n backgroundColor: colors.transport.default.taxi,\n contrastBackgroundColor: colors.transport.contrast.taxi,\n pattern: 'dashed',\n ariaLabel: 'Taxi',\n };\n case 'bicycle':\n return {\n Icon: BicycleIcon,\n backgroundColor: colors.transport.default.bicycle,\n contrastBackgroundColor: colors.transport.contrast.bicycle,\n pattern: 'line',\n ariaLabel: 'Sykkel',\n };\n case 'walk':\n return {\n Icon: WalkIcon,\n backgroundColor: colors.transport.default.walk,\n contrastBackgroundColor: colors.transport.contrast.walk,\n pattern: 'dotted',\n ariaLabel: 'Gange',\n };\n case 'train':\n case 'rail':\n return {\n Icon: TrainIcon,\n backgroundColor: colors.transport.default.train,\n contrastBackgroundColor: colors.transport.contrast.train,\n pattern: 'line',\n ariaLabel: 'Tog',\n };\n case 'ferry':\n case 'water':\n return {\n Icon: FerryIcon,\n backgroundColor: colors.transport.default.ferry,\n contrastBackgroundColor: colors.transport.contrast.ferry,\n pattern: 'wave',\n ariaLabel: 'Ferge',\n };\n case 'carferry':\n return {\n Icon: CarferryIcon,\n backgroundColor: colors.transport.default.carferry,\n contrastBackgroundColor: colors.transport.contrast.carferry,\n pattern: 'wave',\n ariaLabel: 'Bilferge',\n };\n case 'mobility':\n return {\n Icon: MobilityIcon,\n backgroundColor: colors.transport.default.mobility,\n contrastBackgroundColor: colors.transport.contrast.mobility,\n pattern: 'line',\n ariaLabel: 'El-sparkesykkel',\n };\n case 'airportLinkBus':\n return {\n Icon: BusIcon,\n backgroundColor: colors.transport.default.plane,\n contrastBackgroundColor: colors.transport.contrast.plane,\n pattern: 'dashed',\n ariaLabel: 'Flybuss',\n };\n case 'airportLinkRail':\n return {\n Icon: TrainIcon,\n backgroundColor: colors.transport.default.plane,\n contrastBackgroundColor: colors.transport.contrast.plane,\n pattern: 'line',\n ariaLabel: 'Flytog',\n };\n case 'none':\n return {\n Icon: React.Fragment,\n backgroundColor: colors.brand.blue,\n contrastBackgroundColor: colors.brand.white,\n pattern: 'line',\n ariaLabel: '',\n };\n case 'scooter':\n throw Error(\n `transport type 'scooter' is deprecated: Please use 'mobility' instead.`,\n );\n case 'bike':\n throw Error(\n `transport type 'bike' is deprecated: Please use 'bicycle' instead.`,\n );\n case 'car':\n throw Error(\n `transport type 'car' is deprecated: Please use 'taxi' instead.`,\n );\n case 'foot':\n throw Error(\n `transport type 'foot' is deprecated: Please use 'walk' instead.`,\n );\n default:\n throw Error('Please select a transport for the Travel component.');\n }\n};\n","import React, { useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport {\n CloseSmallIcon,\n ValidationInfoIcon,\n ValidationErrorIcon,\n ValidationExclamationIcon,\n} from '@entur/icons';\nimport { useContrast } from '@entur/layout';\n\nimport { getTransportStyle } from './utils';\n\nimport type { Transport } from './utils';\n\nimport './TravelTag.scss';\n\nexport type TravelTagProps = {\n /** Callback som kalles for når man skal lukke TravelTag-en\n * @default undefined\n */\n onClose?: () => void;\n /** Innholdet inne i TravelTag-en */\n children?: React.ReactNode;\n /**Ekstra klassenavn */\n className?: string;\n /** Legger til et Valideringsikon i TravelTagen for å signalisere avvik, informasjon e.l.\n * @default \"none\"\n */\n alert?: 'none' | 'error' | 'warning' | 'info';\n /** Legger til farge og ikon tilpasset valgt transportmiddel */\n transport?: Transport;\n /** Element ved siden av eller under TravelTag. */\n label?: React.ReactNode;\n /** Posisjonen til label-en i forhold til TravelTag-en\n * @default \"right\"\n */\n labelPlacement?: 'bottom' | 'right';\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const TravelTag: React.FC<TravelTagProps> = ({\n children,\n className,\n alert = 'none',\n transport = 'none',\n label,\n labelPlacement = 'right',\n onClose = undefined,\n ...rest\n}) => {\n const isContrast = useContrast();\n const isClosable = onClose ? true : false;\n const transportIsSet = transport !== 'none';\n const alertIsSet = alert !== 'none';\n const tagRef = useRef<HTMLDivElement>(null);\n const numberOfChildren = React.Children.count(children);\n const { Icon, contrastBackgroundColor, backgroundColor, ariaLabel } =\n getTransportStyle(transport);\n\n useEffect(() => {\n if (transportIsSet) {\n tagRef.current?.style.setProperty(\n '--background-color',\n isContrast ? contrastBackgroundColor : backgroundColor,\n );\n }\n }, [tagRef.current, backgroundColor]);\n\n const TravelTagWithoutLabel: JSX.Element = (\n <div\n className={classNames('eds-travel-tag', {\n 'eds-travel-tag--closable': isClosable,\n 'eds-travel-tag--alert': alertIsSet,\n 'eds-travel-tag--alert--error': alert === 'error',\n 'eds-travel-tag--transport': transportIsSet,\n 'eds-travel-tag--icon-and-text':\n numberOfChildren > 1 || (transportIsSet && numberOfChildren > 0),\n className,\n })}\n ref={tagRef}\n {...rest}\n aria-label={\n rest['aria-label'] ?? ariaLabel + (alertIsSet ? ` ${alert}` : '')\n }\n role=\"img\"\n >\n <Icon aria-hidden />\n {children}\n {isClosable && (\n <button\n onClick={onClose}\n type=\"button\"\n className=\"eds-travel-tag__close-button\"\n >\n <CloseSmallIcon inline />\n </button>\n )}\n {alertIsSet && (\n <span className=\"eds-travel-tag__alert\">\n {alert === 'info' && (\n <ValidationInfoIcon\n aria-hidden\n className=\"eds-travel-tag__alert-info-icon\"\n />\n )}\n {alert === 'error' && (\n <ValidationErrorIcon\n aria-hidden\n className=\"eds-travel-tag__alert-error-icon\"\n />\n )}\n {alert === 'warning' && (\n <ValidationExclamationIcon\n aria-hidden\n className=\"eds-travel-tag__alert-exclamation-icon\"\n />\n )}\n </span>\n )}\n </div>\n );\n\n const Label: JSX.Element = (\n <div\n className={classNames('eds-travel-tag__label', {\n [`eds-travel-tag__label--${labelPlacement}`]: label,\n [`eds-travel-tag__label--${labelPlacement}--with-alert`]:\n label && alertIsSet,\n })}\n >\n {label}\n </div>\n );\n\n if (label) {\n return (\n <div\n className={classNames('eds-travel-tag__wrapper', {\n [`eds-travel-tag__wrapper--label-position-${labelPlacement}`]: label,\n })}\n >\n {TravelTagWithoutLabel}\n {Label}\n </div>\n );\n }\n\n return TravelTagWithoutLabel;\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport './LegLine.scss';\n\nexport type LegLineProps = {\n /** Farge på LegLine'n */\n color: string;\n /** Retningen til LegLine */\n direction: 'horizontal' | 'vertical';\n /** Hvilket linjemønster som skal brukes */\n pattern: 'line' | 'dashed' | 'dotted' | 'wave';\n /** Ekstra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const LegLine: React.FC<LegLineProps> = ({\n color,\n direction = 'horizontal',\n pattern,\n className,\n ...rest\n}) => {\n return (\n <div\n className={classNames('eds-leg-line', className, {\n [`eds-leg-line--${pattern}`]: pattern,\n [`eds-leg-line--${direction}`]: direction,\n })}\n style={{ backgroundColor: color }}\n {...rest}\n />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LegLine } from './LegLine';\nimport './LegBone.scss';\n\nexport type LegBoneProps = {\n /** Retning på komponenten */\n direction: 'horizontal' | 'vertical';\n /** Hvilke linjemønster som skal brukes */\n pattern: 'line' | 'dashed' | 'dotted' | 'wave';\n /** Farge på linja */\n color: string;\n /** Farge på startpunktet\n * @default Verdien til color\n */\n startColor?: string;\n /** Farge på endepunktet\n * @default Verdien til color\n */\n endColor?: string;\n /** Vis startpunkt\n * @default true\n */\n showStart?: boolean;\n /** Vis linke\n * @default true\n */\n showLine?: boolean;\n /** Vis endepunkt\n * @default true\n */\n showStop?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const LegBone: React.FC<LegBoneProps> = ({\n direction,\n pattern,\n color,\n startColor,\n endColor,\n showStart = true,\n showStop = true,\n showLine = true,\n className,\n ...rest\n}) => {\n return (\n <div\n className={classNames(className, 'eds-leg-bone', [\n { 'eds-leg-bone--vertical': direction === 'vertical' },\n { 'eds-leg-bone--horizontal': direction === 'horizontal' },\n ])}\n {...rest}\n >\n {showStart && (\n <div\n className={`eds-leg-bone__start`}\n style={{ backgroundColor: startColor || color }}\n />\n )}\n\n {showLine && (\n <LegLine\n className={`eds-leg-bone__line`}\n direction={direction}\n color={color}\n pattern={pattern}\n />\n )}\n\n {showStop && (\n <div\n className={`eds-leg-bone__stop`}\n style={{ backgroundColor: endColor || color }}\n />\n )}\n </div>\n );\n};\n","import React from 'react';\nimport { useContrast } from '@entur/layout';\nimport { LegBone } from './LegBone';\nimport { getTransportStyle } from './utils';\n\nimport type { Transport } from './utils';\n\nexport type TravelLegProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Hviklen type reise som skal vises riktig farge og linjetype */\n transport: Transport;\n /** Retningen på komponenten */\n direction: 'horizontal' | 'vertical';\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const TravelLeg: React.FC<TravelLegProps> = ({\n className,\n transport,\n direction,\n ...rest\n}) => {\n const { backgroundColor, contrastBackgroundColor, pattern } =\n getTransportStyle(transport);\n const isContrast = useContrast();\n\n return (\n <LegBone\n direction={direction}\n pattern={pattern}\n color={isContrast ? contrastBackgroundColor : backgroundColor}\n className={className}\n {...rest}\n />\n );\n};\n","import React from 'react';\nimport { Switch } from '@entur/form';\nimport { getTransportStyle } from './utils';\n\nimport type { Transport } from './utils';\n\nexport type TravelSwitchProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om switch-en er checked eller ikke */\n checked?: boolean;\n /** Label for TravelSwitch-en. */\n children?: React.ReactNode;\n /** Posisjonen til label for TravelSwitch-en.\n * @default \"right\"\n */\n labelPlacement?: 'right' | 'bottom';\n /** Hvilken type reise som skal vises ikon og farge for */\n transport: Transport; // When adding a new submode, check https://enturas.atlassian.net/wiki/spaces/PUBLIC/pages/825393529/Norwegian+submodes+and+their+definitions for names\n /** Callback for når verdien endres */\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Størrelsen på Switch-en\n * @default \"medium\"\n */\n size?: 'medium' | 'large';\n} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>;\n\nexport const TravelSwitch: React.FC<TravelSwitchProps> = ({\n className,\n children,\n labelPlacement = 'right',\n transport,\n size,\n ...rest\n}) => {\n const { backgroundColor, contrastBackgroundColor, Icon } =\n getTransportStyle(transport);\n return (\n <Switch\n className={className}\n labelPlacement={labelPlacement}\n color={backgroundColor}\n contrastColor={contrastBackgroundColor}\n icon={<Icon />}\n size={size}\n {...rest}\n >\n {children}\n </Switch>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('travel');\n\nexport * from './TravelHeader';\nexport * from './TravelTag';\nexport * from './LegLine';\nexport * from './LegBone';\nexport * from './TravelLeg';\nexport * from './TravelSwitch';\n"],"names":["TravelHeader","as","Element","from","to","size","className","noWrap","rest","_excluded","React","createElement","classNames","getTransportStyle","mode","Icon","MetroIcon","backgroundColor","colors","transport","metro","contrastBackgroundColor","contrast","pattern","ariaLabel","BusIcon","bus","PlaneIcon","plane","HelicopterIcon","helicopter","TramIcon","tram","FunicularIcon","funicular","CablewayIcon","cableway","TaxiIcon","taxi","BicycleIcon","bicycle","WalkIcon","walk","TrainIcon","train","FerryIcon","ferry","CarferryIcon","carferry","MobilityIcon","mobility","Fragment","brand","blue","white","Error","TravelTag","children","alert","label","labelPlacement","onClose","undefined","isContrast","useContrast","isClosable","transportIsSet","alertIsSet","tagRef","useRef","numberOfChildren","Children","count","useEffect","current","style","setProperty","TravelTagWithoutLabel","ref","role","onClick","type","CloseSmallIcon","inline","ValidationInfoIcon","ValidationErrorIcon","ValidationExclamationIcon","Label","LegLine","color","direction","LegBone","startColor","endColor","showStart","showStop","showLine","TravelLeg","TravelSwitch","Switch","contrastColor","icon","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBaA,IAAAA,YAAY,GAAgC,SAA5CA,YAAY,CAQpB,IAAA,EAAA;AAAA,EAAA,IAAA,OAAA,GAAA,IAAA,CAPHC,EAAE;AAAEC,IAAAA,OAAO,wBAAG,KAAK,GAAA,OAAA;AACnBC,IAAAA,IAAI,QAAJA,IAAI;AACJC,IAAAA,EAAE,QAAFA,EAAE;AAAA,IAAA,SAAA,GAAA,IAAA,CACFC,IAAI;AAAJA,IAAAA,IAAI,0BAAG,OAAO,GAAA,SAAA;AACdC,IAAAA,SAAS,QAATA,SAAS;AACTC,IAAAA,MAAM,QAANA,MAAM;IACHC,IAAI,GAAA,6BAAA,CAAA,IAAA,EAAAC,WAAA,CAAA,CAAA;AAEP,EAAA,OACEC,KAAC,CAAAC,aAAA,CAAAT,OAAO,EAAA,QAAA,CAAA;AACNI,IAAAA,SAAS,EAAEM,UAAU,CAAC,mBAAmB,EAAEN,SAAS,EAAE;MACpD,0BAA0B,EAAED,IAAI,KAAK,OAAO;MAC5C,2BAA2B,EAAEA,IAAI,KAAK,QAAQ;AAC9C,MAAA,4BAA4B,EAAEE,MAAAA;AAC/B,KAAA,CAAC;2BACiBJ,IAAI,GAASC,QAAAA,GAAAA,EAAAA;AAAI,GAAA,EAChCI,IAAI,CAERE,EA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6C,4BAAsB,CAAC,QAAQ,CAAC;;;;;;;;;"}
1
+ {"version":3,"file":"travel.cjs.development.js","sources":["../src/TravelHeader.tsx","../src/utils.ts","../src/TravelTag.tsx","../src/LegLine.tsx","../src/LegBone.tsx","../src/TravelLeg.tsx","../src/TravelSwitch.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport './TravelHeader.scss';\n\nexport type TravelHeaderProps = {\n /** HTML-elementet eller React-komponenten som lager elementet\n * @default 'div'\n */\n as?: string | React.ElementType;\n /** Destinasjonen man reiser fra */\n from: React.ReactNode;\n /** Destinasjonen man reiser til */\n to: React.ReactNode;\n /**Størrelsen på komponenten\n * @default 'large'\n */\n size?: 'large' | 'medium';\n /** Plassere til og fra på samme linje */\n noWrap?: boolean;\n /**Ekstra klassenavn */\n className?: string;\n [key: string]: any;\n};\n\nexport const TravelHeader: React.FC<TravelHeaderProps> = ({\n as: Element = 'div',\n from,\n to,\n size = 'large',\n className,\n noWrap,\n ...rest\n}) => {\n return (\n <Element\n className={classNames('eds-travel-header', className, {\n 'eds-travel-header--large': size === 'large',\n 'eds-travel-header--medium': size === 'medium',\n 'eds-travel-header--no-wrap': noWrap,\n })}\n aria-label={`Fra ${from}, til ${to}`}\n {...rest}\n >\n <span className=\"eds-travel-header__from\">{from}</span>\n <span className=\"eds-travel-header__to\">{to}</span>\n </Element>\n );\n};\n","import React from 'react';\n\nimport {\n BusIcon,\n FerryIcon,\n CarferryIcon,\n TramIcon,\n PlaneIcon,\n TrainIcon,\n BicycleIcon,\n MobilityIcon,\n MetroIcon,\n HelicopterIcon,\n FunicularIcon,\n CablewayIcon,\n TaxiIcon,\n WalkIcon,\n} from '@entur/icons';\n\nimport type { IconProps } from '@entur/icons';\n\nexport type Transport =\n | 'metro'\n | 'bus'\n | 'plane'\n | 'helicopter'\n | 'tram'\n | 'funicular'\n | 'cableway'\n | 'taxi'\n | 'bicycle'\n | 'walk'\n | 'train'\n | 'ferry'\n | 'carferry'\n | 'mobility'\n | 'airportLinkBus'\n | 'airportLinkRail'\n | 'rail'\n | 'water'\n | 'air'\n | 'none';\n\ntype transportStyleResult = {\n Icon: React.FC<IconProps>;\n backgroundColor?: string;\n contrastBackgroundColor?: string;\n errorBackgroundColor?: string;\n errorTextColor?: string;\n errorContrastTextColor?: string;\n errorContrastBackgroundColor?: string;\n pattern: 'line' | 'wave' | 'dashed' | 'dotted';\n ariaLabel: string;\n};\n\nexport const getTransportStyle = (mode: string): transportStyleResult => {\n switch (mode) {\n case 'metro':\n return {\n Icon: MetroIcon,\n pattern: 'line',\n ariaLabel: 'T-bane',\n };\n case 'bus':\n return {\n Icon: BusIcon,\n pattern: 'dashed',\n ariaLabel: 'Buss',\n };\n case 'plane':\n case 'air':\n return {\n Icon: PlaneIcon,\n pattern: 'line',\n ariaLabel: 'Fly',\n };\n case 'helicopter':\n return {\n Icon: HelicopterIcon,\n pattern: 'line',\n ariaLabel: 'Helikopter',\n };\n case 'tram':\n return {\n Icon: TramIcon,\n pattern: 'line',\n ariaLabel: 'Trikk',\n };\n case 'funicular':\n return {\n Icon: FunicularIcon,\n pattern: 'line',\n ariaLabel: 'Taubane',\n };\n case 'cableway':\n return {\n Icon: CablewayIcon,\n pattern: 'line',\n ariaLabel: 'Gondol',\n };\n case 'taxi':\n return {\n Icon: TaxiIcon,\n pattern: 'dashed',\n ariaLabel: 'Taxi',\n };\n case 'bicycle':\n return {\n Icon: BicycleIcon,\n pattern: 'dashed',\n ariaLabel: 'Sykkel',\n };\n case 'walk':\n return {\n Icon: WalkIcon,\n pattern: 'dotted',\n ariaLabel: 'Gange',\n };\n case 'train':\n case 'rail':\n return {\n Icon: TrainIcon,\n pattern: 'line',\n ariaLabel: 'Tog',\n };\n case 'ferry':\n case 'water':\n return {\n Icon: FerryIcon,\n pattern: 'wave',\n ariaLabel: 'Ferge',\n };\n case 'carferry':\n return {\n Icon: CarferryIcon,\n pattern: 'wave',\n ariaLabel: 'Bilferge',\n };\n case 'mobility':\n return {\n Icon: MobilityIcon,\n pattern: 'line',\n ariaLabel: 'El-sparkesykkel',\n };\n case 'airportLinkBus':\n return {\n Icon: BusIcon,\n pattern: 'dashed',\n ariaLabel: 'Flybuss',\n };\n case 'airportLinkRail':\n return {\n Icon: TrainIcon,\n pattern: 'line',\n ariaLabel: 'Flytog',\n };\n case 'none':\n return {\n Icon: React.Fragment,\n pattern: 'line',\n ariaLabel: '',\n };\n case 'scooter':\n throw Error(\n `transport type 'scooter' is deprecated: Please use 'mobility' instead.`,\n );\n case 'bike':\n throw Error(\n `transport type 'bike' is deprecated: Please use 'bicycle' instead.`,\n );\n case 'car':\n throw Error(\n `transport type 'car' is deprecated: Please use 'taxi' instead.`,\n );\n case 'foot':\n throw Error(\n `transport type 'foot' is deprecated: Please use 'walk' instead.`,\n );\n default:\n throw Error('Please select a transport for the Travel component.');\n }\n};\n","import React, { cloneElement, useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport {\n CloseSmallIcon,\n ValidationInfoIcon,\n ValidationErrorIcon,\n ValidationExclamationIcon,\n} from '@entur/icons';\nimport { useContrast } from '@entur/layout';\n\nimport { getTransportStyle } from './utils';\n\nimport type { Transport } from './utils';\n\nimport './TravelTag.scss';\n\nexport type TravelTagProps = {\n /** Callback som kalles for når man skal lukke TravelTag-en\n * @default undefined\n */\n onClose?: () => void;\n /** Innholdet inne i TravelTag-en */\n children?: React.ReactNode;\n /**Ekstra klassenavn */\n className?: string;\n /** Legger til et Valideringsikon i TravelTagen for å signalisere avvik, informasjon e.l.\n * @default \"none\"\n */\n alert?: 'none' | 'error' | 'warning' | 'info';\n /** Legger til farge og ikon tilpasset valgt transportmiddel */\n transport?: Transport;\n /** Element ved siden av eller under TravelTag. */\n label?: React.ReactNode;\n /** Posisjonen til label-en i forhold til TravelTag-en\n * @default \"right\"\n */\n labelPlacement?: 'bottom' | 'right';\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const TravelTag: React.FC<TravelTagProps> = ({\n children,\n className,\n alert = 'none',\n transport = 'none',\n label,\n labelPlacement = 'right',\n onClose = undefined,\n ...rest\n}) => {\n const isContrast = useContrast();\n const isClosable = onClose ? true : false;\n const transportIsSet = transport !== 'none';\n const alertIsSet = alert !== 'none';\n const tagRef = useRef<HTMLDivElement>(null);\n const numberOfChildren = React.Children.count(children);\n const { Icon, ariaLabel: ariaLabelForTranportIcon } =\n getTransportStyle(transport);\n const deCapitalizeTransport = transport.toLowerCase();\n const IconWithAriaHidden = cloneElement(<Icon />, { 'aria-hidden': 'true' });\n\n const backgroundColor =\n 'var(--components-travel-traveltag-standard-tagfill-' +\n deCapitalizeTransport +\n ')';\n const contrastBackgroundColor =\n 'var(--components-travel-traveltag-contrast-tagfill-' +\n deCapitalizeTransport +\n ')';\n // Error colors\n const errorBackgroundColor =\n 'var(--components-travel-traveltag-standard-tagfill-' +\n deCapitalizeTransport +\n '-cancled)';\n const errorContrastBackgroundColor =\n 'var(--components-travel-traveltag-contrast-tagfill-' +\n deCapitalizeTransport +\n '-cancled)';\n const errorContrastTextColor =\n 'var(--components-travel-traveltag-contrast-text-line-' +\n deCapitalizeTransport +\n '-cancled)';\n const errorTextColor =\n 'var(--components-travel-traveltag-standard-text-line-' +\n deCapitalizeTransport +\n '-cancled)';\n\n useEffect(() => {\n if (transportIsSet) {\n let colorToSet;\n let textColorToSet;\n // Walk has another icon/text color then the other transports\n if (transport === 'walk') {\n tagRef.current?.style.setProperty(\n '--text-color',\n 'var(--components-travel-traveltag-standard-icon-walk)',\n );\n }\n // Error\n if (alert === 'error') {\n colorToSet = isContrast\n ? errorContrastBackgroundColor\n : errorBackgroundColor;\n textColorToSet = isContrast ? errorContrastTextColor : errorTextColor;\n tagRef.current?.style.setProperty('--text-color', `${textColorToSet}`);\n } else {\n colorToSet = isContrast ? contrastBackgroundColor : backgroundColor;\n }\n tagRef.current?.style.setProperty('--background-color', `${colorToSet}`);\n }\n }, [\n transportIsSet,\n isContrast,\n backgroundColor,\n contrastBackgroundColor,\n errorBackgroundColor,\n alert,\n ]);\n\n const TravelTagWithoutLabel: JSX.Element = (\n <div\n className={classNames('eds-travel-tag', {\n 'eds-travel-tag--closable': isClosable,\n 'eds-travel-tag--alert': alertIsSet,\n 'eds-travel-tag--alert--error': alert === 'error',\n 'eds-travel-tag--transport': transportIsSet,\n 'eds-travel-tag--icon-and-text':\n numberOfChildren > 1 || (transportIsSet && numberOfChildren > 0),\n className,\n })}\n ref={tagRef}\n aria-label={`${ariaLabelForTranportIcon} ${children} ${\n alertIsSet ? alert : ''\n }`}\n role=\"img\"\n {...rest}\n >\n {IconWithAriaHidden}\n {children}\n {isClosable && (\n <button\n onClick={onClose}\n type=\"button\"\n className=\"eds-travel-tag__close-button\"\n >\n <CloseSmallIcon inline />\n </button>\n )}\n {alertIsSet && (\n <span className=\"eds-travel-tag__alert\">\n {alert === 'info' && (\n <ValidationInfoIcon\n aria-hidden\n className=\"eds-travel-tag__alert-info-icon\"\n />\n )}\n {alert === 'error' && (\n <ValidationErrorIcon\n aria-hidden\n className=\"eds-travel-tag__alert-error-icon\"\n />\n )}\n {alert === 'warning' && (\n <ValidationExclamationIcon\n aria-hidden\n className=\"eds-travel-tag__alert-exclamation-icon\"\n />\n )}\n </span>\n )}\n </div>\n );\n\n const Label: JSX.Element = (\n <div\n className={classNames('eds-travel-tag__label', {\n [`eds-travel-tag__label--${labelPlacement}`]: label,\n [`eds-travel-tag__label--${labelPlacement}--with-alert`]:\n label && alertIsSet,\n })}\n >\n {label}\n </div>\n );\n\n if (label) {\n return (\n <div\n className={classNames('eds-travel-tag__wrapper', {\n [`eds-travel-tag__wrapper--label-position-${labelPlacement}`]: label,\n })}\n >\n {TravelTagWithoutLabel}\n {Label}\n </div>\n );\n }\n\n return TravelTagWithoutLabel;\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport './LegLine.scss';\n\nexport type LegLineProps = {\n /** Farge på LegLine'n */\n color: string;\n /** Retningen til LegLine */\n direction: 'horizontal' | 'vertical';\n /** Hvilket linjemønster som skal brukes */\n pattern: 'line' | 'dashed' | 'dotted' | 'wave';\n /** Ekstra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const LegLine: React.FC<LegLineProps> = ({\n color,\n direction = 'horizontal',\n pattern,\n className,\n ...rest\n}) => {\n return (\n <div\n className={classNames('eds-leg-line', className, {\n [`eds-leg-line--${pattern}`]: pattern,\n [`eds-leg-line--${direction}`]: direction,\n })}\n style={{ backgroundColor: color }}\n {...rest}\n />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LegLine } from './LegLine';\nimport './LegBone.scss';\n\nexport type LegBoneProps = {\n /** Retning på komponenten */\n direction: 'horizontal' | 'vertical';\n /** Hvilke linjemønster som skal brukes */\n pattern: 'line' | 'dashed' | 'dotted' | 'wave';\n /** Farge på linja */\n color: string;\n /** Farge på startpunktet\n * @default Verdien til color\n */\n startColor?: string;\n /** Farge på endepunktet\n * @default Verdien til color\n */\n endColor?: string;\n /** Vis startpunkt\n * @default true\n */\n showStart?: boolean;\n /** Vis linke\n * @default true\n */\n showLine?: boolean;\n /** Vis endepunkt\n * @default true\n */\n showStop?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const LegBone: React.FC<LegBoneProps> = ({\n direction,\n pattern,\n color,\n startColor,\n endColor,\n showStart = true,\n showStop = true,\n showLine = true,\n className,\n ...rest\n}) => {\n return (\n <div\n className={classNames(className, 'eds-leg-bone', [\n { 'eds-leg-bone--vertical': direction === 'vertical' },\n { 'eds-leg-bone--horizontal': direction === 'horizontal' },\n ])}\n {...rest}\n >\n {showStart && (\n <div\n className={`eds-leg-bone__start`}\n style={{ backgroundColor: startColor || color }}\n />\n )}\n\n {showLine && (\n <LegLine\n className={`eds-leg-bone__line`}\n direction={direction}\n color={color}\n pattern={pattern}\n />\n )}\n\n {showStop && (\n <div\n className={`eds-leg-bone__stop`}\n style={{ backgroundColor: endColor || color }}\n />\n )}\n </div>\n );\n};\n","import React from 'react';\nimport { useContrast } from '@entur/layout';\nimport { LegBone } from './LegBone';\nimport { getTransportStyle } from './utils';\n\nimport type { Transport } from './utils';\n\nexport type TravelLegProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Hviklen type reise som skal vises riktig farge og linjetype */\n transport: Transport;\n /** Retningen på komponenten */\n direction: 'horizontal' | 'vertical';\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const TravelLeg: React.FC<TravelLegProps> = ({\n className,\n transport,\n direction,\n ...rest\n}) => {\n const { pattern } = getTransportStyle(transport);\n const isContrast = useContrast();\n const deCapitalizeTransport = transport.toLowerCase();\n\n console.log('deCapitalizeTransport', deCapitalizeTransport);\n const backgroundColor =\n 'var(--components-travel-travelleg-standard-' + deCapitalizeTransport + ')';\n const contrastBackgroundColor =\n 'var(--components-travel-travelleg-contrast-' + deCapitalizeTransport + ')';\n\n return (\n <LegBone\n direction={direction}\n pattern={pattern}\n color={isContrast ? contrastBackgroundColor : backgroundColor}\n className={className}\n {...rest}\n />\n );\n};\n","import React from 'react';\nimport { Switch } from '@entur/form';\nimport { getTransportStyle } from './utils';\n\nimport type { Transport } from './utils';\n\nexport type TravelSwitchProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om switch-en er checked eller ikke */\n checked?: boolean;\n /** Label for TravelSwitch-en. */\n children?: React.ReactNode;\n /** Posisjonen til label for TravelSwitch-en.\n * @default \"right\"\n */\n labelPlacement?: 'right' | 'bottom';\n /** Hvilken type reise som skal vises ikon og farge for */\n transport: Transport; // When adding a new submode, check https://enturas.atlassian.net/wiki/spaces/PUBLIC/pages/825393529/Norwegian+submodes+and+their+definitions for names\n /** Callback for når verdien endres */\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Størrelsen på Switch-en\n * @default \"medium\"\n */\n size?: 'medium' | 'large';\n} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>;\n\nexport const TravelSwitch: React.FC<TravelSwitchProps> = ({\n className,\n children,\n labelPlacement = 'right',\n transport,\n size,\n ...rest\n}) => {\n const { Icon } = getTransportStyle(transport);\n const deCapitalizeTransport = transport.toLowerCase();\n\n const backgroundColor =\n 'var(--components-travel-travelswitch-standard-backgroundtrue-' +\n deCapitalizeTransport +\n ')';\n const contrastBackgroundColor =\n 'var(--components-travel-travelswitch-contrast-backgroundtrue-' +\n deCapitalizeTransport +\n ')';\n\n return (\n <Switch\n className={className}\n labelPlacement={labelPlacement}\n color={backgroundColor}\n contrastColor={contrastBackgroundColor}\n icon={<Icon />}\n size={size}\n {...rest}\n >\n {children}\n </Switch>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('travel');\n\nexport * from './TravelHeader';\nexport * from './TravelTag';\nexport * from './LegLine';\nexport * from './LegBone';\nexport * from './TravelLeg';\nexport * from './TravelSwitch';\n"],"names":["TravelHeader","as","Element","from","to","size","className","noWrap","rest","_excluded","React","createElement","classNames","getTransportStyle","mode","Icon","MetroIcon","pattern","ariaLabel","BusIcon","PlaneIcon","HelicopterIcon","TramIcon","FunicularIcon","CablewayIcon","TaxiIcon","BicycleIcon","WalkIcon","TrainIcon","FerryIcon","CarferryIcon","MobilityIcon","Fragment","Error","TravelTag","children","alert","transport","label","labelPlacement","onClose","undefined","isContrast","useContrast","isClosable","transportIsSet","alertIsSet","tagRef","useRef","numberOfChildren","Children","count","ariaLabelForTranportIcon","deCapitalizeTransport","toLowerCase","IconWithAriaHidden","cloneElement","backgroundColor","contrastBackgroundColor","errorBackgroundColor","errorContrastBackgroundColor","errorContrastTextColor","errorTextColor","useEffect","colorToSet","textColorToSet","current","style","setProperty","TravelTagWithoutLabel","ref","role","onClick","type","CloseSmallIcon","inline","ValidationInfoIcon","ValidationErrorIcon","ValidationExclamationIcon","Label","LegLine","color","direction","LegBone","startColor","endColor","showStart","showStop","showLine","TravelLeg","console","log","TravelSwitch","Switch","contrastColor","icon","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBaA,IAAAA,YAAY,GAAgC,SAA5CA,YAAY,CAQpB,IAAA,EAAA;AAAA,EAAA,IAAA,OAAA,GAAA,IAAA,CAPHC,EAAE;AAAEC,IAAAA,OAAO,wBAAG,KAAK,GAAA,OAAA;AACnBC,IAAAA,IAAI,QAAJA,IAAI;AACJC,IAAAA,EAAE,QAAFA,EAAE;AAAA,IAAA,SAAA,GAAA,IAAA,CACFC,IAAI;AAAJA,IAAAA,IAAI,0BAAG,OAAO,GAAA,SAAA;AACdC,IAAAA,SAAS,QAATA,SAAS;AACTC,IAAAA,MAAM,QAANA,MAAM;IACHC,IAAI,GAAA,6BAAA,CAAA,IAAA,EAAAC,WAAA,CAAA,CAAA;AAEP,EAAA,OACEC,KAAC,CAAAC,aAAA,CAAAT,OAAO,EAAA,QAAA,CAAA;AACNI,IAAAA,SAAS,EAAEM,UAAU,CAAC,mBAAmB,EAAEN,SAAS,EAAE;MACpD,0BAA0B,EAAED,IAAI,KAAK,OAAO;MAC5C,2BAA2B,EAAEA,IAAI,KAAK,QAAQ;AAC9C,MAAA,4BAA4B,EAAEE,MAAAA;AAC/B,KAAA,CAAC;2BACiBJ,IAAI,GAASC,QAAAA,GAAAA,EAAAA;AAAI,GAAA,EAChCI,IAAI,CAERE,EAAAA,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAML,IAAAA,SAAS,EAAC,yBAAA;GAAyB,EAAEH,IAAI,CAAQ,EACvDO,KAAM,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAAL,IAAAA,SAAS,EAAC,uBAAA;GAAuB,EAAEF,EAAE,CAAQ,CAC3C,CAAA;AAEd;;ACQO,IAAMS,iBAAiB,GAAG,SAApBA,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,CAAC;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@entur/utils"),e=require("react"),a=require("classnames"),t=require("@entur/icons"),o=require("@entur/layout"),n=require("@entur/tokens"),l=require("@entur/form");function s(){return s=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(r[t]=a[t])}return r},s.apply(this,arguments)}function c(r,e){if(null==r)return{};var a,t,o={},n=Object.keys(r);for(t=0;t<n.length;t++)e.indexOf(a=n[t])>=0||(o[a]=r[a]);return o}var i=["as","from","to","size","className","noWrap"],d=function(r){switch(r){case"metro":return{Icon:t.MetroIcon,backgroundColor:n.colors.transport.default.metro,contrastBackgroundColor:n.colors.transport.contrast.metro,pattern:"line",ariaLabel:"T-bane"};case"bus":return{Icon:t.BusIcon,backgroundColor:n.colors.transport.default.bus,contrastBackgroundColor:n.colors.transport.contrast.bus,pattern:"dashed",ariaLabel:"Buss"};case"plane":case"air":return{Icon:t.PlaneIcon,backgroundColor:n.colors.transport.default.plane,contrastBackgroundColor:n.colors.transport.contrast.plane,pattern:"line",ariaLabel:"Fly"};case"helicopter":return{Icon:t.HelicopterIcon,backgroundColor:n.colors.transport.default.helicopter,contrastBackgroundColor:n.colors.transport.contrast.helicopter,pattern:"line",ariaLabel:"Helikopter"};case"tram":return{Icon:t.TramIcon,backgroundColor:n.colors.transport.default.tram,contrastBackgroundColor:n.colors.transport.contrast.tram,pattern:"line",ariaLabel:"Trikk"};case"funicular":return{Icon:t.FunicularIcon,backgroundColor:n.colors.transport.default.funicular,contrastBackgroundColor:n.colors.transport.contrast.funicular,pattern:"line",ariaLabel:"Taubane"};case"cableway":return{Icon:t.CablewayIcon,backgroundColor:n.colors.transport.default.cableway,contrastBackgroundColor:n.colors.transport.contrast.cableway,pattern:"line",ariaLabel:"Gondol"};case"taxi":return{Icon:t.TaxiIcon,backgroundColor:n.colors.transport.default.taxi,contrastBackgroundColor:n.colors.transport.contrast.taxi,pattern:"dashed",ariaLabel:"Taxi"};case"bicycle":return{Icon:t.BicycleIcon,backgroundColor:n.colors.transport.default.bicycle,contrastBackgroundColor:n.colors.transport.contrast.bicycle,pattern:"line",ariaLabel:"Sykkel"};case"walk":return{Icon:t.WalkIcon,backgroundColor:n.colors.transport.default.walk,contrastBackgroundColor:n.colors.transport.contrast.walk,pattern:"dotted",ariaLabel:"Gange"};case"train":case"rail":return{Icon:t.TrainIcon,backgroundColor:n.colors.transport.default.train,contrastBackgroundColor:n.colors.transport.contrast.train,pattern:"line",ariaLabel:"Tog"};case"ferry":case"water":return{Icon:t.FerryIcon,backgroundColor:n.colors.transport.default.ferry,contrastBackgroundColor:n.colors.transport.contrast.ferry,pattern:"wave",ariaLabel:"Ferge"};case"carferry":return{Icon:t.CarferryIcon,backgroundColor:n.colors.transport.default.carferry,contrastBackgroundColor:n.colors.transport.contrast.carferry,pattern:"wave",ariaLabel:"Bilferge"};case"mobility":return{Icon:t.MobilityIcon,backgroundColor:n.colors.transport.default.mobility,contrastBackgroundColor:n.colors.transport.contrast.mobility,pattern:"line",ariaLabel:"El-sparkesykkel"};case"airportLinkBus":return{Icon:t.BusIcon,backgroundColor:n.colors.transport.default.plane,contrastBackgroundColor:n.colors.transport.contrast.plane,pattern:"dashed",ariaLabel:"Flybuss"};case"airportLinkRail":return{Icon:t.TrainIcon,backgroundColor:n.colors.transport.default.plane,contrastBackgroundColor:n.colors.transport.contrast.plane,pattern:"line",ariaLabel:"Flytog"};case"none":return{Icon:e.Fragment,backgroundColor:n.colors.brand.blue,contrastBackgroundColor:n.colors.brand.white,pattern:"line",ariaLabel:""};case"scooter":throw Error("transport type 'scooter' is deprecated: Please use 'mobility' instead.");case"bike":throw Error("transport type 'bike' is deprecated: Please use 'bicycle' instead.");case"car":throw Error("transport type 'car' is deprecated: Please use 'taxi' instead.");case"foot":throw Error("transport type 'foot' is deprecated: Please use 'walk' instead.");default:throw Error("Please select a transport for the Travel component.")}},u=["children","className","alert","transport","label","labelPlacement","onClose"],p=["color","direction","pattern","className"],b=function(r){var t,o=r.color,n=r.direction,l=void 0===n?"horizontal":n,i=r.pattern,d=r.className,u=c(r,p);return e.createElement("div",s({className:a("eds-leg-line",d,(t={},t["eds-leg-line--"+i]=i,t["eds-leg-line--"+l]=l,t)),style:{backgroundColor:o}},u))},g=["direction","pattern","color","startColor","endColor","showStart","showStop","showLine","className"],m=function(r){var t=r.direction,o=r.pattern,n=r.color,l=r.startColor,i=r.endColor,d=r.showStart,u=void 0===d||d,p=r.showStop,m=void 0===p||p,v=r.showLine,k=void 0===v||v,f=r.className,C=c(r,g);return e.createElement("div",s({className:a(f,"eds-leg-bone",[{"eds-leg-bone--vertical":"vertical"===t},{"eds-leg-bone--horizontal":"horizontal"===t}])},C),u&&e.createElement("div",{className:"eds-leg-bone__start",style:{backgroundColor:l||n}}),k&&e.createElement(b,{className:"eds-leg-bone__line",direction:t,color:n,pattern:o}),m&&e.createElement("div",{className:"eds-leg-bone__stop",style:{backgroundColor:i||n}}))},v=["className","transport","direction"],k=["className","children","labelPlacement","transport","size"];r.warnAboutMissingStyles("travel"),exports.LegBone=m,exports.LegLine=b,exports.TravelHeader=function(r){var t=r.as,o=void 0===t?"div":t,n=r.from,l=r.to,d=r.size,u=void 0===d?"large":d,p=r.className,b=r.noWrap,g=c(r,i);return e.createElement(o,s({className:a("eds-travel-header",p,{"eds-travel-header--large":"large"===u,"eds-travel-header--medium":"medium"===u,"eds-travel-header--no-wrap":b}),"aria-label":"Fra "+n+", til "+l},g),e.createElement("span",{className:"eds-travel-header__from"},n),e.createElement("span",{className:"eds-travel-header__to"},l))},exports.TravelLeg=function(r){var a=r.className,t=r.transport,n=r.direction,l=c(r,v),i=d(t),u=i.backgroundColor,p=i.contrastBackgroundColor,b=i.pattern,g=o.useContrast();return e.createElement(m,s({direction:n,pattern:b,color:g?p:u,className:a},l))},exports.TravelSwitch=function(r){var a=r.className,t=r.children,o=r.labelPlacement,n=void 0===o?"right":o,i=r.transport,u=r.size,p=c(r,k),b=d(i);return e.createElement(l.Switch,s({className:a,labelPlacement:n,color:b.backgroundColor,contrastColor:b.contrastBackgroundColor,icon:e.createElement(b.Icon,null),size:u},p),t)},exports.TravelTag=function(r){var n,l,i=r.children,p=r.className,b=r.alert,g=void 0===b?"none":b,m=r.transport,v=void 0===m?"none":m,k=r.label,f=r.labelPlacement,C=void 0===f?"right":f,h=r.onClose,y=void 0===h?void 0:h,I=c(r,u),w=o.useContrast(),_=!!y,N="none"!==v,E="none"!==g,B=e.useRef(null),L=e.Children.count(i),x=d(v),T=x.Icon,P=x.contrastBackgroundColor,S=x.backgroundColor,z=x.ariaLabel;e.useEffect((function(){var r;N&&(null==(r=B.current)||r.style.setProperty("--background-color",w?P:S))}),[B.current,S]);var F,q=e.createElement("div",s({className:a("eds-travel-tag",{"eds-travel-tag--closable":_,"eds-travel-tag--alert":E,"eds-travel-tag--alert--error":"error"===g,"eds-travel-tag--transport":N,"eds-travel-tag--icon-and-text":L>1||N&&L>0,className:p}),ref:B},I,{"aria-label":null!=(n=I["aria-label"])?n:z+(E?" "+g:""),role:"img"}),e.createElement(T,{"aria-hidden":!0}),i,_&&e.createElement("button",{onClick:y,type:"button",className:"eds-travel-tag__close-button"},e.createElement(t.CloseSmallIcon,{inline:!0})),E&&e.createElement("span",{className:"eds-travel-tag__alert"},"info"===g&&e.createElement(t.ValidationInfoIcon,{"aria-hidden":!0,className:"eds-travel-tag__alert-info-icon"}),"error"===g&&e.createElement(t.ValidationErrorIcon,{"aria-hidden":!0,className:"eds-travel-tag__alert-error-icon"}),"warning"===g&&e.createElement(t.ValidationExclamationIcon,{"aria-hidden":!0,className:"eds-travel-tag__alert-exclamation-icon"}))),O=e.createElement("div",{className:a("eds-travel-tag__label",(l={},l["eds-travel-tag__label--"+C]=k,l["eds-travel-tag__label--"+C+"--with-alert"]=k&&E,l))},k);return k?e.createElement("div",{className:a("eds-travel-tag__wrapper",(F={},F["eds-travel-tag__wrapper--label-position-"+C]=k,F))},q,O):q};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),a=require("react"),r=require("classnames"),t=require("@entur/icons"),n=require("@entur/layout"),l=require("@entur/form");function o(){return o=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},o.apply(this,arguments)}function s(e,a){if(null==e)return{};var r,t,n={},l=Object.keys(e);for(t=0;t<l.length;t++)a.indexOf(r=l[t])>=0||(n[r]=e[r]);return n}var c=["as","from","to","size","className","noWrap"],i=function(e){switch(e){case"metro":return{Icon:t.MetroIcon,pattern:"line",ariaLabel:"T-bane"};case"bus":return{Icon:t.BusIcon,pattern:"dashed",ariaLabel:"Buss"};case"plane":case"air":return{Icon:t.PlaneIcon,pattern:"line",ariaLabel:"Fly"};case"helicopter":return{Icon:t.HelicopterIcon,pattern:"line",ariaLabel:"Helikopter"};case"tram":return{Icon:t.TramIcon,pattern:"line",ariaLabel:"Trikk"};case"funicular":return{Icon:t.FunicularIcon,pattern:"line",ariaLabel:"Taubane"};case"cableway":return{Icon:t.CablewayIcon,pattern:"line",ariaLabel:"Gondol"};case"taxi":return{Icon:t.TaxiIcon,pattern:"dashed",ariaLabel:"Taxi"};case"bicycle":return{Icon:t.BicycleIcon,pattern:"dashed",ariaLabel:"Sykkel"};case"walk":return{Icon:t.WalkIcon,pattern:"dotted",ariaLabel:"Gange"};case"train":case"rail":return{Icon:t.TrainIcon,pattern:"line",ariaLabel:"Tog"};case"ferry":case"water":return{Icon:t.FerryIcon,pattern:"wave",ariaLabel:"Ferge"};case"carferry":return{Icon:t.CarferryIcon,pattern:"wave",ariaLabel:"Bilferge"};case"mobility":return{Icon:t.MobilityIcon,pattern:"line",ariaLabel:"El-sparkesykkel"};case"airportLinkBus":return{Icon:t.BusIcon,pattern:"dashed",ariaLabel:"Flybuss"};case"airportLinkRail":return{Icon:t.TrainIcon,pattern:"line",ariaLabel:"Flytog"};case"none":return{Icon:a.Fragment,pattern:"line",ariaLabel:""};case"scooter":throw Error("transport type 'scooter' is deprecated: Please use 'mobility' instead.");case"bike":throw Error("transport type 'bike' is deprecated: Please use 'bicycle' instead.");case"car":throw Error("transport type 'car' is deprecated: Please use 'taxi' instead.");case"foot":throw Error("transport type 'foot' is deprecated: Please use 'walk' instead.");default:throw Error("Please select a transport for the Travel component.")}},d=["children","className","alert","transport","label","labelPlacement","onClose"],v=["color","direction","pattern","className"],u=function(e){var t,n=e.color,l=e.direction,c=void 0===l?"horizontal":l,i=e.pattern,d=e.className,u=s(e,v);return a.createElement("div",o({className:r("eds-leg-line",d,(t={},t["eds-leg-line--"+i]=i,t["eds-leg-line--"+c]=c,t)),style:{backgroundColor:n}},u))},p=["direction","pattern","color","startColor","endColor","showStart","showStop","showLine","className"],m=function(e){var t=e.direction,n=e.pattern,l=e.color,c=e.startColor,i=e.endColor,d=e.showStart,v=void 0===d||d,m=e.showStop,b=void 0===m||m,g=e.showLine,h=void 0===g||g,f=e.className,I=s(e,p);return a.createElement("div",o({className:r(f,"eds-leg-bone",[{"eds-leg-bone--vertical":"vertical"===t},{"eds-leg-bone--horizontal":"horizontal"===t}])},I),v&&a.createElement("div",{className:"eds-leg-bone__start",style:{backgroundColor:c||l}}),h&&a.createElement(u,{className:"eds-leg-bone__line",direction:t,color:l,pattern:n}),b&&a.createElement("div",{className:"eds-leg-bone__stop",style:{backgroundColor:i||l}}))},b=["className","transport","direction"],g=["className","children","labelPlacement","transport","size"];e.warnAboutMissingStyles("travel"),exports.LegBone=m,exports.LegLine=u,exports.TravelHeader=function(e){var t=e.as,n=void 0===t?"div":t,l=e.from,i=e.to,d=e.size,v=void 0===d?"large":d,u=e.className,p=e.noWrap,m=s(e,c);return a.createElement(n,o({className:r("eds-travel-header",u,{"eds-travel-header--large":"large"===v,"eds-travel-header--medium":"medium"===v,"eds-travel-header--no-wrap":p}),"aria-label":"Fra "+l+", til "+i},m),a.createElement("span",{className:"eds-travel-header__from"},l),a.createElement("span",{className:"eds-travel-header__to"},i))},exports.TravelLeg=function(e){var r=e.className,t=e.transport,l=e.direction,c=s(e,b),d=i(t).pattern,v=n.useContrast(),u=t.toLowerCase();return console.log("deCapitalizeTransport",u),a.createElement(m,o({direction:l,pattern:d,color:v?"var(--components-travel-travelleg-contrast-"+u+")":"var(--components-travel-travelleg-standard-"+u+")",className:r},c))},exports.TravelSwitch=function(e){var r=e.className,t=e.children,n=e.labelPlacement,c=void 0===n?"right":n,d=e.transport,v=e.size,u=s(e,g),p=i(d).Icon,m=d.toLowerCase();return a.createElement(l.Switch,o({className:r,labelPlacement:c,color:"var(--components-travel-travelswitch-standard-backgroundtrue-"+m+")",contrastColor:"var(--components-travel-travelswitch-contrast-backgroundtrue-"+m+")",icon:a.createElement(p,null),size:v},u),t)},exports.TravelTag=function(e){var l,c=e.children,v=e.className,u=e.alert,p=void 0===u?"none":u,m=e.transport,b=void 0===m?"none":m,g=e.label,h=e.labelPlacement,f=void 0===h?"right":h,I=e.onClose,y=void 0===I?void 0:I,w=s(e,d),_=n.useContrast(),E=!!y,N="none"!==b,L="none"!==p,k=a.useRef(null),C=a.Children.count(c),x=i(b),P=x.Icon,T=x.ariaLabel,z=b.toLowerCase(),S=a.cloneElement(a.createElement(P,null),{"aria-hidden":"true"}),F="var(--components-travel-traveltag-standard-tagfill-"+z+")",B="var(--components-travel-traveltag-contrast-tagfill-"+z+")",O="var(--components-travel-traveltag-standard-tagfill-"+z+"-cancled)",q="var(--components-travel-traveltag-contrast-tagfill-"+z+"-cancled)",j="var(--components-travel-traveltag-contrast-text-line-"+z+"-cancled)",M="var(--components-travel-traveltag-standard-text-line-"+z+"-cancled)";a.useEffect((function(){var e,a,r,t;N&&("walk"===b&&(null==(r=k.current)||r.style.setProperty("--text-color","var(--components-travel-traveltag-standard-icon-walk)")),"error"===p?(a=_?q:O,null==(t=k.current)||t.style.setProperty("--text-color",""+(_?j:M))):a=_?B:F,null==(e=k.current)||e.style.setProperty("--background-color",""+a))}),[N,_,F,B,O,p]);var H,V=a.createElement("div",o({className:r("eds-travel-tag",{"eds-travel-tag--closable":E,"eds-travel-tag--alert":L,"eds-travel-tag--alert--error":"error"===p,"eds-travel-tag--transport":N,"eds-travel-tag--icon-and-text":C>1||N&&C>0,className:v}),ref:k,"aria-label":T+" "+c+" "+(L?p:""),role:"img"},w),S,c,E&&a.createElement("button",{onClick:y,type:"button",className:"eds-travel-tag__close-button"},a.createElement(t.CloseSmallIcon,{inline:!0})),L&&a.createElement("span",{className:"eds-travel-tag__alert"},"info"===p&&a.createElement(t.ValidationInfoIcon,{"aria-hidden":!0,className:"eds-travel-tag__alert-info-icon"}),"error"===p&&a.createElement(t.ValidationErrorIcon,{"aria-hidden":!0,className:"eds-travel-tag__alert-error-icon"}),"warning"===p&&a.createElement(t.ValidationExclamationIcon,{"aria-hidden":!0,className:"eds-travel-tag__alert-exclamation-icon"}))),W=a.createElement("div",{className:r("eds-travel-tag__label",(l={},l["eds-travel-tag__label--"+f]=g,l["eds-travel-tag__label--"+f+"--with-alert"]=g&&L,l))},g);return g?a.createElement("div",{className:r("eds-travel-tag__wrapper",(H={},H["eds-travel-tag__wrapper--label-position-"+f]=g,H))},V,W):V};
2
2
  //# sourceMappingURL=travel.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"travel.cjs.production.min.js","sources":["../src/utils.ts","../src/LegLine.tsx","../src/LegBone.tsx","../src/index.tsx","../src/TravelHeader.tsx","../src/TravelLeg.tsx","../src/TravelSwitch.tsx","../src/TravelTag.tsx"],"sourcesContent":["import React from 'react';\nimport { colors } from '@entur/tokens';\nimport {\n BusIcon,\n FerryIcon,\n CarferryIcon,\n TramIcon,\n PlaneIcon,\n TrainIcon,\n BicycleIcon,\n MobilityIcon,\n MetroIcon,\n HelicopterIcon,\n FunicularIcon,\n CablewayIcon,\n TaxiIcon,\n WalkIcon,\n} from '@entur/icons';\n\nimport type { IconProps } from '@entur/icons';\n\nexport type Transport =\n | 'metro'\n | 'bus'\n | 'plane'\n | 'helicopter'\n | 'tram'\n | 'funicular'\n | 'cableway'\n | 'taxi'\n | 'bicycle'\n | 'walk'\n | 'train'\n | 'ferry'\n | 'carferry'\n | 'mobility'\n | 'airportLinkBus'\n | 'airportLinkRail'\n | 'rail'\n | 'water'\n | 'air'\n | 'none';\n\ntype transportStyleResult = {\n Icon: React.FC<IconProps>;\n backgroundColor: string;\n contrastBackgroundColor: string;\n pattern: 'line' | 'wave' | 'dashed' | 'dotted';\n ariaLabel: string;\n};\n\nexport const getTransportStyle = (mode: string): transportStyleResult => {\n switch (mode) {\n case 'metro':\n return {\n Icon: MetroIcon,\n backgroundColor: colors.transport.default.metro,\n contrastBackgroundColor: colors.transport.contrast.metro,\n pattern: 'line',\n ariaLabel: 'T-bane',\n };\n case 'bus':\n return {\n Icon: BusIcon,\n backgroundColor: colors.transport.default.bus,\n contrastBackgroundColor: colors.transport.contrast.bus,\n pattern: 'dashed',\n ariaLabel: 'Buss',\n };\n case 'plane':\n case 'air':\n return {\n Icon: PlaneIcon,\n backgroundColor: colors.transport.default.plane,\n contrastBackgroundColor: colors.transport.contrast.plane,\n pattern: 'line',\n ariaLabel: 'Fly',\n };\n case 'helicopter':\n return {\n Icon: HelicopterIcon,\n backgroundColor: colors.transport.default.helicopter,\n contrastBackgroundColor: colors.transport.contrast.helicopter,\n pattern: 'line',\n ariaLabel: 'Helikopter',\n };\n case 'tram':\n return {\n Icon: TramIcon,\n backgroundColor: colors.transport.default.tram,\n contrastBackgroundColor: colors.transport.contrast.tram,\n pattern: 'line',\n ariaLabel: 'Trikk',\n };\n case 'funicular':\n return {\n Icon: FunicularIcon,\n backgroundColor: colors.transport.default.funicular,\n contrastBackgroundColor: colors.transport.contrast.funicular,\n pattern: 'line',\n ariaLabel: 'Taubane',\n };\n case 'cableway':\n return {\n Icon: CablewayIcon,\n backgroundColor: colors.transport.default.cableway,\n contrastBackgroundColor: colors.transport.contrast.cableway,\n pattern: 'line',\n ariaLabel: 'Gondol',\n };\n case 'taxi':\n return {\n Icon: TaxiIcon,\n backgroundColor: colors.transport.default.taxi,\n contrastBackgroundColor: colors.transport.contrast.taxi,\n pattern: 'dashed',\n ariaLabel: 'Taxi',\n };\n case 'bicycle':\n return {\n Icon: BicycleIcon,\n backgroundColor: colors.transport.default.bicycle,\n contrastBackgroundColor: colors.transport.contrast.bicycle,\n pattern: 'line',\n ariaLabel: 'Sykkel',\n };\n case 'walk':\n return {\n Icon: WalkIcon,\n backgroundColor: colors.transport.default.walk,\n contrastBackgroundColor: colors.transport.contrast.walk,\n pattern: 'dotted',\n ariaLabel: 'Gange',\n };\n case 'train':\n case 'rail':\n return {\n Icon: TrainIcon,\n backgroundColor: colors.transport.default.train,\n contrastBackgroundColor: colors.transport.contrast.train,\n pattern: 'line',\n ariaLabel: 'Tog',\n };\n case 'ferry':\n case 'water':\n return {\n Icon: FerryIcon,\n backgroundColor: colors.transport.default.ferry,\n contrastBackgroundColor: colors.transport.contrast.ferry,\n pattern: 'wave',\n ariaLabel: 'Ferge',\n };\n case 'carferry':\n return {\n Icon: CarferryIcon,\n backgroundColor: colors.transport.default.carferry,\n contrastBackgroundColor: colors.transport.contrast.carferry,\n pattern: 'wave',\n ariaLabel: 'Bilferge',\n };\n case 'mobility':\n return {\n Icon: MobilityIcon,\n backgroundColor: colors.transport.default.mobility,\n contrastBackgroundColor: colors.transport.contrast.mobility,\n pattern: 'line',\n ariaLabel: 'El-sparkesykkel',\n };\n case 'airportLinkBus':\n return {\n Icon: BusIcon,\n backgroundColor: colors.transport.default.plane,\n contrastBackgroundColor: colors.transport.contrast.plane,\n pattern: 'dashed',\n ariaLabel: 'Flybuss',\n };\n case 'airportLinkRail':\n return {\n Icon: TrainIcon,\n backgroundColor: colors.transport.default.plane,\n contrastBackgroundColor: colors.transport.contrast.plane,\n pattern: 'line',\n ariaLabel: 'Flytog',\n };\n case 'none':\n return {\n Icon: React.Fragment,\n backgroundColor: colors.brand.blue,\n contrastBackgroundColor: colors.brand.white,\n pattern: 'line',\n ariaLabel: '',\n };\n case 'scooter':\n throw Error(\n `transport type 'scooter' is deprecated: Please use 'mobility' instead.`,\n );\n case 'bike':\n throw Error(\n `transport type 'bike' is deprecated: Please use 'bicycle' instead.`,\n );\n case 'car':\n throw Error(\n `transport type 'car' is deprecated: Please use 'taxi' instead.`,\n );\n case 'foot':\n throw Error(\n `transport type 'foot' is deprecated: Please use 'walk' instead.`,\n );\n default:\n throw Error('Please select a transport for the Travel component.');\n }\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport './LegLine.scss';\n\nexport type LegLineProps = {\n /** Farge på LegLine'n */\n color: string;\n /** Retningen til LegLine */\n direction: 'horizontal' | 'vertical';\n /** Hvilket linjemønster som skal brukes */\n pattern: 'line' | 'dashed' | 'dotted' | 'wave';\n /** Ekstra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const LegLine: React.FC<LegLineProps> = ({\n color,\n direction = 'horizontal',\n pattern,\n className,\n ...rest\n}) => {\n return (\n <div\n className={classNames('eds-leg-line', className, {\n [`eds-leg-line--${pattern}`]: pattern,\n [`eds-leg-line--${direction}`]: direction,\n })}\n style={{ backgroundColor: color }}\n {...rest}\n />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LegLine } from './LegLine';\nimport './LegBone.scss';\n\nexport type LegBoneProps = {\n /** Retning på komponenten */\n direction: 'horizontal' | 'vertical';\n /** Hvilke linjemønster som skal brukes */\n pattern: 'line' | 'dashed' | 'dotted' | 'wave';\n /** Farge på linja */\n color: string;\n /** Farge på startpunktet\n * @default Verdien til color\n */\n startColor?: string;\n /** Farge på endepunktet\n * @default Verdien til color\n */\n endColor?: string;\n /** Vis startpunkt\n * @default true\n */\n showStart?: boolean;\n /** Vis linke\n * @default true\n */\n showLine?: boolean;\n /** Vis endepunkt\n * @default true\n */\n showStop?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const LegBone: React.FC<LegBoneProps> = ({\n direction,\n pattern,\n color,\n startColor,\n endColor,\n showStart = true,\n showStop = true,\n showLine = true,\n className,\n ...rest\n}) => {\n return (\n <div\n className={classNames(className, 'eds-leg-bone', [\n { 'eds-leg-bone--vertical': direction === 'vertical' },\n { 'eds-leg-bone--horizontal': direction === 'horizontal' },\n ])}\n {...rest}\n >\n {showStart && (\n <div\n className={`eds-leg-bone__start`}\n style={{ backgroundColor: startColor || color }}\n />\n )}\n\n {showLine && (\n <LegLine\n className={`eds-leg-bone__line`}\n direction={direction}\n color={color}\n pattern={pattern}\n />\n )}\n\n {showStop && (\n <div\n className={`eds-leg-bone__stop`}\n style={{ backgroundColor: endColor || color }}\n />\n )}\n </div>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('travel');\n\nexport * from './TravelHeader';\nexport * from './TravelTag';\nexport * from './LegLine';\nexport * from './LegBone';\nexport * from './TravelLeg';\nexport * from './TravelSwitch';\n","import React from 'react';\nimport classNames from 'classnames';\nimport './TravelHeader.scss';\n\nexport type TravelHeaderProps = {\n /** HTML-elementet eller React-komponenten som lager elementet\n * @default 'div'\n */\n as?: string | React.ElementType;\n /** Destinasjonen man reiser fra */\n from: React.ReactNode;\n /** Destinasjonen man reiser til */\n to: React.ReactNode;\n /**Størrelsen på komponenten\n * @default 'large'\n */\n size?: 'large' | 'medium';\n /** Plassere til og fra på samme linje */\n noWrap?: boolean;\n /**Ekstra klassenavn */\n className?: string;\n [key: string]: any;\n};\n\nexport const TravelHeader: React.FC<TravelHeaderProps> = ({\n as: Element = 'div',\n from,\n to,\n size = 'large',\n className,\n noWrap,\n ...rest\n}) => {\n return (\n <Element\n className={classNames('eds-travel-header', className, {\n 'eds-travel-header--large': size === 'large',\n 'eds-travel-header--medium': size === 'medium',\n 'eds-travel-header--no-wrap': noWrap,\n })}\n aria-label={`Fra ${from}, til ${to}`}\n {...rest}\n >\n <span className=\"eds-travel-header__from\">{from}</span>\n <span className=\"eds-travel-header__to\">{to}</span>\n </Element>\n );\n};\n","import React from 'react';\nimport { useContrast } from '@entur/layout';\nimport { LegBone } from './LegBone';\nimport { getTransportStyle } from './utils';\n\nimport type { Transport } from './utils';\n\nexport type TravelLegProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Hviklen type reise som skal vises riktig farge og linjetype */\n transport: Transport;\n /** Retningen på komponenten */\n direction: 'horizontal' | 'vertical';\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const TravelLeg: React.FC<TravelLegProps> = ({\n className,\n transport,\n direction,\n ...rest\n}) => {\n const { backgroundColor, contrastBackgroundColor, pattern } =\n getTransportStyle(transport);\n const isContrast = useContrast();\n\n return (\n <LegBone\n direction={direction}\n pattern={pattern}\n color={isContrast ? contrastBackgroundColor : backgroundColor}\n className={className}\n {...rest}\n />\n );\n};\n","import React from 'react';\nimport { Switch } from '@entur/form';\nimport { getTransportStyle } from './utils';\n\nimport type { Transport } from './utils';\n\nexport type TravelSwitchProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om switch-en er checked eller ikke */\n checked?: boolean;\n /** Label for TravelSwitch-en. */\n children?: React.ReactNode;\n /** Posisjonen til label for TravelSwitch-en.\n * @default \"right\"\n */\n labelPlacement?: 'right' | 'bottom';\n /** Hvilken type reise som skal vises ikon og farge for */\n transport: Transport; // When adding a new submode, check https://enturas.atlassian.net/wiki/spaces/PUBLIC/pages/825393529/Norwegian+submodes+and+their+definitions for names\n /** Callback for når verdien endres */\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Størrelsen på Switch-en\n * @default \"medium\"\n */\n size?: 'medium' | 'large';\n} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>;\n\nexport const TravelSwitch: React.FC<TravelSwitchProps> = ({\n className,\n children,\n labelPlacement = 'right',\n transport,\n size,\n ...rest\n}) => {\n const { backgroundColor, contrastBackgroundColor, Icon } =\n getTransportStyle(transport);\n return (\n <Switch\n className={className}\n labelPlacement={labelPlacement}\n color={backgroundColor}\n contrastColor={contrastBackgroundColor}\n icon={<Icon />}\n size={size}\n {...rest}\n >\n {children}\n </Switch>\n );\n};\n","import React, { useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport {\n CloseSmallIcon,\n ValidationInfoIcon,\n ValidationErrorIcon,\n ValidationExclamationIcon,\n} from '@entur/icons';\nimport { useContrast } from '@entur/layout';\n\nimport { getTransportStyle } from './utils';\n\nimport type { Transport } from './utils';\n\nimport './TravelTag.scss';\n\nexport type TravelTagProps = {\n /** Callback som kalles for når man skal lukke TravelTag-en\n * @default undefined\n */\n onClose?: () => void;\n /** Innholdet inne i TravelTag-en */\n children?: React.ReactNode;\n /**Ekstra klassenavn */\n className?: string;\n /** Legger til et Valideringsikon i TravelTagen for å signalisere avvik, informasjon e.l.\n * @default \"none\"\n */\n alert?: 'none' | 'error' | 'warning' | 'info';\n /** Legger til farge og ikon tilpasset valgt transportmiddel */\n transport?: Transport;\n /** Element ved siden av eller under TravelTag. */\n label?: React.ReactNode;\n /** Posisjonen til label-en i forhold til TravelTag-en\n * @default \"right\"\n */\n labelPlacement?: 'bottom' | 'right';\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const TravelTag: React.FC<TravelTagProps> = ({\n children,\n className,\n alert = 'none',\n transport = 'none',\n label,\n labelPlacement = 'right',\n onClose = undefined,\n ...rest\n}) => {\n const isContrast = useContrast();\n const isClosable = onClose ? true : false;\n const transportIsSet = transport !== 'none';\n const alertIsSet = alert !== 'none';\n const tagRef = useRef<HTMLDivElement>(null);\n const numberOfChildren = React.Children.count(children);\n const { Icon, contrastBackgroundColor, backgroundColor, ariaLabel } =\n getTransportStyle(transport);\n\n useEffect(() => {\n if (transportIsSet) {\n tagRef.current?.style.setProperty(\n '--background-color',\n isContrast ? contrastBackgroundColor : backgroundColor,\n );\n }\n }, [tagRef.current, backgroundColor]);\n\n const TravelTagWithoutLabel: JSX.Element = (\n <div\n className={classNames('eds-travel-tag', {\n 'eds-travel-tag--closable': isClosable,\n 'eds-travel-tag--alert': alertIsSet,\n 'eds-travel-tag--alert--error': alert === 'error',\n 'eds-travel-tag--transport': transportIsSet,\n 'eds-travel-tag--icon-and-text':\n numberOfChildren > 1 || (transportIsSet && numberOfChildren > 0),\n className,\n })}\n ref={tagRef}\n {...rest}\n aria-label={\n rest['aria-label'] ?? ariaLabel + (alertIsSet ? ` ${alert}` : '')\n }\n role=\"img\"\n >\n <Icon aria-hidden />\n {children}\n {isClosable && (\n <button\n onClick={onClose}\n type=\"button\"\n className=\"eds-travel-tag__close-button\"\n >\n <CloseSmallIcon inline />\n </button>\n )}\n {alertIsSet && (\n <span className=\"eds-travel-tag__alert\">\n {alert === 'info' && (\n <ValidationInfoIcon\n aria-hidden\n className=\"eds-travel-tag__alert-info-icon\"\n />\n )}\n {alert === 'error' && (\n <ValidationErrorIcon\n aria-hidden\n className=\"eds-travel-tag__alert-error-icon\"\n />\n )}\n {alert === 'warning' && (\n <ValidationExclamationIcon\n aria-hidden\n className=\"eds-travel-tag__alert-exclamation-icon\"\n />\n )}\n </span>\n )}\n </div>\n );\n\n const Label: JSX.Element = (\n <div\n className={classNames('eds-travel-tag__label', {\n [`eds-travel-tag__label--${labelPlacement}`]: label,\n [`eds-travel-tag__label--${labelPlacement}--with-alert`]:\n label && alertIsSet,\n })}\n >\n {label}\n </div>\n );\n\n if (label) {\n return (\n <div\n className={classNames('eds-travel-tag__wrapper', {\n [`eds-travel-tag__wrapper--label-position-${labelPlacement}`]: label,\n })}\n >\n {TravelTagWithoutLabel}\n {Label}\n </div>\n );\n }\n\n return TravelTagWithoutLabel;\n};\n"],"names":["getTransportStyle","mode","Icon","MetroIcon","backgroundColor","colors","transport","metro","contrastBackgroundColor","contrast","pattern","ariaLabel","BusIcon","bus","PlaneIcon","plane","HelicopterIcon","helicopter","TramIcon","tram","FunicularIcon","funicular","CablewayIcon","cableway","TaxiIcon","taxi","BicycleIcon","bicycle","WalkIcon","walk","TrainIcon","train","FerryIcon","ferry","CarferryIcon","carferry","MobilityIcon","mobility","React","Fragment","brand","blue","white","Error","LegLine","_ref","_classNames","color","_ref$direction","direction","className","rest","_objectWithoutPropertiesLoose","_excluded","classNames","style","LegBone","startColor","endColor","_ref$showStart","showStart","_ref$showStop","showStop","_ref$showLine","showLine","createElement","warnAboutMissingStyles","_ref$as","as","Element","from","to","_ref$size","size","noWrap","_extends","isContrast","useContrast","children","_ref$labelPlacement","labelPlacement","Switch","contrastColor","icon","_rest$ariaLabel","_ref$alert","alert","_ref$transport","label","_ref$onClose","onClose","undefined","isClosable","transportIsSet","alertIsSet","tagRef","useRef","numberOfChildren","Children","count","useEffect","_tagRef$current","current","setProperty","_classNames2","TravelTagWithoutLabel","ref","role","onClick","type","CloseSmallIcon","inline","ValidationInfoIcon","ValidationErrorIcon","ValidationExclamationIcon","Label"],"mappings":"mpBAmDaA,EAAoB,SAACC,GAChC,OAAQA,GACN,IAAK,QACH,MAAO,CACLC,KAAMC,EAASA,UACfC,gBAAiBC,EAAMA,OAACC,UAAS,QAASC,MAC1CC,wBAAyBH,EAAMA,OAACC,UAAUG,SAASF,MACnDG,QAAS,OACTC,UAAW,UAEf,IAAK,MACH,MAAO,CACLT,KAAMU,EAAOA,QACbR,gBAAiBC,EAAMA,OAACC,UAAS,QAASO,IAC1CL,wBAAyBH,EAAMA,OAACC,UAAUG,SAASI,IACnDH,QAAS,SACTC,UAAW,QAEf,IAAK,QACL,IAAK,MACH,MAAO,CACLT,KAAMY,EAASA,UACfV,gBAAiBC,EAAMA,OAACC,UAAS,QAASS,MAC1CP,wBAAyBH,EAAMA,OAACC,UAAUG,SAASM,MACnDL,QAAS,OACTC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EAAAA,EAAAA,0BAAAA,GAAmBQ,EACnBR,EAAAA,0BAAAA,EACzBQ,gBAAAA,GAASM,EAAUhD,KAGtB0C,GAIL,OAAIA,EAEAlD,EACE2B,cAAA,MAAA,CAAAf,UAAWI,EAAW,2BACwB0B,EAAAA,CAAAA,EAAAA,EAAAA,2CAAAA,GAAmBQ,EAAKgB,KAGrEC,EACAU,GAKAV,CACT"}
1
+ {"version":3,"file":"travel.cjs.production.min.js","sources":["../src/utils.ts","../src/LegLine.tsx","../src/LegBone.tsx","../src/index.tsx","../src/TravelHeader.tsx","../src/TravelLeg.tsx","../src/TravelSwitch.tsx","../src/TravelTag.tsx"],"sourcesContent":["import React from 'react';\n\nimport {\n BusIcon,\n FerryIcon,\n CarferryIcon,\n TramIcon,\n PlaneIcon,\n TrainIcon,\n BicycleIcon,\n MobilityIcon,\n MetroIcon,\n HelicopterIcon,\n FunicularIcon,\n CablewayIcon,\n TaxiIcon,\n WalkIcon,\n} from '@entur/icons';\n\nimport type { IconProps } from '@entur/icons';\n\nexport type Transport =\n | 'metro'\n | 'bus'\n | 'plane'\n | 'helicopter'\n | 'tram'\n | 'funicular'\n | 'cableway'\n | 'taxi'\n | 'bicycle'\n | 'walk'\n | 'train'\n | 'ferry'\n | 'carferry'\n | 'mobility'\n | 'airportLinkBus'\n | 'airportLinkRail'\n | 'rail'\n | 'water'\n | 'air'\n | 'none';\n\ntype transportStyleResult = {\n Icon: React.FC<IconProps>;\n backgroundColor?: string;\n contrastBackgroundColor?: string;\n errorBackgroundColor?: string;\n errorTextColor?: string;\n errorContrastTextColor?: string;\n errorContrastBackgroundColor?: string;\n pattern: 'line' | 'wave' | 'dashed' | 'dotted';\n ariaLabel: string;\n};\n\nexport const getTransportStyle = (mode: string): transportStyleResult => {\n switch (mode) {\n case 'metro':\n return {\n Icon: MetroIcon,\n pattern: 'line',\n ariaLabel: 'T-bane',\n };\n case 'bus':\n return {\n Icon: BusIcon,\n pattern: 'dashed',\n ariaLabel: 'Buss',\n };\n case 'plane':\n case 'air':\n return {\n Icon: PlaneIcon,\n pattern: 'line',\n ariaLabel: 'Fly',\n };\n case 'helicopter':\n return {\n Icon: HelicopterIcon,\n pattern: 'line',\n ariaLabel: 'Helikopter',\n };\n case 'tram':\n return {\n Icon: TramIcon,\n pattern: 'line',\n ariaLabel: 'Trikk',\n };\n case 'funicular':\n return {\n Icon: FunicularIcon,\n pattern: 'line',\n ariaLabel: 'Taubane',\n };\n case 'cableway':\n return {\n Icon: CablewayIcon,\n pattern: 'line',\n ariaLabel: 'Gondol',\n };\n case 'taxi':\n return {\n Icon: TaxiIcon,\n pattern: 'dashed',\n ariaLabel: 'Taxi',\n };\n case 'bicycle':\n return {\n Icon: BicycleIcon,\n pattern: 'dashed',\n ariaLabel: 'Sykkel',\n };\n case 'walk':\n return {\n Icon: WalkIcon,\n pattern: 'dotted',\n ariaLabel: 'Gange',\n };\n case 'train':\n case 'rail':\n return {\n Icon: TrainIcon,\n pattern: 'line',\n ariaLabel: 'Tog',\n };\n case 'ferry':\n case 'water':\n return {\n Icon: FerryIcon,\n pattern: 'wave',\n ariaLabel: 'Ferge',\n };\n case 'carferry':\n return {\n Icon: CarferryIcon,\n pattern: 'wave',\n ariaLabel: 'Bilferge',\n };\n case 'mobility':\n return {\n Icon: MobilityIcon,\n pattern: 'line',\n ariaLabel: 'El-sparkesykkel',\n };\n case 'airportLinkBus':\n return {\n Icon: BusIcon,\n pattern: 'dashed',\n ariaLabel: 'Flybuss',\n };\n case 'airportLinkRail':\n return {\n Icon: TrainIcon,\n pattern: 'line',\n ariaLabel: 'Flytog',\n };\n case 'none':\n return {\n Icon: React.Fragment,\n pattern: 'line',\n ariaLabel: '',\n };\n case 'scooter':\n throw Error(\n `transport type 'scooter' is deprecated: Please use 'mobility' instead.`,\n );\n case 'bike':\n throw Error(\n `transport type 'bike' is deprecated: Please use 'bicycle' instead.`,\n );\n case 'car':\n throw Error(\n `transport type 'car' is deprecated: Please use 'taxi' instead.`,\n );\n case 'foot':\n throw Error(\n `transport type 'foot' is deprecated: Please use 'walk' instead.`,\n );\n default:\n throw Error('Please select a transport for the Travel component.');\n }\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport './LegLine.scss';\n\nexport type LegLineProps = {\n /** Farge på LegLine'n */\n color: string;\n /** Retningen til LegLine */\n direction: 'horizontal' | 'vertical';\n /** Hvilket linjemønster som skal brukes */\n pattern: 'line' | 'dashed' | 'dotted' | 'wave';\n /** Ekstra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const LegLine: React.FC<LegLineProps> = ({\n color,\n direction = 'horizontal',\n pattern,\n className,\n ...rest\n}) => {\n return (\n <div\n className={classNames('eds-leg-line', className, {\n [`eds-leg-line--${pattern}`]: pattern,\n [`eds-leg-line--${direction}`]: direction,\n })}\n style={{ backgroundColor: color }}\n {...rest}\n />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LegLine } from './LegLine';\nimport './LegBone.scss';\n\nexport type LegBoneProps = {\n /** Retning på komponenten */\n direction: 'horizontal' | 'vertical';\n /** Hvilke linjemønster som skal brukes */\n pattern: 'line' | 'dashed' | 'dotted' | 'wave';\n /** Farge på linja */\n color: string;\n /** Farge på startpunktet\n * @default Verdien til color\n */\n startColor?: string;\n /** Farge på endepunktet\n * @default Verdien til color\n */\n endColor?: string;\n /** Vis startpunkt\n * @default true\n */\n showStart?: boolean;\n /** Vis linke\n * @default true\n */\n showLine?: boolean;\n /** Vis endepunkt\n * @default true\n */\n showStop?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const LegBone: React.FC<LegBoneProps> = ({\n direction,\n pattern,\n color,\n startColor,\n endColor,\n showStart = true,\n showStop = true,\n showLine = true,\n className,\n ...rest\n}) => {\n return (\n <div\n className={classNames(className, 'eds-leg-bone', [\n { 'eds-leg-bone--vertical': direction === 'vertical' },\n { 'eds-leg-bone--horizontal': direction === 'horizontal' },\n ])}\n {...rest}\n >\n {showStart && (\n <div\n className={`eds-leg-bone__start`}\n style={{ backgroundColor: startColor || color }}\n />\n )}\n\n {showLine && (\n <LegLine\n className={`eds-leg-bone__line`}\n direction={direction}\n color={color}\n pattern={pattern}\n />\n )}\n\n {showStop && (\n <div\n className={`eds-leg-bone__stop`}\n style={{ backgroundColor: endColor || color }}\n />\n )}\n </div>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('travel');\n\nexport * from './TravelHeader';\nexport * from './TravelTag';\nexport * from './LegLine';\nexport * from './LegBone';\nexport * from './TravelLeg';\nexport * from './TravelSwitch';\n","import React from 'react';\nimport classNames from 'classnames';\nimport './TravelHeader.scss';\n\nexport type TravelHeaderProps = {\n /** HTML-elementet eller React-komponenten som lager elementet\n * @default 'div'\n */\n as?: string | React.ElementType;\n /** Destinasjonen man reiser fra */\n from: React.ReactNode;\n /** Destinasjonen man reiser til */\n to: React.ReactNode;\n /**Størrelsen på komponenten\n * @default 'large'\n */\n size?: 'large' | 'medium';\n /** Plassere til og fra på samme linje */\n noWrap?: boolean;\n /**Ekstra klassenavn */\n className?: string;\n [key: string]: any;\n};\n\nexport const TravelHeader: React.FC<TravelHeaderProps> = ({\n as: Element = 'div',\n from,\n to,\n size = 'large',\n className,\n noWrap,\n ...rest\n}) => {\n return (\n <Element\n className={classNames('eds-travel-header', className, {\n 'eds-travel-header--large': size === 'large',\n 'eds-travel-header--medium': size === 'medium',\n 'eds-travel-header--no-wrap': noWrap,\n })}\n aria-label={`Fra ${from}, til ${to}`}\n {...rest}\n >\n <span className=\"eds-travel-header__from\">{from}</span>\n <span className=\"eds-travel-header__to\">{to}</span>\n </Element>\n );\n};\n","import React from 'react';\nimport { useContrast } from '@entur/layout';\nimport { LegBone } from './LegBone';\nimport { getTransportStyle } from './utils';\n\nimport type { Transport } from './utils';\n\nexport type TravelLegProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Hviklen type reise som skal vises riktig farge og linjetype */\n transport: Transport;\n /** Retningen på komponenten */\n direction: 'horizontal' | 'vertical';\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const TravelLeg: React.FC<TravelLegProps> = ({\n className,\n transport,\n direction,\n ...rest\n}) => {\n const { pattern } = getTransportStyle(transport);\n const isContrast = useContrast();\n const deCapitalizeTransport = transport.toLowerCase();\n\n console.log('deCapitalizeTransport', deCapitalizeTransport);\n const backgroundColor =\n 'var(--components-travel-travelleg-standard-' + deCapitalizeTransport + ')';\n const contrastBackgroundColor =\n 'var(--components-travel-travelleg-contrast-' + deCapitalizeTransport + ')';\n\n return (\n <LegBone\n direction={direction}\n pattern={pattern}\n color={isContrast ? contrastBackgroundColor : backgroundColor}\n className={className}\n {...rest}\n />\n );\n};\n","import React from 'react';\nimport { Switch } from '@entur/form';\nimport { getTransportStyle } from './utils';\n\nimport type { Transport } from './utils';\n\nexport type TravelSwitchProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om switch-en er checked eller ikke */\n checked?: boolean;\n /** Label for TravelSwitch-en. */\n children?: React.ReactNode;\n /** Posisjonen til label for TravelSwitch-en.\n * @default \"right\"\n */\n labelPlacement?: 'right' | 'bottom';\n /** Hvilken type reise som skal vises ikon og farge for */\n transport: Transport; // When adding a new submode, check https://enturas.atlassian.net/wiki/spaces/PUBLIC/pages/825393529/Norwegian+submodes+and+their+definitions for names\n /** Callback for når verdien endres */\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Størrelsen på Switch-en\n * @default \"medium\"\n */\n size?: 'medium' | 'large';\n} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>;\n\nexport const TravelSwitch: React.FC<TravelSwitchProps> = ({\n className,\n children,\n labelPlacement = 'right',\n transport,\n size,\n ...rest\n}) => {\n const { Icon } = getTransportStyle(transport);\n const deCapitalizeTransport = transport.toLowerCase();\n\n const backgroundColor =\n 'var(--components-travel-travelswitch-standard-backgroundtrue-' +\n deCapitalizeTransport +\n ')';\n const contrastBackgroundColor =\n 'var(--components-travel-travelswitch-contrast-backgroundtrue-' +\n deCapitalizeTransport +\n ')';\n\n return (\n <Switch\n className={className}\n labelPlacement={labelPlacement}\n color={backgroundColor}\n contrastColor={contrastBackgroundColor}\n icon={<Icon />}\n size={size}\n {...rest}\n >\n {children}\n </Switch>\n );\n};\n","import React, { cloneElement, useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport {\n CloseSmallIcon,\n ValidationInfoIcon,\n ValidationErrorIcon,\n ValidationExclamationIcon,\n} from '@entur/icons';\nimport { useContrast } from '@entur/layout';\n\nimport { getTransportStyle } from './utils';\n\nimport type { Transport } from './utils';\n\nimport './TravelTag.scss';\n\nexport type TravelTagProps = {\n /** Callback som kalles for når man skal lukke TravelTag-en\n * @default undefined\n */\n onClose?: () => void;\n /** Innholdet inne i TravelTag-en */\n children?: React.ReactNode;\n /**Ekstra klassenavn */\n className?: string;\n /** Legger til et Valideringsikon i TravelTagen for å signalisere avvik, informasjon e.l.\n * @default \"none\"\n */\n alert?: 'none' | 'error' | 'warning' | 'info';\n /** Legger til farge og ikon tilpasset valgt transportmiddel */\n transport?: Transport;\n /** Element ved siden av eller under TravelTag. */\n label?: React.ReactNode;\n /** Posisjonen til label-en i forhold til TravelTag-en\n * @default \"right\"\n */\n labelPlacement?: 'bottom' | 'right';\n} & React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n>;\n\nexport const TravelTag: React.FC<TravelTagProps> = ({\n children,\n className,\n alert = 'none',\n transport = 'none',\n label,\n labelPlacement = 'right',\n onClose = undefined,\n ...rest\n}) => {\n const isContrast = useContrast();\n const isClosable = onClose ? true : false;\n const transportIsSet = transport !== 'none';\n const alertIsSet = alert !== 'none';\n const tagRef = useRef<HTMLDivElement>(null);\n const numberOfChildren = React.Children.count(children);\n const { Icon, ariaLabel: ariaLabelForTranportIcon } =\n getTransportStyle(transport);\n const deCapitalizeTransport = transport.toLowerCase();\n const IconWithAriaHidden = cloneElement(<Icon />, { 'aria-hidden': 'true' });\n\n const backgroundColor =\n 'var(--components-travel-traveltag-standard-tagfill-' +\n deCapitalizeTransport +\n ')';\n const contrastBackgroundColor =\n 'var(--components-travel-traveltag-contrast-tagfill-' +\n deCapitalizeTransport +\n ')';\n // Error colors\n const errorBackgroundColor =\n 'var(--components-travel-traveltag-standard-tagfill-' +\n deCapitalizeTransport +\n '-cancled)';\n const errorContrastBackgroundColor =\n 'var(--components-travel-traveltag-contrast-tagfill-' +\n deCapitalizeTransport +\n '-cancled)';\n const errorContrastTextColor =\n 'var(--components-travel-traveltag-contrast-text-line-' +\n deCapitalizeTransport +\n '-cancled)';\n const errorTextColor =\n 'var(--components-travel-traveltag-standard-text-line-' +\n deCapitalizeTransport +\n '-cancled)';\n\n useEffect(() => {\n if (transportIsSet) {\n let colorToSet;\n let textColorToSet;\n // Walk has another icon/text color then the other transports\n if (transport === 'walk') {\n tagRef.current?.style.setProperty(\n '--text-color',\n 'var(--components-travel-traveltag-standard-icon-walk)',\n );\n }\n // Error\n if (alert === 'error') {\n colorToSet = isContrast\n ? errorContrastBackgroundColor\n : errorBackgroundColor;\n textColorToSet = isContrast ? errorContrastTextColor : errorTextColor;\n tagRef.current?.style.setProperty('--text-color', `${textColorToSet}`);\n } else {\n colorToSet = isContrast ? contrastBackgroundColor : backgroundColor;\n }\n tagRef.current?.style.setProperty('--background-color', `${colorToSet}`);\n }\n }, [\n transportIsSet,\n isContrast,\n backgroundColor,\n contrastBackgroundColor,\n errorBackgroundColor,\n alert,\n ]);\n\n const TravelTagWithoutLabel: JSX.Element = (\n <div\n className={classNames('eds-travel-tag', {\n 'eds-travel-tag--closable': isClosable,\n 'eds-travel-tag--alert': alertIsSet,\n 'eds-travel-tag--alert--error': alert === 'error',\n 'eds-travel-tag--transport': transportIsSet,\n 'eds-travel-tag--icon-and-text':\n numberOfChildren > 1 || (transportIsSet && numberOfChildren > 0),\n className,\n })}\n ref={tagRef}\n aria-label={`${ariaLabelForTranportIcon} ${children} ${\n alertIsSet ? alert : ''\n }`}\n role=\"img\"\n {...rest}\n >\n {IconWithAriaHidden}\n {children}\n {isClosable && (\n <button\n onClick={onClose}\n type=\"button\"\n className=\"eds-travel-tag__close-button\"\n >\n <CloseSmallIcon inline />\n </button>\n )}\n {alertIsSet && (\n <span className=\"eds-travel-tag__alert\">\n {alert === 'info' && (\n <ValidationInfoIcon\n aria-hidden\n className=\"eds-travel-tag__alert-info-icon\"\n />\n )}\n {alert === 'error' && (\n <ValidationErrorIcon\n aria-hidden\n className=\"eds-travel-tag__alert-error-icon\"\n />\n )}\n {alert === 'warning' && (\n <ValidationExclamationIcon\n aria-hidden\n className=\"eds-travel-tag__alert-exclamation-icon\"\n />\n )}\n </span>\n )}\n </div>\n );\n\n const Label: JSX.Element = (\n <div\n className={classNames('eds-travel-tag__label', {\n [`eds-travel-tag__label--${labelPlacement}`]: label,\n [`eds-travel-tag__label--${labelPlacement}--with-alert`]:\n label && alertIsSet,\n })}\n >\n {label}\n </div>\n );\n\n if (label) {\n return (\n <div\n className={classNames('eds-travel-tag__wrapper', {\n [`eds-travel-tag__wrapper--label-position-${labelPlacement}`]: label,\n })}\n >\n {TravelTagWithoutLabel}\n {Label}\n </div>\n );\n }\n\n return TravelTagWithoutLabel;\n};\n"],"names":["getTransportStyle","mode","Icon","MetroIcon","pattern","ariaLabel","BusIcon","PlaneIcon","HelicopterIcon","TramIcon","FunicularIcon","CablewayIcon","TaxiIcon","BicycleIcon","WalkIcon","TrainIcon","FerryIcon","CarferryIcon","MobilityIcon","React","Fragment","Error","LegLine","_ref","_classNames","color","_ref$direction","direction","className","rest","_objectWithoutPropertiesLoose","_excluded","classNames","style","backgroundColor","LegBone","startColor","endColor","_ref$showStart","showStart","_ref$showStop","showStop","_ref$showLine","showLine","createElement","warnAboutMissingStyles","_ref$as","as","Element","from","to","_ref$size","size","noWrap","_extends","transport","isContrast","useContrast","deCapitalizeTransport","toLowerCase","console","log","children","_ref$labelPlacement","labelPlacement","Switch","contrastColor","icon","_ref$alert","alert","_ref$transport","label","_ref$onClose","onClose","undefined","isClosable","transportIsSet","alertIsSet","tagRef","useRef","numberOfChildren","Children","count","ariaLabelForTranportIcon","IconWithAriaHidden","cloneElement","contrastBackgroundColor","errorBackgroundColor","errorContrastBackgroundColor","errorContrastTextColor","errorTextColor","useEffect","_tagRef$current3","colorToSet","_tagRef$current","_tagRef$current2","current","setProperty","textColorToSet","_classNames2","TravelTagWithoutLabel","ref","role","onClick","type","CloseSmallIcon","inline","ValidationInfoIcon","ValidationErrorIcon","ValidationExclamationIcon","Label"],"mappings":"wnBAuDaA,EAAoB,SAACC,GAChC,OAAQA,GACN,IAAK,QACH,MAAO,CACLC,KAAMC,EAASA,UACfC,QAAS,OACTC,UAAW,UAEf,IAAK,MACH,MAAO,CACLH,KAAMI,EAAOA,QACbF,QAAS,SACTC,UAAW,QAEf,IAAK,QACL,IAAK,MACH,MAAO,CACLH,KAAMK,EAASA,UACfH,QAAS,OACTC,UAAW,OAEf,IAAK,aACH,MAAO,CACLH,KAAMM,EAAcA,eACpBJ,QAAS,OACTC,UAAW,cAEf,IAAK,OACH,MAAO,CACLH,KAAMO,EAAQA,SACdL,QAAS,OACTC,UAAW,SAEf,IAAK,YACH,MAAO,CACLH,KAAMQ,EAAaA,cACnBN,QAAS,OACTC,UAAW,WAEf,IAAK,WACH,MAAO,CACLH,KAAMS,EAAYA,aAClBP,QAAS,OACTC,UAAW,UAEf,IAAK,OACH,MAAO,CACLH,KAAMU,EAAQA,SACdR,QAAS,SACTC,UAAW,QAEf,IAAK,UACH,MAAO,CACLH,KAAMW,EAAWA,YACjBT,QAAS,SACTC,UAAW,UAEf,IAAK,OACH,MAAO,CACLH,KAAMY,EAAQA,SACdV,QAAS,SACTC,UAAW,SAEf,IAAK,QACL,IAAK,OACH,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