@citizenplane/pimp 13.0.0 → 14.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 +4804 -4585
- package/dist/pimp.umd.js +44 -44
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/CpAccordion.vue +163 -0
- package/src/components/CpAccordionGroup.vue +51 -0
- package/src/components/CpBadge.vue +2 -2
- package/src/components/CpButton.vue +4 -3
- package/src/components/CpButtonGroup.vue +30 -2
- package/src/components/CpDate.vue +5 -4
- package/src/components/CpInput.vue +4 -4
- package/src/components/CpItemActions.vue +11 -9
- package/src/components/CpMultiselect.vue +3 -3
- package/src/components/CpPartnerBadge.vue +3 -2
- package/src/components/CpSelect.vue +5 -5
- package/src/components/CpTable.vue +2 -2
- package/src/components/CpTelInput.vue +4 -4
- package/src/components/CpTextarea.vue +3 -3
- package/src/components/CpTransitionCounter.vue +77 -0
- package/src/components/CpTransitionListItems.vue +41 -0
- package/src/components/CpTransitionSize.vue +88 -0
- package/src/components/CpTransitionSlide.vue +44 -0
- package/src/components/CpTransitionTabContent.vue +70 -0
- package/src/components/index.ts +16 -2
- package/src/constants/Sizes.ts +1 -11
- package/src/constants/index.ts +1 -1
- package/src/stories/BaseInputLabel.stories.ts +1 -1
- package/src/stories/CpAccordion.stories.ts +282 -0
- package/src/stories/CpAccordionGroup.stories.ts +223 -0
- package/src/stories/CpAirlineLogo.stories.ts +1 -1
- package/src/stories/CpAlert.stories.ts +1 -1
- package/src/stories/CpBadge.stories.ts +2 -4
- package/src/stories/CpButton.stories.ts +147 -146
- package/src/stories/CpCheckbox.stories.ts +1 -1
- package/src/stories/CpContextualMenu.stories.ts +1 -1
- package/src/stories/CpDate.stories.ts +1 -1
- package/src/stories/CpDatepicker.stories.ts +1 -1
- package/src/stories/CpDialog.stories.ts +1 -1
- package/src/stories/CpHeading.stories.ts +1 -1
- package/src/stories/CpIcon.stories.ts +1 -1
- package/src/stories/CpInput.stories.ts +2 -4
- package/src/stories/CpItemActions.stories.ts +1 -1
- package/src/stories/CpLoader.stories.ts +1 -1
- package/src/stories/CpMenuItem.stories.ts +1 -1
- package/src/stories/CpMultiselect.stories.ts +1 -1
- package/src/stories/CpPartnerBadge.stories.ts +3 -3
- package/src/stories/CpRadio.stories.ts +1 -1
- package/src/stories/CpSelect.stories.ts +4 -6
- package/src/stories/CpSelectMenu.stories.ts +1 -1
- package/src/stories/CpSelectableButton.stories.ts +4 -6
- package/src/stories/CpSwitch.stories.ts +1 -1
- package/src/stories/CpTable.stories.ts +1 -1
- package/src/stories/CpTableEmptyState.stories.ts +1 -1
- package/src/stories/CpTabs.stories.ts +1 -1
- package/src/stories/CpTelInput.stories.ts +1 -1
- package/src/stories/CpTextarea.stories.ts +1 -1
- package/src/stories/CpToast.stories.ts +1 -1
- package/src/stories/CpTooltip.stories.ts +1 -1
- package/src/stories/CpTransitionCounter.stories.ts +66 -0
- package/src/stories/{TransitionExpand.stories.ts → CpTransitionExpand.stories.ts} +11 -11
- package/src/stories/CpTransitionListItems.stories.ts +147 -0
- package/src/stories/CpTransitionSize.stories.ts +147 -0
- package/src/stories/CpTransitionSlide.stories.ts +65 -0
- package/src/stories/CpTransitionTabContent.stories.ts +78 -0
- package/src/stories/documentationStyles.ts +16 -0
- /package/src/components/{TransitionExpand.vue → CpTransitionExpand.vue} +0 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { computed, ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
4
|
+
|
|
5
|
+
import CpButton from '@/components/CpButton.vue'
|
|
6
|
+
import CpTransitionSize from '@/components/CpTransitionSize.vue'
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Transitions/CpTransitionSize',
|
|
10
|
+
component: CpTransitionSize,
|
|
11
|
+
argTypes: {
|
|
12
|
+
type: {
|
|
13
|
+
control: 'select',
|
|
14
|
+
options: ['width', 'height'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof CpTransitionSize>
|
|
18
|
+
|
|
19
|
+
export default meta
|
|
20
|
+
type Story = StoryObj<typeof meta>
|
|
21
|
+
|
|
22
|
+
const wrapperStyle = 'display: flex; flex-direction: column; align-items: center; gap: 12px;'
|
|
23
|
+
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
type: 'width',
|
|
27
|
+
},
|
|
28
|
+
render: (args) => ({
|
|
29
|
+
components: { CpTransitionSize, CpButton },
|
|
30
|
+
setup() {
|
|
31
|
+
const isShort = ref(true)
|
|
32
|
+
const dynamicLabel = computed(() => {
|
|
33
|
+
return isShort.value ? 'Short label' : 'Much longer label'
|
|
34
|
+
})
|
|
35
|
+
return { args, isShort, dynamicLabel }
|
|
36
|
+
},
|
|
37
|
+
template: `
|
|
38
|
+
<div style="${wrapperStyle}">
|
|
39
|
+
<CpButton
|
|
40
|
+
appearance="primary"
|
|
41
|
+
color="accent"
|
|
42
|
+
@click="isShort = !isShort"
|
|
43
|
+
>
|
|
44
|
+
<CpTransitionSize v-bind="args">
|
|
45
|
+
<span>{{ dynamicLabel }}</span>
|
|
46
|
+
</CpTransitionSize>
|
|
47
|
+
</CpButton>
|
|
48
|
+
</div>
|
|
49
|
+
`,
|
|
50
|
+
}),
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const HeightTransition: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
type: 'height',
|
|
56
|
+
},
|
|
57
|
+
render: (args) => ({
|
|
58
|
+
components: { CpTransitionSize, CpButton },
|
|
59
|
+
setup() {
|
|
60
|
+
const isOpen = ref(false)
|
|
61
|
+
const currentStep = ref(0)
|
|
62
|
+
const stepCount = 3
|
|
63
|
+
|
|
64
|
+
const dialogTitle = computed(() => `Step ${currentStep.value + 1} of ${stepCount}`)
|
|
65
|
+
|
|
66
|
+
/** More steps ⇒ more paragraphs (1-based depth). */
|
|
67
|
+
const paragraphCount = computed(() => (currentStep.value + 1) * 3)
|
|
68
|
+
|
|
69
|
+
const openDialog = () => {
|
|
70
|
+
currentStep.value = 0
|
|
71
|
+
isOpen.value = true
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const closeDialog = () => {
|
|
75
|
+
isOpen.value = false
|
|
76
|
+
currentStep.value = 0
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const paragraphStyle = computed(() => {
|
|
80
|
+
return { margin: 0, whiteSpace: 'normal' }
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
args,
|
|
85
|
+
isOpen,
|
|
86
|
+
currentStep,
|
|
87
|
+
stepCount,
|
|
88
|
+
dialogTitle,
|
|
89
|
+
paragraphCount,
|
|
90
|
+
openDialog,
|
|
91
|
+
closeDialog,
|
|
92
|
+
paragraphStyle,
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
template: `
|
|
96
|
+
<div style="${wrapperStyle}">
|
|
97
|
+
<CpButton appearance="primary" color="accent" @click="openDialog">
|
|
98
|
+
Open stepped dialog
|
|
99
|
+
</CpButton>
|
|
100
|
+
<CpTransitionDialog>
|
|
101
|
+
<CpDialog
|
|
102
|
+
v-if="isOpen"
|
|
103
|
+
:max-width="520"
|
|
104
|
+
:title="dialogTitle"
|
|
105
|
+
@close="closeDialog"
|
|
106
|
+
>
|
|
107
|
+
<CpTransitionSize v-bind="args">
|
|
108
|
+
<div style="display: flex; flex-direction: column; gap: 8px;">
|
|
109
|
+
<p v-for="i in paragraphCount" :key="i" :style="paragraphStyle">
|
|
110
|
+
Paragraph {{ i }}. Ut enim ad minim veniam, quis nostrud exercitation ullamco.
|
|
111
|
+
</p>
|
|
112
|
+
</div>
|
|
113
|
+
</CpTransitionSize>
|
|
114
|
+
<template #footer>
|
|
115
|
+
<div style="display: flex; justify-content: space-between; gap: 8px; width: 100%;">
|
|
116
|
+
<CpButton
|
|
117
|
+
v-if="currentStep > 0"
|
|
118
|
+
appearance="secondary"
|
|
119
|
+
color="neutral"
|
|
120
|
+
@click="currentStep--"
|
|
121
|
+
>
|
|
122
|
+
Back
|
|
123
|
+
</CpButton>
|
|
124
|
+
<CpButton
|
|
125
|
+
v-if="currentStep < stepCount - 1"
|
|
126
|
+
appearance="primary"
|
|
127
|
+
color="accent"
|
|
128
|
+
@click="currentStep++"
|
|
129
|
+
>
|
|
130
|
+
Next
|
|
131
|
+
</CpButton>
|
|
132
|
+
<CpButton
|
|
133
|
+
v-if="currentStep === stepCount - 1"
|
|
134
|
+
appearance="primary"
|
|
135
|
+
color="accent"
|
|
136
|
+
@click="closeDialog"
|
|
137
|
+
>
|
|
138
|
+
Done
|
|
139
|
+
</CpButton>
|
|
140
|
+
</div>
|
|
141
|
+
</template>
|
|
142
|
+
</CpDialog>
|
|
143
|
+
</CpTransitionDialog>
|
|
144
|
+
</div>
|
|
145
|
+
`,
|
|
146
|
+
}),
|
|
147
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
4
|
+
|
|
5
|
+
import CpButton from '@/components/CpButton.vue'
|
|
6
|
+
import CpTransitionSlide from '@/components/CpTransitionSlide.vue'
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Transitions/CpTransitionSlide',
|
|
10
|
+
component: CpTransitionSlide,
|
|
11
|
+
argTypes: {
|
|
12
|
+
slideTo: {
|
|
13
|
+
control: 'select',
|
|
14
|
+
options: ['top', 'left'],
|
|
15
|
+
},
|
|
16
|
+
mode: {
|
|
17
|
+
control: 'select',
|
|
18
|
+
options: ['default', 'in-out', 'out-in'],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
} satisfies Meta<typeof CpTransitionSlide>
|
|
22
|
+
|
|
23
|
+
export default meta
|
|
24
|
+
type Story = StoryObj<typeof meta>
|
|
25
|
+
|
|
26
|
+
const wrapperStyle = 'display: flex; flex-direction: column; align-items: center; gap: 60px; min-width: 600px;'
|
|
27
|
+
|
|
28
|
+
const panelStyle =
|
|
29
|
+
'min-width: 260px; max-width: 320px; padding: 20px; border-radius: 12px; background: #f3f4f6; text-align: center;'
|
|
30
|
+
|
|
31
|
+
export const Toggle: Story = {
|
|
32
|
+
name: 'Toggle',
|
|
33
|
+
args: {
|
|
34
|
+
slideTo: 'top',
|
|
35
|
+
mode: 'out-in',
|
|
36
|
+
},
|
|
37
|
+
render: (args) => ({
|
|
38
|
+
components: { CpTransitionSlide, CpButton },
|
|
39
|
+
setup() {
|
|
40
|
+
const showFirst = ref(true)
|
|
41
|
+
return { args, showFirst }
|
|
42
|
+
},
|
|
43
|
+
template: `
|
|
44
|
+
<div style="${wrapperStyle}">
|
|
45
|
+
<CpButton appearance="primary" color="accent" @click="showFirst = !showFirst">
|
|
46
|
+
<CpTransitionSize size="md">
|
|
47
|
+
<span>{{ showFirst ? 'Show second view' : 'Show first view' }}</span>
|
|
48
|
+
</CpTransitionSize>
|
|
49
|
+
</CpButton>
|
|
50
|
+
<CpTransitionSlide v-bind="args">
|
|
51
|
+
<div :key="showFirst ? 'a' : 'b'" style="${panelStyle}">
|
|
52
|
+
<template v-if="showFirst">
|
|
53
|
+
<strong>View A</strong>
|
|
54
|
+
<p style="margin: 8px 0 0; font-size: 14px;">Vertical slide (top).</p>
|
|
55
|
+
</template>
|
|
56
|
+
<template v-else>
|
|
57
|
+
<strong>View B</strong>
|
|
58
|
+
<p style="margin: 8px 0 0; font-size: 14px;">Vertical slide (top).</p>
|
|
59
|
+
</template>
|
|
60
|
+
</div>
|
|
61
|
+
</CpTransitionSlide>
|
|
62
|
+
</div>
|
|
63
|
+
`,
|
|
64
|
+
}),
|
|
65
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
4
|
+
|
|
5
|
+
import CpTabs from '@/components/CpTabs.vue'
|
|
6
|
+
import CpTransitionTabContent from '@/components/CpTransitionTabContent.vue'
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Transitions/CpTransitionTabContent',
|
|
10
|
+
component: CpTransitionTabContent,
|
|
11
|
+
argTypes: {
|
|
12
|
+
duration: {
|
|
13
|
+
control: { type: 'number', min: 100, max: 800, step: 50 },
|
|
14
|
+
},
|
|
15
|
+
direction: { table: { disable: true } },
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof CpTransitionTabContent>
|
|
18
|
+
|
|
19
|
+
export default meta
|
|
20
|
+
type Story = StoryObj<typeof meta>
|
|
21
|
+
|
|
22
|
+
const tabs = [
|
|
23
|
+
{ title: 'Details', icon: 'info' },
|
|
24
|
+
{ title: 'History', icon: 'clock' },
|
|
25
|
+
{ title: 'Settings', icon: 'settings' },
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
const tabBodies = [
|
|
29
|
+
'Overview and metadata for this item.',
|
|
30
|
+
'Past changes and audit trail appear here.',
|
|
31
|
+
'Preferences and access rules for this workspace.',
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
const layoutStyle = 'display: flex; flex-direction: column; gap: 20px; min-width: 600px;'
|
|
35
|
+
|
|
36
|
+
const panelStyle =
|
|
37
|
+
'min-height: 120px; padding: 20px; border-radius: 12px; background: #f3f4f6; font-size: 15px; line-height: 1.5;'
|
|
38
|
+
|
|
39
|
+
export const Default: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
duration: 300,
|
|
42
|
+
},
|
|
43
|
+
render: (args) => ({
|
|
44
|
+
components: { CpTabs, CpTransitionTabContent },
|
|
45
|
+
setup() {
|
|
46
|
+
const activeTabIndex = ref(0)
|
|
47
|
+
const transitionDirection = ref<'forward' | 'backward'>('forward')
|
|
48
|
+
|
|
49
|
+
const onTabClick = (index: number) => {
|
|
50
|
+
if (index === activeTabIndex.value) return
|
|
51
|
+
transitionDirection.value = index > activeTabIndex.value ? 'forward' : 'backward'
|
|
52
|
+
activeTabIndex.value = index
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
args,
|
|
57
|
+
tabs,
|
|
58
|
+
tabBodies,
|
|
59
|
+
activeTabIndex,
|
|
60
|
+
transitionDirection,
|
|
61
|
+
onTabClick,
|
|
62
|
+
layoutStyle,
|
|
63
|
+
panelStyle,
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
template: `
|
|
67
|
+
<div :style="layoutStyle">
|
|
68
|
+
<CpTabs :tabs="tabs" @on-tab-click="onTabClick" />
|
|
69
|
+
<CpTransitionTabContent v-bind="args" :direction="transitionDirection">
|
|
70
|
+
<div :key="activeTabIndex" :style="panelStyle">
|
|
71
|
+
<strong>{{ tabs[activeTabIndex].title }}</strong>
|
|
72
|
+
<p style="margin: 8px 0 0;">{{ tabBodies[activeTabIndex] }}</p>
|
|
73
|
+
</div>
|
|
74
|
+
</CpTransitionTabContent>
|
|
75
|
+
</div>
|
|
76
|
+
`,
|
|
77
|
+
}),
|
|
78
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const docPageStyle =
|
|
2
|
+
'padding: 24px; background: #f3f4f6; min-height: 100vh; width: 70vw; box-sizing: border-box;'
|
|
3
|
+
|
|
4
|
+
export const docSectionStyle =
|
|
5
|
+
'background: #fff; border-radius: 8px; padding: 24px; margin-bottom: 28px; box-shadow: 0 1px 3px rgba(0,0,0,0.08);'
|
|
6
|
+
|
|
7
|
+
export const docTitleStyle =
|
|
8
|
+
'margin: 0 0 16px 0; font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em;'
|
|
9
|
+
|
|
10
|
+
export const docRowWrapStyle = 'display: flex; flex-wrap: wrap; gap: 24px 32px; align-items: flex-end;'
|
|
11
|
+
|
|
12
|
+
export const docRowColumnStyle = 'display: flex; flex-direction: column; gap: 24px;'
|
|
13
|
+
|
|
14
|
+
export const docCellStyle = 'display: flex; flex-direction: column; gap: 10px; align-items: flex-start;'
|
|
15
|
+
|
|
16
|
+
export const docLabelStyle = 'font-size: 12px; color: #6b7280;'
|
|
File without changes
|