@citizenplane/pimp 9.13.2 → 9.13.3
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 +9 -7
- package/dist/pimp.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/CpBadge.vue +10 -4
- package/src/stories/CpBadge.stories.ts +24 -0
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="cpBadge" :class="componentDynamicClasses">
|
|
3
3
|
<slot name="leading-icon">
|
|
4
|
-
<cp-icon v-if="leadingIcon"
|
|
4
|
+
<cp-icon v-if="leadingIcon" class="cpBadge__icon" :type="leadingIcon" />
|
|
5
5
|
</slot>
|
|
6
6
|
<span class="cpBadge__label">
|
|
7
7
|
<slot>{{ label }}</slot>
|
|
8
8
|
</span>
|
|
9
9
|
<slot v-if="!isClearable" name="trailing-icon">
|
|
10
|
-
<cp-icon v-if="trailingIcon"
|
|
10
|
+
<cp-icon v-if="trailingIcon" class="cpBadge__icon" :type="trailingIcon" />
|
|
11
11
|
</slot>
|
|
12
|
-
<button v-if="isClearable" class="cpBadge__clear"
|
|
13
|
-
<cp-icon
|
|
12
|
+
<button v-if="isClearable" class="cpBadge__clear" :disabled="isDisabled" type="button" @click="handleClear">
|
|
13
|
+
<cp-icon class="cpBadge__clearIcon" type="x" />
|
|
14
14
|
</button>
|
|
15
15
|
</div>
|
|
16
16
|
</template>
|
|
@@ -28,6 +28,7 @@ interface Emits {
|
|
|
28
28
|
interface Props {
|
|
29
29
|
color?: Colors
|
|
30
30
|
isClearable?: boolean
|
|
31
|
+
isDashed?: boolean
|
|
31
32
|
isDisabled?: boolean
|
|
32
33
|
isSquare?: boolean
|
|
33
34
|
isStroked?: boolean
|
|
@@ -57,6 +58,7 @@ const componentDynamicClasses = computed(() => {
|
|
|
57
58
|
`cpBadge--is${capitalizeFirstLetter(props.color)}`,
|
|
58
59
|
{ 'cpBadge--isStroked': props.isStroked },
|
|
59
60
|
{ 'cpBadge--isSquare': props.isSquare },
|
|
61
|
+
{ 'cpBadge--isDashed': props.isDashed },
|
|
60
62
|
{ 'cpBadge--isDisabled': props.isDisabled },
|
|
61
63
|
]
|
|
62
64
|
})
|
|
@@ -108,6 +110,10 @@ const handleClear = () => emit('onClear')
|
|
|
108
110
|
outline: 1px solid currentColor;
|
|
109
111
|
}
|
|
110
112
|
|
|
113
|
+
&--isDashed {
|
|
114
|
+
outline-style: dashed;
|
|
115
|
+
}
|
|
116
|
+
|
|
111
117
|
&--isSquare {
|
|
112
118
|
border-radius: fn.px-to-rem(8);
|
|
113
119
|
|
|
@@ -22,6 +22,10 @@ const meta = {
|
|
|
22
22
|
control: 'boolean',
|
|
23
23
|
description: 'Whether the badge has a stroked border',
|
|
24
24
|
},
|
|
25
|
+
isDashed: {
|
|
26
|
+
control: 'boolean',
|
|
27
|
+
description: 'Whether the badge has a dashed border',
|
|
28
|
+
},
|
|
25
29
|
isSquare: {
|
|
26
30
|
control: 'boolean',
|
|
27
31
|
description: 'Whether the badge has a square border',
|
|
@@ -145,6 +149,26 @@ export const IsStroked: Story = {
|
|
|
145
149
|
}),
|
|
146
150
|
}
|
|
147
151
|
|
|
152
|
+
export const IsDashed: Story = {
|
|
153
|
+
render: (args: Args) => ({
|
|
154
|
+
components: { CpBadge },
|
|
155
|
+
setup() {
|
|
156
|
+
return { args }
|
|
157
|
+
},
|
|
158
|
+
template: `
|
|
159
|
+
<div style="display: flex; gap: 8px; align-items: center;">
|
|
160
|
+
<CpBadge v-bind="args" is-dashed is-stroked color="blue" leading-icon="plus" trailing-icon="plus" label="Label" />
|
|
161
|
+
<CpBadge v-bind="args" is-dashed is-stroked color="red" leading-icon="plus" trailing-icon="plus" label="Label" />
|
|
162
|
+
<CpBadge v-bind="args" is-dashed is-stroked color="orange" leading-icon="plus" trailing-icon="plus" label="Label" />
|
|
163
|
+
<CpBadge v-bind="args" is-dashed is-stroked color="yellow" leading-icon="plus" trailing-icon="plus" label="Label" />
|
|
164
|
+
<CpBadge v-bind="args" is-dashed is-stroked color="green" leading-icon="plus" trailing-icon="plus" label="Label" />
|
|
165
|
+
<CpBadge v-bind="args" is-dashed is-stroked color="purple" leading-icon="plus" trailing-icon="plus" label="Label" />
|
|
166
|
+
<CpBadge v-bind="args" is-dashed is-stroked color="gray" leading-icon="plus" trailing-icon="plus" label="Label" />
|
|
167
|
+
</div>
|
|
168
|
+
`,
|
|
169
|
+
}),
|
|
170
|
+
}
|
|
171
|
+
|
|
148
172
|
export const IsSquare: Story = {
|
|
149
173
|
args: { ...Default.args, isSquare: true, label: 'Square' },
|
|
150
174
|
render: defaultRender,
|