@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
@@ -25,155 +25,129 @@
25
25
  :locale="locale"
26
26
  class="cpDatepicker__datepicker"
27
27
  :class="{ 'cpDatepicker__datepicker--isInline': isInline }"
28
- @date-one-selected="(date) => selectDate('dateOne', date)"
29
- @date-two-selected="(date) => selectDate('dateTwo', date)"
28
+ @date-one-selected="onDateOneSelected"
29
+ @date-two-selected="onDateTwoSelected"
30
30
  @opened="() => (isDisabled = true)"
31
- @closed="() => (isDisabled = null)"
31
+ @closed="() => (isDisabled = false)"
32
32
  />
33
33
  </div>
34
34
  </template>
35
35
 
36
- <script>
37
- import CoreDatepicker from '@/libs/CoreDatepicker.vue'
36
+ <script setup lang="ts">
37
+ import { DateTime } from 'luxon'
38
+ import { ref, computed, watch } from 'vue'
39
+
38
40
  import CpInput from '@/components/inputs/CpInput.vue'
41
+
39
42
  import { randomString, formatDates } from '@/helpers'
40
- import { DateTime } from 'luxon'
43
+ import CoreDatepicker from '@/libs/CoreDatepicker.vue'
41
44
 
42
- export default {
43
- name: 'CpDatepicker',
44
- components: {
45
- CoreDatepicker,
46
- CpInput,
47
- },
48
- props: {
49
- triggerElementId: {
50
- type: String,
51
- default: '',
52
- },
53
- mode: {
54
- type: String,
55
- default: 'single',
56
- validator: (value) => {
57
- return ['range', 'single'].includes(value)
58
- },
59
- },
60
- closeAfterSelect: {
61
- type: Boolean,
62
- default: true,
63
- },
64
- label: {
65
- type: String,
66
- default: '',
67
- },
68
- placeholder: {
69
- type: String,
70
- default: 'Select a date',
71
- },
72
- inputValue: {
73
- type: String,
74
- default: '',
75
- },
76
- isError: {
77
- type: Boolean,
78
- default: false,
79
- },
80
- errorMessage: {
81
- type: String,
82
- default: '',
83
- },
84
- initDateOne: {
85
- type: String,
86
- default: '',
87
- validator: (value) => {
88
- return value === '' || value.length === 10
89
- },
90
- },
91
- initDateTwo: {
92
- type: String,
93
- default: '',
94
- validator: (value) => {
95
- return value === '' || value.length === 10
96
- },
97
- },
98
- minDate: {
99
- type: [String, Date],
100
- default: () => DateTime.local().toISODate(),
101
- },
102
- maxDate: {
103
- type: [String, Date],
104
- default: '',
105
- },
106
- allowPastDates: {
107
- type: Boolean,
108
- default: false,
109
- },
110
- isInline: {
111
- type: Boolean,
112
- default: false,
113
- },
114
- singleMonth: {
115
- type: Boolean,
116
- default: false,
117
- },
118
- locale: {
119
- type: String,
120
- default: () => {
121
- return navigator.language
122
- },
123
- },
124
- },
125
- emits: ['dates'],
126
- data() {
127
- return {
128
- calendarFormat: 'YYYY-MM-DD',
129
- humanFormat: 'EEE DD',
130
- dateOne: this.initDateOne || '',
131
- dateTwo: this.mode === 'range' ? this.initDateTwo : '',
132
- isDisabled: null,
133
- datePickerReferenceId: this.triggerElementId || randomString(),
45
+ type DatepickerMode = 'range' | 'single'
46
+
47
+ interface Props {
48
+ allowPastDates?: boolean
49
+ closeAfterSelect?: boolean
50
+ errorMessage?: string
51
+ initDateOne?: string
52
+ initDateTwo?: string
53
+ inputValue?: string
54
+ isError?: boolean
55
+ isInline?: boolean
56
+ label?: string
57
+ locale?: string
58
+ maxDate?: string | Date
59
+ minDate?: string | Date
60
+ mode?: DatepickerMode
61
+ placeholder?: string
62
+ singleMonth?: boolean
63
+ triggerElementId?: string
64
+ }
65
+
66
+ interface Emits {
67
+ (e: 'dates', dates: string[]): void
68
+ }
69
+
70
+ const props = withDefaults(defineProps<Props>(), {
71
+ triggerElementId: '',
72
+ mode: 'single',
73
+ closeAfterSelect: true,
74
+ label: '',
75
+ placeholder: 'Select a date',
76
+ inputValue: '',
77
+ isError: false,
78
+ errorMessage: '',
79
+ initDateOne: '',
80
+ initDateTwo: '',
81
+ minDate: () => DateTime.local().toISODate(),
82
+ maxDate: '',
83
+ allowPastDates: false,
84
+ isInline: false,
85
+ singleMonth: false,
86
+ locale: () => navigator.language,
87
+ })
88
+
89
+ const emit = defineEmits<Emits>()
90
+
91
+ const humanFormat = 'EEE DD'
92
+ const dateOne = ref(props.initDateOne || '')
93
+ const dateTwo = ref(props.mode === 'range' ? props.initDateTwo : '')
94
+ const isDisabled = ref(false)
95
+ const datePickerReferenceId = ref(props.triggerElementId || randomString())
96
+
97
+ const inputComputedValue = computed(() => {
98
+ if (props.inputValue) return props.inputValue
99
+
100
+ return formatDates({
101
+ dateOne: dateOne.value,
102
+ dateTwo: dateTwo.value,
103
+ format: humanFormat,
104
+ locale: props.locale,
105
+ })
106
+ })
107
+
108
+ const numberOfMonths = computed(() => {
109
+ return props.singleMonth ? 1 : 2
110
+ })
111
+
112
+ const computedMinDate = computed(() => {
113
+ return props.allowPastDates ? '' : props.minDate
114
+ })
115
+
116
+ const onDateOneSelected = (date: string) => selectDate('dateOne', date)
117
+ const onDateTwoSelected = (date: string) => selectDate('dateTwo', date)
118
+
119
+ const selectDate = (dateType: 'dateOne' | 'dateTwo', dateValue: string): void => {
120
+ if (dateType === 'dateOne') {
121
+ dateOne.value = dateValue
122
+ } else {
123
+ dateTwo.value = dateValue
124
+ }
125
+ emit('dates', [dateOne.value, ...(dateTwo.value ? [dateTwo.value] : [])])
126
+ }
127
+
128
+ const updateDateValue = (date: 'dateOne' | 'dateTwo', newValue: string, oldValue: string): void => {
129
+ if (newValue !== oldValue) {
130
+ if (date === 'dateOne') {
131
+ dateOne.value = newValue
132
+ } else {
133
+ dateTwo.value = newValue
134
134
  }
135
+ }
136
+ }
137
+
138
+ watch(
139
+ () => props.initDateOne,
140
+ (newValue, oldValue) => {
141
+ updateDateValue('dateOne', newValue, oldValue)
135
142
  },
136
- computed: {
137
- inputComputedValue() {
138
- if (this.inputValue) return this.inputValue
139
-
140
- return formatDates({
141
- dateOne: this.dateOne,
142
- dateTwo: this.dateTwo,
143
- format: this.humanFormat,
144
- locale: this.locale,
145
- })
146
- },
147
- numberOfMonths() {
148
- return this.singleMonth ? 1 : 2
149
- },
150
- computedMinDate() {
151
- return this.allowPastDates ? '' : this.minDate
152
- },
153
- dynamicClasses() {
154
- return { 'cpDatepicker__datepicker--isInline': this.isInline }
155
- },
156
- },
157
- watch: {
158
- initDateOne(newValue, oldValue) {
159
- this.updateDateValue('dateOne', newValue, oldValue)
160
- },
161
- initDateTwo(newValue, oldValue) {
162
- this.updateDateValue('dateTwo', newValue, oldValue)
163
- },
164
- },
165
- methods: {
166
- selectDate(dateType, dateValue) {
167
- this[dateType] = dateValue
168
- this.$emit('dates', [this.dateOne, ...(this.dateTwo && [this.dateTwo])])
169
- },
170
- updateDateValue(date, newValue, oldValue) {
171
- if (newValue !== oldValue) {
172
- this[date] = newValue
173
- }
174
- },
143
+ )
144
+
145
+ watch(
146
+ () => props.initDateTwo,
147
+ (newValue, oldValue) => {
148
+ updateDateValue('dateTwo', newValue, oldValue)
175
149
  },
176
- }
150
+ )
177
151
  </script>
178
152
 
179
153
  <style lang="scss">
@@ -16,31 +16,20 @@
16
16
  </div>
17
17
  </template>
18
18
 
19
- <script setup>
19
+ <script setup lang="ts">
20
20
  import { ref, computed, useSlots } from 'vue'
21
21
 
22
- import { Intent } from '@/utils/constants'
23
-
24
- const props = defineProps({
25
- intent: {
26
- type: String,
27
- required: true,
28
- default: Intent.INFO.value,
29
- validator(value) {
30
- const intentValues = Object.values(Intent).map((item) => item.value)
31
- return intentValues.includes(value)
32
- },
33
- },
34
- title: {
35
- type: String,
36
- required: false,
37
- default: '',
38
- },
39
- isClosable: {
40
- type: Boolean,
41
- required: false,
42
- default: false,
43
- },
22
+ import { Intent } from '@/constants'
23
+
24
+ interface Props {
25
+ intent: (typeof Intent)[keyof typeof Intent]['value']
26
+ isClosable?: boolean
27
+ title?: string
28
+ }
29
+
30
+ const props = withDefaults(defineProps<Props>(), {
31
+ title: '',
32
+ isClosable: false,
44
33
  })
45
34
 
46
35
  const slots = useSlots()
@@ -49,7 +38,7 @@ const isDisplayed = ref(true)
49
38
 
50
39
  const alertIcon = computed(() => {
51
40
  const intentValues = Object.values(Intent)
52
- return intentValues.find((intentItem) => intentItem.value === props.intent).icon
41
+ return intentValues.find((intentItem) => intentItem.value === props.intent)?.icon
53
42
  })
54
43
 
55
44
  const hasIconSlot = computed(() => !!slots.icon)
@@ -116,12 +105,12 @@ const dismissAlert = () => (isDisplayed.value = false)
116
105
  }
117
106
 
118
107
  &__icon,
119
- &__content,
120
- &__title {
108
+ &__content {
121
109
  line-height: fn.px-to-rem(19);
122
110
  }
123
111
 
124
- &__title {
112
+ &__body > .cpHeading {
113
+ line-height: fn.px-to-rem(19);
125
114
  color: inherit;
126
115
  font-weight: 600;
127
116
 
@@ -33,13 +33,12 @@
33
33
  </svg>
34
34
  </template>
35
35
 
36
- <script>
37
- export default {
38
- props: {
39
- color: {
40
- type: String,
41
- default: '#ff6700',
42
- },
43
- },
36
+ <script setup lang="ts">
37
+ interface Props {
38
+ color?: string
44
39
  }
40
+
41
+ withDefaults(defineProps<Props>(), {
42
+ color: '#ff6700',
43
+ })
45
44
  </script>