@citizenplane/pimp 18.14.3 → 18.16.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.
Files changed (58) hide show
  1. package/dist/components/CpSelectableButton.vue.d.ts.map +1 -1
  2. package/dist/components/CpTextMorph.vue.d.ts +11 -0
  3. package/dist/components/CpTextMorph.vue.d.ts.map +1 -0
  4. package/dist/components/CpTripDetails.vue.d.ts +14 -0
  5. package/dist/components/CpTripDetails.vue.d.ts.map +1 -0
  6. package/dist/components/CpTripLegRouteInformation.vue.d.ts +11 -0
  7. package/dist/components/CpTripLegRouteInformation.vue.d.ts.map +1 -0
  8. package/dist/components/CpTripLegRouteLayover.vue.d.ts +13 -0
  9. package/dist/components/CpTripLegRouteLayover.vue.d.ts.map +1 -0
  10. package/dist/components/CpTripLegRoutePlace.vue.d.ts +22 -0
  11. package/dist/components/CpTripLegRoutePlace.vue.d.ts.map +1 -0
  12. package/dist/components/CpTripLegRouteSegment.vue.d.ts +18 -0
  13. package/dist/components/CpTripLegRouteSegment.vue.d.ts.map +1 -0
  14. package/dist/components/index.d.ts +8 -1
  15. package/dist/components/index.d.ts.map +1 -1
  16. package/dist/constants/tripDetails/Airline.d.ts +5 -0
  17. package/dist/constants/tripDetails/Airline.d.ts.map +1 -0
  18. package/dist/constants/tripDetails/Airport.d.ts +7 -0
  19. package/dist/constants/tripDetails/Airport.d.ts.map +1 -0
  20. package/dist/constants/tripDetails/CpTripDetailsConfig.d.ts +16 -0
  21. package/dist/constants/tripDetails/CpTripDetailsConfig.d.ts.map +1 -0
  22. package/dist/constants/tripDetails/Flight.d.ts +5 -0
  23. package/dist/constants/tripDetails/Flight.d.ts.map +1 -0
  24. package/dist/constants/tripDetails/FlightSegment.d.ts +15 -0
  25. package/dist/constants/tripDetails/FlightSegment.d.ts.map +1 -0
  26. package/dist/constants/tripDetails/FlightStopTypes.d.ts +7 -0
  27. package/dist/constants/tripDetails/FlightStopTypes.d.ts.map +1 -0
  28. package/dist/constants/tripDetails/Terminal.d.ts +5 -0
  29. package/dist/constants/tripDetails/Terminal.d.ts.map +1 -0
  30. package/dist/constants/tripDetails/index.d.ts +9 -0
  31. package/dist/constants/tripDetails/index.d.ts.map +1 -0
  32. package/dist/helpers/tripDetails.d.ts +23 -0
  33. package/dist/helpers/tripDetails.d.ts.map +1 -0
  34. package/dist/pimp.es.js +5656 -4673
  35. package/dist/pimp.umd.js +66 -33
  36. package/dist/style.css +1 -1
  37. package/package.json +2 -1
  38. package/src/assets/images/dot.svg +3 -0
  39. package/src/components/CpSelectableButton.vue +4 -0
  40. package/src/components/CpTextMorph.vue +17 -0
  41. package/src/components/CpTripDetails.vue +64 -0
  42. package/src/components/CpTripLegRouteInformation.vue +224 -0
  43. package/src/components/CpTripLegRouteLayover.vue +63 -0
  44. package/src/components/CpTripLegRoutePlace.vue +196 -0
  45. package/src/components/CpTripLegRouteSegment.vue +99 -0
  46. package/src/components/index.ts +26 -0
  47. package/src/constants/tripDetails/Airline.ts +4 -0
  48. package/src/constants/tripDetails/Airport.ts +6 -0
  49. package/src/constants/tripDetails/CpTripDetailsConfig.ts +29 -0
  50. package/src/constants/tripDetails/Flight.ts +5 -0
  51. package/src/constants/tripDetails/FlightSegment.ts +15 -0
  52. package/src/constants/tripDetails/FlightStopTypes.ts +6 -0
  53. package/src/constants/tripDetails/Terminal.ts +4 -0
  54. package/src/constants/tripDetails/index.ts +9 -0
  55. package/src/helpers/tripDetails.ts +61 -0
  56. package/src/stories/CpTextMorph.stories.ts +236 -0
  57. package/src/stories/CpTrip.stories.ts +147 -0
  58. package/src/stories/CpTripDetails.stories.ts +134 -0
