@citizenplane/pimp 16.0.3 → 16.2.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.
Files changed (71) hide show
  1. package/dist/pimp.es.js +781 -757
  2. package/dist/pimp.umd.js +21 -21
  3. package/dist/style.css +1 -1
  4. package/package.json +10 -8
  5. package/src/components/CpDate.vue +3 -1
  6. package/src/components/CpHeading.vue +4 -5
  7. package/src/components/CpMultiselect.vue +2 -5
  8. package/src/components/CpTable.vue +4 -2
  9. package/src/components/CpTelInput.vue +18 -12
  10. package/src/components/CpText.vue +141 -0
  11. package/src/components/CpToast.vue +1 -1
  12. package/src/components/CpTransitionExpand.vue +23 -20
  13. package/src/components/index.ts +2 -0
  14. package/src/libs/CoreDatepicker.vue +1 -0
  15. package/src/stories/BaseInputLabel.stories.ts +36 -9
  16. package/src/stories/Colors.mdx +9 -0
  17. package/src/stories/Colors.stories.ts +177 -0
  18. package/src/stories/CpAccordion.stories.ts +188 -159
  19. package/src/stories/CpAccordionGroup.stories.ts +51 -95
  20. package/src/stories/CpAirlineLogo.stories.ts +52 -28
  21. package/src/stories/CpAlert.stories.ts +196 -159
  22. package/src/stories/CpBadge.stories.ts +260 -194
  23. package/src/stories/CpButton.stories.ts +257 -426
  24. package/src/stories/CpCheckbox.stories.ts +102 -30
  25. package/src/stories/CpContextualMenu.stories.ts +14 -9
  26. package/src/stories/CpDate.stories.ts +53 -26
  27. package/src/stories/CpDatepicker.stories.ts +53 -80
  28. package/src/stories/CpDialog.stories.ts +23 -2
  29. package/src/stories/CpHeading.stories.ts +60 -20
  30. package/src/stories/CpIcon.stories.ts +98 -31
  31. package/src/stories/CpInput.stories.ts +164 -73
  32. package/src/stories/CpItemActions.stories.ts +23 -12
  33. package/src/stories/CpLoader.stories.ts +55 -7
  34. package/src/stories/CpMenuItem.stories.ts +53 -27
  35. package/src/stories/CpMultiselect.stories.ts +53 -72
  36. package/src/stories/CpPartnerBadge.stories.ts +58 -76
  37. package/src/stories/CpRadio.stories.ts +45 -49
  38. package/src/stories/CpRadioGroup.stories.ts +47 -40
  39. package/src/stories/CpSelect.stories.ts +108 -34
  40. package/src/stories/CpSelectMenu.stories.ts +66 -55
  41. package/src/stories/CpSelectableButton.stories.ts +170 -81
  42. package/src/stories/CpSwitch.stories.ts +136 -134
  43. package/src/stories/CpTable.stories.ts +69 -13
  44. package/src/stories/CpTableEmptyState.stories.ts +11 -7
  45. package/src/stories/CpTabs.stories.ts +23 -5
  46. package/src/stories/CpTelInput.stories.ts +28 -19
  47. package/src/stories/CpText.stories.ts +131 -0
  48. package/src/stories/CpTextarea.stories.ts +74 -27
  49. package/src/stories/CpToast.stories.ts +75 -109
  50. package/src/stories/CpTooltip.stories.ts +82 -77
  51. package/src/stories/CpTransitionCounter.stories.ts +5 -1
  52. package/src/stories/CpTransitionExpand.stories.ts +12 -7
  53. package/src/stories/CpTransitionListItems.stories.ts +6 -1
  54. package/src/stories/CpTransitionSize.stories.ts +9 -1
  55. package/src/stories/CpTransitionSlide.stories.ts +5 -1
  56. package/src/stories/CpTransitionTabContent.stories.ts +5 -1
  57. package/src/stories/Dimensions.mdx +9 -0
  58. package/src/stories/Dimensions.stories.ts +119 -0
  59. package/src/stories/Easings.mdx +9 -0
  60. package/src/stories/Easings.stories.ts +101 -0
  61. package/src/stories/FocusRings.mdx +9 -0
  62. package/src/stories/FocusRings.stories.ts +74 -0
  63. package/src/stories/Shadows.mdx +9 -0
  64. package/src/stories/Shadows.stories.ts +100 -0
  65. package/src/stories/Typography.mdx +9 -0
  66. package/src/stories/Typography.stories.ts +181 -0
  67. package/src/stories/documentationStyles.ts +2 -10
  68. package/src/stories/tokenUtils.ts +259 -0
  69. package/src/types/primevue-toasteventbus.d.ts +14 -0
  70. package/tsconfig.json +1 -0
  71. package/.lintstagedrc.json +0 -4
