@citizenplane/pimp 18.16.3 → 18.18.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/dist/components/CpAncillaryItem.vue.d.ts +30 -0
- package/dist/components/CpAncillaryItem.vue.d.ts.map +1 -0
- package/dist/components/CpBottomSheet.vue.d.ts +1 -1
- package/dist/components/CpDate.vue.d.ts +1 -1
- package/dist/components/CpDate.vue.d.ts.map +1 -1
- package/dist/components/CpDialog.vue.d.ts +1 -1
- package/dist/components/CpDialog.vue.d.ts.map +1 -1
- package/dist/components/CpQuantityCounter.vue.d.ts +24 -0
- package/dist/components/CpQuantityCounter.vue.d.ts.map +1 -0
- package/dist/components/CpSwitch.vue.d.ts +1 -1
- package/dist/components/CpSwitch.vue.d.ts.map +1 -1
- package/dist/components/CpTextarea.vue.d.ts +1 -1
- package/dist/components/CpTextarea.vue.d.ts.map +1 -1
- package/dist/components/CpTransitionCounter.vue.d.ts +1 -1
- package/dist/components/CpTransitionCounter.vue.d.ts.map +1 -1
- package/dist/components/index.d.ts +4 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/constants/CpAncillaryItemTypes.d.ts +31 -0
- package/dist/constants/CpAncillaryItemTypes.d.ts.map +1 -0
- package/dist/pimp.es.js +1720 -1569
- package/dist/pimp.umd.js +45 -45
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/assets/images/ancillaries/airport-transfer.png +0 -0
- package/src/assets/images/ancillaries/bicycle.png +0 -0
- package/src/assets/images/ancillaries/cabin-bag.png +0 -0
- package/src/assets/images/ancillaries/checked-bag-size-1.png +0 -0
- package/src/assets/images/ancillaries/checked-bag-size-2.png +0 -0
- package/src/assets/images/ancillaries/checked-bag-size-3.png +0 -0
- package/src/assets/images/ancillaries/checked-bag.png +0 -0
- package/src/assets/images/ancillaries/connectivity.png +0 -0
- package/src/assets/images/ancillaries/diving-set.png +0 -0
- package/src/assets/images/ancillaries/extra-weight.png +0 -0
- package/src/assets/images/ancillaries/fast-track.png +0 -0
- package/src/assets/images/ancillaries/firearm.png +0 -0
- package/src/assets/images/ancillaries/fishing-rod.png +0 -0
- package/src/assets/images/ancillaries/golf.png +0 -0
- package/src/assets/images/ancillaries/hand-bag.png +0 -0
- package/src/assets/images/ancillaries/kite-surf.png +0 -0
- package/src/assets/images/ancillaries/lounge-access.png +0 -0
- package/src/assets/images/ancillaries/meet-and-greet.png +0 -0
- package/src/assets/images/ancillaries/music.png +0 -0
- package/src/assets/images/ancillaries/oversized.png +0 -0
- package/src/assets/images/ancillaries/pet-in-cabin.png +0 -0
- package/src/assets/images/ancillaries/pet-in-hold.png +0 -0
- package/src/assets/images/ancillaries/skis.png +0 -0
- package/src/assets/images/ancillaries/special-meal.png +0 -0
- package/src/assets/images/ancillaries/standard-meal.png +0 -0
- package/src/components/CpAncillaryItem.vue +275 -0
- package/src/components/CpQuantityCounter.vue +106 -0
- package/src/components/index.ts +7 -0
- package/src/constants/CpAncillaryItemTypes.ts +30 -0
- package/src/stories/CpAncillaryItem.stories.ts +243 -0
- package/src/stories/CpQuantityCounter.stories.ts +63 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
import CpAncillaryItem from '@/components/CpAncillaryItem.vue'
|
|
5
|
+
|
|
6
|
+
import { CpAncillaryItemTypes } from '@/constants/CpAncillaryItemTypes'
|
|
7
|
+
import { docCellStyle, docLabelStyle, docRowWrapStyle } from '@/stories/documentationStyles'
|
|
8
|
+
|
|
9
|
+
const galleryCellStyle = `${docCellStyle} width: 260px;`
|
|
10
|
+
|
|
11
|
+
const meta = {
|
|
12
|
+
title: 'Atoms/CpAncillaryItem',
|
|
13
|
+
component: CpAncillaryItem,
|
|
14
|
+
argTypes: {
|
|
15
|
+
currency: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
description: 'ISO currency code used to format price',
|
|
18
|
+
},
|
|
19
|
+
description: {
|
|
20
|
+
control: 'text',
|
|
21
|
+
description: 'Description text for the ancillary',
|
|
22
|
+
},
|
|
23
|
+
locale: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
description: 'Locale used to format price, defaults to the browser locale',
|
|
26
|
+
},
|
|
27
|
+
maxQuantity: {
|
|
28
|
+
control: 'number',
|
|
29
|
+
description: 'Maximum selectable quantity, null for uncapped',
|
|
30
|
+
},
|
|
31
|
+
maxQuantityLabel: {
|
|
32
|
+
control: 'text',
|
|
33
|
+
description: 'Caption shown next to the counter when maxQuantity is set',
|
|
34
|
+
},
|
|
35
|
+
price: {
|
|
36
|
+
control: 'number',
|
|
37
|
+
description: 'Price in minor units (cents), formatted with currency',
|
|
38
|
+
},
|
|
39
|
+
subtitle: {
|
|
40
|
+
control: 'text',
|
|
41
|
+
description: 'Optional second line rendered under the description',
|
|
42
|
+
},
|
|
43
|
+
title: {
|
|
44
|
+
control: 'text',
|
|
45
|
+
description: 'Title of the ancillary',
|
|
46
|
+
},
|
|
47
|
+
type: {
|
|
48
|
+
control: 'select',
|
|
49
|
+
options: Object.values(CpAncillaryItemTypes),
|
|
50
|
+
description: 'Picks the visual for the ancillary',
|
|
51
|
+
},
|
|
52
|
+
vertical: {
|
|
53
|
+
control: 'boolean',
|
|
54
|
+
description: 'Whether to use the column layout instead of the row layout',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
} satisfies Meta<typeof CpAncillaryItem>
|
|
58
|
+
|
|
59
|
+
export default meta
|
|
60
|
+
type Story = StoryObj<typeof meta>
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Default ancillary card. Use the controls to experiment with each prop in isolation.
|
|
64
|
+
*/
|
|
65
|
+
export const Default: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
title: 'Checked bag',
|
|
68
|
+
description: '23kg included',
|
|
69
|
+
type: CpAncillaryItemTypes.CHECKED_BAG,
|
|
70
|
+
quantity: 0,
|
|
71
|
+
maxQuantity: 3,
|
|
72
|
+
maxQuantityLabel: 'max. 3',
|
|
73
|
+
price: 2990,
|
|
74
|
+
currency: 'EUR',
|
|
75
|
+
vertical: false,
|
|
76
|
+
},
|
|
77
|
+
render: (args) => ({
|
|
78
|
+
components: { CpAncillaryItem },
|
|
79
|
+
setup() {
|
|
80
|
+
const quantity = ref(0)
|
|
81
|
+
return { args, quantity }
|
|
82
|
+
},
|
|
83
|
+
template: `
|
|
84
|
+
<div style="padding: 20px; min-width: 15rem;">
|
|
85
|
+
<CpAncillaryItem v-bind="args" v-model:quantity="quantity" />
|
|
86
|
+
</div>
|
|
87
|
+
`,
|
|
88
|
+
}),
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* -------------------------------------------------------------------------- */
|
|
92
|
+
/* States */
|
|
93
|
+
/* -------------------------------------------------------------------------- */
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* quantity > 0 adds the accent ring and swaps the counter background.
|
|
97
|
+
*/
|
|
98
|
+
export const Selected: Story = {
|
|
99
|
+
args: {
|
|
100
|
+
...Default.args,
|
|
101
|
+
quantity: 1,
|
|
102
|
+
},
|
|
103
|
+
render: (args) => ({
|
|
104
|
+
components: { CpAncillaryItem },
|
|
105
|
+
setup() {
|
|
106
|
+
const quantity = ref(1)
|
|
107
|
+
return { args, quantity }
|
|
108
|
+
},
|
|
109
|
+
template: `
|
|
110
|
+
<div style="padding: 20px; min-width: 15rem;">
|
|
111
|
+
<CpAncillaryItem v-bind="args" v-model:quantity="quantity" />
|
|
112
|
+
</div>
|
|
113
|
+
`,
|
|
114
|
+
}),
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* No maxQuantity: the counter has no upper bound and the caption is hidden.
|
|
119
|
+
*/
|
|
120
|
+
export const Uncapped: Story = {
|
|
121
|
+
args: {
|
|
122
|
+
title: 'Extra weight',
|
|
123
|
+
description: 'Additional 5kg allowance',
|
|
124
|
+
type: CpAncillaryItemTypes.EXTRA_WEIGHT,
|
|
125
|
+
quantity: 0,
|
|
126
|
+
maxQuantity: null,
|
|
127
|
+
price: 990,
|
|
128
|
+
currency: 'EUR',
|
|
129
|
+
vertical: false,
|
|
130
|
+
},
|
|
131
|
+
render: (args) => ({
|
|
132
|
+
components: { CpAncillaryItem },
|
|
133
|
+
setup() {
|
|
134
|
+
const quantity = ref(0)
|
|
135
|
+
return { args, quantity }
|
|
136
|
+
},
|
|
137
|
+
template: `
|
|
138
|
+
<div style="padding: 20px; min-width: 15rem;">
|
|
139
|
+
<CpAncillaryItem v-bind="args" v-model:quantity="quantity" />
|
|
140
|
+
</div>
|
|
141
|
+
`,
|
|
142
|
+
}),
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* A type with no bundled visual falls back to the shopping-bag icon.
|
|
147
|
+
*/
|
|
148
|
+
export const NoImage: Story = {
|
|
149
|
+
args: {
|
|
150
|
+
title: 'Cancellation insurance',
|
|
151
|
+
description: 'Refund protection for your trip',
|
|
152
|
+
type: CpAncillaryItemTypes.CANCELLATION_INSURANCE,
|
|
153
|
+
quantity: 0,
|
|
154
|
+
maxQuantity: 1,
|
|
155
|
+
maxQuantityLabel: 'max. 1',
|
|
156
|
+
price: 1490,
|
|
157
|
+
currency: 'EUR',
|
|
158
|
+
vertical: false,
|
|
159
|
+
},
|
|
160
|
+
render: (args) => ({
|
|
161
|
+
components: { CpAncillaryItem },
|
|
162
|
+
setup() {
|
|
163
|
+
const quantity = ref(0)
|
|
164
|
+
return { args, quantity }
|
|
165
|
+
},
|
|
166
|
+
template: `
|
|
167
|
+
<div style="padding: 20px; min-width: 15rem;">
|
|
168
|
+
<CpAncillaryItem v-bind="args" v-model:quantity="quantity" />
|
|
169
|
+
</div>
|
|
170
|
+
`,
|
|
171
|
+
}),
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The column layout, used for baggage grids. subtitle renders a second details
|
|
176
|
+
* line under the description.
|
|
177
|
+
*/
|
|
178
|
+
export const Vertical: Story = {
|
|
179
|
+
args: {
|
|
180
|
+
title: 'Cabin bag',
|
|
181
|
+
description: '10kg included',
|
|
182
|
+
subtitle: '9kg • 55 × 36 × 25 cm',
|
|
183
|
+
type: CpAncillaryItemTypes.CABIN_BAG,
|
|
184
|
+
quantity: 0,
|
|
185
|
+
maxQuantity: 1,
|
|
186
|
+
maxQuantityLabel: 'max. 1',
|
|
187
|
+
price: 1990,
|
|
188
|
+
currency: 'EUR',
|
|
189
|
+
vertical: true,
|
|
190
|
+
},
|
|
191
|
+
render: (args) => ({
|
|
192
|
+
components: { CpAncillaryItem },
|
|
193
|
+
setup() {
|
|
194
|
+
const quantity = ref(0)
|
|
195
|
+
return { args, quantity }
|
|
196
|
+
},
|
|
197
|
+
template: `
|
|
198
|
+
<div style="padding: 20px; min-width: 15rem;">
|
|
199
|
+
<CpAncillaryItem v-bind="args" v-model:quantity="quantity" />
|
|
200
|
+
</div>
|
|
201
|
+
`,
|
|
202
|
+
}),
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/* -------------------------------------------------------------------------- */
|
|
206
|
+
/* Gallery */
|
|
207
|
+
/* -------------------------------------------------------------------------- */
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Every enum value rendered at once: each real visual, and the fallback icon
|
|
211
|
+
* for the three art-less types.
|
|
212
|
+
*/
|
|
213
|
+
export const Gallery: Story = {
|
|
214
|
+
args: {
|
|
215
|
+
...Default.args,
|
|
216
|
+
},
|
|
217
|
+
parameters: { controls: { disable: true } },
|
|
218
|
+
render: () => ({
|
|
219
|
+
components: { CpAncillaryItem },
|
|
220
|
+
setup() {
|
|
221
|
+
const types = Object.values(CpAncillaryItemTypes)
|
|
222
|
+
const quantities = ref(Object.fromEntries(types.map((type) => [type, 0])))
|
|
223
|
+
return { types, quantities, galleryCellStyle, docLabelStyle, docRowWrapStyle }
|
|
224
|
+
},
|
|
225
|
+
template: `
|
|
226
|
+
<div :style="docRowWrapStyle">
|
|
227
|
+
<div v-for="type in types" :key="type" :style="galleryCellStyle">
|
|
228
|
+
<span :style="docLabelStyle">{{ type }}</span>
|
|
229
|
+
<CpAncillaryItem
|
|
230
|
+
v-model:quantity="quantities[type]"
|
|
231
|
+
:title="type"
|
|
232
|
+
description="Sample description"
|
|
233
|
+
:type="type"
|
|
234
|
+
:max-quantity="5"
|
|
235
|
+
max-quantity-label="max. 5"
|
|
236
|
+
:price="1000"
|
|
237
|
+
currency="EUR"
|
|
238
|
+
/>
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
241
|
+
`,
|
|
242
|
+
}),
|
|
243
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
import CpQuantityCounter from '@/components/CpQuantityCounter.vue'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Atoms/CpQuantityCounter',
|
|
8
|
+
component: CpQuantityCounter,
|
|
9
|
+
argTypes: {
|
|
10
|
+
decreaseLabel: {
|
|
11
|
+
control: 'text',
|
|
12
|
+
description: 'Aria-label for the decrease button',
|
|
13
|
+
},
|
|
14
|
+
disableAnimation: {
|
|
15
|
+
control: 'boolean',
|
|
16
|
+
description: 'Whether to render the count as a plain span instead of animating it',
|
|
17
|
+
},
|
|
18
|
+
increaseLabel: {
|
|
19
|
+
control: 'text',
|
|
20
|
+
description: 'Aria-label for the increase button',
|
|
21
|
+
},
|
|
22
|
+
max: {
|
|
23
|
+
control: 'number',
|
|
24
|
+
description: 'Maximum allowed value',
|
|
25
|
+
},
|
|
26
|
+
min: {
|
|
27
|
+
control: 'number',
|
|
28
|
+
description: 'Minimum allowed value',
|
|
29
|
+
},
|
|
30
|
+
modelValue: {
|
|
31
|
+
control: 'number',
|
|
32
|
+
description: 'The counter value',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
} satisfies Meta<typeof CpQuantityCounter>
|
|
36
|
+
|
|
37
|
+
export default meta
|
|
38
|
+
type Story = StoryObj<typeof meta>
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Default counter. Use the controls to experiment with each prop in isolation.
|
|
42
|
+
*/
|
|
43
|
+
export const Default: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
modelValue: 1,
|
|
46
|
+
min: 0,
|
|
47
|
+
max: 5,
|
|
48
|
+
decreaseLabel: 'Decrease',
|
|
49
|
+
increaseLabel: 'Increase',
|
|
50
|
+
},
|
|
51
|
+
render: (args) => ({
|
|
52
|
+
components: { CpQuantityCounter },
|
|
53
|
+
setup() {
|
|
54
|
+
const value = ref(1)
|
|
55
|
+
return { args, value }
|
|
56
|
+
},
|
|
57
|
+
template: `
|
|
58
|
+
<div style="padding: 20px;">
|
|
59
|
+
<CpQuantityCounter v-bind="args" v-model="value" />
|
|
60
|
+
</div>
|
|
61
|
+
`,
|
|
62
|
+
}),
|
|
63
|
+
}
|