@citizenplane/pimp 9.16.2 → 10.0.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 +5419 -7042
- package/dist/pimp.umd.js +44 -44
- package/dist/style.css +1 -1
- package/package.json +1 -2
- package/src/components/CpSelectMenu.vue +1 -13
- package/src/components/CpToast.vue +27 -0
- package/src/components/index.ts +1 -10
- package/src/components/CpToaster.vue +0 -382
- package/src/plugins/toaster.ts +0 -71
- package/src/stories/CpToaster.stories.ts +0 -188
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
-
|
|
3
|
-
import CpToaster from '@/components/CpToaster.vue'
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'CpToaster',
|
|
7
|
-
component: CpToaster,
|
|
8
|
-
argTypes: {
|
|
9
|
-
actionAs: {
|
|
10
|
-
control: 'select',
|
|
11
|
-
options: ['link', 'button'],
|
|
12
|
-
description: 'Determines if the action is a link or a button',
|
|
13
|
-
},
|
|
14
|
-
actionLinkProperties: {
|
|
15
|
-
control: 'object',
|
|
16
|
-
description: 'Properties for the action link when actionAs is "link"',
|
|
17
|
-
},
|
|
18
|
-
title: {
|
|
19
|
-
control: 'text',
|
|
20
|
-
description: 'The title of the toast',
|
|
21
|
-
},
|
|
22
|
-
description: {
|
|
23
|
-
control: 'text',
|
|
24
|
-
description: 'The description of the toast',
|
|
25
|
-
},
|
|
26
|
-
type: {
|
|
27
|
-
control: 'select',
|
|
28
|
-
options: ['info', 'warning', 'success', 'critical'],
|
|
29
|
-
description: 'The type of the toast',
|
|
30
|
-
},
|
|
31
|
-
delayBeforeCloseInMs: {
|
|
32
|
-
control: 'number',
|
|
33
|
-
description: 'Duration in milliseconds before the toast disappears',
|
|
34
|
-
},
|
|
35
|
-
actionLabel: {
|
|
36
|
-
control: 'text',
|
|
37
|
-
description: 'Label for the action button',
|
|
38
|
-
},
|
|
39
|
-
isUnique: {
|
|
40
|
-
control: 'boolean',
|
|
41
|
-
description: 'Whether the toast should be unique',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
} satisfies Meta<typeof CpToaster>
|
|
45
|
-
|
|
46
|
-
export default meta
|
|
47
|
-
type Story = StoryObj<typeof meta>
|
|
48
|
-
|
|
49
|
-
const defaultArgs = {
|
|
50
|
-
title: 'Default Toast',
|
|
51
|
-
description: 'This is a default toast message',
|
|
52
|
-
type: 'info',
|
|
53
|
-
delayBeforeCloseInMs: 3000,
|
|
54
|
-
actionLabel: '',
|
|
55
|
-
isUnique: false,
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export const Default: Story = {
|
|
59
|
-
args: defaultArgs,
|
|
60
|
-
render: (args) => ({
|
|
61
|
-
template: `
|
|
62
|
-
<div style="padding: 20px;">
|
|
63
|
-
<cp-button @click="addInfoToaster">Show Info Toast</cp-button>
|
|
64
|
-
</div>
|
|
65
|
-
`,
|
|
66
|
-
methods: {
|
|
67
|
-
addInfoToaster() {
|
|
68
|
-
this.$toaster.info({ ...args })
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
}),
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export const DifferentTypes: Story = {
|
|
75
|
-
args: defaultArgs,
|
|
76
|
-
render: () => ({
|
|
77
|
-
template: `
|
|
78
|
-
<div style="padding: 20px; display: flex; flex-direction: column; gap: 16px;">
|
|
79
|
-
<cp-button @click="addInfoToaster">Show Info Toast</cp-button>
|
|
80
|
-
<cp-button @click="addSuccessToaster">Show Success Toast</cp-button>
|
|
81
|
-
<cp-button @click="addWarningToaster">Show Warning Toast</cp-button>
|
|
82
|
-
<cp-button @click="addCriticalToaster">Show Critical Toast</cp-button>
|
|
83
|
-
</div>
|
|
84
|
-
`,
|
|
85
|
-
methods: {
|
|
86
|
-
addInfoToaster() {
|
|
87
|
-
this.$toaster.info({
|
|
88
|
-
title: 'This is an info toaster',
|
|
89
|
-
description: 'This a description of a toaster',
|
|
90
|
-
isUnique: true,
|
|
91
|
-
})
|
|
92
|
-
},
|
|
93
|
-
addSuccessToaster() {
|
|
94
|
-
this.$toaster.success({
|
|
95
|
-
title: 'This is a success toaster',
|
|
96
|
-
description: 'This a description of a toaster',
|
|
97
|
-
isUnique: true,
|
|
98
|
-
})
|
|
99
|
-
},
|
|
100
|
-
addWarningToaster() {
|
|
101
|
-
this.$toaster.warning({
|
|
102
|
-
title: 'This is a warning toaster',
|
|
103
|
-
description: 'This a description of a toaster',
|
|
104
|
-
isUnique: true,
|
|
105
|
-
})
|
|
106
|
-
},
|
|
107
|
-
addCriticalToaster() {
|
|
108
|
-
this.$toaster.critical({
|
|
109
|
-
title: 'This is a critical toaster',
|
|
110
|
-
description: 'This a description of a toaster',
|
|
111
|
-
isUnique: true,
|
|
112
|
-
})
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
}),
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export const WithActionAsLink: Story = {
|
|
119
|
-
args: defaultArgs,
|
|
120
|
-
render: () => ({
|
|
121
|
-
template: `
|
|
122
|
-
<div style="padding: 20px;">
|
|
123
|
-
<cp-button @click="addLinkToaster">Show Toast with Action</cp-button>
|
|
124
|
-
</div>
|
|
125
|
-
`,
|
|
126
|
-
methods: {
|
|
127
|
-
addLinkToaster() {
|
|
128
|
-
this.$toaster.success({
|
|
129
|
-
title: 'This is a success toaster',
|
|
130
|
-
description: 'Description of a toaster with a link',
|
|
131
|
-
actionAs: 'link',
|
|
132
|
-
actionLabel: 'See flight information',
|
|
133
|
-
actionLinkProperties: {
|
|
134
|
-
href: 'http://app.citizenplane.com',
|
|
135
|
-
target: '_blank',
|
|
136
|
-
rel: 'noopener noreferrer',
|
|
137
|
-
},
|
|
138
|
-
isUnique: true,
|
|
139
|
-
})
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
}),
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export const WithActionAsButton: Story = {
|
|
146
|
-
args: defaultArgs,
|
|
147
|
-
render: () => ({
|
|
148
|
-
template: `
|
|
149
|
-
<div style="padding: 20px;">
|
|
150
|
-
<cp-button @click="addLinkToaster">Show Toast with Action</cp-button>
|
|
151
|
-
</div>
|
|
152
|
-
`,
|
|
153
|
-
methods: {
|
|
154
|
-
addLinkToaster() {
|
|
155
|
-
this.$toaster.success({
|
|
156
|
-
title: 'This is a success toaster',
|
|
157
|
-
description: 'Description of a toaster with a link',
|
|
158
|
-
actionLabel: 'See flight information',
|
|
159
|
-
isUnique: true,
|
|
160
|
-
actionMethod: () => {
|
|
161
|
-
alert('Action button clicked!')
|
|
162
|
-
},
|
|
163
|
-
})
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
}),
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export const CustomDuration: Story = {
|
|
170
|
-
args: defaultArgs,
|
|
171
|
-
render: () => ({
|
|
172
|
-
template: `
|
|
173
|
-
<div style="padding: 20px;">
|
|
174
|
-
<cp-button @click="addLongDurationToaster">Show Long Duration Toast</cp-button>
|
|
175
|
-
</div>
|
|
176
|
-
`,
|
|
177
|
-
methods: {
|
|
178
|
-
addLongDurationToaster() {
|
|
179
|
-
this.$toaster.info({
|
|
180
|
-
title: 'Long Duration Toast',
|
|
181
|
-
description: 'This toast will stay for 10 seconds',
|
|
182
|
-
delayBeforeCloseInMs: 10000,
|
|
183
|
-
isUnique: true,
|
|
184
|
-
})
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
}),
|
|
188
|
-
}
|