@citizenplane/pimp 8.26.1 → 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 (149) hide show
  1. package/dist/{IconAccompaniedMinorEach-CUq3oXbX.js → IconAccompaniedMinorEach-BJYaPpW3.js} +1 -1
  2. package/dist/{IconAccompaniedMinorNone-nZ4eSfTj.js → IconAccompaniedMinorNone-D1JR2Qpd.js} +1 -1
  3. package/dist/{IconAccompaniedMinorOne-CDMqq14b.js → IconAccompaniedMinorOne-BJ3jzEDZ.js} +1 -1
  4. package/dist/{IconAddReceipt-DRpGiWBU.js → IconAddReceipt-BX_va94f.js} +1 -1
  5. package/dist/{IconAirportTerminal-8k-3lKjb.js → IconAirportTerminal-Dzr98nfc.js} +1 -1
  6. package/dist/{IconArrival-m6HnOVje.js → IconArrival-Ced9HrJH.js} +1 -1
  7. package/dist/{IconBroadcast-B13UworG.js → IconBroadcast-BYX44Wak.js} +1 -1
  8. package/dist/{IconCabinBag-CNnzHz2B.js → IconCabinBag-D1Qs952U.js} +1 -1
  9. package/dist/{IconCheckedBaggage-CkxUDHe9.js → IconCheckedBaggage-Q4_SQL9l.js} +1 -1
  10. package/dist/{IconCheckedBaggage20-DEtphLSa.js → IconCheckedBaggage20-DVH1-A0V.js} +1 -1
  11. package/dist/{IconCheckedBaggage30-CmAddx5h.js → IconCheckedBaggage30-DYOAf-7Z.js} +1 -1
  12. package/dist/{IconChild-OReHyUco.js → IconChild-BeCLAr8Y.js} +1 -1
  13. package/dist/{IconContact-D2N23RZ5.js → IconContact-B3r39fyI.js} +1 -1
  14. package/dist/{IconDeparture-D10LaXRX.js → IconDeparture-BflKZUiE.js} +1 -1
  15. package/dist/{IconDistribution-SpPiru9I.js → IconDistribution-CBxQ7UWb.js} +1 -1
  16. package/dist/{IconDistributionClosed-Bzqe7nju.js → IconDistributionClosed-BWp_k24K.js} +1 -1
  17. package/dist/{IconDistributionExclusivePair-CjPM-_R1.js → IconDistributionExclusivePair-erLbcLps.js} +1 -1
  18. package/dist/{IconDistributionSided-DehjCN0D.js → IconDistributionSided-y000n4qB.js} +1 -1
  19. package/dist/{IconDistributionSupplySided-DWCyXqd1.js → IconDistributionSupplySided-7kCvGwnz.js} +1 -1
  20. package/dist/{IconDynamicContent-BvzbgXvW.js → IconDynamicContent-SwBxkPMB.js} +1 -1
  21. package/dist/{IconFares-zARDpPNl.js → IconFares-DTm0Q_RI.js} +1 -1
  22. package/dist/{IconFaresOutlined-DLFV8nwg.js → IconFaresOutlined-BFMo_x9Q.js} +1 -1
  23. package/dist/{IconFemale-Ba4uoI-S.js → IconFemale-Ma0KeaEM.js} +1 -1
  24. package/dist/{IconFindConversation-d0pP3wG9.js → IconFindConversation-CpsDYPgD.js} +1 -1
  25. package/dist/{IconFire-CXzWKoMB.js → IconFire-DECrDnLM.js} +1 -1
  26. package/dist/{IconFlight-Cof8M5dO.js → IconFlight-D5M0A0CM.js} +1 -1
  27. package/dist/{IconFlightReturn-CA9iGMcW.js → IconFlightReturn-CTvqEFME.js} +1 -1
  28. package/dist/{IconHandHeart-CCLKnMOm.js → IconHandHeart-ChgdfXQa.js} +1 -1
  29. package/dist/{IconHistory-DI6WD_3J.js → IconHistory-DpIXDYI5.js} +1 -1
  30. package/dist/{IconHourGlass-BorNLEca.js → IconHourGlass-CIRkFUSM.js} +1 -1
  31. package/dist/{IconIdCard-DhbhBkul.js → IconIdCard-UD5VZsUi.js} +1 -1
  32. package/dist/{IconInfant-D4EztT9g.js → IconInfant-CmLUvWpO.js} +1 -1
  33. package/dist/{IconItinerary-Bhj_lgG2.js → IconItinerary-CY8irele.js} +1 -1
  34. package/dist/{IconLeave-BvpY7gdD.js → IconLeave-C3bpPz6L.js} +1 -1
  35. package/dist/{IconMale-RMd_9ZSg.js → IconMale-x4xdulWB.js} +1 -1
  36. package/dist/{IconMultiSegments-DROUj0t5.js → IconMultiSegments-BhTMfvhQ.js} +1 -1
  37. package/dist/{IconNoPassport-DBmaQH_g.js → IconNoPassport-_Xm76k6b.js} +1 -1
  38. package/dist/{IconNoRefund-yNAZr7uX.js → IconNoRefund-B78s0oyF.js} +1 -1
  39. package/dist/{IconNotion-CpZhGILz.js → IconNotion-C22PTLTU.js} +1 -1
  40. package/dist/{IconOffline-Bf1mw_1N.js → IconOffline-BDzikWE9.js} +1 -1
  41. package/dist/{IconOneWay-6oGoLo57.js → IconOneWay-DlTVxokv.js} +2 -2
  42. package/dist/{IconPaid-B3dvioAR.js → IconPaid-DmGERe85.js} +1 -1
  43. package/dist/{IconPassport-5SwUf6_R.js → IconPassport-6VOlXjxJ.js} +1 -1
  44. package/dist/{IconPayout-b3TcXwjA.js → IconPayout-abr6BXCd.js} +1 -1
  45. package/dist/{IconReceipt-Dh454941.js → IconReceipt-BnTaihcq.js} +1 -1
  46. package/dist/{IconRecurrence-CXVkBJ3i.js → IconRecurrence-C5TPG2ht.js} +1 -1
  47. package/dist/{IconRefund-D-FNjukU.js → IconRefund-Ysv8pyMJ.js} +1 -1
  48. package/dist/{IconRoundTrip-BqVPrNwg.js → IconRoundTrip-CIVDw8LK.js} +1 -1
  49. package/dist/{IconRouteNoStop-CZ_QeOIY.js → IconRouteNoStop-DQrq4gW5.js} +1 -1
  50. package/dist/{IconRouteOneStop-DGpLAQmQ.js → IconRouteOneStop-pzisj4i4.js} +1 -1
  51. package/dist/{IconScheduleChange-CEIGEhU4.js → IconScheduleChange-BONs1AAT.js} +1 -1
  52. package/dist/{IconSeatEmpty-BwyVwYQZ.js → IconSeatEmpty-CHij3aGA.js} +1 -1
  53. package/dist/{IconSeatSold-B_SNoTs-.js → IconSeatSold-QspS_zCh.js} +1 -1
  54. package/dist/{IconSeatTotal-DUEF7k6I.js → IconSeatTotal-DTZ1TcAX.js} +1 -1
  55. package/dist/{IconTemplate-D1ACYaHI.js → IconTemplate-BDmmr-9L.js} +1 -1
  56. package/dist/{IconTicket-5Z4b83BP.js → IconTicket--vVn61Ey.js} +1 -1
  57. package/dist/{IconTimer-DbcddAPo.js → IconTimer-CspKpwqZ.js} +1 -1
  58. package/dist/{IconTrafficControl-CEzhRpZt.js → IconTrafficControl-DBamcJNe.js} +1 -1
  59. package/dist/{index-DbgX3-2I.js → index-C3oHnZQk.js} +9166 -10083
  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 +27 -44
  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 +159 -113
  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/CpCheckbox.stories.ts +3 -1
  115. package/src/stories/CpDate.stories.ts +3 -1
  116. package/src/stories/CpDatepicker.stories.ts +3 -1
  117. package/src/stories/CpDialog.stories.ts +2 -1
  118. package/src/stories/CpHeading.stories.ts +1 -0
  119. package/src/stories/CpIcon.stories.ts +2 -0
  120. package/src/stories/CpInput.stories.ts +3 -1
  121. package/src/stories/CpLoader.stories.ts +1 -0
  122. package/src/stories/CpMultiselect.stories.ts +2 -1
  123. package/src/stories/CpPartnerBadge.stories.ts +1 -1
  124. package/src/stories/CpRadio.stories.ts +3 -1
  125. package/src/stories/CpSelect.stories.ts +3 -1
  126. package/src/stories/CpSelectMenu.stories.ts +3 -1
  127. package/src/stories/CpSwitch.stories.ts +3 -1
  128. package/src/stories/CpTable.stories.ts +8 -1
  129. package/src/stories/CpTableEmptyState.stories.ts +1 -0
  130. package/src/stories/CpTextarea.stories.ts +3 -1
  131. package/src/stories/CpToaster.stories.ts +1 -0
  132. package/src/stories/CpTooltip.stories.ts +1 -0
  133. package/src/stories/TransitionExpand.stories.ts +3 -1
  134. package/src/types/luxon.d.ts +1 -0
  135. package/src/vendors/ff-polyfill.ts +38 -0
  136. package/vitest.workspace.js +1 -3
  137. package/src/constants/src/CpTableConfig.ts +0 -14
  138. package/src/constants/src/Position.ts +0 -10
  139. package/src/constants/src/colors/Colors.ts +0 -10
  140. package/src/constants/src/colors/ToggleColors.ts +0 -6
  141. package/src/directives/ClickOutside.js +0 -13
  142. package/src/helpers/object.js +0 -9
  143. package/src/helpers/string/src/camelize.js +0 -6
  144. package/src/plugins/toaster.js +0 -61
  145. package/src/utils/constants/index.js +0 -3
  146. package/src/utils/constants/src/PartnerTypes.js +0 -6
  147. package/src/utils/constants/src/Sizes.js +0 -5
  148. package/src/vendors/ff-polyfill.js +0 -36
  149. /package/src/helpers/string/{index.js → index.ts} +0 -0
