@citizenplane/pimp 8.26.1 → 8.28.1

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 (187) hide show
  1. package/dist/{IconAccompaniedMinorEach-CUq3oXbX.js → IconAccompaniedMinorEach-MkIJAypb.js} +1 -1
  2. package/dist/{IconAccompaniedMinorNone-nZ4eSfTj.js → IconAccompaniedMinorNone-DMb-bSCG.js} +1 -1
  3. package/dist/{IconAccompaniedMinorOne-CDMqq14b.js → IconAccompaniedMinorOne-C9ORHm66.js} +1 -1
  4. package/dist/{IconAddReceipt-DRpGiWBU.js → IconAddReceipt-CeJlKuX2.js} +1 -1
  5. package/dist/{IconAirportTerminal-8k-3lKjb.js → IconAirportTerminal-D3p4CRpN.js} +1 -1
  6. package/dist/{IconArrival-m6HnOVje.js → IconArrival-C3oPAqgQ.js} +1 -1
  7. package/dist/IconBaggageCabinNone-valcCKfd.js +22 -0
  8. package/dist/IconBaggageCheckedNone-oq4yx5cO.js +22 -0
  9. package/dist/IconBaggagePersonalNone-BovIoK0M.js +20 -0
  10. package/dist/{IconBroadcast-B13UworG.js → IconBroadcast-CqdgVQaO.js} +1 -1
  11. package/dist/{IconCabinBag-CNnzHz2B.js → IconCabinBag-CMrtn-s6.js} +1 -1
  12. package/dist/IconCalendar-DmUZ-Du1.js +30 -0
  13. package/dist/IconCalendarDelay-DHaiharm.js +22 -0
  14. package/dist/{IconCheckedBaggage-CkxUDHe9.js → IconCheckedBaggage-OeOjHxe7.js} +1 -1
  15. package/dist/{IconCheckedBaggage20-DEtphLSa.js → IconCheckedBaggage20-CXeWuJgc.js} +1 -1
  16. package/dist/{IconCheckedBaggage30-CmAddx5h.js → IconCheckedBaggage30-Cartaaei.js} +1 -1
  17. package/dist/{IconChild-OReHyUco.js → IconChild-ChjkS7Gd.js} +1 -1
  18. package/dist/{IconContact-D2N23RZ5.js → IconContact-CtOxYQIs.js} +1 -1
  19. package/dist/{IconDeparture-D10LaXRX.js → IconDeparture-DJxClL94.js} +1 -1
  20. package/dist/{IconDistribution-SpPiru9I.js → IconDistribution-BmCLzb9p.js} +1 -1
  21. package/dist/{IconDistributionClosed-Bzqe7nju.js → IconDistributionClosed-BMjqoyt9.js} +1 -1
  22. package/dist/{IconDistributionExclusivePair-CjPM-_R1.js → IconDistributionExclusivePair-D71kgwyk.js} +1 -1
  23. package/dist/{IconDistributionSided-DehjCN0D.js → IconDistributionSided-Du56cPXR.js} +1 -1
  24. package/dist/{IconDistributionSupplySided-DWCyXqd1.js → IconDistributionSupplySided-BY9ACIGQ.js} +1 -1
  25. package/dist/{IconDynamicContent-BvzbgXvW.js → IconDynamicContent-DoYbB86x.js} +1 -1
  26. package/dist/IconEndDate-CVABdl-P.js +22 -0
  27. package/dist/{IconFares-zARDpPNl.js → IconFares-BXnx8WJa.js} +1 -1
  28. package/dist/{IconFaresOutlined-DLFV8nwg.js → IconFaresOutlined-CjJhZUKX.js} +1 -1
  29. package/dist/{IconFemale-Ba4uoI-S.js → IconFemale-D4lMoNKt.js} +1 -1
  30. package/dist/{IconFindConversation-d0pP3wG9.js → IconFindConversation-CYdB5hW8.js} +1 -1
  31. package/dist/{IconFire-CXzWKoMB.js → IconFire-Bh3vQ1A3.js} +1 -1
  32. package/dist/{IconFlight-Cof8M5dO.js → IconFlight-RyDIRwoI.js} +1 -1
  33. package/dist/{IconFlightReturn-CA9iGMcW.js → IconFlightReturn-DN7K5zxX.js} +1 -1
  34. package/dist/IconFlightSchedule-DAX_cnvF.js +28 -0
  35. package/dist/{IconHandHeart-CCLKnMOm.js → IconHandHeart-C5jxr29k.js} +1 -1
  36. package/dist/{IconHistory-DI6WD_3J.js → IconHistory-CuJwcjfY.js} +1 -1
  37. package/dist/{IconHourGlass-BorNLEca.js → IconHourGlass-DyrZPbXz.js} +1 -1
  38. package/dist/{IconIdCard-DhbhBkul.js → IconIdCard-lBDLYRPq.js} +1 -1
  39. package/dist/{IconInfant-D4EztT9g.js → IconInfant-E19ozPuk.js} +1 -1
  40. package/dist/{IconItinerary-Bhj_lgG2.js → IconItinerary-5AEG0f9f.js} +1 -1
  41. package/dist/{IconLeave-BvpY7gdD.js → IconLeave-XuFJRd-0.js} +1 -1
  42. package/dist/{IconMale-RMd_9ZSg.js → IconMale-R2ZgQj0s.js} +1 -1
  43. package/dist/{IconMultiSegments-DROUj0t5.js → IconMultiSegments-DfiqdUEm.js} +1 -1
  44. package/dist/IconNoPassport-h-6DjTcc.js +22 -0
  45. package/dist/{IconNoRefund-yNAZr7uX.js → IconNoRefund-C5R_Zxke.js} +1 -1
  46. package/dist/IconNoSeat-C-XnWQk8.js +23 -0
  47. package/dist/{IconNotion-CpZhGILz.js → IconNotion-pdx45QBU.js} +1 -1
  48. package/dist/{IconOffline-Bf1mw_1N.js → IconOffline-EG6mJ-Fs.js} +1 -1
  49. package/dist/{IconOneWay-6oGoLo57.js → IconOneWay-CX6CckSB.js} +2 -2
  50. package/dist/{IconPaid-B3dvioAR.js → IconPaid-BJhBGPy9.js} +1 -1
  51. package/dist/IconPassport-C6THdLYf.js +37 -0
  52. package/dist/{IconPayout-b3TcXwjA.js → IconPayout-MS-qRRR0.js} +1 -1
  53. package/dist/IconPlug-yYpQdJgj.js +22 -0
  54. package/dist/IconPlugOff-DSGcBog-.js +23 -0
  55. package/dist/{IconReceipt-Dh454941.js → IconReceipt-ChU6nBry.js} +1 -1
  56. package/dist/IconRecurrence-DtwCmoXo.js +22 -0
  57. package/dist/{IconRefund-D-FNjukU.js → IconRefund-D1wQXsZj.js} +1 -1
  58. package/dist/{IconRoundTrip-BqVPrNwg.js → IconRoundTrip-DhPU15r6.js} +1 -1
  59. package/dist/{IconRouteNoStop-CZ_QeOIY.js → IconRouteNoStop-C5b0NI9V.js} +1 -1
  60. package/dist/{IconRouteOneStop-DGpLAQmQ.js → IconRouteOneStop-CDL4AJoN.js} +1 -1
  61. package/dist/IconScheduleChange-CasvbB9p.js +22 -0
  62. package/dist/{IconSeatEmpty-BwyVwYQZ.js → IconSeatEmpty-CUDMQzqk.js} +1 -1
  63. package/dist/{IconSeatSold-B_SNoTs-.js → IconSeatSold-mwtkmlhT.js} +1 -1
  64. package/dist/{IconSeatTotal-DUEF7k6I.js → IconSeatTotal-BPegCOjA.js} +1 -1
  65. package/dist/IconStartDate-DoPJpEly.js +22 -0
  66. package/dist/{IconTemplate-D1ACYaHI.js → IconTemplate-CQH8r3U7.js} +1 -1
  67. package/dist/{IconTicket-5Z4b83BP.js → IconTicket-mONYGHBg.js} +1 -1
  68. package/dist/{IconTimer-DbcddAPo.js → IconTimer-BxR1ymxu.js} +1 -1
  69. package/dist/{IconTrafficControl-CEzhRpZt.js → IconTrafficControl-AcQHu-Dm.js} +1 -1
  70. package/dist/{index-DbgX3-2I.js → index-CjeXy6n3.js} +17600 -18506
  71. package/dist/pimp.es.js +1 -1
  72. package/dist/pimp.umd.js +23 -23
  73. package/dist/style.css +1 -1
  74. package/package.json +2 -1
  75. package/src/components/{core/BaseInputLabel.vue → BaseInputLabel.vue} +9 -15
  76. package/src/components/{core/BaseSelectClearButton.vue → BaseSelectClearButton.vue} +2 -2
  77. package/src/components/{atomic-elements/CpAirlineLogo.vue → CpAirlineLogo.vue} +9 -10
  78. package/src/components/{feedback-indicators/CpAlert.vue → CpAlert.vue} +16 -27
  79. package/src/components/{atomic-elements/CpBadge.vue → CpBadge.vue} +27 -44
  80. package/src/components/{buttons/CpButton.vue → CpButton.vue} +63 -104
  81. package/src/components/{date-pickers/CpCalendar.vue → CpCalendar.vue} +157 -156
  82. package/src/components/{toggles/CpCheckbox.vue → CpCheckbox.vue} +45 -54
  83. package/src/components/{date-pickers/CpDate.vue → CpDate.vue} +202 -212
  84. package/src/components/CpDatepicker.vue +203 -0
  85. package/src/components/{atomic-elements/CpDialog.vue → CpDialog.vue} +14 -9
  86. package/src/components/{typography/CpHeading.vue → CpHeading.vue} +11 -31
  87. package/src/components/{visual/CpIcon.vue → CpIcon.vue} +2 -1
  88. package/src/components/{inputs/CpInput.vue → CpInput.vue} +41 -58
  89. package/src/components/{feedback-indicators/CpLoader.vue → CpLoader.vue} +7 -8
  90. package/src/components/{selects/CpMultiselect.vue → CpMultiselect.vue} +60 -91
  91. package/src/components/{atomic-elements/CpPartnerBadge.vue → CpPartnerBadge.vue} +12 -20
  92. package/src/components/{toggles/CpRadio.vue → CpRadio.vue} +47 -58
  93. package/src/components/{selects/CpSelect.vue → CpSelect.vue} +74 -94
  94. package/src/components/{selects/CpSelectMenu.vue → CpSelectMenu.vue} +94 -96
  95. package/src/components/{toggles/CpSwitch.vue → CpSwitch.vue} +51 -67
  96. package/src/components/{lists-and-table/CpTable.vue → CpTable.vue} +159 -113
  97. package/src/components/{lists-and-table/CpTableEmptyState.vue → CpTableEmptyState.vue} +5 -8
  98. package/src/components/{inputs/CpTextarea.vue → CpTextarea.vue} +32 -52
  99. package/src/components/CpToaster.vue +377 -0
  100. package/src/components/{atomic-elements/CpTooltip.vue → CpTooltip.vue} +12 -11
  101. package/src/components/TransitionExpand.vue +70 -0
  102. package/src/components/icons/IconBaggageCabinNone.vue +24 -0
  103. package/src/components/icons/IconBaggageCheckedNone.vue +25 -0
  104. package/src/components/icons/IconBaggagePersonalNone.vue +33 -0
  105. package/src/components/icons/IconCalendar.vue +17 -0
  106. package/src/components/icons/IconCalendarDelay.vue +21 -0
  107. package/src/components/icons/IconEndDate.vue +19 -0
  108. package/src/components/icons/IconFlightSchedule.vue +23 -0
  109. package/src/components/icons/IconNoPassport.vue +23 -24
  110. package/src/components/icons/IconNoSeat.vue +18 -0
  111. package/src/components/icons/IconOneWay.vue +1 -1
  112. package/src/components/icons/IconPassport.vue +15 -22
  113. package/src/components/icons/IconPlug.vue +17 -0
  114. package/src/components/icons/IconPlugOff.vue +18 -0
  115. package/src/components/icons/IconRecurrence.vue +17 -8
  116. package/src/components/icons/IconScheduleChange.vue +17 -26
  117. package/src/components/icons/IconStartDate.vue +19 -0
  118. package/src/components/index.ts +43 -55
  119. package/src/constants/{src/CpCustomIcons.ts → CpCustomIcons.ts} +13 -2
  120. package/src/constants/CpTableConfig.ts +12 -0
  121. package/src/constants/Heading.ts +8 -0
  122. package/src/{utils/constants/src/Intent.js → constants/Intent.ts} +1 -1
  123. package/src/constants/PartnerTypes.ts +6 -0
  124. package/src/constants/Position.ts +10 -0
  125. package/src/constants/Sizes.ts +5 -0
  126. package/src/constants/colors/Colors.ts +10 -0
  127. package/src/constants/colors/ToggleColors.ts +6 -0
  128. package/src/constants/index.ts +10 -5
  129. package/src/directives/ClickOutside.ts +17 -0
  130. package/src/directives/{ResizeSelect.js → ResizeSelect.ts} +3 -3
  131. package/src/helpers/{dom.js → dom.ts} +13 -9
  132. package/src/helpers/{index.js → index.ts} +13 -3
  133. package/src/helpers/object.ts +9 -0
  134. package/src/helpers/string/src/camelize.ts +6 -0
  135. package/src/helpers/string/src/{decamelize.js → decamelize.ts} +1 -1
  136. package/src/libs/CoreDatepicker.vue +4 -4
  137. package/src/plugins/toaster.ts +71 -0
  138. package/src/stories/BaseInputLabel.stories.ts +2 -1
  139. package/src/stories/CpAirlineLogo.stories.ts +1 -1
  140. package/src/stories/CpAlert.stories.ts +2 -1
  141. package/src/stories/CpBadge.stories.ts +1 -1
  142. package/src/stories/CpButton.stories.ts +1 -1
  143. package/src/stories/CpCheckbox.stories.ts +4 -2
  144. package/src/stories/CpDate.stories.ts +4 -2
  145. package/src/stories/CpDatepicker.stories.ts +4 -2
  146. package/src/stories/CpDialog.stories.ts +3 -2
  147. package/src/stories/CpHeading.stories.ts +2 -1
  148. package/src/stories/CpIcon.stories.ts +3 -1
  149. package/src/stories/CpInput.stories.ts +4 -2
  150. package/src/stories/CpLoader.stories.ts +2 -1
  151. package/src/stories/CpMultiselect.stories.ts +3 -2
  152. package/src/stories/CpPartnerBadge.stories.ts +2 -2
  153. package/src/stories/CpRadio.stories.ts +4 -2
  154. package/src/stories/CpSelect.stories.ts +4 -2
  155. package/src/stories/CpSelectMenu.stories.ts +4 -2
  156. package/src/stories/CpSwitch.stories.ts +4 -2
  157. package/src/stories/CpTable.stories.ts +9 -2
  158. package/src/stories/CpTableEmptyState.stories.ts +2 -1
  159. package/src/stories/CpTextarea.stories.ts +4 -2
  160. package/src/stories/CpToaster.stories.ts +2 -1
  161. package/src/stories/CpTooltip.stories.ts +2 -1
  162. package/src/stories/TransitionExpand.stories.ts +4 -2
  163. package/src/types/luxon.d.ts +1 -0
  164. package/src/vendors/ff-polyfill.ts +38 -0
  165. package/vitest.workspace.js +1 -3
  166. package/dist/IconNoPassport-DBmaQH_g.js +0 -18
  167. package/dist/IconPassport-5SwUf6_R.js +0 -20
  168. package/dist/IconRecurrence-CXVkBJ3i.js +0 -24
  169. package/dist/IconScheduleChange-CEIGEhU4.js +0 -19
  170. package/src/components/date-pickers/CpDatepicker.vue +0 -229
  171. package/src/components/feedback-indicators/CpToaster.vue +0 -372
  172. package/src/components/helpers-utilities/TransitionExpand.vue +0 -72
  173. package/src/constants/src/CpTableConfig.ts +0 -14
  174. package/src/constants/src/Position.ts +0 -10
  175. package/src/constants/src/colors/Colors.ts +0 -10
  176. package/src/constants/src/colors/ToggleColors.ts +0 -6
  177. package/src/directives/ClickOutside.js +0 -13
  178. package/src/helpers/object.js +0 -9
  179. package/src/helpers/string/src/camelize.js +0 -6
  180. package/src/plugins/toaster.js +0 -61
  181. package/src/utils/constants/index.js +0 -3
  182. package/src/utils/constants/src/PartnerTypes.js +0 -6
  183. package/src/utils/constants/src/Sizes.js +0 -5
  184. package/src/vendors/ff-polyfill.js +0 -36
  185. /package/src/components/{atomic-elements/CpDialogWrapper.vue → CpDialogWrapper.vue} +0 -0
  186. /package/src/components/{logo/Pimp.vue → Pimp.vue} +0 -0
  187. /package/src/helpers/string/{index.js → index.ts} +0 -0
