@opentripplanner/trip-details 9.0.5-alpha.2 → 9.0.6
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/README.md +2 -5
- package/lib/components/departure-date.js +41 -45
- package/lib/components/departure-date.js.map +1 -1
- package/lib/components/emissions.d.ts +0 -1
- package/lib/components/emissions.d.ts.map +1 -1
- package/lib/components/emissions.js +63 -57
- package/lib/components/emissions.js.map +1 -1
- package/lib/components/fares-v2-table.d.ts +0 -1
- package/lib/components/fares-v2-table.d.ts.map +1 -1
- package/lib/components/fares-v2-table.js +179 -146
- package/lib/components/fares-v2-table.js.map +1 -1
- package/lib/components/fares.js +123 -92
- package/lib/components/fares.js.map +1 -1
- package/lib/components/flex-booking-info.d.ts +0 -1
- package/lib/components/flex-booking-info.d.ts.map +1 -1
- package/lib/components/flex-booking-info.js +37 -55
- package/lib/components/flex-booking-info.js.map +1 -1
- package/lib/components/time-active.js +66 -40
- package/lib/components/time-active.js.map +1 -1
- package/lib/index.js +65 -53
- package/lib/index.js.map +1 -1
- package/lib/styled.js +92 -119
- package/lib/styled.js.map +1 -1
- package/lib/trip-detail.d.ts.map +1 -1
- package/lib/trip-detail.js +62 -64
- package/lib/trip-detail.js.map +1 -1
- package/lib/types.d.ts +0 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +4 -1
- package/lib/types.js.map +1 -1
- package/lib/utils.js +23 -17
- package/lib/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/__snapshots__/TripDetails.story.tsx.snap +187 -82
- package/tsconfig.tsbuildinfo +1 -1
package/lib/index.js
CHANGED
|
@@ -1,68 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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;
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
17
6
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const react_intl_1 = require("react-intl");
|
|
32
|
-
const flat_1 = require("flat");
|
|
33
|
-
const S = __importStar(require("./styled"));
|
|
7
|
+
Object.defineProperty(exports, "FaresV2Table", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _faresV2Table.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
exports.Styled = void 0;
|
|
14
|
+
exports.TripDetails = TripDetails;
|
|
15
|
+
exports.default = void 0;
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
|
+
var _reactIntl = require("react-intl");
|
|
18
|
+
var _flat = require("flat");
|
|
19
|
+
var S = _interopRequireWildcard(require("./styled"));
|
|
34
20
|
exports.Styled = S;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
21
|
+
var _flexBookingInfo = _interopRequireDefault(require("./components/flex-booking-info"));
|
|
22
|
+
var _faresV2Table = _interopRequireDefault(require("./components/fares-v2-table"));
|
|
23
|
+
var _emissions = _interopRequireDefault(require("./components/emissions"));
|
|
24
|
+
var _fares = _interopRequireDefault(require("./components/fares"));
|
|
25
|
+
var _timeActive = _interopRequireWildcard(require("./components/time-active"));
|
|
26
|
+
var _departureDate = _interopRequireDefault(require("./components/departure-date"));
|
|
27
|
+
var _enUS = _interopRequireDefault(require("../i18n/en-US.yml"));
|
|
28
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
42
29
|
// Load the default messages.
|
|
43
|
-
|
|
30
|
+
|
|
44
31
|
// HACK: We should flatten the messages loaded above because
|
|
45
32
|
// the YAML loaders behave differently between webpack and our version of jest:
|
|
46
33
|
// - the yaml loader for webpack returns a nested object,
|
|
47
34
|
// - the yaml loader for jest returns messages with flattened ids.
|
|
48
|
-
const defaultMessages = (0,
|
|
35
|
+
const defaultMessages = (0, _flat.flatten)(_enUS.default);
|
|
49
36
|
function cn(className, arg1) {
|
|
50
|
-
|
|
37
|
+
return className ? `${className} ${arg1}` : arg1;
|
|
51
38
|
}
|
|
39
|
+
|
|
52
40
|
/**
|
|
53
41
|
* Renders trip details such as departure instructions, fare amount, and minutes active.
|
|
54
42
|
*/
|
|
55
|
-
function TripDetails({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
43
|
+
function TripDetails({
|
|
44
|
+
className = "",
|
|
45
|
+
co2Config,
|
|
46
|
+
defaultFareType,
|
|
47
|
+
DepartureDetails = null,
|
|
48
|
+
FareDetails = null,
|
|
49
|
+
itinerary,
|
|
50
|
+
showApproximateMinutesActive,
|
|
51
|
+
TimeActiveDetails = _timeActive.DefaultTimeActiveDetails
|
|
52
|
+
}) {
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(S.TripDetails, {
|
|
54
|
+
className: cn(className, "trip-details")
|
|
55
|
+
}, /*#__PURE__*/_react.default.createElement(S.TripDetailsHeader, {
|
|
56
|
+
id: "trip-details-header"
|
|
57
|
+
}, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
58
|
+
defaultMessage: defaultMessages["otpUi.TripDetails.title"],
|
|
59
|
+
description: "Title (heading) text of the component.",
|
|
60
|
+
id: "otpUi.TripDetails.title"
|
|
61
|
+
})), /*#__PURE__*/_react.default.createElement(S.TripDetailsBody, null, /*#__PURE__*/_react.default.createElement(_departureDate.default, {
|
|
62
|
+
itinerary: itinerary,
|
|
63
|
+
DepartureDetails: DepartureDetails
|
|
64
|
+
}), /*#__PURE__*/_react.default.createElement(_fares.default, {
|
|
65
|
+
itinerary: itinerary,
|
|
66
|
+
FareDetails: FareDetails,
|
|
67
|
+
defaultFareType: defaultFareType
|
|
68
|
+
}), /*#__PURE__*/_react.default.createElement(_timeActive.default, {
|
|
69
|
+
itinerary: itinerary,
|
|
70
|
+
TimeActiveDetails: TimeActiveDetails,
|
|
71
|
+
showApproximateMinutesActive: showApproximateMinutesActive
|
|
72
|
+
}), /*#__PURE__*/_react.default.createElement(_flexBookingInfo.default, {
|
|
73
|
+
itinerary: itinerary
|
|
74
|
+
}), /*#__PURE__*/_react.default.createElement(_emissions.default, {
|
|
75
|
+
itinerary: itinerary,
|
|
76
|
+
co2Config: co2Config
|
|
77
|
+
})));
|
|
65
78
|
}
|
|
66
|
-
exports.
|
|
67
|
-
exports.default = TripDetails;
|
|
79
|
+
var _default = exports.default = TripDetails; // Rename styled components for export.
|
|
68
80
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_reactIntl","_flat","S","_interopRequireWildcard","exports","Styled","_flexBookingInfo","_faresV2Table","_emissions","_fares","_timeActive","_departureDate","_enUS","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","defaultMessages","flatten","defaultEnglishMessages","cn","className","arg1","TripDetails","co2Config","defaultFareType","DepartureDetails","FareDetails","itinerary","showApproximateMinutesActive","TimeActiveDetails","DefaultTimeActiveDetails","createElement","TripDetailsHeader","id","FormattedMessage","defaultMessage","description","TripDetailsBody","_default"],"sources":["../src/index.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { FormattedMessage } from \"react-intl\";\nimport { flatten } from \"flat\";\nimport * as S from \"./styled\";\nimport { TripDetailsProps } from \"./types\";\nimport FlexBookingInfo from \"./components/flex-booking-info\";\nimport FaresV2Table from \"./components/fares-v2-table\";\nimport Emissions from \"./components/emissions\";\nimport Fares from \"./components/fares\";\nimport TimeActive, { DefaultTimeActiveDetails } from \"./components/time-active\";\nimport DepartureDate from \"./components/departure-date\";\n\n// Load the default messages.\nimport defaultEnglishMessages from \"../i18n/en-US.yml\";\n\n// HACK: We should flatten the messages loaded above because\n// the YAML loaders behave differently between webpack and our version of jest:\n// - the yaml loader for webpack returns a nested object,\n// - the yaml loader for jest returns messages with flattened ids.\nconst defaultMessages: Record<string, string> = flatten(defaultEnglishMessages);\n\nfunction cn(className: string, arg1: string): string {\n return className ? `${className} ${arg1}` : arg1;\n}\n\n/**\n * Renders trip details such as departure instructions, fare amount, and minutes active.\n */\nexport function TripDetails({\n className = \"\",\n co2Config,\n defaultFareType,\n DepartureDetails = null,\n FareDetails = null,\n itinerary,\n showApproximateMinutesActive,\n TimeActiveDetails = DefaultTimeActiveDetails\n}: TripDetailsProps): ReactElement {\n return (\n <S.TripDetails className={cn(className, \"trip-details\")}>\n {/* this can be presentation as S.TripDetails is already labeled by this */}\n <S.TripDetailsHeader id=\"trip-details-header\">\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.title\"]}\n description=\"Title (heading) text of the component.\"\n id=\"otpUi.TripDetails.title\"\n />\n </S.TripDetailsHeader>\n\n <S.TripDetailsBody>\n <DepartureDate\n itinerary={itinerary}\n DepartureDetails={DepartureDetails}\n />\n <Fares\n itinerary={itinerary}\n FareDetails={FareDetails}\n defaultFareType={defaultFareType}\n />\n <TimeActive\n itinerary={itinerary}\n TimeActiveDetails={TimeActiveDetails}\n showApproximateMinutesActive={showApproximateMinutesActive}\n />\n <FlexBookingInfo itinerary={itinerary} />\n <Emissions itinerary={itinerary} co2Config={co2Config} />\n </S.TripDetailsBody>\n </S.TripDetails>\n );\n}\n\nexport default TripDetails;\n\n// Rename styled components for export.\nexport { S as Styled, FaresV2Table };\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,CAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAA8BK,OAAA,CAAAC,MAAA,GAAAH,CAAA;AAE9B,IAAAI,gBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,aAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,UAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,MAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,WAAA,GAAAP,uBAAA,CAAAJ,OAAA;AACA,IAAAY,cAAA,GAAAb,sBAAA,CAAAC,OAAA;AAGA,IAAAa,KAAA,GAAAd,sBAAA,CAAAC,OAAA;AAAuD,SAAAI,wBAAAU,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ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EA;EAAU,CAAE,CACvC,CACN,CAAC;AAEpB;AAAC,IAAAe,QAAA,GAAAlD,OAAA,CAAAmB,OAAA,GAEce,WAAW,EAE1B","ignoreList":[]}
|
package/lib/styled.js
CHANGED
|
@@ -1,123 +1,96 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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;
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
17
5
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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;
|
|
6
|
+
exports.TripDetailsHeader = exports.TripDetailsBody = exports.TripDetails = exports.TripDetailSummary = exports.TripDetailIcon = exports.TripDetailDescription = exports.TripDetail = exports.TransitFareSingle = exports.TransitFare = exports.Timing = exports.TNCFareCompanies = exports.TNCFare = exports.InvisibleA11yLabel = exports.InvisibleA11yCaption = exports.HideButton = exports.FlexSummary = exports.Fare = exports.ExpandButton = exports.CO2Summary = exports.CO2Description = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
9
|
+
const InvisibleA11yStyles = (0, _styledComponents.css)(["display:inline-block;clip:rect(0,0,0,0);height:0;overflow:hidden;position:absolute;width:0;"]);
|
|
10
|
+
const InvisibleA11yLabel = exports.InvisibleA11yLabel = _styledComponents.default.span.withConfig({
|
|
11
|
+
displayName: "styled__InvisibleA11yLabel",
|
|
12
|
+
componentId: "sc-6q2ok2-0"
|
|
13
|
+
})(["", ""], InvisibleA11yStyles);
|
|
78
14
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
exports.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
exports.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
15
|
+
// Warning: https://github.com/opentripplanner/otp-ui/pull/855#discussion_r2248534209
|
|
16
|
+
const InvisibleA11yCaption = exports.InvisibleA11yCaption = _styledComponents.default.caption.withConfig({
|
|
17
|
+
displayName: "styled__InvisibleA11yCaption",
|
|
18
|
+
componentId: "sc-6q2ok2-1"
|
|
19
|
+
})(["", ""], InvisibleA11yStyles);
|
|
20
|
+
const BaseButton = _styledComponents.default.button.withConfig({
|
|
21
|
+
displayName: "styled__BaseButton",
|
|
22
|
+
componentId: "sc-6q2ok2-2"
|
|
23
|
+
})(["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;"]);
|
|
24
|
+
const CO2Description = exports.CO2Description = _styledComponents.default.span.withConfig({
|
|
25
|
+
displayName: "styled__CO2Description",
|
|
26
|
+
componentId: "sc-6q2ok2-3"
|
|
27
|
+
})([""]);
|
|
28
|
+
const CO2Summary = exports.CO2Summary = _styledComponents.default.span.withConfig({
|
|
29
|
+
displayName: "styled__CO2Summary",
|
|
30
|
+
componentId: "sc-6q2ok2-4"
|
|
31
|
+
})([""]);
|
|
32
|
+
const ExpandButton = exports.ExpandButton = (0, _styledComponents.default)(BaseButton).withConfig({
|
|
33
|
+
displayName: "styled__ExpandButton",
|
|
34
|
+
componentId: "sc-6q2ok2-5"
|
|
35
|
+
})(["color:#00f;font-size:16px;margin-left:6px;margin-top:-2px;"]);
|
|
36
|
+
const Fare = exports.Fare = _styledComponents.default.span.withConfig({
|
|
37
|
+
displayName: "styled__Fare",
|
|
38
|
+
componentId: "sc-6q2ok2-6"
|
|
39
|
+
})([""]);
|
|
40
|
+
const HideButton = exports.HideButton = (0, _styledComponents.default)(BaseButton).withConfig({
|
|
41
|
+
displayName: "styled__HideButton",
|
|
42
|
+
componentId: "sc-6q2ok2-7"
|
|
43
|
+
})(["float:right;"]);
|
|
44
|
+
const TNCFare = exports.TNCFare = _styledComponents.default.span.withConfig({
|
|
45
|
+
displayName: "styled__TNCFare",
|
|
46
|
+
componentId: "sc-6q2ok2-8"
|
|
47
|
+
})([""]);
|
|
48
|
+
const TNCFareCompanies = exports.TNCFareCompanies = _styledComponents.default.span.withConfig({
|
|
49
|
+
displayName: "styled__TNCFareCompanies",
|
|
50
|
+
componentId: "sc-6q2ok2-9"
|
|
51
|
+
})(["text-transform:capitalize;"]);
|
|
52
|
+
const Timing = exports.Timing = _styledComponents.default.span.withConfig({
|
|
53
|
+
displayName: "styled__Timing",
|
|
54
|
+
componentId: "sc-6q2ok2-10"
|
|
55
|
+
})([""]);
|
|
56
|
+
const TransitFare = exports.TransitFare = _styledComponents.default.details.withConfig({
|
|
57
|
+
displayName: "styled__TransitFare",
|
|
58
|
+
componentId: "sc-6q2ok2-11"
|
|
59
|
+
})(["display:inline-block;> span{display:block;padding-left:1.75ch;}"]);
|
|
60
|
+
const TransitFareSingle = exports.TransitFareSingle = _styledComponents.default.span.withConfig({
|
|
61
|
+
displayName: "styled__TransitFareSingle",
|
|
62
|
+
componentId: "sc-6q2ok2-12"
|
|
63
|
+
})([""]);
|
|
64
|
+
const FlexSummary = exports.FlexSummary = _styledComponents.default.span.withConfig({
|
|
65
|
+
displayName: "styled__FlexSummary",
|
|
66
|
+
componentId: "sc-6q2ok2-13"
|
|
67
|
+
})([""]);
|
|
68
|
+
const TripDetail = exports.TripDetail = _styledComponents.default.div.withConfig({
|
|
69
|
+
displayName: "styled__TripDetail",
|
|
70
|
+
componentId: "sc-6q2ok2-14"
|
|
71
|
+
})(["margin-top:6px;"]);
|
|
72
|
+
const TripDetailDescription = exports.TripDetailDescription = _styledComponents.default.div.withConfig({
|
|
73
|
+
displayName: "styled__TripDetailDescription",
|
|
74
|
+
componentId: "sc-6q2ok2-15"
|
|
75
|
+
})(["background-color:#fff;border:1px solid #888;font-size:12px;margin-top:2px;padding:8px;"]);
|
|
76
|
+
const TripDetailIcon = exports.TripDetailIcon = _styledComponents.default.div.withConfig({
|
|
77
|
+
displayName: "styled__TripDetailIcon",
|
|
78
|
+
componentId: "sc-6q2ok2-16"
|
|
79
|
+
})(["float:left;font-size:17px;"]);
|
|
80
|
+
const TripDetails = exports.TripDetails = _styledComponents.default.div.withConfig({
|
|
81
|
+
displayName: "styled__TripDetails",
|
|
82
|
+
componentId: "sc-6q2ok2-17"
|
|
83
|
+
})(["background-color:#eee;border-radius:6px;margin-bottom:15px;margin-top:16px;padding:10px 16px;overflow-x:scroll;"]);
|
|
84
|
+
const TripDetailsBody = exports.TripDetailsBody = _styledComponents.default.div.withConfig({
|
|
85
|
+
displayName: "styled__TripDetailsBody",
|
|
86
|
+
componentId: "sc-6q2ok2-18"
|
|
87
|
+
})([""]);
|
|
88
|
+
const TripDetailsHeader = exports.TripDetailsHeader = _styledComponents.default.h2.withConfig({
|
|
89
|
+
displayName: "styled__TripDetailsHeader",
|
|
90
|
+
componentId: "sc-6q2ok2-19"
|
|
91
|
+
})(["font-size:18px;font-weight:600;margin:0;"]);
|
|
92
|
+
const TripDetailSummary = exports.TripDetailSummary = _styledComponents.default.div.withConfig({
|
|
93
|
+
displayName: "styled__TripDetailSummary",
|
|
94
|
+
componentId: "sc-6q2ok2-20"
|
|
95
|
+
})(["margin-left:28px;padding-top:2px;display:flex;align-items:baseline;white-space:pre-wrap;"]);
|
|
123
96
|
//# sourceMappingURL=styled.js.map
|
package/lib/styled.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","
|
|
1
|
+
{"version":3,"file":"styled.js","names":["_styledComponents","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","InvisibleA11yStyles","css","InvisibleA11yLabel","exports","styled","span","withConfig","displayName","componentId","InvisibleA11yCaption","caption","BaseButton","button","CO2Description","CO2Summary","ExpandButton","Fare","HideButton","TNCFare","TNCFareCompanies","Timing","TransitFare","details","TransitFareSingle","FlexSummary","TripDetail","div","TripDetailDescription","TripDetailIcon","TripDetails","TripDetailsBody","TripDetailsHeader","h2","TripDetailSummary"],"sources":["../src/styled.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nconst InvisibleA11yStyles = css`\n display: inline-block;\n clip: rect(0, 0, 0, 0);\n height: 0;\n overflow: hidden;\n position: absolute;\n width: 0;\n`;\nexport const InvisibleA11yLabel = styled.span`\n ${InvisibleA11yStyles}\n`;\n\n// Warning: https://github.com/opentripplanner/otp-ui/pull/855#discussion_r2248534209\nexport const InvisibleA11yCaption = styled.caption`\n ${InvisibleA11yStyles}\n`;\n\nconst BaseButton = styled.button`\n background: transparent;\n border: 0;\n cursor: pointer;\n display: inline-block;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.42857143;\n margin: 0;\n padding: 0;\n text-decoration: none;\n touch-action: manipulation;\n user-select: none;\n vertical-align: middle;\n white-space: nowrap;\n`;\n\nexport const CO2Description = styled.span``;\n\nexport const CO2Summary = styled.span``;\n\nexport const ExpandButton = styled(BaseButton)`\n color: #00f;\n font-size: 16px;\n margin-left: 6px;\n margin-top: -2px;\n`;\n\nexport const Fare = styled.span``;\n\nexport const HideButton = styled(BaseButton)`\n float: right;\n`;\n\nexport const TNCFare = styled.span``;\n\nexport const TNCFareCompanies = styled.span`\n text-transform: capitalize;\n`;\n\nexport const Timing = styled.span``;\n\nexport const TransitFare = styled.details`\n display: inline-block;\n\n > span {\n display: block;\n /* This may seem wrong, but this value gives the most aligned results */\n /* see: https://github.com/opentripplanner/otp-ui/pull/294#discussion_r742045851 */\n padding-left: 1.75ch;\n }\n`;\nexport const TransitFareSingle = styled.span``;\n\nexport const FlexSummary = styled.span``;\n\nexport const TripDetail = styled.div`\n margin-top: 6px;\n`;\n\nexport const TripDetailDescription = styled.div`\n background-color: #fff;\n border: 1px solid #888;\n font-size: 12px;\n margin-top: 2px;\n padding: 8px;\n`;\n\nexport const TripDetailIcon = styled.div`\n float: left;\n font-size: 17px;\n`;\n\nexport const TripDetails = styled.div`\n background-color: #eee;\n border-radius: 6px;\n margin-bottom: 15px;\n margin-top: 16px;\n padding: 10px 16px;\n overflow-x: scroll;\n`;\n\nexport const TripDetailsBody = styled.div``;\n\nexport const TripDetailsHeader = styled.h2`\n font-size: 18px;\n font-weight: 600;\n margin: 0;\n`;\n\nexport const TripDetailSummary = styled.div`\n margin-left: 28px;\n padding-top: 2px;\n display: flex;\n align-items: baseline;\n white-space: pre-wrap;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAgD,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA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vB,yBAAM,CAACsB,GAAG,CAAApB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,8FAM9C;AAEM,MAAMoB,cAAc,GAAAzB,OAAA,CAAAyB,cAAA,GAAGxB,yBAAM,CAACsB,GAAG,CAAApB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,kCAGvC;AAEM,MAAMqB,WAAW,GAAA1B,OAAA,CAAA0B,WAAA,GAAGzB,yBAAM,CAACsB,GAAG,CAAApB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,uHAOpC;AAEM,MAAMsB,eAAe,GAAA3B,OAAA,CAAA2B,eAAA,GAAG1B,yBAAM,CAACsB,GAAG,CAAApB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,QAAE;AAEpC,MAAMuB,iBAAiB,GAAA5B,OAAA,CAAA4B,iBAAA,GAAG3B,yBAAM,CAAC4B,EAAE,CAAA1B,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,gDAIzC;AAEM,MAAMyB,iBAAiB,GAAA9B,OAAA,CAAA8B,iBAAA,GAAG7B,yBAAM,CAACsB,GAAG,CAAApB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,gGAM1C","ignoreList":[]}
|
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;AAaF,QAAA,MAAM,UAAU,
|
|
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,GAAI,2CAKjB,KAAK,KAAG,GAAG,CAAC,OAmDd,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/lib/trip-detail.js
CHANGED
|
@@ -1,71 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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;
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
17
6
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var
|
|
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"));
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _QuestionCircle = require("@styled-icons/fa-solid/QuestionCircle");
|
|
10
|
+
var _TimesCircle = require("@styled-icons/fa-solid/TimesCircle");
|
|
11
|
+
var _reactAnimateHeight = _interopRequireDefault(require("react-animate-height"));
|
|
12
|
+
var _reactIntl = require("react-intl");
|
|
13
|
+
var S = _interopRequireWildcard(require("./styled"));
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
35
15
|
// TODO: Remove this helper method by moving to semantically correct HTML
|
|
36
16
|
function uuidv4() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
17
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
18
|
+
// eslint-disable-next-line no-bitwise
|
|
19
|
+
const r = Math.random() * 16 | 0;
|
|
20
|
+
// eslint-disable-next-line no-bitwise
|
|
21
|
+
const v = c === "x" ? r : r & 0x3 | 0x8;
|
|
22
|
+
return v.toString(16);
|
|
23
|
+
});
|
|
44
24
|
}
|
|
45
|
-
const TripDetail = ({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
25
|
+
const TripDetail = ({
|
|
26
|
+
icon,
|
|
27
|
+
summary,
|
|
28
|
+
description,
|
|
29
|
+
className
|
|
30
|
+
}) => {
|
|
31
|
+
const intl = (0, _reactIntl.useIntl)();
|
|
32
|
+
const [expanded, setExpanded] = (0, _react.useState)(false);
|
|
33
|
+
const id = uuidv4();
|
|
34
|
+
const toggle = () => {
|
|
35
|
+
setExpanded(!expanded);
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(S.TripDetail, {
|
|
38
|
+
role: "group",
|
|
39
|
+
className: className
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement(S.TripDetailIcon, {
|
|
41
|
+
role: "presentation"
|
|
42
|
+
}, icon), /*#__PURE__*/_react.default.createElement(S.TripDetailSummary, null, summary, description && /*#__PURE__*/_react.default.createElement(S.ExpandButton, {
|
|
43
|
+
"aria-label": expanded ? intl.formatMessage({
|
|
44
|
+
id: "otpUi.TripDetails.hideDetail"
|
|
45
|
+
}) : intl.formatMessage({
|
|
46
|
+
id: "otpUi.TripDetails.showDetail"
|
|
47
|
+
}),
|
|
48
|
+
"aria-controls": id,
|
|
49
|
+
"aria-expanded": expanded,
|
|
50
|
+
id: "expand-button",
|
|
51
|
+
onClick: toggle,
|
|
52
|
+
tabIndex: 0
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement(_QuestionCircle.QuestionCircle, {
|
|
54
|
+
size: "0.92em"
|
|
55
|
+
}))), /*#__PURE__*/_react.default.createElement(_reactAnimateHeight.default, {
|
|
56
|
+
duration: 300,
|
|
57
|
+
height: expanded ? "auto" : 0
|
|
58
|
+
}, /*#__PURE__*/_react.default.createElement(S.TripDetailDescription, {
|
|
59
|
+
"aria-labelledby": "expand-button",
|
|
60
|
+
id: id
|
|
61
|
+
}, /*#__PURE__*/_react.default.createElement(S.HideButton, {
|
|
62
|
+
role: "presentation",
|
|
63
|
+
onClick: () => setExpanded(false)
|
|
64
|
+
}, /*#__PURE__*/_react.default.createElement(_TimesCircle.TimesCircle, {
|
|
65
|
+
size: "0.92em"
|
|
66
|
+
})), description)));
|
|
69
67
|
};
|
|
70
|
-
exports.default = TripDetail;
|
|
68
|
+
var _default = exports.default = TripDetail;
|
|
71
69
|
//# 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","names":["_react","_interopRequireWildcard","require","_QuestionCircle","_TimesCircle","_reactAnimateHeight","_interopRequireDefault","_reactIntl","S","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","uuidv4","replace","c","Math","random","v","toString","TripDetail","icon","summary","description","className","intl","useIntl","expanded","setExpanded","useState","id","toggle","createElement","role","TripDetailIcon","TripDetailSummary","ExpandButton","formatMessage","onClick","tabIndex","QuestionCircle","size","duration","height","TripDetailDescription","HideButton","TimesCircle","_default","exports"],"sources":["../src/trip-detail.tsx"],"sourcesContent":["import React, { ReactElement, useState } from \"react\";\nimport { QuestionCircle } from \"@styled-icons/fa-solid/QuestionCircle\";\nimport { TimesCircle } from \"@styled-icons/fa-solid/TimesCircle\";\n\nimport AnimateHeight from \"react-animate-height\";\nimport { useIntl } from \"react-intl\";\nimport * as S from \"./styled\";\n\ntype Props = {\n className?: string;\n description?: ReactElement | string;\n icon: ReactElement;\n summary: ReactElement | string;\n};\n\n// TODO: Remove this helper method by moving to semantically correct HTML\nfunction uuidv4(): string {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function(c) {\n // eslint-disable-next-line no-bitwise\n const r = (Math.random() * 16) | 0;\n // eslint-disable-next-line no-bitwise\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\nconst TripDetail = ({\n icon,\n summary,\n description,\n className\n}: Props): JSX.Element => {\n const intl = useIntl();\n const [expanded, setExpanded] = useState(false);\n\n const id = uuidv4();\n\n const toggle = (): void => {\n setExpanded(!expanded);\n };\n\n return (\n <S.TripDetail role=\"group\" className={className}>\n <S.TripDetailIcon role=\"presentation\">{icon}</S.TripDetailIcon>\n {/* TODO: Adjust the summary and description to be a `summary`/`details` pair, therefore semantically correct */}\n {/* https://github.com/opentripplanner/otp-ui/pull/530#discussion_r1074006057 */}\n <S.TripDetailSummary>\n {summary}\n {description && (\n <S.ExpandButton\n aria-label={\n expanded\n ? intl.formatMessage({\n id: \"otpUi.TripDetails.hideDetail\"\n })\n : intl.formatMessage({\n id: \"otpUi.TripDetails.showDetail\"\n })\n }\n aria-controls={id}\n aria-expanded={expanded}\n id=\"expand-button\"\n onClick={toggle}\n tabIndex={0}\n >\n <QuestionCircle size=\"0.92em\" />\n </S.ExpandButton>\n )}\n </S.TripDetailSummary>\n <AnimateHeight duration={300} height={expanded ? \"auto\" : 0}>\n <S.TripDetailDescription aria-labelledby=\"expand-button\" id={id}>\n {/** This button isn't needed for screen readers as the main expand-button is\n * more convenient.\n */}\n <S.HideButton role=\"presentation\" onClick={() => setExpanded(false)}>\n <TimesCircle size=\"0.92em\" />\n </S.HideButton>\n {description}\n </S.TripDetailDescription>\n </AnimateHeight>\n </S.TripDetail>\n );\n};\n\nexport default TripDetail;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA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,eAAe;IAClBQ,OAAO,EAAEP,MAAO;IAChBQ,QAAQ,EAAE;EAAE,gBAEZtD,MAAA,CAAAmB,OAAA,CAAA4B,aAAA,CAAC5C,eAAA,CAAAoD,cAAc;IAACC,IAAI,EAAC;EAAQ,CAAE,CACjB,CAEC,CAAC,eACtBxD,MAAA,CAAAmB,OAAA,CAAA4B,aAAA,CAAC1C,mBAAA,CAAAc,OAAa;IAACsC,QAAQ,EAAE,GAAI;IAACC,MAAM,EAAEhB,QAAQ,GAAG,MAAM,GAAG;EAAE,gBAC1D1C,MAAA,CAAAmB,OAAA,CAAA4B,aAAA,CAACvC,CAAC,CAACmD,qBAAqB;IAAC,mBAAgB,eAAe;IAACd,EAAE,EAAEA;EAAG,gBAI9D7C,MAAA,CAAAmB,OAAA,CAAA4B,aAAA,CAACvC,CAAC,CAACoD,UAAU;IAACZ,IAAI,EAAC,cAAc;IAACK,OAAO,EAAEA,CAAA,KAAMV,WAAW,CAAC,KAAK;EAAE,gBAClE3C,MAAA,CAAAmB,OAAA,CAAA4B,aAAA,CAAC3C,YAAA,CAAAyD,WAAW;IAACL,IAAI,EAAC;EAAQ,CAAE,CAChB,CAAC,EACdlB,WACsB,CACZ,CACH,CAAC;AAEnB,CAAC;AAAC,IAAAwB,QAAA,GAAAC,OAAA,CAAA5C,OAAA,GAEagB,UAAU","ignoreList":[]}
|
package/lib/types.d.ts
CHANGED
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,SAAS,EACT,GAAG,EACH,cAAc,EACd,KAAK,EACL,MAAM,wBAAwB,CAAC;AAEjC,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC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