@opentripplanner/trip-details 1.6.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/custom-messages.yml +7 -0
- package/esm/index.js +215 -140
- 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 +43 -0
- package/i18n/fr.yml +31 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +204 -131
- 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 +62 -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 +10 -7
- package/src/TripDetails.story.tsx +315 -0
- package/src/__unpublished__/external-types.d.ts +22 -0
- package/src/__unpublished__/messages.d.ts +2 -0
- package/src/index.tsx +402 -0
- package/src/{styled.js → styled.ts} +6 -0
- package/src/{trip-detail.js → trip-detail.tsx} +17 -18
- package/src/types.ts +69 -0
- package/tsconfig.json +15 -0
- package/tsconfig.tsbuildinfo +4496 -0
- package/src/TripDetails.story.js +0 -155
- package/src/index.js +0 -324
package/lib/styled.js
CHANGED
|
@@ -5,25 +5,25 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.TripDetailSummary = exports.TripDetailsHeader = exports.TripDetailsBody = exports.TripDetails = exports.TripDetailIcon = exports.TripDetailDescription = exports.TripDetail = exports.TransitFareSingle = exports.TransitFare = exports.Timing = exports.TNCFareCompanies = exports.TNCFare = exports.HideButton = exports.Fare = exports.ExpandButton = exports.CaloriesSummary = exports.CaloriesDescription = void 0;
|
|
8
|
+
exports.TripDetailSummary = exports.TripDetailsHeader = exports.TripDetailsBody = exports.TripDetails = exports.TripDetailIcon = exports.TripDetailDescription = exports.TripDetail = exports.FlexDropOffSummary = exports.FlexPickupSummary = exports.FlexSummary = exports.TransitFareSingle = exports.TransitFare = exports.Timing = exports.TNCFareCompanies = exports.TNCFare = exports.HideButton = exports.Fare = exports.ExpandButton = exports.CaloriesSummary = exports.CaloriesDescription = void 0;
|
|
9
9
|
|
|
10
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
11
|
|
|
12
12
|
const BaseButton = _styledComponents.default.button.withConfig({
|
|
13
13
|
displayName: "styled__BaseButton",
|
|
14
|
-
componentId: "
|
|
14
|
+
componentId: "sc-6q2ok2-0"
|
|
15
15
|
})(["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;"]);
|
|
16
16
|
|
|
17
17
|
const CaloriesDescription = _styledComponents.default.span.withConfig({
|
|
18
18
|
displayName: "styled__CaloriesDescription",
|
|
19
|
-
componentId: "
|
|
19
|
+
componentId: "sc-6q2ok2-1"
|
|
20
20
|
})([""]);
|
|
21
21
|
|
|
22
22
|
exports.CaloriesDescription = CaloriesDescription;
|
|
23
23
|
|
|
24
24
|
const CaloriesSummary = _styledComponents.default.span.withConfig({
|
|
25
25
|
displayName: "styled__CaloriesSummary",
|
|
26
|
-
componentId: "
|
|
26
|
+
componentId: "sc-6q2ok2-2"
|
|
27
27
|
})([""]);
|
|
28
28
|
|
|
29
29
|
exports.CaloriesSummary = CaloriesSummary;
|
|
@@ -31,102 +31,123 @@ const ExpandButton = (0, _styledComponents.default)(BaseButton).attrs({
|
|
|
31
31
|
"aria-label": "What does this mean?"
|
|
32
32
|
}).withConfig({
|
|
33
33
|
displayName: "styled__ExpandButton",
|
|
34
|
-
componentId: "
|
|
34
|
+
componentId: "sc-6q2ok2-3"
|
|
35
35
|
})(["color:#00f;font-size:16px;margin-left:6px;margin-top:-2px;"]);
|
|
36
36
|
exports.ExpandButton = ExpandButton;
|
|
37
37
|
|
|
38
38
|
const Fare = _styledComponents.default.span.withConfig({
|
|
39
39
|
displayName: "styled__Fare",
|
|
40
|
-
componentId: "
|
|
40
|
+
componentId: "sc-6q2ok2-4"
|
|
41
41
|
})([""]);
|
|
42
42
|
|
|
43
43
|
exports.Fare = Fare;
|
|
44
44
|
const HideButton = (0, _styledComponents.default)(BaseButton).withConfig({
|
|
45
45
|
displayName: "styled__HideButton",
|
|
46
|
-
componentId: "
|
|
46
|
+
componentId: "sc-6q2ok2-5"
|
|
47
47
|
})(["float:right;"]);
|
|
48
48
|
exports.HideButton = HideButton;
|
|
49
49
|
|
|
50
50
|
const TNCFare = _styledComponents.default.span.withConfig({
|
|
51
51
|
displayName: "styled__TNCFare",
|
|
52
|
-
componentId: "
|
|
52
|
+
componentId: "sc-6q2ok2-6"
|
|
53
53
|
})([""]);
|
|
54
54
|
|
|
55
55
|
exports.TNCFare = TNCFare;
|
|
56
56
|
|
|
57
57
|
const TNCFareCompanies = _styledComponents.default.span.withConfig({
|
|
58
58
|
displayName: "styled__TNCFareCompanies",
|
|
59
|
-
componentId: "
|
|
59
|
+
componentId: "sc-6q2ok2-7"
|
|
60
60
|
})(["text-transform:capitalize;"]);
|
|
61
61
|
|
|
62
62
|
exports.TNCFareCompanies = TNCFareCompanies;
|
|
63
63
|
|
|
64
64
|
const Timing = _styledComponents.default.span.withConfig({
|
|
65
65
|
displayName: "styled__Timing",
|
|
66
|
-
componentId: "
|
|
66
|
+
componentId: "sc-6q2ok2-8"
|
|
67
67
|
})([""]);
|
|
68
68
|
|
|
69
69
|
exports.Timing = Timing;
|
|
70
70
|
|
|
71
71
|
const TransitFare = _styledComponents.default.details.withConfig({
|
|
72
72
|
displayName: "styled__TransitFare",
|
|
73
|
-
componentId: "
|
|
73
|
+
componentId: "sc-6q2ok2-9"
|
|
74
74
|
})(["display:inline-block;> span{display:block;padding-left:1.75ch;}"]);
|
|
75
75
|
|
|
76
76
|
exports.TransitFare = TransitFare;
|
|
77
77
|
|
|
78
78
|
const TransitFareSingle = _styledComponents.default.span.withConfig({
|
|
79
79
|
displayName: "styled__TransitFareSingle",
|
|
80
|
-
componentId: "
|
|
80
|
+
componentId: "sc-6q2ok2-10"
|
|
81
81
|
})([""]);
|
|
82
82
|
|
|
83
83
|
exports.TransitFareSingle = TransitFareSingle;
|
|
84
84
|
|
|
85
|
+
const FlexSummary = _styledComponents.default.span.withConfig({
|
|
86
|
+
displayName: "styled__FlexSummary",
|
|
87
|
+
componentId: "sc-6q2ok2-11"
|
|
88
|
+
})([""]);
|
|
89
|
+
|
|
90
|
+
exports.FlexSummary = FlexSummary;
|
|
91
|
+
|
|
92
|
+
const FlexPickupSummary = _styledComponents.default.span.withConfig({
|
|
93
|
+
displayName: "styled__FlexPickupSummary",
|
|
94
|
+
componentId: "sc-6q2ok2-12"
|
|
95
|
+
})([""]);
|
|
96
|
+
|
|
97
|
+
exports.FlexPickupSummary = FlexPickupSummary;
|
|
98
|
+
|
|
99
|
+
const FlexDropOffSummary = _styledComponents.default.span.withConfig({
|
|
100
|
+
displayName: "styled__FlexDropOffSummary",
|
|
101
|
+
componentId: "sc-6q2ok2-13"
|
|
102
|
+
})([""]);
|
|
103
|
+
|
|
104
|
+
exports.FlexDropOffSummary = FlexDropOffSummary;
|
|
105
|
+
|
|
85
106
|
const TripDetail = _styledComponents.default.div.withConfig({
|
|
86
107
|
displayName: "styled__TripDetail",
|
|
87
|
-
componentId: "
|
|
108
|
+
componentId: "sc-6q2ok2-14"
|
|
88
109
|
})(["margin-top:6px;"]);
|
|
89
110
|
|
|
90
111
|
exports.TripDetail = TripDetail;
|
|
91
112
|
|
|
92
113
|
const TripDetailDescription = _styledComponents.default.div.withConfig({
|
|
93
114
|
displayName: "styled__TripDetailDescription",
|
|
94
|
-
componentId: "
|
|
115
|
+
componentId: "sc-6q2ok2-15"
|
|
95
116
|
})(["background-color:#fff;border:1px solid #888;font-size:12px;margin-top:2px;padding:8px;"]);
|
|
96
117
|
|
|
97
118
|
exports.TripDetailDescription = TripDetailDescription;
|
|
98
119
|
|
|
99
120
|
const TripDetailIcon = _styledComponents.default.div.withConfig({
|
|
100
121
|
displayName: "styled__TripDetailIcon",
|
|
101
|
-
componentId: "
|
|
122
|
+
componentId: "sc-6q2ok2-16"
|
|
102
123
|
})(["float:left;font-size:17px;"]);
|
|
103
124
|
|
|
104
125
|
exports.TripDetailIcon = TripDetailIcon;
|
|
105
126
|
|
|
106
127
|
const TripDetails = _styledComponents.default.div.withConfig({
|
|
107
128
|
displayName: "styled__TripDetails",
|
|
108
|
-
componentId: "
|
|
129
|
+
componentId: "sc-6q2ok2-17"
|
|
109
130
|
})(["background-color:#eee;border-radius:6px;margin-bottom:15px;margin-top:16px;padding:10px 16px;"]);
|
|
110
131
|
|
|
111
132
|
exports.TripDetails = TripDetails;
|
|
112
133
|
|
|
113
134
|
const TripDetailsBody = _styledComponents.default.div.withConfig({
|
|
114
135
|
displayName: "styled__TripDetailsBody",
|
|
115
|
-
componentId: "
|
|
136
|
+
componentId: "sc-6q2ok2-18"
|
|
116
137
|
})([""]);
|
|
117
138
|
|
|
118
139
|
exports.TripDetailsBody = TripDetailsBody;
|
|
119
140
|
|
|
120
141
|
const TripDetailsHeader = _styledComponents.default.div.withConfig({
|
|
121
142
|
displayName: "styled__TripDetailsHeader",
|
|
122
|
-
componentId: "
|
|
143
|
+
componentId: "sc-6q2ok2-19"
|
|
123
144
|
})(["font-size:18px;font-weight:600;"]);
|
|
124
145
|
|
|
125
146
|
exports.TripDetailsHeader = TripDetailsHeader;
|
|
126
147
|
|
|
127
148
|
const TripDetailSummary = _styledComponents.default.div.withConfig({
|
|
128
149
|
displayName: "styled__TripDetailSummary",
|
|
129
|
-
componentId: "
|
|
150
|
+
componentId: "sc-6q2ok2-20"
|
|
130
151
|
})(["margin-left:28px;padding-top:2px;display:flex;align-items:baseline;"]);
|
|
131
152
|
|
|
132
153
|
exports.TripDetailSummary = TripDetailSummary;
|
package/lib/styled.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/styled.
|
|
1
|
+
{"version":3,"sources":["../src/styled.ts"],"names":["BaseButton","styled","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;;AAEA,MAAMA,UAAU,GAAGC,0BAAOC,MAAV;AAAA;AAAA;AAAA,8PAAhB;;AAiBO,MAAMC,mBAAmB,GAAGF,0BAAOG,IAAV;AAAA;AAAA;AAAA,QAAzB;;;;AAEA,MAAMC,eAAe,GAAGJ,0BAAOG,IAAV;AAAA;AAAA;AAAA,QAArB;;;AAEA,MAAME,YAAY,GAAG,+BAAON,UAAP,EAAmBO,KAAnB,CAAyB;AACnD,gBAAc;AADqC,CAAzB,CAAH;AAAA;AAAA;AAAA,kEAAlB;;;AASA,MAAMC,IAAI,GAAGP,0BAAOG,IAAV;AAAA;AAAA;AAAA,QAAV;;;AAEA,MAAMK,UAAU,GAAG,+BAAOT,UAAP,CAAH;AAAA;AAAA;AAAA,oBAAhB;;;AAIA,MAAMU,OAAO,GAAGT,0BAAOG,IAAV;AAAA;AAAA;AAAA,QAAb;;;;AAEA,MAAMO,gBAAgB,GAAGV,0BAAOG,IAAV;AAAA;AAAA;AAAA,kCAAtB;;;;AAIA,MAAMQ,MAAM,GAAGX,0BAAOG,IAAV;AAAA;AAAA;AAAA,QAAZ;;;;AAEA,MAAMS,WAAW,GAAGZ,0BAAOa,OAAV;AAAA;AAAA;AAAA,uEAAjB;;;;AAUA,MAAMC,iBAAiB,GAAGd,0BAAOG,IAAV;AAAA;AAAA;AAAA,QAAvB;;;;AAEA,MAAMY,WAAW,GAAGf,0BAAOG,IAAV;AAAA;AAAA;AAAA,QAAjB;;;;AAEA,MAAMa,iBAAiB,GAAGhB,0BAAOG,IAAV;AAAA;AAAA;AAAA,QAAvB;;;;AAEA,MAAMc,kBAAkB,GAAGjB,0BAAOG,IAAV;AAAA;AAAA;AAAA,QAAxB;;;;AAEA,MAAMe,UAAU,GAAGlB,0BAAOmB,GAAV;AAAA;AAAA;AAAA,uBAAhB;;;;AAIA,MAAMC,qBAAqB,GAAGpB,0BAAOmB,GAAV;AAAA;AAAA;AAAA,8FAA3B;;;;AAQA,MAAME,cAAc,GAAGrB,0BAAOmB,GAAV;AAAA;AAAA;AAAA,kCAApB;;;;AAKA,MAAMG,WAAW,GAAGtB,0BAAOmB,GAAV;AAAA;AAAA;AAAA,qGAAjB;;;;AAQA,MAAMI,eAAe,GAAGvB,0BAAOmB,GAAV;AAAA;AAAA;AAAA,QAArB;;;;AAEA,MAAMK,iBAAiB,GAAGxB,0BAAOmB,GAAV;AAAA;AAAA;AAAA,uCAAvB;;;;AAKA,MAAMM,iBAAiB,GAAGzB,0BAAOmB,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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Component, ReactElement } from "react";
|
|
2
|
+
declare type Props = {
|
|
3
|
+
description?: ReactElement | string;
|
|
4
|
+
icon: ReactElement;
|
|
5
|
+
summary: ReactElement | string;
|
|
6
|
+
};
|
|
7
|
+
declare type State = {
|
|
8
|
+
expanded: boolean;
|
|
9
|
+
};
|
|
10
|
+
export default class TripDetail extends Component<Props, State> {
|
|
11
|
+
constructor(props: Props);
|
|
12
|
+
toggle: () => void;
|
|
13
|
+
onExpandClick: () => void;
|
|
14
|
+
onHideClick: () => void;
|
|
15
|
+
render(): ReactElement;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=trip-detail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trip-detail.d.ts","sourceRoot":"","sources":["../src/trip-detail.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAOvD,aAAK,KAAK,GAAG;IACX,WAAW,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IACpC,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,YAAY,GAAG,MAAM,CAAC;CAChC,CAAC;AAEF,aAAK,KAAK,GAAG;IACX,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;gBACjD,KAAK,EAAE,KAAK;IAOxB,MAAM,QAAO,IAAI,CAIf;IAEF,aAAa,QAAO,IAAI,CAEtB;IAEF,WAAW,QAAO,IAAI,CAEpB;IAEF,MAAM,IAAI,YAAY;CA8BvB"}
|
package/lib/trip-detail.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = void 0;
|
|
9
7
|
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
9
|
|
|
14
10
|
var _QuestionCircle = require("@styled-icons/fa-solid/QuestionCircle");
|
|
@@ -81,12 +77,4 @@ class TripDetail extends _react.Component {
|
|
|
81
77
|
}
|
|
82
78
|
|
|
83
79
|
exports.default = TripDetail;
|
|
84
|
-
TripDetail.propTypes = {
|
|
85
|
-
icon: _propTypes.default.node.isRequired,
|
|
86
|
-
summary: _propTypes.default.node.isRequired,
|
|
87
|
-
description: _propTypes.default.node
|
|
88
|
-
};
|
|
89
|
-
TripDetail.defaultProps = {
|
|
90
|
-
description: undefined
|
|
91
|
-
};
|
|
92
80
|
//# sourceMappingURL=trip-detail.js.map
|
package/lib/trip-detail.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/trip-detail.
|
|
1
|
+
{"version":3,"sources":["../src/trip-detail.tsx"],"names":["TripDetail","Component","constructor","props","toggle","expanded","state","onHideClick","onExpandClick","setState","render","icon","summary","description","animation"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAYe,MAAMA,UAAN,SAAyBC,gBAAzB,CAAiD;AAC9DC,EAAAA,WAAW,CAACC,KAAD,EAAe;AACxB,UAAMA,KAAN;;AADwB,SAO1BC,MAP0B,GAOjB,MAAY;AACnB,YAAM;AAAEC,QAAAA;AAAF,UAAe,KAAKC,KAA1B;AACA,UAAID,QAAJ,EAAc,KAAKE,WAAL,GAAd,KACK,KAAKC,aAAL;AACN,KAXyB;;AAAA,SAa1BA,aAb0B,GAaV,MAAY;AAC1B,WAAKC,QAAL,CAAc;AAAEJ,QAAAA,QAAQ,EAAE;AAAZ,OAAd;AACD,KAfyB;;AAAA,SAiB1BE,WAjB0B,GAiBZ,MAAY;AACxB,WAAKE,QAAL,CAAc;AAAEJ,QAAAA,QAAQ,EAAE;AAAZ,OAAd;AACD,KAnByB;;AAExB,SAAKC,KAAL,GAAa;AACXD,MAAAA,QAAQ,EAAE;AADC,KAAb;AAGD;;AAgBDK,EAAAA,MAAM,GAAiB;AACrB,UAAM;AAAEC,MAAAA,IAAF;AAAQC,MAAAA,OAAR;AAAiBC,MAAAA;AAAjB,QAAiC,KAAKV,KAA5C;AACA,UAAM;AAAEE,MAAAA;AAAF,QAAe,KAAKC,KAA1B;AACA,wBACE,6BAAC,CAAD,CAAG,UAAH,qBACE,6BAAC,CAAD,CAAG,cAAH,QAAmBK,IAAnB,CADF,eAEE,6BAAC,CAAD,CAAG,iBAAH,QACGC,OADH,EAEGC,WAAW,iBACV,6BAAC,CAAD,CAAG,YAAH;AAAgB,MAAA,OAAO,EAAE,KAAKT;AAA9B,oBACE,6BAAC,8BAAD;AAAgB,MAAA,IAAI,EAAC;AAArB,MADF,CAHJ,CAFF,eAUE,6BAAC,sCAAD;AACE,MAAA,KAAK,EAAE;AAAEU,QAAAA,SAAS,EAAE;AAAb,OADT;AAEE,MAAA,KAAK,EAAE;AAAEA,QAAAA,SAAS,EAAE;AAAb;AAFT,OAIGT,QAAQ,iBACP,6BAAC,CAAD,CAAG,qBAAH,qBACE,6BAAC,CAAD,CAAG,UAAH;AAAc,MAAA,OAAO,EAAE,KAAKE;AAA5B,oBACE,6BAAC,wBAAD;AAAa,MAAA,IAAI,EAAC;AAAlB,MADF,CADF,EAIGM,WAJH,CALJ,CAVF,CADF;AA0BD;;AAnD6D","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/lib/types.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Itinerary } from "@opentripplanner/types";
|
|
2
|
+
import type { ReactElement } from "react";
|
|
3
|
+
export interface CaloriesDetailsProps {
|
|
4
|
+
bikeSeconds: number;
|
|
5
|
+
calories: number;
|
|
6
|
+
walkSeconds: number;
|
|
7
|
+
}
|
|
8
|
+
export interface DepartureDetailsProps {
|
|
9
|
+
departureDate: Date;
|
|
10
|
+
}
|
|
11
|
+
export interface TransitFareData {
|
|
12
|
+
[key: string]: {
|
|
13
|
+
currencyCode: string;
|
|
14
|
+
transitFare: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface FareDetailsProps {
|
|
18
|
+
maxTNCFare: number;
|
|
19
|
+
minTNCFare: number;
|
|
20
|
+
transitFares: TransitFareData;
|
|
21
|
+
}
|
|
22
|
+
export interface TransitFareProps {
|
|
23
|
+
fareKey: string;
|
|
24
|
+
fareNameFallback?: ReactElement;
|
|
25
|
+
fareKeyNameMap: {
|
|
26
|
+
[key: string]: string;
|
|
27
|
+
};
|
|
28
|
+
transitFares: TransitFareData;
|
|
29
|
+
}
|
|
30
|
+
export interface TripDetailsProps {
|
|
31
|
+
/**
|
|
32
|
+
* Slot for a custom component to render the expandable section for calories.
|
|
33
|
+
*/
|
|
34
|
+
CaloriesDetails?: React.ElementType<CaloriesDetailsProps>;
|
|
35
|
+
/**
|
|
36
|
+
* Used for additional styling with styled components for example.
|
|
37
|
+
*/
|
|
38
|
+
className?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Determines which transit fare should be displayed by default, should there be multiple transit fare types.
|
|
41
|
+
*/
|
|
42
|
+
defaultFareKey?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Slot for a custom component to render the expandable section for departure.
|
|
45
|
+
*/
|
|
46
|
+
DepartureDetails?: React.ElementType<DepartureDetailsProps>;
|
|
47
|
+
/**
|
|
48
|
+
* Slot for a custom component to render the expandable section for fares.
|
|
49
|
+
*/
|
|
50
|
+
FareDetails?: React.ElementType<FareDetailsProps>;
|
|
51
|
+
/**
|
|
52
|
+
* Mapping between fare keys and human-readable names for them.
|
|
53
|
+
*/
|
|
54
|
+
fareKeyNameMap?: {
|
|
55
|
+
[name: string]: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Itinerary that the user has selected to view, contains multiple legs.
|
|
59
|
+
*/
|
|
60
|
+
itinerary: Itinerary;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG;QACb,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAA;CACF;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,eAAe,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,cAAc,EAAE;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;IACF,YAAY,EAAE,eAAe,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;IAC1D;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAC5D;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAClD;;OAEG;IACH,cAAc,CAAC,EAAE;QACf,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB,CAAC;IACF;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;CACtB"}
|
package/lib/types.js
ADDED
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentripplanner/trip-details",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A component for displaying details about a trip planning itinerary",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
7
|
+
"types": "lib/index.d.js",
|
|
7
8
|
"repository": "https://github.com/opentripplanner/otp-ui.git",
|
|
8
9
|
"homepage": "https://github.com/opentripplanner/otp-ui#readme",
|
|
9
10
|
"author": "Evan Siroky",
|
|
@@ -11,22 +12,24 @@
|
|
|
11
12
|
"private": false,
|
|
12
13
|
"dependencies": {
|
|
13
14
|
"@opentripplanner/core-utils": "^4.5.0",
|
|
14
|
-
"@opentripplanner/humanize-distance": "^1.1.0",
|
|
15
|
-
"moment": "^2.24.0",
|
|
16
|
-
"prop-types": "^15.7.2",
|
|
17
15
|
"@styled-icons/fa-solid": "^10.34.0",
|
|
16
|
+
"flat": "^5.0.2",
|
|
18
17
|
"velocity-react": "^1.4.3"
|
|
19
18
|
},
|
|
20
19
|
"devDependencies": {
|
|
21
|
-
"@opentripplanner/
|
|
22
|
-
"@
|
|
20
|
+
"@opentripplanner/types": "^1.0.2",
|
|
21
|
+
"@types/flat": "^5.0.2"
|
|
23
22
|
},
|
|
24
23
|
"peerDependencies": {
|
|
25
24
|
"react": "^16.14.0",
|
|
25
|
+
"react-intl": "^5.20.4",
|
|
26
26
|
"styled-components": "^5.3.0"
|
|
27
27
|
},
|
|
28
28
|
"bugs": {
|
|
29
29
|
"url": "https://github.com/opentripplanner/otp-ui/issues"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "0af1b7cda60bd4252b219dcf893e01c2acb2ed5d"
|
|
31
|
+
"gitHead": "0af1b7cda60bd4252b219dcf893e01c2acb2ed5d",
|
|
32
|
+
"scripts": {
|
|
33
|
+
"tsc": "tsc && echo Remove the @ts-expect-error exception in index.tsx once core-utils is typed!"
|
|
34
|
+
}
|
|
32
35
|
}
|