@opentripplanner/trip-details 1.3.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ # Example used to overwrite a subset of the messages from /i18n/en-US.yml.
2
+ otpUi:
3
+ TripDetails:
4
+ caloriesDescription: "Walking <strong>{walkMinutes}</strong> minute(s) and biking <strong>{bikeMinutes}</strong> minute(s) will consume {calories} Calories."
5
+ departure: "<strong>Leave</strong> at <strong>{departureDate, time, short}</strong> on <strong>{departureDate, date, long}</strong>"
6
+ title: "Custom Trip Details Title"
7
+ tncFare: "Pay <strong>{minTNCFare}-{maxTNCFare}</strong> to {companies}"
package/esm/index.js CHANGED
@@ -1,55 +1,257 @@
1
+ import flatten from "flat"; // @ts-expect-error FIXME: Create TypeScript types for core-utils packages.
2
+
1
3
  import coreUtils from "@opentripplanner/core-utils";
2
- import moment from "moment";
3
- import PropTypes from "prop-types";
4
4
  import React from "react";
5
- import { CalendarAlt, Heartbeat, MoneyBillAlt } from "styled-icons/fa-solid";
6
- import * as Styled from "./styled";
5
+ import { FormattedMessage, FormattedNumber } from "react-intl";
6
+ import { CalendarAlt } from "@styled-icons/fa-solid/CalendarAlt";
7
+ import { HandPaper } from "@styled-icons/fa-solid/HandPaper";
8
+ import { Heartbeat } from "@styled-icons/fa-solid/Heartbeat";
9
+ import { MoneyBillAlt } from "@styled-icons/fa-solid/MoneyBillAlt";
10
+ import { PhoneVolume } from "@styled-icons/fa-solid/PhoneVolume";
11
+ import { Route } from "@styled-icons/fa-solid/Route";
12
+ import * as S from "./styled";
7
13
  import TripDetail from "./trip-detail";
8
- export default function TripDetails(_ref) {
9
- var className = _ref.className,
10
- itinerary = _ref.itinerary,
11
- longDateFormat = _ref.longDateFormat,
12
- messages = _ref.messages,
13
- routingType = _ref.routingType,
14
- timeOptions = _ref.timeOptions;
15
- var date = moment(itinerary.startTime);
16
- messages = coreUtils.messages.mergeMessages(TripDetails.defaultProps.messages, messages); // process the transit fare
17
-
18
- var _coreUtils$itinerary$ = coreUtils.itinerary.calculateFares(itinerary),
19
- centsToString = _coreUtils$itinerary$.centsToString,
20
- dollarsToString = _coreUtils$itinerary$.dollarsToString,
21
- maxTNCFare = _coreUtils$itinerary$.maxTNCFare,
22
- minTNCFare = _coreUtils$itinerary$.minTNCFare,
23
- transitFare = _coreUtils$itinerary$.transitFare;
24
-
25
- var companies;
14
+ // Load the default messages.
15
+ import defaultEnglishMessages from "../i18n/en-US.yml"; // HACK: We should flatten the messages loaded above because
16
+ // the YAML loaders behave differently between webpack and our version of jest:
17
+ // - the yaml loader for webpack returns a nested object,
18
+ // - the yaml loader for jest returns messages with flattened ids.
19
+
20
+ var defaultMessages = flatten(defaultEnglishMessages);
21
+ /**
22
+ * Format text bold (used with FormattedMessage).
23
+ */
24
+ // TODO: Find a better place for this utility.
25
+
26
+ function boldText(contents) {
27
+ return /*#__PURE__*/React.createElement("strong", null, contents);
28
+ }
29
+ /**
30
+ * Render formatted fare.
31
+ * @param currencyCode The ISO currency code to use (USD, GBP, EUR).
32
+ * @param fare The fare value, in currency units, to be shown.
33
+ * @returns The formatted fare value according to the selected locale.
34
+ */
35
+
36
+
37
+ function renderFare(currencyCode, fare) {
38
+ return /*#__PURE__*/React.createElement(FormattedNumber, {
39
+ currency: currencyCode // For dollars in locales such as 'fr',
40
+ // this will limit the display to just the dollar sign
41
+ // (otherwise it will render e.g. '2,50 $US' instead of '2,50 $').
42
+ ,
43
+ currencyDisplay: "narrowSymbol",
44
+ value: fare // eslint-disable-next-line react/style-prop-object
45
+ ,
46
+ style: "currency"
47
+ });
48
+ }
49
+ /**
50
+ * Helper function to specify the link to dietary table.
51
+ */
52
+
53
+
54
+ function dietaryLink(contents) {
55
+ return /*#__PURE__*/React.createElement("a", {
56
+ href: "https://health.gov/dietaryguidelines/dga2005/document/html/chapter3.htm#table4",
57
+ rel: "noopener noreferrer",
58
+ target: "_blank"
59
+ }, contents);
60
+ }
61
+ /**
62
+ * Helper function that assembles values for flex pickup/dropoff messages.
63
+ */
64
+
65
+
66
+ function getFlexMessageValues(info) {
67
+ var _info$contactInfo, _info$contactInfo2;
68
+
69
+ return {
70
+ hasLeadTime: coreUtils.itinerary.isAdvanceBookingRequired(info),
71
+ hasPhone: !!(info !== null && info !== void 0 && (_info$contactInfo = info.contactInfo) !== null && _info$contactInfo !== void 0 && _info$contactInfo.phoneNumber),
72
+ leadDays: info.latestBookingTime.daysPrior,
73
+ phoneNumber: info === null || info === void 0 ? void 0 : (_info$contactInfo2 = info.contactInfo) === null || _info$contactInfo2 === void 0 ? void 0 : _info$contactInfo2.phoneNumber
74
+ };
75
+ }
76
+ /**
77
+ * Default rendering if no component is provided for the CaloriesDetails
78
+ * slot in the TripDetails component.
79
+ */
80
+
81
+
82
+ function DefaultCaloriesDetails(_ref) {
83
+ var bikeSeconds = _ref.bikeSeconds,
84
+ calories = _ref.calories,
85
+ walkSeconds = _ref.walkSeconds;
86
+ return /*#__PURE__*/React.createElement(FormattedMessage, {
87
+ defaultMessage: defaultMessages["otpUi.TripDetails.caloriesDescription"],
88
+ description: "Text describing how the calories relate to the walking and biking duration of a trip.",
89
+ id: "otpUi.TripDetails.caloriesDescription",
90
+ values: {
91
+ bikeMinutes: Math.round(bikeSeconds / 60),
92
+ calories: Math.round(calories),
93
+ dietaryLink: dietaryLink,
94
+ strong: boldText,
95
+ walkMinutes: Math.round(walkSeconds / 60)
96
+ }
97
+ });
98
+ }
99
+ /**
100
+ * Helper component that renders a transit fare entry.
101
+ */
102
+
103
+
104
+ var TransitFare = function TransitFare(_ref2) {
105
+ var fareKey = _ref2.fareKey,
106
+ fareNameFallback = _ref2.fareNameFallback,
107
+ fareKeyNameMap = _ref2.fareKeyNameMap,
108
+ transitFares = _ref2.transitFares;
109
+ var currentFare = transitFares[fareKey];
110
+ return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedMessage, {
111
+ defaultMessage: defaultMessages["otpUi.TripDetails.transitFareEntry"],
112
+ description: "Text showing the price of tickets on public transportation.",
113
+ id: "otpUi.TripDetails.transitFareEntry",
114
+ values: {
115
+ name: fareKeyNameMap[fareKey] || fareNameFallback || fareKey,
116
+ strong: boldText,
117
+ value: renderFare(currentFare.currencyCode, currentFare.transitFare / 100)
118
+ }
119
+ }));
120
+ };
121
+ /**
122
+ * Renders trip details such as departure instructions, fare amount, and calories spent.
123
+ */
124
+
125
+
126
+ export function TripDetails(_ref3) {
127
+ var _ref3$CaloriesDetails = _ref3.CaloriesDetails,
128
+ CaloriesDetails = _ref3$CaloriesDetails === void 0 ? DefaultCaloriesDetails : _ref3$CaloriesDetails,
129
+ _ref3$className = _ref3.className,
130
+ className = _ref3$className === void 0 ? "" : _ref3$className,
131
+ _ref3$DepartureDetail = _ref3.DepartureDetails,
132
+ DepartureDetails = _ref3$DepartureDetail === void 0 ? null : _ref3$DepartureDetail,
133
+ _ref3$defaultFareKey = _ref3.defaultFareKey,
134
+ defaultFareKey = _ref3$defaultFareKey === void 0 ? "regular" : _ref3$defaultFareKey,
135
+ _ref3$FareDetails = _ref3.FareDetails,
136
+ FareDetails = _ref3$FareDetails === void 0 ? null : _ref3$FareDetails,
137
+ _ref3$fareKeyNameMap = _ref3.fareKeyNameMap,
138
+ fareKeyNameMap = _ref3$fareKeyNameMap === void 0 ? {} : _ref3$fareKeyNameMap,
139
+ itinerary = _ref3.itinerary;
140
+ // process the transit fare
141
+ var fareResult = coreUtils.itinerary.calculateFares(itinerary, true);
142
+ var maxTNCFare = fareResult.maxTNCFare,
143
+ minTNCFare = fareResult.minTNCFare,
144
+ tncCurrencyCode = fareResult.tncCurrencyCode,
145
+ transitFares = fareResult.transitFares;
146
+ var defaultFare = defaultFareKey;
147
+
148
+ if (!transitFares[defaultFareKey]) {
149
+ defaultFare = "regular";
150
+ }
151
+
152
+ var companies = "";
26
153
  itinerary.legs.forEach(function (leg) {
27
154
  if (leg.tncData) {
28
155
  companies = leg.tncData.company;
29
156
  }
30
157
  });
31
158
  var fare;
159
+ var fareKeys = transitFares && Object.keys(transitFares).sort();
160
+
161
+ if (transitFares && fareKeys.length > 0) {
162
+ // Depending on if there are additional fares to display either render a <span> or a <details>
163
+ var TransitFareWrapper = transitFares && fareKeys.length > 1 ? S.TransitFare : S.TransitFareSingle;
164
+ fare = /*#__PURE__*/React.createElement(S.Fare, null, /*#__PURE__*/React.createElement(TransitFareWrapper, null, /*#__PURE__*/React.createElement("summary", {
165
+ style: {
166
+ display: fareKeys.length > 1 ? "list-item" : ""
167
+ }
168
+ }, /*#__PURE__*/React.createElement(TransitFare, {
169
+ fareNameFallback: /*#__PURE__*/React.createElement(FormattedMessage, {
170
+ defaultMessage: defaultMessages["otpUi.TripDetails.transitFare"],
171
+ description: "Text showing the price of tickets on public transportation.",
172
+ id: "otpUi.TripDetails.transitFare"
173
+ }),
174
+ fareKey: defaultFare,
175
+ fareKeyNameMap: fareKeyNameMap,
176
+ transitFares: transitFares
177
+ })), fareKeys.map(function (fareKey) {
178
+ // Don't show the default fare twice!
179
+ if (fareKey === defaultFare) {
180
+ return null;
181
+ }
32
182
 
33
- if (transitFare || minTNCFare) {
34
- fare = /*#__PURE__*/React.createElement(Styled.Fare, null, transitFare && /*#__PURE__*/React.createElement(Styled.TransitFare, null, messages.transitFare, ": ", /*#__PURE__*/React.createElement("b", null, centsToString(transitFare))), minTNCFare !== 0 && /*#__PURE__*/React.createElement(Styled.TNCFare, null, /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Styled.TNCFareCompanies, null, companies.toLowerCase()), " ", messages.fare, ":", " ", /*#__PURE__*/React.createElement("b", null, dollarsToString(minTNCFare), " - ", dollarsToString(maxTNCFare))));
35
- } // Compute calories burned.
183
+ return /*#__PURE__*/React.createElement(TransitFare, {
184
+ fareKey: fareKey,
185
+ key: fareKey,
186
+ fareKeyNameMap: fareKeyNameMap,
187
+ transitFares: transitFares
188
+ });
189
+ })), minTNCFare !== 0 && /*#__PURE__*/React.createElement(S.TNCFare, null, /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(FormattedMessage, {
190
+ defaultMessage: defaultMessages["otpUi.TripDetails.tncFare"],
191
+ description: "Text showing the price paid to transportation network companies.",
192
+ id: "otpUi.TripDetails.tncFare",
193
+ values: {
194
+ companies:
195
+ /*#__PURE__*/
196
+ // S.TNCFareCompanies capitalizes the TNC company ID (e.g. "COMPANY")
197
+ // after it is converted to lowercase, so it renders as "Company".
198
+ React.createElement(S.TNCFareCompanies, null, companies.toLowerCase()),
199
+ maxTNCFare: renderFare(tncCurrencyCode, maxTNCFare),
200
+ minTNCFare: renderFare(tncCurrencyCode, minTNCFare),
201
+ strong: boldText
202
+ }
203
+ })));
204
+ }
36
205
 
