@citizenplane/pimp 9.4.6 → 9.5.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 +2692 -2634
- package/dist/pimp.umd.js +18 -18
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/CpButton.vue +19 -3
- package/src/components/CpButtonGroup.vue +35 -0
- package/src/components/CpContextualMenu.vue +19 -1
- package/src/components/CpItemActions.vue +93 -0
- package/src/components/CpMenuItem.vue +5 -1
- package/src/components/index.ts +4 -0
- package/src/stories/CpItemActions.stories.ts +70 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
4
|
+
import type { MenuItem } from 'primevue/menuitem'
|
|
5
|
+
|
|
6
|
+
import CpItemActions from '@/components/CpItemActions.vue'
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'CpItemActions',
|
|
10
|
+
component: CpItemActions,
|
|
11
|
+
argTypes: {
|
|
12
|
+
actions: {
|
|
13
|
+
control: 'object',
|
|
14
|
+
description: 'The actions to display',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof CpItemActions>
|
|
18
|
+
|
|
19
|
+
export default meta
|
|
20
|
+
type Story = StoryObj<typeof meta>
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
render: () => ({
|
|
24
|
+
components: { CpItemActions },
|
|
25
|
+
setup() {
|
|
26
|
+
const actions: MenuItem[] = ref([
|
|
27
|
+
{
|
|
28
|
+
icon: 'edit',
|
|
29
|
+
label: 'Action 1',
|
|
30
|
+
command: () => alert('Action 1 clicked'),
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
icon: 'download',
|
|
34
|
+
label: 'Action 3',
|
|
35
|
+
command: () => alert('Action 3 clicked'),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
icon: 'trash-2',
|
|
39
|
+
label: 'Action 2',
|
|
40
|
+
command: () => alert('Action 2 clicked'),
|
|
41
|
+
isCritical: true,
|
|
42
|
+
},
|
|
43
|
+
])
|
|
44
|
+
|
|
45
|
+
const listItems = [1, 2, 3, 4]
|
|
46
|
+
|
|
47
|
+
const listItemStyle = {
|
|
48
|
+
padding: '16px',
|
|
49
|
+
border: '1px solid #ccc',
|
|
50
|
+
borderRadius: '12px',
|
|
51
|
+
marginBottom: '16px',
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return { actions, listItemStyle, listItems }
|
|
55
|
+
},
|
|
56
|
+
template: `
|
|
57
|
+
<div style="padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 400px;">
|
|
58
|
+
<ul>
|
|
59
|
+
<li v-for="(item, index) in listItems" :key="item" :style="listItemStyle" cp-item-actions-trigger>
|
|
60
|
+
<p>Item {{ index + 1 }}</p>
|
|
61
|
+
<CpItemActions
|
|
62
|
+
size="xs"
|
|
63
|
+
:actions="actions"
|
|
64
|
+
/>
|
|
65
|
+
</li>
|
|
66
|
+
</ul>
|
|
67
|
+
</div>
|
|
68
|
+
`,
|
|
69
|
+
}),
|
|
70
|
+
}
|