@citizenplane/pimp 16.0.2 → 16.1.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 +343 -311
- package/dist/pimp.umd.js +21 -21
- package/dist/style.css +1 -1
- package/package.json +2 -1
- package/src/components/CpAlert.vue +38 -30
- package/src/components/CpHeading.vue +4 -5
- package/src/components/CpText.vue +141 -0
- package/src/components/index.ts +2 -0
- package/src/stories/BaseInputLabel.stories.ts +36 -9
- package/src/stories/Colors.mdx +9 -0
- package/src/stories/Colors.stories.ts +177 -0
- package/src/stories/CpAccordion.stories.ts +187 -158
- package/src/stories/CpAccordionGroup.stories.ts +50 -94
- package/src/stories/CpAirlineLogo.stories.ts +49 -28
- package/src/stories/CpAlert.stories.ts +194 -157
- package/src/stories/CpBadge.stories.ts +259 -193
- package/src/stories/CpButton.stories.ts +257 -426
- package/src/stories/CpCheckbox.stories.ts +101 -29
- package/src/stories/CpContextualMenu.stories.ts +9 -8
- package/src/stories/CpDate.stories.ts +52 -25
- package/src/stories/CpDatepicker.stories.ts +57 -88
- package/src/stories/CpDialog.stories.ts +22 -1
- package/src/stories/CpHeading.stories.ts +59 -20
- package/src/stories/CpIcon.stories.ts +98 -31
- package/src/stories/CpInput.stories.ts +142 -67
- package/src/stories/CpItemActions.stories.ts +22 -27
- package/src/stories/CpLoader.stories.ts +54 -6
- package/src/stories/CpMenuItem.stories.ts +52 -26
- package/src/stories/CpMultiselect.stories.ts +52 -71
- package/src/stories/CpPartnerBadge.stories.ts +53 -74
- package/src/stories/CpRadio.stories.ts +44 -48
- package/src/stories/CpRadioGroup.stories.ts +46 -39
- package/src/stories/CpSelect.stories.ts +98 -39
- package/src/stories/CpSelectMenu.stories.ts +49 -57
- package/src/stories/CpSelectableButton.stories.ts +170 -81
- package/src/stories/CpSwitch.stories.ts +135 -133
- package/src/stories/CpTable.stories.ts +54 -1
- package/src/stories/CpTableEmptyState.stories.ts +11 -7
- package/src/stories/CpTabs.stories.ts +22 -4
- package/src/stories/CpTelInput.stories.ts +25 -23
- package/src/stories/CpText.stories.ts +131 -0
- package/src/stories/CpTextarea.stories.ts +59 -23
- package/src/stories/CpToast.stories.ts +53 -103
- package/src/stories/CpTooltip.stories.ts +82 -77
- package/src/stories/CpTransitionCounter.stories.ts +4 -0
- package/src/stories/CpTransitionExpand.stories.ts +11 -6
- package/src/stories/CpTransitionListItems.stories.ts +5 -0
- package/src/stories/CpTransitionSize.stories.ts +8 -0
- package/src/stories/CpTransitionSlide.stories.ts +4 -0
- package/src/stories/CpTransitionTabContent.stories.ts +4 -0
- package/src/stories/Dimensions.mdx +9 -0
- package/src/stories/Dimensions.stories.ts +119 -0
- package/src/stories/Easings.mdx +9 -0
- package/src/stories/Easings.stories.ts +101 -0
- package/src/stories/FocusRings.mdx +9 -0
- package/src/stories/FocusRings.stories.ts +74 -0
- package/src/stories/Shadows.mdx +9 -0
- package/src/stories/Shadows.stories.ts +100 -0
- package/src/stories/Typography.mdx +9 -0
- package/src/stories/Typography.stories.ts +181 -0
- package/src/stories/documentationStyles.ts +2 -10
- package/src/stories/tokenUtils.ts +259 -0
|
@@ -6,15 +6,6 @@ import type { MenuItem } from 'primevue/menuitem'
|
|
|
6
6
|
import type { CpAccordionBaseProps } from '@/components/CpAccordion.vue'
|
|
7
7
|
import CpAccordion from '@/components/CpAccordion.vue'
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
docCellStyle,
|
|
11
|
-
docLabelStyle,
|
|
12
|
-
docPageStyle,
|
|
13
|
-
docRowColumnStyle,
|
|
14
|
-
docSectionStyle,
|
|
15
|
-
docTitleStyle,
|
|
16
|
-
} from '@/stories/documentationStyles'
|
|
17
|
-
|
|
18
9
|
/** Storybook controls: component props remain a discriminated union in `CpAccordion.vue`. */
|
|
19
10
|
type CpAccordionStoryArgs = CpAccordionBaseProps & {
|
|
20
11
|
actions?: MenuItem[]
|
|
@@ -37,7 +28,7 @@ const defaultStoryActions: MenuItem[] = [
|
|
|
37
28
|
]
|
|
38
29
|
|
|
39
30
|
const meta = {
|
|
40
|
-
title: '
|
|
31
|
+
title: 'Molecules/CpAccordion',
|
|
41
32
|
component: CpAccordion,
|
|
42
33
|
argTypes: {
|
|
43
34
|
title: {
|
|
@@ -50,16 +41,16 @@ const meta = {
|
|
|
50
41
|
},
|
|
51
42
|
hideActionTrigger: {
|
|
52
43
|
control: 'boolean',
|
|
53
|
-
description: 'Whether to hide the action trigger',
|
|
44
|
+
description: 'Whether to hide the inline action trigger (leading icon mode)',
|
|
54
45
|
},
|
|
55
46
|
iconPosition: {
|
|
56
47
|
control: 'select',
|
|
57
48
|
options: ['leading', 'trailing'],
|
|
58
|
-
description: 'Chevron icon position',
|
|
49
|
+
description: 'Chevron icon position. `trailing` disables actions.',
|
|
59
50
|
},
|
|
60
51
|
quickOptionsLimit: {
|
|
61
52
|
control: 'number',
|
|
62
|
-
description: 'Number of quick
|
|
53
|
+
description: 'Number of quick-access actions to display inline',
|
|
63
54
|
},
|
|
64
55
|
actions: {
|
|
65
56
|
control: 'object',
|
|
@@ -74,7 +65,9 @@ type Story = StoryObj<typeof meta>
|
|
|
74
65
|
|
|
75
66
|
const sampleContentStyle =
|
|
76
67
|
'padding: 16px; font-size: 13px; color: #374151; background: repeating-linear-gradient(45deg, #fff9c4, #fff9c4 4px, #fffde7 4px, #fffde7 8px);'
|
|
77
|
-
|
|
68
|
+
|
|
69
|
+
const wrapperStyle =
|
|
70
|
+
'box-sizing: border-box; width: 100%; max-width: 1200px; margin: 0 auto; padding: 20px; width: 500px;'
|
|
78
71
|
|
|
79
72
|
const defaultRender = (args: Args) => ({
|
|
80
73
|
components: { CpAccordion },
|
|
@@ -93,10 +86,10 @@ const defaultRender = (args: Args) => ({
|
|
|
93
86
|
return args
|
|
94
87
|
})
|
|
95
88
|
|
|
96
|
-
return { accordionArgs, sampleContentStyle }
|
|
89
|
+
return { accordionArgs, sampleContentStyle, wrapperStyle }
|
|
97
90
|
},
|
|
98
91
|
template: `
|
|
99
|
-
<div style="
|
|
92
|
+
<div :style="wrapperStyle">
|
|
100
93
|
<CpAccordion v-bind="accordionArgs">
|
|
101
94
|
<div :style="sampleContentStyle" />
|
|
102
95
|
</CpAccordion>
|
|
@@ -104,163 +97,199 @@ const defaultRender = (args: Args) => ({
|
|
|
104
97
|
`,
|
|
105
98
|
})
|
|
106
99
|
|
|
107
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Default accordion with a leading chevron icon, open by default and two quick actions.
|
|
102
|
+
*/
|
|
103
|
+
export const Default: Story = {
|
|
108
104
|
args: {
|
|
109
|
-
title: 'I have title.',
|
|
105
|
+
title: 'I have a title.',
|
|
106
|
+
defaultOpenState: true,
|
|
107
|
+
iconPosition: 'leading',
|
|
108
|
+
quickOptionsLimit: 2,
|
|
109
|
+
hideActionTrigger: false,
|
|
110
|
+
actions: defaultStoryActions,
|
|
110
111
|
},
|
|
111
|
-
render:
|
|
112
|
-
|
|
113
|
-
setup: () => ({
|
|
114
|
-
docPageStyle,
|
|
115
|
-
docSectionStyle,
|
|
116
|
-
docTitleStyle,
|
|
117
|
-
docRowColumnStyle,
|
|
118
|
-
docCellStyle,
|
|
119
|
-
docLabelStyle,
|
|
120
|
-
sampleContentStyle,
|
|
121
|
-
highlightedSlotStyle,
|
|
122
|
-
actions: defaultStoryActions,
|
|
123
|
-
}),
|
|
124
|
-
template: `
|
|
125
|
-
<div :style="docPageStyle">
|
|
126
|
-
<h1 style="margin: 0 0 24px 0; font-size: 28px; font-weight: 700; color: #111827;">CpAccordion</h1>
|
|
112
|
+
render: defaultRender,
|
|
113
|
+
}
|
|
127
114
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<div :style="docCellStyle">
|
|
132
|
-
<span :style="docLabelStyle">false</span>
|
|
133
|
-
<CpAccordion title="I have title." :default-open-state="false" icon-position="trailing">
|
|
134
|
-
<div :style="sampleContentStyle" />
|
|
135
|
-
</CpAccordion>
|
|
136
|
-
</div>
|
|
137
|
-
<div :style="docCellStyle">
|
|
138
|
-
<span :style="docLabelStyle">true</span>
|
|
139
|
-
<CpAccordion title="I have title." :default-open-state="true" icon-position="trailing">
|
|
140
|
-
<div :style="sampleContentStyle" />
|
|
141
|
-
</CpAccordion>
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
</section>
|
|
115
|
+
/* -------------------------------------------------------------------------- */
|
|
116
|
+
/* Icon position */
|
|
117
|
+
/* -------------------------------------------------------------------------- */
|
|
145
118
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
119
|
+
/**
|
|
120
|
+
* The chevron is rendered at the beginning of the header. This is the default.
|
|
121
|
+
* Actions can be combined with this layout.
|
|
122
|
+
*/
|
|
123
|
+
export const LeadingIcon: Story = {
|
|
124
|
+
args: {
|
|
125
|
+
...Default.args,
|
|
126
|
+
iconPosition: 'leading',
|
|
127
|
+
title: 'Leading chevron',
|
|
128
|
+
},
|
|
129
|
+
render: defaultRender,
|
|
130
|
+
}
|
|
149
131
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
</CpAccordion>
|
|
164
|
-
</div>
|
|
165
|
-
</div>
|
|
166
|
-
</section>
|
|
132
|
+
/**
|
|
133
|
+
* The chevron is rendered at the end of the header. This variant is
|
|
134
|
+
* action-less by design (the component enforces it through its prop types).
|
|
135
|
+
*/
|
|
136
|
+
export const TrailingIcon: Story = {
|
|
137
|
+
args: {
|
|
138
|
+
title: 'Trailing chevron',
|
|
139
|
+
defaultOpenState: false,
|
|
140
|
+
iconPosition: 'trailing',
|
|
141
|
+
quickOptionsLimit: 0,
|
|
142
|
+
},
|
|
143
|
+
render: defaultRender,
|
|
144
|
+
}
|
|
167
145
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
<div :style="docCellStyle">
|
|
172
|
-
<span :style="docLabelStyle">Default</span>
|
|
173
|
-
<CpAccordion title="DIDA TRAVEL" :default-open-state="false" icon-position="leading" :actions="actions" :quick-options-limit="3">
|
|
174
|
-
<template #trailing-slot>
|
|
175
|
-
This is a trailing slot
|
|
176
|
-
</template>
|
|
177
|
-
<div :style="sampleContentStyle" />
|
|
178
|
-
</CpAccordion>
|
|
179
|
-
</div>
|
|
180
|
-
<div :style="docCellStyle">
|
|
181
|
-
<span :style="docLabelStyle">Hide Action Trigger</span>
|
|
182
|
-
<CpAccordion
|
|
183
|
-
title="DIDA TRAVEL"
|
|
184
|
-
:default-open-state="false"
|
|
185
|
-
icon-position="leading"
|
|
186
|
-
style="background: var(--cp-background-primary-hover);"
|
|
187
|
-
:actions="actions"
|
|
188
|
-
:quick-options-limit="3"
|
|
189
|
-
hide-action-trigger
|
|
190
|
-
>
|
|
191
|
-
<template #trailing-slot>
|
|
192
|
-
This is a trailing slot
|
|
193
|
-
</template>
|
|
194
|
-
<div :style="sampleContentStyle" />
|
|
195
|
-
</CpAccordion>
|
|
196
|
-
</div>
|
|
197
|
-
</div>
|
|
198
|
-
</section>
|
|
146
|
+
/* -------------------------------------------------------------------------- */
|
|
147
|
+
/* Open state */
|
|
148
|
+
/* -------------------------------------------------------------------------- */
|
|
199
149
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
<div :style="docCellStyle">
|
|
212
|
-
<CpAccordion title="DIDA TRAVEL" :default-open-state="false" icon-position="trailing">
|
|
213
|
-
<template #leading-slot>
|
|
214
|
-
<span :style="highlightedSlotStyle">I have text.</span>
|
|
215
|
-
</template>
|
|
216
|
-
<div :style="sampleContentStyle" />
|
|
217
|
-
</CpAccordion>
|
|
218
|
-
</div>
|
|
219
|
-
</div>
|
|
220
|
-
</section>
|
|
150
|
+
/**
|
|
151
|
+
* The accordion renders open on first mount.
|
|
152
|
+
*/
|
|
153
|
+
export const OpenByDefault: Story = {
|
|
154
|
+
args: {
|
|
155
|
+
...Default.args,
|
|
156
|
+
defaultOpenState: true,
|
|
157
|
+
title: 'Open on mount',
|
|
158
|
+
},
|
|
159
|
+
render: defaultRender,
|
|
160
|
+
}
|
|
221
161
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
<div :style="sampleContentStyle" />
|
|
231
|
-
</CpAccordion>
|
|
232
|
-
</div>
|
|
233
|
-
<div :style="docCellStyle">
|
|
234
|
-
<CpAccordion title="DIDA TRAVEL" :default-open-state="false" icon-position="trailing">
|
|
235
|
-
<template #trailing-slot>
|
|
236
|
-
<span :style="highlightedSlotStyle">I have text.</span>
|
|
237
|
-
</template>
|
|
238
|
-
<div :style="sampleContentStyle" />
|
|
239
|
-
</CpAccordion>
|
|
240
|
-
</div>
|
|
241
|
-
</div>
|
|
242
|
-
</section>
|
|
243
|
-
</div>
|
|
244
|
-
`,
|
|
245
|
-
}),
|
|
246
|
-
parameters: {
|
|
247
|
-
controls: { disable: true },
|
|
248
|
-
docs: {
|
|
249
|
-
source: {
|
|
250
|
-
code: null,
|
|
251
|
-
},
|
|
252
|
-
},
|
|
162
|
+
/**
|
|
163
|
+
* The accordion renders closed on first mount.
|
|
164
|
+
*/
|
|
165
|
+
export const ClosedByDefault: Story = {
|
|
166
|
+
args: {
|
|
167
|
+
...Default.args,
|
|
168
|
+
defaultOpenState: false,
|
|
169
|
+
title: 'Closed on mount',
|
|
253
170
|
},
|
|
171
|
+
render: defaultRender,
|
|
254
172
|
}
|
|
255
173
|
|
|
256
|
-
|
|
174
|
+
/* -------------------------------------------------------------------------- */
|
|
175
|
+
/* Actions & quick options */
|
|
176
|
+
/* -------------------------------------------------------------------------- */
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Pass `actions` (a `MenuItem[]`) to reveal a contextual menu on hover/focus.
|
|
180
|
+
* Only available in `leading` icon mode.
|
|
181
|
+
*/
|
|
182
|
+
export const WithActions: Story = {
|
|
183
|
+
args: {
|
|
184
|
+
...Default.args,
|
|
185
|
+
title: 'Accordion with a contextual menu',
|
|
186
|
+
quickOptionsLimit: 0,
|
|
187
|
+
actions: defaultStoryActions,
|
|
188
|
+
},
|
|
189
|
+
render: defaultRender,
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Use `quickOptionsLimit` to display N action triggers inline at the start of
|
|
194
|
+
* the header in addition to the overflow menu.
|
|
195
|
+
*/
|
|
196
|
+
export const WithQuickOptions: Story = {
|
|
197
|
+
args: {
|
|
198
|
+
...Default.args,
|
|
199
|
+
title: 'With quick options',
|
|
200
|
+
quickOptionsLimit: 2,
|
|
201
|
+
actions: defaultStoryActions,
|
|
202
|
+
},
|
|
203
|
+
render: defaultRender,
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Same as `WithActions`, but the inline action trigger (the `…` button) is
|
|
208
|
+
* hidden. Useful when actions are surfaced elsewhere.
|
|
209
|
+
*/
|
|
210
|
+
export const HideActionTrigger: Story = {
|
|
257
211
|
args: {
|
|
258
|
-
|
|
212
|
+
...Default.args,
|
|
213
|
+
title: 'Action trigger hidden',
|
|
214
|
+
hideActionTrigger: true,
|
|
215
|
+
actions: defaultStoryActions,
|
|
216
|
+
},
|
|
217
|
+
render: defaultRender,
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* An accordion without any inline actions.
|
|
222
|
+
*/
|
|
223
|
+
export const WithoutActions: Story = {
|
|
224
|
+
args: {
|
|
225
|
+
title: 'Plain accordion',
|
|
259
226
|
defaultOpenState: true,
|
|
260
227
|
iconPosition: 'leading',
|
|
261
|
-
quickOptionsLimit:
|
|
228
|
+
quickOptionsLimit: 0,
|
|
262
229
|
hideActionTrigger: false,
|
|
263
|
-
actions:
|
|
230
|
+
actions: [],
|
|
264
231
|
},
|
|
265
232
|
render: defaultRender,
|
|
266
233
|
}
|
|
234
|
+
|
|
235
|
+
/* -------------------------------------------------------------------------- */
|
|
236
|
+
/* Slots */
|
|
237
|
+
/* -------------------------------------------------------------------------- */
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* The `leading-slot` lets you append rich content next to the title
|
|
241
|
+
* (e.g. meta, badges).
|
|
242
|
+
*/
|
|
243
|
+
export const WithLeadingSlot: Story = {
|
|
244
|
+
args: {
|
|
245
|
+
...Default.args,
|
|
246
|
+
title: 'Accordion with leading slot',
|
|
247
|
+
actions: [],
|
|
248
|
+
quickOptionsLimit: 0,
|
|
249
|
+
},
|
|
250
|
+
render: (args: Args) => ({
|
|
251
|
+
components: { CpAccordion },
|
|
252
|
+
setup() {
|
|
253
|
+
return { args, sampleContentStyle, wrapperStyle }
|
|
254
|
+
},
|
|
255
|
+
template: `
|
|
256
|
+
<div :style="wrapperStyle">
|
|
257
|
+
<CpAccordion v-bind="args">
|
|
258
|
+
<template #leading-slot>
|
|
259
|
+
<span style="font-size: 12px; color: #6b7280; margin-top: 4px;">Additional context below the title</span>
|
|
260
|
+
</template>
|
|
261
|
+
<div :style="sampleContentStyle" />
|
|
262
|
+
</CpAccordion>
|
|
263
|
+
</div>
|
|
264
|
+
`,
|
|
265
|
+
}),
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* The `trailing-slot` is shown on the right of the header. It supports any
|
|
270
|
+
* custom content (e.g. timestamps, counters).
|
|
271
|
+
*/
|
|
272
|
+
export const WithTrailingSlot: Story = {
|
|
273
|
+
args: {
|
|
274
|
+
...Default.args,
|
|
275
|
+
title: 'Accordion with trailing slot',
|
|
276
|
+
actions: [],
|
|
277
|
+
quickOptionsLimit: 0,
|
|
278
|
+
},
|
|
279
|
+
render: (args: Args) => ({
|
|
280
|
+
components: { CpAccordion },
|
|
281
|
+
setup() {
|
|
282
|
+
return { args, sampleContentStyle, wrapperStyle }
|
|
283
|
+
},
|
|
284
|
+
template: `
|
|
285
|
+
<div :style="wrapperStyle">
|
|
286
|
+
<CpAccordion v-bind="args">
|
|
287
|
+
<template #trailing-slot>
|
|
288
|
+
<span style="font-size: 12px; color: #6b7280;">Last edit · 2 min ago</span>
|
|
289
|
+
</template>
|
|
290
|
+
<div :style="sampleContentStyle" />
|
|
291
|
+
</CpAccordion>
|
|
292
|
+
</div>
|
|
293
|
+
`,
|
|
294
|
+
}),
|
|
295
|
+
}
|
|
@@ -6,18 +6,12 @@ import type { MenuItem } from 'primevue/menuitem'
|
|
|
6
6
|
import CpAccordion from '@/components/CpAccordion.vue'
|
|
7
7
|
import CpAccordionGroup from '@/components/CpAccordionGroup.vue'
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
docCellStyle,
|
|
11
|
-
docLabelStyle,
|
|
12
|
-
docPageStyle,
|
|
13
|
-
docRowColumnStyle,
|
|
14
|
-
docSectionStyle,
|
|
15
|
-
docTitleStyle,
|
|
16
|
-
} from '@/stories/documentationStyles'
|
|
17
|
-
|
|
18
9
|
const sampleContentStyle =
|
|
19
10
|
'padding: 16px; font-size: 13px; color: #374151; background: repeating-linear-gradient(45deg, #fff9c4, #fff9c4 4px, #fffde7 4px, #fffde7 8px);'
|
|
20
11
|
|
|
12
|
+
const wrapperStyle =
|
|
13
|
+
'box-sizing: border-box; width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px; width: 500px;'
|
|
14
|
+
|
|
21
15
|
type CpAccordionGroupStoryArgs = {
|
|
22
16
|
itemActions: MenuItem[]
|
|
23
17
|
itemDefaultOpenState: boolean
|
|
@@ -43,7 +37,7 @@ const defaultItemActions: MenuItem[] = [
|
|
|
43
37
|
]
|
|
44
38
|
|
|
45
39
|
const meta = {
|
|
46
|
-
title: '
|
|
40
|
+
title: 'Molecules/CpAccordionGroup',
|
|
47
41
|
component: CpAccordionGroup,
|
|
48
42
|
argTypes: {
|
|
49
43
|
variant: {
|
|
@@ -110,10 +104,10 @@ const defaultRender = (args: Args) => ({
|
|
|
110
104
|
}
|
|
111
105
|
})
|
|
112
106
|
|
|
113
|
-
return { accordionBind, args, sampleContentStyle }
|
|
107
|
+
return { accordionBind, args, sampleContentStyle, wrapperStyle }
|
|
114
108
|
},
|
|
115
109
|
template: `
|
|
116
|
-
<div style="
|
|
110
|
+
<div :style="wrapperStyle">
|
|
117
111
|
<CpAccordionGroup :variant="args.variant">
|
|
118
112
|
<CpAccordion
|
|
119
113
|
v-for="i in 3"
|
|
@@ -128,91 +122,13 @@ const defaultRender = (args: Args) => ({
|
|
|
128
122
|
`,
|
|
129
123
|
})
|
|
130
124
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
render: () => ({
|
|
136
|
-
components: { CpAccordion, CpAccordionGroup },
|
|
137
|
-
setup: () => ({
|
|
138
|
-
docPageStyle,
|
|
139
|
-
docSectionStyle,
|
|
140
|
-
docTitleStyle,
|
|
141
|
-
docRowColumnStyle,
|
|
142
|
-
docCellStyle,
|
|
143
|
-
docLabelStyle,
|
|
144
|
-
sampleContentStyle,
|
|
145
|
-
}),
|
|
146
|
-
template: `
|
|
147
|
-
<div :style="docPageStyle">
|
|
148
|
-
<h1 style="margin: 0 0 24px 0; font-size: 28px; font-weight: 700; color: #111827;">CpAccordionGroup</h1>
|
|
149
|
-
|
|
150
|
-
<section :style="docSectionStyle">
|
|
151
|
-
<h2 :style="docTitleStyle">Style</h2>
|
|
152
|
-
<div :style="docRowColumnStyle">
|
|
153
|
-
<div :style="docCellStyle">
|
|
154
|
-
<span :style="docLabelStyle">Minimal</span>
|
|
155
|
-
<CpAccordionGroup variant="minimal">
|
|
156
|
-
<CpAccordion key="doc-default-1" title="DIDA TRAVEL" icon-position="leading">
|
|
157
|
-
<div :style="sampleContentStyle" />
|
|
158
|
-
</CpAccordion>
|
|
159
|
-
<CpAccordion key="doc-default-2" title="DIDA TRAVEL" icon-position="leading">
|
|
160
|
-
<div :style="sampleContentStyle" />
|
|
161
|
-
</CpAccordion>
|
|
162
|
-
<CpAccordion key="doc-default-3" title="DIDA TRAVEL" icon-position="leading">
|
|
163
|
-
<div :style="sampleContentStyle" />
|
|
164
|
-
</CpAccordion>
|
|
165
|
-
</CpAccordionGroup>
|
|
166
|
-
</div>
|
|
167
|
-
|
|
168
|
-
<div :style="docCellStyle">
|
|
169
|
-
<span :style="docLabelStyle">Default</span>
|
|
170
|
-
<CpAccordionGroup variant="default">
|
|
171
|
-
<CpAccordion key="doc-bb-1" title="DIDA TRAVEL" icon-position="leading">
|
|
172
|
-
<div :style="sampleContentStyle" />
|
|
173
|
-
</CpAccordion>
|
|
174
|
-
<CpAccordion key="doc-bb-2" title="DIDA TRAVEL" icon-position="leading">
|
|
175
|
-
<div :style="sampleContentStyle" />
|
|
176
|
-
</CpAccordion>
|
|
177
|
-
<CpAccordion key="doc-bb-3" title="DIDA TRAVEL" icon-position="leading">
|
|
178
|
-
<div :style="sampleContentStyle" />
|
|
179
|
-
</CpAccordion>
|
|
180
|
-
</CpAccordionGroup>
|
|
181
|
-
</div>
|
|
182
|
-
|
|
183
|
-
<div :style="docCellStyle">
|
|
184
|
-
<span :style="docLabelStyle">Primary</span>
|
|
185
|
-
<CpAccordionGroup variant="primary">
|
|
186
|
-
<CpAccordion key="doc-gb-1" title="DIDA TRAVEL" icon-position="leading">
|
|
187
|
-
<div :style="sampleContentStyle" />
|
|
188
|
-
</CpAccordion>
|
|
189
|
-
<CpAccordion key="doc-gb-2" title="DIDA TRAVEL" icon-position="leading">
|
|
190
|
-
<div :style="sampleContentStyle" />
|
|
191
|
-
</CpAccordion>
|
|
192
|
-
<CpAccordion key="doc-gb-3" title="DIDA TRAVEL" icon-position="leading">
|
|
193
|
-
<div :style="sampleContentStyle" />
|
|
194
|
-
</CpAccordion>
|
|
195
|
-
</CpAccordionGroup>
|
|
196
|
-
</div>
|
|
197
|
-
</div>
|
|
198
|
-
</section>
|
|
199
|
-
</div>
|
|
200
|
-
`,
|
|
201
|
-
}),
|
|
202
|
-
parameters: {
|
|
203
|
-
controls: { disable: true },
|
|
204
|
-
docs: {
|
|
205
|
-
source: {
|
|
206
|
-
code: null,
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
}
|
|
211
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Default accordion group rendered with the `default` variant.
|
|
127
|
+
*/
|
|
212
128
|
export const Default: Story = {
|
|
213
129
|
args: {
|
|
214
130
|
variant: 'default',
|
|
215
|
-
itemTitle: '
|
|
131
|
+
itemTitle: 'Accordion',
|
|
216
132
|
itemDefaultOpenState: false,
|
|
217
133
|
itemIconPosition: 'leading',
|
|
218
134
|
itemQuickOptionsLimit: 2,
|
|
@@ -221,3 +137,43 @@ export const Default: Story = {
|
|
|
221
137
|
},
|
|
222
138
|
render: defaultRender,
|
|
223
139
|
}
|
|
140
|
+
|
|
141
|
+
/* -------------------------------------------------------------------------- */
|
|
142
|
+
/* Variants */
|
|
143
|
+
/* -------------------------------------------------------------------------- */
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Minimal variant: no container border, no separators between items. Use when
|
|
147
|
+
* the grouping is implicit in the surrounding layout.
|
|
148
|
+
*/
|
|
149
|
+
export const Minimal: Story = {
|
|
150
|
+
args: {
|
|
151
|
+
...Default.args,
|
|
152
|
+
variant: 'minimal',
|
|
153
|
+
},
|
|
154
|
+
render: defaultRender,
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Default variant: thin separator lines between items, no outer border.
|
|
159
|
+
* This is the most common variant.
|
|
160
|
+
*/
|
|
161
|
+
export const DefaultVariant: Story = {
|
|
162
|
+
args: {
|
|
163
|
+
...Default.args,
|
|
164
|
+
variant: 'default',
|
|
165
|
+
},
|
|
166
|
+
render: defaultRender,
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Primary variant: the group is wrapped in a rounded card with an outer border
|
|
171
|
+
* and separators between items.
|
|
172
|
+
*/
|
|
173
|
+
export const Primary: Story = {
|
|
174
|
+
args: {
|
|
175
|
+
...Default.args,
|
|
176
|
+
variant: 'primary',
|
|
177
|
+
},
|
|
178
|
+
render: defaultRender,
|
|
179
|
+
}
|