@citizenplane/pimp 8.26.0 → 8.27.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 (150) hide show
  1. package/dist/{IconAccompaniedMinorEach-DDeSlaA_.js → IconAccompaniedMinorEach-BJYaPpW3.js} +1 -1
  2. package/dist/{IconAccompaniedMinorNone-BKs1gk1K.js → IconAccompaniedMinorNone-D1JR2Qpd.js} +1 -1
  3. package/dist/{IconAccompaniedMinorOne-CpL8FNve.js → IconAccompaniedMinorOne-BJ3jzEDZ.js} +1 -1
  4. package/dist/{IconAddReceipt-DLH3pqjA.js → IconAddReceipt-BX_va94f.js} +1 -1
  5. package/dist/{IconAirportTerminal-Cc4CU6MC.js → IconAirportTerminal-Dzr98nfc.js} +1 -1
  6. package/dist/{IconArrival-CdtUsRVo.js → IconArrival-Ced9HrJH.js} +1 -1
  7. package/dist/{IconBroadcast-QjMZtFA9.js → IconBroadcast-BYX44Wak.js} +1 -1
  8. package/dist/{IconCabinBag-xVC6mOQF.js → IconCabinBag-D1Qs952U.js} +1 -1
  9. package/dist/{IconCheckedBaggage-I_1h49TJ.js → IconCheckedBaggage-Q4_SQL9l.js} +1 -1
  10. package/dist/{IconCheckedBaggage20-CyPcsqrn.js → IconCheckedBaggage20-DVH1-A0V.js} +1 -1
  11. package/dist/{IconCheckedBaggage30-s5htbUIA.js → IconCheckedBaggage30-DYOAf-7Z.js} +1 -1
  12. package/dist/{IconChild-DL43kbm1.js → IconChild-BeCLAr8Y.js} +1 -1
  13. package/dist/{IconContact-FdhTr03q.js → IconContact-B3r39fyI.js} +1 -1
  14. package/dist/{IconDeparture-DNR3OGPD.js → IconDeparture-BflKZUiE.js} +1 -1
  15. package/dist/{IconDistribution-Cl8L6177.js → IconDistribution-CBxQ7UWb.js} +1 -1
  16. package/dist/{IconDistributionClosed-DBT6wR78.js → IconDistributionClosed-BWp_k24K.js} +1 -1
  17. package/dist/{IconDistributionExclusivePair-CkRG6yNV.js → IconDistributionExclusivePair-erLbcLps.js} +1 -1
  18. package/dist/{IconDistributionSided-D_wdvDNf.js → IconDistributionSided-y000n4qB.js} +1 -1
  19. package/dist/{IconDistributionSupplySided-C3VcE8Dw.js → IconDistributionSupplySided-7kCvGwnz.js} +1 -1
  20. package/dist/{IconDynamicContent-Ct1HRd3s.js → IconDynamicContent-SwBxkPMB.js} +1 -1
  21. package/dist/{IconFares-dIGVrtE4.js → IconFares-DTm0Q_RI.js} +1 -1
  22. package/dist/{IconFaresOutlined-bd8kT44f.js → IconFaresOutlined-BFMo_x9Q.js} +1 -1
  23. package/dist/{IconFemale-CMeYHrDy.js → IconFemale-Ma0KeaEM.js} +1 -1
  24. package/dist/{IconFindConversation-BdN2Yd3R.js → IconFindConversation-CpsDYPgD.js} +1 -1
  25. package/dist/{IconFire-obwuluyJ.js → IconFire-DECrDnLM.js} +1 -1
  26. package/dist/{IconFlight-B_6tJxB3.js → IconFlight-D5M0A0CM.js} +1 -1
  27. package/dist/{IconFlightReturn-BEO97PwR.js → IconFlightReturn-CTvqEFME.js} +1 -1
  28. package/dist/{IconHandHeart-hs0yFSEL.js → IconHandHeart-ChgdfXQa.js} +1 -1
  29. package/dist/{IconHistory-CT-jOMRt.js → IconHistory-DpIXDYI5.js} +1 -1
  30. package/dist/{IconHourGlass-CF940vmy.js → IconHourGlass-CIRkFUSM.js} +1 -1
  31. package/dist/{IconIdCard-DKkU58Ix.js → IconIdCard-UD5VZsUi.js} +1 -1
  32. package/dist/{IconInfant-DIUT-6_4.js → IconInfant-CmLUvWpO.js} +1 -1
  33. package/dist/{IconItinerary-D7mOGUmj.js → IconItinerary-CY8irele.js} +1 -1
  34. package/dist/{IconLeave-BExl4uyV.js → IconLeave-C3bpPz6L.js} +1 -1
  35. package/dist/{IconMale-eHGH5XBz.js → IconMale-x4xdulWB.js} +1 -1
  36. package/dist/{IconMultiSegments-KkrKiZrK.js → IconMultiSegments-BhTMfvhQ.js} +1 -1
  37. package/dist/{IconNoPassport-PJ2QqqoI.js → IconNoPassport-_Xm76k6b.js} +1 -1
  38. package/dist/{IconNoRefund-W47AQisu.js → IconNoRefund-B78s0oyF.js} +1 -1
  39. package/dist/{IconNotion-CCnhatKK.js → IconNotion-C22PTLTU.js} +1 -1
  40. package/dist/{IconOffline-3wunTEJG.js → IconOffline-BDzikWE9.js} +1 -1
  41. package/dist/{IconOneWay-BQ5K41Bu.js → IconOneWay-DlTVxokv.js} +2 -2
  42. package/dist/{IconPaid-zwDwWzF8.js → IconPaid-DmGERe85.js} +1 -1
  43. package/dist/{IconPassport-IxhNLS8P.js → IconPassport-6VOlXjxJ.js} +1 -1
  44. package/dist/{IconPayout-BNSON3dj.js → IconPayout-abr6BXCd.js} +1 -1
  45. package/dist/{IconReceipt-DOosYtgi.js → IconReceipt-BnTaihcq.js} +1 -1
  46. package/dist/{IconRecurrence-B8i5kO2Q.js → IconRecurrence-C5TPG2ht.js} +1 -1
  47. package/dist/{IconRefund-DkjF9lEI.js → IconRefund-Ysv8pyMJ.js} +1 -1
  48. package/dist/{IconRoundTrip-BZvhS65z.js → IconRoundTrip-CIVDw8LK.js} +1 -1
  49. package/dist/{IconRouteNoStop-CeSlfnpx.js → IconRouteNoStop-DQrq4gW5.js} +1 -1
  50. package/dist/{IconRouteOneStop-aP1Mj-Bv.js → IconRouteOneStop-pzisj4i4.js} +1 -1
  51. package/dist/{IconScheduleChange-QQ4AMAMI.js → IconScheduleChange-BONs1AAT.js} +1 -1
  52. package/dist/{IconSeatEmpty-DgVBD165.js → IconSeatEmpty-CHij3aGA.js} +1 -1
  53. package/dist/{IconSeatSold-BGBwNZUa.js → IconSeatSold-QspS_zCh.js} +1 -1
  54. package/dist/{IconSeatTotal-Dq9uXccZ.js → IconSeatTotal-DTZ1TcAX.js} +1 -1
  55. package/dist/{IconTemplate-BgruEhjI.js → IconTemplate-BDmmr-9L.js} +1 -1
  56. package/dist/{IconTicket-BTaYnuPt.js → IconTicket--vVn61Ey.js} +1 -1
  57. package/dist/{IconTimer-CyJzne5T.js → IconTimer-CspKpwqZ.js} +1 -1
  58. package/dist/{IconTrafficControl-BeQtpwhK.js → IconTrafficControl-DBamcJNe.js} +1 -1
  59. package/dist/{index-B8RNa4cx.js → index-C3oHnZQk.js} +9152 -10064
  60. package/dist/pimp.es.js +1 -1
  61. package/dist/pimp.umd.js +17 -17
  62. package/dist/style.css +1 -1
  63. package/package.json +2 -1
  64. package/src/components/atomic-elements/CpAirlineLogo.vue +9 -10
  65. package/src/components/atomic-elements/CpBadge.vue +33 -41
  66. package/src/components/atomic-elements/CpDialog.vue +14 -9
  67. package/src/components/atomic-elements/CpPartnerBadge.vue +12 -20
  68. package/src/components/atomic-elements/CpTooltip.vue +12 -11
  69. package/src/components/buttons/CpButton.vue +63 -104
  70. package/src/components/core/BaseInputLabel.vue +9 -15
  71. package/src/components/core/BaseSelectClearButton.vue +1 -1
  72. package/src/components/date-pickers/CpCalendar.vue +154 -153
  73. package/src/components/date-pickers/CpDate.vue +202 -212
  74. package/src/components/date-pickers/CpDatepicker.vue +112 -138
  75. package/src/components/feedback-indicators/CpAlert.vue +16 -27
  76. package/src/components/feedback-indicators/CpLoader.vue +7 -8
  77. package/src/components/feedback-indicators/CpToaster.vue +197 -192
  78. package/src/components/helpers-utilities/TransitionExpand.vue +31 -33
  79. package/src/components/icons/IconOneWay.vue +1 -1
  80. package/src/components/index.ts +28 -40
  81. package/src/components/inputs/CpInput.vue +40 -57
  82. package/src/components/inputs/CpTextarea.vue +30 -50
  83. package/src/components/lists-and-table/CpTable.vue +165 -114
  84. package/src/components/lists-and-table/CpTableEmptyState.vue +5 -8
  85. package/src/components/selects/CpMultiselect.vue +58 -89
  86. package/src/components/selects/CpSelect.vue +70 -90
  87. package/src/components/selects/CpSelectMenu.vue +94 -96
  88. package/src/components/toggles/CpCheckbox.vue +45 -54
  89. package/src/components/toggles/CpRadio.vue +47 -58
  90. package/src/components/toggles/CpSwitch.vue +51 -67
  91. package/src/components/typography/CpHeading.vue +11 -31
  92. package/src/components/visual/CpIcon.vue +2 -1
  93. package/src/constants/{src/CpCustomIcons.ts → CpCustomIcons.ts} +1 -1
  94. package/src/constants/CpTableConfig.ts +12 -0
  95. package/src/constants/Heading.ts +8 -0
  96. package/src/{utils/constants/src/Intent.js → constants/Intent.ts} +1 -1
  97. package/src/constants/PartnerTypes.ts +6 -0
  98. package/src/constants/Position.ts +10 -0
  99. package/src/constants/Sizes.ts +5 -0
  100. package/src/constants/colors/Colors.ts +10 -0
  101. package/src/constants/colors/ToggleColors.ts +6 -0
  102. package/src/constants/index.ts +10 -5
  103. package/src/directives/ClickOutside.ts +17 -0
  104. package/src/directives/{ResizeSelect.js → ResizeSelect.ts} +3 -3
  105. package/src/helpers/{dom.js → dom.ts} +13 -9
  106. package/src/helpers/{index.js → index.ts} +13 -3
  107. package/src/helpers/object.ts +9 -0
  108. package/src/helpers/string/src/camelize.ts +6 -0
  109. package/src/helpers/string/src/{decamelize.js → decamelize.ts} +1 -1
  110. package/src/libs/CoreDatepicker.vue +4 -4
  111. package/src/plugins/toaster.ts +71 -0
  112. package/src/stories/BaseInputLabel.stories.ts +1 -0
  113. package/src/stories/CpAlert.stories.ts +1 -0
  114. package/src/stories/CpBadge.stories.ts +18 -0
  115. package/src/stories/CpCheckbox.stories.ts +3 -1
  116. package/src/stories/CpDate.stories.ts +3 -1
  117. package/src/stories/CpDatepicker.stories.ts +3 -1
  118. package/src/stories/CpDialog.stories.ts +2 -1
  119. package/src/stories/CpHeading.stories.ts +1 -0
  120. package/src/stories/CpIcon.stories.ts +2 -0
  121. package/src/stories/CpInput.stories.ts +3 -1
  122. package/src/stories/CpLoader.stories.ts +1 -0
  123. package/src/stories/CpMultiselect.stories.ts +2 -1
  124. package/src/stories/CpPartnerBadge.stories.ts +1 -1
  125. package/src/stories/CpRadio.stories.ts +3 -1
  126. package/src/stories/CpSelect.stories.ts +3 -1
  127. package/src/stories/CpSelectMenu.stories.ts +3 -1
  128. package/src/stories/CpSwitch.stories.ts +3 -1
  129. package/src/stories/CpTable.stories.ts +8 -1
  130. package/src/stories/CpTableEmptyState.stories.ts +1 -0
  131. package/src/stories/CpTextarea.stories.ts +3 -1
  132. package/src/stories/CpToaster.stories.ts +1 -0
  133. package/src/stories/CpTooltip.stories.ts +1 -0
  134. package/src/stories/TransitionExpand.stories.ts +3 -1
  135. package/src/types/luxon.d.ts +1 -0
  136. package/src/vendors/ff-polyfill.ts +38 -0
  137. package/vitest.workspace.js +1 -3
  138. package/src/constants/src/CpTableConfig.ts +0 -14
  139. package/src/constants/src/Position.ts +0 -10
  140. package/src/constants/src/colors/Colors.ts +0 -10
  141. package/src/constants/src/colors/ToggleColors.ts +0 -6
  142. package/src/directives/ClickOutside.js +0 -13
  143. package/src/helpers/object.js +0 -9
  144. package/src/helpers/string/src/camelize.js +0 -6
  145. package/src/plugins/toaster.js +0 -61
  146. package/src/utils/constants/index.js +0 -3
  147. package/src/utils/constants/src/PartnerTypes.js +0 -6
  148. package/src/utils/constants/src/Sizes.js +0 -5
  149. package/src/vendors/ff-polyfill.js +0 -36
  150. /package/src/helpers/string/{index.js → index.ts} +0 -0
