@citizenplane/pimp 16.0.2 → 16.1.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/dist/pimp.es.js +343 -311
- package/dist/pimp.umd.js +21 -21
- package/dist/style.css +1 -1
- package/package.json +2 -1
- package/src/components/CpAlert.vue +38 -30
- package/src/components/CpHeading.vue +4 -5
- package/src/components/CpText.vue +141 -0
- package/src/components/index.ts +2 -0
- package/src/stories/BaseInputLabel.stories.ts +36 -9
- package/src/stories/Colors.mdx +9 -0
- package/src/stories/Colors.stories.ts +177 -0
- package/src/stories/CpAccordion.stories.ts +187 -158
- package/src/stories/CpAccordionGroup.stories.ts +50 -94
- package/src/stories/CpAirlineLogo.stories.ts +49 -28
- package/src/stories/CpAlert.stories.ts +194 -157
- package/src/stories/CpBadge.stories.ts +259 -193
- package/src/stories/CpButton.stories.ts +257 -426
- package/src/stories/CpCheckbox.stories.ts +101 -29
- package/src/stories/CpContextualMenu.stories.ts +9 -8
- package/src/stories/CpDate.stories.ts +52 -25
- package/src/stories/CpDatepicker.stories.ts +57 -88
- package/src/stories/CpDialog.stories.ts +22 -1
- package/src/stories/CpHeading.stories.ts +59 -20
- package/src/stories/CpIcon.stories.ts +98 -31
- package/src/stories/CpInput.stories.ts +142 -67
- package/src/stories/CpItemActions.stories.ts +22 -27
- package/src/stories/CpLoader.stories.ts +54 -6
- package/src/stories/CpMenuItem.stories.ts +52 -26
- package/src/stories/CpMultiselect.stories.ts +52 -71
- package/src/stories/CpPartnerBadge.stories.ts +53 -74
- package/src/stories/CpRadio.stories.ts +44 -48
- package/src/stories/CpRadioGroup.stories.ts +46 -39
- package/src/stories/CpSelect.stories.ts +98 -39
- package/src/stories/CpSelectMenu.stories.ts +49 -57
- package/src/stories/CpSelectableButton.stories.ts +170 -81
- package/src/stories/CpSwitch.stories.ts +135 -133
- package/src/stories/CpTable.stories.ts +54 -1
- package/src/stories/CpTableEmptyState.stories.ts +11 -7
- package/src/stories/CpTabs.stories.ts +22 -4
- package/src/stories/CpTelInput.stories.ts +25 -23
- package/src/stories/CpText.stories.ts +131 -0
- package/src/stories/CpTextarea.stories.ts +59 -23
- package/src/stories/CpToast.stories.ts +53 -103
- package/src/stories/CpTooltip.stories.ts +82 -77
- package/src/stories/CpTransitionCounter.stories.ts +4 -0
- package/src/stories/CpTransitionExpand.stories.ts +11 -6
- package/src/stories/CpTransitionListItems.stories.ts +5 -0
- package/src/stories/CpTransitionSize.stories.ts +8 -0
- package/src/stories/CpTransitionSlide.stories.ts +4 -0
- package/src/stories/CpTransitionTabContent.stories.ts +4 -0
- package/src/stories/Dimensions.mdx +9 -0
- package/src/stories/Dimensions.stories.ts +119 -0
- package/src/stories/Easings.mdx +9 -0
- package/src/stories/Easings.stories.ts +101 -0
- package/src/stories/FocusRings.mdx +9 -0
- package/src/stories/FocusRings.stories.ts +74 -0
- package/src/stories/Shadows.mdx +9 -0
- package/src/stories/Shadows.stories.ts +100 -0
- package/src/stories/Typography.mdx +9 -0
- package/src/stories/Typography.stories.ts +181 -0
- package/src/stories/documentationStyles.ts +2 -10
- package/src/stories/tokenUtils.ts +259 -0
|
@@ -2,32 +2,44 @@ import type { Args, Meta, StoryObj } from '@storybook/vue3'
|
|
|
2
2
|
|
|
3
3
|
import CpBadge from '@/components/CpBadge.vue'
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
import { docCellStyle, docLabelStyle, docRowWrapStyle } from '@/stories/documentationStyles'
|
|
6
|
+
|
|
7
|
+
const badgeColors = [
|
|
8
|
+
'neutral',
|
|
9
|
+
'accent',
|
|
10
|
+
'error',
|
|
11
|
+
'warning',
|
|
12
|
+
'success',
|
|
13
|
+
'blue',
|
|
14
|
+
'pink',
|
|
15
|
+
'magenta',
|
|
16
|
+
'yellow',
|
|
17
|
+
'white',
|
|
18
|
+
] as const
|
|
19
|
+
|
|
20
|
+
const badgeSizes = ['2xs', 'xs', 'sm', 'md'] as const
|
|
21
|
+
|
|
22
|
+
const badgeVariants = ['outline', 'soft', 'solid'] as const
|
|
23
|
+
|
|
24
|
+
const badgeIcons = ['', 'check', 'arrow-right', 'arrow-left', 'arrow-up', 'arrow-down', 'plus'] as const
|
|
13
25
|
|
|
14
26
|
const meta = {
|
|
15
|
-
title: '
|
|
27
|
+
title: 'Atoms/CpBadge',
|
|
16
28
|
component: CpBadge,
|
|
17
29
|
argTypes: {
|
|
18
30
|
color: {
|
|
19
31
|
control: 'select',
|
|
20
|
-
options:
|
|
32
|
+
options: badgeColors,
|
|
21
33
|
description: 'The color variant of the badge',
|
|
22
34
|
},
|
|
23
35
|
size: {
|
|
24
36
|
control: 'select',
|
|
25
|
-
options:
|
|
37
|
+
options: badgeSizes,
|
|
26
38
|
description: 'The size of the badge',
|
|
27
39
|
},
|
|
28
40
|
variant: {
|
|
29
41
|
control: 'select',
|
|
30
|
-
options:
|
|
42
|
+
options: badgeVariants,
|
|
31
43
|
description: 'The variant of the badge',
|
|
32
44
|
},
|
|
33
45
|
disabled: {
|
|
@@ -40,12 +52,12 @@ const meta = {
|
|
|
40
52
|
},
|
|
41
53
|
leadingIcon: {
|
|
42
54
|
control: 'select',
|
|
43
|
-
options:
|
|
55
|
+
options: badgeIcons,
|
|
44
56
|
description: 'Type of leading icon (if any)',
|
|
45
57
|
},
|
|
46
58
|
trailingIcon: {
|
|
47
59
|
control: 'select',
|
|
48
|
-
options:
|
|
60
|
+
options: badgeIcons,
|
|
49
61
|
description: 'Type of trailing icon (if any)',
|
|
50
62
|
},
|
|
51
63
|
label: {
|
|
@@ -72,204 +84,258 @@ const defaultRender = (args: Args) => ({
|
|
|
72
84
|
template: defaultTemplate,
|
|
73
85
|
})
|
|
74
86
|
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Default badge: neutral color, outline variant, medium size. Use the controls
|
|
89
|
+
* to experiment with each prop in isolation.
|
|
90
|
+
*/
|
|
91
|
+
export const Default: Story = {
|
|
92
|
+
args: {
|
|
93
|
+
color: 'neutral',
|
|
94
|
+
size: 'md',
|
|
95
|
+
variant: 'outline',
|
|
96
|
+
isSquare: false,
|
|
97
|
+
disabled: false,
|
|
98
|
+
leadingIcon: '',
|
|
99
|
+
trailingIcon: '',
|
|
100
|
+
label: 'Badge',
|
|
101
|
+
isClearable: false,
|
|
102
|
+
},
|
|
103
|
+
render: defaultRender,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* -------------------------------------------------------------------------- */
|
|
107
|
+
/* Sizes */
|
|
108
|
+
/* -------------------------------------------------------------------------- */
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* All sizes rendered side by side, from `2xs` to `md`.
|
|
112
|
+
*/
|
|
113
|
+
export const Sizes: Story = {
|
|
114
|
+
parameters: { controls: { disable: true } },
|
|
77
115
|
render: () => ({
|
|
78
116
|
components: { CpBadge },
|
|
79
|
-
setup
|
|
117
|
+
setup() {
|
|
118
|
+
return { badgeSizes, docCellStyle, docLabelStyle, docRowWrapStyle }
|
|
119
|
+
},
|
|
80
120
|
template: `
|
|
81
|
-
<div>
|
|
82
|
-
<div style="
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
<CpBadge color="accent" size="2xs" label="Badge" />
|
|
91
|
-
</div>
|
|
92
|
-
<div style="${docCellStyle}">
|
|
93
|
-
<span style="${docLabelStyle}">xs</span>
|
|
94
|
-
<CpBadge color="accent" size="xs" label="Badge" />
|
|
95
|
-
</div>
|
|
96
|
-
<div style="${docCellStyle}">
|
|
97
|
-
<span style="${docLabelStyle}">sm</span>
|
|
98
|
-
<CpBadge color="accent" size="sm" label="Badge" />
|
|
99
|
-
</div>
|
|
100
|
-
<div style="${docCellStyle}">
|
|
101
|
-
<span style="${docLabelStyle}">md</span>
|
|
102
|
-
<CpBadge color="accent" size="md" label="Badge" />
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
105
|
-
</section>
|
|
121
|
+
<div :style="docRowWrapStyle">
|
|
122
|
+
<div v-for="size in badgeSizes" :key="size" :style="docCellStyle">
|
|
123
|
+
<span :style="docLabelStyle">{{ size }}</span>
|
|
124
|
+
<CpBadge color="accent" :size="size" label="Badge" />
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
`,
|
|
128
|
+
}),
|
|
129
|
+
}
|
|
106
130
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
<div style="${docCellStyle}">
|
|
111
|
-
<span style="${docLabelStyle}">neutral</span>
|
|
112
|
-
<CpBadge color="neutral" label="Badge" />
|
|
113
|
-
</div>
|
|
114
|
-
<div style="${docCellStyle}">
|
|
115
|
-
<span style="${docLabelStyle}">accent</span>
|
|
116
|
-
<CpBadge color="accent" label="Badge" />
|
|
117
|
-
</div>
|
|
118
|
-
<div style="${docCellStyle}">
|
|
119
|
-
<span style="${docLabelStyle}">error</span>
|
|
120
|
-
<CpBadge color="error" label="Badge" />
|
|
121
|
-
</div>
|
|
122
|
-
<div style="${docCellStyle}">
|
|
123
|
-
<span style="${docLabelStyle}">warning</span>
|
|
124
|
-
<CpBadge color="warning" label="Badge" />
|
|
125
|
-
</div>
|
|
126
|
-
<div style="${docCellStyle}">
|
|
127
|
-
<span style="${docLabelStyle}">success</span>
|
|
128
|
-
<CpBadge color="success" label="Badge" />
|
|
129
|
-
</div>
|
|
130
|
-
<div style="${docCellStyle}">
|
|
131
|
-
<span style="${docLabelStyle}">blue</span>
|
|
132
|
-
<CpBadge color="blue" label="Badge" />
|
|
133
|
-
</div>
|
|
134
|
-
<div style="${docCellStyle}">
|
|
135
|
-
<span style="${docLabelStyle}">pink</span>
|
|
136
|
-
<CpBadge color="pink" label="Badge" />
|
|
137
|
-
</div>
|
|
138
|
-
<div style="${docCellStyle}">
|
|
139
|
-
<span style="${docLabelStyle}">magenta</span>
|
|
140
|
-
<CpBadge color="magenta" label="Badge" />
|
|
141
|
-
</div>
|
|
142
|
-
<div style="${docCellStyle}">
|
|
143
|
-
<span style="${docLabelStyle}">yellow</span>
|
|
144
|
-
<CpBadge color="yellow" label="Badge" />
|
|
145
|
-
</div>
|
|
146
|
-
<div style="${docCellStyle}">
|
|
147
|
-
<span style="${docLabelStyle}">white</span>
|
|
148
|
-
<CpBadge color="white" label="Badge" />
|
|
149
|
-
</div>
|
|
150
|
-
</div>
|
|
151
|
-
</section>
|
|
131
|
+
/* -------------------------------------------------------------------------- */
|
|
132
|
+
/* Colors */
|
|
133
|
+
/* -------------------------------------------------------------------------- */
|
|
152
134
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Every semantic and utility color available for the badge.
|
|
137
|
+
*/
|
|
138
|
+
export const Colors: Story = {
|
|
139
|
+
parameters: { controls: { disable: true } },
|
|
140
|
+
render: () => ({
|
|
141
|
+
components: { CpBadge },
|
|
142
|
+
setup() {
|
|
143
|
+
return { badgeColors, docCellStyle, docLabelStyle, docRowWrapStyle }
|
|
144
|
+
},
|
|
145
|
+
template: `
|
|
146
|
+
<div :style="docRowWrapStyle">
|
|
147
|
+
<div v-for="color in badgeColors" :key="color" :style="docCellStyle">
|
|
148
|
+
<span :style="docLabelStyle">{{ color }}</span>
|
|
149
|
+
<CpBadge :color="color" label="Badge" />
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
`,
|
|
153
|
+
}),
|
|
154
|
+
}
|
|
172
155
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
<div style="${docCellStyle}">
|
|
177
|
-
<span style="${docLabelStyle}">false</span>
|
|
178
|
-
<CpBadge color="accent" label="Badge" />
|
|
179
|
-
</div>
|
|
180
|
-
<div style="${docCellStyle}">
|
|
181
|
-
<span style="${docLabelStyle}">true</span>
|
|
182
|
-
<CpBadge color="accent" :disabled="true" label="Badge" />
|
|
183
|
-
</div>
|
|
184
|
-
</div>
|
|
185
|
-
</section>
|
|
156
|
+
/* -------------------------------------------------------------------------- */
|
|
157
|
+
/* Variants */
|
|
158
|
+
/* -------------------------------------------------------------------------- */
|
|
186
159
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
160
|
+
/**
|
|
161
|
+
* Variant × color matrix, showing how each variant renders across every color.
|
|
162
|
+
*/
|
|
163
|
+
export const Variants: Story = {
|
|
164
|
+
parameters: { controls: { disable: true } },
|
|
165
|
+
render: () => ({
|
|
166
|
+
components: { CpBadge },
|
|
167
|
+
setup() {
|
|
168
|
+
return { badgeColors, badgeVariants }
|
|
169
|
+
},
|
|
170
|
+
template: `
|
|
171
|
+
<table style="border-collapse: collapse; width: 100%;">
|
|
172
|
+
<thead>
|
|
173
|
+
<tr>
|
|
174
|
+
<th style="text-align: left; padding: 8px 12px; font-size: 12px; color: #666; font-weight: 500;"></th>
|
|
175
|
+
<th
|
|
176
|
+
v-for="color in badgeColors"
|
|
177
|
+
:key="color"
|
|
178
|
+
style="text-align: center; padding: 8px 12px; font-size: 12px; color: #666; font-weight: 500; text-transform: capitalize;"
|
|
179
|
+
>
|
|
180
|
+
{{ color }}
|
|
181
|
+
</th>
|
|
182
|
+
</tr>
|
|
183
|
+
</thead>
|
|
184
|
+
<tbody>
|
|
185
|
+
<tr v-for="variant in badgeVariants" :key="variant">
|
|
186
|
+
<td style="padding: 8px 12px; font-size: 12px; color: #666; text-transform: capitalize;">{{ variant }}</td>
|
|
187
|
+
<td
|
|
188
|
+
v-for="color in badgeColors"
|
|
189
|
+
:key="color"
|
|
190
|
+
style="padding: 8px 12px; text-align: center;"
|
|
191
|
+
>
|
|
192
|
+
<CpBadge :color="color" :variant="variant" label="Badge" />
|
|
193
|
+
</td>
|
|
194
|
+
</tr>
|
|
195
|
+
</tbody>
|
|
196
|
+
</table>
|
|
197
|
+
`,
|
|
198
|
+
}),
|
|
199
|
+
}
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
<div style="${docCellStyle}">
|
|
205
|
-
<span style="${docLabelStyle}">default</span>
|
|
206
|
-
<CpBadge color="accent" label="Badge" />
|
|
207
|
-
</div>
|
|
208
|
-
<div style="${docCellStyle}">
|
|
209
|
-
<span style="${docLabelStyle}">leading</span>
|
|
210
|
-
<CpBadge color="accent" leading-icon="check" label="Badge" />
|
|
211
|
-
</div>
|
|
212
|
-
<div style="${docCellStyle}">
|
|
213
|
-
<span style="${docLabelStyle}">leading + trailing</span>
|
|
214
|
-
<CpBadge color="accent" leading-icon="check" trailing-icon="arrow-right" label="Badge" />
|
|
215
|
-
</div>
|
|
216
|
-
<div style="${docCellStyle}">
|
|
217
|
-
<span style="${docLabelStyle}">trailing</span>
|
|
218
|
-
<CpBadge color="accent" trailing-icon="arrow-right" label="Badge" />
|
|
219
|
-
</div>
|
|
220
|
-
<div style="${docCellStyle}">
|
|
221
|
-
<span style="${docLabelStyle}">without label</span>
|
|
222
|
-
<CpBadge color="accent" leading-icon="check" />
|
|
223
|
-
</div>
|
|
224
|
-
</div>
|
|
225
|
-
</section>
|
|
201
|
+
/* -------------------------------------------------------------------------- */
|
|
202
|
+
/* Disabled */
|
|
203
|
+
/* -------------------------------------------------------------------------- */
|
|
226
204
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
205
|
+
/**
|
|
206
|
+
* Enabled and disabled states compared side by side.
|
|
207
|
+
*/
|
|
208
|
+
export const Disabled: Story = {
|
|
209
|
+
parameters: { controls: { disable: true } },
|
|
210
|
+
render: () => ({
|
|
211
|
+
components: { CpBadge },
|
|
212
|
+
setup() {
|
|
213
|
+
return { docCellStyle, docLabelStyle, docRowWrapStyle }
|
|
214
|
+
},
|
|
215
|
+
template: `
|
|
216
|
+
<div :style="docRowWrapStyle">
|
|
217
|
+
<div :style="docCellStyle">
|
|
218
|
+
<span :style="docLabelStyle">Enabled</span>
|
|
219
|
+
<CpBadge color="accent" label="Badge" />
|
|
220
|
+
</div>
|
|
221
|
+
<div :style="docCellStyle">
|
|
222
|
+
<span :style="docLabelStyle">Disabled</span>
|
|
223
|
+
<CpBadge color="accent" :disabled="true" label="Badge" />
|
|
244
224
|
</div>
|
|
245
225
|
</div>
|
|
246
226
|
`,
|
|
247
227
|
}),
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/* -------------------------------------------------------------------------- */
|
|
231
|
+
/* Square vs rounded */
|
|
232
|
+
/* -------------------------------------------------------------------------- */
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Fully rounded (default) compared with the square variant.
|
|
236
|
+
*/
|
|
237
|
+
export const Squared: Story = {
|
|
238
|
+
parameters: { controls: { disable: true } },
|
|
239
|
+
render: () => ({
|
|
240
|
+
components: { CpBadge },
|
|
241
|
+
setup() {
|
|
242
|
+
return { docCellStyle, docLabelStyle, docRowWrapStyle }
|
|
254
243
|
},
|
|
255
|
-
|
|
244
|
+
template: `
|
|
245
|
+
<div :style="docRowWrapStyle">
|
|
246
|
+
<div :style="docCellStyle">
|
|
247
|
+
<span :style="docLabelStyle">Rounded</span>
|
|
248
|
+
<CpBadge color="accent" :is-square="false" label="Badge" />
|
|
249
|
+
</div>
|
|
250
|
+
<div :style="docCellStyle">
|
|
251
|
+
<span :style="docLabelStyle">Square</span>
|
|
252
|
+
<CpBadge color="accent" :is-square="true" label="Badge" />
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
`,
|
|
256
|
+
}),
|
|
256
257
|
}
|
|
257
258
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
259
|
+
/* -------------------------------------------------------------------------- */
|
|
260
|
+
/* Icons */
|
|
261
|
+
/* -------------------------------------------------------------------------- */
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Badge with a leading icon.
|
|
265
|
+
*/
|
|
266
|
+
export const WithLeadingIcon: Story = {
|
|
267
|
+
args: { ...Default.args, color: 'accent', leadingIcon: 'check' },
|
|
268
|
+
render: defaultRender,
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Badge with a trailing icon.
|
|
273
|
+
*/
|
|
274
|
+
export const WithTrailingIcon: Story = {
|
|
275
|
+
args: { ...Default.args, color: 'accent', trailingIcon: 'arrow-right' },
|
|
276
|
+
render: defaultRender,
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Badge with both a leading and a trailing icon.
|
|
281
|
+
*/
|
|
282
|
+
export const WithBothIcons: Story = {
|
|
283
|
+
args: { ...Default.args, color: 'accent', leadingIcon: 'check', trailingIcon: 'arrow-right' },
|
|
270
284
|
render: defaultRender,
|
|
271
285
|
}
|
|
272
286
|
|
|
287
|
+
/**
|
|
288
|
+
* Badge without a label, acting as an icon-only indicator.
|
|
289
|
+
*/
|
|
290
|
+
export const WithoutLabel: Story = {
|
|
291
|
+
args: { ...Default.args, color: 'accent', leadingIcon: 'check', label: '' },
|
|
292
|
+
render: defaultRender,
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/* -------------------------------------------------------------------------- */
|
|
296
|
+
/* Clearable */
|
|
297
|
+
/* -------------------------------------------------------------------------- */
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* The clearable affordance shows up when `isClearable` is `true` and an
|
|
301
|
+
* `onClear` listener is provided. The clear button follows the badge disabled
|
|
302
|
+
* state.
|
|
303
|
+
*/
|
|
304
|
+
export const Clearable: Story = {
|
|
305
|
+
parameters: { controls: { disable: true } },
|
|
306
|
+
render: () => ({
|
|
307
|
+
components: { CpBadge },
|
|
308
|
+
setup() {
|
|
309
|
+
const onClear = () => console.log('clear')
|
|
310
|
+
return { docCellStyle, docLabelStyle, docRowWrapStyle, onClear }
|
|
311
|
+
},
|
|
312
|
+
template: `
|
|
313
|
+
<div :style="docRowWrapStyle">
|
|
314
|
+
<div :style="docCellStyle">
|
|
315
|
+
<span :style="docLabelStyle">Not clearable</span>
|
|
316
|
+
<CpBadge color="accent" label="Badge" />
|
|
317
|
+
</div>
|
|
318
|
+
<div :style="docCellStyle">
|
|
319
|
+
<span :style="docLabelStyle">Clearable</span>
|
|
320
|
+
<CpBadge color="accent" :is-clearable="true" label="Badge" @on-clear="onClear" />
|
|
321
|
+
</div>
|
|
322
|
+
<div :style="docCellStyle">
|
|
323
|
+
<span :style="docLabelStyle">Clearable (disabled)</span>
|
|
324
|
+
<CpBadge color="accent" :is-clearable="true" :disabled="true" label="Badge" @on-clear="onClear" />
|
|
325
|
+
</div>
|
|
326
|
+
</div>
|
|
327
|
+
`,
|
|
328
|
+
}),
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/* -------------------------------------------------------------------------- */
|
|
332
|
+
/* Slots */
|
|
333
|
+
/* -------------------------------------------------------------------------- */
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Customize the icons and the label through `#leading-icon`, `#trailing-icon`
|
|
337
|
+
* and the default slot.
|
|
338
|
+
*/
|
|
273
339
|
export const WithSlot: Story = {
|
|
274
340
|
render: (args: Args) => ({
|
|
275
341
|
components: { CpBadge },
|