@opentripplanner/trip-details 1.5.0 → 2.0.1
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-messages.yml +7 -0
- package/esm/index.js +258 -126
- package/esm/index.js.map +1 -1
- package/esm/styled.js +30 -18
- package/esm/styled.js.map +1 -1
- package/esm/trip-detail.js +0 -9
- package/esm/trip-detail.js.map +1 -1
- package/esm/types.js +2 -0
- package/esm/types.js.map +1 -0
- package/i18n/en-US.yml +44 -0
- package/i18n/fr.yml +32 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +241 -122
- package/lib/index.js.map +1 -1
- package/lib/styled.d.ts +23 -0
- package/lib/styled.d.ts.map +1 -0
- package/lib/styled.js +40 -19
- package/lib/styled.js.map +1 -1
- package/lib/trip-detail.d.ts +18 -0
- package/lib/trip-detail.d.ts.map +1 -0
- package/lib/trip-detail.js +0 -12
- package/lib/trip-detail.js.map +1 -1
- package/lib/types.d.ts +67 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/package.json +11 -8
- package/src/TripDetails.story.tsx +273 -0
- package/src/__unpublished__/external-types.d.ts +22 -0
- package/src/__unpublished__/messages.d.ts +2 -0
- package/src/index.tsx +404 -0
- package/src/{styled.js → styled.ts} +6 -0
- package/src/{trip-detail.js → trip-detail.tsx} +17 -18
- package/src/types.ts +74 -0
- package/tsconfig.json +15 -0
- package/tsconfig.tsbuildinfo +4432 -0
- package/src/TripDetails.story.js +0 -147
- package/src/index.js +0 -262
package/esm/styled.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/styled.
|
|
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"}
|
package/esm/trip-detail.js
CHANGED
|
@@ -8,7 +8,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
8
8
|
|
|
9
9
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
10
|
|
|
11
|
-
import PropTypes from "prop-types";
|
|
12
11
|
import React, { Component } from "react";
|
|
13
12
|
import { QuestionCircle } from "@styled-icons/fa-solid/QuestionCircle";
|
|
14
13
|
import { TimesCircle } from "@styled-icons/fa-solid/TimesCircle";
|
|
@@ -81,12 +80,4 @@ var TripDetail = /*#__PURE__*/function (_Component) {
|
|
|
81
80
|
}(Component);
|
|
82
81
|
|
|
83
82
|
export { TripDetail as default };
|
|
84
|
-
TripDetail.propTypes = {
|
|
85
|
-
icon: PropTypes.node.isRequired,
|
|
86
|
-
summary: PropTypes.node.isRequired,
|
|
87
|
-
description: PropTypes.node
|
|
88
|
-
};
|
|
89
|
-
TripDetail.defaultProps = {
|
|
90
|
-
description: undefined
|
|
91
|
-
};
|
|
92
83
|
//# sourceMappingURL=trip-detail.js.map
|
package/esm/trip-detail.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/trip-detail.
|
|
1
|
+
{"version":3,"sources":["../src/trip-detail.tsx"],"names":["React","Component","QuestionCircle","TimesCircle","VelocityTransitionGroup","S","TripDetail","props","toggle","expanded","state","onHideClick","onExpandClick","setState","icon","summary","description","animation"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAA+C,OAA/C;AACA,SAASC,cAAT,QAA+B,uCAA/B;AACA,SAASC,WAAT,QAA4B,oCAA5B;AACA,SAASC,uBAAT,QAAwC,gBAAxC;AAEA,OAAO,KAAKC,CAAZ,MAAmB,UAAnB;;IAYqBC,U;;;;;AACnB,sBAAYC,KAAZ,EAA0B;AAAA;;AAAA;;AACxB,8BAAMA,KAAN;;AADwB,UAO1BC,MAP0B,GAOjB,YAAY;AACnB,UAAQC,QAAR,GAAqB,MAAKC,KAA1B,CAAQD,QAAR;AACA,UAAIA,QAAJ,EAAc,MAAKE,WAAL,GAAd,KACK,MAAKC,aAAL;AACN,KAXyB;;AAAA,UAa1BA,aAb0B,GAaV,YAAY;AAC1B,YAAKC,QAAL,CAAc;AAAEJ,QAAAA,QAAQ,EAAE;AAAZ,OAAd;AACD,KAfyB;;AAAA,UAiB1BE,WAjB0B,GAiBZ,YAAY;AACxB,YAAKE,QAAL,CAAc;AAAEJ,QAAAA,QAAQ,EAAE;AAAZ,OAAd;AACD,KAnByB;;AAExB,UAAKC,KAAL,GAAa;AACXD,MAAAA,QAAQ,EAAE;AADC,KAAb;AAFwB;AAKzB;;;;WAgBD,kBAAuB;AACrB,wBAAuC,KAAKF,KAA5C;AAAA,UAAQO,IAAR,eAAQA,IAAR;AAAA,UAAcC,OAAd,eAAcA,OAAd;AAAA,UAAuBC,WAAvB,eAAuBA,WAAvB;AACA,UAAQP,QAAR,GAAqB,KAAKC,KAA1B,CAAQD,QAAR;AACA,0BACE,oBAAC,CAAD,CAAG,UAAH,qBACE,oBAAC,CAAD,CAAG,cAAH,QAAmBK,IAAnB,CADF,eAEE,oBAAC,CAAD,CAAG,iBAAH,QACGC,OADH,EAEGC,WAAW,iBACV,oBAAC,CAAD,CAAG,YAAH;AAAgB,QAAA,OAAO,EAAE,KAAKR;AAA9B,sBACE,oBAAC,cAAD;AAAgB,QAAA,IAAI,EAAC;AAArB,QADF,CAHJ,CAFF,eAUE,oBAAC,uBAAD;AACE,QAAA,KAAK,EAAE;AAAES,UAAAA,SAAS,EAAE;AAAb,SADT;AAEE,QAAA,KAAK,EAAE;AAAEA,UAAAA,SAAS,EAAE;AAAb;AAFT,SAIGR,QAAQ,iBACP,oBAAC,CAAD,CAAG,qBAAH,qBACE,oBAAC,CAAD,CAAG,UAAH;AAAc,QAAA,OAAO,EAAE,KAAKE;AAA5B,sBACE,oBAAC,WAAD;AAAa,QAAA,IAAI,EAAC;AAAlB,QADF,CADF,EAIGK,WAJH,CALJ,CAVF,CADF;AA0BD;;;;EAnDqCf,S;;SAAnBK,U","sourcesContent":["import React, { Component, ReactElement } from \"react\";\nimport { QuestionCircle } from \"@styled-icons/fa-solid/QuestionCircle\";\nimport { TimesCircle } from \"@styled-icons/fa-solid/TimesCircle\";\nimport { VelocityTransitionGroup } from \"velocity-react\";\n\nimport * as S from \"./styled\";\n\ntype Props = {\n description?: ReactElement | string;\n icon: ReactElement;\n summary: ReactElement | string;\n};\n\ntype State = {\n expanded: boolean;\n};\n\nexport default class TripDetail extends Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = {\n expanded: false\n };\n }\n\n toggle = (): void => {\n const { expanded } = this.state;\n if (expanded) this.onHideClick();\n else this.onExpandClick();\n };\n\n onExpandClick = (): void => {\n this.setState({ expanded: true });\n };\n\n onHideClick = (): void => {\n this.setState({ expanded: false });\n };\n\n render(): ReactElement {\n const { icon, summary, description } = this.props;\n const { expanded } = this.state;\n return (\n <S.TripDetail>\n <S.TripDetailIcon>{icon}</S.TripDetailIcon>\n <S.TripDetailSummary>\n {summary}\n {description && (\n <S.ExpandButton onClick={this.toggle}>\n <QuestionCircle size=\"0.92em\" />\n </S.ExpandButton>\n )}\n </S.TripDetailSummary>\n <VelocityTransitionGroup\n enter={{ animation: \"slideDown\" }}\n leave={{ animation: \"slideUp\" }}\n >\n {expanded && (\n <S.TripDetailDescription>\n <S.HideButton onClick={this.onHideClick}>\n <TimesCircle size=\"0.92em\" />\n </S.HideButton>\n {description}\n </S.TripDetailDescription>\n )}\n </VelocityTransitionGroup>\n </S.TripDetail>\n );\n }\n}\n"],"file":"trip-detail.js"}
|
package/esm/types.js
ADDED
package/esm/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
|
package/i18n/en-US.yml
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Default messages for the TripDetails component.
|
|
2
|
+
# To use from a react-intl application:
|
|
3
|
+
# - merge the content of this file into the messages object
|
|
4
|
+
# that has your other localized strings,
|
|
5
|
+
# - flatten the ids, i.e. convert a structure such as
|
|
6
|
+
# otpUi > TripDetails > calories
|
|
7
|
+
# into "otpUi.TripDetails.calories" (see TripDetail story for an example),
|
|
8
|
+
# - pass the resulting object to the messages prop of IntlProvider.
|
|
9
|
+
#
|
|
10
|
+
# The meaning of the pseudo <tags> used in the strings below is as follows:
|
|
11
|
+
# - <dietaryLink>: The link to the Dietary Guidelines for Americans will surround the text enclosed by the tag.
|
|
12
|
+
# - <strong>: The enclosed text will be rendered as strong (bold) text (same meaning as in HTML).
|
|
13
|
+
|
|
14
|
+
otpUi:
|
|
15
|
+
TripDetails:
|
|
16
|
+
calories: "Calories Burned: <strong>{calories, number, ::.}</strong>"
|
|
17
|
+
caloriesDescription: >
|
|
18
|
+
Calories burned is based on
|
|
19
|
+
<strong>{walkMinutes, plural, one {# minute} other {# minutes}}</strong> spent walking and
|
|
20
|
+
<strong>{bikeMinutes, plural, one {# minute} other {# minutes}}</strong> spent biking during this trip.
|
|
21
|
+
Adapted from <dietaryLink>Dietary Guidelines for Americans 2005, page 16, Table 4</dietaryLink>.
|
|
22
|
+
departure: Depart <strong>{departureDate, date, long}</strong> at <strong>{departureDate, time, short}</strong>
|
|
23
|
+
flexDropOffMessage: >
|
|
24
|
+
{hasLeadTime, select,
|
|
25
|
+
true {To get off at your destination, you must call
|
|
26
|
+
{hasPhone, select,
|
|
27
|
+
true {{phoneNumber}}
|
|
28
|
+
other {ahead}
|
|
29
|
+
} at least {leadDays, plural, one {# day} other {# days}} in advance}
|
|
30
|
+
other {You must tell the operator where you want to get off.}
|
|
31
|
+
}.
|
|
32
|
+
flexPickupMessage: >
|
|
33
|
+
To take this route, you must call {hasPhone, select,
|
|
34
|
+
true {{phoneNumber}}
|
|
35
|
+
other {ahead}
|
|
36
|
+
}{hasLeadTime, select,
|
|
37
|
+
true { at least {leadDays, plural, one {# day} other {# days}} in advance}
|
|
38
|
+
other {}
|
|
39
|
+
}.
|
|
40
|
+
title: Trip Details
|
|
41
|
+
tncFare: "{companies} Fare: <strong>{minTNCFare} - {maxTNCFare}</strong>"
|
|
42
|
+
transitFare: Transit Fare
|
|
43
|
+
transitFareEntry: "{name}: <strong>{value}</strong>"
|
|
44
|
+
tripIncludesFlex: This trip includes flexible routes.
|
package/i18n/fr.yml
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Example translations for the TripDetails component into French.
|
|
2
|
+
otpUi:
|
|
3
|
+
TripDetails:
|
|
4
|
+
calories: "Calories dépensées : <strong>{calories, number, ::.}</strong>"
|
|
5
|
+
caloriesDescription: >
|
|
6
|
+
La dépense calorique est calculée sur la base de
|
|
7
|
+
{walkMinutes, plural, one {<strong># minute</strong> effectuée} other {<strong># minutes</strong> effectuées}} à pied et
|
|
8
|
+
{bikeMinutes, plural, one {<strong># minute</strong> effectuée} other {<strong># minutes</strong> effectuées}} en vélo sur ce trajet.
|
|
9
|
+
(d'après <dietaryLink>Dietary Guidelines for Americans 2005, page 16, Table 4</dietaryLink>)
|
|
10
|
+
departure: Départ le <strong>{departureDate, date, long}</strong> à <strong>{departureDate, time, short}</strong>
|
|
11
|
+
flexDropOffMessage: >
|
|
12
|
+
{hasLeadTime, select,
|
|
13
|
+
true {Pour descendre à votre destination, vous devez faire une réservation préalable
|
|
14
|
+
{hasPhone, select,
|
|
15
|
+
true {au {phoneNumber}}
|
|
16
|
+
other {}
|
|
17
|
+
} au moins {leadDays, plural, one {# jour} other {# jours}} à l'avance.}
|
|
18
|
+
other {Vous devez informer le conducteur de votre destination.}
|
|
19
|
+
}.
|
|
20
|
+
flexPickupMessage: >
|
|
21
|
+
Pour ce trajet, vous devez faire une réservation préalable {hasPhone, select,
|
|
22
|
+
true {au {phoneNumber}}
|
|
23
|
+
other {}
|
|
24
|
+
}{hasLeadTime, select,
|
|
25
|
+
true { au moins {leadDays, plural, one {# jour} other {# jours}} à l'avance}
|
|
26
|
+
other {}
|
|
27
|
+
}.
|
|
28
|
+
title: Détails du trajet
|
|
29
|
+
tncFare: "Tarif {companies} : <strong>{minTNCFare} - {maxTNCFare}</strong>"
|
|
30
|
+
transitFare: Tarif en transports
|
|
31
|
+
transitFareEntry: "{name} : <strong>{value}</strong>"
|
|
32
|
+
tripIncludesFlex: Ce trajet comprend un service à la demande (Flex).
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import * as S from "./styled";
|
|
3
|
+
import { TripDetailsProps } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Renders trip details such as departure instructions, fare amount, and calories spent.
|
|
6
|
+
*/
|
|
7
|
+
export declare function TripDetails({ CaloriesDetails, className, DepartureDetails, defaultFareKey, FareDetails, fareKeyNameMap, itinerary }: TripDetailsProps): ReactElement;
|
|
8
|
+
export default TripDetails;
|
|
9
|
+
export { S as Styled };
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAS5C,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,OAAO,EAGL,gBAAgB,EACjB,MAAM,SAAS,CAAC;AA0HjB;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAC1B,eAAwC,EACxC,SAAc,EACd,gBAAuB,EACvB,cAA0B,EAC1B,WAAkB,EAClB,cAAmB,EACnB,SAAS,EACV,EAAE,gBAAgB,GAAG,YAAY,CAoPjC;AAED,eAAe,WAAW,CAAC;AAG3B,OAAO,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -5,32 +5,133 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
exports.TripDetails = TripDetails;
|
|
8
9
|
exports.Styled = exports.default = void 0;
|
|
9
10
|
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var _moment = _interopRequireDefault(require("moment"));
|
|
11
|
+
var _flat = _interopRequireDefault(require("flat"));
|
|
13
12
|
|
|
14
|
-
var
|
|
13
|
+
var _coreUtils = _interopRequireDefault(require("@opentripplanner/core-utils"));
|
|
15
14
|
|
|
16
15
|
var _react = _interopRequireDefault(require("react"));
|
|
17
16
|
|
|
17
|
+
var _reactIntl = require("react-intl");
|
|
18
|
+
|
|
18
19
|
var _CalendarAlt = require("@styled-icons/fa-solid/CalendarAlt");
|
|
19
20
|
|
|
21
|
+
var _HandPaper = require("@styled-icons/fa-solid/HandPaper");
|
|
22
|
+
|
|
20
23
|
var _Heartbeat = require("@styled-icons/fa-solid/Heartbeat");
|
|
21
24
|
|
|
22
25
|
var _MoneyBillAlt = require("@styled-icons/fa-solid/MoneyBillAlt");
|
|
23
26
|
|
|
27
|
+
var _PhoneVolume = require("@styled-icons/fa-solid/PhoneVolume");
|
|
28
|
+
|
|
29
|
+
var _Route = require("@styled-icons/fa-solid/Route");
|
|
30
|
+
|
|
24
31
|
var S = _interopRequireWildcard(require("./styled"));
|
|
25
32
|
|
|
26
33
|
exports.Styled = S;
|
|
27
34
|
|
|
28
35
|
var _tripDetail = _interopRequireDefault(require("./trip-detail"));
|
|
29
36
|
|
|
37
|
+
var _enUS = _interopRequireDefault(require("../i18n/en-US.yml"));
|
|
38
|
+
|
|
30
39
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
40
|
|
|
32
41
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
42
|
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
44
|
+
// @ts-ignore FIXME: Create TypeScript types for core-utils packages.
|
|
45
|
+
// Load the default messages.
|
|
46
|
+
// HACK: We should flatten the messages loaded above because
|
|
47
|
+
// the YAML loaders behave differently between webpack and our version of jest:
|
|
48
|
+
// - the yaml loader for webpack returns a nested object,
|
|
49
|
+
// - the yaml loader for jest returns messages with flattened ids.
|
|
50
|
+
const defaultMessages = (0, _flat.default)(_enUS.default);
|
|
51
|
+
/**
|
|
52
|
+
* Format text bold (used with FormattedMessage).
|
|
53
|
+
*/
|
|
54
|
+
// TODO: Find a better place for this utility.
|
|
55
|
+
|
|
56
|
+
function boldText(contents) {
|
|
57
|
+
return /*#__PURE__*/_react.default.createElement("strong", null, contents);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Render formatted fare.
|
|
61
|
+
* @param currencyCode The ISO currency code to use (USD, GBP, EUR).
|
|
62
|
+
* @param fare The fare value, in currency units, to be shown.
|
|
63
|
+
* @returns The formatted fare value according to the selected locale.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
function renderFare(currencyCode, fare) {
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedNumber, {
|
|
69
|
+
currency: currencyCode // For dollars in locales such as 'fr',
|
|
70
|
+
// this will limit the display to just the dollar sign
|
|
71
|
+
// (otherwise it will render e.g. '2,50 $US' instead of '2,50 $').
|
|
72
|
+
,
|
|
73
|
+
currencyDisplay: "narrowSymbol",
|
|
74
|
+
value: fare // eslint-disable-next-line react/style-prop-object
|
|
75
|
+
,
|
|
76
|
+
style: "currency"
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Helper function to specify the link to dietary table.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
function dietaryLink(contents) {
|
|
85
|
+
return /*#__PURE__*/_react.default.createElement("a", {
|
|
86
|
+
href: "https://health.gov/dietaryguidelines/dga2005/document/html/chapter3.htm#table4",
|
|
87
|
+
rel: "noopener noreferrer",
|
|
88
|
+
target: "_blank"
|
|
89
|
+
}, contents);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Helper function that assembles values for flex pickup/dropoff messages.
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
function getFlexMessageValues(info) {
|
|
97
|
+
var _info$contactInfo, _info$contactInfo2;
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
hasLeadTime: _coreUtils.default.itinerary.isAdvanceBookingRequired(info),
|
|
101
|
+
hasPhone: !!(info !== null && info !== void 0 && (_info$contactInfo = info.contactInfo) !== null && _info$contactInfo !== void 0 && _info$contactInfo.phoneNumber),
|
|
102
|
+
leadDays: info.latestBookingTime.daysPrior,
|
|
103
|
+
phoneNumber: info === null || info === void 0 ? void 0 : (_info$contactInfo2 = info.contactInfo) === null || _info$contactInfo2 === void 0 ? void 0 : _info$contactInfo2.phoneNumber
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Default rendering if no component is provided for the CaloriesDetails
|
|
108
|
+
* slot in the TripDetails component.
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
function DefaultCaloriesDetails({
|
|
113
|
+
bikeSeconds,
|
|
114
|
+
calories,
|
|
115
|
+
walkSeconds
|
|
116
|
+
}) {
|
|
117
|
+
return /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
118
|
+
defaultMessage: defaultMessages["otpUi.TripDetails.caloriesDescription"],
|
|
119
|
+
description: "Text describing how the calories relate to the walking and biking duration of a trip.",
|
|
120
|
+
id: "otpUi.TripDetails.caloriesDescription",
|
|
121
|
+
values: {
|
|
122
|
+
bikeMinutes: Math.round(bikeSeconds / 60),
|
|
123
|
+
calories: Math.round(calories),
|
|
124
|
+
dietaryLink,
|
|
125
|
+
strong: boldText,
|
|
126
|
+
walkMinutes: Math.round(walkSeconds / 60)
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Helper component that renders a transit fare entry.
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
|
|
34
135
|
const TransitFare = ({
|
|
35
136
|
fareKey,
|
|
36
137
|
fareNameFallback,
|
|
@@ -38,50 +139,43 @@ const TransitFare = ({
|
|
|
38
139
|
transitFares
|
|
39
140
|
}) => {
|
|
40
141
|
const currentFare = transitFares[fareKey];
|
|
41
|
-
return /*#__PURE__*/_react.default.createElement("span", null,
|
|
142
|
+
return /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
143
|
+
defaultMessage: defaultMessages["otpUi.TripDetails.transitFareEntry"],
|
|
144
|
+
description: "Text showing the price of tickets on public transportation.",
|
|
145
|
+
id: "otpUi.TripDetails.transitFareEntry",
|
|
146
|
+
values: {
|
|
147
|
+
name: fareKeyNameMap[fareKey] || fareNameFallback || fareKey,
|
|
148
|
+
strong: boldText,
|
|
149
|
+
value: renderFare(currentFare.currency.currencyCode, currentFare.cents / 100)
|
|
150
|
+
}
|
|
151
|
+
}));
|
|
42
152
|
};
|
|
153
|
+
/**
|
|
154
|
+
* Renders trip details such as departure instructions, fare amount, and calories spent.
|
|
155
|
+
*/
|
|
43
156
|
|
|
44
|
-
TransitFare.propTypes = {
|
|
45
|
-
fareKey: _propTypes.default.string.isRequired,
|
|
46
|
-
fareNameFallback: _propTypes.default.string,
|
|
47
|
-
fareKeyNameMap: _propTypes.default.shape({
|
|
48
|
-
[_propTypes.default.string]: _propTypes.default.string
|
|
49
|
-
}).isRequired,
|
|
50
|
-
transitFares: _propTypes.default.shape({
|
|
51
|
-
centsToString: _propTypes.default.func,
|
|
52
|
-
transitFare: _propTypes.default.number
|
|
53
|
-
}).isRequired
|
|
54
|
-
};
|
|
55
|
-
TransitFare.defaultProps = {
|
|
56
|
-
fareNameFallback: undefined
|
|
57
|
-
};
|
|
58
157
|
|
|
59
158
|
function TripDetails({
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
timeOptions
|
|
159
|
+
CaloriesDetails = DefaultCaloriesDetails,
|
|
160
|
+
className = "",
|
|
161
|
+
DepartureDetails = null,
|
|
162
|
+
defaultFareKey = "regular",
|
|
163
|
+
FareDetails = null,
|
|
164
|
+
fareKeyNameMap = {},
|
|
165
|
+
itinerary
|
|
68
166
|
}) {
|
|
69
|
-
|
|
70
|
-
|
|
167
|
+
var _itinerary$fare;
|
|
168
|
+
|
|
169
|
+
// process the transit fare
|
|
170
|
+
const fareResult = _coreUtils.default.itinerary.calculateTncFares(itinerary);
|
|
71
171
|
|
|
72
172
|
const {
|
|
73
173
|
maxTNCFare,
|
|
74
174
|
minTNCFare,
|
|
75
|
-
|
|
76
|
-
} =
|
|
77
|
-
|
|
78
|
-
let
|
|
79
|
-
|
|
80
|
-
if (!transitFares[defaultFareKey]) {
|
|
81
|
-
defaultFare = "regular";
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
let companies;
|
|
175
|
+
tncCurrencyCode
|
|
176
|
+
} = fareResult;
|
|
177
|
+
const transitFares = itinerary === null || itinerary === void 0 ? void 0 : (_itinerary$fare = itinerary.fare) === null || _itinerary$fare === void 0 ? void 0 : _itinerary$fare.fare;
|
|
178
|
+
let companies = "";
|
|
85
179
|
itinerary.legs.forEach(leg => {
|
|
86
180
|
if (leg.tncData) {
|
|
87
181
|
companies = leg.tncData.company;
|
|
@@ -91,9 +185,12 @@ function TripDetails({
|
|
|
91
185
|
const fareKeys = transitFares && Object.keys(transitFares).sort();
|
|
92
186
|
|
|
93
187
|
if (transitFares && fareKeys.length > 0) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
188
|
+
let defaultFare = defaultFareKey;
|
|
189
|
+
|
|
190
|
+
if (!transitFares[defaultFareKey]) {
|
|
191
|
+
defaultFare = "regular";
|
|
192
|
+
} // Depending on if there are additional fares to display either render a <span> or a <details>
|
|
193
|
+
|
|
97
194
|
|
|
98
195
|
const TransitFareWrapper = transitFares && fareKeys.length > 1 ? S.TransitFare : S.TransitFareSingle;
|
|
99
196
|
fare = /*#__PURE__*/_react.default.createElement(S.Fare, null, /*#__PURE__*/_react.default.createElement(TransitFareWrapper, null, /*#__PURE__*/_react.default.createElement("summary", {
|
|
@@ -101,7 +198,11 @@ function TripDetails({
|
|
|
101
198
|
display: fareKeys.length > 1 ? "list-item" : ""
|
|
102
199
|
}
|
|
103
200
|
}, /*#__PURE__*/_react.default.createElement(TransitFare, {
|
|
104
|
-
fareNameFallback:
|
|
201
|
+
fareNameFallback: /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
202
|
+
defaultMessage: defaultMessages["otpUi.TripDetails.transitFare"],
|
|
203
|
+
description: "Text showing the price of tickets on public transportation.",
|
|
204
|
+
id: "otpUi.TripDetails.transitFare"
|
|
205
|
+
}),
|
|
105
206
|
fareKey: defaultFare,
|
|
106
207
|
fareKeyNameMap: fareKeyNameMap,
|
|
107
208
|
transitFares: transitFares
|
|
@@ -117,26 +218,65 @@ function TripDetails({
|
|
|
117
218
|
fareKeyNameMap: fareKeyNameMap,
|
|
118
219
|
transitFares: transitFares
|
|
119
220
|
});
|
|
120
|
-
})), minTNCFare !== 0 && /*#__PURE__*/_react.default.createElement(S.TNCFare, null, /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement(
|
|
121
|
-
|
|
221
|
+
})), minTNCFare !== 0 && /*#__PURE__*/_react.default.createElement(S.TNCFare, null, /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
222
|
+
defaultMessage: defaultMessages["otpUi.TripDetails.tncFare"],
|
|
223
|
+
description: "Text showing the price paid to transportation network companies.",
|
|
224
|
+
id: "otpUi.TripDetails.tncFare",
|
|
225
|
+
values: {
|
|
226
|
+
companies:
|
|
227
|
+
/*#__PURE__*/
|
|
228
|
+
// S.TNCFareCompanies capitalizes the TNC company ID (e.g. "COMPANY")
|
|
229
|
+
// after it is converted to lowercase, so it renders as "Company".
|
|
230
|
+
_react.default.createElement(S.TNCFareCompanies, null, companies.toLowerCase()),
|
|
231
|
+
maxTNCFare: renderFare(tncCurrencyCode, maxTNCFare),
|
|
232
|
+
minTNCFare: renderFare(tncCurrencyCode, minTNCFare),
|
|
233
|
+
strong: boldText
|
|
234
|
+
}
|
|
235
|
+
})));
|
|
236
|
+
}
|
|
122
237
|
|
|
238
|
+
const departureDate = new Date(itinerary.startTime); // Compute calories burned.
|
|
123
239
|
|
|
124
240
|
const {
|
|
125
241
|
bikeDuration,
|
|
126
242
|
caloriesBurned,
|
|
127
243
|
walkDuration
|
|
128
|
-
} = _coreUtils.default.itinerary.calculatePhysicalActivity(itinerary);
|
|
244
|
+
} = _coreUtils.default.itinerary.calculatePhysicalActivity(itinerary); // Parse flex info and generate appropriate strings
|
|
245
|
+
|
|
129
246
|
|
|
247
|
+
const containsFlex = itinerary.legs.some(_coreUtils.default.itinerary.isFlex);
|
|
248
|
+
const pickupBookingInfo = itinerary.legs.map(leg => leg.pickupBookingInfo).filter(info => !!info);
|
|
249
|
+
const dropOffBookingInfo = itinerary.legs.map(leg => leg.dropOffBookingInfo).filter(info => !!info);
|
|
130
250
|
return /*#__PURE__*/_react.default.createElement(S.TripDetails, {
|
|
131
251
|
className: className
|
|
132
|
-
}, /*#__PURE__*/_react.default.createElement(S.TripDetailsHeader, null,
|
|
133
|
-
|
|
252
|
+
}, /*#__PURE__*/_react.default.createElement(S.TripDetailsHeader, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
253
|
+
defaultMessage: defaultMessages["otpUi.TripDetails.title"],
|
|
254
|
+
description: "Title (heading) text of the component.",
|
|
255
|
+
id: "otpUi.TripDetails.title"
|
|
256
|
+
})), /*#__PURE__*/_react.default.createElement(S.TripDetailsBody, null, /*#__PURE__*/_react.default.createElement(_tripDetail.default // Any custom description for the Departure message needs to be handled by the slot.
|
|
257
|
+
, {
|
|
258
|
+
description: DepartureDetails && /*#__PURE__*/_react.default.createElement(DepartureDetails, {
|
|
259
|
+
departureDate: departureDate
|
|
260
|
+
}),
|
|
134
261
|
icon: /*#__PURE__*/_react.default.createElement(_CalendarAlt.CalendarAlt, {
|
|
135
262
|
size: 17
|
|
136
263
|
}),
|
|
137
|
-
summary: /*#__PURE__*/_react.default.createElement(S.Timing, null, /*#__PURE__*/_react.default.createElement(
|
|
138
|
-
|
|
139
|
-
|
|
264
|
+
summary: /*#__PURE__*/_react.default.createElement(S.Timing, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
265
|
+
defaultMessage: defaultMessages["otpUi.TripDetails.departure"],
|
|
266
|
+
description: "Text showing the departure date/time for a trip.",
|
|
267
|
+
id: "otpUi.TripDetails.departure",
|
|
268
|
+
values: {
|
|
269
|
+
departureDate,
|
|
270
|
+
strong: boldText
|
|
271
|
+
}
|
|
272
|
+
}))
|
|
273
|
+
}), fare && /*#__PURE__*/_react.default.createElement(_tripDetail.default // Any custom description for the transit fare needs to be handled by the slot.
|
|
274
|
+
, {
|
|
275
|
+
description: FareDetails && /*#__PURE__*/_react.default.createElement(FareDetails, {
|
|
276
|
+
maxTNCFare: maxTNCFare,
|
|
277
|
+
minTNCFare: minTNCFare,
|
|
278
|
+
transitFares: transitFares
|
|
279
|
+
}),
|
|
140
280
|
icon: /*#__PURE__*/_react.default.createElement(_MoneyBillAlt.MoneyBillAlt, {
|
|
141
281
|
size: 17
|
|
142
282
|
}),
|
|
@@ -145,79 +285,58 @@ function TripDetails({
|
|
|
145
285
|
icon: /*#__PURE__*/_react.default.createElement(_Heartbeat.Heartbeat, {
|
|
146
286
|
size: 17
|
|
147
287
|
}),
|
|
148
|
-
summary: /*#__PURE__*/_react.default.createElement(S.CaloriesSummary, null,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
288
|
+
summary: /*#__PURE__*/_react.default.createElement(S.CaloriesSummary, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
289
|
+
defaultMessage: defaultMessages["otpUi.TripDetails.calories"],
|
|
290
|
+
description: "Text showing the number of calories for the walking and biking legs of a trip.",
|
|
291
|
+
id: "otpUi.TripDetails.calories",
|
|
292
|
+
values: {
|
|
293
|
+
calories: caloriesBurned,
|
|
294
|
+
strong: boldText
|
|
295
|
+
}
|
|
296
|
+
})),
|
|
297
|
+
description: CaloriesDetails && /*#__PURE__*/_react.default.createElement(CaloriesDetails, {
|
|
298
|
+
bikeSeconds: bikeDuration,
|
|
299
|
+
calories: caloriesBurned,
|
|
300
|
+
walkSeconds: walkDuration
|
|
301
|
+
})
|
|
302
|
+
}), containsFlex && /*#__PURE__*/_react.default.createElement(_tripDetail.default, {
|
|
303
|
+
summary: /*#__PURE__*/_react.default.createElement(S.FlexSummary, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
304
|
+
defaultMessage: defaultMessages["otpUi.TripDetails.tripIncludesFlex"],
|
|
305
|
+
description: "Text stating that portions of the trip include a flex (on-demand) transit service.",
|
|
306
|
+
id: "otpUi.TripDetails.tripIncludesFlex"
|
|
307
|
+
})),
|
|
308
|
+
icon: /*#__PURE__*/_react.default.createElement(_Route.Route, {
|
|
309
|
+
size: 17
|
|
310
|
+
})
|
|
311
|
+
}), pickupBookingInfo && pickupBookingInfo.map(info => /*#__PURE__*/_react.default.createElement(_tripDetail.default, {
|
|
312
|
+
key: info.pickupMessage,
|
|
313
|
+
icon: /*#__PURE__*/_react.default.createElement(_PhoneVolume.PhoneVolume, {
|
|
314
|
+
size: 17
|
|
315
|
+
}),
|
|
316
|
+
summary: /*#__PURE__*/_react.default.createElement(S.FlexPickupSummary, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
317
|
+
defaultMessage: defaultMessages["otpUi.TripDetails.flexPickupMessage"],
|
|
318
|
+
description: "Instructions for booking and boarding the flex (on-demand) transit service.",
|
|
319
|
+
id: "otpUi.TripDetails.flexPickupMessage",
|
|
320
|
+
values: getFlexMessageValues(info)
|
|
321
|
+
})),
|
|
322
|
+
description: info.pickupMessage
|
|
323
|
+
})), dropOffBookingInfo && dropOffBookingInfo.map(info => /*#__PURE__*/_react.default.createElement(_tripDetail.default, {
|
|
324
|
+
description: info.dropOffMessage,
|
|
325
|
+
icon: _coreUtils.default.itinerary.isAdvanceBookingRequired(info) ? /*#__PURE__*/_react.default.createElement(_PhoneVolume.PhoneVolume, {
|
|
326
|
+
size: 17
|
|
327
|
+
}) : /*#__PURE__*/_react.default.createElement(_HandPaper.HandPaper, {
|
|
328
|
+
size: 17
|
|
329
|
+
}),
|
|
330
|
+
key: info.dropOffMessage,
|
|
331
|
+
summary: /*#__PURE__*/_react.default.createElement(S.FlexDropOffSummary, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
332
|
+
defaultMessage: defaultMessages["otpUi.TripDetails.flexDropOffMessage"],
|
|
333
|
+
description: "Instructions for getting off the flex (on-demand) transit service.",
|
|
334
|
+
id: "otpUi.TripDetails.flexDropOffMessage",
|
|
335
|
+
values: getFlexMessageValues(info)
|
|
336
|
+
}))
|
|
337
|
+
}))));
|
|
155
338
|
}
|
|
156
339
|
|
|
157
|
-
TripDetails.propTypes = {
|
|
158
|
-
/** Used for additional styling with styled components for example. */
|
|
159
|
-
className: _propTypes.default.string,
|
|
160
|
-
|
|
161
|
-
/** Determines which transit fare should be displayed by default, should there be multiple transit fare types */
|
|
162
|
-
defaultFareKey: _propTypes.default.string,
|
|
163
|
-
|
|
164
|
-
/** Itinerary that the user has selected to view, contains multiple legs */
|
|
165
|
-
itinerary: _coreUtils.default.types.itineraryType.isRequired,
|
|
166
|
-
|
|
167
|
-
/** Mapping between fare keys and human-readable names for them */
|
|
168
|
-
fareKeyNameMap: _propTypes.default.shape({
|
|
169
|
-
[_propTypes.default.string]: _propTypes.default.string
|
|
170
|
-
}),
|
|
171
|
-
|
|
172
|
-
/** the desired format to use for a long date */
|
|
173
|
-
longDateFormat: _propTypes.default.string,
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* messages to use for l10n/i8n
|
|
177
|
-
*
|
|
178
|
-
* Note: messages with default null values included here for visibility.
|
|
179
|
-
* Overriding with a truthy string value will cause the expandable help
|
|
180
|
-
* message to appear in trip details.
|
|
181
|
-
*/
|
|
182
|
-
messages: _propTypes.default.shape({
|
|
183
|
-
at: _propTypes.default.string,
|
|
184
|
-
caloriesBurned: _propTypes.default.string,
|
|
185
|
-
// FIXME: Add templated string description.
|
|
186
|
-
caloriesBurnedDescription: _propTypes.default.string,
|
|
187
|
-
depart: _propTypes.default.string,
|
|
188
|
-
departDescription: _propTypes.default.string,
|
|
189
|
-
title: _propTypes.default.string,
|
|
190
|
-
fare: _propTypes.default.string,
|
|
191
|
-
transitFare: _propTypes.default.string,
|
|
192
|
-
transitFareDescription: _propTypes.default.string
|
|
193
|
-
}),
|
|
194
|
-
|
|
195
|
-
/** whether the routing type is an itinerary or a profile result */
|
|
196
|
-
routingType: _propTypes.default.string,
|
|
197
|
-
|
|
198
|
-
/** Contains the preferred format string for time display and a timezone offset */
|
|
199
|
-
timeOptions: _coreUtils.default.types.timeOptionsType
|
|
200
|
-
};
|
|
201
|
-
TripDetails.defaultProps = {
|
|
202
|
-
className: null,
|
|
203
|
-
defaultFareKey: "regular",
|
|
204
|
-
fareKeyNameMap: {},
|
|
205
|
-
longDateFormat: null,
|
|
206
|
-
messages: {
|
|
207
|
-
at: "at",
|
|
208
|
-
caloriesBurned: "Calories Burned",
|
|
209
|
-
// FIXME: Add templated string description.
|
|
210
|
-
caloriesBurnedDescription: null,
|
|
211
|
-
depart: "Depart",
|
|
212
|
-
departDescription: null,
|
|
213
|
-
title: "Trip Details",
|
|
214
|
-
fare: "Fare",
|
|
215
|
-
transitFare: "Transit Fare",
|
|
216
|
-
transitFareDescription: null
|
|
217
|
-
},
|
|
218
|
-
routingType: "ITINERARY",
|
|
219
|
-
timeOptions: null
|
|
220
|
-
};
|
|
221
340
|
var _default = TripDetails; // Rename styled components for export
|
|
222
341
|
|
|
223
342
|
exports.default = _default;
|