@opentripplanner/trip-details 8.0.2 → 9.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/esm/components/fares-v2-table.js +194 -0
- package/esm/components/fares-v2-table.js.map +1 -0
- package/esm/components/fares.js +34 -60
- package/esm/components/fares.js.map +1 -1
- package/esm/index.js +5 -5
- package/esm/index.js.map +1 -1
- package/esm/styled.js +29 -22
- package/esm/styled.js.map +1 -1
- package/esm/trip-detail.js +1 -8
- package/esm/trip-detail.js.map +1 -1
- package/esm/types.js.map +1 -1
- package/i18n/en-US.yml +2 -7
- package/i18n/es.yml +0 -7
- package/i18n/fr.yml +2 -7
- package/i18n/ko.yml +2 -9
- package/i18n/nb_NO.yml +1 -4
- package/i18n/pl.yml +24 -19
- package/i18n/ru.yml +3 -10
- package/i18n/ta.yml +20 -25
- package/i18n/tl.yml +2 -9
- package/i18n/tr.yml +0 -7
- package/i18n/vi.yml +2 -9
- package/i18n/zh_Hans.yml +2 -9
- package/i18n/zh_Hant.yml +0 -7
- package/lib/components/departure-date.js +45 -42
- package/lib/components/departure-date.js.map +1 -1
- package/lib/components/emissions.js +57 -64
- package/lib/components/emissions.js.map +1 -1
- package/lib/components/fares-v2-table.d.ts +9 -0
- package/lib/components/fares-v2-table.d.ts.map +1 -0
- package/lib/components/fares-v2-table.js +158 -0
- package/lib/components/fares-v2-table.js.map +1 -0
- package/lib/components/fares.d.ts +4 -4
- package/lib/components/fares.d.ts.map +1 -1
- package/lib/components/fares.js +87 -151
- package/lib/components/fares.js.map +1 -1
- package/lib/components/flex-booking-info.js +55 -38
- package/lib/components/flex-booking-info.js.map +1 -1
- package/lib/components/time-active.js +40 -66
- package/lib/components/time-active.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +53 -66
- package/lib/index.js.map +1 -1
- package/lib/styled.d.ts +1 -0
- package/lib/styled.d.ts.map +1 -1
- package/lib/styled.js +120 -86
- package/lib/styled.js.map +1 -1
- package/lib/trip-detail.d.ts.map +1 -1
- package/lib/trip-detail.js +65 -71
- package/lib/trip-detail.js.map +1 -1
- package/lib/types.d.ts +4 -41
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +1 -4
- package/lib/types.js.map +1 -1
- package/lib/utils.js +17 -23
- package/lib/utils.js.map +1 -1
- package/package.json +3 -5
- package/src/TripDetails.story.tsx +47 -158
- package/src/__snapshots__/TripDetails.story.tsx.snap +1726 -924
- package/src/components/fares-v2-table.tsx +262 -0
- package/src/components/fares.tsx +51 -89
- package/src/index.tsx +4 -4
- package/src/styled.ts +11 -2
- package/src/trip-detail.tsx +1 -10
- package/src/types.ts +4 -40
- package/tsconfig.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/__mocks__/custom-english-messages.yml +0 -14
- package/__mocks__/custom-french-messages.yml +0 -9
- package/esm/components/fare-table.js +0 -122
- package/esm/components/fare-table.js.map +0 -1
- package/i18n/i18n-exceptions.json +0 -12
- package/lib/components/fare-table.d.ts +0 -5
- package/lib/components/fare-table.d.ts.map +0 -1
- package/lib/components/fare-table.js +0 -118
- package/lib/components/fare-table.js.map +0 -1
- package/src/components/fare-table.tsx +0 -215
package/lib/index.js
CHANGED
|
@@ -1,81 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
6
17
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.FaresV2Table = exports.Styled = exports.TripDetails = void 0;
|
|
30
|
+
const react_1 = __importDefault(require("react"));
|
|
31
|
+
const react_intl_1 = require("react-intl");
|
|
32
|
+
const flat_1 = require("flat");
|
|
33
|
+
const S = __importStar(require("./styled"));
|
|
20
34
|
exports.Styled = S;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
29
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
35
|
+
const flex_booking_info_1 = __importDefault(require("./components/flex-booking-info"));
|
|
36
|
+
const fares_v2_table_1 = __importDefault(require("./components/fares-v2-table"));
|
|
37
|
+
exports.FaresV2Table = fares_v2_table_1.default;
|
|
38
|
+
const emissions_1 = __importDefault(require("./components/emissions"));
|
|
39
|
+
const fares_1 = __importDefault(require("./components/fares"));
|
|
40
|
+
const time_active_1 = __importStar(require("./components/time-active"));
|
|
41
|
+
const departure_date_1 = __importDefault(require("./components/departure-date"));
|
|
30
42
|
// Load the default messages.
|
|
31
|
-
|
|
43
|
+
const en_US_yml_1 = __importDefault(require("../i18n/en-US.yml"));
|
|
32
44
|
// HACK: We should flatten the messages loaded above because
|
|
33
45
|
// the YAML loaders behave differently between webpack and our version of jest:
|
|
34
46
|
// - the yaml loader for webpack returns a nested object,
|
|
35
47
|
// - the yaml loader for jest returns messages with flattened ids.
|
|
36
|
-
const defaultMessages = (0,
|
|
48
|
+
const defaultMessages = (0, flat_1.flatten)(en_US_yml_1.default);
|
|
37
49
|
function cn(className, arg1) {
|
|
38
|
-
|
|
50
|
+
return className ? `${className} ${arg1}` : arg1;
|
|
39
51
|
}
|
|
40
|
-
|
|
41
52
|
/**
|
|
42
53
|
* Renders trip details such as departure instructions, fare amount, and minutes active.
|
|
43
54
|
*/
|
|
44
|
-
function TripDetails({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})
|
|
54
|
-
return /*#__PURE__*/_react.default.createElement(S.TripDetails, {
|
|
55
|
-
className: cn(className, "trip-details")
|
|
56
|
-
}, /*#__PURE__*/_react.default.createElement(S.TripDetailsHeader, {
|
|
57
|
-
id: "trip-details-header"
|
|
58
|
-
}, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
59
|
-
defaultMessage: defaultMessages["otpUi.TripDetails.title"],
|
|
60
|
-
description: "Title (heading) text of the component.",
|
|
61
|
-
id: "otpUi.TripDetails.title"
|
|
62
|
-
})), /*#__PURE__*/_react.default.createElement(S.TripDetailsBody, null, /*#__PURE__*/_react.default.createElement(_departureDate.default, {
|
|
63
|
-
itinerary: itinerary,
|
|
64
|
-
DepartureDetails: DepartureDetails
|
|
65
|
-
}), /*#__PURE__*/_react.default.createElement(_fares.default, {
|
|
66
|
-
itinerary: itinerary,
|
|
67
|
-
fareConfig: fareConfig,
|
|
68
|
-
FareDetails: FareDetails
|
|
69
|
-
}), /*#__PURE__*/_react.default.createElement(_timeActive.default, {
|
|
70
|
-
itinerary: itinerary,
|
|
71
|
-
TimeActiveDetails: TimeActiveDetails,
|
|
72
|
-
showApproximateMinutesActive: showApproximateMinutesActive
|
|
73
|
-
}), /*#__PURE__*/_react.default.createElement(_flexBookingInfo.default, {
|
|
74
|
-
itinerary: itinerary
|
|
75
|
-
}), /*#__PURE__*/_react.default.createElement(_emissions.default, {
|
|
76
|
-
itinerary: itinerary,
|
|
77
|
-
co2Config: co2Config
|
|
78
|
-
})));
|
|
55
|
+
function TripDetails({ className = "", co2Config, defaultFareType, DepartureDetails = null, FareDetails = null, itinerary, showApproximateMinutesActive, TimeActiveDetails = time_active_1.DefaultTimeActiveDetails }) {
|
|
56
|
+
return (react_1.default.createElement(S.TripDetails, { className: cn(className, "trip-details") },
|
|
57
|
+
react_1.default.createElement(S.TripDetailsHeader, { id: "trip-details-header" },
|
|
58
|
+
react_1.default.createElement(react_intl_1.FormattedMessage, { defaultMessage: defaultMessages["otpUi.TripDetails.title"], description: "Title (heading) text of the component.", id: "otpUi.TripDetails.title" })),
|
|
59
|
+
react_1.default.createElement(S.TripDetailsBody, null,
|
|
60
|
+
react_1.default.createElement(departure_date_1.default, { itinerary: itinerary, DepartureDetails: DepartureDetails }),
|
|
61
|
+
react_1.default.createElement(fares_1.default, { itinerary: itinerary, FareDetails: FareDetails, defaultFareType: defaultFareType }),
|
|
62
|
+
react_1.default.createElement(time_active_1.default, { itinerary: itinerary, TimeActiveDetails: TimeActiveDetails, showApproximateMinutesActive: showApproximateMinutesActive }),
|
|
63
|
+
react_1.default.createElement(flex_booking_info_1.default, { itinerary: itinerary }),
|
|
64
|
+
react_1.default.createElement(emissions_1.default, { itinerary: itinerary, co2Config: co2Config }))));
|
|
79
65
|
}
|
|
80
|
-
|
|
66
|
+
exports.TripDetails = TripDetails;
|
|
67
|
+
exports.default = TripDetails;
|
|
81
68
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA4C;AAC5C,2CAA8C;AAC9C,+BAA+B;AAC/B,4CAA8B;AAuEhB,mBAAM;AArEpB,uFAA6D;AAC7D,iFAAuD;AAoEjC,uBApEf,wBAAY,CAoEe;AAnElC,uEAA+C;AAC/C,+DAAuC;AACvC,wEAAgF;AAChF,iFAAwD;AAExD,6BAA6B;AAC7B,kEAAuD;AAEvD,4DAA4D;AAC5D,+EAA+E;AAC/E,yDAAyD;AACzD,kEAAkE;AAClE,MAAM,eAAe,GAA2B,IAAA,cAAO,EAAC,mBAAsB,CAAC,CAAC;AAEhF,SAAS,EAAE,CAAC,SAAiB,EAAE,IAAY;IACzC,OAAO,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,EAC1B,SAAS,GAAG,EAAE,EACd,SAAS,EACT,eAAe,EACf,gBAAgB,GAAG,IAAI,EACvB,WAAW,GAAG,IAAI,EAClB,SAAS,EACT,4BAA4B,EAC5B,iBAAiB,GAAG,sCAAwB,EAC3B;IACjB,OAAO,CACL,8BAAC,CAAC,CAAC,WAAW,IAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,cAAc,CAAC;QAErD,8BAAC,CAAC,CAAC,iBAAiB,IAAC,EAAE,EAAC,qBAAqB;YAC3C,8BAAC,6BAAgB,IACf,cAAc,EAAE,eAAe,CAAC,yBAAyB,CAAC,EAC1D,WAAW,EAAC,wCAAwC,EACpD,EAAE,EAAC,yBAAyB,GAC5B,CACkB;QAEtB,8BAAC,CAAC,CAAC,eAAe;YAChB,8BAAC,wBAAa,IACZ,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,GAClC;YACF,8BAAC,eAAK,IACJ,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,GAChC;YACF,8BAAC,qBAAU,IACT,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,iBAAiB,EACpC,4BAA4B,EAAE,4BAA4B,GAC1D;YACF,8BAAC,2BAAe,IAAC,SAAS,EAAE,SAAS,GAAI;YACzC,8BAAC,mBAAS,IAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,GAAI,CACvC,CACN,CACjB,CAAC;AACJ,CAAC;AAzCD,kCAyCC;AAED,kBAAe,WAAW,CAAC"}
|
package/lib/styled.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const InvisibleA11yLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
2
|
+
export declare const InvisibleA11yCaption: import("styled-components").StyledComponent<"caption", any, {}, never>;
|
|
2
3
|
export declare const CO2Description: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
3
4
|
export declare const CO2Summary: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
4
5
|
export declare const ExpandButton: import("styled-components").StyledComponent<"button", any, {}, never>;
|
package/lib/styled.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,kBAAkB,qEAE9B,CAAC;AAGF,eAAO,MAAM,oBAAoB,wEAEhC,CAAC;AAmBF,eAAO,MAAM,cAAc,qEAAgB,CAAC;AAE5C,eAAO,MAAM,UAAU,qEAAgB,CAAC;AAExC,eAAO,MAAM,YAAY,uEAKxB,CAAC;AAEF,eAAO,MAAM,IAAI,qEAAgB,CAAC;AAElC,eAAO,MAAM,UAAU,uEAEtB,CAAC;AAEF,eAAO,MAAM,OAAO,qEAAgB,CAAC;AAErC,eAAO,MAAM,gBAAgB,qEAE5B,CAAC;AAEF,eAAO,MAAM,MAAM,qEAAgB,CAAC;AAEpC,eAAO,MAAM,WAAW,wEASvB,CAAC;AACF,eAAO,MAAM,iBAAiB,qEAAgB,CAAC;AAE/C,eAAO,MAAM,WAAW,qEAAgB,CAAC;AAEzC,eAAO,MAAM,UAAU,oEAEtB,CAAC;AAEF,eAAO,MAAM,qBAAqB,oEAMjC,CAAC;AAEF,eAAO,MAAM,cAAc,oEAG1B,CAAC;AAEF,eAAO,MAAM,WAAW,oEAOvB,CAAC;AAEF,eAAO,MAAM,eAAe,oEAAe,CAAC;AAE5C,eAAO,MAAM,iBAAiB,mEAI7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,oEAM7B,CAAC"}
|
package/lib/styled.js
CHANGED
|
@@ -1,89 +1,123 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
6
17
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.TripDetailSummary = exports.TripDetailsHeader = exports.TripDetailsBody = exports.TripDetails = exports.TripDetailIcon = exports.TripDetailDescription = exports.TripDetail = exports.FlexSummary = exports.TransitFareSingle = exports.TransitFare = exports.Timing = exports.TNCFareCompanies = exports.TNCFare = exports.HideButton = exports.Fare = exports.ExpandButton = exports.CO2Summary = exports.CO2Description = exports.InvisibleA11yCaption = exports.InvisibleA11yLabel = void 0;
|
|
27
|
+
const styled_components_1 = __importStar(require("styled-components"));
|
|
28
|
+
const InvisibleA11yStyles = (0, styled_components_1.css) `
|
|
29
|
+
display: inline-block;
|
|
30
|
+
clip: rect(0, 0, 0, 0);
|
|
31
|
+
height: 0;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
position: absolute;
|
|
34
|
+
width: 0;
|
|
35
|
+
`;
|
|
36
|
+
exports.InvisibleA11yLabel = styled_components_1.default.span `
|
|
37
|
+
${InvisibleA11yStyles}
|
|
38
|
+
`;
|
|
39
|
+
// Warning: https://github.com/opentripplanner/otp-ui/pull/855#discussion_r2248534209
|
|
40
|
+
exports.InvisibleA11yCaption = styled_components_1.default.caption `
|
|
41
|
+
${InvisibleA11yStyles}
|
|
42
|
+
`;
|
|
43
|
+
const BaseButton = styled_components_1.default.button `
|
|
44
|
+
background: transparent;
|
|
45
|
+
border: 0;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
display: inline-block;
|
|
48
|
+
font-size: 14px;
|
|
49
|
+
font-weight: 400;
|
|
50
|
+
line-height: 1.42857143;
|
|
51
|
+
margin: 0;
|
|
52
|
+
padding: 0;
|
|
53
|
+
text-decoration: none;
|
|
54
|
+
touch-action: manipulation;
|
|
55
|
+
user-select: none;
|
|
56
|
+
vertical-align: middle;
|
|
57
|
+
white-space: nowrap;
|
|
58
|
+
`;
|
|
59
|
+
exports.CO2Description = styled_components_1.default.span ``;
|
|
60
|
+
exports.CO2Summary = styled_components_1.default.span ``;
|
|
61
|
+
exports.ExpandButton = (0, styled_components_1.default)(BaseButton) `
|
|
62
|
+
color: #00f;
|
|
63
|
+
font-size: 16px;
|
|
64
|
+
margin-left: 6px;
|
|
65
|
+
margin-top: -2px;
|
|
66
|
+
`;
|
|
67
|
+
exports.Fare = styled_components_1.default.span ``;
|
|
68
|
+
exports.HideButton = (0, styled_components_1.default)(BaseButton) `
|
|
69
|
+
float: right;
|
|
70
|
+
`;
|
|
71
|
+
exports.TNCFare = styled_components_1.default.span ``;
|
|
72
|
+
exports.TNCFareCompanies = styled_components_1.default.span `
|
|
73
|
+
text-transform: capitalize;
|
|
74
|
+
`;
|
|
75
|
+
exports.Timing = styled_components_1.default.span ``;
|
|
76
|
+
exports.TransitFare = styled_components_1.default.details `
|
|
77
|
+
display: inline-block;
|
|
78
|
+
|
|
79
|
+
> span {
|
|
80
|
+
display: block;
|
|
81
|
+
/* This may seem wrong, but this value gives the most aligned results */
|
|
82
|
+
/* see: https://github.com/opentripplanner/otp-ui/pull/294#discussion_r742045851 */
|
|
83
|
+
padding-left: 1.75ch;
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
86
|
+
exports.TransitFareSingle = styled_components_1.default.span ``;
|
|
87
|
+
exports.FlexSummary = styled_components_1.default.span ``;
|
|
88
|
+
exports.TripDetail = styled_components_1.default.div `
|
|
89
|
+
margin-top: 6px;
|
|
90
|
+
`;
|
|
91
|
+
exports.TripDetailDescription = styled_components_1.default.div `
|
|
92
|
+
background-color: #fff;
|
|
93
|
+
border: 1px solid #888;
|
|
94
|
+
font-size: 12px;
|
|
95
|
+
margin-top: 2px;
|
|
96
|
+
padding: 8px;
|
|
97
|
+
`;
|
|
98
|
+
exports.TripDetailIcon = styled_components_1.default.div `
|
|
99
|
+
float: left;
|
|
100
|
+
font-size: 17px;
|
|
101
|
+
`;
|
|
102
|
+
exports.TripDetails = styled_components_1.default.div `
|
|
103
|
+
background-color: #eee;
|
|
104
|
+
border-radius: 6px;
|
|
105
|
+
margin-bottom: 15px;
|
|
106
|
+
margin-top: 16px;
|
|
107
|
+
padding: 10px 16px;
|
|
108
|
+
overflow-x: scroll;
|
|
109
|
+
`;
|
|
110
|
+
exports.TripDetailsBody = styled_components_1.default.div ``;
|
|
111
|
+
exports.TripDetailsHeader = styled_components_1.default.h2 `
|
|
112
|
+
font-size: 18px;
|
|
113
|
+
font-weight: 600;
|
|
114
|
+
margin: 0;
|
|
115
|
+
`;
|
|
116
|
+
exports.TripDetailSummary = styled_components_1.default.div `
|
|
117
|
+
margin-left: 28px;
|
|
118
|
+
padding-top: 2px;
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: baseline;
|
|
121
|
+
white-space: pre-wrap;
|
|
122
|
+
`;
|
|
89
123
|
//# sourceMappingURL=styled.js.map
|
package/lib/styled.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","
|
|
1
|
+
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../src/styled.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAgD;AAEhD,MAAM,mBAAmB,GAAG,IAAA,uBAAG,EAAA;;;;;;;CAO9B,CAAC;AACW,QAAA,kBAAkB,GAAG,2BAAM,CAAC,IAAI,CAAA;IACzC,mBAAmB;CACtB,CAAC;AAEF,qFAAqF;AACxE,QAAA,oBAAoB,GAAG,2BAAM,CAAC,OAAO,CAAA;IAC9C,mBAAmB;CACtB,CAAC;AAEF,MAAM,UAAU,GAAG,2BAAM,CAAC,MAAM,CAAA;;;;;;;;;;;;;;;CAe/B,CAAC;AAEW,QAAA,cAAc,GAAG,2BAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AAE/B,QAAA,UAAU,GAAG,2BAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AAE3B,QAAA,YAAY,GAAG,IAAA,2BAAM,EAAC,UAAU,CAAC,CAAA;;;;;CAK7C,CAAC;AAEW,QAAA,IAAI,GAAG,2BAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AAErB,QAAA,UAAU,GAAG,IAAA,2BAAM,EAAC,UAAU,CAAC,CAAA;;CAE3C,CAAC;AAEW,QAAA,OAAO,GAAG,2BAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AAExB,QAAA,gBAAgB,GAAG,2BAAM,CAAC,IAAI,CAAA;;CAE1C,CAAC;AAEW,QAAA,MAAM,GAAG,2BAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AAEvB,QAAA,WAAW,GAAG,2BAAM,CAAC,OAAO,CAAA;;;;;;;;;CASxC,CAAC;AACW,QAAA,iBAAiB,GAAG,2BAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AAElC,QAAA,WAAW,GAAG,2BAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AAE5B,QAAA,UAAU,GAAG,2BAAM,CAAC,GAAG,CAAA;;CAEnC,CAAC;AAEW,QAAA,qBAAqB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;CAM9C,CAAC;AAEW,QAAA,cAAc,GAAG,2BAAM,CAAC,GAAG,CAAA;;;CAGvC,CAAC;AAEW,QAAA,WAAW,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;CAOpC,CAAC;AAEW,QAAA,eAAe,GAAG,2BAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE/B,QAAA,iBAAiB,GAAG,2BAAM,CAAC,EAAE,CAAA;;;;CAIzC,CAAC;AAEW,QAAA,iBAAiB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;CAM1C,CAAC"}
|
package/lib/trip-detail.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trip-detail.d.ts","sourceRoot":"","sources":["../src/trip-detail.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAQtD,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IACpC,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,YAAY,GAAG,MAAM,CAAC;CAChC,CAAC;
|
|
1
|
+
{"version":3,"file":"trip-detail.d.ts","sourceRoot":"","sources":["../src/trip-detail.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAQtD,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IACpC,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,YAAY,GAAG,MAAM,CAAC;CAChC,CAAC;AAaF,QAAA,MAAM,UAAU,8CAKb,KAAK,KAAG,WAmDV,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/lib/trip-detail.js
CHANGED
|
@@ -1,77 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
6
17
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const QuestionCircle_1 = require("@styled-icons/fa-solid/QuestionCircle");
|
|
31
|
+
const TimesCircle_1 = require("@styled-icons/fa-solid/TimesCircle");
|
|
32
|
+
const react_animate_height_1 = __importDefault(require("react-animate-height"));
|
|
33
|
+
const react_intl_1 = require("react-intl");
|
|
34
|
+
const S = __importStar(require("./styled"));
|
|
35
|
+
// TODO: Remove this helper method by moving to semantically correct HTML
|
|
23
36
|
function uuidv4() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
37
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
38
|
+
// eslint-disable-next-line no-bitwise
|
|
39
|
+
const r = (Math.random() * 16) | 0;
|
|
40
|
+
// eslint-disable-next-line no-bitwise
|
|
41
|
+
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
42
|
+
return v.toString(16);
|
|
43
|
+
});
|
|
32
44
|
}
|
|
33
|
-
const TripDetail = ({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"aria-expanded": expanded,
|
|
58
|
-
id: "expand-button",
|
|
59
|
-
onClick: toggle,
|
|
60
|
-
tabIndex: 0
|
|
61
|
-
}, /*#__PURE__*/_react.default.createElement(_QuestionCircle.QuestionCircle, {
|
|
62
|
-
size: "0.92em"
|
|
63
|
-
}))), /*#__PURE__*/_react.default.createElement(_reactAnimateHeight.default, {
|
|
64
|
-
duration: 300,
|
|
65
|
-
height: expanded ? "auto" : 0
|
|
66
|
-
}, /*#__PURE__*/_react.default.createElement(S.TripDetailDescription, {
|
|
67
|
-
"aria-labelledby": "expand-button",
|
|
68
|
-
id: id
|
|
69
|
-
}, /*#__PURE__*/_react.default.createElement(S.HideButton, {
|
|
70
|
-
role: "presentation",
|
|
71
|
-
onClick: () => setExpanded(false)
|
|
72
|
-
}, /*#__PURE__*/_react.default.createElement(_TimesCircle.TimesCircle, {
|
|
73
|
-
size: "0.92em"
|
|
74
|
-
})), description)));
|
|
45
|
+
const TripDetail = ({ icon, summary, description, className }) => {
|
|
46
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
47
|
+
const [expanded, setExpanded] = (0, react_1.useState)(false);
|
|
48
|
+
const id = uuidv4();
|
|
49
|
+
const toggle = () => {
|
|
50
|
+
setExpanded(!expanded);
|
|
51
|
+
};
|
|
52
|
+
return (react_1.default.createElement(S.TripDetail, { role: "group", className: className },
|
|
53
|
+
react_1.default.createElement(S.TripDetailIcon, { role: "presentation" }, icon),
|
|
54
|
+
react_1.default.createElement(S.TripDetailSummary, null,
|
|
55
|
+
summary,
|
|
56
|
+
description && (react_1.default.createElement(S.ExpandButton, { "aria-label": expanded
|
|
57
|
+
? intl.formatMessage({
|
|
58
|
+
id: "otpUi.TripDetails.hideDetail"
|
|
59
|
+
})
|
|
60
|
+
: intl.formatMessage({
|
|
61
|
+
id: "otpUi.TripDetails.showDetail"
|
|
62
|
+
}), "aria-controls": id, "aria-expanded": expanded, id: "expand-button", onClick: toggle, tabIndex: 0 },
|
|
63
|
+
react_1.default.createElement(QuestionCircle_1.QuestionCircle, { size: "0.92em" })))),
|
|
64
|
+
react_1.default.createElement(react_animate_height_1.default, { duration: 300, height: expanded ? "auto" : 0 },
|
|
65
|
+
react_1.default.createElement(S.TripDetailDescription, { "aria-labelledby": "expand-button", id: id },
|
|
66
|
+
react_1.default.createElement(S.HideButton, { role: "presentation", onClick: () => setExpanded(false) },
|
|
67
|
+
react_1.default.createElement(TimesCircle_1.TimesCircle, { size: "0.92em" })),
|
|
68
|
+
description))));
|
|
75
69
|
};
|
|
76
|
-
|
|
70
|
+
exports.default = TripDetail;
|
|
77
71
|
//# sourceMappingURL=trip-detail.js.map
|
package/lib/trip-detail.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trip-detail.js","
|
|
1
|
+
{"version":3,"file":"trip-detail.js","sourceRoot":"","sources":["../src/trip-detail.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAsD;AACtD,0EAAuE;AACvE,oEAAiE;AAEjE,gFAAiD;AACjD,2CAAqC;AACrC,4CAA8B;AAS9B,yEAAyE;AACzE,SAAS,MAAM;IACb,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,UAAS,CAAC;QACvE,sCAAsC;QACtC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QACnC,sCAAsC;QACtC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;QAC1C,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,EAClB,IAAI,EACJ,OAAO,EACP,WAAW,EACX,SAAS,EACH,EAAe,EAAE;IACvB,MAAM,IAAI,GAAG,IAAA,oBAAO,GAAE,CAAC;IACvB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAEhD,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAEpB,MAAM,MAAM,GAAG,GAAS,EAAE;QACxB,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC,CAAC;IAEF,OAAO,CACL,8BAAC,CAAC,CAAC,UAAU,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAE,SAAS;QAC7C,8BAAC,CAAC,CAAC,cAAc,IAAC,IAAI,EAAC,cAAc,IAAE,IAAI,CAAoB;QAG/D,8BAAC,CAAC,CAAC,iBAAiB;YACjB,OAAO;YACP,WAAW,IAAI,CACd,8BAAC,CAAC,CAAC,YAAY,kBAEX,QAAQ;oBACN,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC;wBACjB,EAAE,EAAE,8BAA8B;qBACnC,CAAC;oBACJ,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC;wBACjB,EAAE,EAAE,8BAA8B;qBACnC,CAAC,mBAEO,EAAE,mBACF,QAAQ,EACvB,EAAE,EAAC,eAAe,EAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,CAAC;gBAEX,8BAAC,+BAAc,IAAC,IAAI,EAAC,QAAQ,GAAG,CACjB,CAClB,CACmB;QACtB,8BAAC,8BAAa,IAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACzD,8BAAC,CAAC,CAAC,qBAAqB,uBAAiB,eAAe,EAAC,EAAE,EAAE,EAAE;gBAI7D,8BAAC,CAAC,CAAC,UAAU,IAAC,IAAI,EAAC,cAAc,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC;oBACjE,8BAAC,yBAAW,IAAC,IAAI,EAAC,QAAQ,GAAG,CAChB;gBACd,WAAW,CACY,CACZ,CACH,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
|