@@ -0,0 +1,177 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3-vite'
2
+
3
+ import { docLabelStyle } from '@/stories/documentationStyles'
4
+ import type { Token } from '@/stories/tokenUtils'
5
+ import { copyableClass, copyableCopiedClass, readTokens, useCopier } from '@/stories/tokenUtils'
6
+
7
+ const meta: Meta = {
8
+ title: 'Foundations/Colors',
9
+ tags: ['!dev'],
10
+ parameters: {
11
+ layout: 'padded',
12
+ controls: { disable: true },
13
+ docs: { source: { code: null } },
14
+ },
15
+ }
16
+
17
+ export default meta
18
+
19
+ type Story = StoryObj
20
+
21
+ const FAMILIES = ['accent', 'blue', 'error', 'magenta', 'neutral', 'pink', 'success', 'warning', 'yellow'] as const
22
+
23
+ const FAMILY_ORDER: readonly string[] = [
24
+ 'base',
25
+ 'accent',
26
+ 'error',
27
+ 'warning',
28
+ 'success',
29
+ 'blue',
30
+ 'pink',
31
+ 'magenta',
32
+ 'yellow',
33
+ 'neutral',
34
+ ]
35
+
36
+ const FAMILY_LABEL: Record<string, string> = {
37
+ base: 'Base',
38
+ accent: 'Accent',
39
+ error: 'Error',
40
+ warning: 'Warning',
41
+ success: 'Success',
42
+ blue: 'Blue',
43
+ pink: 'Pink',
44
+ magenta: 'Magenta',
45
+ yellow: 'Yellow',
46
+ neutral: 'Neutral',
47
+ }
48
+
49
+ const gridStyle = 'display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px;'
50
+
51
+ const cardStyle =
52
+ 'display: flex; flex-direction: column; border: 1px solid #e9eaf6; border-radius: 8px; overflow: hidden; background: #ffffff;'
53
+
54
+ const swatchStyle = (tokenName: string) =>
55
+ `height: 72px; background: var(${tokenName}); border-bottom: 1px solid rgba(0, 0, 0, 0.06);`
56
+
57
+ const cardBodyStyle = 'display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;'
58
+
59
+ const cardNameStyle =
60
+ 'font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: #111; word-break: break-all;'
61
+
62
+ const cardValueStyle =
63
+ 'font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: #6b7280; word-break: break-all;'
64
+
65
+ const familyGroupStyle = 'display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px;'
66
+
67
+ type Family = { label: string; tokens: Token[] }
68
+
69
+ const familyOf = (name: string, prefix: string): string => {
70
+ const rest = name.startsWith(prefix) ? name.slice(prefix.length) : name
71
+ const first = rest.split('-')[0]
72
+ return (FAMILIES as readonly string[]).includes(first) ? first : 'base'
73
+ }
74
+
75
+ const groupByFamily = (tokens: Token[], prefix: string): Family[] => {
76
+ const byFamily = new Map<string, Token[]>()
77
+ for (const token of tokens) {
78
+ const key = familyOf(token.name, prefix)
79
+ const bucket = byFamily.get(key) ?? []
80
+ bucket.push(token)
81
+ byFamily.set(key, bucket)
82
+ }
83
+ return FAMILY_ORDER.filter((key) => byFamily.has(key)).map((key) => ({
84
+ label: FAMILY_LABEL[key] ?? key,
85
+ tokens: byFamily.get(key) ?? [],
86
+ }))
87
+ }
88
+
89
+ type SectionArgs = { exclude?: (RegExp | string)[]; prefix: string }
90
+
91
+ const makeSectionStory = (section: SectionArgs): Story => ({
92
+ render: () => ({
93
+ setup() {
94
+ const tokens = readTokens([section.prefix], section.exclude ?? [])
95
+ const { copiedKey, copy } = useCopier()
96
+ return {
97
+ count: tokens.length,
98
+ families: groupByFamily(tokens, section.prefix),
99
+ copiedKey,
100
+ copy,
101
+ labelStyle: docLabelStyle,
102
+ groupStyle: familyGroupStyle,
103
+ grid: gridStyle,
104
+ card: cardStyle,
105
+ body: cardBodyStyle,
106
+ nameText: cardNameStyle,
107
+ valueText: cardValueStyle,
108
+ copyClass: copyableClass,
109
+ copiedClass: copyableCopiedClass,
110
+ swatch: (tokenName: string) => swatchStyle(tokenName),
111
+ }
112
+ },
113
+ template: `
114
+ <div v-if="count > 0">
115
+ <div v-for="family in families" :key="family.label" :style="groupStyle">
116
+ <span :style="labelStyle">{{ family.label }} ({{ family.tokens.length }})</span>
117
+ <div :style="grid">
118
+ <div v-for="token in family.tokens" :key="token.name" :style="card">
119
+ <div :style="swatch(token.name)"></div>
120
+ <div :style="body">
121
+ <span
122
+ :style="nameText"
123
+ :class="[copyClass, copiedKey === token.name ? copiedClass : '']"
124
+ role="button"
125
+ tabindex="0"
126
+ :title="'Click to copy ' + token.name"
127
+ @click="copy(token.name)"
128
+ @keydown.enter.prevent="copy(token.name)"
129
+ @keydown.space.prevent="copy(token.name)"
130
+ >{{ copiedKey === token.name ? 'Copied!' : token.name }}</span>
131
+ <span :style="valueText">{{ token.value }}</span>
132
+ </div>
133
+ </div>
134
+ </div>
135
+ </div>
136
+ </div>
137
+ <div v-else style="padding: 12px 0; color: #9ca3af; font-size: 12px;">No tokens</div>
138
+ `,
139
+ }),
140
+ })
141
+
142
+ /**
143
+ * Surface colors used for page, card and control backgrounds.
144
+ */
145
+ export const Background: Story = makeSectionStory({ prefix: '--cp-background-' })
146
+
147
+ /**
148
+ * Border colors for dividers, card outlines and control edges.
149
+ */
150
+ export const Border: Story = makeSectionStory({ prefix: '--cp-border-' })
151
+
152
+ /**
153
+ * Foreground colors used for icons, illustrations and decorative surfaces
154
+ * that sit on top of the background.
155
+ */
156
+ export const Foreground: Story = makeSectionStory({ prefix: '--cp-foreground-' })
157
+
158
+ /**
159
+ * Text colors. Typography size, line-height and letter-spacing tokens live
160
+ * under the Typography section.
161
+ */
162
+ export const Text: Story = makeSectionStory({
163
+ prefix: '--cp-text-',
164
+ exclude: [/-line-height$/, /-letter-spacing$/, /^--cp-text-size-/],
165
+ })
166
+
167
+ /**
168
+ * Utility colors for transient UI surfaces such as overlays, shadows or
169
+ * state indicators.
170
+ */
171
+ export const Utility: Story = makeSectionStory({ prefix: '--cp-utility-' })
172
+
173
+ /**
174
+ * Dedicated colors used by focus rings. See the Focus Rings section for
175
+ * composite ring tokens.
176
+ */
177
+ export const Focus: Story = makeSectionStory({ prefix: '--cp-focus' })
@@ -1,20 +1,11 @@
1
1
  import { computed } from 'vue'
