@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.
- package/dist/{IconAccompaniedMinorEach-DDeSlaA_.js → IconAccompaniedMinorEach-BJYaPpW3.js} +1 -1
- package/dist/{IconAccompaniedMinorNone-BKs1gk1K.js → IconAccompaniedMinorNone-D1JR2Qpd.js} +1 -1
- package/dist/{IconAccompaniedMinorOne-CpL8FNve.js → IconAccompaniedMinorOne-BJ3jzEDZ.js} +1 -1
- package/dist/{IconAddReceipt-DLH3pqjA.js → IconAddReceipt-BX_va94f.js} +1 -1
- package/dist/{IconAirportTerminal-Cc4CU6MC.js → IconAirportTerminal-Dzr98nfc.js} +1 -1
- package/dist/{IconArrival-CdtUsRVo.js → IconArrival-Ced9HrJH.js} +1 -1
- package/dist/{IconBroadcast-QjMZtFA9.js → IconBroadcast-BYX44Wak.js} +1 -1
- package/dist/{IconCabinBag-xVC6mOQF.js → IconCabinBag-D1Qs952U.js} +1 -1
- package/dist/{IconCheckedBaggage-I_1h49TJ.js → IconCheckedBaggage-Q4_SQL9l.js} +1 -1
- package/dist/{IconCheckedBaggage20-CyPcsqrn.js → IconCheckedBaggage20-DVH1-A0V.js} +1 -1
- package/dist/{IconCheckedBaggage30-s5htbUIA.js → IconCheckedBaggage30-DYOAf-7Z.js} +1 -1
- package/dist/{IconChild-DL43kbm1.js → IconChild-BeCLAr8Y.js} +1 -1
- package/dist/{IconContact-FdhTr03q.js → IconContact-B3r39fyI.js} +1 -1
- package/dist/{IconDeparture-DNR3OGPD.js → IconDeparture-BflKZUiE.js} +1 -1
- package/dist/{IconDistribution-Cl8L6177.js → IconDistribution-CBxQ7UWb.js} +1 -1
- package/dist/{IconDistributionClosed-DBT6wR78.js → IconDistributionClosed-BWp_k24K.js} +1 -1
- package/dist/{IconDistributionExclusivePair-CkRG6yNV.js → IconDistributionExclusivePair-erLbcLps.js} +1 -1
- package/dist/{IconDistributionSided-D_wdvDNf.js → IconDistributionSided-y000n4qB.js} +1 -1
- package/dist/{IconDistributionSupplySided-C3VcE8Dw.js → IconDistributionSupplySided-7kCvGwnz.js} +1 -1
- package/dist/{IconDynamicContent-Ct1HRd3s.js → IconDynamicContent-SwBxkPMB.js} +1 -1
- package/dist/{IconFares-dIGVrtE4.js → IconFares-DTm0Q_RI.js} +1 -1
- package/dist/{IconFaresOutlined-bd8kT44f.js → IconFaresOutlined-BFMo_x9Q.js} +1 -1
- package/dist/{IconFemale-CMeYHrDy.js → IconFemale-Ma0KeaEM.js} +1 -1
- package/dist/{IconFindConversation-BdN2Yd3R.js → IconFindConversation-CpsDYPgD.js} +1 -1
- package/dist/{IconFire-obwuluyJ.js → IconFire-DECrDnLM.js} +1 -1
- package/dist/{IconFlight-B_6tJxB3.js → IconFlight-D5M0A0CM.js} +1 -1
- package/dist/{IconFlightReturn-BEO97PwR.js → IconFlightReturn-CTvqEFME.js} +1 -1
- package/dist/{IconHandHeart-hs0yFSEL.js → IconHandHeart-ChgdfXQa.js} +1 -1
- package/dist/{IconHistory-CT-jOMRt.js → IconHistory-DpIXDYI5.js} +1 -1
- package/dist/{IconHourGlass-CF940vmy.js → IconHourGlass-CIRkFUSM.js} +1 -1
- package/dist/{IconIdCard-DKkU58Ix.js → IconIdCard-UD5VZsUi.js} +1 -1
- package/dist/{IconInfant-DIUT-6_4.js → IconInfant-CmLUvWpO.js} +1 -1
- package/dist/{IconItinerary-D7mOGUmj.js → IconItinerary-CY8irele.js} +1 -1
- package/dist/{IconLeave-BExl4uyV.js → IconLeave-C3bpPz6L.js} +1 -1
- package/dist/{IconMale-eHGH5XBz.js → IconMale-x4xdulWB.js} +1 -1
- package/dist/{IconMultiSegments-KkrKiZrK.js → IconMultiSegments-BhTMfvhQ.js} +1 -1
- package/dist/{IconNoPassport-PJ2QqqoI.js → IconNoPassport-_Xm76k6b.js} +1 -1
- package/dist/{IconNoRefund-W47AQisu.js → IconNoRefund-B78s0oyF.js} +1 -1
- package/dist/{IconNotion-CCnhatKK.js → IconNotion-C22PTLTU.js} +1 -1
- package/dist/{IconOffline-3wunTEJG.js → IconOffline-BDzikWE9.js} +1 -1
- package/dist/{IconOneWay-BQ5K41Bu.js → IconOneWay-DlTVxokv.js} +2 -2
- package/dist/{IconPaid-zwDwWzF8.js → IconPaid-DmGERe85.js} +1 -1
- package/dist/{IconPassport-IxhNLS8P.js → IconPassport-6VOlXjxJ.js} +1 -1
- package/dist/{IconPayout-BNSON3dj.js → IconPayout-abr6BXCd.js} +1 -1
- package/dist/{IconReceipt-DOosYtgi.js → IconReceipt-BnTaihcq.js} +1 -1
- package/dist/{IconRecurrence-B8i5kO2Q.js → IconRecurrence-C5TPG2ht.js} +1 -1
- package/dist/{IconRefund-DkjF9lEI.js → IconRefund-Ysv8pyMJ.js} +1 -1
- package/dist/{IconRoundTrip-BZvhS65z.js → IconRoundTrip-CIVDw8LK.js} +1 -1
- package/dist/{IconRouteNoStop-CeSlfnpx.js → IconRouteNoStop-DQrq4gW5.js} +1 -1
- package/dist/{IconRouteOneStop-aP1Mj-Bv.js → IconRouteOneStop-pzisj4i4.js} +1 -1
- package/dist/{IconScheduleChange-QQ4AMAMI.js → IconScheduleChange-BONs1AAT.js} +1 -1
- package/dist/{IconSeatEmpty-DgVBD165.js → IconSeatEmpty-CHij3aGA.js} +1 -1
- package/dist/{IconSeatSold-BGBwNZUa.js → IconSeatSold-QspS_zCh.js} +1 -1
- package/dist/{IconSeatTotal-Dq9uXccZ.js → IconSeatTotal-DTZ1TcAX.js} +1 -1
- package/dist/{IconTemplate-BgruEhjI.js → IconTemplate-BDmmr-9L.js} +1 -1
- package/dist/{IconTicket-BTaYnuPt.js → IconTicket--vVn61Ey.js} +1 -1
- package/dist/{IconTimer-CyJzne5T.js → IconTimer-CspKpwqZ.js} +1 -1
- package/dist/{IconTrafficControl-BeQtpwhK.js → IconTrafficControl-DBamcJNe.js} +1 -1
- package/dist/{index-B8RNa4cx.js → index-C3oHnZQk.js} +9152 -10064
- package/dist/pimp.es.js +1 -1
- package/dist/pimp.umd.js +17 -17
- package/dist/style.css +1 -1
- package/package.json +2 -1
- package/src/components/atomic-elements/CpAirlineLogo.vue +9 -10
- package/src/components/atomic-elements/CpBadge.vue +33 -41
- package/src/components/atomic-elements/CpDialog.vue +14 -9
- package/src/components/atomic-elements/CpPartnerBadge.vue +12 -20
- package/src/components/atomic-elements/CpTooltip.vue +12 -11
- package/src/components/buttons/CpButton.vue +63 -104
- package/src/components/core/BaseInputLabel.vue +9 -15
- package/src/components/core/BaseSelectClearButton.vue +1 -1
- package/src/components/date-pickers/CpCalendar.vue +154 -153
- package/src/components/date-pickers/CpDate.vue +202 -212
- package/src/components/date-pickers/CpDatepicker.vue +112 -138
- package/src/components/feedback-indicators/CpAlert.vue +16 -27
- package/src/components/feedback-indicators/CpLoader.vue +7 -8
- package/src/components/feedback-indicators/CpToaster.vue +197 -192
- package/src/components/helpers-utilities/TransitionExpand.vue +31 -33
- package/src/components/icons/IconOneWay.vue +1 -1
- package/src/components/index.ts +28 -40
- package/src/components/inputs/CpInput.vue +40 -57
- package/src/components/inputs/CpTextarea.vue +30 -50
- package/src/components/lists-and-table/CpTable.vue +165 -114
- package/src/components/lists-and-table/CpTableEmptyState.vue +5 -8
- package/src/components/selects/CpMultiselect.vue +58 -89
- package/src/components/selects/CpSelect.vue +70 -90
- package/src/components/selects/CpSelectMenu.vue +94 -96
- package/src/components/toggles/CpCheckbox.vue +45 -54
- package/src/components/toggles/CpRadio.vue +47 -58
- package/src/components/toggles/CpSwitch.vue +51 -67
- package/src/components/typography/CpHeading.vue +11 -31
- package/src/components/visual/CpIcon.vue +2 -1
- package/src/constants/{src/CpCustomIcons.ts → CpCustomIcons.ts} +1 -1
- package/src/constants/CpTableConfig.ts +12 -0
- package/src/constants/Heading.ts +8 -0
- package/src/{utils/constants/src/Intent.js → constants/Intent.ts} +1 -1
- package/src/constants/PartnerTypes.ts +6 -0
- package/src/constants/Position.ts +10 -0
- package/src/constants/Sizes.ts +5 -0
- package/src/constants/colors/Colors.ts +10 -0
- package/src/constants/colors/ToggleColors.ts +6 -0
- package/src/constants/index.ts +10 -5
- package/src/directives/ClickOutside.ts +17 -0
- package/src/directives/{ResizeSelect.js → ResizeSelect.ts} +3 -3
- package/src/helpers/{dom.js → dom.ts} +13 -9
- package/src/helpers/{index.js → index.ts} +13 -3
- package/src/helpers/object.ts +9 -0
- package/src/helpers/string/src/camelize.ts +6 -0
- package/src/helpers/string/src/{decamelize.js → decamelize.ts} +1 -1
- package/src/libs/CoreDatepicker.vue +4 -4
- package/src/plugins/toaster.ts +71 -0
- package/src/stories/BaseInputLabel.stories.ts +1 -0
- package/src/stories/CpAlert.stories.ts +1 -0
- package/src/stories/CpBadge.stories.ts +18 -0
- package/src/stories/CpCheckbox.stories.ts +3 -1
- package/src/stories/CpDate.stories.ts +3 -1
- package/src/stories/CpDatepicker.stories.ts +3 -1
- package/src/stories/CpDialog.stories.ts +2 -1
- package/src/stories/CpHeading.stories.ts +1 -0
- package/src/stories/CpIcon.stories.ts +2 -0
- package/src/stories/CpInput.stories.ts +3 -1
- package/src/stories/CpLoader.stories.ts +1 -0
- package/src/stories/CpMultiselect.stories.ts +2 -1
- package/src/stories/CpPartnerBadge.stories.ts +1 -1
- package/src/stories/CpRadio.stories.ts +3 -1
- package/src/stories/CpSelect.stories.ts +3 -1
- package/src/stories/CpSelectMenu.stories.ts +3 -1
- package/src/stories/CpSwitch.stories.ts +3 -1
- package/src/stories/CpTable.stories.ts +8 -1
- package/src/stories/CpTableEmptyState.stories.ts +1 -0
- package/src/stories/CpTextarea.stories.ts +3 -1
- package/src/stories/CpToaster.stories.ts +1 -0
- package/src/stories/CpTooltip.stories.ts +1 -0
- package/src/stories/TransitionExpand.stories.ts +3 -1
- package/src/types/luxon.d.ts +1 -0
- package/src/vendors/ff-polyfill.ts +38 -0
- package/vitest.workspace.js +1 -3
- package/src/constants/src/CpTableConfig.ts +0 -14
- package/src/constants/src/Position.ts +0 -10
- package/src/constants/src/colors/Colors.ts +0 -10
- package/src/constants/src/colors/ToggleColors.ts +0 -6
- package/src/directives/ClickOutside.js +0 -13
- package/src/helpers/object.js +0 -9
- package/src/helpers/string/src/camelize.js +0 -6
- package/src/plugins/toaster.js +0 -61
- package/src/utils/constants/index.js +0 -3
- package/src/utils/constants/src/PartnerTypes.js +0 -6
- package/src/utils/constants/src/Sizes.js +0 -5
- package/src/vendors/ff-polyfill.js +0 -36
- /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="
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
|
|
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
|
-
|
|
144
|
-
|
|
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
|
-
|
|
153
|
-
|
|
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
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
element.style.width = width
|
|
16
|
+
element.style.position = `absolute`
|
|
17
|
+
element.style.visibility = `hidden`
|
|
18
|
+
element.style.height = `auto`
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
const { height } = getComputedStyle(element)
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
29
|
-
|
|
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
|
-
|
|
37
|
+
element.style.height = height
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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) "
|
package/src/components/index.ts
CHANGED
|
@@ -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
|
|
8
|
-
import
|
|
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
|
|
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
|
-
|
|
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
|
},
|