@citizenplane/pimp 16.0.2 → 16.0.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 +30 -26
- package/dist/pimp.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/CpAlert.vue +38 -30
- package/src/stories/CpAlert.stories.ts +2 -2
package/package.json
CHANGED
|
@@ -98,37 +98,39 @@ const emit = defineEmits<{
|
|
|
98
98
|
|
|
99
99
|
const slots = useSlots()
|
|
100
100
|
|
|
101
|
-
const colorProps = {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
primaryActionAppearance: 'secondary',
|
|
105
|
-
secondaryActionAppearance: 'tertiary',
|
|
106
|
-
},
|
|
107
|
-
accent: {
|
|
108
|
-
icon: 'info',
|
|
109
|
-
primaryActionAppearance: 'primary',
|
|
101
|
+
const colorProps = computed(() => {
|
|
102
|
+
const defaultProps = {
|
|
103
|
+
primaryActionAppearance: isExpanded.value ? 'primary' : 'secondary',
|
|
110
104
|
secondaryActionAppearance: 'secondary',
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
neutral: {
|
|
108
|
+
icon: 'dashed-circle',
|
|
109
|
+
primaryActionAppearance: isExpanded.value ? 'secondary' : 'tertiary',
|
|
110
|
+
secondaryActionAppearance: 'tertiary',
|
|
111
|
+
},
|
|
112
|
+
accent: {
|
|
113
|
+
...defaultProps,
|
|
114
|
+
icon: 'info',
|
|
115
|
+
},
|
|
116
|
+
success: {
|
|
117
|
+
...defaultProps,
|
|
118
|
+
icon: 'check',
|
|
119
|
+
},
|
|
120
|
+
warning: {
|
|
121
|
+
...defaultProps,
|
|
122
|
+
icon: 'alert-triangle',
|
|
123
|
+
},
|
|
124
|
+
error: {
|
|
125
|
+
...defaultProps,
|
|
126
|
+
icon: 'x-octagon',
|
|
127
|
+
},
|
|
128
|
+
}
|
|
129
|
+
})
|
|
128
130
|
|
|
129
131
|
const alertIcon = computed(() => {
|
|
130
132
|
if (props.icon) return props.icon
|
|
131
|
-
return colorProps[props.color].icon
|
|
133
|
+
return colorProps.value[props.color].icon
|
|
132
134
|
})
|
|
133
135
|
|
|
134
136
|
const isExpanded = computed(() => props.type === 'expanded')
|
|
@@ -136,9 +138,11 @@ const hasTitle = computed(() => !!props.title || !!slots.title)
|
|
|
136
138
|
const hasContent = computed(() => isExpanded.value && (!!props.content || !!slots.default))
|
|
137
139
|
const hasActions = computed(() => hasPrimaryAction.value || hasSecondaryAction.value)
|
|
138
140
|
const hasPrimaryAction = computed(() => !!props.primaryActionLabel || !!slots['primary-action'])
|
|
139
|
-
const hasSecondaryAction = computed(
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
const hasSecondaryAction = computed(
|
|
142
|
+
() => isExpanded.value && (!!props.secondaryActionLabel || !!slots['secondary-action']),
|
|
143
|
+
)
|
|
144
|
+
const primaryActionAppearance = computed(() => colorProps.value[props.color].primaryActionAppearance)
|
|
145
|
+
const secondaryActionAppearance = computed(() => colorProps.value[props.color].secondaryActionAppearance)
|
|
142
146
|
const actionsSize = computed(() => (isExpanded.value ? 'sm' : 'xs'))
|
|
143
147
|
|
|
144
148
|
const dynamicClasses = computed(() => [
|
|
@@ -197,6 +201,10 @@ const dynamicClasses = computed(() => [
|
|
|
197
201
|
gap: var(--cp-spacing-md);
|
|
198
202
|
}
|
|
199
203
|
|
|
204
|
+
&__close {
|
|
205
|
+
align-self: flex-start;
|
|
206
|
+
}
|
|
207
|
+
|
|
200
208
|
&__title {
|
|
201
209
|
font-size: var(--cp-text-size-sm);
|
|
202
210
|
line-height: var(--cp-line-height-sm);
|
|
@@ -217,11 +217,11 @@ export const Documentation: Story = {
|
|
|
217
217
|
|
|
218
218
|
export const Default: Story = {
|
|
219
219
|
args: {
|
|
220
|
-
color: '
|
|
220
|
+
color: 'neutral',
|
|
221
221
|
type: 'expanded',
|
|
222
222
|
title: 'Alert title',
|
|
223
223
|
content: 'This is an informational alert message.',
|
|
224
|
-
isClosable:
|
|
224
|
+
isClosable: false,
|
|
225
225
|
icon: undefined,
|
|
226
226
|
primaryActionLabel: undefined,
|
|
227
227
|
secondaryActionLabel: undefined,
|