@opentripplanner/trip-details 3.0.9 → 4.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.
- package/__mocks__/custom-english-messages.yml +11 -11
- package/esm/index.js +37 -47
- package/esm/index.js.map +1 -1
- package/esm/styled.js +19 -27
- package/esm/styled.js.map +1 -1
- package/esm/types.js.map +1 -1
- package/i18n/en-US.yml +7 -7
- package/i18n/es.yml +0 -7
- package/i18n/fr.yml +5 -8
- package/i18n/ko.yml +0 -6
- package/i18n/nb_NO.yml +0 -1
- package/i18n/vi.yml +0 -6
- package/i18n/zh_Hans.yml +0 -5
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +34 -45
- package/lib/index.js.map +1 -1
- package/lib/styled.d.ts +0 -2
- package/lib/styled.d.ts.map +1 -1
- package/lib/styled.js +20 -34
- package/lib/styled.js.map +1 -1
- package/lib/types.d.ts +13 -13
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +1 -1
- package/src/TripDetails.story.tsx +8 -13
- package/src/index.tsx +45 -57
- package/src/styled.ts +1 -4
- package/src/types.ts +14 -14
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# Example used to overwrite a subset of the messages from /i18n/en-US.yml.
|
|
2
1
|
otpUi:
|
|
3
2
|
TripDetails:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
tncFare: "Pay <strong>{minTNCFare}-{maxTNCFare}</strong> to {companies}"
|
|
3
|
+
departure: >-
|
|
4
|
+
<strong>Leave</strong> at <strong>{departureDate, time, short}</strong> on
|
|
5
|
+
<strong>{departureDate, date, long}</strong>
|
|
8
6
|
fareDetailsHeaders:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
cash: Cash
|
|
8
|
+
electronic: ORCA
|
|
9
|
+
regular: Regular
|
|
10
|
+
senior: Senior
|
|
11
|
+
special: LIFT
|
|
12
|
+
youth: Youth
|
|
13
|
+
title: Custom Trip Details Title
|
|
14
|
+
tncFare: Pay <strong>{minTNCFare}-{maxTNCFare}</strong> to {companies}
|
package/esm/index.js
CHANGED
|
@@ -19,17 +19,6 @@ import defaultEnglishMessages from "../i18n/en-US.yml"; // HACK: We should flatt
|
|
|
19
19
|
// - the yaml loader for jest returns messages with flattened ids.
|
|
20
20
|
|
|
21
21
|
var defaultMessages = flatten(defaultEnglishMessages);
|
|
22
|
-
/**
|
|
23
|
-
* Helper function to specify the link to dietary table.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
function dietaryLink(contents) {
|
|
27
|
-
return /*#__PURE__*/React.createElement("a", {
|
|
28
|
-
href: "https://health.gov/dietaryguidelines/dga2005/document/html/chapter3.htm#table4",
|
|
29
|
-
rel: "noopener noreferrer",
|
|
30
|
-
target: "_blank"
|
|
31
|
-
}, contents);
|
|
32
|
-
}
|
|
33
22
|
|
|
34
23
|
function CO2DescriptionLink(contents) {
|
|
35
24
|
return /*#__PURE__*/React.createElement("a", {
|
|
@@ -39,25 +28,22 @@ function CO2DescriptionLink(contents) {
|
|
|
39
28
|
}, contents);
|
|
40
29
|
}
|
|
41
30
|
/**
|
|
42
|
-
* Default rendering if no component is provided for the
|
|
31
|
+
* Default rendering if no component is provided for the TimeActiveDetails
|
|
43
32
|
* slot in the TripDetails component.
|
|
44
33
|
*/
|
|
45
34
|
|
|
46
35
|
|
|
47
|
-
function
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
walkSeconds = _ref.walkSeconds;
|
|
36
|
+
function DefaultTimeActiveDetails(_ref) {
|
|
37
|
+
var bikeMinutes = _ref.bikeMinutes,
|
|
38
|
+
walkMinutes = _ref.walkMinutes;
|
|
51
39
|
return /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
52
|
-
defaultMessage: defaultMessages["otpUi.TripDetails.
|
|
53
|
-
description: "Text describing
|
|
54
|
-
id: "otpUi.TripDetails.
|
|
40
|
+
defaultMessage: defaultMessages["otpUi.TripDetails.timeActiveDescription"],
|
|
41
|
+
description: "Text describing the walking and biking durations of a trip.",
|
|
42
|
+
id: "otpUi.TripDetails.timeActiveDescription",
|
|
55
43
|
values: {
|
|
56
|
-
bikeMinutes:
|
|
57
|
-
calories: Math.round(calories),
|
|
58
|
-
dietaryLink: dietaryLink,
|
|
44
|
+
bikeMinutes: bikeMinutes,
|
|
59
45
|
strong: boldText,
|
|
60
|
-
walkMinutes:
|
|
46
|
+
walkMinutes: walkMinutes
|
|
61
47
|
}
|
|
62
48
|
});
|
|
63
49
|
}
|
|
@@ -95,30 +81,30 @@ var TransitFare = function TransitFare(_ref2) {
|
|
|
95
81
|
}));
|
|
96
82
|
};
|
|
97
83
|
/**
|
|
98
|
-
* Renders trip details such as departure instructions, fare amount, and
|
|
84
|
+
* Renders trip details such as departure instructions, fare amount, and minutes active.
|
|
99
85
|
*/
|
|
100
86
|
|
|
101
87
|
|
|
102
88
|
export function TripDetails(_ref3) {
|
|
103
89
|
var _itinerary$fare;
|
|
104
90
|
|
|
105
|
-
var _ref3$
|
|
106
|
-
CaloriesDetails = _ref3$CaloriesDetails === void 0 ? DefaultCaloriesDetails : _ref3$CaloriesDetails,
|
|
107
|
-
_ref3$className = _ref3.className,
|
|
91
|
+
var _ref3$className = _ref3.className,
|
|
108
92
|
className = _ref3$className === void 0 ? "" : _ref3$className,
|
|
93
|
+
co2Config = _ref3.co2Config,
|
|
109
94
|
_ref3$defaultFareKey = _ref3.defaultFareKey,
|
|
110
95
|
defaultFareKey = _ref3$defaultFareKey === void 0 ? "regular" : _ref3$defaultFareKey,
|
|
111
|
-
_ref3$displayCalories = _ref3.displayCalories,
|
|
112
|
-
displayCalories = _ref3$displayCalories === void 0 ? true : _ref3$displayCalories,
|
|
113
96
|
_ref3$DepartureDetail = _ref3.DepartureDetails,
|
|
114
97
|
DepartureDetails = _ref3$DepartureDetail === void 0 ? null : _ref3$DepartureDetail,
|
|
98
|
+
_ref3$displayTimeActi = _ref3.displayTimeActive,
|
|
99
|
+
displayTimeActive = _ref3$displayTimeActi === void 0 ? true : _ref3$displayTimeActi,
|
|
115
100
|
_ref3$FareDetails = _ref3.FareDetails,
|
|
116
101
|
FareDetails = _ref3$FareDetails === void 0 ? null : _ref3$FareDetails,
|
|
117
102
|
fareDetailsLayout = _ref3.fareDetailsLayout,
|
|
118
103
|
_ref3$fareKeyNameMap = _ref3.fareKeyNameMap,
|
|
119
104
|
fareKeyNameMap = _ref3$fareKeyNameMap === void 0 ? {} : _ref3$fareKeyNameMap,
|
|
120
105
|
itinerary = _ref3.itinerary,
|
|
121
|
-
|
|
106
|
+
_ref3$TimeActiveDetai = _ref3.TimeActiveDetails,
|
|
107
|
+
TimeActiveDetails = _ref3$TimeActiveDetai === void 0 ? DefaultTimeActiveDetails : _ref3$TimeActiveDetai;
|
|
122
108
|
// process the transit fare
|
|
123
109
|
var fareResult = coreUtils.itinerary.calculateTncFares(itinerary);
|
|
124
110
|
var currencyCode = fareResult.currencyCode,
|
|
@@ -192,13 +178,18 @@ export function TripDetails(_ref3) {
|
|
|
192
178
|
})));
|
|
193
179
|
}
|
|
194
180
|
|
|
195
|
-
var departureDate = new Date(itinerary.startTime); // Compute
|
|
196
|
-
|
|
197
|
-
var _coreUtils$itinerary$ = coreUtils.itinerary.calculatePhysicalActivity(itinerary),
|
|
198
|
-
bikeDuration = _coreUtils$itinerary$.bikeDuration,
|
|
199
|
-
caloriesBurned = _coreUtils$itinerary$.caloriesBurned,
|
|
200
|
-
walkDuration = _coreUtils$itinerary$.walkDuration; // Calculate CO₂ if it's not provided by the itinerary
|
|
181
|
+
var departureDate = new Date(itinerary.startTime); // Compute total time spent active.
|
|
182
|
+
// TODO: separate into two reducers
|
|
201
183
|
|
|
184
|
+
var walkDurationSeconds = 0;
|
|
185
|
+
var bikeDurationSeconds = 0;
|
|
186
|
+
itinerary.legs.forEach(function (leg) {
|
|
187
|
+
if (leg.mode.startsWith("WALK")) walkDurationSeconds += leg.duration;
|
|
188
|
+
if (leg.mode.startsWith("BICYCLE")) bikeDurationSeconds += leg.duration;
|
|
189
|
+
});
|
|
190
|
+
var bikeMinutes = Math.round(bikeDurationSeconds / 60);
|
|
191
|
+
var walkMinutes = Math.round(walkDurationSeconds / 60);
|
|
192
|
+
var minutesActive = bikeMinutes + walkMinutes; // Calculate CO₂ if it's not provided by the itinerary
|
|
202
193
|
|
|
203
194
|
var co2 = itinerary.co2 || (co2Config === null || co2Config === void 0 ? void 0 : co2Config.enabled) && coreUtils.itinerary.calculateEmissions(itinerary, co2Config === null || co2Config === void 0 ? void 0 : co2Config.carbonIntensity, co2Config === null || co2Config === void 0 ? void 0 : co2Config.units); // Parse flex info and generate appropriate strings
|
|
204
195
|
|
|
@@ -252,23 +243,22 @@ export function TripDetails(_ref3) {
|
|
|
252
243
|
size: 17
|
|
253
244
|
}),
|
|
254
245
|
summary: fare
|
|
255
|
-
}),
|
|
246
|
+
}), displayTimeActive && minutesActive > 0 && /*#__PURE__*/React.createElement(TripDetail, {
|
|
256
247
|
icon: /*#__PURE__*/React.createElement(Heartbeat, {
|
|
257
248
|
size: 17
|
|
258
249
|
}),
|
|
259
|
-
summary: /*#__PURE__*/React.createElement(
|
|
260
|
-
defaultMessage: defaultMessages["otpUi.TripDetails.
|
|
261
|
-
description: "Text showing the number of
|
|
262
|
-
id: "otpUi.TripDetails.
|
|
250
|
+
summary: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
251
|
+
defaultMessage: defaultMessages["otpUi.TripDetails.minutesActive"],
|
|
252
|
+
description: "Text showing the number of minutes spent walking or biking throughout trip.",
|
|
253
|
+
id: "otpUi.TripDetails.minutesActive",
|
|
263
254
|
values: {
|
|
264
|
-
|
|
255
|
+
minutes: minutesActive,
|
|
265
256
|
strong: boldText
|
|
266
257
|
}
|
|
267
|
-
})
|
|
268
|
-
description:
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
walkSeconds: walkDuration
|
|
258
|
+
}),
|
|
259
|
+
description: TimeActiveDetails && /*#__PURE__*/React.createElement(TimeActiveDetails, {
|
|
260
|
+
bikeMinutes: bikeMinutes,
|
|
261
|
+
walkMinutes: walkMinutes
|
|
272
262
|
})
|
|
273
263
|
}), co2 > 0 && (co2Config === null || co2Config === void 0 ? void 0 : co2Config.enabled) && /*#__PURE__*/React.createElement(TripDetail, {
|
|
274
264
|
icon: /*#__PURE__*/React.createElement(Leaf, {
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.tsx"],"names":["flatten","coreUtils","React","FormattedMessage","FormattedNumber","CalendarAlt","Heartbeat","MoneyBillAlt","Leaf","Route","S","TripDetail","FareLegTable","boldText","renderFare","defaultEnglishMessages","defaultMessages","dietaryLink","contents","CO2DescriptionLink","DefaultCaloriesDetails","bikeSeconds","calories","walkSeconds","bikeMinutes","Math","round","strong","walkMinutes","TransitFare","fareKey","fareNameFallback","fareKeyNameMap","transitFares","currentFare","cents","name","value","currency","currencyCode","TripDetails","CaloriesDetails","className","defaultFareKey","displayCalories","DepartureDetails","FareDetails","fareDetailsLayout","itinerary","co2Config","fareResult","calculateTncFares","maxTNCFare","minTNCFare","fare","companies","legs","forEach","leg","tncData","company","fareKeys","Object","keys","sort","length","defaultFare","TransitFareWrapper","TransitFareSingle","display","map","toLowerCase","departureDate","Date","startTime","calculatePhysicalActivity","bikeDuration","caloriesBurned","walkDuration","co2","enabled","calculateEmissions","carbonIntensity","units","containsFlex","some","isFlex","pickupBookingInfo","filter","info","dropOffBookingInfo","totalDistance","reduce","total","distance","link","extraMessage","Set","message","join","Styled"],"mappings":";AAAA,OAAOA,OAAP,MAAoB,MAApB;AACA,OAAOC,SAAP,MAAsB,6BAAtB;AACA,OAAOC,KAAP,MAAoC,OAApC;AACA,SAASC,gBAAT,EAA2BC,eAA3B,QAAkD,YAAlD;AACA,SAASC,WAAT,QAA4B,oC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AAAA,iBAAIA,IAAI,CAACS,OAAT;AAAA,SAA1B,CADF,sBAEER,kBAAkB,CAACpB,GAAnB,CAAuB,UAAAmB,IAAI;AAAA,iBAAIA,IAAI,CAACS,OAAT;AAAA,SAA3B,CAFF,GADS,EAKZC,IALY,CAKP,GALO;AADR;AANV,MADF,CAFJ;AAoBE,IAAA,IAAI,eAAE,oBAAC,KAAD;AAAO,MAAA,IAAI,EAAE;AAAb;AApBR,IA1GJ,CATF,CADF;AA8ID;AAED,eAAe3D,WAAf,C,CAEA;;AACA,SAAS9B,CAAC,IAAI0F,MAAd,EAAsBxF,YAAtB","sourcesContent":["import flatten from \"flat\";\nimport coreUtils from \"@opentripplanner/core-utils\";\nimport React, { ReactElement } from \"react\";\nimport { FormattedMessage, FormattedNumber } from \"react-intl\";\nimport { CalendarAlt } from \"@styled-icons/fa-solid/CalendarAlt\";\nimport { Heartbeat } from \"@styled-icons/fa-solid/Heartbeat\";\nimport { MoneyBillAlt } from \"@styled-icons/fa-solid/MoneyBillAlt\";\nimport { Leaf } from \"@styled-icons/fa-solid/Leaf\";\nimport { Route } from \"@styled-icons/fa-solid/Route\";\n\nimport * as S from \"./styled\";\nimport TripDetail from \"./trip-detail\";\nimport FareLegTable from \"./fare-table\";\nimport { boldText, renderFare } from \"./utils\";\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 * 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\nfunction CO2DescriptionLink(contents: ReactElement): ReactElement {\n return (\n <a\n href=\"https://www.itf-oecd.org/sites/default/files/life-cycle-assessment-calculations-2020.xlsx\"\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n {contents}\n </a>\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 // TODO: Is this needed? Every implementation of TransitFare does a check for currentFare's existence, although not the cents field\n if (typeof currentFare?.cents !== \"number\") {\n return (\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.transitFareUnknown\"]}\n description=\"Text showing that no fare information is present.\"\n id=\"otpUi.TripDetails.transitFareUnknown\"\n />\n );\n }\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?.currency?.currencyCode || \"USD\",\n currentFare.cents / 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 defaultFareKey = \"regular\",\n displayCalories = true,\n DepartureDetails = null,\n FareDetails = null,\n fareDetailsLayout,\n fareKeyNameMap = {},\n itinerary,\n co2Config\n}: TripDetailsProps): ReactElement {\n // process the transit fare\n const fareResult = coreUtils.itinerary.calculateTncFares(itinerary);\n const { currencyCode, maxTNCFare, minTNCFare } = fareResult;\n const transitFares = itinerary?.fare?.fare;\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 let defaultFare = defaultFareKey;\n if (!transitFares[defaultFareKey]) {\n defaultFare = \"regular\";\n }\n\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 = transitFares?.[defaultFare] && (\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 {fareDetailsLayout ? (\n // Show full ƒare details by leg\n <FareLegTable layout={fareDetailsLayout} itinerary={itinerary} />\n ) : (\n // Just show the fares for each payment type\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 fareKeyNameMap={fareKeyNameMap}\n key={fareKey}\n transitFares={transitFares}\n />\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(currencyCode, maxTNCFare),\n minTNCFare: renderFare(currencyCode, 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 // Calculate CO₂ if it's not provided by the itinerary\n const co2 =\n itinerary.co2 ||\n (co2Config?.enabled &&\n coreUtils.itinerary.calculateEmissions(\n itinerary,\n co2Config?.carbonIntensity,\n co2Config?.units\n ));\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 const totalDistance = itinerary.legs.reduce(\n (total, leg) => total + leg.distance,\n 0\n );\n\n return (\n <S.TripDetails className={className}>\n {/* this can be presentation as S.TripDetails is already labeled by this */}\n <S.TripDetailsHeader id=\"trip-details-header\">\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 {displayCalories && 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 {co2 > 0 && co2Config?.enabled && (\n <TripDetail\n icon={<Leaf size={17} />}\n summary={\n <S.CO2Summary>\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.co2\"]}\n description=\"Text showing the quantity of CO₂ emitted by this trip.\"\n id=\"otpUi.TripDetails.co2\"\n values={{\n co2: (\n <FormattedNumber\n value={Math.round(co2)}\n // eslint-disable-next-line react/style-prop-object\n style=\"unit\"\n unit={co2Config?.units || \"gram\"}\n unitDisplay=\"narrow\"\n />\n ),\n strong: boldText\n }}\n />\n </S.CO2Summary>\n }\n description={\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.co2description\"]\n }\n description=\"Text explaining how the CO₂ emissions are calculated.\"\n id=\"otpUi.TripDetails.co2description\"\n values={{\n link: CO2DescriptionLink,\n totalDistance\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 values={{\n extraMessage: [\n ...new Set([\n ...pickupBookingInfo.map(info => info.message),\n ...dropOffBookingInfo.map(info => info.message)\n ])\n ].join(\" \")\n }}\n />\n </S.FlexSummary>\n }\n icon={<Route size={17} />}\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, FareLegTable };\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"names":["flatten","coreUtils","React","FormattedMessage","FormattedNumber","CalendarAlt","Heartbeat","MoneyBillAlt","Leaf","Route","S","TripDetail","FareLegTable","boldText","renderFare","defaultEnglishMessages","defaultMessages","CO2DescriptionLink","contents","DefaultTimeActiveDetails","bikeMinutes","walkMinutes","strong","TransitFare","fareKey","fareNameFallback","fareKeyNameMap","transitFares","currentFare","cents","name","value","currency","currencyCode","TripDetails","className","co2Config","defaultFareKey","DepartureDetails","displayTimeActive","FareDetails","fareDetailsLayout","itinerary","TimeActiveDetails","fareResult","calculateTncFares","maxTNCFare","minTNCFare","fare","companies","legs","forEach","leg","tncData","company","fareKeys","Object","keys","sort","length","defaultFare","TransitFareWrapper","TransitFareSingle","display","map","toLowerCase","departureDate","Date","startTime","walkDurationSeconds","bikeDurationSeconds","mode","startsWith","duration","Math","round","minutesActive","co2","enabled","calculateEmissions","carbonIntensity","units","containsFlex","some","isFlex","pickupBookingInfo","filter","info","dropOffBookingInfo","totalDistance","reduce","total","distance","minutes","link","extraMessage","Set","message","join","Styled"],"mappings":";AAAA,OAAOA,OAAP,MAAoB,MAApB;AACA,OAAOC,SAAP,MAAsB,6BAAtB;AACA,OAAOC,KA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sB,UAAAuB,IAAI;AAAA,iBAAIA,IAAI,CAACU,OAAT;AAAA,SAA1B,CADF,sBAEET,kBAAkB,CAACxB,GAAnB,CAAuB,UAAAuB,IAAI;AAAA,iBAAIA,IAAI,CAACU,OAAT;AAAA,SAA3B,CAFF,GADS,EAKZC,IALY,CAKP,GALO;AADR;AANV,MADF,CAFJ;AAoBE,IAAA,IAAI,eAAE,oBAAC,KAAD;AAAO,MAAA,IAAI,EAAE;AAAb;AApBR,IAzGJ,CATF,CADF;AA6ID;AAED,eAAehE,WAAf,C,CAEA;;AACA,SAASxB,CAAC,IAAIyF,MAAd,EAAsBvF,YAAtB","sourcesContent":["import flatten from \"flat\";\nimport coreUtils from \"@opentripplanner/core-utils\";\nimport React, { ReactElement } from \"react\";\nimport { FormattedMessage, FormattedNumber } from \"react-intl\";\nimport { CalendarAlt } from \"@styled-icons/fa-solid/CalendarAlt\";\nimport { Heartbeat } from \"@styled-icons/fa-solid/Heartbeat\";\nimport { MoneyBillAlt } from \"@styled-icons/fa-solid/MoneyBillAlt\";\nimport { Leaf } from \"@styled-icons/fa-solid/Leaf\";\nimport { Route } from \"@styled-icons/fa-solid/Route\";\n\nimport * as S from \"./styled\";\nimport TripDetail from \"./trip-detail\";\nimport FareLegTable from \"./fare-table\";\nimport { boldText, renderFare } from \"./utils\";\n\nimport {\n TimeActiveDetailsProps,\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\nfunction CO2DescriptionLink(contents: ReactElement): ReactElement {\n return (\n <a\n href=\"https://www.itf-oecd.org/sites/default/files/life-cycle-assessment-calculations-2020.xlsx\"\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n {contents}\n </a>\n );\n}\n/**\n * Default rendering if no component is provided for the TimeActiveDetails\n * slot in the TripDetails component.\n */\nfunction DefaultTimeActiveDetails({\n bikeMinutes,\n walkMinutes\n}: TimeActiveDetailsProps): ReactElement {\n return (\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.timeActiveDescription\"]\n }\n description=\"Text describing the walking and biking durations of a trip.\"\n id=\"otpUi.TripDetails.timeActiveDescription\"\n values={{\n bikeMinutes,\n strong: boldText,\n walkMinutes\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 // TODO: Is this needed? Every implementation of TransitFare does a check for currentFare's existence, although not the cents field\n if (typeof currentFare?.cents !== \"number\") {\n return (\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.transitFareUnknown\"]}\n description=\"Text showing that no fare information is present.\"\n id=\"otpUi.TripDetails.transitFareUnknown\"\n />\n );\n }\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?.currency?.currencyCode || \"USD\",\n currentFare.cents / 100\n )\n }}\n />\n </span>\n );\n};\n\n/**\n * Renders trip details such as departure instructions, fare amount, and minutes active.\n */\nexport function TripDetails({\n className = \"\",\n co2Config,\n defaultFareKey = \"regular\",\n DepartureDetails = null,\n displayTimeActive = true,\n FareDetails = null,\n fareDetailsLayout,\n fareKeyNameMap = {},\n itinerary,\n TimeActiveDetails = DefaultTimeActiveDetails\n}: TripDetailsProps): ReactElement {\n // process the transit fare\n const fareResult = coreUtils.itinerary.calculateTncFares(itinerary);\n const { currencyCode, maxTNCFare, minTNCFare } = fareResult;\n const transitFares = itinerary?.fare?.fare;\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 let defaultFare = defaultFareKey;\n if (!transitFares[defaultFareKey]) {\n defaultFare = \"regular\";\n }\n\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 = transitFares?.[defaultFare] && (\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 {fareDetailsLayout ? (\n // Show full ƒare details by leg\n <FareLegTable layout={fareDetailsLayout} itinerary={itinerary} />\n ) : (\n // Just show the fares for each payment type\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 fareKeyNameMap={fareKeyNameMap}\n key={fareKey}\n transitFares={transitFares}\n />\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(currencyCode, maxTNCFare),\n minTNCFare: renderFare(currencyCode, 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 total time spent active.\n\n // TODO: separate into two reducers\n let walkDurationSeconds = 0;\n let bikeDurationSeconds = 0;\n itinerary.legs.forEach(leg => {\n if (leg.mode.startsWith(\"WALK\")) walkDurationSeconds += leg.duration;\n if (leg.mode.startsWith(\"BICYCLE\")) bikeDurationSeconds += leg.duration;\n });\n const bikeMinutes = Math.round(bikeDurationSeconds / 60);\n const walkMinutes = Math.round(walkDurationSeconds / 60);\n const minutesActive = bikeMinutes + walkMinutes;\n\n // Calculate CO₂ if it's not provided by the itinerary\n const co2 =\n itinerary.co2 ||\n (co2Config?.enabled &&\n coreUtils.itinerary.calculateEmissions(\n itinerary,\n co2Config?.carbonIntensity,\n co2Config?.units\n ));\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 const totalDistance = itinerary.legs.reduce(\n (total, leg) => total + leg.distance,\n 0\n );\n\n return (\n <S.TripDetails className={className}>\n {/* this can be presentation as S.TripDetails is already labeled by this */}\n <S.TripDetailsHeader id=\"trip-details-header\">\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 {displayTimeActive && minutesActive > 0 && (\n <TripDetail\n icon={<Heartbeat size={17} />}\n summary={\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.minutesActive\"]\n }\n description=\"Text showing the number of minutes spent walking or biking throughout trip.\"\n id=\"otpUi.TripDetails.minutesActive\"\n values={{\n minutes: minutesActive,\n strong: boldText\n }}\n />\n }\n description={\n TimeActiveDetails && (\n <TimeActiveDetails\n bikeMinutes={bikeMinutes}\n walkMinutes={walkMinutes}\n />\n )\n }\n />\n )}\n {co2 > 0 && co2Config?.enabled && (\n <TripDetail\n icon={<Leaf size={17} />}\n summary={\n <S.CO2Summary>\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.co2\"]}\n description=\"Text showing the quantity of CO₂ emitted by this trip.\"\n id=\"otpUi.TripDetails.co2\"\n values={{\n co2: (\n <FormattedNumber\n value={Math.round(co2)}\n // eslint-disable-next-line react/style-prop-object\n style=\"unit\"\n unit={co2Config?.units || \"gram\"}\n unitDisplay=\"narrow\"\n />\n ),\n strong: boldText\n }}\n />\n </S.CO2Summary>\n }\n description={\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.co2description\"]\n }\n description=\"Text explaining how the CO₂ emissions are calculated.\"\n id=\"otpUi.TripDetails.co2description\"\n values={{\n link: CO2DescriptionLink,\n totalDistance\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 values={{\n extraMessage: [\n ...new Set([\n ...pickupBookingInfo.map(info => info.message),\n ...dropOffBookingInfo.map(info => info.message)\n ])\n ].join(\" \")\n }}\n />\n </S.FlexSummary>\n }\n icon={<Route size={17} />}\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, FareLegTable };\n"],"file":"index.js"}
|
package/esm/styled.js
CHANGED
|
@@ -3,84 +3,76 @@ var BaseButton = styled.button.withConfig({
|
|
|
3
3
|
displayName: "styled__BaseButton",
|
|
4
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
|
-
export var CaloriesDescription = styled.span.withConfig({
|
|
7
|
-
displayName: "styled__CaloriesDescription",
|
|
8
|
-
componentId: "sc-6q2ok2-1"
|
|
9
|
-
})([""]);
|
|
10
|
-
export var CaloriesSummary = styled.span.withConfig({
|
|
11
|
-
displayName: "styled__CaloriesSummary",
|
|
12
|
-
componentId: "sc-6q2ok2-2"
|
|
13
|
-
})([""]);
|
|
14
6
|
export var CO2Description = styled.span.withConfig({
|
|
15
7
|
displayName: "styled__CO2Description",
|
|
16
|
-
componentId: "sc-6q2ok2-
|
|
8
|
+
componentId: "sc-6q2ok2-1"
|
|
17
9
|
})([""]);
|
|
18
10
|
export var CO2Summary = styled.span.withConfig({
|
|
19
11
|
displayName: "styled__CO2Summary",
|
|
20
|
-
componentId: "sc-6q2ok2-
|
|
12
|
+
componentId: "sc-6q2ok2-2"
|
|
21
13
|
})([""]);
|
|
22
14
|
export var ExpandButton = styled(BaseButton).withConfig({
|
|
23
15
|
displayName: "styled__ExpandButton",
|
|
24
|
-
componentId: "sc-6q2ok2-
|
|
16
|
+
componentId: "sc-6q2ok2-3"
|
|
25
17
|
})(["color:#00f;font-size:16px;margin-left:6px;margin-top:-2px;"]);
|
|
26
18
|
export var Fare = styled.span.withConfig({
|
|
27
19
|
displayName: "styled__Fare",
|
|
28
|
-
componentId: "sc-6q2ok2-
|
|
20
|
+
componentId: "sc-6q2ok2-4"
|
|
29
21
|
})([""]);
|
|
30
22
|
export var HideButton = styled(BaseButton).withConfig({
|
|
31
23
|
displayName: "styled__HideButton",
|
|
32
|
-
componentId: "sc-6q2ok2-
|
|
24
|
+
componentId: "sc-6q2ok2-5"
|
|
33
25
|
})(["float:right;"]);
|
|
34
26
|
export var TNCFare = styled.span.withConfig({
|
|
35
27
|
displayName: "styled__TNCFare",
|
|
36
|
-
componentId: "sc-6q2ok2-
|
|
28
|
+
componentId: "sc-6q2ok2-6"
|
|
37
29
|
})([""]);
|
|
38
30
|
export var TNCFareCompanies = styled.span.withConfig({
|
|
39
31
|
displayName: "styled__TNCFareCompanies",
|
|
40
|
-
componentId: "sc-6q2ok2-
|
|
32
|
+
componentId: "sc-6q2ok2-7"
|
|
41
33
|
})(["text-transform:capitalize;"]);
|
|
42
34
|
export var Timing = styled.span.withConfig({
|
|
43
35
|
displayName: "styled__Timing",
|
|
44
|
-
componentId: "sc-6q2ok2-
|
|
36
|
+
componentId: "sc-6q2ok2-8"
|
|
45
37
|
})([""]);
|
|
46
38
|
export var TransitFare = styled.details.withConfig({
|
|
47
39
|
displayName: "styled__TransitFare",
|
|
48
|
-
componentId: "sc-6q2ok2-
|
|
40
|
+
componentId: "sc-6q2ok2-9"
|
|
49
41
|
})(["display:inline-block;> span{display:block;padding-left:1.75ch;}"]);
|
|
50
42
|
export var TransitFareSingle = styled.span.withConfig({
|
|
51
43
|
displayName: "styled__TransitFareSingle",
|
|
52
|
-
componentId: "sc-6q2ok2-
|
|
44
|
+
componentId: "sc-6q2ok2-10"
|
|
53
45
|
})([""]);
|
|
54
46
|
export var FlexSummary = styled.span.withConfig({
|
|
55
47
|
displayName: "styled__FlexSummary",
|
|
56
|
-
componentId: "sc-6q2ok2-
|
|
48
|
+
componentId: "sc-6q2ok2-11"
|
|
57
49
|
})([""]);
|
|
58
50
|
export var TripDetail = styled.div.withConfig({
|
|
59
51
|
displayName: "styled__TripDetail",
|
|
60
|
-
componentId: "sc-6q2ok2-
|
|
52
|
+
componentId: "sc-6q2ok2-12"
|
|
61
53
|
})(["margin-top:6px;"]);
|
|
62
54
|
export var TripDetailDescription = styled.div.withConfig({
|
|
63
55
|
displayName: "styled__TripDetailDescription",
|
|
64
|
-
componentId: "sc-6q2ok2-
|
|
56
|
+
componentId: "sc-6q2ok2-13"
|
|
65
57
|
})(["background-color:#fff;border:1px solid #888;font-size:12px;margin-top:2px;padding:8px;"]);
|
|
66
58
|
export var TripDetailIcon = styled.div.withConfig({
|
|
67
59
|
displayName: "styled__TripDetailIcon",
|
|
68
|
-
componentId: "sc-6q2ok2-
|
|
60
|
+
componentId: "sc-6q2ok2-14"
|
|
69
61
|
})(["float:left;font-size:17px;"]);
|
|
70
62
|
export var TripDetails = styled.div.withConfig({
|
|
71
63
|
displayName: "styled__TripDetails",
|
|
72
|
-
componentId: "sc-6q2ok2-
|
|
64
|
+
componentId: "sc-6q2ok2-15"
|
|
73
65
|
})(["background-color:#eee;border-radius:6px;margin-bottom:15px;margin-top:16px;padding:10px 16px;"]);
|
|
74
66
|
export var TripDetailsBody = styled.div.withConfig({
|
|
75
67
|
displayName: "styled__TripDetailsBody",
|
|
76
|
-
componentId: "sc-6q2ok2-
|
|
68
|
+
componentId: "sc-6q2ok2-16"
|
|
77
69
|
})([""]);
|
|
78
70
|
export var TripDetailsHeader = styled.h2.withConfig({
|
|
79
71
|
displayName: "styled__TripDetailsHeader",
|
|
80
|
-
componentId: "sc-6q2ok2-
|
|
72
|
+
componentId: "sc-6q2ok2-17"
|
|
81
73
|
})(["font-size:18px;font-weight:600;margin:0;"]);
|
|
82
74
|
export var TripDetailSummary = styled.div.withConfig({
|
|
83
75
|
displayName: "styled__TripDetailSummary",
|
|
84
|
-
componentId: "sc-6q2ok2-
|
|
85
|
-
})(["margin-left:28px;padding-top:2px;display:flex;align-items:baseline;"]);
|
|
76
|
+
componentId: "sc-6q2ok2-18"
|
|
77
|
+
})(["margin-left:28px;padding-top:2px;display:flex;align-items:baseline;white-space:pre;"]);
|
|
86
78
|
//# sourceMappingURL=styled.js.map
|
package/esm/styled.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/styled.ts"],"names":["styled","BaseButton","button","
|
|
1
|
+
{"version":3,"sources":["../src/styled.ts"],"names":["styled","BaseButton","button","CO2Description","span","CO2Summary","ExpandButton","Fare","HideButton","TNCFare","TNCFareCompanies","Timing","TransitFare","details","TransitFareSingle","FlexSummary","TripDetail","div","TripDetailDescription","TripDetailIcon","TripDetails","TripDetailsBody","TripDetailsHeader","h2","TripDetailSummary"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,mBAAnB;AAEA,IAAMC,UAAU,GAAGD,MAAM,CAACE,MAAV;AAAA;AAAA;AAAA,8PAAhB;AAiBA,OAAO,IAAMC,cAAc,GAAGH,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAApB;AAEP,OAAO,IAAMC,UAAU,GAAGL,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAAhB;AAEP,OAAO,IAAME,YAAY,GAAGN,MAAM,CAACC,UAAD,CAAT;AAAA;AAAA;AAAA,kEAAlB;AAOP,OAAO,IAAMM,IAAI,GAAGP,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAAV;AAEP,OAAO,IAAMI,UAAU,GAAGR,MAAM,CAACC,UAAD,CAAT;AAAA;AAAA;AAAA,oBAAhB;AAIP,OAAO,IAAMQ,OAAO,GAAGT,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAAb;AAEP,OAAO,IAAMM,gBAAgB,GAAGV,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,kCAAtB;AAIP,OAAO,IAAMO,MAAM,GAAGX,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAAZ;AAEP,OAAO,IAAMQ,WAAW,GAAGZ,MAAM,CAACa,OAAV;AAAA;AAAA;AAAA,uEAAjB;AAUP,OAAO,IAAMC,iBAAiB,GAAGd,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAAvB;AAEP,OAAO,IAAMW,WAAW,GAAGf,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,QAAjB;AAEP,OAAO,IAAMY,UAAU,GAAGhB,MAAM,CAACiB,GAAV;AAAA;AAAA;AAAA,uBAAhB;AAIP,OAAO,IAAMC,qBAAqB,GAAGlB,MAAM,CAACiB,GAAV;AAAA;AAAA;AAAA,8FAA3B;AAQP,OAAO,IAAME,cAAc,GAAGnB,MAAM,CAACiB,GAAV;AAAA;AAAA;AAAA,kCAApB;AAKP,OAAO,IAAMG,WAAW,GAAGpB,MAAM,CAACiB,GAAV;AAAA;AAAA;AAAA,qGAAjB;AAQP,OAAO,IAAMI,eAAe,GAAGrB,MAAM,CAACiB,GAAV;AAAA;AAAA;AAAA,QAArB;AAEP,OAAO,IAAMK,iBAAiB,GAAGtB,MAAM,CAACuB,EAAV;AAAA;AAAA;AAAA,gDAAvB;AAMP,OAAO,IAAMC,iBAAiB,GAAGxB,MAAM,CAACiB,GAAV;AAAA;AAAA;AAAA,2FAAvB","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 CO2Description = styled.span``;\n\nexport const CO2Summary = styled.span``;\n\nexport const ExpandButton = styled(BaseButton)`\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 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.h2`\n font-size: 18px;\n font-weight: 600;\n margin: 0;\n`;\n\nexport const TripDetailSummary = styled.div`\n margin-left: 28px;\n padding-top: 2px;\n display: flex;\n align-items: baseline;\n white-space: pre;\n`;\n"],"file":"styled.js"}
|
package/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"names":["FareTableText"],"mappings":"AAAA;AACA;AAoBA,WAAYA,aAAZ;;WAAYA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,KAAAA,a","sourcesContent":["// Prettier does not recognize the import type syntax.\n// eslint-disable-next-line prettier/prettier\nimport type { MassUnitOption, Fare, Itinerary, Money } from \"@opentripplanner/types\";\nimport type { ReactElement } from \"react\";\n\nexport interface
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"names":["FareTableText"],"mappings":"AAAA;AACA;AAoBA,WAAYA,aAAZ;;WAAYA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,KAAAA,a","sourcesContent":["// Prettier does not recognize the import type syntax.\n// eslint-disable-next-line prettier/prettier\nimport type { MassUnitOption, Fare, Itinerary, Money } from \"@opentripplanner/types\";\nimport type { ReactElement } from \"react\";\n\nexport interface TimeActiveDetailsProps {\n bikeMinutes: number;\n minutesActive?: number;\n walkMinutes: number;\n}\n\nexport interface CO2ConfigType {\n carbonIntensity?: Record<string, number>;\n units?: MassUnitOption;\n enabled?: boolean;\n}\n\nexport interface DepartureDetailsProps {\n departureDate: Date;\n}\n\nexport enum FareTableText {\n regular = \"regular\",\n youth = \"youth\",\n senior = \"senior\",\n special = \"special\",\n cash = \"cash\",\n electronic = \"electronic\"\n}\n\nexport interface FareTableLayout {\n cols: {\n header: FareTableText;\n key?: string;\n riderCategory?: string;\n fareContainer?: string;\n }[];\n header: FareTableText;\n}\nexport interface TransitFareData {\n [key: string]: Money\n}\n\nexport interface FareDetailsProps {\n maxTNCFare: number;\n minTNCFare: number;\n transitFares: TransitFareData;\n}\n\nexport interface FareLegTableProps {\n layout?: FareTableLayout[];\n itinerary: Itinerary;\n}\n\nexport interface TransitFareProps {\n fareKey: string;\n fareNameFallback?: ReactElement;\n fareKeyNameMap: {\n [key: string]: string;\n };\n transitFares: Fare;\n}\n\nexport interface TripDetailsProps {\n /**\n * Used for additional styling with styled components for example.\n */\n className?: string;\n /**\n * Object containing the CO₂ config.\n */\n co2Config?: CO2ConfigType;\n /**\n * Determines which transit fare should be displayed by default, should there be multiple transit fare types.\n */\n defaultFareKey?: string;\n /**\n * Slot for a custom component to render the expandable section for departure.\n */\n DepartureDetails?: React.ElementType<DepartureDetailsProps>;\n /**\n * If this is set to true, a row will be added to the trip details displaying how\n * many minutes in total the user will spend walking or biking.\n */\n displayTimeActive?: boolean;\n /**\n * Slot for a custom component to render the expandable section for fares.\n */\n FareDetails?: React.ElementType<FareDetailsProps>;\n /**\n * Column and table configuration for fare details/fare by leg table.\n */\n fareDetailsLayout?: FareTableLayout[];\n /**\n * Mapping between fare keys and human-readable names for them.\n */\n fareKeyNameMap?: {\n [name: string]: string;\n };\n /**\n * Itinerary that the user has selected to view, contains multiple legs.\n */\n itinerary: Itinerary;\n /**\n * Slot for a custom component to render the expandable section for time active.\n */\n TimeActiveDetails?: React.ElementType<TimeActiveDetailsProps>;\n}"],"file":"types.js"}
|
package/i18n/en-US.yml
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
otpUi:
|
|
2
2
|
TripDetails:
|
|
3
|
-
calories: "Calories Burned: <strong>{calories, number, ::.}</strong>"
|
|
4
|
-
caloriesDescription: >
|
|
5
|
-
Calories burned is based on <strong>{walkMinutes, plural, one {# minute}
|
|
6
|
-
other {# minutes}}</strong> spent walking and <strong>{bikeMinutes,
|
|
7
|
-
plural, one {# minute} other {# minutes}}</strong> spent biking during
|
|
8
|
-
this trip. Adapted from <dietaryLink>Dietary Guidelines for Americans
|
|
9
|
-
2005, page 16, Table 4</dietaryLink>.
|
|
10
3
|
co2: "CO₂ Emitted: <strong>{co2}</strong>"
|
|
11
4
|
co2description: >-
|
|
12
5
|
CO₂ intensity is calculated by multiplying the distance of each leg of a
|
|
@@ -23,7 +16,14 @@ otpUi:
|
|
|
23
16
|
special: Special
|
|
24
17
|
youth: Youth
|
|
25
18
|
hideDetail: Hide details
|
|
19
|
+
minutesActive: >-
|
|
20
|
+
Time Spent Active: <strong>{minutes, plural, one {# minute} other {#
|
|
21
|
+
minutes}}</strong>
|
|
26
22
|
showDetail: Show details
|
|
23
|
+
timeActiveDescription: >
|
|
24
|
+
By taking this trip, you'll spend <strong>{walkMinutes, plural, one {#
|
|
25
|
+
minute} other {# minutes}}</strong> walking and <strong>{bikeMinutes,
|
|
26
|
+
plural, one {# minute} other {# minutes}}</strong> biking.
|
|
27
27
|
title: Trip Details
|
|
28
28
|
tncFare: "{companies} Fare: <strong>{minTNCFare} - {maxTNCFare}</strong>"
|
|
29
29
|
transferDiscountExplanation: Transfer discount of {transferAmount} is applied
|
package/i18n/es.yml
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
otpUi:
|
|
2
2
|
TripDetails:
|
|
3
|
-
calories: "Calorías quemadas: <strong>{calories, number, ::.}</strong>"
|
|
4
|
-
caloriesDescription: >
|
|
5
|
-
Las calorías quemadas se basan en <strong>{walkMinutes, plural, one {#
|
|
6
|
-
minuto} other {# minutos}}</strong> de caminata y <strong>{bikeMinutes,
|
|
7
|
-
plural, one {# minuto} other {# minutos}}</strong> en bicicleta durante
|
|
8
|
-
este viaje. Adaptado del <dietaryLink>Dietary Guidelines for Americans
|
|
9
|
-
2005, page 16, Table 4</dietaryLink>.
|
|
10
3
|
co2: "CO₂ emitido: <strong>{co2}</strong>"
|
|
11
4
|
co2description: >-
|
|
12
5
|
La intensidad de CO₂ se calcula multiplicando la distancia de cada tramo
|
package/i18n/fr.yml
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
otpUi:
|
|
2
2
|
TripDetails:
|
|
3
|
-
calories: "Calories dépensées : <strong>{calories, number, ::.}</strong>"
|
|
4
|
-
caloriesDescription: >
|
|
5
|
-
La dépense calorique est calculée sur la base de {walkMinutes, plural, one
|
|
6
|
-
{<strong># minute</strong> effectuée} other {<strong># minutes</strong>
|
|
7
|
-
effectuées}} à pied et {bikeMinutes, plural, one {<strong>#
|
|
8
|
-
minute</strong> effectuée} other {<strong># minutes</strong> effectuées}}
|
|
9
|
-
en vélo sur ce trajet. (d'après <dietaryLink>Dietary Guidelines for
|
|
10
|
-
Americans 2005, page 16, Table 4</dietaryLink>)
|
|
11
3
|
co2: "CO₂ émis : <strong>{co2}</strong>"
|
|
12
4
|
co2description: >-
|
|
13
5
|
L'intensité carbone est calculée en multipliant la distance de chaque
|
|
@@ -24,7 +16,12 @@ otpUi:
|
|
|
24
16
|
special: Spécial
|
|
25
17
|
youth: Jeunes
|
|
26
18
|
hideDetail: Masquer les détails
|
|
19
|
+
minutesActive: "Activité physique: {minutes, plural, one {# minute} other {# minutes}}"
|
|
27
20
|
showDetail: Afficher les détails
|
|
21
|
+
timeActiveDescription: >
|
|
22
|
+
Sur ce trajet, vous effectuerez <strong>{walkMinutes, plural, one {#
|
|
23
|
+
minute} other {# minutes}}</strong> à pied et <strong>{bikeMinutes,
|
|
24
|
+
plural, one {# minute} other {# minutes}}</strong> à vélo.
|
|
28
25
|
title: Détails du trajet
|
|
29
26
|
tncFare: "Tarif {companies} : <strong>{minTNCFare} - {maxTNCFare}</strong>"
|
|
30
27
|
transferDiscountExplanation: Cette correspondance vous donne une réduction de {transferAmount}
|
package/i18n/ko.yml
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
otpUi:
|
|
2
2
|
TripDetails:
|
|
3
|
-
calories: "소모 칼로리: <strong>{calories, number, ::.}</strong>"
|
|
4
|
-
caloriesDescription: >
|
|
5
|
-
소모된 칼로리는 이 트립에서 <strong>{walkMinutes}분 동안 </strong>걷고<strong>
|
|
6
|
-
<strong>{bikeMinutes}분</strong> 동안 자전거를 탄 것을 기준으로 합니다.
|
|
7
|
-
<dietaryLink>Dietary Guidelines for Americans 2005, 16 페이지, 표
|
|
8
|
-
4</dietaryLink> 적용.
|
|
9
3
|
co2: "CO₂ 배출: <strong>{co2}</strong>"
|
|
10
4
|
co2description: >-
|
|
11
5
|
CO₂ 강도는 각 모드의 CO₂ 강도를 트립에서 각 다리가 걸은 거리를 곱하여 계산됩니다. 각 모드의 CO₂ 강도는 <link>이
|
package/i18n/nb_NO.yml
CHANGED
package/i18n/vi.yml
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
otpUi:
|
|
2
2
|
TripDetails:
|
|
3
|
-
calories: "Calo bị đốt cháy: <strong>{calories, number, ::.}</strong>"
|
|
4
|
-
caloriesDescription: >
|
|
5
|
-
Lượng calo bị đốt cháy dựa trên <strong>{walkMinutes} phút</strong> đi bộ
|
|
6
|
-
và <strong>{bikeMinutes} phút</strong> dành cho chuyến đi xe đạp trong
|
|
7
|
-
chuyến đi này. Phỏng theo <dietaryLink>Dietary Guidelines for Americans
|
|
8
|
-
2005, trang 16, hình ảnh 4</dietaryLink>.
|
|
9
3
|
co2: "CO₂ thải ra: <strong>{co2}</strong>"
|
|
10
4
|
co2description: >-
|
|
11
5
|
Nồng độ CO₂ được tính bằng cách nhân khoảng cách của mỗi chặng của một
|
package/i18n/zh_Hans.yml
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
otpUi:
|
|
2
2
|
TripDetails:
|
|
3
|
-
calories: "卡路里消耗: <strong>{calories, number, ::.}</strong>"
|
|
4
|
-
caloriesDescription: >
|
|
5
|
-
燃烧的卡路里是根据这次旅行中的 <strong>{walkMinutes}分钟</strong> 步行和
|
|
6
|
-
<strong>{bikeMinutes}分钟</strong> 骑自行车计算的. 改编自< <dietaryLink>Dietary
|
|
7
|
-
Guidelines for Americans 2005, 页16, 图片4</dietaryLink>.
|
|
8
3
|
co2: "排放的二氧化碳: <strong>{co2}</strong>"
|
|
9
4
|
co2description: CO₂ 强度的计算方法是将行程的每条腿的距离乘以每种模式的 CO₂ 强度。 每种模式的二氧化碳强度来自<link>此电子表格</link>。
|
|
10
5
|
departure: >-
|
package/lib/index.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import * as S from "./styled";
|
|
|
3
3
|
import FareLegTable from "./fare-table";
|
|
4
4
|
import { TripDetailsProps } from "./types";
|
|
5
5
|
/**
|
|
6
|
-
* Renders trip details such as departure instructions, fare amount, and
|
|
6
|
+
* Renders trip details such as departure instructions, fare amount, and minutes active.
|
|
7
7
|
*/
|
|
8
|
-
export declare function TripDetails({
|
|
8
|
+
export declare function TripDetails({ className, co2Config, defaultFareKey, DepartureDetails, displayTimeActive, FareDetails, fareDetailsLayout, fareKeyNameMap, itinerary, TimeActiveDetails }: TripDetailsProps): ReactElement;
|
|
9
9
|
export default TripDetails;
|
|
10
10
|
export { S as Styled, FareLegTable };
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAQ5C,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,YAAY,MAAM,cAAc,CAAC;AAGxC,OAAO,EAGL,gBAAgB,EACjB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAQ5C,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,YAAY,MAAM,cAAc,CAAC;AAGxC,OAAO,EAGL,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAuFjB;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAC1B,SAAc,EACd,SAAS,EACT,cAA0B,EAC1B,gBAAuB,EACvB,iBAAwB,EACxB,WAAkB,EAClB,iBAAiB,EACjB,cAAmB,EACnB,SAAS,EACT,iBAA4C,EAC7C,EAAE,gBAAgB,GAAG,YAAY,CA+QjC;AAED,eAAe,WAAW,CAAC;AAG3B,OAAO,EAAE,CAAC,IAAI,MAAM,EAAE,YAAY,EAAE,CAAC"}
|