@@ -0,0 +1,377 @@
1
+ <template>
2
+ <transition @enter="enter" @leave="leave">
3
+ <div
4
+ v-show="isOpen"
5
+ :id="toasterId"
6
+ :key="toasterId"
7
+ class="cpToaster"
8
+ :class="dynamicClass"
9
+ role="alert"
10
+ @mouseenter="setHoverState()"
11
+ @mouseleave="setHoverState(false)"
12
+ >
13
+ <div class="cpToaster__content">
14
+ <cp-icon :type="toasterIcon" class="cpToaster__icon" />
15
+ <div class="cpToaster__body">
16
+ <cp-heading :heading-level="HeadingLevels.H4" :size="400" class="cpToaster__title">{{ title }}</cp-heading>
17
+ <p v-if="description" class="cpToaster__description">{{ description }}</p>
18
+ </div>
19
+ </div>
20
+ <button type="button" class="cpToaster__close" @click="closeToaster"><cp-icon type="x" /></button>
21
+ <div v-if="actionLabel" class="cpToaster__footer">
22
+ <button type="button" class="cpToaster__button" @click="handleActionMethod">
23
+ {{ actionLabel }}
24
+ </button>
25
+ </div>
26
+ </div>
27
+ </transition>
28
+ </template>
29
+
30
+ <script setup lang="ts">
31
+ import { animate } from 'animejs'
32
+ import { ref, computed, watch, onBeforeMount, onMounted, nextTick, getCurrentInstance } from 'vue'
33
+
34
+ import CpHeading from '@/components/CpHeading.vue'
35
+ import CpIcon from '@/components/CpIcon.vue'
36
+
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)
134
+ }
135
+ })
136
+ }
137
+
138
+ const setHoverState = (state: boolean = true): void => {
139
+ isHovered.value = state
140
+ }
141
+
142
+ const handleDeleteEvent = (): void => {
143
+ startCountDown()
144
+
145
+ timeoutID.value = setTimeout(() => {
146
+ closeToaster()
147
+ }, props.delayBeforeCloseInMs)
148
+ }
149
+
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()
208
+ },
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()
220
+ },
221
+ })
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
+ })
239
+ </script>
240
+
241
+ <style lang="scss">
242
+ @mixin cp-toaster-style($color, $className) {
243
+ &--#{$className} &__icon {
244
+ color: $color;
245
+ }
246
+
247
+ &--#{$className}:before {
248
+ background-color: $color;
249
+ }
250
+ }
251
+
252
+ .cpToaster {
253
+ position: relative;
254
+ box-shadow:
255
+ rgba(67, 90, 111, 0.3) 0 0 1px,
256
+ rgba(67, 90, 111, 0.47) 0 8px 10px -4px;
257
+ background: colors.$neutral-light;
258
+ padding: sp.$space-md;
259
+ overflow: hidden;
260
+ width: max-content;
261
+ max-width: 100%;
262
+ margin: auto;
263
+ pointer-events: auto;
264
+ font-size: fn.px-to-rem(14);
265
+
266
+ @media (min-width: 769px) {
267
+ border-radius: fn.px-to-rem(8);
268
+ }
269
+
270
+ @media (max-width: 768px) {
271
+ min-width: 100%;
272
+ }
273
+
274
+ &:before {
275
+ content: '';
276
+ position: absolute;
277
+ top: 0;
278
+ left: 0;
279
+ width: fn.px-to-rem(3);
280
+ height: 100%;
281
+ }
282
+
283
+ &__container {
284
+ position: fixed;
285
+ z-index: 9999;
286
+ top: 0;
287
+ left: 0;
288
+ right: 0;
289
+ margin: auto;
290
+ padding: sp.$space-lg;
291
+ max-width: fn.px-to-rem(400);
292
+ pointer-events: none;
293
+
294
+ & > *:not(:last-child) {
295
+ margin-bottom: sp.$space;
296
+ }
297
+
298
+ @media (max-width: 768px) {
299
+ max-width: 100%;
300
+ }
301
+ }
302
+
303
+ &__content {
304
+ display: flex;
305
+ align-items: flex-start;
306
+ }
307
+
308
+ &__body {
309
+ flex: 1;
310
+ margin-left: sp.$space;
311
+ padding-right: calc(sp.$space-lg + sp.$space-lg);
312
+ }
313
+
314
+ &__icon {
315
+ flex-shrink: 0;
316
+ height: fn.px-to-rem(16);
317
+ width: fn.px-to-rem(16);
318
+ }
319
+
320
+ &__content,
321
+ &__title {
322
+ line-height: fn.px-to-rem(16);
323
+ }
324
+
325
+ &__title {
326
+ font-weight: 600;
327
+
328
+ &:not(:only-child) {
329
+ margin-bottom: sp.$space-sm;
330
+ }
331
+ }
332
+
333
+ &__description {
334
+ font-size: fn.px-to-rem(14);
335
+ }
336
+
337
+ &__close {
338
+ position: absolute;
339
+ right: sp.$space;
340
+ top: sp.$space;
341
+ display: flex;
342
+ border-radius: fn.px-to-rem(4);
343
+ padding: sp.$space-sm;
344
+ color: colors.$neutral-dark-1;
345
+
346
+ svg {
347
+ margin: 0;
348
+ width: fn.px-to-rem(18);
349
+ height: fn.px-to-rem(18);
350
+ }
351
+
352
+ &:hover {
353
+ background-color: rgba(colors.$neutral-dark-1, 0.1);
354
+ }
355
+ }
356
+
357
+ &__footer {
358
+ display: flex;
359
+ justify-content: flex-end;
360
+ margin-top: sp.$space-lg;
361
+ }
362
+
363
+ &__button {
364
+ font-size: fn.px-to-rem(12);
365
+ color: colors.$secondary-color;
366
+
367
+ &:not(:hover) {
368
+ text-decoration: underline;
369
+ }
370
+ }
371
+
372
+ @include cp-toaster-style(colors.$secondary-color, 'info');
373
+ @include cp-toaster-style(colors.$warning-color, 'warning');
374
+ @include cp-toaster-style(colors.$success-color, 'success');
375
+ @include cp-toaster-style(colors.$error-color, 'critical');
376
+ }
377
+ </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <v-tooltip :aria-id="ariaId" popper-class="cpTooltip" :distance :container="false">
2
+ <v-tooltip :aria-id="ariaId" class="cpTooltip" :distance :container="false">
3
3
  <slot />