2
2
 
3
- import type { Args, Meta, StoryObj } from '@storybook/vue3'
3
+ import type { Args, Meta, StoryObj } from '@storybook/vue3-vite'
4
4
  import type { MenuItem } from 'primevue/menuitem'
5
5
 
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: 'Visual/CpAccordion',
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 options to display',
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
- const highlightedSlotStyle = 'background: #fff9c4;'
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="box-sizing: border-box; width: 100%; max-width: 1200px; margin: 0 auto; padding: 20px; width: 500px;">
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
- export const Documentation: Story = {
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
- components: { CpAccordion },
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
- <section :style="docSectionStyle">
129
- <h2 :style="docTitleStyle">Is Open</h2>
130
- <div :style="docRowColumnStyle">
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
- <h2 style="margin: 0 0 16px 0; font-size: 16px; font-weight: 600; color: #111827;">
147
- Unpublished Base: <span style="font-weight: 700;">Accordion Header</span>
148
- </h2>
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
- <section :style="docSectionStyle">
151
- <h2 :style="docTitleStyle">Style</h2>
152
- <div :style="docRowColumnStyle">
153
- <div :style="docCellStyle">
154
- <span :style="docLabelStyle">Leading Chevron</span>
155
- <CpAccordion title="DIDA TRAVEL" :default-open-state="false" icon-position="leading">
156
- <div :style="sampleContentStyle" />
157
- </CpAccordion>
158
- </div>
159
- <div :style="docCellStyle">
160
- <span :style="docLabelStyle">Trailing Chevron</span>
161
- <CpAccordion title="DIDA TRAVEL" :default-open-state="false" icon-position="trailing">
162
- <div :style="sampleContentStyle" />
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
- <section :style="docSectionStyle">
169
- <h2 :style="docTitleStyle">Actions</h2>
170
- <div :style="docRowColumnStyle">
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
- <section :style="docSectionStyle">
201
- <h2 :style="docTitleStyle">Has Leading Slot</h2>
202
- <div :style="docRowColumnStyle">
203
- <div :style="docCellStyle">
204
- <CpAccordion title="DIDA TRAVEL" :default-open-state="false" icon-position="leading" :actions="actions" :quick-options-limit="3">
205
- <template #leading-slot>
206
- <span :style="highlightedSlotStyle">I have text.</span>
207
- </template>
208
- <div :style="sampleContentStyle" />
209
- </CpAccordion>
210
- </div>
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
- <section :style="docSectionStyle">
223
- <h2 :style="docTitleStyle">Has Trailing Slot</h2>
224
- <div :style="docRowColumnStyle">
225
- <div :style="docCellStyle">
226
- <CpAccordion title="DIDA TRAVEL" :default-open-state="false" icon-position="leading">
227
- <template #trailing-slot>
228
- <span :style="highlightedSlotStyle">I have text.</span>
229
- </template>
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
- export const Default: Story = {
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
- title: 'I have title.',
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: 2,
228
+ quickOptionsLimit: 0,
262
229
  hideActionTrigger: false,
263
- actions: defaultStoryActions,
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
+ }