@opentripplanner/trip-details 1.6.0 → 2.0.2-alpha.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/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: "sr23bt-0"
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: "sr23bt-1"
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: "sr23bt-2"
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: "sr23bt-3"
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: "sr23bt-4"
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: "sr23bt-5"
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: "sr23bt-6"
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: "sr23bt-7"
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: "sr23bt-8"
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: "sr23bt-9"
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: "sr23bt-10"
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: "sr23bt-11"
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: "sr23bt-12"
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: "sr23bt-13"
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: "sr23bt-14"
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: "sr23bt-15"
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: "sr23bt-16"
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: "sr23bt-17"
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.js"],"names":["BaseButton","styled","button","CaloriesDescription","span","CaloriesSummary","ExpandButton","attrs","Fare","HideButton","TNCFare","TNCFareCompanies","Timing","TransitFare","details","TransitFareSingle","TripDetail","div","TripDetailDescription","TripDetailIcon","TripDetails","TripDetailsBody","TripDetailsHeader","TripDetailSummary"],"mappings":";;;;;;;;;AAAA;;AAEA,MAAMA,UAAU,GAAGC,0BAAOC,MAAV;AAAA;AAAA;A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AiB,GAAGtB,0BAAOgB,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 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"}
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"}
@@ -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
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/trip-detail.js"],"names":["TripDetail","Component","constructor","props","toggle","expanded","state","onHideClick","onExpandClick","setState","render","icon","summary","description","animation","propTypes","PropTypes","node","isRequired","defaultProps","undefined"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAEe,MAAMA,UAAN,SAAyBC,gBAAzB,CAAmC;AAChDC,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACjB,UAAMA,KAAN;;AADiB,SAOnBC,MAPmB,GAOV,MAAM;AACb,YAAM;AAAEC,QAAAA;AAAF,UAAe,KAAKC,KAA1B;AACA,UAAID,QAAJ,EAAc,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AA,IAAI,EAAEK,mBAAUC,IAAV,CAAeC,UADA;AAErBN,EAAAA,OAAO,EAAEI,mBAAUC,IAAV,CAAeC,UAFH;AAGrBL,EAAAA,WAAW,EAAEG,mBAAUC;AAHF,CAAvB;AAMAjB,UAAU,CAACmB,YAAX,GAA0B;AACxBN,EAAAA,WAAW,EAAEO;AADW,CAA1B","sourcesContent":["import PropTypes from \"prop-types\";\nimport React, { Component } 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\nexport default class TripDetail extends Component {\n constructor(props) {\n super(props);\n this.state = {\n expanded: false\n };\n }\n\n toggle = () => {\n const { expanded } = this.state;\n if (expanded) this.onHideClick();\n else this.onExpandClick();\n };\n\n onExpandClick = () => {\n this.setState({ expanded: true });\n };\n\n onHideClick = () => {\n this.setState({ expanded: false });\n };\n\n render() {\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\nTripDetail.propTypes = {\n icon: PropTypes.node.isRequired,\n summary: PropTypes.node.isRequired,\n description: PropTypes.node\n};\n\nTripDetail.defaultProps = {\n description: undefined\n};\n"],"file":"trip-detail.js"}
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,67 @@
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
+ currency: {
14
+ currencyCode: string;
15
+ defaultFractionDigits: number;
16
+ currency: string;
17
+ symbol: string;
18
+ };
19
+ cents: number;
20
+ };
21
+ }
22
+ export interface FareDetailsProps {
23
+ maxTNCFare: number;
24
+ minTNCFare: number;
25
+ transitFares: TransitFareData;
26
+ }
27
+ export interface TransitFareProps {
28
+ fareKey: string;
29
+ fareNameFallback?: ReactElement;
30
+ fareKeyNameMap: {
31
+ [key: string]: string;
32
+ };
33
+ transitFares: TransitFareData;
34
+ }
35
+ export interface TripDetailsProps {
36
+ /**
37
+ * Slot for a custom component to render the expandable section for calories.
38
+ */
39
+ CaloriesDetails?: React.ElementType<CaloriesDetailsProps>;
40
+ /**
41
+ * Used for additional styling with styled components for example.
42
+ */
43
+ className?: string;
44
+ /**
45
+ * Determines which transit fare should be displayed by default, should there be multiple transit fare types.
46
+ */
47
+ defaultFareKey?: string;
48
+ /**
49
+ * Slot for a custom component to render the expandable section for departure.
50
+ */
51
+ DepartureDetails?: React.ElementType<DepartureDetailsProps>;
52
+ /**
53
+ * Slot for a custom component to render the expandable section for fares.
54
+ */
55
+ FareDetails?: React.ElementType<FareDetailsProps>;
56
+ /**
57
+ * Mapping between fare keys and human-readable names for them.
58
+ */
59
+ fareKeyNameMap?: {
60
+ [name: string]: string;
61
+ };
62
+ /**
63
+ * Itinerary that the user has selected to view, contains multiple legs.
64
+ */
65
+ itinerary: Itinerary;
66
+ }
67
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../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E,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
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
package/package.json CHANGED
@@ -1,32 +1,35 @@
1
1
  {
2
2
  "name": "@opentripplanner/trip-details",
3
- "version": "1.6.0",
3
+ "version": "2.0.2-alpha.1",
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",
10
11
  "license": "MIT",
11
12
  "private": false,
12
13
  "dependencies": {
13
- "@opentripplanner/core-utils": "^4.5.0",
14
- "@opentripplanner/humanize-distance": "^1.1.0",
15
- "moment": "^2.24.0",
16
- "prop-types": "^15.7.2",
14
+ "@opentripplanner/core-utils": "^4.6.0",
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/icons": "^1.2.1",
22
- "@opentripplanner/itinerary-body": "^2.6.0"
20
+ "@opentripplanner/types": "^1.1.0",
21
+ "@types/flat": "^5.0.2"
23
22
  },
24
23
  "peerDependencies": {
25
24
  "react": "^16.14.0",
25
+ "react-intl": "^5.24.6",
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
  }
@@ -0,0 +1,273 @@
1
+ import flatten from "flat";
2
+ import React, { ReactElement } from "react";
3
+ import {
4
+ ComponentMeta,
5
+ ComponentStory,
6
+ Parameters,
7
+ StoryContext
8
+ } from "@storybook/react";
9
+ import styled from "styled-components";
10
+ // The below eslint-disable is due to https://github.com/storybookjs/storybook/issues/13408
11
+ // eslint-disable-next-line import/no-named-as-default
12
+ import TripDetails from ".";
13
+ import * as TripDetailsClasses from "./styled";
14
+ import {
15
+ CaloriesDetailsProps,
16
+ DepartureDetailsProps,
17
+ FareDetailsProps,
18
+ TripDetailsProps
19
+ } from "./types";
20
+
21
+ import customMessages from "../__mocks__/custom-messages.yml";
22
+
23
+ // import mock itinaries. These are all trip plan outputs from OTP.
24
+ const bikeOnlyItinerary = require("@opentripplanner/itinerary-body/src/__mocks__/itineraries/bike-only.json");
25
+ const bikeRentalItinerary = require("@opentripplanner/itinerary-body/src/__mocks__/itineraries/bike-rental.json");
26
+ const bikeRentalTransitBikeRentalItinerary = require("@opentripplanner/itinerary-body/src/__mocks__/itineraries/bike-rental-transit-bike-rental.json");
27
+ const bikeTransitBikeItinerary = require("@opentripplanner/itinerary-body/src/__mocks__/itineraries/bike-transit-bike.json");
28
+ const eScooterRentalItinerary = require("@opentripplanner/itinerary-body/src/__mocks__/itineraries/e-scooter-rental.json");
29
+ const eScooterRentalTransiteScooterRentalItinerary = require("@opentripplanner/itinerary-body/src/__mocks__/itineraries/e-scooter-transit-e-scooter.json");
30
+ const parkAndRideItinerary = require("@opentripplanner/itinerary-body/src/__mocks__/itineraries/park-and-ride.json");
31
+ const tncTransitTncItinerary = require("@opentripplanner/itinerary-body/src/__mocks__/itineraries/tnc-transit-tnc.json");
32
+ const walkInterlinedTransitItinerary = require("@opentripplanner/itinerary-body/src/__mocks__/itineraries/walk-interlined-transit-walk.json");
33
+ const walkOnlyItinerary = require("@opentripplanner/itinerary-body/src/__mocks__/itineraries/walk-only.json");
34
+ const walkTransitWalkItinerary = require("@opentripplanner/itinerary-body/src/__mocks__/itineraries/walk-transit-walk.json");
35
+ const walkTransitWalkTransitWalkItinerary = require("@opentripplanner/itinerary-body/src/__mocks__/itineraries/walk-transit-walk-transit-walk.json");
36
+ const fareComponentsItinerary = require("@opentripplanner/itinerary-body/src/__mocks__/itineraries/fare-components.json");
37
+
38
+ // Change currency code on one of the itineraries for illustration.
39
+ // (other currency fields in the itinerary object are not used for display).
40
+ const itinCurrency =
41
+ walkTransitWalkTransitWalkItinerary.fare.fare.regular.currency;
42
+ itinCurrency.currencyCode = "EUR";
43
+
44
+ const StyledTripDetails = styled(TripDetails)`
45
+ ${TripDetailsClasses.TripDetailsHeader} {
46
+ background-color: pink;
47
+ }
48
+ `;
49
+
50
+ const longDateFormat = "MMMM D, YYYY";
51
+
52
+ const englishFareKeyMap = {
53
+ regular: "Transit Fare",
54
+ student: "Student Fare",
55
+ senior: "Senior Fare",
56
+ tram: "Tram Fare",
57
+ special: "Special Fare",
58
+ youth: "Youth Fare",
59
+ electronicRegular: "Orca Fare",
60
+ electronicYouth: "Orca Youth Fare",
61
+ electronicSpecial: "Orca Special Fare",
62
+ electronicSenior: "Orca Senior Fare"
63
+ };
64
+
65
+ const frenchFareKeyMap = {
66
+ regular: "Tarif en transports",
67
+ student: "Tarif étudiants",
68
+ senior: "Tarif séniors",
69
+ tram: "Tarif tram",
70
+ special: "Tarif spécial",
71
+ youth: "Tarif jeunes",
72
+ electronicRegular: "Tarif Orca",
73
+ electronicYouth: "Tarif Orca jeunes",
74
+ electronicSpecial: "Tarif Orca spécial",
75
+ electronicSenior: "Tarif Orca séniors"
76
+ };
77
+
78
+ // Custom slots for expandable detail sections.
79
+ const CustomDepartureDetails = ({
80
+ departureDate
81
+ }: DepartureDetailsProps): ReactElement => (
82
+ <>
83
+ Custom messages about {departureDate.format(longDateFormat)} can be
84
+ constructed dynamically using any markup.
85
+ </>
86
+ );
87
+
88
+ const CustomFareDetails = ({
89
+ maxTNCFare,
90
+ minTNCFare,
91
+ transitFares
92
+ }: FareDetailsProps): ReactElement => (
93
+ <>
94
+ Custom details about fares (transitFares: {JSON.stringify(transitFares)}{" "}
95
+ (cents), minTNCFare: {minTNCFare} and maxTNCFare: {maxTNCFare} can be
96
+ constructed dynamically using any markup.
97
+ </>
98
+ );
99
+
100
+ const CustomCaloriesDetails = ({
101
+ bikeSeconds,
102
+ calories,
103
+ walkSeconds
104
+ }: CaloriesDetailsProps): ReactElement => (
105
+ <>
106
+ Custom message about {calories} calories burned,
107
+ {walkSeconds} seconds and {bikeSeconds} seconds.
108
+ </>
109
+ );
110
+
111
+ /**
112
+ * Create a template component for each TripDetails story.
113
+ * A Component argument is passed. Once bound,
114
+ * the Component to render should not change.
115
+ * @param Component The component to render.
116
+ */
117
+ function createTripDetailsTemplate(
118
+ Component: typeof TripDetails = TripDetails
119
+ ): ComponentStory<typeof TripDetails> {
120
+ const TripDetailsTemplate = (
121
+ {
122
+ CaloriesDetails,
123
+ defaultFare,
124
+ DepartureDetails,
125
+ FareDetails,
126
+ itinerary
127
+ }: TripDetailsProps,
128
+ { globals, parameters }: StoryContext
129
+ ): ReactElement => {
130
+ const { locale } = globals;
131
+ const { useCustomFareKeyMap } = parameters;
132
+ const fareKeyNameMap = useCustomFareKeyMap
133
+ ? locale === "en-US"
134
+ ? englishFareKeyMap
135
+ : frenchFareKeyMap
136
+ : {};
137
+ return (
138
+ <Component
139
+ CaloriesDetails={CaloriesDetails}
140
+ defaultFare={defaultFare}
141
+ DepartureDetails={DepartureDetails}
142
+ FareDetails={FareDetails}
143
+ fareKeyNameMap={fareKeyNameMap}
144
+ itinerary={itinerary}
145
+ />
146
+ );
147
+ };
148
+ return TripDetailsTemplate;
149
+ }
150
+
151
+ /**
152
+ * Helper to simplify story declaration.
153
+ */
154
+ function makeStory(
155
+ args: TripDetailsProps,
156
+ parameters: Parameters,
157
+ Component?: typeof TripDetails
158
+ ): ComponentStory<typeof TripDetails> {
159
+ const BoundTripDetails = createTripDetailsTemplate(Component).bind({});
160
+ BoundTripDetails.args = args;
161
+ BoundTripDetails.parameters = parameters;
162
+ return BoundTripDetails;
163
+ }
164
+
165
+ export default {
166
+ args: {
167
+ defaultFareKey: "regular"
168
+ },
169
+ component: TripDetails,
170
+ parameters: {
171
+ // Hide all controls
172
+ // (there are no args that the user can interactively change for this component).
173
+ controls: {
174
+ hideNoControlsWarning: true,
175
+ include: []
176
+ }
177
+ },
178
+ title: "TripDetails"
179
+ } as ComponentMeta<typeof TripDetails>;
180
+
181
+ export const WalkOnlyItinerary = makeStory({
182
+ itinerary: walkOnlyItinerary
183
+ });
184
+
185
+ export const BikeOnlyItinerary = makeStory({
186
+ itinerary: bikeOnlyItinerary
187
+ });
188
+
189
+ export const WalkTransitWalkItinerary = makeStory({
190
+ itinerary: walkTransitWalkItinerary
191
+ });
192
+
193
+ export const StyledWalkTransitWalkItinerary = makeStory(
194
+ {
195
+ itinerary: walkTransitWalkItinerary
196
+ },
197
+ null,
198
+ StyledTripDetails
199
+ );
200
+
201
+ export const BikeTransitBikeItinerary = makeStory({
202
+ itinerary: bikeTransitBikeItinerary
203
+ });
204
+
205
+ export const WalkInterlinedTransitItinerary = makeStory(
206
+ {
207
+ defaultFareKey: "electronicRegular",
208
+ itinerary: walkInterlinedTransitItinerary
209
+ },
210
+ {
211
+ useCustomFareKeyMap: true
212
+ }
213
+ );
214
+
215
+ export const WalkTransitTransferItinerary = makeStory({
216
+ itinerary: walkTransitWalkTransitWalkItinerary
217
+ });
218
+
219
+ export const BikeRentalItinerary = makeStory({
220
+ itinerary: bikeRentalItinerary
221
+ });
222
+
223
+ export const EScooterRentalItinerary = makeStory({
224
+ itinerary: eScooterRentalItinerary
225
+ });
226
+
227
+ export const ParkAndRideItinerary = makeStory({
228
+ itinerary: parkAndRideItinerary
229
+ });
230
+
231
+ export const BikeRentalTransitItinerary = makeStory({
232
+ itinerary: bikeRentalTransitBikeRentalItinerary
233
+ });
234
+
235
+ export const EScooterRentalTransitItinerary = makeStory({
236
+ itinerary: eScooterRentalTransiteScooterRentalItinerary
237
+ });
238
+
239
+ export const TncTransitItinerary = makeStory(
240
+ {
241
+ itinerary: tncTransitTncItinerary
242
+ },
243
+ {
244
+ useCustomFareKeyMap: true
245
+ }
246
+ );
247
+
248
+ const flattenedMessages = flatten(customMessages);
249
+ export const TncTransitItineraryWithCustomMessagesAndDetails = makeStory(
250
+ {
251
+ CaloriesDetails: CustomCaloriesDetails,
252
+ defaultFareKey: "electronicRegular",
253
+ DepartureDetails: CustomDepartureDetails,
254
+ FareDetails: CustomFareDetails,
255
+ itinerary: tncTransitTncItinerary
256
+ },
257
+ {
258
+ // For illustration purposes,
259
+ // override a subset of localized strings with custom messages.
260
+ reactIntl: {
261
+ messages: {
262
+ "en-US": flattenedMessages,
263
+ fr: flattenedMessages
264
+ }
265
+ },
266
+ useCustomFareKeyMap: true
267
+ },
268
+ StyledTripDetails
269
+ );
270
+
271
+ export const FlexItinerary = makeStory({
272
+ itinerary: fareComponentsItinerary
273
+ });