4
4
  <template #popper>
5
5
  <span v-if="content">
@@ -10,19 +10,18 @@
10
10
  </v-tooltip>
11
11
  </template>
12
12
 
13
- <script setup>
13
+ <script setup lang="ts">
14
14
  import { Tooltip as VTooltip } from 'floating-vue'
15
15
  import { useId } from 'vue'
16
16
 
17
- defineProps({
18
- content: {
19
- type: String,
20
- default: '',
21
- },
22
- distance: {
23
- type: Number,
24
- default: 8,
25
- },
17
+ interface Props {
18
+ content?: string
19
+ distance?: number
20
+ }
21
+
22
+ withDefaults(defineProps<Props>(), {
23
+ content: '',
24
+ distance: 8,
26
25
  })
27
26
 
28
27
  const ariaId = useId()
@@ -30,6 +29,8 @@ const ariaId = useId()
30
29
 
31
30
  <style lang="scss">
32
31
  .cpTooltip.v-popper--theme-tooltip {
32
+ display: inline-flex;
33
+
33
34
  .v-popper__inner {
34
35
  padding: sp.$space sp.$space-md;
35
36
  border-radius: fn.px-to-rem(8);
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <transition name="expand" @enter="enter" @after-enter="afterEnter" @leave="leave">
3
+ <slot />
4
+ </transition>
5
+ </template>
6
+
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)
14
+
15
+ element.style.width = width
16
+ element.style.position = `absolute`
17
+ element.style.visibility = `hidden`
18
+ element.style.height = `auto`
19
+
20
+ const { height } = getComputedStyle(element)
21
+
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
+ }
33
+
34
+ const leave = (element: HTMLElement): void => {
35
+ const { height } = getComputedStyle(element)
36
+
37
+ element.style.height = height
38
+
39
+ // Force repaint to make sure the
40
+ // animation is triggered correctly.
41
+ requestAnimationFrame(() => {
42
+ element.style.height = '0'
43
+ })
44
+ }
45
+ </script>
46
+
47
+ <style scoped>
48
+ * {
49
+ will-change: height;
50
+ transform: translateZ(0);
51
+ backface-visibility: hidden;
52
+ perspective: 1000px;
53
+ }
54
+ </style>
55
+
56
+ <style lang="scss">
57
+ .expand-enter-active,
58
+ .expand-leave-active {
59
+ transition-property: opacity, height;
60
+ transition-duration: 0.2s;
61
+ transition-timing-function: ease-out;
62
+ overflow: hidden;
63
+ }
64
+
65
+ .expand-enter-from,
66
+ .expand-leave-to {
67
+ height: 0;
68
+ opacity: 0;
69
+ }
70
+ </style>
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <svg
3
+ width="24"
4
+ height="24"
5
+ viewBox="0 0 24 24"
6
+ fill="none"
7
+ stroke="currentColor"
8
+ stroke-width="2"
9
+ stroke-linecap="round"
10
+ stroke-linejoin="round"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ >
13
+ <path
14
+ d="M15.8056 20.0955H8.18876C7.63648 20.0955 7.18876 19.6478 7.18876 19.0955V11.4758M9.80047 8.87244H11.4122H15.8056C16.3579 8.87244 16.8056 9.32015 16.8056 9.87244V16.219"
15
+ />
16
+ <path d="M14.4593 20.0955V21.051" />
17
+ <path d="M9.44919 20.0955V21.051" />
18
+ <path d="M13.4143 3L13.4143 8.80565" />
19
+ <path d="M10.58 3L10.58 8.80565" />
20
+ <path d="M3 3L21 21" />
21
+ <path d="M12.4378 12.1178H14.0499" />
22
+ <path d="M8.99997 3L14.9944 3" />
23
+ </svg>
24
+ </template>
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <svg
3
+ width="24"
4
+ height="24"
5
+ viewBox="0 0 24 24"
6
+ fill="none"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ stroke="currentColor"
9
+ stroke-width="2"
10
+ stroke-linecap="round"
11
+ stroke-linejoin="round"
12
+ >
13
+ <path
14
+ d="M17.631 17.5374V7.54905C17.631 6.87124 17.1064 6.32178 16.4593 6.32178H7.53504M6.36339 11.8682V18.8682C6.36339 19.546 6.88796 20.0955 7.53505 20.0955H11.9972L14.7447 20.0955"
15
+ />
16
+ <path d="M14.8912 20.0955V21.051" />
17
+ <path d="M9.10875 20.0955V21.051" />
18
+ <path d="M10.2928 15L10.2928 16.0056" />
19
+ <path d="M13.4143 3L13.4143 6" />
20
+ <path d="M10.5801 3L10.5801 6" />
21
+ <path d="M8.99996 3L14.9944 3" />
22
+ <path d="M2.99999 3L21 21" />
23
+ <path d="M13.7071 10.4117L13.7071 13.4147" />
24
+ </svg>
25
+ </template>
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <svg
3
+ width="24"
4
+ height="24"
5
+ viewBox="0 0 24 24"
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ fill="currentColor"
8
+ fill-rule="evenodd"
9
+ clip-rule="evenodd"
10
+ >
11
+ <path
12
+ d="M14.0343 6.9345C14.4899 7.45647 14.7131 8.09578 14.773 8.48765C14.8564 9.0336 15.3666 9.40855 15.9126 9.32512C16.4585 9.24169 16.8335 8.73148 16.7501 8.18554C16.6421 7.47892 16.284 6.47051 15.5411 5.61937C14.7711 4.73714 13.5973 4.04114 11.9625 4.04114C11.4102 4.04114 10.9625 4.48885 10.9625 5.04114C10.9625 5.59342 11.4102 6.04114 11.9625 6.04114C12.964 6.04114 13.6059 6.44362 14.0343 6.9345Z"
13
+ />
14
+ <path
15
+ d="M11.9625 6.04114C10.3168 6.04114 9.53709 7.17285 9.24483 8.10042C9.07885 8.62717 8.51729 8.91964 7.99053 8.75367C7.46378 8.58769 7.17131 8.02612 7.33728 7.49937C7.77121 6.12221 9.09963 4.04114 11.9625 4.04114C12.5148 4.04114 12.9625 4.48885 12.9625 5.04114C12.9625 5.59342 12.5148 6.04114 11.9625 6.04114Z"
16
+ />
17
+ <path
18
+ d="M16.6758 11.7963C16.6758 11.3821 16.34 11.0463 15.9258 11.0463L11.9625 11.0463C11.5483 11.0463 11.2125 11.3821 11.2125 11.7963C11.2125 12.2105 11.5483 12.5463 11.9625 12.5463L15.9258 12.5463C16.34 12.5463 16.6758 12.2105 16.6758 11.7963Z"
19
+ />
20
+ <path
21
+ d="M14.6224 11.5962C14.2082 11.5962 13.8724 11.932 13.8724 12.3462L13.8724 13.5055C13.8724 13.9197 14.2082 14.2555 14.6224 14.2555C15.0367 14.2555 15.3724 13.9197 15.3724 13.5055L15.3724 12.3462C15.3724 11.932 15.0367 11.5962 14.6224 11.5962Z"
22
+ />
23
+ <path
24
+ d="M18.3657 10.4998C18.3352 9.97078 17.8973 9.55737 17.3674 9.55737L9.20555 9.55737C8.65326 9.55737 8.20555 9.10966 8.20555 8.55737C8.20555 8.00509 8.65326 7.55737 9.20555 7.55737H17.3674C18.9572 7.55737 20.2709 8.79759 20.3624 10.3848L20.7609 17.2995C20.8375 18.6278 20.0399 19.7948 18.8794 20.2589L17.1135 18.4721H17.7659C18.3408 18.4721 18.7973 17.9885 18.7642 17.4146L18.3657 10.4998ZM3.62566 9.32591C3.65807 8.77458 4.13128 8.3539 4.68262 8.38631C5.23395 8.41872 5.65462 8.89193 5.62222 9.44327L5.16061 17.4148C5.12766 17.9886 5.58415 18.4721 6.15897 18.4721H14.7887C15.3409 18.4721 15.7887 18.9198 15.7887 19.4721C15.7887 20.0244 15.3409 20.4721 14.7887 20.4721H6.15897C4.43451 20.4721 3.06505 19.0217 3.1639 17.3001L3.45651 12.2038L3.62566 9.32591Z"
25
+ />
26
+ <path
27
+ d="M2.49956 2.56633C2.10903 2.95685 2.10903 3.59002 2.49956 3.98054L20.0488 21.5298C20.4393 21.9203 21.0724 21.9203 21.463 21.5298C21.8535 21.1392 21.8535 20.5061 21.463 20.1155L3.91377 2.56633C3.52325 2.17581 2.89008 2.17581 2.49956 2.56633Z"
28
+ />
29
+ <path
30
+ d="M7.25294 11.7849C7.25294 12.1899 7.58123 12.5182 7.9862 12.5182C8.39117 12.5182 8.71947 12.1899 8.71947 11.7849C8.71947 11.3799 8.39117 11.0516 7.9862 11.0516C7.58123 11.0516 7.25294 11.3799 7.25294 11.7849Z"
31
+ />
32
+ </svg>
33
+ </template>
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <svg
3
+ width="24"
4
+ height="24"
5
+ viewBox="0 0 24 24"
6
+ fill="none"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ stroke="currentColor"
9
+ stroke-width="2"
10
+ stroke-linecap="round"
11
+ >
12
+ <rect x="3.03387" y="5.4895" width="17.9328" height="15.4378" rx="2.52177" />
13
+ <path d="M6.88023 10.4016H16.9642" />
14
+ <path d="M7.03662 3.07251V7.3348" />
15
+ <path d="M16.9646 3.07251V7.3348" />
16
+ </svg>
17
+ </template>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <svg
3
+ width="24"
4
+ height="24"
5
+ viewBox="0 0 24 24"
6
+ fill="none"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ stroke="currentColor"
9
+ stroke-width="2"
10
+ stroke-linecap="round"
11
+ stroke-linejoin="round"
12
+ >
13
+ <path d="M7.01345 3V7.28155" />
14
+ <path d="M16.9868 3V7.28155" />
15
+ <path
16
+ d="M21.0073 8.7705V7.88929C21.0073 6.53001 19.9054 5.4281 18.5461 5.4281H5.45462C4.09534 5.4281 2.99343 6.53001 2.99343 7.88929V18.4744C2.99343 19.8337 4.09534 20.9356 5.45462 20.9356H8.44034"
17
+ />
18
+ <circle cx="15.6421" cy="15.8132" r="5.36444" />
19
+ <path d="M15.5908 14.2495V15.8384L17.2175 17.4651" />
20
+ </svg>
21
+ </template>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <svg
3
+ width="24"
4
+ height="24"
5
+ viewBox="0 0 24 24"
6
+ fill="none"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ stroke="currentColor"
9
+ stroke-width="2"
10
+ stroke-linecap="round"
11
+ stroke-linejoin="round"
12
+ >
13
+ <rect x="3.03387" y="5.4895" width="17.9328" height="15.4378" rx="2.52177" />
14
+ <path d="M7.03662 3.07251V7.3348" />
15
+ <path d="M16.9646 3.07251V7.3348" />
16
+ <path d="M16.7501 14.1487L9.17437 14.1487" />
17
+ <path d="M9.45959 16.321L7.25 14.1488L9.4596 11.9766" />
18
+ </svg>
19
+ </template>
@@ -0,0 +1,23 @@
1
+ <template>
2
+ <svg
3
+ width="24"
4
+ height="24"
5
+ viewBox="0 0 24 24"
6
+ fill="none"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ stroke="currentColor"
9
+ stroke-width="2"
10
+ stroke-linecap="round"
11
+ stroke-linejoin="round"
12
+ >
13
+ <path d="M7.01345 3V7.28155" />
14
+ <path d="M16.9868 3V7.28155" />
15
+ <path
16
+ d="M21.0073 8.7705V7.88929C21.0073 6.53001 19.9054 5.4281 18.5461 5.4281H5.45462C4.09534 5.4281 2.99343 6.53001 2.99343 7.88929V18.4744C2.99343 19.8337 4.09534 20.9356 5.45462 20.9356H8.44033"
17
+ />
18
+ <path
19
+ d="M16.4936 13.2807L18.4809 11.3159C18.9519 10.8502 19.7135 10.8523 20.1819 11.3207C20.6503 11.7891 20.6481 12.5464 20.1771 13.0121L18.1898 14.9769L18.8803 19.5107C18.914 19.7322 18.8395 19.9565 18.6797 20.1145L17.8727 20.9124C17.6984 21.0847 17.405 21.032 17.3023 20.8101L15.7283 17.4106L13.9295 19.189L14.0661 20.1562C14.0971 20.3754 14.0224 20.5964 13.8645 20.7525L13.2008 21.4086C13.0464 21.5613 12.7866 21.5163 12.6932 21.3208L11.8507 19.5578L10.0824 18.71C9.8863 18.616 9.84256 18.3574 9.99696 18.2048L10.6606 17.5486C10.8185 17.3925 11.0411 17.3195 11.2615 17.3515L12.2333 17.4928L14.0321 15.7144L10.6222 14.1301C10.3996 14.0266 10.3484 13.7346 10.5226 13.5623L11.3296 12.7644C11.4894 12.6064 11.7154 12.5336 11.938 12.5684L16.4936 13.2807Z"
20
+ fill="#3E3E5B"
21
+ />
22
+ </svg>
23
+ </template>