@opentripplanner/trip-details 1.3.2 → 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 +293 -95
- package/esm/index.js.map +1 -1
- package/esm/styled.js +35 -19
- package/esm/styled.js.map +1 -1
- package/esm/trip-detail.js +7 -15
- 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 +286 -93
- 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 +49 -21
- 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 +10 -20
- 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 +12 -9
- 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} +19 -1
- package/src/trip-detail.tsx +70 -0
- package/src/types.ts +69 -0
- package/tsconfig.json +15 -0
- package/tsconfig.tsbuildinfo +4496 -0
- package/src/TripDetails.story.js +0 -131
- package/src/index.js +0 -184
- package/src/trip-detail.js +0 -70
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["TripDetails","className","itinerary","longDateFormat","messages","routingType","timeOptions","date","startTime","coreUtils","mergeMessages","defaultProps","centsToString","dollarsToString","maxTNCFare","minTNCFare","transitFare","calculateFares","companies","legs","forEach","leg","tncData","company","fare","toLowerCase","bikeDuration","caloriesBurned","walkDuration","calculatePhysicalActivity","title","departDescription","depart","format","at","time","formatTime","transitFareDescription","Math","round","propTypes","PropTypes","string","types","itineraryType","isRequired","shape","caloriesBurnedDescription","timeOptionsType"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAEe,SAASA,WAAT,CAAqB;AAClCC,EAAAA,SADkC;AAElCC,EAAAA,SAFkC;AAGlCC,EAAAA,cAHkC;AAIlCC,EAAAA,QAJkC;AAKlCC,EAAAA,WALkC;AAMlCC,EAAAA;AANkC,CAArB,EAOZ;AACD,QAAMC,IAAI,GAAG,qBAAOL,SAAS,CAACM,SAAjB,CAAb;AACAJ,EAAAA,QAAQ,GAAGK,mBAAUL,QAAV,CAAmBM,aAAnB,CACTV,WAAW,CAACW,YAAZ,CAAyBP,QADhB,EAETA,QAFS,CAAX,CAFC,CAOD;;AACA,QAAM;AACJQ,IAAAA,aADI;AAEJC,IAAAA,eAFI;AAGJC,IAAAA,UAHI;AAIJC,IAAAA,UAJI;AAKJC,IAAAA;AALI,MAMFP,mBAAUP,SAAV,CAAoBe,cAApB,CAAmCf,SAAnC,CANJ;;AAOA,MAAIgB,SAAJ;AACAhB,EAAAA,SAAS,CAACiB,IAAV,CAAeC,OAAf,CAAuBC,GAAG,IAAI;AAC5B,QAAIA,GAAG,CAACC,OAAR,EAAiB;AACfJ,MAAAA,SAAS,GAAGG,GAAG,CAACC,OAAJ,CAAYC,OAAxB;AACD;AACF,GAJD;AAKA,MAAIC,IAAJ;;AACA,MAAIR,WAAW,IAAID,UAAnB,EAA+B;AAC7BS,IAAAA,IAAI,gBACF,6BAAC,MAAD,CAAQ,IAAR,QACGR,WAAW,iBACV,6BAAC,MAAD,CAAQ,WAAR,QACGZ,QAAQ,CAACY,WADZ,qBAC0B,wCAAIJ,aAAa,CAACI,WAAD,CAAjB,CAD1B,CAFJ,EAMGD,UAAU,KAAK,CAAf,iBACC,6BA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AUC,MAPO;AAQxBlB,IAAAA,IAAI,EAAEiB,mBAAUC,MARQ;AASxB1B,IAAAA,WAAW,EAAEyB,mBAAUC,MATC;AAUxBL,IAAAA,sBAAsB,EAAEI,mBAAUC;AAVV,GAAhB,CAdY;;AA0BtB;AACArC,EAAAA,WAAW,EAAEoC,mBAAUC,MA3BD;;AA4BtB;AACApC,EAAAA,WAAW,EAAEG,mBAAUkC,KAAV,CAAgBK;AA7BP,CAAxB;AAgCAhD,WAAW,CAACW,YAAZ,GAA2B;AACzBV,EAAAA,SAAS,EAAE,IADc;AAEzBE,EAAAA,cAAc,EAAE,IAFS;AAGzBC,EAAAA,QAAQ,EAAE;AACR8B,IAAAA,EAAE,EAAE,IADI;AAERP,IAAAA,cAAc,EAAE,iBAFR;AAGR;AACAoB,IAAAA,yBAAyB,EAAE,IAJnB;AAKRf,IAAAA,MAAM,EAAE,QALA;AAMRD,IAAAA,iBAAiB,EAAE,IANX;AAORD,IAAAA,KAAK,EAAE,cAPC;AAQRN,IAAAA,IAAI,EAAE,MARE;AASRR,IAAAA,WAAW,EAAE,cATL;AAURqB,IAAAA,sBAAsB,EAAE;AAVhB,GAHe;AAezBhC,EAAAA,WAAW,EAAE,WAfY;AAgBzBC,EAAAA,WAAW,EAAE;AAhBY,CAA3B","sourcesContent":["import coreUtils from \"@opentripplanner/core-utils\";\nimport moment from \"moment\";\nimport PropTypes from \"prop-types\";\nimport React from \"react\";\nimport { CalendarAlt, Heartbeat, MoneyBillAlt } from \"styled-icons/fa-solid\";\n\nimport * as Styled from \"./styled\";\nimport TripDetail from \"./trip-detail\";\n\nexport default function TripDetails({\n className,\n itinerary,\n longDateFormat,\n messages,\n routingType,\n timeOptions\n}) {\n const date = moment(itinerary.startTime);\n messages = coreUtils.messages.mergeMessages(\n TripDetails.defaultProps.messages,\n messages\n );\n\n // process the transit fare\n const {\n centsToString,\n dollarsToString,\n maxTNCFare,\n minTNCFare,\n transitFare\n } = coreUtils.itinerary.calculateFares(itinerary);\n let companies;\n itinerary.legs.forEach(leg => {\n if (leg.tncData) {\n companies = leg.tncData.company;\n }\n });\n let fare;\n if (transitFare || minTNCFare) {\n fare = (\n <Styled.Fare>\n {transitFare && (\n <Styled.TransitFare>\n {messages.transitFare}: <b>{centsToString(transitFare)}</b>\n </Styled.TransitFare>\n )}\n {minTNCFare !== 0 && (\n <Styled.TNCFare>\n <br />\n <Styled.TNCFareCompanies>\n {companies.toLowerCase()}\n </Styled.TNCFareCompanies>{\" \"}\n {messages.fare}:{\" \"}\n <b>\n {dollarsToString(minTNCFare)} - {dollarsToString(maxTNCFare)}\n </b>\n </Styled.TNCFare>\n )}\n </Styled.Fare>\n );\n }\n\n // Compute calories burned.\n const {\n bikeDuration,\n caloriesBurned,\n walkDuration\n } = coreUtils.itinerary.calculatePhysicalActivity(itinerary);\n\n return (\n <Styled.TripDetails className={className}>\n <Styled.TripDetailsHeader>{messages.title}</Styled.TripDetailsHeader>\n <Styled.TripDetailsBody>\n <TripDetail\n description={messages.departDescription}\n icon={<CalendarAlt size={17} />}\n summary={\n <Styled.Timing>\n <span>\n {messages.depart} <b>{date.format(longDateFormat)}</b>\n </span>\n {routingType === \"ITINERARY\" && (\n <span>\n {\" \"}\n {messages.at}{\" \"}\n <b>\n {coreUtils.time.formatTime(\n itinerary.startTime,\n timeOptions\n )}\n </b>\n </span>\n )}\n </Styled.Timing>\n }\n />\n {fare && (\n <TripDetail\n description={messages.transitFareDescription}\n icon={<MoneyBillAlt size={17} />}\n summary={fare}\n />\n )}\n {caloriesBurned > 0 && (\n <TripDetail\n icon={<Heartbeat size={17} />}\n summary={\n <Styled.CaloriesSummary>\n {messages.caloriesBurned}: <b>{Math.round(caloriesBurned)}</b>\n </Styled.CaloriesSummary>\n }\n description={\n <Styled.CaloriesDescription>\n Calories burned is based on{\" \"}\n <b>{Math.round(walkDuration / 60)} minute(s)</b> spent walking\n and <b>{Math.round(bikeDuration / 60)} minute(s)</b> spent\n biking during this trip. Adapted from{\" \"}\n <a\n href=\"https://health.gov/dietaryguidelines/dga2005/document/html/chapter3.htm#table4\"\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n Dietary Guidelines for Americans 2005, page 16, Table 4\n </a>\n .\n </Styled.CaloriesDescription>\n }\n />\n )}\n </Styled.TripDetailsBody>\n </Styled.TripDetails>\n );\n}\n\nTripDetails.propTypes = {\n /** Used for additional styling with styled components for example. */\n className: PropTypes.string,\n /** Itinerary that the user has selected to view, contains multiple legs */\n itinerary: coreUtils.types.itineraryType.isRequired,\n /** the desired format to use for a long date */\n longDateFormat: PropTypes.string,\n /**\n * messages to use for l10n/i8n\n *\n * Note: messages with default null values included here for visibility.\n * Overriding with a truthy string value will cause the expandable help\n * message to appear in trip details.\n */\n messages: PropTypes.shape({\n at: PropTypes.string,\n caloriesBurned: PropTypes.string,\n // FIXME: Add templated string description.\n caloriesBurnedDescription: PropTypes.string,\n depart: PropTypes.string,\n departDescription: PropTypes.string,\n title: PropTypes.string,\n fare: PropTypes.string,\n transitFare: PropTypes.string,\n transitFareDescription: PropTypes.string\n }),\n /** whether the routing type is an itinerary or a profile result */\n routingType: PropTypes.string,\n /** Contains the preferred format string for time display and a timezone offset */\n timeOptions: coreUtils.types.timeOptionsType\n};\n\nTripDetails.defaultProps = {\n className: null,\n longDateFormat: null,\n messages: {\n at: \"at\",\n caloriesBurned: \"Calories Burned\",\n // FIXME: Add templated string description.\n caloriesBurnedDescription: null,\n depart: \"Depart\",\n departDescription: null,\n title: \"Trip Details\",\n fare: \"Fare\",\n transitFare: \"Transit Fare\",\n transitFareDescription: null\n },\n routingType: \"ITINERARY\",\n timeOptions: null\n};\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"names":["defaultMessages","defaultEnglishMessages","boldText","contents","renderFare","currencyCode","fare","dietaryLink","getFlexMessageValues","info","hasLeadTime","coreUtils","itinerary","isAdvanceBookingRequired","hasPhone","contactInfo","phoneNumber","leadDays","latestBookingTime","daysPrior","DefaultCaloriesDetails","bikeSeconds","calories","walkSeconds","bikeMinutes","Math","round","strong","walkMinutes","TransitFare","fareKey","fareNameFallback","fareKeyNameMap","transitFares","currentFare","name","value","transitFare","TripDetails","CaloriesDetails","className","DepartureDetails","defaultFareKey","FareDetails","fareResult","calculateFares","maxTNCFare","minTNCFare","tncCurrencyCode","defaultFare","companies","legs","forEach","leg","tncData","company","fareKeys","Object","keys","sort","length","TransitFareWrapper","S","TransitFareSingle","display","map","toLowerCase","departureDate","Date","startTime","bikeDuration","caloriesBurned","walkDuration","calculatePhysicalActivity","containsFlex","some","isFlex","pickupBookingInfo","filter","dropOffBookingInfo","pickupMessage","dropOffMessage"],"mappings":";;;;;;;;;;AAAA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;AACA;;AASA;;;;;;AAtBA;AAqBA;AAGA;AACA;AACA;AACA;AACA,MAAMA,eAAuC,GAAG,mBAAQC,aAAR,CAAhD;AAEA;AACA;AACA;AACA;;AACA,SAASC,QAAT,CAAkBC,QAAlB,EAAwD;AACtD,sBAAO,6CAASA,QAAT,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,UAAT,CAAoBC,YAApB,EAA0CC,IAA1C,EAAsE;AACpE,sBACE,6BAAC,0BAAD;AACE,IAAA,QAAQ,EAAED,YADZ,CAEE;AACA;AACA;AAJF;AAKE,IAAA,eAAe,EAAC,cALlB;AAME,IAAA,KAAK,EAAEC,IANT,CAOE;AAPF;AAQE,IAAA,KAAK,EAAC;AARR,IADF;AAYD;AAED;AACA;AACA;;;AACA,SAASC,WAAT,CAAqBJ,QAArB,EAA2D;AACzD,sBACE;AACE,IAAA,IAAI,EAAC,gFADP;AAEE,IAAA,GAAG,EAAC,qBAFN;AAGE,IAAA,MAAM,EAAC;AAHT,KAKGA,QALH,CADF;AASD;AAED;AACA;AACA;;;AACA,SAASK,oBAAT,CAA8BC,IAA9B,EAAqD;AAAA;;AACnD,SAAO;A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BAAUC,SAAV,CAAoBC,wBAApB,CAA6CJ,IAA7C,iBACE,6BAAC,wBAAD;AAAa,MAAA,IAAI,EAAE;AAAnB,MADF,gBAGE,6BAAC,oBAAD;AAAW,MAAA,IAAI,EAAE;AAAjB,MANN;AASE,IAAA,GAAG,EAAEA,IAAI,CAACwE,cATZ;AAUE,IAAA,OAAO,eACL,6BAAC,CAAD,CAAG,kBAAH,qBACE,6BAAC,2BAAD;AACE,MAAA,cAAc,EACZjF,eAAe,CAAC,sCAAD,CAFnB;AAIE,MAAA,WAAW,EAAC,oEAJd;AAKE,MAAA,EAAE,EAAC,sCALL;AAME,MAAA,MAAM,EAAEQ,oBAAoB,CAACC,IAAD;AAN9B,MADF;AAXJ,IADF,CAvGJ,CARF,CADF;AA4ID;;eAEc6B,W,EAEf","sourcesContent":["import flatten from \"flat\";\n// @ts-expect-error FIXME: Create TypeScript types for core-utils packages.\nimport coreUtils from \"@opentripplanner/core-utils\";\nimport { FlexBookingInfo } from \"@opentripplanner/types\";\nimport React, { ReactElement } from \"react\";\nimport { FormattedMessage, FormattedNumber } from \"react-intl\";\nimport { CalendarAlt } from \"@styled-icons/fa-solid/CalendarAlt\";\nimport { HandPaper } from \"@styled-icons/fa-solid/HandPaper\";\nimport { Heartbeat } from \"@styled-icons/fa-solid/Heartbeat\";\nimport { MoneyBillAlt } from \"@styled-icons/fa-solid/MoneyBillAlt\";\nimport { PhoneVolume } from \"@styled-icons/fa-solid/PhoneVolume\";\nimport { Route } from \"@styled-icons/fa-solid/Route\";\n\nimport * as S from \"./styled\";\nimport TripDetail from \"./trip-detail\";\n\nimport {\n CaloriesDetailsProps,\n TransitFareProps,\n TripDetailsProps\n} from \"./types\";\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\n/**\n * Format text bold (used with FormattedMessage).\n */\n// TODO: Find a better place for this utility.\nfunction boldText(contents: ReactElement): ReactElement {\n return <strong>{contents}</strong>;\n}\n\n/**\n * Render formatted fare.\n * @param currencyCode The ISO currency code to use (USD, GBP, EUR).\n * @param fare The fare value, in currency units, to be shown.\n * @returns The formatted fare value according to the selected locale.\n */\nfunction renderFare(currencyCode: string, fare: number): ReactElement {\n return (\n <FormattedNumber\n currency={currencyCode}\n // For dollars in locales such as 'fr',\n // this will limit the display to just the dollar sign\n // (otherwise it will render e.g. '2,50 $US' instead of '2,50 $').\n currencyDisplay=\"narrowSymbol\"\n value={fare}\n // eslint-disable-next-line react/style-prop-object\n style=\"currency\"\n />\n );\n}\n\n/**\n * Helper function to specify the link to dietary table.\n */\nfunction dietaryLink(contents: ReactElement): ReactElement {\n return (\n <a\n href=\"https://health.gov/dietaryguidelines/dga2005/document/html/chapter3.htm#table4\"\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n {contents}\n </a>\n );\n}\n\n/**\n * Helper function that assembles values for flex pickup/dropoff messages.\n */\nfunction getFlexMessageValues(info: FlexBookingInfo) {\n return {\n hasLeadTime: coreUtils.itinerary.isAdvanceBookingRequired(info),\n hasPhone: !!info?.contactInfo?.phoneNumber,\n leadDays: info.latestBookingTime.daysPrior,\n phoneNumber: info?.contactInfo?.phoneNumber\n };\n}\n\n/**\n * Default rendering if no component is provided for the CaloriesDetails\n * slot in the TripDetails component.\n */\nfunction DefaultCaloriesDetails({\n bikeSeconds,\n calories,\n walkSeconds\n}: CaloriesDetailsProps): ReactElement {\n return (\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.caloriesDescription\"]}\n description=\"Text describing how the calories relate to the walking and biking duration of a trip.\"\n id=\"otpUi.TripDetails.caloriesDescription\"\n values={{\n bikeMinutes: Math.round(bikeSeconds / 60),\n calories: Math.round(calories),\n dietaryLink,\n strong: boldText,\n walkMinutes: Math.round(walkSeconds / 60)\n }}\n />\n );\n}\n\n/**\n * Helper component that renders a transit fare entry.\n */\nconst TransitFare = ({\n fareKey,\n fareNameFallback,\n fareKeyNameMap,\n transitFares\n}: TransitFareProps): ReactElement => {\n const currentFare = transitFares[fareKey];\n\n return (\n <span>\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.transitFareEntry\"]}\n description=\"Text showing the price of tickets on public transportation.\"\n id=\"otpUi.TripDetails.transitFareEntry\"\n values={{\n name: fareKeyNameMap[fareKey] || fareNameFallback || fareKey,\n strong: boldText,\n value: renderFare(\n currentFare.currencyCode,\n currentFare.transitFare / 100\n )\n }}\n />\n </span>\n );\n};\n\n/**\n * Renders trip details such as departure instructions, fare amount, and calories spent.\n */\nexport function TripDetails({\n CaloriesDetails = DefaultCaloriesDetails,\n className = \"\",\n DepartureDetails = null,\n defaultFareKey = \"regular\",\n FareDetails = null,\n fareKeyNameMap = {},\n itinerary\n}: TripDetailsProps): ReactElement {\n // process the transit fare\n const fareResult = coreUtils.itinerary.calculateFares(itinerary, true);\n const { maxTNCFare, minTNCFare, tncCurrencyCode, transitFares } = fareResult;\n\n let defaultFare = defaultFareKey;\n if (!transitFares[defaultFareKey]) {\n defaultFare = \"regular\";\n }\n\n let companies = \"\";\n itinerary.legs.forEach(leg => {\n if (leg.tncData) {\n companies = leg.tncData.company;\n }\n });\n let fare;\n\n const fareKeys = transitFares && Object.keys(transitFares).sort();\n\n if (transitFares && fareKeys.length > 0) {\n // Depending on if there are additional fares to display either render a <span> or a <details>\n const TransitFareWrapper =\n transitFares && fareKeys.length > 1 ? S.TransitFare : S.TransitFareSingle;\n\n fare = (\n <S.Fare>\n <TransitFareWrapper>\n <summary style={{ display: fareKeys.length > 1 ? \"list-item\" : \"\" }}>\n <TransitFare\n fareNameFallback={\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.transitFare\"]\n }\n description=\"Text showing the price of tickets on public transportation.\"\n id=\"otpUi.TripDetails.transitFare\"\n />\n }\n fareKey={defaultFare}\n fareKeyNameMap={fareKeyNameMap}\n transitFares={transitFares}\n />\n </summary>\n {fareKeys.map(fareKey => {\n // Don't show the default fare twice!\n if (fareKey === defaultFare) {\n return null;\n }\n return (\n <TransitFare\n fareKey={fareKey}\n key={fareKey}\n fareKeyNameMap={fareKeyNameMap}\n transitFares={transitFares}\n />\n );\n })}\n </TransitFareWrapper>\n {minTNCFare !== 0 && (\n <S.TNCFare>\n <br />\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.tncFare\"]}\n description=\"Text showing the price paid to transportation network companies.\"\n id=\"otpUi.TripDetails.tncFare\"\n values={{\n companies: (\n // S.TNCFareCompanies capitalizes the TNC company ID (e.g. \"COMPANY\")\n // after it is converted to lowercase, so it renders as \"Company\".\n <S.TNCFareCompanies>\n {companies.toLowerCase()}\n </S.TNCFareCompanies>\n ),\n maxTNCFare: renderFare(tncCurrencyCode, maxTNCFare),\n minTNCFare: renderFare(tncCurrencyCode, minTNCFare),\n strong: boldText\n }}\n />\n </S.TNCFare>\n )}\n </S.Fare>\n );\n }\n\n const departureDate = new Date(itinerary.startTime);\n\n // Compute calories burned.\n const {\n bikeDuration,\n caloriesBurned,\n walkDuration\n } = coreUtils.itinerary.calculatePhysicalActivity(itinerary);\n\n // Parse flex info and generate appropriate strings\n const containsFlex = itinerary.legs.some(coreUtils.itinerary.isFlex);\n const pickupBookingInfo = itinerary.legs\n .map(leg => leg.pickupBookingInfo)\n .filter(info => !!info);\n const dropOffBookingInfo = itinerary.legs\n .map(leg => leg.dropOffBookingInfo)\n .filter(info => !!info);\n\n return (\n <S.TripDetails className={className}>\n <S.TripDetailsHeader>\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 <S.TripDetailsBody>\n <TripDetail\n // Any custom description for the Departure message needs to be handled by the slot.\n description={\n DepartureDetails && (\n <DepartureDetails departureDate={departureDate} />\n )\n }\n icon={<CalendarAlt size={17} />}\n summary={\n <S.Timing>\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.departure\"]}\n description=\"Text showing the departure date/time for a trip.\"\n id=\"otpUi.TripDetails.departure\"\n values={{\n departureDate,\n strong: boldText\n }}\n />\n </S.Timing>\n }\n />\n {fare && (\n <TripDetail\n // Any custom description for the transit fare needs to be handled by the slot.\n description={\n FareDetails && (\n <FareDetails\n maxTNCFare={maxTNCFare}\n minTNCFare={minTNCFare}\n transitFares={transitFares}\n />\n )\n }\n icon={<MoneyBillAlt size={17} />}\n summary={fare}\n />\n )}\n {caloriesBurned > 0 && (\n <TripDetail\n icon={<Heartbeat size={17} />}\n summary={\n <S.CaloriesSummary>\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.calories\"]}\n description=\"Text showing the number of calories for the walking and biking legs of a trip.\"\n id=\"otpUi.TripDetails.calories\"\n values={{\n calories: caloriesBurned,\n strong: boldText\n }}\n />\n </S.CaloriesSummary>\n }\n description={\n CaloriesDetails && (\n <CaloriesDetails\n bikeSeconds={bikeDuration}\n calories={caloriesBurned}\n walkSeconds={walkDuration}\n />\n )\n }\n />\n )}\n {containsFlex && (\n <TripDetail\n summary={\n <S.FlexSummary>\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.tripIncludesFlex\"]\n }\n description=\"Text stating that portions of the trip include a flex (on-demand) transit service.\"\n id=\"otpUi.TripDetails.tripIncludesFlex\"\n />\n </S.FlexSummary>\n }\n icon={<Route size={17} />}\n />\n )}\n {pickupBookingInfo &&\n pickupBookingInfo.map(info => (\n <TripDetail\n key={info.pickupMessage}\n icon={<PhoneVolume size={17} />}\n summary={\n <S.FlexPickupSummary>\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.flexPickupMessage\"]\n }\n description=\"Instructions for booking and boarding the flex (on-demand) transit service.\"\n id=\"otpUi.TripDetails.flexPickupMessage\"\n values={getFlexMessageValues(info)}\n />\n </S.FlexPickupSummary>\n }\n description={info.pickupMessage}\n />\n ))}\n {dropOffBookingInfo &&\n dropOffBookingInfo.map(info => (\n <TripDetail\n description={info.dropOffMessage}\n icon={\n coreUtils.itinerary.isAdvanceBookingRequired(info) ? (\n <PhoneVolume size={17} />\n ) : (\n <HandPaper size={17} />\n )\n }\n key={info.dropOffMessage}\n summary={\n <S.FlexDropOffSummary>\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.flexDropOffMessage\"]\n }\n description=\"Instructions for getting off the flex (on-demand) transit service.\"\n id=\"otpUi.TripDetails.flexDropOffMessage\"\n values={getFlexMessageValues(info)}\n />\n </S.FlexDropOffSummary>\n }\n />\n ))}\n </S.TripDetailsBody>\n </S.TripDetails>\n );\n}\n\nexport default TripDetails;\n\n// Rename styled components for export\nexport { S as Styled };\n"],"file":"index.js"}
|
package/lib/styled.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const CaloriesDescription: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
2
|
+
export declare const CaloriesSummary: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
3
|
+
export declare const ExpandButton: import("styled-components").StyledComponent<"button", any, {
|
|
4
|
+
"aria-label": "What does this mean?";
|
|
5
|
+
}, "aria-label">;
|
|
6
|
+
export declare const Fare: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
7
|
+
export declare const HideButton: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
8
|
+
export declare const TNCFare: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
9
|
+
export declare const TNCFareCompanies: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
10
|
+
export declare const Timing: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
11
|
+
export declare const TransitFare: import("styled-components").StyledComponent<"details", any, {}, never>;
|
|
12
|
+
export declare const TransitFareSingle: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
13
|
+
export declare const FlexSummary: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
14
|
+
export declare const FlexPickupSummary: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
15
|
+
export declare const FlexDropOffSummary: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
16
|
+
export declare const TripDetail: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
|
+
export declare const TripDetailDescription: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
|
+
export declare const TripDetailIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
19
|
+
export declare const TripDetails: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
20
|
+
export declare const TripDetailsBody: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
21
|
+
export declare const TripDetailsHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
22
|
+
export declare const TripDetailSummary: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
23
|
+
//# sourceMappingURL=styled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,mBAAmB,qEAAgB,CAAC;AAEjD,eAAO,MAAM,eAAe,qEAAgB,CAAC;AAE7C,eAAO,MAAM,YAAY;;gBAOxB,CAAC;AAEF,eAAO,MAAM,IAAI,qEAAgB,CAAC;AAElC,eAAO,MAAM,UAAU,uEAEtB,CAAC;AAEF,eAAO,MAAM,OAAO,qEAAgB,CAAC;AAErC,eAAO,MAAM,gBAAgB,qEAE5B,CAAC;AAEF,eAAO,MAAM,MAAM,qEAAgB,CAAC;AAEpC,eAAO,MAAM,WAAW,wEASvB,CAAC;AACF,eAAO,MAAM,iBAAiB,qEAAgB,CAAC;AAE/C,eAAO,MAAM,WAAW,qEAAgB,CAAC;AAEzC,eAAO,MAAM,iBAAiB,qEAAgB,CAAC;AAE/C,eAAO,MAAM,kBAAkB,qEAAgB,CAAC;AAEhD,eAAO,MAAM,UAAU,oEAEtB,CAAC;AAEF,eAAO,MAAM,qBAAqB,oEAMjC,CAAC;AAEF,eAAO,MAAM,cAAc,oEAG1B,CAAC;AAEF,eAAO,MAAM,WAAW,oEAMvB,CAAC;AAEF,eAAO,MAAM,eAAe,oEAAe,CAAC;AAE5C,eAAO,MAAM,iBAAiB,oEAG7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,oEAK7B,CAAC"}
|
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.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,96 +31,124 @@ 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
|
-
const TransitFare = _styledComponents.default.
|
|
71
|
+
const TransitFare = _styledComponents.default.details.withConfig({
|
|
72
72
|
displayName: "styled__TransitFare",
|
|
73
|
-
componentId: "
|
|
74
|
-
})([""]);
|
|
73
|
+
componentId: "sc-6q2ok2-9"
|
|
74
|
+
})(["display:inline-block;> span{display:block;padding-left:1.75ch;}"]);
|
|
75
75
|
|
|
76
76
|
exports.TransitFare = TransitFare;
|
|
77
77
|
|
|
78
|
+
const TransitFareSingle = _styledComponents.default.span.withConfig({
|
|
79
|
+
displayName: "styled__TransitFareSingle",
|
|
80
|
+
componentId: "sc-6q2ok2-10"
|
|
81
|
+
})([""]);
|
|
82
|
+
|
|
83
|
+
exports.TransitFareSingle = TransitFareSingle;
|
|
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
|
+
|
|
78
106
|
const TripDetail = _styledComponents.default.div.withConfig({
|
|
79
107
|
displayName: "styled__TripDetail",
|
|
80
|
-
componentId: "
|
|
108
|
+
componentId: "sc-6q2ok2-14"
|
|
81
109
|
})(["margin-top:6px;"]);
|
|
82
110
|
|
|
83
111
|
exports.TripDetail = TripDetail;
|
|
84
112
|
|
|
85
113
|
const TripDetailDescription = _styledComponents.default.div.withConfig({
|
|
86
114
|
displayName: "styled__TripDetailDescription",
|
|
87
|
-
componentId: "
|
|
115
|
+
componentId: "sc-6q2ok2-15"
|
|
88
116
|
})(["background-color:#fff;border:1px solid #888;font-size:12px;margin-top:2px;padding:8px;"]);
|
|
89
117
|
|
|
90
118
|
exports.TripDetailDescription = TripDetailDescription;
|
|
91
119
|
|
|
92
120
|
const TripDetailIcon = _styledComponents.default.div.withConfig({
|
|
93
121
|
displayName: "styled__TripDetailIcon",
|
|
94
|
-
componentId: "
|
|
122
|
+
componentId: "sc-6q2ok2-16"
|
|
95
123
|
})(["float:left;font-size:17px;"]);
|
|
96
124
|
|
|
97
125
|
exports.TripDetailIcon = TripDetailIcon;
|
|
98
126
|
|
|
99
127
|
const TripDetails = _styledComponents.default.div.withConfig({
|
|
100
128
|
displayName: "styled__TripDetails",
|
|
101
|
-
componentId: "
|
|
129
|
+
componentId: "sc-6q2ok2-17"
|
|
102
130
|
})(["background-color:#eee;border-radius:6px;margin-bottom:15px;margin-top:16px;padding:10px 16px;"]);
|
|
103
131
|
|
|
104
132
|
exports.TripDetails = TripDetails;
|
|
105
133
|
|
|
106
134
|
const TripDetailsBody = _styledComponents.default.div.withConfig({
|
|
107
135
|
displayName: "styled__TripDetailsBody",
|
|
108
|
-
componentId: "
|
|
136
|
+
componentId: "sc-6q2ok2-18"
|
|
109
137
|
})([""]);
|
|
110
138
|
|
|
111
139
|
exports.TripDetailsBody = TripDetailsBody;
|
|
112
140
|
|
|
113
141
|
const TripDetailsHeader = _styledComponents.default.div.withConfig({
|
|
114
142
|
displayName: "styled__TripDetailsHeader",
|
|
115
|
-
componentId: "
|
|
143
|
+
componentId: "sc-6q2ok2-19"
|
|
116
144
|
})(["font-size:18px;font-weight:600;"]);
|
|
117
145
|
|
|
118
146
|
exports.TripDetailsHeader = TripDetailsHeader;
|
|
119
147
|
|
|
120
148
|
const TripDetailSummary = _styledComponents.default.div.withConfig({
|
|
121
149
|
displayName: "styled__TripDetailSummary",
|
|
122
|
-
componentId: "
|
|
123
|
-
})(["margin-left:28px;padding-top:2px;"]);
|
|
150
|
+
componentId: "sc-6q2ok2-20"
|
|
151
|
+
})(["margin-left:28px;padding-top:2px;display:flex;align-items:baseline;"]);
|
|
124
152
|
|
|
125
153
|
exports.TripDetailSummary = TripDetailSummary;
|
|
126
154
|
//# sourceMappingURL=styled.js.map
|
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,0BAA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;;;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,21 +1,19 @@
|
|
|
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
|
-
var
|
|
10
|
+
var _QuestionCircle = require("@styled-icons/fa-solid/QuestionCircle");
|
|
11
|
+
|
|
12
|
+
var _TimesCircle = require("@styled-icons/fa-solid/TimesCircle");
|
|
15
13
|
|
|
16
14
|
var _velocityReact = require("velocity-react");
|
|
17
15
|
|
|
18
|
-
var
|
|
16
|
+
var S = _interopRequireWildcard(require("./styled"));
|
|
19
17
|
|
|
20
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
19
|
|
|
@@ -58,33 +56,25 @@ class TripDetail extends _react.Component {
|
|
|
58
56
|
const {
|
|
59
57
|
expanded
|
|
60
58
|
} = this.state;
|
|
61
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement(S.TripDetail, null, /*#__PURE__*/_react.default.createElement(S.TripDetailIcon, null, icon), /*#__PURE__*/_react.default.createElement(S.TripDetailSummary, null, summary, description && /*#__PURE__*/_react.default.createElement(S.ExpandButton, {
|
|
62
60
|
onClick: this.toggle
|
|
63
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
61
|
+
}, /*#__PURE__*/_react.default.createElement(_QuestionCircle.QuestionCircle, {
|
|
64
62
|
size: "0.92em"
|
|
65
|
-
})), /*#__PURE__*/_react.default.createElement(_velocityReact.VelocityTransitionGroup, {
|
|
63
|
+
}))), /*#__PURE__*/_react.default.createElement(_velocityReact.VelocityTransitionGroup, {
|
|
66
64
|
enter: {
|
|
67
65
|
animation: "slideDown"
|
|
68
66
|
},
|
|
69
67
|
leave: {
|
|
70
68
|
animation: "slideUp"
|
|
71
69
|
}
|
|
72
|
-
}, expanded && /*#__PURE__*/_react.default.createElement(
|
|
70
|
+
}, expanded && /*#__PURE__*/_react.default.createElement(S.TripDetailDescription, null, /*#__PURE__*/_react.default.createElement(S.HideButton, {
|
|
73
71
|
onClick: this.onHideClick
|
|
74
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
72
|
+
}, /*#__PURE__*/_react.default.createElement(_TimesCircle.TimesCircle, {
|
|
75
73
|
size: "0.92em"
|
|
76
|
-
})), description)))
|
|
74
|
+
})), description)));
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
}
|
|
80
78
|
|
|
81
79
|
exports.default = TripDetail;
|
|
82
|
-
TripDetail.propTypes = {
|
|
83
|
-
icon: _propTypes.default.node.isRequired,
|
|
84
|
-
summary: _propTypes.default.node.isRequired,
|
|
85
|
-
description: _propTypes.default.node
|
|
86
|
-
};
|
|
87
|
-
TripDetail.defaultProps = {
|
|
88
|
-
description: undefined
|
|
89
|
-
};
|
|
90
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","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;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,32 +1,35 @@
|
|
|
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",
|
|
10
11
|
"license": "MIT",
|
|
11
12
|
"private": false,
|
|
12
13
|
"dependencies": {
|
|
13
|
-
"@opentripplanner/core-utils": "^4.
|
|
14
|
-
"@
|
|
15
|
-
"
|
|
16
|
-
"prop-types": "^15.7.2",
|
|
17
|
-
"styled-icons": "^9.1.0",
|
|
14
|
+
"@opentripplanner/core-utils": "^4.5.0",
|
|
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
|
}
|