@citizenplane/pimp 18.21.0 → 18.21.2

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.21.0",
3
+ "version": "18.21.2",
4
4
  "scripts": {
5
5
  "dev": "storybook dev -p 8081",
6
6
  "build-storybook": "storybook build --output-dir ./docs",
@@ -80,6 +80,12 @@ const increment = () => {
80
80
  @include mx.square-sizing(28);
81
81
  @extend %u-focus-outline;
82
82
 
83
+ .cpIcon {
84
+ flex-shrink: 0;
85
+
86
+ @include mx.square-sizing(16);
87
+ }
88
+
83
89
  &:disabled {
84
90
  border-color: transparent;
85
91
  background: var(--cp-background-secondary);
@@ -5,9 +5,7 @@
5
5
  </button>
6
6
  <div class="cpStepperMobile__wrapper">
7
7
  <cp-heading class="cpStepperMobile__title" heading-level="h3" :size="600">
8
- <transition mode="out-in" :name="titleTransitionName">
9
- <span :key="activeStepLabel" class="cpStepperMobile__titleInner">{{ activeStepLabel }}</span>
10
- </transition>
8
+ <cp-text-morph :text="activeStepLabel ?? ''" class="cpStepperMobile__titleInner" />
11
9
  </cp-heading>
12
10
  <div class="cpStepperMobile__steps">
13
11
  <div v-for="step in steps" :key="step.id" class="cpStepperMobile__step" :class="stepActiveClass(step)" />
@@ -17,12 +15,13 @@
17
15
  </template>
18
16
 
19
17
  <script setup lang="ts">
20
- import { computed, ref, watch } from 'vue'
18
+ import { computed } from 'vue'
19
+
20
+ import type { CpStepperStep } from '@/constants/CpStepperTypes'
21
21
 
22
22
  import CpHeading from '@/components/CpHeading.vue'
23
23
  import CpIcon from '@/components/CpIcon.vue'
24
-
25
- import { type CpStepperStep, CpStepperTransitionDirections } from '@/constants/CpStepperTypes'
24
+ import CpTextMorph from '@/components/CpTextMorph.vue'
26
25
 
27
26
  interface Props {
28
27
  activeStepId?: string
@@ -40,24 +39,8 @@ const emit = defineEmits<{ previous: [] }>()
40
39
  const activeStep = computed(() => props.steps.find((step) => step.id === props.activeStepId))
41
40
  const activeStepLabel = computed(() => activeStep.value?.label)
42
41
 
43
- const titleTransitionDirection = ref<CpStepperTransitionDirections>(CpStepperTransitionDirections.FORWARD)
44
- const titleTransitionName = computed(() => `slide-${titleTransitionDirection.value}`)
45
-
46
42
  const stepActiveClass = (step: CpStepperStep) =>
47
43
  step.id === props.activeStepId ? 'cpStepperMobile__step--isActive' : ''
48
-
49
- watch(
50
- () => props.activeStepId,
51
- (newStepId, oldStepId) => {
52
- if (!newStepId || !oldStepId) return
53
-
54
- const newIndex = props.steps.findIndex((step) => step.id === newStepId)
55
- const oldIndex = props.steps.findIndex((step) => step.id === oldStepId)
56
-
57
- titleTransitionDirection.value =
58
- newIndex > oldIndex ? CpStepperTransitionDirections.BACKWARD : CpStepperTransitionDirections.FORWARD
59
- },
60
- )
61
44
  </script>
62
45
 
63
46
  <style lang="scss">
@@ -122,43 +105,4 @@ watch(
122
105
  }
123
106
  }
124
107
  }
125
-
126
- .slide-backward,
127
- .slide-forward {
128
- &-enter-active,
129
- &-leave-active {
130
- transition:
131
- transform 200ms ease,
132
- opacity 200ms ease;
133
- }
134
-
135
- &-enter-from,
136
- &-leave-to {
137
- opacity: 0;
138
- }
139
-
140
- &-enter-to {
141
- transform: translate3d(0, 0, 0);
142
- }
143
- }
144
-
145
- .slide-forward {
146
- &-enter-from {
147
- transform: translate3d(3vw, 0, 0);
148
- }
149
-
150
- &-leave-to {
151
- transform: translate3d(-3vw, 0, 0);
152
- }
153
- }
154
-
155
- .slide-backward {
156
- &-enter-from {
157
- transform: translate3d(-3vw, 0, 0);
158
- }
159
-
160
- &-leave-to {
161
- transform: translate3d(3vw, 0, 0);
162
- }
163
- }
164
108
  </style>
@@ -222,7 +222,6 @@ export type {
222
222
 
223
223
  export { CpAncillaryCategoryTypes, isSwitchCategory } from '@/constants/CpAncillaryCategoryTypes'
224
224
  export { CpAncillaryItemTypes } from '@/constants/CpAncillaryItemTypes'
225
- export { CpStepperTransitionDirections } from '@/constants/CpStepperTypes'
226
225
  export {
227
226
  CpSeatMapTransitionDirections,
228
227
  DEFAULT_CP_SEAT_MAP_CONFIG,
@@ -2,8 +2,3 @@ export interface CpStepperStep {
2
2
  id: string
3
3
  label: string
4
4
  }
5
-
6
- export enum CpStepperTransitionDirections {
7
- BACKWARD = 'backward',
8
- FORWARD = 'forward',
9
- }
@@ -53,8 +53,8 @@ export const Default: Story = {
53
53
  }
54
54
 
55
55
  /**
56
- * Previous/Next move the active step index so the title's
57
- * slide-forward / slide-backward transition plays in each direction.
56
+ * Previous/Next move the active step index so the title morphs
57
+ * from the previous step name to the new one.
58
58
  */
59
59
  export const Interactive: Story = {
60
60
  args: { ...Default.args },