@citizenplane/pimp 8.11.3 → 8.13.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/README.md +0 -2
- package/dist/assets/BaseInputLabel-B6HBeOYW.css +1 -0
- package/dist/assets/BaseInputLabel-BKfOnmKd.js +1 -0
- package/dist/assets/BaseInputLabel.stories-B3jMVrza.js +28 -0
- package/dist/assets/Color-YHDXOIA2-CfioBzZb.js +1 -0
- package/dist/assets/Colors-mWZwWrlN.js +1 -0
- package/dist/assets/CpAlert-6hd7PZeZ.js +1 -0
- package/dist/assets/CpAlert-BW1Zf1Km.css +1 -0
- package/dist/assets/CpAlert.stories-CcK6sLCO.js +58 -0
- package/dist/assets/CpBadge-BRRUYYEk.js +1 -0
- package/dist/assets/CpBadge-CE420vX2.css +1 -0
- package/dist/assets/CpBadge.stories-Btggeh1U.js +170 -0
- package/dist/assets/CpButton-DQb7zTje.js +1 -0
- package/dist/assets/CpButton-gbl9KLuG.css +1 -0
- package/dist/assets/CpButton.stories-Chy_2ILm.js +86 -0
- package/dist/assets/CpCheckbox-Dalwqglu.js +1 -0
- package/dist/assets/CpCheckbox-DdQW6Gbc.css +1 -0
- package/dist/assets/CpCheckbox.stories-BEtAkjE-.js +167 -0
- package/dist/assets/CpDate-BdnXxnGQ.css +1 -0
- package/dist/assets/CpDate-DdtWXX2Q.js +3 -0
- package/dist/assets/CpDate.stories-C2Jg2QqC.js +59 -0
- package/dist/assets/CpDatepicker-DlzMF4b8.js +5 -0
- package/dist/assets/CpDatepicker-DqugfF5T.css +1 -0
- package/dist/assets/CpDatepicker.stories-CvOQvZYr.js +83 -0
- package/dist/assets/CpDialog-BTJusbSJ.js +1 -0
- package/dist/assets/CpDialog-BeuM9Ffk.css +1 -0
- package/dist/assets/CpDialog.stories-jA8uhNJR.js +43 -0
- package/dist/assets/CpHeading-BfoX1SIY.js +1 -0
- package/dist/assets/CpHeading-DgViCnDE.css +1 -0
- package/dist/assets/CpHeading.stories-DYb8vPG0.js +85 -0
- package/dist/assets/CpIcon-CdMV7BxY.css +1 -0
- package/dist/assets/CpIcon-DjtGpusx.js +5 -0
- package/dist/assets/CpIcon.stories-Cavk2BnC.js +47 -0
- package/dist/assets/CpInput-BT29xZan.js +1 -0
- package/dist/assets/CpInput-CAegPnB6.css +1 -0
- package/dist/assets/CpInput.stories-BbBe4bFT.js +98 -0
- package/dist/assets/CpLoader-B--Vqrhj.js +1 -0
- package/dist/assets/CpLoader.stories-CZ0hlfa2.js +10 -0
- package/dist/assets/CpRadio-C7OtLwPR.js +1 -0
- package/dist/assets/CpRadio-DiUdGJPg.css +1 -0
- package/dist/assets/CpRadio.stories-DPcn2bvJ.js +132 -0
- package/dist/assets/CpSelect-DlLk_-bg.js +1 -0
- package/dist/assets/CpSelect-HpT9AKcz.css +1 -0
- package/dist/assets/CpSelect.stories-C90Kd5cu.js +85 -0
- package/dist/assets/CpSelectMenu-Bpz33Tbp.js +1 -0
- package/dist/assets/CpSelectMenu-Dw4sbiEj.css +1 -0
- package/dist/assets/CpSelectMenu.stories-Bw2sNo0F.js +104 -0
- package/dist/assets/CpSwitch-CIWoB1sY.css +1 -0
- package/dist/assets/CpSwitch-CeGY7EL9.js +1 -0
- package/dist/assets/CpSwitch.stories-DbepH0R0.js +132 -0
- package/dist/assets/CpTable-BN6Amfsc.css +1 -0
- package/dist/assets/CpTable-RA2YDd8h.js +1 -0
- package/dist/assets/CpTable.stories-Dgc6tAkl.js +151 -0
- package/dist/assets/CpTableEmptyState-DLgi2hhT.css +1 -0
- package/dist/assets/CpTableEmptyState-TCjommO_.js +1 -0
- package/dist/assets/CpTableEmptyState.stories-C2oOfeda.js +20 -0
- package/dist/assets/CpTextarea-CzC-Bjsy.css +1 -0
- package/dist/assets/CpTextarea-HUf2FbPC.js +1 -0
- package/dist/assets/CpTextarea.stories-_17UyFSg.js +64 -0
- package/dist/assets/CpToaster-BXpKEwda.css +1 -0
- package/dist/assets/CpToaster-D9ITJUky.js +1 -0
- package/dist/assets/CpToaster.stories-BhEsau9e.js +124 -0
- package/dist/assets/CpTooltip-BIIOHaoi.css +1 -0
- package/dist/assets/CpTooltip-CD0Q4ym2.js +1 -0
- package/dist/assets/CpTooltip.stories-acOxur2H.js +121 -0
- package/dist/assets/DocsRenderer-CFRXHY34-Do1gGJEp.js +623 -0
- package/dist/assets/Intent-UfUixXOL.js +1 -0
- package/dist/assets/ToggleColors-CSr2zujL.js +1 -0
- package/dist/assets/TransitionExpand-BHMSqajW.css +1 -0
- package/dist/assets/TransitionExpand-BLDnMZa8.js +1 -0
- package/dist/assets/TransitionExpand.stories-5x0MQdG_.js +121 -0
- package/dist/assets/_commonjsHelpers-CqkleIqs.js +1 -0
- package/dist/assets/_plugin-vue_export-helper-DlAUqK2U.js +1 -0
- package/dist/assets/anime.esm-RriTVqCw.js +8 -0
- package/dist/assets/entry-preview-CE4fSG5C.js +1 -0
- package/dist/assets/entry-preview-docs-DMfJ0ifx.js +16 -0
- package/dist/assets/iframe-DLKLJnYS.js +211 -0
- package/dist/assets/index-Bx-go_-4.js +8 -0
- package/dist/assets/index-CtrtR6PF.js +1 -0
- package/dist/assets/index-DCv8Njl6.js +1 -0
- package/dist/assets/index-DrFu-skq.js +6 -0
- package/dist/assets/preview-B8lJiyuQ.js +34 -0
- package/dist/assets/preview-BBWR9nbA.js +1 -0
- package/dist/assets/preview-BWzBA1C2.js +396 -0
- package/dist/assets/preview-CHl-kSbv.js +2 -0
- package/dist/assets/preview-CIuMKJn5.js +240 -0
- package/dist/assets/preview-CvbIS5ZJ.js +1 -0
- package/dist/assets/preview-D2UkcbT2.js +3 -0
- package/dist/assets/preview-DD_OYowb.js +1 -0
- package/dist/assets/preview-DGUiP6tS.js +7 -0
- package/dist/assets/preview-OgCpecWL.css +1 -0
- package/dist/assets/vue.esm-bundler-DmHyoj4Y.js +36 -0
- package/dist/favicon.svg +1 -0
- package/dist/iframe.html +666 -0
- package/dist/index.html +177 -0
- package/dist/index.json +1 -0
- package/dist/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/nunito-sans-bold.woff2 +0 -0
- package/dist/nunito-sans-italic.woff2 +0 -0
- package/dist/nunito-sans-regular.woff2 +0 -0
- package/dist/project.json +1 -0
- package/dist/sb-addons/chromatic-com-storybook-9/manager-bundle.js +331 -0
- package/dist/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +51 -0
- package/dist/sb-addons/essentials-actions-2/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-backgrounds-4/manager-bundle.js +12 -0
- package/dist/sb-addons/essentials-controls-1/manager-bundle.js +402 -0
- package/dist/sb-addons/essentials-docs-3/manager-bundle.js +242 -0
- package/dist/sb-addons/essentials-measure-7/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-outline-8/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-toolbars-6/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-viewport-5/manager-bundle.js +3 -0
- package/dist/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +3 -0
- package/dist/sb-addons/storybook-experimental-addon-test-10/manager-bundle.js +223 -0
- package/dist/sb-common-assets/favicon.svg +1 -0
- package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/dist/sb-manager/globals-module-info.js +1052 -0
- package/dist/sb-manager/globals-runtime.js +42127 -0
- package/dist/sb-manager/globals.js +48 -0
- package/dist/sb-manager/runtime.js +12048 -0
- package/package.json +24 -5
- package/src/README.md +0 -25
- package/src/assets/styles/base/_base.scss +1 -5
- package/src/assets/styles/utilities/_index.scss +19 -0
- package/src/components/core/BaseInputLabel.vue +0 -1
- package/src/components/date-pickers/CpDate.vue +8 -5
- package/src/components/inputs/CpInput.vue +5 -16
- package/src/components/inputs/CpTextarea.vue +4 -6
- package/src/components/selects/CpSelect.vue +5 -5
- package/src/stories/BaseInputLabel.stories.ts +35 -0
- package/src/stories/CpAlert.stories.ts +90 -0
- package/src/stories/CpBadge.stories.ts +158 -0
- package/src/stories/CpButton.stories.ts +134 -0
- package/src/stories/CpCheckbox.stories.ts +184 -0
- package/src/stories/CpDate.stories.ts +110 -0
- package/src/stories/CpDatepicker.stories.ts +162 -0
- package/src/stories/CpDialog.stories.ts +53 -0
- package/src/stories/CpHeading.stories.ts +77 -0
- package/src/stories/CpIcon.stories.ts +79 -0
- package/src/stories/CpInput.stories.ts +155 -0
- package/src/stories/CpLoader.stories.ts +29 -0
- package/src/stories/CpRadio.stories.ts +139 -0
- package/src/stories/CpSelect.stories.ts +147 -0
- package/src/stories/CpSelectMenu.stories.ts +132 -0
- package/src/stories/CpSwitch.stories.ts +137 -0
- package/src/stories/CpTable.stories.ts +192 -0
- package/src/stories/CpTableEmptyState.stories.ts +34 -0
- package/src/stories/CpTextarea.stories.ts +112 -0
- package/src/stories/CpToaster.stories.ts +147 -0
- package/src/stories/CpTooltip.stories.ts +101 -0
- package/src/stories/TransitionExpand.stories.ts +85 -0
- package/vitest.workspace.js +31 -0
- package/dist/pimp.es.js +0 -14987
- package/dist/pimp.umd.js +0 -12
- package/dist/style.css +0 -1
- package/src/App.vue +0 -110
- package/src/components/core/playground-sections/SectionAtomicElements.vue +0 -83
- package/src/components/core/playground-sections/SectionButtons.vue +0 -142
- package/src/components/core/playground-sections/SectionContainer.vue +0 -50
- package/src/components/core/playground-sections/SectionDatePickers.vue +0 -160
- package/src/components/core/playground-sections/SectionDialog.vue +0 -47
- package/src/components/core/playground-sections/SectionFeedbackIndicators.vue +0 -47
- package/src/components/core/playground-sections/SectionInputs.vue +0 -46
- package/src/components/core/playground-sections/SectionListsAndTables.vue +0 -268
- package/src/components/core/playground-sections/SectionSelectMenus.vue +0 -98
- package/src/components/core/playground-sections/SectionSelects.vue +0 -120
- package/src/components/core/playground-sections/SectionSimpleInputs.vue +0 -305
- package/src/components/core/playground-sections/SectionToasters.vue +0 -68
- package/src/components/core/playground-sections/SectionToggles.vue +0 -158
- package/src/components/core/playground-sections/SectionTypography.vue +0 -40
- package/src/main.js +0 -15
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import CpToaster from '@/components/feedback-indicators/CpToaster.vue'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'CpToaster',
|
|
6
|
+
component: CpToaster,
|
|
7
|
+
argTypes: {
|
|
8
|
+
title: {
|
|
9
|
+
control: 'text',
|
|
10
|
+
description: 'The title of the toast',
|
|
11
|
+
},
|
|
12
|
+
description: {
|
|
13
|
+
control: 'text',
|
|
14
|
+
description: 'The description of the toast',
|
|
15
|
+
},
|
|
16
|
+
type: {
|
|
17
|
+
control: 'select',
|
|
18
|
+
options: ['info', 'warning', 'success', 'critical'],
|
|
19
|
+
description: 'The type of the toast',
|
|
20
|
+
},
|
|
21
|
+
delayBeforeCloseInMs: {
|
|
22
|
+
control: 'number',
|
|
23
|
+
description: 'Duration in milliseconds before the toast disappears',
|
|
24
|
+
},
|
|
25
|
+
actionLabel: {
|
|
26
|
+
control: 'text',
|
|
27
|
+
description: 'Label for the action button',
|
|
28
|
+
},
|
|
29
|
+
isUnique: {
|
|
30
|
+
control: 'boolean',
|
|
31
|
+
description: 'Whether the toast should be unique',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
} satisfies Meta<typeof CpToaster>
|
|
35
|
+
|
|
36
|
+
export default meta
|
|
37
|
+
type Story = StoryObj<typeof meta>
|
|
38
|
+
|
|
39
|
+
export const Default: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
title: 'Default Toast',
|
|
42
|
+
description: 'This is a default toast message',
|
|
43
|
+
type: 'info',
|
|
44
|
+
delayBeforeCloseInMs: 3000,
|
|
45
|
+
actionLabel: '',
|
|
46
|
+
isUnique: false,
|
|
47
|
+
},
|
|
48
|
+
render: (args) => ({
|
|
49
|
+
template: `
|
|
50
|
+
<div style="padding: 20px;">
|
|
51
|
+
<cp-button @click="addInfoToaster">Show Info Toast</cp-button>
|
|
52
|
+
</div>
|
|
53
|
+
`,
|
|
54
|
+
methods: {
|
|
55
|
+
addInfoToaster() {
|
|
56
|
+
this.$toaster.info({ ...args })
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const DifferentTypes: Story = {
|
|
63
|
+
render: () => ({
|
|
64
|
+
template: `
|
|
65
|
+
<div style="padding: 20px; display: flex; flex-direction: column; gap: 16px;">
|
|
66
|
+
<cp-button @click="addInfoToaster">Show Info Toast</cp-button>
|
|
67
|
+
<cp-button @click="addSuccessToaster">Show Success Toast</cp-button>
|
|
68
|
+
<cp-button @click="addWarningToaster">Show Warning Toast</cp-button>
|
|
69
|
+
<cp-button @click="addCriticalToaster">Show Critical Toast</cp-button>
|
|
70
|
+
</div>
|
|
71
|
+
`,
|
|
72
|
+
methods: {
|
|
73
|
+
addInfoToaster() {
|
|
74
|
+
this.$toaster.info({
|
|
75
|
+
title: 'This is an info toaster',
|
|
76
|
+
description: 'This a description of a toaster',
|
|
77
|
+
isUnique: true,
|
|
78
|
+
})
|
|
79
|
+
},
|
|
80
|
+
addSuccessToaster() {
|
|
81
|
+
this.$toaster.success({
|
|
82
|
+
title: 'This is a success toaster',
|
|
83
|
+
description: 'This a description of a toaster',
|
|
84
|
+
isUnique: true,
|
|
85
|
+
})
|
|
86
|
+
},
|
|
87
|
+
addWarningToaster() {
|
|
88
|
+
this.$toaster.warning({
|
|
89
|
+
title: 'This is a warning toaster',
|
|
90
|
+
description: 'This a description of a toaster',
|
|
91
|
+
isUnique: true,
|
|
92
|
+
})
|
|
93
|
+
},
|
|
94
|
+
addCriticalToaster() {
|
|
95
|
+
this.$toaster.critical({
|
|
96
|
+
title: 'This is a critical toaster',
|
|
97
|
+
description: 'This a description of a toaster',
|
|
98
|
+
isUnique: true,
|
|
99
|
+
})
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
}),
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const WithAction: Story = {
|
|
106
|
+
render: () => ({
|
|
107
|
+
template: `
|
|
108
|
+
<div style="padding: 20px;">
|
|
109
|
+
<cp-button @click="addLinkToaster">Show Toast with Action</cp-button>
|
|
110
|
+
</div>
|
|
111
|
+
`,
|
|
112
|
+
methods: {
|
|
113
|
+
addLinkToaster() {
|
|
114
|
+
this.$toaster.success({
|
|
115
|
+
title: 'This is a success toaster',
|
|
116
|
+
description: 'Description of a toaster with a link',
|
|
117
|
+
actionLabel: 'See flight information',
|
|
118
|
+
isUnique: true,
|
|
119
|
+
actionMethod: (vm) => {
|
|
120
|
+
vm.closeToaster()
|
|
121
|
+
window.open('http://app.citizenplane.com', '_blank')
|
|
122
|
+
},
|
|
123
|
+
})
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
}),
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const CustomDuration: Story = {
|
|
130
|
+
render: () => ({
|
|
131
|
+
template: `
|
|
132
|
+
<div style="padding: 20px;">
|
|
133
|
+
<cp-button @click="addLongDurationToaster">Show Long Duration Toast</cp-button>
|
|
134
|
+
</div>
|
|
135
|
+
`,
|
|
136
|
+
methods: {
|
|
137
|
+
addLongDurationToaster() {
|
|
138
|
+
this.$toaster.info({
|
|
139
|
+
title: 'Long Duration Toast',
|
|
140
|
+
description: 'This toast will stay for 10 seconds',
|
|
141
|
+
delayBeforeCloseInMs: 10000,
|
|
142
|
+
isUnique: true,
|
|
143
|
+
})
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
}),
|
|
147
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import CpTooltip from '@/components/atomic-elements/CpTooltip.vue'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'CpTooltip',
|
|
6
|
+
component: CpTooltip,
|
|
7
|
+
argTypes: {
|
|
8
|
+
content: {
|
|
9
|
+
control: 'text',
|
|
10
|
+
description: 'The content to display in the tooltip',
|
|
11
|
+
},
|
|
12
|
+
placement: {
|
|
13
|
+
control: 'select',
|
|
14
|
+
options: ['top', 'right', 'bottom', 'left'],
|
|
15
|
+
description: 'The placement of the tooltip',
|
|
16
|
+
},
|
|
17
|
+
distance: {
|
|
18
|
+
control: 'number',
|
|
19
|
+
description: 'The distance between the tooltip and the target',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
} satisfies Meta<typeof CpTooltip>
|
|
23
|
+
|
|
24
|
+
export default meta
|
|
25
|
+
type Story = StoryObj<typeof meta>
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
content: 'Tooltip content',
|
|
30
|
+
placement: 'top',
|
|
31
|
+
distance: 8,
|
|
32
|
+
},
|
|
33
|
+
render: (args) => ({
|
|
34
|
+
components: { CpTooltip },
|
|
35
|
+
setup() {
|
|
36
|
+
return { args }
|
|
37
|
+
},
|
|
38
|
+
template: `
|
|
39
|
+
<div style="padding: 100px; text-align: center;">
|
|
40
|
+
<CpTooltip v-bind="args">
|
|
41
|
+
<button>Hover me</button>
|
|
42
|
+
</CpTooltip>
|
|
43
|
+
</div>
|
|
44
|
+
`,
|
|
45
|
+
}),
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const AllPlacements: Story = {
|
|
49
|
+
render: (args) => ({
|
|
50
|
+
components: { CpTooltip },
|
|
51
|
+
setup() {
|
|
52
|
+
return { args }
|
|
53
|
+
},
|
|
54
|
+
template: `
|
|
55
|
+
<div style="display: flex; flex-direction: column; gap: 20px; padding: 100px;">
|
|
56
|
+
<div>
|
|
57
|
+
<CpTooltip content="Top tooltip" placement="top">
|
|
58
|
+
<button>Top</button>
|
|
59
|
+
</CpTooltip>
|
|
60
|
+
</div>
|
|
61
|
+
<div>
|
|
62
|
+
<CpTooltip content="Right tooltip" placement="right">
|
|
63
|
+
<button>Right</button>
|
|
64
|
+
</CpTooltip>
|
|
65
|
+
</div>
|
|
66
|
+
<div>
|
|
67
|
+
<CpTooltip content="Bottom tooltip" placement="bottom">
|
|
68
|
+
<button>Bottom</button>
|
|
69
|
+
</CpTooltip>
|
|
70
|
+
</div>
|
|
71
|
+
<div>
|
|
72
|
+
<CpTooltip content="Left tooltip" placement="left">
|
|
73
|
+
<button>Left</button>
|
|
74
|
+
</CpTooltip>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
`,
|
|
78
|
+
}),
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const WithHTMLContent: Story = {
|
|
82
|
+
args: {
|
|
83
|
+
placement: 'top',
|
|
84
|
+
},
|
|
85
|
+
render: (args) => ({
|
|
86
|
+
components: { CpTooltip },
|
|
87
|
+
setup() {
|
|
88
|
+
return { args }
|
|
89
|
+
},
|
|
90
|
+
template: `
|
|
91
|
+
<div style="padding: 100px; text-align: center;">
|
|
92
|
+
<CpTooltip v-bind="args">
|
|
93
|
+
<button type="button">Trigger HTML content</button>
|
|
94
|
+
<template #content>
|
|
95
|
+
<p>HTML <b>Content</b> and <u>underlined</u></p>
|
|
96
|
+
</template>
|
|
97
|
+
</CpTooltip>
|
|
98
|
+
</div>
|
|
99
|
+
`,
|
|
100
|
+
}),
|
|
101
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import TransitionExpand from '@/components/helpers-utilities/TransitionExpand.vue'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'TransitionExpand',
|
|
7
|
+
component: TransitionExpand,
|
|
8
|
+
argTypes: {
|
|
9
|
+
// No props to document as this is a utility component
|
|
10
|
+
},
|
|
11
|
+
} satisfies Meta<typeof TransitionExpand>
|
|
12
|
+
|
|
13
|
+
export default meta
|
|
14
|
+
type Story = StoryObj<typeof meta>
|
|
15
|
+
|
|
16
|
+
const wrapperStyle = 'display: flex; flex-direction: column; align-items: center; gap: 12px;'
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
render: () => ({
|
|
20
|
+
components: { TransitionExpand },
|
|
21
|
+
setup() {
|
|
22
|
+
const isExpanded = ref(false)
|
|
23
|
+
return { isExpanded }
|
|
24
|
+
},
|
|
25
|
+
template: `
|
|
26
|
+
<div style="${wrapperStyle}">
|
|
27
|
+
<CpButton
|
|
28
|
+
@click="isExpanded = !isExpanded"
|
|
29
|
+
appearance="primary"
|
|
30
|
+
color="purple"
|
|
31
|
+
>
|
|
32
|
+
{{ isExpanded ? 'Collapse' : 'Expand' }}
|
|
33
|
+
</CpButton>
|
|
34
|
+
|
|
35
|
+
<TransitionExpand>
|
|
36
|
+
<div v-if="isExpanded" style="
|
|
37
|
+
background: #F3F4F6;
|
|
38
|
+
border-radius: 6px;
|
|
39
|
+
">
|
|
40
|
+
<h3 style="margin: 0 0 8px 0;">Expanded Content</h3>
|
|
41
|
+
<p style="margin: 0;">
|
|
42
|
+
This content will smoothly expand and collapse with a nice animation.
|
|
43
|
+
The height transition is handled automatically by the TransitionExpand component.
|
|
44
|
+
</p>
|
|
45
|
+
</div>
|
|
46
|
+
</TransitionExpand>
|
|
47
|
+
</div>
|
|
48
|
+
`,
|
|
49
|
+
}),
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const WithLongContent: Story = {
|
|
53
|
+
render: () => ({
|
|
54
|
+
components: { TransitionExpand },
|
|
55
|
+
setup() {
|
|
56
|
+
const isExpanded = ref(false)
|
|
57
|
+
return { isExpanded }
|
|
58
|
+
},
|
|
59
|
+
template: `
|
|
60
|
+
<div style="${wrapperStyle}">
|
|
61
|
+
<CpButton
|
|
62
|
+
@click="isExpanded = !isExpanded"
|
|
63
|
+
appearance="primary"
|
|
64
|
+
color="purple"
|
|
65
|
+
>
|
|
66
|
+
{{ isExpanded ? 'Collapse' : 'Expand' }}
|
|
67
|
+
</CpButton>
|
|
68
|
+
|
|
69
|
+
<TransitionExpand>
|
|
70
|
+
<div v-if="isExpanded" style="
|
|
71
|
+
background: #F3F4F6;
|
|
72
|
+
border-radius: 6px;
|
|
73
|
+
">
|
|
74
|
+
<h3 style="margin: 0 0 8px 0;">Long Content Example</h3>
|
|
75
|
+
<p v-for="i in 5" :key="i" style="margin: 0 0 8px 0;">
|
|
76
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor
|
|
77
|
+
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
|
|
78
|
+
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
79
|
+
</p>
|
|
80
|
+
</div>
|
|
81
|
+
</TransitionExpand>
|
|
82
|
+
</div>
|
|
83
|
+
`,
|
|
84
|
+
}),
|
|
85
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
|
|
4
|
+
import { defineWorkspace } from 'vitest/config'
|
|
5
|
+
|
|
6
|
+
import { storybookTest } from '@storybook/experimental-addon-test/vitest-plugin'
|
|
7
|
+
|
|
8
|
+
const dirname = typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url))
|
|
9
|
+
|
|
10
|
+
// More info at: https://storybook.js.org/docs/writing-tests/test-addon
|
|
11
|
+
export default defineWorkspace([
|
|
12
|
+
'vite.config.cjs',
|
|
13
|
+
{
|
|
14
|
+
extends: 'vite.config.cjs',
|
|
15
|
+
plugins: [
|
|
16
|
+
// The plugin will run tests for the stories defined in your Storybook config
|
|
17
|
+
// See options at: https://storybook.js.org/docs/writing-tests/test-addon#storybooktest
|
|
18
|
+
storybookTest({ configDir: path.join(dirname, '.storybook') }),
|
|
19
|
+
],
|
|
20
|
+
test: {
|
|
21
|
+
name: 'storybook',
|
|
22
|
+
browser: {
|
|
23
|
+
enabled: true,
|
|
24
|
+
headless: true,
|
|
25
|
+
name: 'chromium',
|
|
26
|
+
provider: 'playwright',
|
|
27
|
+
},
|
|
28
|
+
setupFiles: ['.storybook/vitest.setup.js'],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
])
|