@@ -0,0 +1,134 @@
1
+ import type { Args, Meta, StoryObj } from '@storybook/vue3-vite'
2
+
3
+ import type { Flight } from '@/constants/tripDetails/Flight'
4
+
5
+ import CpTripDetails from '@/components/CpTripDetails.vue'
6
+
7
+ const parisAirport = {
8
+ city_name: 'Paris',
9
+ iata_code: 'CDG',
10
+ name: 'Paris Charles de Gaulle Airport',
11
+ timezone: 'Europe/Paris',
12
+ }
13
+
14
+ const munichAirport = {
15
+ city_name: 'Munich',
16
+ iata_code: 'MUC',
17
+ name: 'Franz Josef Strauss Airport',
18
+ timezone: 'Europe/Berlin',
19
+ }
20
+
21
+ const newYorkAirport = {
22
+ city_name: 'New York',
23
+ iata_code: 'JFK',
24
+ name: 'John F. Kennedy International Airport',
25
+ timezone: 'America/New_York',
26
+ }
27
+
28
+ const directFlight: Flight = {
29
+ segments: [
30
+ {
31
+ airline: { iata_code: 'AF', name: 'Air France' },
32
+ arrival_date: '2026-06-10T17:40:00',
33
+ departure_date: '2026-06-10T09:00:00',
34
+ destination: newYorkAirport,
35
+ destination_terminal: { label: 'Terminal 1', terminal_code: '1' },
36
+ flight_number: 'AF008',
37
+ origin: parisAirport,
38
+ origin_terminal: { label: 'Terminal 2E', terminal_code: '2E' },
39
+ },
40
+ ],
41
+ }
42
+
43
+ const oneStopFlight: Flight = {
44
+ segments: [
45
+ {
46
+ airline: { iata_code: 'AF', name: 'Air France' },
47
+ arrival_date: '2026-06-10T11:10:00',
48
+ departure_date: '2026-06-10T09:00:00',
49
+ destination: munichAirport,
50
+ flight_number: 'AF1234',
51
+ origin: parisAirport,
52
+ origin_terminal: { label: 'Terminal 2E', terminal_code: '2E' },
53
+ via_airport: { city_name: 'Munich', iata_code: 'MUC' },
54
+ },
55
+ {
56
+ airline: { iata_code: 'KL', name: 'KLM' },
57
+ arrival_date: '2026-06-10T20:25:00',
58
+ departure_date: '2026-06-10T13:20:00',
59
+ destination: newYorkAirport,
60
+ destination_terminal: { label: 'Terminal 4', terminal_code: '4' },
61
+ flight_number: 'KL5678',
62
+ origin: munichAirport,
63
+ },
64
+ ],
65
+ }
66
+
67
+ /** Luxon formats times and durations through `Intl`, so any BCP 47 tag works. */
68
+ const localeOptions = ['en', 'fr', 'de', 'es', 'it', 'nl', 'pt']
69
+
70
+ const localeLabels: Record<string, string> = {
71
+ de: 'Deutsch (de)',
72
+ en: 'English (en)',
73
+ es: 'Español (es)',
74
+ fr: 'Français (fr)',
75
+ it: 'Italiano (it)',
76
+ nl: 'Nederlands (nl)',
77
+ pt: 'Português (pt)',
78
+ }
79
+
80
+ const meta = {
81
+ title: 'Business/CpTripDetails',
82
+ component: CpTripDetails,
83
+ argTypes: {
84
+ flight: {
85
+ control: 'object',
86
+ description: 'Raw flight data (segments) the leg-by-leg route detail is built from',
87
+ },
88
+ config: {
89
+ control: 'object',
90
+ description: 'Static label overrides — Pimp has no i18n, so the consumer supplies its own translations',
91
+ },
92
+ locale: {
93
+ control: { type: 'select', labels: localeLabels },
94
+ options: localeOptions,
95
+ description: 'Locale used to format durations and the date tooltips. Does not translate the `config` labels.',
96
+ table: { defaultValue: { summary: 'en' } },
97
+ },
98
+ },
99
+ } satisfies Meta<typeof CpTripDetails>
100
+
101
+ export default meta
102
+
103
+ type Story = StoryObj<typeof meta>
104
+
105
+ const defaultRender = (args: Args) => ({
106
+ components: { CpTripDetails },
107
+ setup() {
108
+ return { args }
109
+ },
110
+ template: `<CpTripDetails v-bind="args" />`,
111
+ })
112
+
113
+ /**
114
+ * Direct flight: a single segment, no layover section.
115
+ */
116
+ export const DirectFlight: Story = {
117
+ args: {
118
+ flight: directFlight,
119
+ locale: 'en',
120
+ },
121
+ render: defaultRender,
122
+ }
123
+
124
+ /**
125
+ * One-stop itinerary: the layover section appears between the two segments,
126
+ * and the technical-stop row is visible in the connection details.
127
+ */
128
+ export const OneStop: Story = {
129
+ args: {
130
+ flight: oneStopFlight,
131
+ locale: 'en',
132
+ },
133
+ render: defaultRender,
134
+ }