@citizenplane/pimp 18.19.4 → 18.19.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citizenplane/pimp",
3
- "version": "18.19.4",
3
+ "version": "18.19.6",
4
4
  "scripts": {
5
5
  "dev": "storybook dev -p 8081",
6
6
  "build-storybook": "storybook build --output-dir ./docs",
@@ -26,20 +26,22 @@
26
26
  <span v-if="hasFromPrice" class="cpAncillaryCategory__price">{{ formattedPrice }}</span>
27
27
  <cp-switch v-model="checked" color="accent" />
28
28
  </div>
29
- <div v-else-if="isActuallyExpandable" class="cpAncillaryCategory__trailing">
30
- <span v-if="hasFromPrice" class="cpAncillaryCategory__fromPriceClip">
31
- <span :aria-hidden="isOpen" class="cpAncillaryCategory__fromPrice" :class="fromPriceDynamicClass">
32
- <span class="cpAncillaryCategory__fromPriceLabel">{{ fromPriceLabel }}</span>
33
- <span class="cpAncillaryCategory__fromPriceAmount">{{ formattedPrice }}</span>
34
- </span>
35
- </span>
29
+ <template v-else-if="isActuallyExpandable">
30
+ <div class="cpAncillaryCategory__trailing">
31
+ <cp-transition-expand>
32
+ <span v-if="!isOpen && hasFromPrice" class="cpAncillaryCategory__fromPrice">
33
+ <span class="cpAncillaryCategory__fromPriceLabel">{{ fromPriceLabel }}</span>
34
+ <span class="cpAncillaryCategory__fromPriceAmount">{{ formattedPrice }}</span>
35
+ </span>
36
+ </cp-transition-expand>
37
+ </div>
36
38
  <cp-icon
37
39
  class="cpAncillaryCategory__chevron"
38
40
  :class="chevronDynamicClass"
39
41
  size="24"
40
42
  type="chevron-down"
41
43
  />
42
- </div>
44
+ </template>
43
45
  </div>
44
46
  </div>
45
47
  </component>
@@ -133,8 +135,6 @@ const formattedPrice = computed(() => {
133
135
 
134
136
  const hasFromPrice = computed(() => formattedPrice.value !== null)
135
137
 
136
- const fromPriceDynamicClass = computed(() => ({ 'cpAncillaryCategory__fromPrice--isHidden': isOpen.value }))
137
-
138
138
  const chevronDynamicClass = computed(() => ({ 'cpAncillaryCategory__chevron--isRotated': isOpen.value }))
139
139
 
140
140
  const handleHeaderClick = () => {
@@ -183,6 +183,7 @@ const handleHeaderClick = () => {
183
183
  @container (width < 30rem) {
184
184
  flex-direction: column;
185
185
  align-items: stretch;
186
+ gap: 0;
186
187
  }
187
188
  }
188
189
 
@@ -195,9 +196,17 @@ const handleHeaderClick = () => {
195
196
  border-radius: var(--cp-radius-lg);
196
197
  gap: var(--cp-spacing-lg);
197
198
 
199
+ &:has(+ .cpAncillaryCategory__chevron) {
200
+ flex: 0 0 fn.px-to-rem(180);
201
+ }
202
+
198
203
  @container (width < 30rem) {
199
204
  justify-content: flex-start;
200
205
  padding: 0;
206
+
207
+ &:has(+ .cpAncillaryCategory__chevron) {
208
+ flex: none;
209
+ }
201
210
  }
202
211
  }
203
212
 
@@ -209,24 +218,13 @@ const handleHeaderClick = () => {
209
218
  line-height: var(--cp-text-lg-line-height);
210
219
  }
211
220
 
212
- &__fromPriceClip {
213
- overflow: hidden;
214
- }
215
-
216
221
  &__fromPrice {
217
222
  display: flex;
218
223
  align-items: center;
219
224
  gap: var(--cp-spacing-sm);
220
- opacity: 1;
221
- transform: translate3d(0, 0, 0);
222
- transition:
223
- opacity 200ms ease,
224
- transform 200ms ease;
225
-
226
- &--isHidden {
227
- opacity: 0;
228
- pointer-events: none;
229
- transform: translate3d(0, 20px, 0);
225
+
226
+ @container (width < 30rem) {
227
+ margin-block-start: var(--cp-spacing-lg);
230
228
  }
231
229
  }
232
230
 
@@ -274,6 +272,11 @@ const handleHeaderClick = () => {
274
272
  min-width: 0;
275
273
  flex: auto;
276
274
  flex-direction: column;
275
+
276
+ .cpAncillaryCategory__content:has(.cpAncillaryCategory__chevron) & {
277
+ min-width: 0;
278
+ flex: 1 1 0;
279
+ }
277
280
  }
278
281
 
279
282
  &__title {
@@ -216,41 +216,43 @@ const cpAncillaryItemDynamicClass = computed(() => ({
216
216
  line-height: var(--cp-text-md-line-height);
217
217
  }
218
218
 
219
- &--isVertical {
220
- .cpAncillaryItem__wrap {
221
- flex-direction: column;
222
- align-items: center;
223
- padding-bottom: var(--cp-spacing-lg);
224
- }
225
-
226
- .cpAncillaryItem__visual {
227
- width: 100%;
228
- height: fn.px-to-rem(128);
229
- }
230
-
231
- .cpAncillaryItem__image {
232
- width: fn.px-to-rem(80);
233
- height: fn.px-to-rem(80);
234
- }
235
-
236
- .cpAncillaryItem__content {
237
- width: 100%;
238
- align-items: center;
239
- }
240
-
241
- .cpAncillaryItem__name {
242
- padding: 0 var(--cp-spacing-lg);
243
- }
244
-
245
- .cpAncillaryItem__title,
246
- .cpAncillaryItem__description,
247
- .cpAncillaryItem__subtitle {
248
- text-align: center;
249
- }
250
-
251
- .cpAncillaryItem__quantity {
252
- flex-direction: column;
253
- gap: var(--cp-spacing-sm);
219
+ @include mx.media-query-min(48rem) {
220
+ &--isVertical {
221
+ .cpAncillaryItem__wrap {
222
+ flex-direction: column;
223
+ align-items: center;
224
+ padding-bottom: var(--cp-spacing-lg);
225
+ }
226
+
227
+ .cpAncillaryItem__visual {
228
+ width: 100%;
229
+ height: fn.px-to-rem(128);
230
+ }
231
+
232
+ .cpAncillaryItem__image {
233
+ width: fn.px-to-rem(80);
234
+ height: fn.px-to-rem(80);
235
+ }
236
+
237
+ .cpAncillaryItem__content {
238
+ width: 100%;
239
+ align-items: center;
240
+ }
241
+
242
+ .cpAncillaryItem__name {
243
+ padding: 0 var(--cp-spacing-lg);
244
+ }
245
+
246
+ .cpAncillaryItem__title,
247
+ .cpAncillaryItem__description,
248
+ .cpAncillaryItem__subtitle {
249
+ text-align: center;
250
+ }
251
+
252
+ .cpAncillaryItem__quantity {
253
+ flex-direction: column;
254
+ gap: var(--cp-spacing-sm);
255
+ }
254
256
  }
255
257
  }
256
258
 
@@ -240,7 +240,7 @@ export const Mobile: Story = {
240
240
  template: `
241
241
  <div :style="galleryListStyle">
242
242
  <div :style="galleryRowStyle">
243
- <span :style="docLabelStyle">Expandable</span>
243
+ <span :style="docLabelStyle">Expandable (closed)</span>
244
244
  <div style="width: 358px;">
245
245
  <CpAncillaryCategory
246
246
  title="Sport Equipments"
@@ -253,6 +253,21 @@ export const Mobile: Story = {
253
253
  />
254
254
  </div>
255
255
  </div>
256
+ <div :style="galleryRowStyle">
257
+ <span :style="docLabelStyle">Expandable (open, no trailing)</span>
258
+ <div style="width: 358px;">
259
+ <CpAncillaryCategory
260
+ title="Sport Equipments"
261
+ description="Travel with special or oversized items you need to bring along."
262
+ type="sportEquipments"
263
+ is-expandable
264
+ :from-price="5990"
265
+ currency="EUR"
266
+ >
267
+ <span :style="docLabelStyle">Body content</span>
268
+ </CpAncillaryCategory>
269
+ </div>
270
+ </div>
256
271
  <div :style="galleryRowStyle">
257
272
  <span :style="docLabelStyle">Switch</span>
258
273
  <div style="width: 358px;">
@@ -202,6 +202,31 @@ export const Vertical: Story = {
202
202
  }),
203
203
  }
204
204
 
205
+ /**
206
+ * Below the tablet breakpoint the card is always horizontal, even when
207
+ * vertical is true: `vertical` only takes effect from tablet width up.
208
+ */
209
+ export const VerticalOnMobile: Story = {
210
+ args: {
211
+ ...Vertical.args,
212
+ },
213
+ globals: {
214
+ viewport: { value: '390-844', isRotated: false },
215
+ },
216
+ render: (args) => ({
217
+ components: { CpAncillaryItem },
218
+ setup() {
219
+ const quantity = ref(0)
220
+ return { args, quantity }
221
+ },
222
+ template: `
223
+ <div style="padding: 20px; min-width: 15rem;">
224
+ <CpAncillaryItem v-bind="args" v-model:quantity="quantity" />
225
+ </div>
226
+ `,
227
+ }),
228
+ }
229
+
205
230
  /* -------------------------------------------------------------------------- */
206
231
  /* Gallery */
207
232
  /* -------------------------------------------------------------------------- */