@citizenplane/pimp 16.3.2 → 16.3.4
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/package.json
CHANGED
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
<slot name="leading-icon" />
|
|
14
14
|
</span>
|
|
15
15
|
<span v-if="showText" class="cpSelectableButton__label">
|
|
16
|
-
|
|
16
|
+
<slot>
|
|
17
|
+
{{ label }}
|
|
18
|
+
</slot>
|
|
17
19
|
</span>
|
|
18
20
|
<span v-if="showTrailingIcon" class="cpSelectableButton__icon cpSelectableButton__icon--isAfter">
|
|
19
21
|
<slot name="trailing-icon" />
|
|
@@ -51,8 +53,9 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
51
53
|
const slots = useSlots()
|
|
52
54
|
|
|
53
55
|
const showLeadingIcon = computed(() => !!slots['leading-icon'])
|
|
54
|
-
const showText = computed(() => !!props.label)
|
|
56
|
+
const showText = computed(() => !!props.label || !!slots.default)
|
|
55
57
|
const showTrailingIcon = computed(() => !!slots['trailing-icon'])
|
|
58
|
+
const isIconOnly = computed(() => !props.label)
|
|
56
59
|
|
|
57
60
|
const dynamicClasses = computed(() => {
|
|
58
61
|
return [
|
|
@@ -62,6 +65,7 @@ const dynamicClasses = computed(() => {
|
|
|
62
65
|
'cpSelectableButton--isSelected': props.isSelected,
|
|
63
66
|
'cpSelectableButton--isExpanded': props.isExpanded,
|
|
64
67
|
'cpSelectableButton--isDisabled': props.disabled,
|
|
68
|
+
'cpSelectableButton--isIconOnly': isIconOnly.value,
|
|
65
69
|
},
|
|
66
70
|
]
|
|
67
71
|
})
|
|
@@ -149,6 +153,10 @@ const dynamicClasses = computed(() => {
|
|
|
149
153
|
--cp-selectable-body-background-color-hover: var(--cp-background-accent-solid-hover);
|
|
150
154
|
--cp-selectable-box-shadow: var(--cp-shadows-3xs-inset);
|
|
151
155
|
|
|
156
|
+
&.cpSelectableButton--isIconOnly {
|
|
157
|
+
--cp-selectable-body-padding: var(--cp-spacing-sm-md);
|
|
158
|
+
}
|
|
159
|
+
|
|
152
160
|
&--sm {
|
|
153
161
|
--cp-selectable-border-padding: var(--cp-spacing-sm);
|
|
154
162
|
--cp-selectable-border-radius: var(--cp-radius-sm-md);
|
|
@@ -160,6 +168,10 @@ const dynamicClasses = computed(() => {
|
|
|
160
168
|
--cp-selectable-icon-size: var(--cp-dimensions-4);
|
|
161
169
|
}
|
|
162
170
|
|
|
171
|
+
&--sm.cpSelectableButton--isIconOnly {
|
|
172
|
+
--cp-selectable-body-padding: var(--cp-spacing-sm);
|
|
173
|
+
}
|
|
174
|
+
|
|
163
175
|
&--xs {
|
|
164
176
|
--cp-selectable-border-padding: var(--cp-spacing-xs);
|
|
165
177
|
--cp-selectable-border-radius: var(--cp-radius-sm-md);
|
|
@@ -171,6 +183,10 @@ const dynamicClasses = computed(() => {
|
|
|
171
183
|
--cp-selectable-icon-size: var(--cp-dimensions-4);
|
|
172
184
|
}
|
|
173
185
|
|
|
186
|
+
&--xs.cpSelectableButton--isIconOnly {
|
|
187
|
+
--cp-selectable-body-padding: var(--cp-spacing-sm);
|
|
188
|
+
}
|
|
189
|
+
|
|
174
190
|
&--2xs {
|
|
175
191
|
--cp-selectable-border-padding: var(--cp-spacing-xs);
|
|
176
192
|
--cp-selectable-border-radius: var(--cp-radius-sm-md);
|
|
@@ -182,6 +198,10 @@ const dynamicClasses = computed(() => {
|
|
|
182
198
|
--cp-selectable-icon-size: var(--cp-dimensions-3_5);
|
|
183
199
|
}
|
|
184
200
|
|
|
201
|
+
&--2xs.cpSelectableButton--isIconOnly {
|
|
202
|
+
--cp-selectable-body-padding: var(--cp-spacing-sm);
|
|
203
|
+
}
|
|
204
|
+
|
|
185
205
|
&--3xs {
|
|
186
206
|
--cp-selectable-border-padding: var(--cp-spacing-none);
|
|
187
207
|
--cp-selectable-border-radius: var(--cp-radius-sm);
|
|
@@ -193,6 +213,10 @@ const dynamicClasses = computed(() => {
|
|
|
193
213
|
--cp-selectable-icon-size: var(--cp-dimensions-3);
|
|
194
214
|
}
|
|
195
215
|
|
|
216
|
+
&--3xs.cpSelectableButton--isIconOnly {
|
|
217
|
+
--cp-selectable-body-padding: var(--cp-spacing-sm);
|
|
218
|
+
}
|
|
219
|
+
|
|
196
220
|
&--isSelected {
|
|
197
221
|
--cp-selectable-border-color: transparent;
|
|
198
222
|
--cp-selectable-border-color-hover: transparent;
|
|
@@ -174,7 +174,6 @@ export const WithIcons: Story = {
|
|
|
174
174
|
args: {
|
|
175
175
|
appearance: 'primary',
|
|
176
176
|
size: 'md',
|
|
177
|
-
label: 'Label',
|
|
178
177
|
},
|
|
179
178
|
render: (args: Args) => ({
|
|
180
179
|
components: { CpSelectableButton },
|
|
@@ -186,6 +185,7 @@ export const WithIcons: Story = {
|
|
|
186
185
|
<template #leading-icon>
|
|
187
186
|
<CpIcon type="circle" />
|
|
188
187
|
</template>
|
|
188
|
+
Custom label
|
|
189
189
|
<template #trailing-icon>
|
|
190
190
|
<CpIcon type="circle" />
|
|
191
191
|
</template>
|
|
@@ -224,6 +224,27 @@ export const FullWidth: Story = {
|
|
|
224
224
|
}),
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
+
/* -------------------------------------------------------------------------- */
|
|
228
|
+
/* Icon only */
|
|
229
|
+
/* -------------------------------------------------------------------------- */
|
|
230
|
+
export const IconOnly: Story = {
|
|
231
|
+
args: {
|
|
232
|
+
appearance: 'primary',
|
|
233
|
+
size: 'md',
|
|
234
|
+
},
|
|
235
|
+
render: (args: Args) => ({
|
|
236
|
+
components: { CpSelectableButton },
|
|
237
|
+
setup() {
|
|
238
|
+
return { args }
|
|
239
|
+
},
|
|
240
|
+
template: `
|
|
241
|
+
<CpSelectableButton v-bind="args">
|
|
242
|
+
<template #leading-icon><CpIcon type="circle" /></template>
|
|
243
|
+
</CpSelectableButton>
|
|
244
|
+
`,
|
|
245
|
+
}),
|
|
246
|
+
}
|
|
247
|
+
|
|
227
248
|
/* -------------------------------------------------------------------------- */
|
|
228
249
|
/* Matrix */
|
|
229
250
|
/* -------------------------------------------------------------------------- */
|