@citizenplane/pimp 16.2.2 → 16.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pimp.es.js +3643 -3672
- package/dist/pimp.umd.js +44 -44
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/CpAlert.vue +0 -6
- package/src/components/index.ts +0 -2
- package/src/constants/index.ts +0 -1
- package/src/components/CpPartnerBadge.vue +0 -90
- package/src/constants/PartnerTypes.ts +0 -6
- package/src/stories/CpPartnerBadge.stories.ts +0 -143
package/package.json
CHANGED
|
@@ -201,10 +201,6 @@ const dynamicClasses = computed(() => [
|
|
|
201
201
|
gap: var(--cp-spacing-md);
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
&__close {
|
|
205
|
-
align-self: flex-start;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
204
|
&__title {
|
|
209
205
|
font-size: var(--cp-text-size-sm);
|
|
210
206
|
line-height: var(--cp-line-height-sm);
|
|
@@ -220,8 +216,6 @@ const dynamicClasses = computed(() => [
|
|
|
220
216
|
}
|
|
221
217
|
|
|
222
218
|
&--isInline {
|
|
223
|
-
align-items: center;
|
|
224
|
-
|
|
225
219
|
.cpAlert__body {
|
|
226
220
|
flex-direction: row;
|
|
227
221
|
align-items: center;
|
package/src/components/index.ts
CHANGED
|
@@ -34,7 +34,6 @@ import CpItemActions from './CpItemActions.vue'
|
|
|
34
34
|
import CpLoader from './CpLoader.vue'
|
|
35
35
|
import CpMenuItem from './CpMenuItem.vue'
|
|
36
36
|
import CpMultiselect from './CpMultiselect.vue'
|
|
37
|
-
import CpPartnerBadge from './CpPartnerBadge.vue'
|
|
38
37
|
import CpRadio from './CpRadio.vue'
|
|
39
38
|
import CpRadioGroup from './CpRadioGroup.vue'
|
|
40
39
|
import CpRadioNew from './CpRadioNew.vue'
|
|
@@ -103,7 +102,6 @@ const Components = {
|
|
|
103
102
|
CpIcon,
|
|
104
103
|
CpTelInput,
|
|
105
104
|
CpTooltip,
|
|
106
|
-
CpPartnerBadge,
|
|
107
105
|
CpAirlineLogo,
|
|
108
106
|
IconAirline,
|
|
109
107
|
IconOta,
|
package/src/constants/index.ts
CHANGED
|
@@ -4,7 +4,6 @@ export type { ToggleColors } from './colors/ToggleColors'
|
|
|
4
4
|
export { HeadingLevels } from './Heading'
|
|
5
5
|
export { PAGINATION_FORMATS, RESERVED_KEYS, VISIBLE_ROWS_MAX } from './CpTableConfig'
|
|
6
6
|
export type { Sizes } from './Sizes'
|
|
7
|
-
export { PartnerTypes } from './PartnerTypes'
|
|
8
7
|
|
|
9
8
|
export { CustomCpIcons } from './CpCustomIcons'
|
|
10
9
|
export { Intent } from './Intent'
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="cpPartnerBadge" :class="componentDynamicClasses">
|
|
3
|
-
<slot name="icon">
|
|
4
|
-
<component :is="dynamicBadgeProps.icon" class="cpPartnerBadge__icon" />
|
|
5
|
-
</slot>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script setup lang="ts">
|
|
10
|
-
import { computed } from 'vue'
|
|
11
|
-
|
|
12
|
-
import IconAirline from '@/components/icons/IconAirline.vue'
|
|
13
|
-
import IconOta from '@/components/icons/IconOta.vue'
|
|
14
|
-
import IconSupplier from '@/components/icons/IconSupplier.vue'
|
|
15
|
-
import IconThirdParty from '@/components/icons/IconThirdParty.vue'
|
|
16
|
-
|
|
17
|
-
import { PartnerTypes } from '@/constants'
|
|
18
|
-
import type { Sizes } from '@/constants'
|
|
19
|
-
|
|
20
|
-
interface Props {
|
|
21
|
-
size?: Sizes
|
|
22
|
-
type?: PartnerTypes
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
26
|
-
size: 'md',
|
|
27
|
-
type: PartnerTypes.THIRDPARTY,
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
const dynamicBadgeProps = computed(() => {
|
|
31
|
-
switch (props.type) {
|
|
32
|
-
case PartnerTypes.OTA:
|
|
33
|
-
return { classModifier: 'isOta', icon: IconOta }
|
|
34
|
-
case PartnerTypes.AIRLINE:
|
|
35
|
-
return { classModifier: 'isAirline', icon: IconAirline }
|
|
36
|
-
case PartnerTypes.SUPPLIER:
|
|
37
|
-
return { classModifier: 'isSupplier', icon: IconSupplier }
|
|
38
|
-
case PartnerTypes.THIRDPARTY:
|
|
39
|
-
default:
|
|
40
|
-
return { classModifier: 'isThirdParty', icon: IconThirdParty }
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
const componentDynamicClasses = computed(() => {
|
|
45
|
-
return [`cpPartnerBadge--${props.size}`, `cpPartnerBadge--${dynamicBadgeProps.value.classModifier}`]
|
|
46
|
-
})
|
|
47
|
-
</script>
|
|
48
|
-
|
|
49
|
-
<style lang="scss">
|
|
50
|
-
.cpPartnerBadge {
|
|
51
|
-
display: inline-flex;
|
|
52
|
-
padding: var(--cp-spacing-xs);
|
|
53
|
-
align-items: center;
|
|
54
|
-
justify-content: center;
|
|
55
|
-
border-radius: var(--cp-radius-sm);
|
|
56
|
-
color: var(--cp-text-white);
|
|
57
|
-
|
|
58
|
-
&--isOta {
|
|
59
|
-
background-color: var(--cp-background-warning-solid);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
&--isAirline {
|
|
63
|
-
background-color: var(--cp-background-blue-solid);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
&--isSupplier {
|
|
67
|
-
background-color: var(--cp-background-magenta-solid);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&--isThirdParty {
|
|
71
|
-
background-color: var(--cp-background-pink-solid);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
> * {
|
|
75
|
-
width: var(--cp-dimensions-5);
|
|
76
|
-
height: var(--cp-dimensions-5);
|
|
77
|
-
aspect-ratio: 1/1;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
&--sm > * {
|
|
81
|
-
width: var(--cp-dimensions-4);
|
|
82
|
-
height: var(--cp-dimensions-4);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
&--xs > * {
|
|
86
|
-
width: var(--cp-dimensions-3);
|
|
87
|
-
height: var(--cp-dimensions-3);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
</style>
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3-vite'
|
|
2
|
-
|
|
3
|
-
import CpPartnerBadge from '@/components/CpPartnerBadge.vue'
|
|
4
|
-
|
|
5
|
-
import { PartnerTypes } from '@/constants'
|
|
6
|
-
import { docCellStyle, docLabelStyle, docRowWrapStyle } from '@/stories/documentationStyles'
|
|
7
|
-
|
|
8
|
-
const partnerSizes = ['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl'] as const
|
|
9
|
-
|
|
10
|
-
const meta = {
|
|
11
|
-
title: 'Atoms/CpPartnerBadge',
|
|
12
|
-
component: CpPartnerBadge,
|
|
13
|
-
parameters: {
|
|
14
|
-
docs: {
|
|
15
|
-
description: {
|
|
16
|
-
component:
|
|
17
|
-
'A badge component that displays partner type icons with different background colors based on the partner type. Supports OTA, Airline, Supplier, and Third Party partner types.',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
argTypes: {
|
|
22
|
-
type: {
|
|
23
|
-
control: 'select',
|
|
24
|
-
options: Object.values(PartnerTypes),
|
|
25
|
-
description: 'The type of partner (determines icon and background color)',
|
|
26
|
-
table: {
|
|
27
|
-
type: { summary: 'string' },
|
|
28
|
-
defaultValue: { summary: 'ota' },
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
size: {
|
|
32
|
-
control: 'select',
|
|
33
|
-
options: partnerSizes,
|
|
34
|
-
description: 'The size of the badge',
|
|
35
|
-
table: {
|
|
36
|
-
type: { summary: 'string' },
|
|
37
|
-
defaultValue: { summary: 'md' },
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
tags: ['autodocs'],
|
|
42
|
-
} satisfies Meta<typeof CpPartnerBadge>
|
|
43
|
-
|
|
44
|
-
export default meta
|
|
45
|
-
|
|
46
|
-
type Story = StoryObj<typeof meta>
|
|
47
|
-
|
|
48
|
-
type PartnerBadgeStoryArgs = NonNullable<Story['args']>
|
|
49
|
-
|
|
50
|
-
const defaultTemplate = '<CpPartnerBadge v-bind="args" />'
|
|
51
|
-
const defaultRender = (args: PartnerBadgeStoryArgs) => ({
|
|
52
|
-
components: { CpPartnerBadge },
|
|
53
|
-
setup() {
|
|
54
|
-
return { args }
|
|
55
|
-
},
|
|
56
|
-
template: defaultTemplate,
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Default partner badge. Use the controls to experiment with each prop in
|
|
61
|
-
* isolation.
|
|
62
|
-
*/
|
|
63
|
-
export const Default: Story = {
|
|
64
|
-
args: {
|
|
65
|
-
type: PartnerTypes.OTA,
|
|
66
|
-
},
|
|
67
|
-
render: defaultRender,
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/* -------------------------------------------------------------------------- */
|
|
71
|
-
/* Types */
|
|
72
|
-
/* -------------------------------------------------------------------------- */
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Every partner type rendered side by side. Each type gets its own icon and
|
|
76
|
-
* background color.
|
|
77
|
-
*/
|
|
78
|
-
export const Types: Story = {
|
|
79
|
-
parameters: { controls: { disable: true } },
|
|
80
|
-
render: () => ({
|
|
81
|
-
components: { CpPartnerBadge },
|
|
82
|
-
setup() {
|
|
83
|
-
const entries = Object.entries(PartnerTypes)
|
|
84
|
-
return { entries, docCellStyle, docLabelStyle, docRowWrapStyle }
|
|
85
|
-
},
|
|
86
|
-
template: `
|
|
87
|
-
<div :style="docRowWrapStyle">
|
|
88
|
-
<div v-for="[name, type] in entries" :key="type" :style="docCellStyle">
|
|
89
|
-
<span :style="docLabelStyle">{{ name.toLowerCase() }}</span>
|
|
90
|
-
<CpPartnerBadge :type="type" />
|
|
91
|
-
</div>
|
|
92
|
-
</div>
|
|
93
|
-
`,
|
|
94
|
-
}),
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/* -------------------------------------------------------------------------- */
|
|
98
|
-
/* Sizes */
|
|
99
|
-
/* -------------------------------------------------------------------------- */
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* All sizes rendered side by side, from `2xs` to `4xl`.
|
|
103
|
-
*/
|
|
104
|
-
export const Sizes: Story = {
|
|
105
|
-
parameters: { controls: { disable: true } },
|
|
106
|
-
render: () => ({
|
|
107
|
-
components: { CpPartnerBadge },
|
|
108
|
-
setup() {
|
|
109
|
-
return { partnerSizes, PartnerTypes, docCellStyle, docLabelStyle, docRowWrapStyle }
|
|
110
|
-
},
|
|
111
|
-
template: `
|
|
112
|
-
<div :style="docRowWrapStyle">
|
|
113
|
-
<div v-for="size in partnerSizes" :key="size" :style="docCellStyle">
|
|
114
|
-
<span :style="docLabelStyle">{{ size }}</span>
|
|
115
|
-
<CpPartnerBadge :type="PartnerTypes.OTA" :size="size" />
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
`,
|
|
119
|
-
}),
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/* -------------------------------------------------------------------------- */
|
|
123
|
-
/* Slots */
|
|
124
|
-
/* -------------------------------------------------------------------------- */
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Override the default icon through the `#icon` slot.
|
|
128
|
-
*/
|
|
129
|
-
export const WithCustomIcon: Story = {
|
|
130
|
-
render: () => ({
|
|
131
|
-
components: { CpPartnerBadge },
|
|
132
|
-
setup() {
|
|
133
|
-
return { PartnerTypes }
|
|
134
|
-
},
|
|
135
|
-
template: `
|
|
136
|
-
<CpPartnerBadge :type="PartnerTypes.OTA">
|
|
137
|
-
<template #icon>
|
|
138
|
-
<cp-icon type="plus" />
|
|
139
|
-
</template>
|
|
140
|
-
</CpPartnerBadge>
|
|
141
|
-
`,
|
|
142
|
-
}),
|
|
143
|
-
}
|