@citizenplane/pimp 8.29.0 → 8.32.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/.lintstagedrc.json +1 -1
- package/dist/{IconAccompaniedMinorEach-DJAl0F5n.js → IconAccompaniedMinorEach-DpEElnDj.js} +3 -3
- package/dist/{IconAccompaniedMinorNone-DiM0N51w.js → IconAccompaniedMinorNone-CSAn78Qm.js} +3 -3
- package/dist/{IconAccompaniedMinorOne-CKplzZmh.js → IconAccompaniedMinorOne-CpdzlOXT.js} +3 -3
- package/dist/{IconAddReceipt-DcCS2bfI.js → IconAddReceipt-CBtGGdgh.js} +3 -3
- package/dist/{IconAirportTerminal-Ds0ZJoQR.js → IconAirportTerminal-DKMC59g1.js} +3 -3
- package/dist/{IconArrival-D46TLsV9.js → IconArrival-DvnK3WzD.js} +3 -3
- package/dist/{IconBaggageCabinNone-xb3xxuaw.js → IconBaggageCabinNone-3-Ba3Rcj.js} +3 -3
- package/dist/{IconBaggageCheckedNone-B-aRpwV3.js → IconBaggageCheckedNone-bOh-0iC-.js} +3 -3
- package/dist/{IconBaggagePersonalNone-BANaXEwN.js → IconBaggagePersonalNone-DUkuqDJE.js} +3 -3
- package/dist/{IconBroadcast-CaP6RkQS.js → IconBroadcast-a_ffnOkB.js} +3 -3
- package/dist/{IconCabinBag-C_RCoMJH.js → IconCabinBag-D-uH23Ly.js} +3 -3
- package/dist/{IconCalendar-DsY2EgtV.js → IconCalendar-BE6-u-8l.js} +3 -3
- package/dist/{IconCalendarDelay-Dw2BJrkM.js → IconCalendarDelay-De3JquGL.js} +3 -3
- package/dist/{IconCheckedBaggage20-64O0_VLT.js → IconCheckedBaggage20-D0q_kCTC.js} +3 -3
- package/dist/{IconCheckedBaggage30-KqEee1vY.js → IconCheckedBaggage30-DV4BONSE.js} +3 -3
- package/dist/{IconChild-CQgO2S-B.js → IconChild-CdQcUtcE.js} +3 -3
- package/dist/{IconContact-Dp6fiVgj.js → IconContact-Cv9sjybD.js} +3 -3
- package/dist/{IconDeparture-CzilFSlX.js → IconDeparture-DH2HQHdm.js} +3 -3
- package/dist/{IconDistribution-DwWykEuK.js → IconDistribution-B3rMB_8z.js} +3 -3
- package/dist/{IconDistributionClosed-BFhm0zlg.js → IconDistributionClosed-DV1uZDv4.js} +3 -3
- package/dist/{IconDistributionExclusivePair-BJloN2rr.js → IconDistributionExclusivePair-B168f8xr.js} +3 -3
- package/dist/{IconDistributionSided-CGOMrvD9.js → IconDistributionSided-zq7aztcl.js} +3 -3
- package/dist/{IconDistributionSupplySided-aDOBPVbr.js → IconDistributionSupplySided-BikGIlKh.js} +3 -3
- package/dist/{IconDynamicContent-Dy4P_4kE.js → IconDynamicContent-DQnNwzTU.js} +3 -3
- package/dist/{IconEndDate-zHqEusva.js → IconEndDate-CUSkHS7K.js} +3 -3
- package/dist/{IconFares-Ar7mT2uJ.js → IconFares-BdiZU6jj.js} +3 -3
- package/dist/{IconFaresOutlined-CzXzP1Nq.js → IconFaresOutlined-CwLyXpw3.js} +3 -3
- package/dist/{IconFemale-BAPZu5dD.js → IconFemale-CYnfnomZ.js} +3 -3
- package/dist/{IconFindConversation-Dp9kb_9Q.js → IconFindConversation-1FhTucOg.js} +3 -3
- package/dist/{IconFire-D-skpITw.js → IconFire-VTDN9VmA.js} +3 -3
- package/dist/{IconFlight-Bk74FFlO.js → IconFlight-BIgPgBMK.js} +3 -3
- package/dist/{IconFlightReturn-ChU0D5NM.js → IconFlightReturn-B2oaqzxG.js} +3 -3
- package/dist/{IconFlightSchedule-BGqSAgnS.js → IconFlightSchedule-BxffdZn8.js} +3 -3
- package/dist/{IconHandHeart-DSLVTWB0.js → IconHandHeart-BZ-0iAln.js} +3 -3
- package/dist/{IconHistory-DoiJxTLv.js → IconHistory-Cy0h3-N0.js} +3 -3
- package/dist/{IconHourGlass-DiUkDFsn.js → IconHourGlass-C1Tn_AKr.js} +3 -3
- package/dist/{IconIdCard-AZFJGbhI.js → IconIdCard-BcDy9HdN.js} +3 -3
- package/dist/{IconInfant-Upc6KK5G.js → IconInfant-Bi9YxGKg.js} +3 -3
- package/dist/{IconItinerary-B0gVEP6X.js → IconItinerary-CWuYOVj4.js} +3 -3
- package/dist/{IconLeave-CuUkbugY.js → IconLeave-B5kgaYEj.js} +3 -3
- package/dist/{IconMale-C38B_sQb.js → IconMale-CCtT1P1K.js} +3 -3
- package/dist/{IconMultiSegments-DDmDlR8c.js → IconMultiSegments-BUCf_pj_.js} +3 -3
- package/dist/{IconNoPassport-C0o54-Yj.js → IconNoPassport-Bhgj3NBo.js} +3 -3
- package/dist/{IconNoRefund-B4xImgrQ.js → IconNoRefund-DqFSgn-6.js} +3 -3
- package/dist/{IconNoSeat-Bnh__UM_.js → IconNoSeat-wuEX_UXv.js} +3 -3
- package/dist/{IconNotion-DOT1v1RD.js → IconNotion-2FtjMQMa.js} +3 -3
- package/dist/{IconOffline-D1d62Jkv.js → IconOffline-C4GjnTTo.js} +3 -3
- package/dist/{IconOneWay--BY9YJWU.js → IconOneWay-CFtiG5Ts.js} +3 -3
- package/dist/{IconPaid-Dyw8JVGl.js → IconPaid-DbLrGat6.js} +3 -3
- package/dist/{IconPassport-_LaJzaWO.js → IconPassport-DQWeA53e.js} +3 -3
- package/dist/{IconPayout-Df0q7muN.js → IconPayout-DxnFPgCJ.js} +3 -3
- package/dist/{IconPlug-Djxnwr8c.js → IconPlug-1iIATnTp.js} +3 -3
- package/dist/{IconPlugOff-njGjheAI.js → IconPlugOff-BMmQIhhA.js} +3 -3
- package/dist/{IconReceipt-DS1UiNwb.js → IconReceipt-C__7aeaN.js} +3 -3
- package/dist/{IconRecurrence-CYJGsNgj.js → IconRecurrence-pynP-MFG.js} +3 -3
- package/dist/{IconRefund-BqZTvJDf.js → IconRefund-DLKKJOjc.js} +3 -3
- package/dist/{IconRoundTrip-Du_iKzRn.js → IconRoundTrip-CbNgQaWm.js} +3 -3
- package/dist/{IconRouteNoStop-BMimFG1_.js → IconRouteNoStop-BWNJ-cpd.js} +3 -3
- package/dist/{IconRouteOneStop-BCyieuH0.js → IconRouteOneStop-DTNCRbnX.js} +3 -3
- package/dist/{IconScheduleChange-CPJ2QMHl.js → IconScheduleChange-D39f_zJq.js} +3 -3
- package/dist/{IconSeatEmpty-BvulUq5w.js → IconSeatEmpty-xCuONmtp.js} +3 -3
- package/dist/{IconSeatSold-Cs3FRT9q.js → IconSeatSold-sLOrljqd.js} +3 -3
- package/dist/{IconSeatTotal-B3mVvYAL.js → IconSeatTotal-C2AnnUoa.js} +3 -3
- package/dist/{IconStartDate-B-j0bRpZ.js → IconStartDate-B3fwVSZ0.js} +3 -3
- package/dist/{IconTemplate-CJfm6u-D.js → IconTemplate-hGOX59R9.js} +3 -3
- package/dist/{IconTicket-Dr5BMylL.js → IconTicket-D6g4QR2n.js} +3 -3
- package/dist/{IconTimer-DkbtAi6L.js → IconTimer-D8ewK3WY.js} +3 -3
- package/dist/{IconTrafficControl-DaYBu9ZI.js → IconTrafficControl-CYJ9cs6N.js} +3 -3
- package/dist/{index-Cs7xsj5h.js → index-DuaPiFxo.js} +1906 -1912
- package/dist/pimp.es.js +1 -1
- package/dist/pimp.umd.js +18 -18
- package/dist/style.css +1 -1
- package/package.json +5 -3
- package/src/assets/styles/variables/_colors.scss +3 -1
- package/src/components/BaseInputLabel.vue +4 -0
- package/src/components/CpBadge.vue +69 -29
- package/src/components/CpButton.vue +2 -17
- package/src/components/CpCheckbox.vue +1 -0
- package/src/components/CpDate.vue +7 -7
- package/src/components/CpDatepicker.vue +1 -0
- package/src/components/CpHeading.vue +4 -0
- package/src/components/CpInput.vue +5 -5
- package/src/components/CpMultiselect.vue +9 -16
- package/src/components/CpSelect.vue +4 -5
- package/src/components/CpSelectMenu.vue +1 -0
- package/src/components/CpTable.vue +8 -8
- package/src/components/CpTextarea.vue +4 -4
- package/src/constants/Button.ts +16 -0
- package/src/constants/CpCustomIcons.ts +1 -1
- package/src/constants/index.ts +2 -0
- package/src/libs/CoreDatepicker.vue +20 -12
- package/src/stories/CpBadge.stories.ts +71 -54
- package/src/stories/CpDate.stories.ts +1 -1
- package/src/stories/CpMultiselect.stories.ts +7 -5
|
@@ -63,6 +63,10 @@ import BaseInputLabel from '@/components/BaseInputLabel.vue'
|
|
|
63
63
|
|
|
64
64
|
import { randomString, capitalizeFirstLetter } from '@/helpers'
|
|
65
65
|
|
|
66
|
+
interface Emits {
|
|
67
|
+
(e: 'update:modelValue', value: string | number | boolean): void
|
|
68
|
+
}
|
|
69
|
+
|
|
66
70
|
interface Props {
|
|
67
71
|
errorMessage?: string
|
|
68
72
|
help?: string
|
|
@@ -93,10 +97,6 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
93
97
|
help: '',
|
|
94
98
|
})
|
|
95
99
|
|
|
96
|
-
interface Emits {
|
|
97
|
-
(e: 'update:modelValue', value: string | number | boolean): void
|
|
98
|
-
}
|
|
99
|
-
|
|
100
100
|
const emit = defineEmits<Emits>()
|
|
101
101
|
|
|
102
102
|
defineOptions({ inheritAttrs: false })
|
|
@@ -104,7 +104,7 @@ defineOptions({ inheritAttrs: false })
|
|
|
104
104
|
const attrs = useAttrs()
|
|
105
105
|
|
|
106
106
|
// class is a reserved word, we can't remove 'class' property from attrs
|
|
107
|
-
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
108
108
|
const { ['class']: value, id, ...restAttributes } = attrs
|
|
109
109
|
|
|
110
110
|
const inputIdentifier = ref(id || randomString())
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
<base-input-label v-if="label" :required="required" class="cpMultiselect__label">
|
|
4
4
|
{{ label }}
|
|
5
5
|
</base-input-label>
|
|
6
|
-
|
|
7
|
-
<AutoComplete
|
|
6
|
+
<auto-complete
|
|
8
7
|
ref="multiselect"
|
|
9
8
|
v-model="selectModel"
|
|
10
9
|
:suggestions="options"
|
|
@@ -29,7 +28,6 @@
|
|
|
29
28
|
<div class="cpMultiselect__empty">{{ emptyMessage }}</div>
|
|
30
29
|
</slot>
|
|
31
30
|
</template>
|
|
32
|
-
|
|
33
31
|
<template #chip="{ value, removeCallback }">
|
|
34
32
|
<slot name="selected-option" :option="value" :remove="removeCallback">
|
|
35
33
|
<cp-badge is-clearable size="sm" @on-clear="removeCallback()">
|
|
@@ -40,25 +38,20 @@
|
|
|
40
38
|
</cp-badge>
|
|
41
39
|
</slot>
|
|
42
40
|
</template>
|
|
43
|
-
|
|
44
41
|
<template #option="{ option }">
|
|
45
42
|
<slot name="option" :option="option" />
|
|
46
43
|
</template>
|
|
47
|
-
|
|
48
44
|
<template #dropdown>
|
|
49
45
|
<div v-if="displayPrefix" class="cpMultiselect__prefix">
|
|
50
46
|
<slot name="prefix" />
|
|
51
47
|
</div>
|
|
52
|
-
|
|
53
48
|
<cp-loader v-if="isLoading" class="cpMultiselect__loader" color="#B2B2BD" />
|
|
54
49
|
<button v-else :disabled="disabled" type="button" class="cpMultiselect__toggle" @click.stop="toggleDropdown">
|
|
55
50
|
<cp-icon type="chevron-down" class="cpMultiselect__dropdownIcon" :class="chevronDynamicClass" />
|
|
56
51
|
</button>
|
|
57
|
-
|
|
58
52
|
<base-select-clear-button v-if="displayClearButton" class="cpMultiselect__clear" @click="handleClear" />
|
|
59
53
|
</template>
|
|
60
|
-
</
|
|
61
|
-
|
|
54
|
+
</auto-complete>
|
|
62
55
|
<transition-expand>
|
|
63
56
|
<p v-if="isInvalid" class="cpMultiselect__error">
|
|
64
57
|
{{ errorMessage }}
|
|
@@ -78,6 +71,13 @@ import TransitionExpand from '@/components/TransitionExpand.vue'
|
|
|
78
71
|
|
|
79
72
|
import { isEmpty } from '@/helpers/object'
|
|
80
73
|
|
|
74
|
+
interface Emits {
|
|
75
|
+
(e: 'search', query: string): void
|
|
76
|
+
(e: 'select', option: Record<string, unknown>): void
|
|
77
|
+
(e: 'clear'): void
|
|
78
|
+
(e: 'update:modelValue', value: Record<string, unknown> | Record<string, unknown>[] | null): void
|
|
79
|
+
}
|
|
80
|
+
|
|
81
81
|
interface Props {
|
|
82
82
|
disabled?: boolean
|
|
83
83
|
emptyMessage?: string
|
|
@@ -114,13 +114,6 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
114
114
|
modelValue: null,
|
|
115
115
|
})
|
|
116
116
|
|
|
117
|
-
interface Emits {
|
|
118
|
-
(e: 'search', query: string): void
|
|
119
|
-
(e: 'select', option: Record<string, unknown>): void
|
|
120
|
-
(e: 'clear'): void
|
|
121
|
-
(e: 'update:modelValue', value: Record<string, unknown> | Record<string, unknown>[] | null): void
|
|
122
|
-
}
|
|
123
|
-
|
|
124
117
|
const emit = defineEmits<Emits>()
|
|
125
118
|
|
|
126
119
|
const selectModel = computed({
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
<div class="cpSelect__container">
|
|
7
7
|
<select
|
|
8
8
|
:id="selectReferenceId"
|
|
9
|
-
ref="cpSelect"
|
|
10
9
|
:value="modelValue"
|
|
11
10
|
:disabled="disabled"
|
|
12
11
|
:required="required"
|
|
@@ -40,6 +39,10 @@ import TransitionExpand from '@/components/TransitionExpand.vue'
|
|
|
40
39
|
|
|
41
40
|
import { randomString, capitalizeFirstLetter } from '@/helpers'
|
|
42
41
|
|
|
42
|
+
interface Emits {
|
|
43
|
+
(e: 'update:modelValue', value: string): void
|
|
44
|
+
}
|
|
45
|
+
|
|
43
46
|
interface SelectOption {
|
|
44
47
|
label: string
|
|
45
48
|
value: string | number
|
|
@@ -60,10 +63,6 @@ interface Props {
|
|
|
60
63
|
required?: boolean
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
interface Emits {
|
|
64
|
-
(e: 'update:modelValue', value: string): void
|
|
65
|
-
}
|
|
66
|
-
|
|
67
66
|
const props = withDefaults(defineProps<Props>(), {
|
|
68
67
|
label: '',
|
|
69
68
|
modelValue: '',
|
|
@@ -78,6 +78,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
78
78
|
dropdownTitle: 'Select value',
|
|
79
79
|
dropdownFilterPlaceholder: 'Filter...',
|
|
80
80
|
dropdownEmptyViewPlaceholder: 'No option found',
|
|
81
|
+
// eslint-disable-next-line vue/no-boolean-default
|
|
81
82
|
closeOnSelect: true,
|
|
82
83
|
})
|
|
83
84
|
|
|
@@ -121,7 +121,12 @@ import { camelize, decamelize } from '@/helpers/string'
|
|
|
121
121
|
import { PAGINATION_FORMATS, RESERVED_KEYS, VISIBLE_ROWS_MAX } from '@/constants'
|
|
122
122
|
import { randomString } from '@/helpers'
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
interface Emits {
|
|
125
|
+
(e: 'onRowClick', data: Record<string, unknown>): void
|
|
126
|
+
(e: 'onRowRightClick', payload: { data: Record<string, unknown>; event: Event }): void
|
|
127
|
+
(e: 'onNextClick'): void
|
|
128
|
+
(e: 'onPreviousClick'): void
|
|
129
|
+
}
|
|
125
130
|
|
|
126
131
|
interface ColumnDefinition {
|
|
127
132
|
id: string
|
|
@@ -183,15 +188,10 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
183
188
|
rowOptions: () => [],
|
|
184
189
|
})
|
|
185
190
|
|
|
186
|
-
interface Emits {
|
|
187
|
-
(e: 'onRowClick', data: Record<string, unknown>): void
|
|
188
|
-
(e: 'onRowRightClick', payload: { data: Record<string, unknown>; event: Event }): void
|
|
189
|
-
(e: 'onNextClick'): void
|
|
190
|
-
(e: 'onPreviousClick'): void
|
|
191
|
-
}
|
|
192
|
-
|
|
193
191
|
const emit = defineEmits<Emits>()
|
|
194
192
|
|
|
193
|
+
const LoaderColor = '#5341F9'
|
|
194
|
+
|
|
195
195
|
const uniqueId = ref(randomString())
|
|
196
196
|
const pageNumber = ref(0)
|
|
197
197
|
const cpTableContainer = ref<HTMLElement | null>(null)
|
|
@@ -35,6 +35,10 @@ import TransitionExpand from '@/components/TransitionExpand.vue'
|
|
|
35
35
|
|
|
36
36
|
import { randomString, capitalizeFirstLetter } from '@/helpers'
|
|
37
37
|
|
|
38
|
+
interface Emits {
|
|
39
|
+
(e: 'update:modelValue', value: string): void
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
interface Props {
|
|
39
43
|
disabled?: boolean
|
|
40
44
|
errorMessage?: string
|
|
@@ -59,10 +63,6 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
59
63
|
height: 200,
|
|
60
64
|
})
|
|
61
65
|
|
|
62
|
-
interface Emits {
|
|
63
|
-
(e: 'update:modelValue', value: string): void
|
|
64
|
-
}
|
|
65
|
-
|
|
66
66
|
const emit = defineEmits<Emits>()
|
|
67
67
|
|
|
68
68
|
const textareaModel = defineModel<string>({
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export enum ButtonAppearances {
|
|
2
|
+
DEFAULT = 'default',
|
|
3
|
+
PRIMARY = 'primary',
|
|
4
|
+
MINIMAL = 'minimal',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export enum ButtonTags {
|
|
8
|
+
BUTTON = 'button',
|
|
9
|
+
A = 'a',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export enum ButtonTypes {
|
|
13
|
+
BUTTON = 'button',
|
|
14
|
+
SUBMIT = 'submit',
|
|
15
|
+
RESET = 'reset',
|
|
16
|
+
}
|
|
@@ -10,7 +10,7 @@ export const CustomCpIcons = {
|
|
|
10
10
|
arrival: defineAsyncComponent(() => import('@/components/icons/IconArrival.vue')),
|
|
11
11
|
'baggage-cabin-none': defineAsyncComponent(() => import('@/components/icons/IconBaggageCabinNone.vue')),
|
|
12
12
|
'baggage-checked-none': defineAsyncComponent(() => import('@/components/icons/IconBaggageCheckedNone.vue')),
|
|
13
|
-
'baggage-
|
|
13
|
+
'baggage-personal-none': defineAsyncComponent(() => import('@/components/icons/IconBaggagePersonalNone.vue')),
|
|
14
14
|
broadcast: defineAsyncComponent(() => import('@/components/icons/IconBroadcast.vue')),
|
|
15
15
|
'calendar-2': defineAsyncComponent(() => import('@/components/icons/IconCalendar.vue')),
|
|
16
16
|
'calendar-delay': defineAsyncComponent(() => import('@/components/icons/IconCalendarDelay.vue')),
|
package/src/constants/index.ts
CHANGED
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
>
|
|
80
80
|
<option
|
|
81
81
|
v-if="years.indexOf(month.year) === -1"
|
|
82
|
-
:key="`month-${monthIndex}-${year}`"
|
|
82
|
+
:key="`month-${monthIndex}-${month.year}`"
|
|
83
83
|
:value="month.year"
|
|
84
84
|
:disabled="true"
|
|
85
85
|
>
|
|
@@ -246,15 +246,16 @@ export default {
|
|
|
246
246
|
},
|
|
247
247
|
isTest: {
|
|
248
248
|
type: Boolean,
|
|
249
|
+
// eslint-disable-next-line vue/no-boolean-default
|
|
249
250
|
default: () => process.env.NODE_ENV === 'test',
|
|
250
251
|
},
|
|
251
252
|
},
|
|
252
253
|
emits: [
|
|
253
|
-
'
|
|
254
|
-
'
|
|
255
|
-
'
|
|
256
|
-
'
|
|
257
|
-
'
|
|
254
|
+
'dateOneSelected',
|
|
255
|
+
'dateTwoSelected',
|
|
256
|
+
'isInline',
|
|
257
|
+
'previousMonth',
|
|
258
|
+
'nextMonth',
|
|
258
259
|
'opened',
|
|
259
260
|
'cancelled',
|
|
260
261
|
'closed',
|
|
@@ -382,11 +383,11 @@ export default {
|
|
|
382
383
|
watch: {
|
|
383
384
|
selectedDate1(newValue) {
|
|
384
385
|
const newDate = !newValue || newValue === '' ? '' : newValue
|
|
385
|
-
this.$emit('
|
|
386
|
+
this.$emit('dateOneSelected', newDate)
|
|
386
387
|
},
|
|
387
388
|
selectedDate2(newValue) {
|
|
388
389
|
const newDate = !newValue || newValue === '' ? '' : newValue
|
|
389
|
-
this.$emit('
|
|
390
|
+
this.$emit('dateTwoSelected', newDate)
|
|
390
391
|
},
|
|
391
392
|
mode() {
|
|
392
393
|
this.setStartDates()
|
|
@@ -408,7 +409,7 @@ export default {
|
|
|
408
409
|
}
|
|
409
410
|
if (this.isDateTwoBeforeDateOne) {
|
|
410
411
|
this.selectedDate2 = ''
|
|
411
|
-
this.$emit('
|
|
412
|
+
this.$emit('dateTwoSelected', '')
|
|
412
413
|
}
|
|
413
414
|
},
|
|
414
415
|
trigger(newValue) {
|
|
@@ -442,11 +443,15 @@ export default {
|
|
|
442
443
|
this.openDatepicker()
|
|
443
444
|
}
|
|
444
445
|
|
|
446
|
+
// eslint-disable-next-line vue/no-undef-properties
|
|
445
447
|
this.triggerElement.addEventListener('click', this._handleWindowClickEvent)
|
|
446
448
|
},
|
|
447
449
|
unmounted() {
|
|
450
|
+
// eslint-disable-next-line vue/no-undef-properties
|
|
448
451
|
window.removeEventListener('resize', this._handleWindowResizeEvent)
|
|
452
|
+
|
|
449
453
|
window.removeEventListener('click', this._handleWindowClickEvent)
|
|
454
|
+
|
|
450
455
|
this.triggerElement.removeEventListener('click', this._handleWindowClickEvent)
|
|
451
456
|
},
|
|
452
457
|
methods: {
|
|
@@ -456,7 +461,7 @@ export default {
|
|
|
456
461
|
this._handleWindowResizeEvent = this.debounce(() => {
|
|
457
462
|
if (this.inline) this.openDatepicker()
|
|
458
463
|
else this.closeDatepicker()
|
|
459
|
-
this.$emit('
|
|
464
|
+
this.$emit('isInline', this.inline)
|
|
460
465
|
this.positionDatepicker()
|
|
461
466
|
this.setStartDates()
|
|
462
467
|
}, 200)
|
|
@@ -878,7 +883,7 @@ export default {
|
|
|
878
883
|
|
|
879
884
|
this.months.unshift(this.getMonth(this.startingDate))
|
|
880
885
|
this.months.splice(this.months.length - 1, 1)
|
|
881
|
-
this.$emit('
|
|
886
|
+
this.$emit('previousMonth', this.visibleMonths)
|
|
882
887
|
this.resetFocusedDate(false)
|
|
883
888
|
},
|
|
884
889
|
nextMonth() {
|
|
@@ -886,7 +891,7 @@ export default {
|
|
|
886
891
|
this.startingDate = this.addMonths(this.months[this.months.length - 1].firstDateOfMonth)
|
|
887
892
|
this.months.push(this.getMonth(this.startingDate))
|
|
888
893
|
this.months.splice(0, 1)
|
|
889
|
-
this.$emit('
|
|
894
|
+
this.$emit('nextMonth', this.visibleMonths)
|
|
890
895
|
this.resetFocusedDate(true)
|
|
891
896
|
},
|
|
892
897
|
subtractMonths(date) {
|
|
@@ -922,7 +927,9 @@ export default {
|
|
|
922
927
|
this.setStartDates()
|
|
923
928
|
this.triggerElement.classList.add('datepicker-open')
|
|
924
929
|
this.showDatepicker = true
|
|
930
|
+
// eslint-disable-next-line vue/no-undef-properties
|
|
925
931
|
this.initialDate1 = this.dateOne
|
|
932
|
+
// eslint-disable-next-line vue/no-undef-properties
|
|
926
933
|
this.initialDate2 = this.dateTwo
|
|
927
934
|
this.$emit('opened')
|
|
928
935
|
this.$nextTick(() => {
|
|
@@ -988,6 +995,7 @@ export default {
|
|
|
988
995
|
},
|
|
989
996
|
}
|
|
990
997
|
</script>
|
|
998
|
+
|
|
991
999
|
<style lang="scss">
|
|
992
1000
|
$tablet: 768px;
|
|
993
1001
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
1
|
+
import type { Args, Meta, StoryObj } from '@storybook/vue3'
|
|
2
2
|
|
|
3
3
|
import CpBadge from '@/components/CpBadge.vue'
|
|
4
4
|
|
|
5
|
+
import { Colors, Sizes } from '@/constants'
|
|
6
|
+
|
|
5
7
|
const meta = {
|
|
6
8
|
title: 'CpBadge',
|
|
7
9
|
component: CpBadge,
|
|
@@ -13,7 +15,7 @@ const meta = {
|
|
|
13
15
|
},
|
|
14
16
|
size: {
|
|
15
17
|
control: 'select',
|
|
16
|
-
options: ['sm', 'md'],
|
|
18
|
+
options: ['xs', 'sm', 'md'],
|
|
17
19
|
description: 'The size of the badge',
|
|
18
20
|
},
|
|
19
21
|
isStroked: {
|
|
@@ -26,12 +28,12 @@ const meta = {
|
|
|
26
28
|
},
|
|
27
29
|
leadingIcon: {
|
|
28
30
|
control: 'select',
|
|
29
|
-
options: ['check', 'arrow-right', 'arrow-left', 'arrow-up', 'arrow-down'],
|
|
31
|
+
options: ['', 'check', 'arrow-right', 'arrow-left', 'arrow-up', 'arrow-down', 'plus'],
|
|
30
32
|
description: 'Type of leading icon (if any)',
|
|
31
33
|
},
|
|
32
34
|
trailingIcon: {
|
|
33
35
|
control: 'select',
|
|
34
|
-
options: ['check', 'arrow-right', 'arrow-left', 'arrow-up', 'arrow-down'],
|
|
36
|
+
options: ['', 'check', 'arrow-right', 'arrow-left', 'arrow-up', 'arrow-down', 'plus'],
|
|
35
37
|
description: 'Type of trailing icon (if any)',
|
|
36
38
|
},
|
|
37
39
|
label: {
|
|
@@ -45,23 +47,28 @@ export default meta
|
|
|
45
47
|
|
|
46
48
|
type Story = StoryObj<typeof meta>
|
|
47
49
|
|
|
50
|
+
const defaultTemplate = '<CpBadge v-bind="args" />'
|
|
51
|
+
const defaultRender = (args: Args) => ({
|
|
52
|
+
components: { CpBadge },
|
|
53
|
+
setup() {
|
|
54
|
+
return { args }
|
|
55
|
+
},
|
|
56
|
+
template: defaultTemplate,
|
|
57
|
+
})
|
|
58
|
+
|
|
48
59
|
export const Default: Story = {
|
|
49
60
|
args: {
|
|
50
|
-
color:
|
|
51
|
-
size:
|
|
61
|
+
color: Colors.GRAY,
|
|
62
|
+
size: Sizes.MD,
|
|
52
63
|
isStroked: false,
|
|
53
64
|
isSquare: false,
|
|
65
|
+
isClearable: false,
|
|
66
|
+
isDisabled: false,
|
|
54
67
|
leadingIcon: '',
|
|
55
68
|
trailingIcon: '',
|
|
56
69
|
label: 'Badge',
|
|
57
70
|
},
|
|
58
|
-
render:
|
|
59
|
-
components: { CpBadge },
|
|
60
|
-
setup() {
|
|
61
|
-
return { args }
|
|
62
|
-
},
|
|
63
|
-
template: '<CpBadge v-bind="args" />',
|
|
64
|
-
}),
|
|
71
|
+
render: defaultRender,
|
|
65
72
|
}
|
|
66
73
|
|
|
67
74
|
export const WithColors: Story = {
|
|
@@ -83,74 +90,84 @@ export const WithColors: Story = {
|
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
export const WithSizes: Story = {
|
|
86
|
-
render: () => ({
|
|
93
|
+
render: (args: Args) => ({
|
|
87
94
|
components: { CpBadge },
|
|
95
|
+
setup() {
|
|
96
|
+
return { args }
|
|
97
|
+
},
|
|
88
98
|
template: `
|
|
89
99
|
<div style="display: flex; gap: 8px; align-items: center;">
|
|
90
|
-
<CpBadge size="
|
|
91
|
-
<CpBadge size="
|
|
100
|
+
<CpBadge v-bind="args" leading-icon="plus" trailing-icon="plus" size="md" label="Medium" />
|
|
101
|
+
<CpBadge v-bind="args" leading-icon="plus" trailing-icon="plus" size="sm" label="Small" />
|
|
102
|
+
<CpBadge v-bind="args" leading-icon="plus" trailing-icon="plus" size="xs" label="Extra Small" />
|
|
92
103
|
</div>
|
|
93
104
|
`,
|
|
94
105
|
}),
|
|
95
106
|
}
|
|
96
107
|
|
|
97
|
-
export const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
template: `
|
|
101
|
-
<div style="display: flex; gap: 8px; flex-wrap: wrap;">
|
|
102
|
-
<CpBadge color="blue" isStroked label="Stroked" />
|
|
103
|
-
<CpBadge color="green" isStroked label="Stroked" />
|
|
104
|
-
<CpBadge color="red" isStroked label="Stroked" />
|
|
105
|
-
</div>
|
|
106
|
-
`,
|
|
107
|
-
}),
|
|
108
|
+
export const WithIcons: Story = {
|
|
109
|
+
args: { ...Default.args, leadingIcon: 'check', trailingIcon: 'arrow-right', label: 'Both Icons' },
|
|
110
|
+
render: defaultRender,
|
|
108
111
|
}
|
|
109
112
|
|
|
110
|
-
export const
|
|
111
|
-
|
|
113
|
+
export const WithLeadingIcon: Story = {
|
|
114
|
+
args: { ...Default.args, leadingIcon: 'check', label: 'Leading Icon' },
|
|
115
|
+
render: defaultRender,
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const WithTrailingIcon: Story = {
|
|
119
|
+
args: { ...Default.args, trailingIcon: 'check', label: 'Trailing Icon' },
|
|
120
|
+
render: defaultRender,
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export const IconOnly: Story = {
|
|
124
|
+
args: { ...Default.args, leadingIcon: 'check', label: '' },
|
|
125
|
+
render: defaultRender,
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export const IsStroked: Story = {
|
|
129
|
+
render: (args: Args) => ({
|
|
112
130
|
components: { CpBadge },
|
|
131
|
+
setup() {
|
|
132
|
+
return { args }
|
|
133
|
+
},
|
|
113
134
|
template: `
|
|
114
135
|
<div style="display: flex; gap: 8px; align-items: center;">
|
|
115
|
-
<CpBadge color="blue" leading-icon="
|
|
116
|
-
<CpBadge color="
|
|
117
|
-
<CpBadge color="
|
|
136
|
+
<CpBadge v-bind="args" is-stroked color="blue" leading-icon="plus" trailing-icon="plus" label="Label" />
|
|
137
|
+
<CpBadge v-bind="args" is-stroked color="red" leading-icon="plus" trailing-icon="plus" label="Label" />
|
|
138
|
+
<CpBadge v-bind="args" is-stroked color="orange" leading-icon="plus" trailing-icon="plus" label="Label" />
|
|
139
|
+
<CpBadge v-bind="args" is-stroked color="yellow" leading-icon="plus" trailing-icon="plus" label="Label" />
|
|
140
|
+
<CpBadge v-bind="args" is-stroked color="green" leading-icon="plus" trailing-icon="plus" label="Label" />
|
|
141
|
+
<CpBadge v-bind="args" is-stroked color="purple" leading-icon="plus" trailing-icon="plus" label="Label" />
|
|
142
|
+
<CpBadge v-bind="args" is-stroked color="gray" leading-icon="plus" trailing-icon="plus" label="Label" />
|
|
118
143
|
</div>
|
|
119
144
|
`,
|
|
120
145
|
}),
|
|
121
146
|
}
|
|
122
147
|
|
|
123
148
|
export const IsSquare: Story = {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
template: `
|
|
127
|
-
<div style="display: flex; gap: 8px; align-items: center;">
|
|
128
|
-
<CpBadge color="blue" isSquare label="Square" />
|
|
129
|
-
<CpBadge color="green" isSquare label="Square" />
|
|
130
|
-
<CpBadge color="red" isSquare label="Square" />
|
|
131
|
-
</div>
|
|
132
|
-
`,
|
|
133
|
-
}),
|
|
149
|
+
args: { ...Default.args, isSquare: true, label: 'Square' },
|
|
150
|
+
render: defaultRender,
|
|
134
151
|
}
|
|
135
152
|
|
|
136
153
|
export const IsClearable: Story = {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
</div>
|
|
145
|
-
`,
|
|
146
|
-
}),
|
|
154
|
+
args: { ...Default.args, isClearable: true, label: 'Clearable' },
|
|
155
|
+
render: defaultRender,
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export const IsDisabled: Story = {
|
|
159
|
+
args: { ...Default.args, isDisabled: true, label: 'Disabled' },
|
|
160
|
+
render: defaultRender,
|
|
147
161
|
}
|
|
148
162
|
|
|
149
163
|
export const WithSlot: Story = {
|
|
150
|
-
render: () => ({
|
|
164
|
+
render: (args: Args) => ({
|
|
151
165
|
components: { CpBadge },
|
|
166
|
+
setup() {
|
|
167
|
+
return { args }
|
|
168
|
+
},
|
|
152
169
|
template: `
|
|
153
|
-
<CpBadge
|
|
170
|
+
<CpBadge v-bind="args">
|
|
154
171
|
<template #leading-icon>
|
|
155
172
|
<span style="font-size: 16px; margin-right: 4px;">🌟</span>
|
|
156
173
|
</template>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref } from 'vue'
|
|
1
|
+
import { ref, toValue } from 'vue'
|
|
2
2
|
|
|
3
3
|
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
4
4
|
|
|
@@ -87,7 +87,7 @@ export const Single: Story = {
|
|
|
87
87
|
const isLoading = ref(false)
|
|
88
88
|
|
|
89
89
|
const originalOptions = ref(args.options)
|
|
90
|
-
const dynamicOptions = ref(originalOptions
|
|
90
|
+
const dynamicOptions = ref(toValue(originalOptions))
|
|
91
91
|
|
|
92
92
|
const handleSearch = async (query: string) => {
|
|
93
93
|
isLoading.value = true
|
|
@@ -97,7 +97,8 @@ export const Single: Story = {
|
|
|
97
97
|
|
|
98
98
|
await new Promise((resolve) => setTimeout(resolve, 500))
|
|
99
99
|
|
|
100
|
-
dynamicOptions.value = dynamicOptions.value
|
|
100
|
+
dynamicOptions.value = dynamicOptions.value?.filter((option) => {
|
|
101
|
+
// @ts-expect-error option is unknown
|
|
101
102
|
return option.name.toLowerCase().includes(searchQuery.value.toLowerCase())
|
|
102
103
|
})
|
|
103
104
|
|
|
@@ -165,7 +166,7 @@ export const Multiple: Story = {
|
|
|
165
166
|
const isLoading = ref(false)
|
|
166
167
|
|
|
167
168
|
const originalOptions = ref(args.options)
|
|
168
|
-
const dynamicOptions = ref(originalOptions
|
|
169
|
+
const dynamicOptions = ref(toValue(originalOptions))
|
|
169
170
|
|
|
170
171
|
const handleSearch = async (query: string) => {
|
|
171
172
|
isLoading.value = true
|
|
@@ -175,7 +176,8 @@ export const Multiple: Story = {
|
|
|
175
176
|
|
|
176
177
|
await new Promise((resolve) => setTimeout(resolve, 500))
|
|
177
178
|
|
|
178
|
-
dynamicOptions.value = dynamicOptions.value
|
|
179
|
+
dynamicOptions.value = dynamicOptions.value?.filter((option) => {
|
|
180
|
+
// @ts-expect-error option is unknown
|
|
179
181
|
return option.name.toLowerCase().includes(searchQuery.value.toLowerCase())
|
|
180
182
|
})
|
|
181
183
|
|