@@ -13,7 +13,7 @@
13
13
  <div class="cpToaster__content">
14
14
  <cp-icon :type="toasterIcon" class="cpToaster__icon" />
15
15
  <div class="cpToaster__body">
16
- <cp-heading heading-level="h4" :size="400" class="cpToaster__title">{{ title }}</cp-heading>
16
+ <cp-heading :heading-level="HeadingLevels.H4" :size="400" class="cpToaster__title">{{ title }}</cp-heading>
17
17
  <p v-if="description" class="cpToaster__description">{{ description }}</p>
18
18
  </div>
19
19
  </div>
@@ -27,210 +27,215 @@
27
27
  </transition>
28
28
  </template>
29
29
 
30
- <script>
30
+ <script setup lang="ts">
31
31
  import { animate } from 'animejs'
32
-
33
- import { Intent } from '@/utils/constants'
34
- import { randomString } from '@/helpers'
32
+ import { ref, computed, watch, onBeforeMount, onMounted, nextTick, getCurrentInstance } from 'vue'
35
33
 
36
34
  import CpHeading from '@/components/typography/CpHeading.vue'
37
35
  import CpIcon from '@/components/visual/CpIcon.vue'
38
36
 
39
- export default {
40
- name: 'CpToaster',
41
- components: {
42
- CpHeading,
43
- CpIcon,
44
- },
45
- props: {
46
- title: {
47
- type: String,
48
- required: true,
49
- default: '',
50
- },
51
- description: {
52
- type: String,
53
- required: false,
54
- default: '',
55
- },
56
- type: {
57
- type: String,
58
- required: false,
59
- default: 'info',
60
- validator(value) {
61
- const intentValues = Object.values(Intent).map((item) => item.value)
62
- return intentValues.includes(value)
63
- },
64
- },
65
- delayBeforeCloseInMs: {
66
- type: Number,
67
- required: false,
68
- default: 5000,
69
- },
70
- actionLabel: {
71
- type: String,
72
- required: false,
73
- default: '',
74
- },
75
- actionMethod: {
76
- type: Function,
77
- required: false,
78
- default: () => {},
79
- },
80
- isUnique: {
81
- type: Boolean,
82
- default: false,
83
- },
84
- },
85
- data() {
86
- return {
87
- toasterId: null,
88
- toastersContainer: null,
89
- isOpen: false,
90
- isHovered: false,
91
- deleteCountDown: this.delayBeforeCloseInMs,
92
- timeoutID: null,
93
- countDownInterval: null,
94
- publicProperties: ['closeToaster'],
37
+ import { HeadingLevels, Intent } from '@/constants'
38
+ import { randomString } from '@/helpers'
39
+
40
+ interface Props {
41
+ actionLabel?: string
42
+ actionMethod?: (vmProperties: Record<string, unknown>) => void
43
+ delayBeforeCloseInMs?: number
44
+ description?: string
45
+ isUnique?: boolean
46
+ title: string
47
+ type?: string
48
+ }
49
+
50
+ interface PublicMethods {
51
+ closeToaster: () => void
52
+ }
53
+
54
+ const props = withDefaults(defineProps<Props>(), {
55
+ description: '',
56
+ type: 'info',
57
+ delayBeforeCloseInMs: 5000,
58
+ actionLabel: '',
59
+ actionMethod: () => {},
60
+ isUnique: false,
61
+ })
62
+
63
+ const validateType = (value: string): boolean => {
64
+ const intentValues = Object.values(Intent).map((item) => item.value)
65
+ return intentValues.includes(value)
66
+ }
67
+
68
+ if (!validateType(props.type)) {
69
+ console.warn(`Type de toaster invalide: ${props.type}`)
70
+ }
71
+
72
+ const toasterId = ref<string>()
73
+ const toastersContainer = ref<HTMLElement | null>(null)
74
+ const isOpen = ref<boolean>(false)
75
+ const isHovered = ref<boolean>(false)
76
+ const deleteCountDown = ref<number>(props.delayBeforeCloseInMs)
77
+ const timeoutID = ref<ReturnType<typeof setTimeout>>()
78
+ const countDownInterval = ref<ReturnType<typeof setInterval>>()
79
+
80
+ const instance = getCurrentInstance()
81
+
82
+ const toasterIcon = computed(() => {
83
+ const intentValues = Object.values(Intent)
84
+ const intent = intentValues.find((intentItem) => intentItem.value === props.type)
85
+ return intent ? intent.icon : Intent.INFO.icon
86
+ })
87
+
88
+ const dynamicClass = computed(() => {
89
+ return `cpToaster--${props.type || Intent.INFO.value}`
90
+ })
91
+
92
+ watch(isHovered, (newValue: boolean) => {
93
+ if (!newValue) {
94
+ handleDeleteEvent()
95
+ } else {
96
+ cancelDelete()
97
+ }
98
+ })
99
+
100
+ const createContainer = (): void => {
101
+ toastersContainer.value = document.querySelector('.cpToaster__container')
102
+
103
+ if (toastersContainer.value) return
104
+
105
+ if (!toastersContainer.value) {
106
+ toastersContainer.value = document.createElement('section')
107
+ toastersContainer.value.className = 'cpToaster__container'
108
+ }
109
+ }
110
+
111
+ const setupContainer = (): void => {
112
+ if (toastersContainer.value) {
113
+ document.body.appendChild(toastersContainer.value)
114
+ }
115
+ }
116
+
117
+ const removeSiblings = (): void => {
118
+ if (!props.isUnique) return
119
+
120
+ const siblings = document.querySelectorAll('.cpToaster')
121
+ siblings.forEach(removeElement)
122
+ }
123
+
124
+ const setToasterId = (): void => {
125
+ toasterId.value = randomString()
126
+ }
127
+
128
+ const showToaster = (): void => {
129
+ isOpen.value = true
130
+
131
+ nextTick(() => {
132
+ if (toastersContainer.value && instance?.proxy?.$el) {
133
+ toastersContainer.value.insertAdjacentElement('afterbegin', instance.proxy.$el)
95
134
  }
96
- },
97
- computed: {
98
- toasterIcon() {
99
- const intentValues = Object.values(Intent)
100
- const intent = intentValues.find((intentItem) => intentItem.value === this.type)
101
- return intent ? intent.icon : Intent.INFO.icon
102
- },
103
- dynamicClass() {
104
- return `cpToaster--${this.type || Intent.INFO.value}`
105
- },
106
- },
107
- watch: {
108
- isHovered(newValue) {
109
- if (!newValue) {
110
- this.handleDeleteEvent()
111
- } else {
112
- this.cancelDelete()
113
- }
114
- },
115
- },
116
- beforeMount() {
117
- this.createContainer()
118
- this.setupContainer()
119
- this.removeSiblings()
120
- this.setToasterId()
121
- },
122
- mounted() {
123
- this.showToaster()
124
- this.handleDeleteEvent()
125
- },
126
- methods: {
127
- createContainer() {
128
- this.toastersContainer = document.querySelector('.cpToaster__container')
129
-
130
- if (this.toastersContainer) return
131
-
132
- if (!this.toastersContainer) {
133
- this.toastersContainer = document.createElement('section')
134
- this.toastersContainer.className = 'cpToaster__container'
135
- }
136
- },
137
- setupContainer() {
138
- document.body.appendChild(this.toastersContainer)
139
- },
140
- removeSiblings() {
141
- if (!this.isUnique) return
135
+ })
136
+ }
142
137
 
143
- const siblings = document.querySelectorAll('.cpToaster')
144
- siblings.forEach(this.removeElement)
145
- },
146
- setToasterId() {
147
- this.toasterId = randomString()
148
- },
149
- showToaster() {
150
- this.isOpen = true
138
+ const setHoverState = (state: boolean = true): void => {
139
+ isHovered.value = state
140
+ }
151
141
 
152
- this.$nextTick(() => {
153
- this.toastersContainer.insertAdjacentElement('afterbegin', this.$el)
154
- })
155
- },
156
- setHoverState(state = true) {
157
- this.isHovered = state
158
- },
159
- handleDeleteEvent() {
160
- this.startCountDown()
142
+ const handleDeleteEvent = (): void => {
143
+ startCountDown()
161
144
 
162
- this.timeoutID = setTimeout(() => {
163
- this.closeToaster()
164
- }, this.delayBeforeCloseInMs)
165
- },
166
- cancelDelete() {
167
- clearTimeout(this.timeoutID)
168
- clearInterval(this.countDownInterval)
169
- this.resetCountDown()
170
- },
171
- startCountDown() {
172
- this.countDownInterval = setInterval(() => {
173
- this.deleteCountDown -= 1000
174
- if (this.deleteCountDown <= 0) {
175
- clearInterval(this.countDownInterval)
176
- }
177
- }, 1000)
178
- },
179
- resetCountDown() {
180
- const delay = this.delayBeforeCloseInMs
181
- this.deleteCountDown = delay
182
- },
183
- handleActionMethod() {
184
- // Unexpected aliasing of 'this' to local variable @typescript-eslint/no-this-alias
185
- // eslint-disable-next-line
186
- const vm = this
187
- const vmProperties = Object.keys(vm)
188
- .filter((key) => this.publicProperties.includes(key))
189
- .reduce((allowedProperties, key) => {
190
- allowedProperties[key] = vm[key]
191
- return allowedProperties
192
- }, {})
193
- return this.actionMethod(vmProperties)
194
- },
195
- closeToaster() {
196
- this.cancelDelete()
197
- this.isOpen = false
145
+ timeoutID.value = setTimeout(() => {
146
+ closeToaster()
147
+ }, props.delayBeforeCloseInMs)
148
+ }
198
149
 
199
- setTimeout(() => {
200
- this.removeElement(this.$el)
201
- }, 240)
202
- },
203
- removeElement(el) {
204
- if (typeof el.remove !== 'undefined') {
205
- el.remove()
206
- } else {
207
- el.parentNode.removeChild(el)
208
- }
209
- },
210
- async enter(el, done) {
211
- animate(el, {
212
- translateY: [-60, 0],
213
- opacity: [0, 1],
214
- duration: 240,
215
- ease: 'cubicBezier(0.175, 0.885, 0.32, 1.175)',
216
- complete: function () {
217
- done()
218
- },
219
- })
150
+ const cancelDelete = (): void => {
151
+ if (timeoutID.value) {
152
+ clearTimeout(timeoutID.value)
153
+ }
154
+ if (countDownInterval.value) {
155
+ clearInterval(countDownInterval.value)
156
+ }
157
+ resetCountDown()
158
+ }
159
+
160
+ const startCountDown = (): void => {
161
+ countDownInterval.value = setInterval(() => {
162
+ deleteCountDown.value -= 1000
163
+ if (deleteCountDown.value <= 0 && countDownInterval.value) {
164
+ clearInterval(countDownInterval.value)
165
+ }
166
+ }, 1000)
167
+ }
168
+
169
+ const resetCountDown = (): void => {
170
+ deleteCountDown.value = props.delayBeforeCloseInMs
171
+ }
172
+
173
+ const handleActionMethod = (): void => {
174
+ const vmProperties: Record<string, unknown> = {
175
+ closeToaster,
176
+ }
177
+
178
+ return props.actionMethod(vmProperties)
179
+ }
180
+
181
+ const closeToaster = (): void => {
182
+ cancelDelete()
183
+ isOpen.value = false
184
+
185
+ setTimeout(() => {
186
+ if (instance?.proxy?.$el) {
187
+ removeElement(instance.proxy.$el)
188
+ }
189
+ }, 240)
190
+ }
191
+
192
+ const removeElement = (el: Element): void => {
193
+ if (typeof (el as HTMLElement).remove !== 'undefined') {
194
+ ;(el as HTMLElement).remove()
195
+ } else if (el.parentNode) {
196
+ el.parentNode.removeChild(el)
197
+ }
198
+ }
199
+
200
+ const enter = async (el: Element, done: () => void): Promise<void> => {
201
+ animate(el, {
202
+ translateY: [-60, 0],
203
+ opacity: [0, 1],
204
+ duration: 240,
205
+ ease: 'cubicBezier(0.175, 0.885, 0.32, 1.175)',
206
+ complete: function () {
207
+ done()
220
208
  },
221
- async leave(el, done) {
222
- animate(el, {
223
- scale: [1, 0.8],
224
- opacity: [1, 0],
225
- duration: 240,
226
- ease: 'cubicBezier(0.0, 0.0, 0.2, 1)',
227
- complete: function () {
228
- done()
229
- },
230
- })
209
+ })
210
+ }
211
+
212
+ const leave = async (el: Element, done: () => void): Promise<void> => {
213
+ animate(el, {
214
+ scale: [1, 0.8],
215
+ opacity: [1, 0],
216
+ duration: 240,
217
+ ease: 'cubicBezier(0.0, 0.0, 0.2, 1)',
218
+ complete: function () {
219
+ done()
231
220
  },
232
- },
221
+ })
233
222
  }
223
+
224
+ onBeforeMount(() => {
225
+ createContainer()
226
+ setupContainer()
227
+ removeSiblings()
228
+ setToasterId()
229
+ })
230
+
231
+ onMounted(() => {
232
+ showToaster()
233
+ handleDeleteEvent()
234
+ })
235
+
236
+ defineExpose<PublicMethods>({
237
+ closeToaster,
238
+ })
234
239
  </script>
235
240
 
236
241
  <style lang="scss">
@@ -4,45 +4,43 @@
4
4
  </transition>
5
5
  </template>
6
6
 
7
- <script>
8
- export default {
9
- methods: {
10
- afterEnter(element) {
11
- element.style.height = `auto`
12
- },
13
- enter(element) {
14
- const { width } = getComputedStyle(element)
7
+ <script setup lang="ts">
8
+ const afterEnter = (element: HTMLElement): void => {
9
+ element.style.height = `auto`
10
+ }
11
+
12
+ const enter = (element: HTMLElement): void => {
13
+ const { width } = getComputedStyle(element)
15
14
 
16
- element.style.width = width
17
- element.style.position = `absolute`
18
- element.style.visibility = `hidden`
19
- element.style.height = `auto`
15
+ element.style.width = width
16
+ element.style.position = `absolute`
17
+ element.style.visibility = `hidden`
18
+ element.style.height = `auto`
20
19
 
21
- const { height } = getComputedStyle(element)
20
+ const { height } = getComputedStyle(element)
22
21
 
23
- element.style.width = null
24
- element.style.position = null
25
- element.style.visibility = null
26
- element.style.height = 0
22
+ element.style.width = ''
23
+ element.style.position = ''
24
+ element.style.visibility = ''
25
+ element.style.height = '0'
26
+
27
+ // Force repaint to make sure the
28
+ // animation is triggered correctly.
29
+ requestAnimationFrame(() => {
30
+ element.style.height = height
31
+ })
32
+ }
27
33
 
28
- // Force repaint to make sure the
29
- // animation is triggered correctly.
30
- requestAnimationFrame(() => {
31
- element.style.height = height
32
- })
33
- },
34
- leave(element) {
35
- const { height } = getComputedStyle(element)
34
+ const leave = (element: HTMLElement): void => {
35
+ const { height } = getComputedStyle(element)
36
36
 
37
- element.style.height = height
37
+ element.style.height = height
38
38
 
39
- // Force repaint to make sure the
40
- // animation is triggered correctly.
41
- requestAnimationFrame(() => {
42
- element.style.height = 0
43
- })
44
- },
45
- },
39
+ // Force repaint to make sure the
40
+ // animation is triggered correctly.
41
+ requestAnimationFrame(() => {
42
+ element.style.height = '0'
43
+ })
46
44
  }
47
45
  </script>
48
46
 
@@ -19,8 +19,8 @@
19
19
  <use stroke="#C8C8D4" stroke-width="1.6" xlink:href="#path-1"></use>
20
20
  </g>
21
21
  <path
22
- d="M38,11.6666667 L0,11.6666667"
23
22
  id="Shape"
23
+ d="M38,11.6666667 L0,11.6666667"
24
24
  stroke="#C8C8D4"
25
25
  stroke-width="1.6"
26
26
  transform="translate(19.000000, 11.666667) scale(-1, 1) translate(-19.000000, -11.666667) "
@@ -1,74 +1,61 @@
1
+ import { vTooltip } from 'floating-vue'
1
2
  // PLUGINS
2
3
  import { vMaska } from 'maska/vue'
3
4
  import PrimeVue from 'primevue/config'
5
+ import { App } from 'vue'
6
+ import { BindOnceDirective } from 'vue-bind-once'
4
7
 
5
8
  // DIRECTIVES
6
9
  import ClickOutside from '../directives/ClickOutside'
7
- import { BindOnceDirective } from 'vue-bind-once'
8
- import { vTooltip } from 'floating-vue'
9
-
10
+ import CpCoreDatepicker from '../libs/CoreDatepicker.vue'
11
+ import CpAirlineLogo from './atomic-elements/CpAirlineLogo.vue'
10
12
  // COMPONENTS
11
13
  // Atomic elements
12
14
  import CpBadge from './atomic-elements/CpBadge.vue'
13
15
  import CpDialog from './atomic-elements/CpDialog.vue'
14
16
  import CpDialogWrapper from './atomic-elements/CpDialogWrapper.vue'
15
- import CpTooltip from './atomic-elements/CpTooltip.vue'
16
17
  import CpPartnerBadge from './atomic-elements/CpPartnerBadge.vue'
17
- import CpAirlineLogo from './atomic-elements/CpAirlineLogo.vue'
18
-
19
- // Typography
20
- import CpHeading from './typography/CpHeading.vue'
21
-
18
+ import CpTooltip from './atomic-elements/CpTooltip.vue'
22
19
  // Buttons
23
20
  import CpButton from './buttons/CpButton.vue'
24
-
21
+ import CpCalendar from './date-pickers/CpCalendar.vue'
25
22
  // Date pickers
26
23
  import CpDate from './date-pickers/CpDate.vue'
27
- import CpCoreDatepicker from '../libs/CoreDatepicker.vue'
28
24
  import CpDatepicker from './date-pickers/CpDatepicker.vue'
29
- import CpCalendar from './date-pickers/CpCalendar.vue'
30
-
31
- // Dropdown menus
32
-
33
25
  // Feedback indicators
34
26
  import CpAlert from './feedback-indicators/CpAlert.vue'
27
+ // Dropdown menus
35
28
  import CpLoader from './feedback-indicators/CpLoader.vue'
36
29
  import CpToaster from './feedback-indicators/CpToaster.vue'
37
-
30
+ // Helpers and Utilities
31
+ import TransitionExpand from './helpers-utilities/TransitionExpand.vue'
32
+ import IconAirline from './icons/IconAirline.vue'
33
+ import IconCheckList from './icons/IconCheckList.vue'
34
+ import IconCollapse from './icons/IconCollapse.vue'
35
+ import IconExpand from './icons/IconExpand.vue'
36
+ import IconGroupBy from './icons/IconGroupBy.vue'
37
+ import IconOta from './icons/IconOta.vue'
38
+ import IconSupplier from './icons/IconSupplier.vue'
39
+ import IconThirdParty from './icons/IconThirdParty.vue'
40
+ // Icons
41
+ import IconTooltip from './icons/IconTooltip.vue'
38
42
  // Inputs
39
43
  import CpInput from './inputs/CpInput.vue'
40
44
  import CpTextarea from './inputs/CpTextarea.vue'
41
-
45
+ // List and Tables
46
+ import CpTable from './lists-and-table/CpTable.vue'
47
+ import CpMultiselect from './selects/CpMultiselect.vue'
42
48
  // Selects
43
49
  import CpSelect from './selects/CpSelect.vue'
44
50
  import CpSelectMenu from './selects/CpSelectMenu.vue'
45
- import CpMultiselect from './selects/CpMultiselect.vue'
46
-
47
51
  // Toggles
48
52
  import CpCheckbox from './toggles/CpCheckbox.vue'
49
53
  import CpRadio from './toggles/CpRadio.vue'
50
54
  import CpSwitch from './toggles/CpSwitch.vue'
51
-
52
- // List and Tables
53
- import CpTable from './lists-and-table/CpTable.vue'
54
-
55
+ // Typography
56
+ import CpHeading from './typography/CpHeading.vue'
55
57
  // Visual
56
58
  import CpIcon from './visual/CpIcon.vue'
57
-
58
- // Icons
59
- import IconTooltip from './icons/IconTooltip.vue'
60
- import IconAirline from './icons/IconAirline.vue'
61
- import IconOta from './icons/IconOta.vue'
62
- import IconSupplier from './icons/IconSupplier.vue'
63
- import IconThirdParty from './icons/IconThirdParty.vue'
64
- import IconGroupBy from './icons/IconGroupBy.vue'
65
- import IconCollapse from './icons/IconCollapse.vue'
66
- import IconExpand from './icons/IconExpand.vue'
67
- import IconCheckList from './icons/IconCheckList.vue'
68
-
69
- // Helpers and Utilities
70
- import TransitionExpand from './helpers-utilities/TransitionExpand.vue'
71
-
72
59
  // Methods
73
60
  import createToaster from '@/plugins/toaster'
74
61
 
@@ -111,11 +98,11 @@ const Components = {
111
98
  }
112
99
 
113
100
  const Pimp = {
114
- install(app, options) {
101
+ install(app: App, options: Record<string, unknown>) {
115
102
  app.use(PrimeVue, { unstyled: true })
116
103
 
117
104
  Object.keys(Components).forEach((name) => {
118
- app.component(name, Components[name])
105
+ app.component(name, Components[name as keyof typeof Components])
119
106
  })
120
107
 
121
108
  // Directives
@@ -126,6 +113,7 @@ const Pimp = {
126
113
 
127
114
  // CpToaster
128
115
  const methods = createToaster(options)
116
+ // @ts-expect-error <comment on type error>
129
117
  app.$toaster = methods
130
118
  app.config.globalProperties.$toaster = methods
131
119
  },