@@ -52,232 +52,222 @@
52
52
  </div>
53
53
  </template>
54
54
 
55
- <script>
55
+ <script setup lang="ts">
56
56
  import { Info, DateTime } from 'luxon'
57
+ import { ref, computed, watch } from 'vue'
57
58
 
58
59
  import { randomString, capitalizeFirstLetter } from '@/helpers'
59
60
 
60
61
  const HUMAN_MAX_AGE = 120
61
62
 
62
- export default {
63
- props: {
64
- modelValue: {
65
- type: [String, Date],
66
- default: '',
67
- },
68
- minDate: {
69
- type: [String, Date],
70
- default: DateTime.now().minus({ year: HUMAN_MAX_AGE }).toISO(),
71
- },
72
- maxDate: {
73
- type: [String, Date],
74
- default: DateTime.now().toISO(),
75
- },
76
- label: {
77
- type: String,
78
- default: '',
79
- },
80
- required: {
81
- type: Boolean,
82
- default: false,
83
- },
84
- disabled: {
85
- type: Boolean,
86
- default: false,
87
- },
88
- isInvalid: {
89
- type: Boolean,
90
- default: false,
91
- },
92
- errorMessage: {
93
- type: String,
94
- default: '',
95
- },
96
- displayErrorMessage: {
97
- type: Boolean,
98
- default: true,
99
- },
100
- autocompleteBirthday: {
101
- type: Boolean,
102
- default: false,
103
- },
104
- locale: {
105
- type: String,
106
- default: () => {
107
- return navigator.language
108
- },
109
- },
110
- inputsOptions: {
111
- type: Object,
112
- default: () => {},
113
- },
114
- },
115
- emits: ['update:modelValue', 'on-validation'],
116
- data() {
63
+ interface InputsOptions {
64
+ dayInputPlaceholder?: string
65
+ monthInputPlaceholder?: string
66
+ yearInputPlaceholder?: string
67
+ }
68
+
69
+ interface Props {
70
+ autocompleteBirthday?: boolean
71
+ disabled?: boolean
72
+ displayErrorMessage?: boolean
73
+ errorMessage?: string
74
+ inputsOptions?: InputsOptions
75
+ isInvalid?: boolean
76
+ label?: string
77
+ locale?: string
78
+ maxDate?: string | Date
79
+ minDate?: string | Date
80
+ modelValue?: string | Date
81
+ required?: boolean
82
+ }
83
+
84
+ interface Emits {
85
+ (e: 'update:modelValue', value: string): void
86
+ (e: 'on-validation', value: boolean): void
87
+ }
88
+
89
+ const props = withDefaults(defineProps<Props>(), {
90
+ modelValue: '',
91
+ minDate: () => DateTime.now().minus({ year: HUMAN_MAX_AGE }).toISO(),
92
+ maxDate: () => DateTime.now().toISO(),
93
+ label: '',
94
+ required: false,
95
+ disabled: false,
96
+ isInvalid: false,
97
+ errorMessage: '',
98
+ displayErrorMessage: true,
99
+ autocompleteBirthday: false,
100
+ locale: () => navigator.language,
101
+ inputsOptions: () => ({}),
102
+ })
103
+
104
+ const emit = defineEmits<Emits>()
105
+
106
+ const initDateToken = (token: 'day' | 'month' | 'year'): string => {
107
+ if (DateTime.fromISO(props.modelValue).invalid) return ''
108
+
109
+ return DateTime.fromISO(props.modelValue)[token]
110
+ }
111
+
112
+ const day = ref(initDateToken('day'))
113
+ const month = ref(initDateToken('month'))
114
+ const year = ref(initDateToken('year'))
115
+
116
+ const capitalizedLabel = computed(() => capitalizeFirstLetter(props.label))
117
+
118
+ const cpDateId = computed(() => randomString())
119
+
120
+ const minYear = computed(() => isoMinDate.value.year)
121
+
122
+ const maxYear = computed(() => isoMaxDate.value.year)
123
+
124
+ const monthMaxDay = computed(() => {
125
+ const date = DateTime.fromObject({
126
+ year: year.value && year.value.length <= 4 ? Number(year.value) : DateTime.now().year,
127
+ month: month.value ? Number(month.value) : DateTime.now().month,
128
+ day: 1,
129
+ })
130
+
131
+ return date.daysInMonth
132
+ })
133
+
134
+ const months = computed(() => {
135
+ const rawLocalizedMonths = Info.months('long', { locale: props.locale })
136
+
137
+ return rawLocalizedMonths.map((month: string, index: number) => {
117
138
  return {
118
- day: this.initDateToken('day'),
119
- month: this.initDateToken('month'),
120
- year: this.initDateToken('year'),
139
+ label: capitalizeFirstLetter(month),
140
+ value: index + 1,
121
141
  }
122
- },
123
- computed: {
124
- capitalizedLabel() {
125
- return capitalizeFirstLetter(this.label)
126
- },
127
- cpDateId() {
128
- return randomString()
129
- },
130
- minYear() {
131
- return this.isoMinDate.year
132
- },
133
- maxYear() {
134
- return this.isoMaxDate.year
135
- },
136
- monthMaxDay() {
137
- const date = DateTime.fromObject({
138
- year: this.year && this.year.length <= 4 ? Number(this.year) : DateTime.now().year,
139
- month: this.month ? Number(this.month) : DateTime.now().month,
140
- day: 1,
141
- })
142
-
143
- return date.daysInMonth
144
- },
145
- months() {
146
- const rawLocalizedMonths = Info.months('long', { locale: this.locale })
147
-
148
- return rawLocalizedMonths.map((month, index) => {
149
- return {
150
- label: capitalizeFirstLetter(month),
151
- value: index + 1,
152
- }
153
- })
154
- },
155
- isoDate() {
156
- return DateTime.fromObject({
157
- year: Number(this.year),
158
- month: Number(this.month),
159
- day: Number(this.day),
160
- }).toISODate()
161
- },
162
- isoMinDate() {
163
- return DateTime.fromISO(this.minDate)
164
- },
165
- isoMaxDate() {
166
- return DateTime.fromISO(this.maxDate)
167
- },
168
- isDateAfterMinDate() {
169
- return this.isoDate >= this.isoMinDate.toISODate()
170
- },
171
- isDateBeforeMaxDate() {
172
- return this.isoDate <= this.isoMaxDate.toISODate()
173
- },
174
- areInputsEmpty() {
175
- return this.day === '' && this.month === '' && this.year === ''
176
- },
177
- isDateValid() {
178
- if (this.areInputsEmpty && !this.required) return true
179
-
180
- return (
181
- !this.isInvalid &&
182
- this.isDayValid &&
183
- this.isMonthValid &&
184
- this.isYearValid &&
185
- this.isDateBeforeMaxDate &&
186
- this.isDateAfterMinDate
187
- )
188
- },
189
- isDayValid() {
190
- return this.day >= 1 && this.day <= this.monthMaxDay
191
- },
192
- isMonthValid() {
193
- return !!this.month
194
- },
195
- isYearValid() {
196
- return this.year >= this.minYear && this.year <= this.maxYear
197
- },
198
- advancedErrorMessage() {
199
- if (this.isDateValid || !this.displayErrorMessage) return ''
200
-
201
- if (this.errorMessage) return this.errorMessage
202
-
203
- if (!this.isMonthValid) {
204
- return 'Month is required.'
205
- }
142
+ })
143
+ })
144
+
145
+ const isoDate = computed(() => {
146
+ return DateTime.fromObject({
147
+ year: Number(year.value),
148
+ month: Number(month.value),
149
+ day: Number(day.value),
150
+ }).toISODate()
151
+ })
152
+
153
+ const isoMinDate = computed(() => {
154
+ return DateTime.fromISO(props.minDate)
155
+ })
156
+
157
+ const isoMaxDate = computed(() => {
158
+ return DateTime.fromISO(props.maxDate)
159
+ })
160
+
161
+ const isDateAfterMinDate = computed(() => {
162
+ return isoDate.value >= isoMinDate.value.toISODate()
163
+ })
164
+
165
+ const isDateBeforeMaxDate = computed(() => {
166
+ return isoDate.value <= isoMaxDate.value.toISODate()
167
+ })
168
+
169
+ const areInputsEmpty = computed(() => {
170
+ return day.value === '' && month.value === '' && year.value === ''
171
+ })
172
+
173
+ const isDateValid = computed(() => {
174
+ if (areInputsEmpty.value && !props.required) return true
175
+
176
+ return (
177
+ !props.isInvalid &&
178
+ isDayValid.value &&
179
+ isMonthValid.value &&
180
+ isYearValid.value &&
181
+ isDateBeforeMaxDate.value &&
182
+ isDateAfterMinDate.value
183
+ )
184
+ })
185
+
186
+ const isDayValid = computed(() => {
187
+ return Number(day.value) >= 1 && Number(day.value) <= monthMaxDay.value
188
+ })
189
+
190
+ const isMonthValid = computed(() => {
191
+ return !!month.value
192
+ })
193
+
194
+ const isYearValid = computed(() => {
195
+ return Number(year.value) >= minYear.value && Number(year.value) <= maxYear.value
196
+ })
197
+
198
+ const advancedErrorMessage = computed(() => {
199
+ if (isDateValid.value || !props.displayErrorMessage) return ''
200
+
201
+ if (props.errorMessage) return props.errorMessage
202
+
203
+ if (!isMonthValid.value) {
204
+ return 'Month is required.'
205
+ }
206
206
 
207
- if (!this.isDayValid) {
208
- return `Day must be in the range 1 – ${this.monthMaxDay}.`
209
- }
207
+ if (!isDayValid.value) {
208
+ return `Day must be in the range 1 – ${monthMaxDay.value}.`
209
+ }
210
210
 
211
- if (!this.isYearValid) {
212
- return `Year must be in the range ${this.minYear} – ${this.maxYear}.`
213
- }
211
+ if (!isYearValid.value) {
212
+ return `Year must be in the range ${minYear.value} – ${maxYear.value}.`
213
+ }
214
214
 
215
- if (!this.isDateBeforeMaxDate) {
216
- const formattedMaxDate = this.isoMaxDate.toFormat('DDD')
217
- return `The date can't be after ${formattedMaxDate}.`
218
- }
215
+ if (!isDateBeforeMaxDate.value) {
216
+ const formattedMaxDate = isoMaxDate.value.toFormat('DDD')
217
+ return `The date can't be after ${formattedMaxDate}.`
218
+ }
219
219
 
220
- if (!this.isDateAfterMinDate) {
221
- const formattedMinDate = this.isoMinDate.toFormat('DDD')
222
- return `The date can't be before ${formattedMinDate}.`
223
- }
220
+ if (!isDateAfterMinDate.value) {
221
+ const formattedMinDate = isoMinDate.value.toFormat('DDD')
222
+ return `The date can't be before ${formattedMinDate}.`
223
+ }
224
224
 
225
- return ''
226
- },
227
- dynamicClasses() {
228
- return {
229
- 'cpDate--isInvalid': !this.isDateValid,
230
- 'cpDate--isDisabled': this.disabled,
231
- }
232
- },
233
- selectDynamicClass() {
234
- return {
235
- 'cpDate__month--isEmpty': !this.month,
236
- }
237
- },
238
- autocompleteFields() {
239
- if (!this.autocompleteBirthday) return 'off'
240
-
241
- return {
242
- day: 'bday-day',
243
- month: 'bday-month',
244
- year: 'bday-year',
245
- }
246
- },
247
- dayInputPlaceholder() {
248
- return this.inputsOptions?.dayInputPlaceholder || 'DD'
249
- },
250
- monthInputPlaceholder() {
251
- return this.inputsOptions?.monthInputPlaceholder || 'Months'
252
- },
253
- yearInputPlaceholder() {
254
- return this.inputsOptions?.yearInputPlaceholder || 'YYYY'
255
- },
256
- },
257
- watch: {
258
- day() {
259
- this.handleUpdate()
260
- },
261
- month() {
262
- this.handleUpdate()
263
- },
264
- year() {
265
- this.handleUpdate()
266
- },
267
- },
268
- methods: {
269
- initDateToken(token) {
270
- if (DateTime.fromISO(this.modelValue).invalid) return ''
271
-
272
- return DateTime.fromISO(this.modelValue)[token]
273
- },
274
- handleUpdate() {
275
- this.$emit('update:modelValue', this.isoDate)
276
-
277
- this.$emit('on-validation', this.isDateValid)
278
- },
279
- },
225
+ return ''
226
+ })
227
+
228
+ const dynamicClasses = computed(() => {
229
+ return {
230
+ 'cpDate--isInvalid': !isDateValid.value,
231
+ 'cpDate--isDisabled': props.disabled,
232
+ }
233
+ })
234
+
235
+ const selectDynamicClass = computed(() => {
236
+ return {
237
+ 'cpDate__month--isEmpty': !month.value,
238
+ }
239
+ })
240
+
241
+ const autocompleteFields = computed(() => {
242
+ if (!props.autocompleteBirthday) return 'off'
243
+
244
+ return {
245
+ day: 'bday-day',
246
+ month: 'bday-month',
247
+ year: 'bday-year',
248
+ }
249
+ })
250
+
251
+ const dayInputPlaceholder = computed(() => {
252
+ return props.inputsOptions?.dayInputPlaceholder || 'DD'
253
+ })
254
+
255
+ const monthInputPlaceholder = computed(() => {
256
+ return props.inputsOptions?.monthInputPlaceholder || 'Months'
257
+ })
258
+
259
+ const yearInputPlaceholder = computed(() => {
260
+ return props.inputsOptions?.yearInputPlaceholder || 'YYYY'
261
+ })
262
+
263
+ const handleUpdate = (): void => {
264
+ emit('update:modelValue', isoDate.value)
265
+ emit('on-validation', isDateValid.value)
280
266
  }
267
+
268
+ watch(day, handleUpdate)
269
+ watch(month, handleUpdate)
270
+ watch(year, handleUpdate)
281
271
  </script>
282
272
 
283
273
  <style lang="scss">