206
+ var departureDate = new Date(itinerary.startTime); // Compute calories burned.
37
207
 
38
- var _coreUtils$itinerary$2 = coreUtils.itinerary.calculatePhysicalActivity(itinerary),
39
- bikeDuration = _coreUtils$itinerary$2.bikeDuration,
40
- caloriesBurned = _coreUtils$itinerary$2.caloriesBurned,
41
- walkDuration = _coreUtils$itinerary$2.walkDuration;
208
+ var _coreUtils$itinerary$ = coreUtils.itinerary.calculatePhysicalActivity(itinerary),
209
+ bikeDuration = _coreUtils$itinerary$.bikeDuration,
210
+ caloriesBurned = _coreUtils$itinerary$.caloriesBurned,
211
+ walkDuration = _coreUtils$itinerary$.walkDuration; // Parse flex info and generate appropriate strings
42
212
 
43
- return /*#__PURE__*/React.createElement(Styled.TripDetails, {
213
+
214
+ var containsFlex = itinerary.legs.some(coreUtils.itinerary.isFlex);
215
+ var pickupBookingInfo = itinerary.legs.map(function (leg) {
216
+ return leg.pickupBookingInfo;
217
+ }).filter(function (info) {
218
+ return !!info;
219
+ });
220
+ var dropOffBookingInfo = itinerary.legs.map(function (leg) {
221
+ return leg.dropOffBookingInfo;
222
+ }).filter(function (info) {
223
+ return !!info;
224
+ });
225
+ return /*#__PURE__*/React.createElement(S.TripDetails, {
44
226
  className: className
45
- }, /*#__PURE__*/React.createElement(Styled.TripDetailsHeader, null, messages.title), /*#__PURE__*/React.createElement(Styled.TripDetailsBody, null, /*#__PURE__*/React.createElement(TripDetail, {
46
- description: messages.departDescription,
227
+ }, /*#__PURE__*/React.createElement(S.TripDetailsHeader, null, /*#__PURE__*/React.createElement(FormattedMessage, {
228
+ defaultMessage: defaultMessages["otpUi.TripDetails.title"],
229
+ description: "Title (heading) text of the component.",
230
+ id: "otpUi.TripDetails.title"
231
+ })), /*#__PURE__*/React.createElement(S.TripDetailsBody, null, /*#__PURE__*/React.createElement(TripDetail // Any custom description for the Departure message needs to be handled by the slot.
232
+ , {
233
+ description: DepartureDetails && /*#__PURE__*/React.createElement(DepartureDetails, {
234
+ departureDate: departureDate
235
+ }),
47
236
  icon: /*#__PURE__*/React.createElement(CalendarAlt, {
48
237
  size: 17
49
238
  }),
50
- summary: /*#__PURE__*/React.createElement(Styled.Timing, null, /*#__PURE__*/React.createElement("span", null, messages.depart, " ", /*#__PURE__*/React.createElement("b", null, date.format(longDateFormat))), routingType === "ITINERARY" && /*#__PURE__*/React.createElement("span", null, " ", messages.at, " ", /*#__PURE__*/React.createElement("b", null, coreUtils.time.formatTime(itinerary.startTime, timeOptions))))
51
- }), fare && /*#__PURE__*/React.createElement(TripDetail, {
52
- description: messages.transitFareDescription,
239
+ summary: /*#__PURE__*/React.createElement(S.Timing, null, /*#__PURE__*/React.createElement(FormattedMessage, {
240
+ defaultMessage: defaultMessages["otpUi.TripDetails.departure"],
241
+ description: "Text showing the departure date/time for a trip.",
242
+ id: "otpUi.TripDetails.departure",
243
+ values: {
244
+ departureDate: departureDate,
245
+ strong: boldText
246
+ }
247
+ }))
248
+ }), fare && /*#__PURE__*/React.createElement(TripDetail // Any custom description for the transit fare needs to be handled by the slot.
249
+ , {
250
+ description: FareDetails && /*#__PURE__*/React.createElement(FareDetails, {
251
+ maxTNCFare: maxTNCFare,
252
+ minTNCFare: minTNCFare,
253
+ transitFares: transitFares
254
+ }),
53
255
  icon: /*#__PURE__*/React.createElement(MoneyBillAlt, {
54
256
  size: 17
55
257
  }),
@@ -58,66 +260,62 @@ export default function TripDetails(_ref) {
58
260
  icon: /*#__PURE__*/React.createElement(Heartbeat, {
59
261
  size: 17
60
262
  }),
61
- summary: /*#__PURE__*/React.createElement(Styled.CaloriesSummary, null, messages.caloriesBurned, ": ", /*#__PURE__*/React.createElement("b", null, Math.round(caloriesBurned))),
62
- description: /*#__PURE__*/React.createElement(Styled.CaloriesDescription, null, "Calories burned is based on", " ", /*#__PURE__*/React.createElement("b", null, Math.round(walkDuration / 60), " minute(s)"), " spent walking and ", /*#__PURE__*/React.createElement("b", null, Math.round(bikeDuration / 60), " minute(s)"), " spent biking during this trip. Adapted from", " ", /*#__PURE__*/React.createElement("a", {
63
- href: "https://health.gov/dietaryguidelines/dga2005/document/html/chapter3.htm#table4",
64
- rel: "noopener noreferrer",
65
- target: "_blank"
66
- }, "Dietary Guidelines for Americans 2005, page 16, Table 4"), ".")
263
+ summary: /*#__PURE__*/React.createElement(S.CaloriesSummary, null, /*#__PURE__*/React.createElement(FormattedMessage, {
264
+ defaultMessage: defaultMessages["otpUi.TripDetails.calories"],
265
+ description: "Text showing the number of calories for the walking and biking legs of a trip.",
266
+ id: "otpUi.TripDetails.calories",
267
+ values: {
268
+ calories: caloriesBurned,
269
+ strong: boldText
270
+ }
271
+ })),
272
+ description: CaloriesDetails && /*#__PURE__*/React.createElement(CaloriesDetails, {
273
+ bikeSeconds: bikeDuration,
274
+ calories: caloriesBurned,
275
+ walkSeconds: walkDuration
276
+ })
277
+ }), containsFlex && /*#__PURE__*/React.createElement(TripDetail, {
278
+ summary: /*#__PURE__*/React.createElement(S.FlexSummary, null, /*#__PURE__*/React.createElement(FormattedMessage, {
279
+ defaultMessage: defaultMessages["otpUi.TripDetails.tripIncludesFlex"],
280
+ description: "Text stating that portions of the trip include a flex (on-demand) transit service.",
281
+ id: "otpUi.TripDetails.tripIncludesFlex"
282
+ })),
283
+ icon: /*#__PURE__*/React.createElement(Route, {
284
+ size: 17
285
+ })
286
+ }), pickupBookingInfo && pickupBookingInfo.map(function (info) {
287
+ return /*#__PURE__*/React.createElement(TripDetail, {
288
+ key: info.pickupMessage,
289
+ icon: /*#__PURE__*/React.createElement(PhoneVolume, {
290
+ size: 17
291
+ }),
292
+ summary: /*#__PURE__*/React.createElement(S.FlexPickupSummary, null, /*#__PURE__*/React.createElement(FormattedMessage, {
293
+ defaultMessage: defaultMessages["otpUi.TripDetails.flexPickupMessage"],
294
+ description: "Instructions for booking and boarding the flex (on-demand) transit service.",
295
+ id: "otpUi.TripDetails.flexPickupMessage",
296
+ values: getFlexMessageValues(info)
297
+ })),
298
+ description: info.pickupMessage
299
+ });
300
+ }), dropOffBookingInfo && dropOffBookingInfo.map(function (info) {
301
+ return /*#__PURE__*/React.createElement(TripDetail, {
302
+ description: info.dropOffMessage,
303
+ icon: coreUtils.itinerary.isAdvanceBookingRequired(info) ? /*#__PURE__*/React.createElement(PhoneVolume, {
304
+ size: 17
305
+ }) : /*#__PURE__*/React.createElement(HandPaper, {
306
+ size: 17
307
+ }),
308
+ key: info.dropOffMessage,
309
+ summary: /*#__PURE__*/React.createElement(S.FlexDropOffSummary, null, /*#__PURE__*/React.createElement(FormattedMessage, {
310
+ defaultMessage: defaultMessages["otpUi.TripDetails.flexDropOffMessage"],
311
+ description: "Instructions for getting off the flex (on-demand) transit service.",
312
+ id: "otpUi.TripDetails.flexDropOffMessage",
313
+ values: getFlexMessageValues(info)
314
+ }))
315
+ });
67
316
  })));
68
317
  }
69
- TripDetails.propTypes = {
70
- /** Used for additional styling with styled components for example. */
71
- className: PropTypes.string,
72
-
73
- /** Itinerary that the user has selected to view, contains multiple legs */
74
- itinerary: coreUtils.types.itineraryType.isRequired,
75
-
76
- /** the desired format to use for a long date */
77
- longDateFormat: PropTypes.string,
78
-
79
- /**
80
- * messages to use for l10n/i8n
81
- *
82
- * Note: messages with default null values included here for visibility.
83
- * Overriding with a truthy string value will cause the expandable help
84
- * message to appear in trip details.
85
- */
86
- messages: PropTypes.shape({
87
- at: PropTypes.string,
88
- caloriesBurned: PropTypes.string,
89
- // FIXME: Add templated string description.
90
- caloriesBurnedDescription: PropTypes.string,
91
- depart: PropTypes.string,
92
- departDescription: PropTypes.string,
93
- title: PropTypes.string,
94
- fare: PropTypes.string,
95
- transitFare: PropTypes.string,
96
- transitFareDescription: PropTypes.string
97
- }),
98
-
99
- /** whether the routing type is an itinerary or a profile result */
100
- routingType: PropTypes.string,
101
-
102
- /** Contains the preferred format string for time display and a timezone offset */
103
- timeOptions: coreUtils.types.timeOptionsType
104
- };
105
- TripDetails.defaultProps = {
106
- className: null,
107
- longDateFormat: null,
108
- messages: {
109
- at: "at",
110
- caloriesBurned: "Calories Burned",
111
- // FIXME: Add templated string description.
112
- caloriesBurnedDescription: null,
113
- depart: "Depart",
114
- departDescription: null,
115
- title: "Trip Details",
116
- fare: "Fare",
117
- transitFare: "Transit Fare",
118
- transitFareDescription: null
119
- },
120
- routingType: "ITINERARY",
121
- timeOptions: null
122
- };
318
+ export default TripDetails; // Rename styled components for export
319
+
320
+ export { S as Styled };
123
321
  //# sourceMappingURL=index.js.map
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["coreUtils","moment","PropTypes","React","CalendarAlt","Heartbeat","MoneyBillAlt","Styled","TripDetail","TripDetails","className","itinerary","longDateFormat","messages","routingType","timeOptions","date","startTime","mergeMessages","defaultProps","calculateFares","centsToString","dollarsToString","maxTNCFare","minTNCFare","transitFare","companies","legs","forEach","leg","tncData","company","fare","toLowerCase","calculatePhysicalActivity","bikeDuration","caloriesBurned","walkDuration","title","departDescription","depart","format","at","time","formatTime","transitFareDescription","Math","round","propTypes","string","types","itineraryType","isRequired","shape","caloriesBurnedDescription","timeOptionsType"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,6BAAtB;AACA,OAAOC,MAAP,MAAmB,QAAnB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA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AAC+C,MAJb;AAKxBT,IAAAA,MAAM,EAAEtC,SAAS,CAAC+C,MALM;AAMxBV,IAAAA,iBAAiB,EAAErC,SAAS,CAAC+C,MANL;AAOxBX,IAAAA,KAAK,EAAEpC,SAAS,CAAC+C,MAPO;AAQxBjB,IAAAA,IAAI,EAAE9B,SAAS,CAAC+C,MARQ;AASxBxB,IAAAA,WAAW,EAAEvB,SAAS,CAAC+C,MATC;AAUxBJ,IAAAA,sBAAsB,EAAE3C,SAAS,CAAC+C;AAVV,GAAhB,CAdY;;AA0BtB;AACAnC,EAAAA,WAAW,EAAEZ,SAAS,CAAC+C,MA3BD;;AA4BtB;AACAlC,EAAAA,WAAW,EAAEf,SAAS,CAACkD,KAAV,CAAgBK;AA7BP,CAAxB;AAgCA9C,WAAW,CAACU,YAAZ,GAA2B;AACzBT,EAAAA,SAAS,EAAE,IADc;AAEzBE,EAAAA,cAAc,EAAE,IAFS;AAGzBC,EAAAA,QAAQ,EAAE;AACR6B,IAAAA,EAAE,EAAE,IADI;AAERN,IAAAA,cAAc,EAAE,iBAFR;AAGR;AACAkB,IAAAA,yBAAyB,EAAE,IAJnB;AAKRd,IAAAA,MAAM,EAAE,QALA;AAMRD,IAAAA,iBAAiB,EAAE,IANX;AAORD,IAAAA,KAAK,EAAE,cAPC;AAQRN,IAAAA,IAAI,EAAE,MARE;AASRP,IAAAA,WAAW,EAAE,cATL;AAURoB,IAAAA,sBAAsB,EAAE;AAVhB,GAHe;AAezB/B,EAAAA,WAAW,EAAE,WAfY;AAgBzBC,EAAAA,WAAW,EAAE;AAhBY,CAA3B","sourcesContent":["import coreUtils from \"@opentripplanner/core-utils\";\nimport moment from \"moment\";\nimport PropTypes from \"prop-types\";\nimport React from \"react\";\nimport { CalendarAlt, Heartbeat, MoneyBillAlt } from \"styled-icons/fa-solid\";\n\nimport * as Styled from \"./styled\";\nimport TripDetail from \"./trip-detail\";\n\nexport default function TripDetails({\n className,\n itinerary,\n longDateFormat,\n messages,\n routingType,\n timeOptions\n}) {\n const date = moment(itinerary.startTime);\n messages = coreUtils.messages.mergeMessages(\n TripDetails.defaultProps.messages,\n messages\n );\n\n // process the transit fare\n const {\n centsToString,\n dollarsToString,\n maxTNCFare,\n minTNCFare,\n transitFare\n } = coreUtils.itinerary.calculateFares(itinerary);\n let companies;\n itinerary.legs.forEach(leg => {\n if (leg.tncData) {\n companies = leg.tncData.company;\n }\n });\n let fare;\n if (transitFare || minTNCFare) {\n fare = (\n <Styled.Fare>\n {transitFare && (\n <Styled.TransitFare>\n {messages.transitFare}: <b>{centsToString(transitFare)}</b>\n </Styled.TransitFare>\n )}\n {minTNCFare !== 0 && (\n <Styled.TNCFare>\n <br />\n <Styled.TNCFareCompanies>\n {companies.toLowerCase()}\n </Styled.TNCFareCompanies>{\" \"}\n {messages.fare}:{\" \"}\n <b>\n {dollarsToString(minTNCFare)} - {dollarsToString(maxTNCFare)}\n </b>\n </Styled.TNCFare>\n )}\n </Styled.Fare>\n );\n }\n\n // Compute calories burned.\n const {\n bikeDuration,\n caloriesBurned,\n walkDuration\n } = coreUtils.itinerary.calculatePhysicalActivity(itinerary);\n\n return (\n <Styled.TripDetails className={className}>\n <Styled.TripDetailsHeader>{messages.title}</Styled.TripDetailsHeader>\n <Styled.TripDetailsBody>\n <TripDetail\n description={messages.departDescription}\n icon={<CalendarAlt size={17} />}\n summary={\n <Styled.Timing>\n <span>\n {messages.depart} <b>{date.format(longDateFormat)}</b>\n </span>\n {routingType === \"ITINERARY\" && (\n <span>\n {\" \"}\n {messages.at}{\" \"}\n <b>\n {coreUtils.time.formatTime(\n itinerary.startTime,\n timeOptions\n )}\n </b>\n </span>\n )}\n </Styled.Timing>\n }\n />\n {fare && (\n <TripDetail\n description={messages.transitFareDescription}\n icon={<MoneyBillAlt size={17} />}\n summary={fare}\n />\n )}\n {caloriesBurned > 0 && (\n <TripDetail\n icon={<Heartbeat size={17} />}\n summary={\n <Styled.CaloriesSummary>\n {messages.caloriesBurned}: <b>{Math.round(caloriesBurned)}</b>\n </Styled.CaloriesSummary>\n }\n description={\n <Styled.CaloriesDescription>\n Calories burned is based on{\" \"}\n <b>{Math.round(walkDuration / 60)} minute(s)</b> spent walking\n and <b>{Math.round(bikeDuration / 60)} minute(s)</b> spent\n biking during this trip. Adapted from{\" \"}\n <a\n href=\"https://health.gov/dietaryguidelines/dga2005/document/html/chapter3.htm#table4\"\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n Dietary Guidelines for Americans 2005, page 16, Table 4\n </a>\n .\n </Styled.CaloriesDescription>\n }\n />\n )}\n </Styled.TripDetailsBody>\n </Styled.TripDetails>\n );\n}\n\nTripDetails.propTypes = {\n /** Used for additional styling with styled components for example. */\n className: PropTypes.string,\n /** Itinerary that the user has selected to view, contains multiple legs */\n itinerary: coreUtils.types.itineraryType.isRequired,\n /** the desired format to use for a long date */\n longDateFormat: PropTypes.string,\n /**\n * messages to use for l10n/i8n\n *\n * Note: messages with default null values included here for visibility.\n * Overriding with a truthy string value will cause the expandable help\n * message to appear in trip details.\n */\n messages: PropTypes.shape({\n at: PropTypes.string,\n caloriesBurned: PropTypes.string,\n // FIXME: Add templated string description.\n caloriesBurnedDescription: PropTypes.string,\n depart: PropTypes.string,\n departDescription: PropTypes.string,\n title: PropTypes.string,\n fare: PropTypes.string,\n transitFare: PropTypes.string,\n transitFareDescription: PropTypes.string\n }),\n /** whether the routing type is an itinerary or a profile result */\n routingType: PropTypes.string,\n /** Contains the preferred format string for time display and a timezone offset */\n timeOptions: coreUtils.types.timeOptionsType\n};\n\nTripDetails.defaultProps = {\n className: null,\n longDateFormat: null,\n messages: {\n at: \"at\",\n caloriesBurned: \"Calories Burned\",\n // FIXME: Add templated string description.\n caloriesBurnedDescription: null,\n depart: \"Depart\",\n departDescription: null,\n title: \"Trip Details\",\n fare: \"Fare\",\n transitFare: \"Transit Fare\",\n transitFareDescription: null\n },\n routingType: \"ITINERARY\",\n timeOptions: null\n};\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.tsx"],"names":["flatten","coreUtils","React","FormattedMessage","FormattedNumber","CalendarAlt","HandPaper","Heartbeat","MoneyBillAlt","PhoneVolume","Route","S","TripDetail","defaultEnglishMessages","defaultMessages","boldText","contents","renderFare","currencyCode","fare","dietaryLink","getFlexMessageValues","info","hasLeadTime","itinerary","isAdvanceBookingRequired","hasPhone","contactInfo","phoneNumber","leadDays","latestBookingTime","daysPrior","DefaultCaloriesDetails","bikeSeconds","calories","walkSeconds","bikeMinutes","Math","round","strong","walkMinutes","TransitFare","fareKey","fareNameFallback","fareKeyNameMap","transitFares","currentFare","name","value","transitFare","TripDetails","CaloriesDetails","className","DepartureDetails","defaultFareKey","FareDetails","fareResult","calculateFares","maxTNCFare","minTNCFare","tncCurrencyCode","defaultFare","companies","legs","forEach","leg","tncData","company","fareKeys","Object","keys","sort","length","TransitFareWrapper","TransitFareSingle","display","map","toLowerCase","departureDate","Date","startTime","calculatePhysicalActivity","bikeDuration","caloriesBurned","walkDuration","containsFlex","some","isFlex","pickupBookingInfo","filter","dropOffBookingInfo","pickupMessage","dropOffMessage","Styled"],"mappings":"AAAA,OAAOA,OAAP,MAAoB,MAApB,C,CACA;;AACA,OAAOC,SAAP,MAAsB,6BAAtB;AAEA,OAAOC,KAAP,MAAoC,OAApC;AACA,SAASC,gBAAT,EAA2BC,eAA3B,QAAkD,YAAlD;AACA,SAASC,WAAT,QAA4B,oCAA5B;AACA,SAASC,SAAT,QAA0B,kCAA1B;AACA,SAASC,SAAT,QAA0B,kCAA1B;AACA,SAASC,YAAT,QAA6B,qCAA7B;AACA,SAASC,WAAT,QAA4B,oCAA5B;AACA,SAASC,KAAT,QAAsB,8BAAtB;AAEA,OAAO,KAAKC,CAAZ,MAAmB,UAAnB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AAQA;AACA,OAAOC,sBAAP,MAAmC,mBAAnC,C,CAEA;AACA;AACA;AACA;;AACA,IAAMC,eAAuC,GAAGd,OAAO,CAACa,sBAAD,CAAvD;AAEA;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,QAAA,IAAI,EAAE;AAAnB,QADF,gBAGE,oBAAC,SAAD;AAAW,QAAA,IAAI,EAAE;AAAjB,QANN;AASE,MAAA,GAAG,EAAEA,IAAI,CAACsE,cATZ;AAUE,MAAA,OAAO,eACL,oBAAC,CAAD,CAAG,kBAAH,qBACE,oBAAC,gBAAD;AACE,QAAA,cAAc,EACZ9E,eAAe,CAAC,sCAAD,CAFnB;AAIE,QAAA,WAAW,EAAC,oEAJd;AAKE,QAAA,EAAE,EAAC,sCALL;AAME,QAAA,MAAM,EAAEO,oBAAoB,CAACC,IAAD;AAN9B,QADF;AAXJ,MADyB;AAAA,GAA3B,CAvGJ,CARF,CADF;AA4ID;AAED,eAAe4B,WAAf,C,CAEA;;AACA,SAASvC,CAAC,IAAIkF,MAAd","sourcesContent":["import flatten from \"flat\";\n// @ts-expect-error FIXME: Create TypeScript types for core-utils packages.\nimport coreUtils from \"@opentripplanner/core-utils\";\nimport { FlexBookingInfo } from \"@opentripplanner/types\";\nimport React, { ReactElement } from \"react\";\nimport { FormattedMessage, FormattedNumber } from \"react-intl\";\nimport { CalendarAlt } from \"@styled-icons/fa-solid/CalendarAlt\";\nimport { HandPaper } from \"@styled-icons/fa-solid/HandPaper\";\nimport { Heartbeat } from \"@styled-icons/fa-solid/Heartbeat\";\nimport { MoneyBillAlt } from \"@styled-icons/fa-solid/MoneyBillAlt\";\nimport { PhoneVolume } from \"@styled-icons/fa-solid/PhoneVolume\";\nimport { Route } from \"@styled-icons/fa-solid/Route\";\n\nimport * as S from \"./styled\";\nimport TripDetail from \"./trip-detail\";\n\nimport {\n CaloriesDetailsProps,\n TransitFareProps,\n TripDetailsProps\n} from \"./types\";\n\n// Load the default messages.\nimport defaultEnglishMessages from \"../i18n/en-US.yml\";\n\n// HACK: We should flatten the messages loaded above because\n// the YAML loaders behave differently between webpack and our version of jest:\n// - the yaml loader for webpack returns a nested object,\n// - the yaml loader for jest returns messages with flattened ids.\nconst defaultMessages: Record<string, string> = flatten(defaultEnglishMessages);\n\n/**\n * Format text bold (used with FormattedMessage).\n */\n// TODO: Find a better place for this utility.\nfunction boldText(contents: ReactElement): ReactElement {\n return <strong>{contents}</strong>;\n}\n\n/**\n * Render formatted fare.\n * @param currencyCode The ISO currency code to use (USD, GBP, EUR).\n * @param fare The fare value, in currency units, to be shown.\n * @returns The formatted fare value according to the selected locale.\n */\nfunction renderFare(currencyCode: string, fare: number): ReactElement {\n return (\n <FormattedNumber\n currency={currencyCode}\n // For dollars in locales such as 'fr',\n // this will limit the display to just the dollar sign\n // (otherwise it will render e.g. '2,50 $US' instead of '2,50 $').\n currencyDisplay=\"narrowSymbol\"\n value={fare}\n // eslint-disable-next-line react/style-prop-object\n style=\"currency\"\n />\n );\n}\n\n/**\n * Helper function to specify the link to dietary table.\n */\nfunction dietaryLink(contents: ReactElement): ReactElement {\n return (\n <a\n href=\"https://health.gov/dietaryguidelines/dga2005/document/html/chapter3.htm#table4\"\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n {contents}\n </a>\n );\n}\n\n/**\n * Helper function that assembles values for flex pickup/dropoff messages.\n */\nfunction getFlexMessageValues(info: FlexBookingInfo) {\n return {\n hasLeadTime: coreUtils.itinerary.isAdvanceBookingRequired(info),\n hasPhone: !!info?.contactInfo?.phoneNumber,\n leadDays: info.latestBookingTime.daysPrior,\n phoneNumber: info?.contactInfo?.phoneNumber\n };\n}\n\n/**\n * Default rendering if no component is provided for the CaloriesDetails\n * slot in the TripDetails component.\n */\nfunction DefaultCaloriesDetails({\n bikeSeconds,\n calories,\n walkSeconds\n}: CaloriesDetailsProps): ReactElement {\n return (\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.caloriesDescription\"]}\n description=\"Text describing how the calories relate to the walking and biking duration of a trip.\"\n id=\"otpUi.TripDetails.caloriesDescription\"\n values={{\n bikeMinutes: Math.round(bikeSeconds / 60),\n calories: Math.round(calories),\n dietaryLink,\n strong: boldText,\n walkMinutes: Math.round(walkSeconds / 60)\n }}\n />\n );\n}\n\n/**\n * Helper component that renders a transit fare entry.\n */\nconst TransitFare = ({\n fareKey,\n fareNameFallback,\n fareKeyNameMap,\n transitFares\n}: TransitFareProps): ReactElement => {\n const currentFare = transitFares[fareKey];\n\n return (\n <span>\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.transitFareEntry\"]}\n description=\"Text showing the price of tickets on public transportation.\"\n id=\"otpUi.TripDetails.transitFareEntry\"\n values={{\n name: fareKeyNameMap[fareKey] || fareNameFallback || fareKey,\n strong: boldText,\n value: renderFare(\n currentFare.currencyCode,\n currentFare.transitFare / 100\n )\n }}\n />\n </span>\n );\n};\n\n/**\n * Renders trip details such as departure instructions, fare amount, and calories spent.\n */\nexport function TripDetails({\n CaloriesDetails = DefaultCaloriesDetails,\n className = \"\",\n DepartureDetails = null,\n defaultFareKey = \"regular\",\n FareDetails = null,\n fareKeyNameMap = {},\n itinerary\n}: TripDetailsProps): ReactElement {\n // process the transit fare\n const fareResult = coreUtils.itinerary.calculateFares(itinerary, true);\n const { maxTNCFare, minTNCFare, tncCurrencyCode, transitFares } = fareResult;\n\n let defaultFare = defaultFareKey;\n if (!transitFares[defaultFareKey]) {\n defaultFare = \"regular\";\n }\n\n let companies = \"\";\n itinerary.legs.forEach(leg => {\n if (leg.tncData) {\n companies = leg.tncData.company;\n }\n });\n let fare;\n\n const fareKeys = transitFares && Object.keys(transitFares).sort();\n\n if (transitFares && fareKeys.length > 0) {\n // Depending on if there are additional fares to display either render a <span> or a <details>\n const TransitFareWrapper =\n transitFares && fareKeys.length > 1 ? S.TransitFare : S.TransitFareSingle;\n\n fare = (\n <S.Fare>\n <TransitFareWrapper>\n <summary style={{ display: fareKeys.length > 1 ? \"list-item\" : \"\" }}>\n <TransitFare\n fareNameFallback={\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.transitFare\"]\n }\n description=\"Text showing the price of tickets on public transportation.\"\n id=\"otpUi.TripDetails.transitFare\"\n />\n }\n fareKey={defaultFare}\n fareKeyNameMap={fareKeyNameMap}\n transitFares={transitFares}\n />\n </summary>\n {fareKeys.map(fareKey => {\n // Don't show the default fare twice!\n if (fareKey === defaultFare) {\n return null;\n }\n return (\n <TransitFare\n fareKey={fareKey}\n key={fareKey}\n fareKeyNameMap={fareKeyNameMap}\n transitFares={transitFares}\n />\n );\n })}\n </TransitFareWrapper>\n {minTNCFare !== 0 && (\n <S.TNCFare>\n <br />\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.tncFare\"]}\n description=\"Text showing the price paid to transportation network companies.\"\n id=\"otpUi.TripDetails.tncFare\"\n values={{\n companies: (\n // S.TNCFareCompanies capitalizes the TNC company ID (e.g. \"COMPANY\")\n // after it is converted to lowercase, so it renders as \"Company\".\n <S.TNCFareCompanies>\n {companies.toLowerCase()}\n </S.TNCFareCompanies>\n ),\n maxTNCFare: renderFare(tncCurrencyCode, maxTNCFare),\n minTNCFare: renderFare(tncCurrencyCode, minTNCFare),\n strong: boldText\n }}\n />\n </S.TNCFare>\n )}\n </S.Fare>\n );\n }\n\n const departureDate = new Date(itinerary.startTime);\n\n // Compute calories burned.\n const {\n bikeDuration,\n caloriesBurned,\n walkDuration\n } = coreUtils.itinerary.calculatePhysicalActivity(itinerary);\n\n // Parse flex info and generate appropriate strings\n const containsFlex = itinerary.legs.some(coreUtils.itinerary.isFlex);\n const pickupBookingInfo = itinerary.legs\n .map(leg => leg.pickupBookingInfo)\n .filter(info => !!info);\n const dropOffBookingInfo = itinerary.legs\n .map(leg => leg.dropOffBookingInfo)\n .filter(info => !!info);\n\n return (\n <S.TripDetails className={className}>\n <S.TripDetailsHeader>\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.title\"]}\n description=\"Title (heading) text of the component.\"\n id=\"otpUi.TripDetails.title\"\n />\n </S.TripDetailsHeader>\n <S.TripDetailsBody>\n <TripDetail\n // Any custom description for the Departure message needs to be handled by the slot.\n description={\n DepartureDetails && (\n <DepartureDetails departureDate={departureDate} />\n )\n }\n icon={<CalendarAlt size={17} />}\n summary={\n <S.Timing>\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.departure\"]}\n description=\"Text showing the departure date/time for a trip.\"\n id=\"otpUi.TripDetails.departure\"\n values={{\n departureDate,\n strong: boldText\n }}\n />\n </S.Timing>\n }\n />\n {fare && (\n <TripDetail\n // Any custom description for the transit fare needs to be handled by the slot.\n description={\n FareDetails && (\n <FareDetails\n maxTNCFare={maxTNCFare}\n minTNCFare={minTNCFare}\n transitFares={transitFares}\n />\n )\n }\n icon={<MoneyBillAlt size={17} />}\n summary={fare}\n />\n )}\n {caloriesBurned > 0 && (\n <TripDetail\n icon={<Heartbeat size={17} />}\n summary={\n <S.CaloriesSummary>\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.calories\"]}\n description=\"Text showing the number of calories for the walking and biking legs of a trip.\"\n id=\"otpUi.TripDetails.calories\"\n values={{\n calories: caloriesBurned,\n strong: boldText\n }}\n />\n </S.CaloriesSummary>\n }\n description={\n CaloriesDetails && (\n <CaloriesDetails\n bikeSeconds={bikeDuration}\n calories={caloriesBurned}\n walkSeconds={walkDuration}\n />\n )\n }\n />\n )}\n {containsFlex && (\n <TripDetail\n summary={\n <S.FlexSummary>\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.tripIncludesFlex\"]\n }\n description=\"Text stating that portions of the trip include a flex (on-demand) transit service.\"\n id=\"otpUi.TripDetails.tripIncludesFlex\"\n />\n </S.FlexSummary>\n }\n icon={<Route size={17} />}\n />\n )}\n {pickupBookingInfo &&\n pickupBookingInfo.map(info => (\n <TripDetail\n key={info.pickupMessage}\n icon={<PhoneVolume size={17} />}\n summary={\n <S.FlexPickupSummary>\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.flexPickupMessage\"]\n }\n description=\"Instructions for booking and boarding the flex (on-demand) transit service.\"\n id=\"otpUi.TripDetails.flexPickupMessage\"\n values={getFlexMessageValues(info)}\n />\n </S.FlexPickupSummary>\n }\n description={info.pickupMessage}\n />\n ))}\n {dropOffBookingInfo &&\n dropOffBookingInfo.map(info => (\n <TripDetail\n description={info.dropOffMessage}\n icon={\n coreUtils.itinerary.isAdvanceBookingRequired(info) ? (\n <PhoneVolume size={17} />\n ) : (\n <HandPaper size={17} />\n )\n }\n key={info.dropOffMessage}\n summary={\n <S.FlexDropOffSummary>\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.flexDropOffMessage\"]\n }\n description=\"Instructions for getting off the flex (on-demand) transit service.\"\n id=\"otpUi.TripDetails.flexDropOffMessage\"\n values={getFlexMessageValues(info)}\n />\n </S.FlexDropOffSummary>\n }\n />\n ))}\n </S.TripDetailsBody>\n </S.TripDetails>\n );\n}\n\nexport default TripDetails;\n\n// Rename styled components for export\nexport { S as Styled };\n"],"file":"index.js"}
package/esm/styled.js CHANGED
@@ -1,72 +1,88 @@
1
1
  import styled from "styled-components";
2
2
  var BaseButton = styled.button.withConfig({
3
3
  displayName: "styled__BaseButton",
4
- componentId: "sr23bt-0"
4
+ componentId: "sc-6q2ok2-0"
5
5
  })(["background:transparent;border:0;cursor:pointer;display:inline-block;font-size:14px;font-weight:400;line-height:1.42857143;margin:0;padding:0;text-decoration:none;touch-action:manipulation;user-select:none;vertical-align:middle;white-space:nowrap;"]);
6
6
  export var CaloriesDescription = styled.span.withConfig({
7
7
  displayName: "styled__CaloriesDescription",
8
- componentId: "sr23bt-1"
8
+ componentId: "sc-6q2ok2-1"
9
9
  })([""]);
10
10
  export var CaloriesSummary = styled.span.withConfig({
11
11
  displayName: "styled__CaloriesSummary",
12
- componentId: "sr23bt-2"
12
+ componentId: "sc-6q2ok2-2"
13
13
  })([""]);
14
14
  export var ExpandButton = styled(BaseButton).attrs({
15
15
  "aria-label": "What does this mean?"
16
16
  }).withConfig({
17
17
  displayName: "styled__ExpandButton",
18
- componentId: "sr23bt-3"
18
+ componentId: "sc-6q2ok2-3"
19
19
  })(["color:#00f;font-size:16px;margin-left:6px;margin-top:-2px;"]);
20
20
  export var Fare = styled.span.withConfig({
21
21
  displayName: "styled__Fare",
22
- componentId: "sr23bt-4"
22
+ componentId: "sc-6q2ok2-4"
23
23
  })([""]);
24
24
  export var HideButton = styled(BaseButton).withConfig({
25
25
  displayName: "styled__HideButton",
26
- componentId: "sr23bt-5"
26
+ componentId: "sc-6q2ok2-5"
27
27
  })(["float:right;"]);
28
28
  export var TNCFare = styled.span.withConfig({
29
29
  displayName: "styled__TNCFare",
30
- componentId: "sr23bt-6"
30
+ componentId: "sc-6q2ok2-6"
31
31
  })([""]);
32
32
  export var TNCFareCompanies = styled.span.withConfig({
33
33
  displayName: "styled__TNCFareCompanies",
34
- componentId: "sr23bt-7"
34
+ componentId: "sc-6q2ok2-7"
35
35
  })(["text-transform:capitalize;"]);
36
36
  export var Timing = styled.span.withConfig({
37
37
  displayName: "styled__Timing",
38
- componentId: "sr23bt-8"
38
+ componentId: "sc-6q2ok2-8"
39
39
  })([""]);
40
- export var TransitFare = styled.span.withConfig({
40
+ export var TransitFare = styled.details.withConfig({
41
41
  displayName: "styled__TransitFare",
42
- componentId: "sr23bt-9"
42
+ componentId: "sc-6q2ok2-9"
43
+ })(["display:inline-block;> span{display:block;padding-left:1.75ch;}"]);
44
+ export var TransitFareSingle = styled.span.withConfig({
45
+ displayName: "styled__TransitFareSingle",
46
+ componentId: "sc-6q2ok2-10"
47
+ })([""]);
48
+ export var FlexSummary = styled.span.withConfig({
49
+ displayName: "styled__FlexSummary",
50
+ componentId: "sc-6q2ok2-11"
51
+ })([""]);
52
+ export var FlexPickupSummary = styled.span.withConfig({
53
+ displayName: "styled__FlexPickupSummary",
54
+ componentId: "sc-6q2ok2-12"
55
+ })([""]);
56
+ export var FlexDropOffSummary = styled.span.withConfig({
57
+ displayName: "styled__FlexDropOffSummary",
58
+ componentId: "sc-6q2ok2-13"
43
59
  })([""]);
44
60
  export var TripDetail = styled.div.withConfig({
45
61
  displayName: "styled__TripDetail",
46
- componentId: "sr23bt-10"
62
+ componentId: "sc-6q2ok2-14"
47
63
  })(["margin-top:6px;"]);
48
64
  export var TripDetailDescription = styled.div.withConfig({
49
65
  displayName: "styled__TripDetailDescription",
50
- componentId: "sr23bt-11"
66
+ componentId: "sc-6q2ok2-15"
51
67
  })(["background-color:#fff;border:1px solid #888;font-size:12px;margin-top:2px;padding:8px;"]);
52
68
  export var TripDetailIcon = styled.div.withConfig({
53
69
  displayName: "styled__TripDetailIcon",
54
- componentId: "sr23bt-12"
70
+ componentId: "sc-6q2ok2-16"
55
71
  })(["float:left;font-size:17px;"]);
56
72
  export var TripDetails = styled.div.withConfig({
57
73
  displayName: "styled__TripDetails",
58
- componentId: "sr23bt-13"
74
+ componentId: "sc-6q2ok2-17"
59
75
  })(["background-color:#eee;border-radius:6px;margin-bottom:15px;margin-top:16px;padding:10px 16px;"]);
60
76
  export var TripDetailsBody = styled.div.withConfig({
61
77
  displayName: "styled__TripDetailsBody",
62
- componentId: "sr23bt-14"
78
+ componentId: "sc-6q2ok2-18"
63
79
  })([""]);
64
80
  export var TripDetailsHeader = styled.div.withConfig({
65
81
  displayName: "styled__TripDetailsHeader",
66
- componentId: "sr23bt-15"
82
+ componentId: "sc-6q2ok2-19"
67
83
  })(["font-size:18px;font-weight:600;"]);
68
84
  export var TripDetailSummary = styled.div.withConfig({
69
85
  displayName: "styled__TripDetailSummary",
70
- componentId: "sr23bt-16"
71
- })(["margin-left:28px;padding-top:2px;"]);
86
+ componentId: "sc-6q2ok2-20"
87
+ })(["margin-left:28px;padding-top:2px;display:flex;align-items:baseline;"]);
72
88
  //# sourceMappingURL=styled.js.map
package/esm/styled.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/styled.js"],"names":["styled","BaseButton","button","CaloriesDescription","span","CaloriesSummary","ExpandButton","attrs","Fare","HideButton","TNCFare","TNCFareCompanies","Timing","TransitFare","TripDetail","div","TripDetailDescription","TripDetailIc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AAO,IAAMI,eAAe,GAAGnB,MAAM,CAACe,GAAV;AAAA;AAAA;AAAA,QAArB;AAEP,OAAO,IAAMK,iBAAiB,GAAGpB,MAAM,CAACe,GAAV;AAAA;AAAA;AAAA,uCAAvB;AAKP,OAAO,IAAMM,iBAAiB,GAAGrB,MAAM,CAACe,GAAV;AAAA;AAAA;AAAA,yCAAvB","sourcesContent":["import styled from \"styled-components\";\n\nconst BaseButton = styled.button`\n background: transparent;\n border: 0;\n cursor: pointer;\n display: inline-block;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.42857143;\n margin: 0;\n padding: 0;\n text-decoration: none;\n touch-action: manipulation;\n user-select: none;\n vertical-align: middle;\n white-space: nowrap;\n`;\n\nexport const CaloriesDescription = styled.span``;\n\nexport const CaloriesSummary = styled.span``;\n\nexport const ExpandButton = styled(BaseButton).attrs({\n \"aria-label\": \"What does this mean?\"\n})`\n color: #00f;\n font-size: 16px;\n margin-left: 6px;\n margin-top: -2px;\n`;\n\nexport const Fare = styled.span``;\n\nexport const HideButton = styled(BaseButton)`\n float: right;\n`;\n\nexport const TNCFare = styled.span``;\n\nexport const TNCFareCompanies = styled.span`\n text-transform: capitalize;\n`;\n\nexport const Timing = styled.span``;\n\nexport const TransitFare = styled.span``;\n\nexport const TripDetail = styled.div`\n margin-top: 6px;\n`;\n\nexport const TripDetailDescription = styled.div`\n background-color: #fff;\n border: 1px solid #888;\n font-size: 12px;\n margin-top: 2px;\n padding: 8px;\n`;\n\nexport const TripDetailIcon = styled.div`\n float: left;\n font-size: 17px;\n`;\n\nexport const TripDetails = styled.div`\n background-color: #eee;\n border-radius: 6px;\n margin-bottom: 15px;\n margin-top: 16px;\n padding: 10px 16px;\n`;\n\nexport const TripDetailsBody = styled.div``;\n\nexport const TripDetailsHeader = styled.div`\n font-size: 18px;\n font-weight: 600;\n`;\n\nexport const TripDetailSummary = styled.div`\n margin-left: 28px;\n padding-top: 2px;\n`;\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../src/styled.ts"],"names":["styled","BaseButton","button","CaloriesDescription","span","CaloriesSummary","ExpandButton","attrs","Fare","HideButton","TNCFare","TNCFareCompanies","Timing","TransitFare","details","TransitFareSingle","FlexSummary","FlexPickupSummary","FlexDropOffSummary","TripDetail","div","TripDetailDescription","TripDetailIcon","TripDetails","TripDetailsBody","TripDetailsHeader","TripDetailSummary"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,mBAAnB;AAEA,IAAMC,UAAU,GAAGD,MAAM,CAACE,MAAV;AAAA;AAAA;AAAA,8PAAhB;AAiBA,OAAO,IAAMC,mBAAmB,GAAGH,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAAzB;AAEP,OAAO,IAAMC,eAAe,GAAGL,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAArB;AAEP,OAAO,IAAME,YAAY,GAAGN,MAAM,CAACC,UAAD,CAAN,CAAmBM,KAAnB,CAAyB;AACnD,gBAAc;AADqC,CAAzB,CAAH;AAAA;AAAA;AAAA,kEAAlB;AASP,OAAO,IAAMC,IAAI,GAAGR,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAAV;AAEP,OAAO,IAAMK,UAAU,GAAGT,MAAM,CAACC,UAAD,CAAT;AAAA;AAAA;AAAA,oBAAhB;AAIP,OAAO,IAAMS,OAAO,GAAGV,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAAb;AAEP,OAAO,IAAMO,gBAAgB,GAAGX,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,kCAAtB;AAIP,OAAO,IAAMQ,MAAM,GAAGZ,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAAZ;AAEP,OAAO,IAAMS,WAAW,GAAGb,MAAM,CAACc,OAAV;AAAA;AAAA;AAAA,uEAAjB;AAUP,OAAO,IAAMC,iBAAiB,GAAGf,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAAvB;AAEP,OAAO,IAAMY,WAAW,GAAGhB,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAAjB;AAEP,OAAO,IAAMa,iBAAiB,GAAGjB,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAAvB;AAEP,OAAO,IAAMc,kBAAkB,GAAGlB,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAAxB;AAEP,OAAO,IAAMe,UAAU,GAAGnB,MAAM,CAACoB,GAAV;AAAA;AAAA;AAAA,uBAAhB;AAIP,OAAO,IAAMC,qBAAqB,GAAGrB,MAAM,CAACoB,GAAV;AAAA;AAAA;AAAA,8FAA3B;AAQP,OAAO,IAAME,cAAc,GAAGtB,MAAM,CAACoB,GAAV;AAAA;AAAA;AAAA,kCAApB;AAKP,OAAO,IAAMG,WAAW,GAAGvB,MAAM,CAACoB,GAAV;AAAA;AAAA;AAAA,qGAAjB;AAQP,OAAO,IAAMI,eAAe,GAAGxB,MAAM,CAACoB,GAAV;AAAA;AAAA;AAAA,QAArB;AAEP,OAAO,IAAMK,iBAAiB,GAAGzB,MAAM,CAACoB,GAAV;AAAA;AAAA;AAAA,uCAAvB;AAKP,OAAO,IAAMM,iBAAiB,GAAG1B,MAAM,CAACoB,GAAV;AAAA;AAAA;AAAA,2EAAvB","sourcesContent":["import styled from \"styled-components\";\n\nconst BaseButton = styled.button`\n background: transparent;\n border: 0;\n cursor: pointer;\n display: inline-block;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.42857143;\n margin: 0;\n padding: 0;\n text-decoration: none;\n touch-action: manipulation;\n user-select: none;\n vertical-align: middle;\n white-space: nowrap;\n`;\n\nexport const CaloriesDescription = styled.span``;\n\nexport const CaloriesSummary = styled.span``;\n\nexport const ExpandButton = styled(BaseButton).attrs({\n \"aria-label\": \"What does this mean?\"\n})`\n color: #00f;\n font-size: 16px;\n margin-left: 6px;\n margin-top: -2px;\n`;\n\nexport const Fare = styled.span``;\n\nexport const HideButton = styled(BaseButton)`\n float: right;\n`;\n\nexport const TNCFare = styled.span``;\n\nexport const TNCFareCompanies = styled.span`\n text-transform: capitalize;\n`;\n\nexport const Timing = styled.span``;\n\nexport const TransitFare = styled.details`\n display: inline-block;\n\n > span {\n display: block;\n /* This may seem wrong, but this value gives the most aligned results */\n /* see: https://github.com/opentripplanner/otp-ui/pull/294#discussion_r742045851 */\n padding-left: 1.75ch;\n }\n`;\nexport const TransitFareSingle = styled.span``;\n\nexport const FlexSummary = styled.span``;\n\nexport const FlexPickupSummary = styled.span``;\n\nexport const FlexDropOffSummary = styled.span``;\n\nexport const TripDetail = styled.div`\n margin-top: 6px;\n`;\n\nexport const TripDetailDescription = styled.div`\n background-color: #fff;\n border: 1px solid #888;\n font-size: 12px;\n margin-top: 2px;\n padding: 8px;\n`;\n\nexport const TripDetailIcon = styled.div`\n float: left;\n font-size: 17px;\n`;\n\nexport const TripDetails = styled.div`\n background-color: #eee;\n border-radius: 6px;\n margin-bottom: 15px;\n margin-top: 16px;\n padding: 10px 16px;\n`;\n\nexport const TripDetailsBody = styled.div``;\n\nexport const TripDetailsHeader = styled.div`\n font-size: 18px;\n font-weight: 600;\n`;\n\nexport const TripDetailSummary = styled.div`\n margin-left: 28px;\n padding-top: 2px;\n display: flex;\n align-items: baseline;\n`;\n"],"file":"styled.js"}