@citizenplane/pimp 16.0.3 → 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 +313 -285
- package/dist/pimp.umd.js +21 -21
- package/dist/style.css +1 -1
- package/package.json +2 -1
- 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 +195 -158
- 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
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
1
|
+
import type { Args, Meta, StoryObj } from '@storybook/vue3'
|
|
2
2
|
|
|
3
3
|
import CpAirlineLogo from '@/components/CpAirlineLogo.vue'
|
|
4
4
|
|
|
5
|
+
import { docCellStyle, docLabelStyle, docRowWrapStyle } from '@/stories/documentationStyles'
|
|
6
|
+
|
|
7
|
+
const airlineSizes = [16, 24, 32, 48] as const
|
|
8
|
+
|
|
5
9
|
const meta = {
|
|
6
|
-
title: '
|
|
10
|
+
title: 'Atoms/CpAirlineLogo',
|
|
7
11
|
component: CpAirlineLogo,
|
|
8
12
|
parameters: {
|
|
9
13
|
docs: {
|
|
10
14
|
description: {
|
|
11
15
|
component:
|
|
12
|
-
'
|
|
16
|
+
'Displays an airline logo fetched from the Kiwi.com CDN using its IATA code. Falls back to a placeholder when the code is unknown.',
|
|
13
17
|
},
|
|
14
18
|
},
|
|
15
19
|
},
|
|
16
20
|
argTypes: {
|
|
17
21
|
iataCode: {
|
|
18
22
|
control: 'text',
|
|
19
|
-
description: 'The IATA airline code (e.g
|
|
23
|
+
description: 'The IATA airline code (e.g. "LH" for Lufthansa, "BA" for British Airways)',
|
|
20
24
|
table: {
|
|
21
25
|
type: { summary: 'string' },
|
|
22
26
|
defaultValue: { summary: '1L' },
|
|
@@ -31,21 +35,23 @@ const meta = {
|
|
|
31
35
|
},
|
|
32
36
|
},
|
|
33
37
|
},
|
|
34
|
-
tags: ['autodocs'],
|
|
35
38
|
} satisfies Meta<typeof CpAirlineLogo>
|
|
36
39
|
|
|
37
40
|
export default meta
|
|
38
41
|
type Story = StoryObj<typeof meta>
|
|
39
42
|
|
|
40
|
-
const
|
|
41
|
-
const defaultRender = (args) => ({
|
|
43
|
+
const defaultRender = (args: Args) => ({
|
|
42
44
|
components: { CpAirlineLogo },
|
|
43
45
|
setup() {
|
|
44
46
|
return { args }
|
|
45
47
|
},
|
|
46
|
-
template:
|
|
48
|
+
template: '<CpAirlineLogo v-bind="args" />',
|
|
47
49
|
})
|
|
48
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Default airline logo. Use the controls to experiment with each prop in
|
|
53
|
+
* isolation.
|
|
54
|
+
*/
|
|
49
55
|
export const Default: Story = {
|
|
50
56
|
args: {
|
|
51
57
|
iataCode: 'AF',
|
|
@@ -54,40 +60,55 @@ export const Default: Story = {
|
|
|
54
60
|
render: defaultRender,
|
|
55
61
|
}
|
|
56
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Logo rendered at the sizes most commonly used across the design system.
|
|
65
|
+
*/
|
|
66
|
+
export const Sizes: Story = {
|
|
67
|
+
parameters: { controls: { disable: true } },
|
|
68
|
+
render: () => ({
|
|
69
|
+
components: { CpAirlineLogo },
|
|
70
|
+
setup() {
|
|
71
|
+
return { airlineSizes, docCellStyle, docLabelStyle, docRowWrapStyle }
|
|
72
|
+
},
|
|
73
|
+
template: `
|
|
74
|
+
<div :style="docRowWrapStyle">
|
|
75
|
+
<div v-for="size in airlineSizes" :key="size" :style="docCellStyle">
|
|
76
|
+
<span :style="docLabelStyle">{{ size }}px</span>
|
|
77
|
+
<CpAirlineLogo iata-code="AF" :size="size" />
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
`,
|
|
81
|
+
}),
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* A sample of common airline logos displayed side by side.
|
|
86
|
+
*/
|
|
57
87
|
export const MultipleAirlines: Story = {
|
|
88
|
+
parameters: { controls: { disable: true } },
|
|
58
89
|
render: () => ({
|
|
59
90
|
components: { CpAirlineLogo },
|
|
60
91
|
template: `
|
|
61
92
|
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
|
|
62
|
-
<CpAirlineLogo
|
|
63
|
-
<CpAirlineLogo
|
|
64
|
-
<CpAirlineLogo
|
|
65
|
-
<CpAirlineLogo
|
|
66
|
-
<CpAirlineLogo
|
|
67
|
-
<CpAirlineLogo
|
|
93
|
+
<CpAirlineLogo iata-code="1L" :size="32" />
|
|
94
|
+
<CpAirlineLogo iata-code="BA" :size="32" />
|
|
95
|
+
<CpAirlineLogo iata-code="EK" :size="32" />
|
|
96
|
+
<CpAirlineLogo iata-code="AA" :size="32" />
|
|
97
|
+
<CpAirlineLogo iata-code="AF" :size="32" />
|
|
98
|
+
<CpAirlineLogo iata-code="KL" :size="32" />
|
|
68
99
|
</div>
|
|
69
100
|
`,
|
|
70
101
|
}),
|
|
71
|
-
parameters: {
|
|
72
|
-
docs: {
|
|
73
|
-
description: {
|
|
74
|
-
story: 'Multiple airline logos displayed together.',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
102
|
}
|
|
79
103
|
|
|
104
|
+
/**
|
|
105
|
+
* With an empty `iataCode`, the component falls back to a neutral
|
|
106
|
+
* placeholder.
|
|
107
|
+
*/
|
|
80
108
|
export const EmptyIATACode: Story = {
|
|
81
109
|
args: {
|
|
82
110
|
iataCode: '',
|
|
83
111
|
size: 32,
|
|
84
112
|
},
|
|
85
113
|
render: defaultRender,
|
|
86
|
-
parameters: {
|
|
87
|
-
docs: {
|
|
88
|
-
description: {
|
|
89
|
-
story: 'Shows the component with an empty IATA code.',
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
114
|
}
|
|
@@ -2,28 +2,26 @@ import type { Args, Meta, StoryObj } from '@storybook/vue3'
|
|
|
2
2
|
|
|
3
3
|
import CpAlert from '@/components/CpAlert.vue'
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
docTitleStyle,
|
|
12
|
-
} from '@/stories/documentationStyles'
|
|
5
|
+
import { docCellStyle, docLabelStyle, docRowColumnStyle } from '@/stories/documentationStyles'
|
|
6
|
+
|
|
7
|
+
const alertColors = ['neutral', 'accent', 'success', 'warning', 'error'] as const
|
|
8
|
+
const alertTypes = ['expanded', 'inline'] as const
|
|
9
|
+
|
|
10
|
+
const alertStackStyle = `${docCellStyle} width: 100%; min-width: 420px;`
|
|
13
11
|
|
|
14
12
|
const meta = {
|
|
15
|
-
title: '
|
|
13
|
+
title: 'Molecules/CpAlert',
|
|
16
14
|
component: CpAlert,
|
|
17
15
|
argTypes: {
|
|
18
16
|
color: {
|
|
19
17
|
control: 'select',
|
|
20
|
-
options:
|
|
18
|
+
options: alertColors,
|
|
21
19
|
description: 'The color variant of the alert',
|
|
22
20
|
},
|
|
23
21
|
type: {
|
|
24
22
|
control: 'select',
|
|
25
|
-
options:
|
|
26
|
-
description: 'The type of the alert',
|
|
23
|
+
options: alertTypes,
|
|
24
|
+
description: 'The layout type of the alert',
|
|
27
25
|
},
|
|
28
26
|
title: {
|
|
29
27
|
control: 'text',
|
|
@@ -31,16 +29,16 @@ const meta = {
|
|
|
31
29
|
},
|
|
32
30
|
content: {
|
|
33
31
|
control: 'text',
|
|
34
|
-
description: 'The text content of the alert',
|
|
32
|
+
description: 'The text content of the alert (expanded type only)',
|
|
35
33
|
},
|
|
36
34
|
icon: {
|
|
37
35
|
control: 'select',
|
|
38
36
|
options: ['', 'info', 'check', 'alert-triangle', 'x-octagon', 'bell', 'star'],
|
|
39
|
-
description: 'Custom icon override',
|
|
37
|
+
description: 'Custom icon override. Defaults to the color-specific icon when empty.',
|
|
40
38
|
},
|
|
41
39
|
isClosable: {
|
|
42
40
|
control: 'boolean',
|
|
43
|
-
description: 'Whether the alert
|
|
41
|
+
description: 'Whether the alert shows a close button',
|
|
44
42
|
},
|
|
45
43
|
primaryActionLabel: {
|
|
46
44
|
control: 'text',
|
|
@@ -66,169 +64,208 @@ const defaultRender = (args: Args) => ({
|
|
|
66
64
|
template: defaultTemplate,
|
|
67
65
|
})
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Default alert with a neutral color, expanded layout, a title and a content
|
|
69
|
+
* message. Use the controls to experiment with each prop in isolation.
|
|
70
|
+
*/
|
|
71
|
+
export const Default: Story = {
|
|
72
|
+
args: {
|
|
73
|
+
color: 'neutral',
|
|
74
|
+
type: 'expanded',
|
|
75
|
+
title: 'Alert title',
|
|
76
|
+
content: 'This is an informational alert message.',
|
|
77
|
+
isClosable: false,
|
|
78
|
+
icon: undefined,
|
|
79
|
+
primaryActionLabel: undefined,
|
|
80
|
+
secondaryActionLabel: undefined,
|
|
81
|
+
},
|
|
82
|
+
render: defaultRender,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* -------------------------------------------------------------------------- */
|
|
86
|
+
/* Colors */
|
|
87
|
+
/* -------------------------------------------------------------------------- */
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Every semantic color available for the alert, stacked vertically.
|
|
91
|
+
*/
|
|
92
|
+
export const Colors: Story = {
|
|
93
|
+
parameters: { controls: { disable: true } },
|
|
71
94
|
render: () => ({
|
|
72
95
|
components: { CpAlert },
|
|
73
|
-
setup
|
|
96
|
+
setup() {
|
|
97
|
+
return { alertColors, docRowColumnStyle, alertStackStyle, docLabelStyle }
|
|
98
|
+
},
|
|
74
99
|
template: `
|
|
75
|
-
<div>
|
|
76
|
-
<div style="
|
|
77
|
-
<
|
|
100
|
+
<div :style="docRowColumnStyle">
|
|
101
|
+
<div v-for="color in alertColors" :key="color" :style="alertStackStyle">
|
|
102
|
+
<span :style="docLabelStyle">{{ color }}</span>
|
|
103
|
+
<CpAlert
|
|
104
|
+
:color="color"
|
|
105
|
+
:title="color.charAt(0).toUpperCase() + color.slice(1) + ' alert'"
|
|
106
|
+
content="This is an informational alert message."
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
`,
|
|
111
|
+
}),
|
|
112
|
+
}
|
|
78
113
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
<div style="${docCellStyle}">
|
|
83
|
-
<span style="${docLabelStyle}">neutral</span>
|
|
84
|
-
<CpAlert color="neutral" title="Neutral alert" content="This is a neutral informational message." is-closable />
|
|
85
|
-
</div>
|
|
86
|
-
<div style="${docCellStyle}">
|
|
87
|
-
<span style="${docLabelStyle}">accent</span>
|
|
88
|
-
<CpAlert color="accent" title="Accent alert" content="This is an accent informational message." is-closable />
|
|
89
|
-
</div>
|
|
90
|
-
<div style="${docCellStyle}">
|
|
91
|
-
<span style="${docLabelStyle}">success</span>
|
|
92
|
-
<CpAlert color="success" title="Success alert" content="The operation completed successfully." is-closable />
|
|
93
|
-
</div>
|
|
94
|
-
<div style="${docCellStyle}">
|
|
95
|
-
<span style="${docLabelStyle}">warning</span>
|
|
96
|
-
<CpAlert color="warning" title="Warning alert" content="Please review before proceeding." is-closable />
|
|
97
|
-
</div>
|
|
98
|
-
<div style="${docCellStyle}">
|
|
99
|
-
<span style="${docLabelStyle}">error</span>
|
|
100
|
-
<CpAlert color="error" title="Error alert" content="Something went wrong. Please try again." is-closable />
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
</section>
|
|
114
|
+
/* -------------------------------------------------------------------------- */
|
|
115
|
+
/* Layout types */
|
|
116
|
+
/* -------------------------------------------------------------------------- */
|
|
104
117
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
<CpAlert color="success" type="inline" title="Success alert" is-closable />
|
|
133
|
-
</div>
|
|
134
|
-
<div style="${docCellStyle}">
|
|
135
|
-
<CpAlert color="warning" type="inline" title="Warning alert" is-closable />
|
|
136
|
-
</div>
|
|
137
|
-
<div style="${docCellStyle}">
|
|
138
|
-
<CpAlert color="error" type="inline" title="Error alert" is-closable />
|
|
139
|
-
</div>
|
|
140
|
-
</div>
|
|
141
|
-
</section>
|
|
118
|
+
/**
|
|
119
|
+
* `expanded` stacks the title, content and actions vertically. `inline` keeps
|
|
120
|
+
* them on a single line and hides the content area — best for short messages.
|
|
121
|
+
*/
|
|
122
|
+
export const Types: Story = {
|
|
123
|
+
parameters: { controls: { disable: true } },
|
|
124
|
+
render: () => ({
|
|
125
|
+
components: { CpAlert },
|
|
126
|
+
setup() {
|
|
127
|
+
return { alertTypes, docRowColumnStyle, alertStackStyle, docLabelStyle }
|
|
128
|
+
},
|
|
129
|
+
template: `
|
|
130
|
+
<div :style="docRowColumnStyle">
|
|
131
|
+
<div v-for="type in alertTypes" :key="type" :style="alertStackStyle">
|
|
132
|
+
<span :style="docLabelStyle">{{ type }}</span>
|
|
133
|
+
<CpAlert
|
|
134
|
+
color="accent"
|
|
135
|
+
:type="type"
|
|
136
|
+
title="Alert title"
|
|
137
|
+
content="This is an informational alert message."
|
|
138
|
+
primary-action-label="Action"
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
`,
|
|
143
|
+
}),
|
|
144
|
+
}
|
|
142
145
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
<div style="${docCellStyle}">
|
|
147
|
-
<CpAlert color="accent" content="This is an accent informational message." is-closable />
|
|
148
|
-
</div>
|
|
149
|
-
</div>
|
|
150
|
-
</section>
|
|
146
|
+
/* -------------------------------------------------------------------------- */
|
|
147
|
+
/* Content combinations */
|
|
148
|
+
/* -------------------------------------------------------------------------- */
|
|
151
149
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
150
|
+
/**
|
|
151
|
+
* The three supported content combinations: title only, content only, and
|
|
152
|
+
* both title and content.
|
|
153
|
+
*/
|
|
154
|
+
export const ContentLayouts: Story = {
|
|
155
|
+
parameters: { controls: { disable: true } },
|
|
156
|
+
render: () => ({
|
|
157
|
+
components: { CpAlert },
|
|
158
|
+
setup() {
|
|
159
|
+
return { docRowColumnStyle, alertStackStyle, docLabelStyle }
|
|
160
|
+
},
|
|
161
|
+
template: `
|
|
162
|
+
<div :style="docRowColumnStyle">
|
|
163
|
+
<div :style="alertStackStyle">
|
|
164
|
+
<span :style="docLabelStyle">Title only</span>
|
|
165
|
+
<CpAlert color="accent" title="Title only" />
|
|
166
|
+
</div>
|
|
167
|
+
<div :style="alertStackStyle">
|
|
168
|
+
<span :style="docLabelStyle">Content only</span>
|
|
169
|
+
<CpAlert color="accent" content="Only a description, without a title on top." />
|
|
170
|
+
</div>
|
|
171
|
+
<div :style="alertStackStyle">
|
|
172
|
+
<span :style="docLabelStyle">Title and content</span>
|
|
173
|
+
<CpAlert
|
|
174
|
+
color="accent"
|
|
175
|
+
title="Title and content"
|
|
176
|
+
content="The full layout with both title and description."
|
|
177
|
+
/>
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
`,
|
|
181
|
+
}),
|
|
182
|
+
}
|
|
169
183
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
<div style="${docCellStyle}">
|
|
174
|
-
<span style="${docLabelStyle}">without actions</span>
|
|
175
|
-
<CpAlert color="accent" title="Without actions" />
|
|
176
|
-
</div>
|
|
177
|
-
<div style="${docCellStyle}">
|
|
178
|
-
<span style="${docLabelStyle}">primary only</span>
|
|
179
|
-
<CpAlert color="accent" title="With primary action" content="This alert has a primary action button." primary-action-label="Confirm" is-closable @primary-action-click="console.log('primary action clicked')" />
|
|
180
|
-
</div>
|
|
181
|
-
<div style="${docCellStyle}">
|
|
182
|
-
<CpAlert color="accent" title="With primary action" type="inline" primary-action-label="Confirm" is-closable @primary-action-click="console.log('primary action clicked')" />
|
|
183
|
-
</div>
|
|
184
|
-
<div style="${docCellStyle}">
|
|
185
|
-
<span style="${docLabelStyle}">primary + secondary</span>
|
|
186
|
-
<CpAlert color="accent" title="With both actions" content="This alert has primary and secondary action buttons." primary-action-label="Confirm" secondary-action-label="Cancel" is-closable @primary-action-click="console.log('primary action clicked')" @secondary-action-click="console.log('secondary action clicked')" />
|
|
187
|
-
</div>
|
|
188
|
-
</div>
|
|
189
|
-
</section>
|
|
184
|
+
/* -------------------------------------------------------------------------- */
|
|
185
|
+
/* Dismiss & actions */
|
|
186
|
+
/* -------------------------------------------------------------------------- */
|
|
190
187
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
188
|
+
/**
|
|
189
|
+
* All dismiss and action affordances shown side by side: closable, primary
|
|
190
|
+
* action, secondary action, and both actions together.
|
|
191
|
+
*/
|
|
192
|
+
export const Actions: Story = {
|
|
193
|
+
parameters: { controls: { disable: true } },
|
|
194
|
+
render: () => ({
|
|
195
|
+
components: { CpAlert },
|
|
196
|
+
setup() {
|
|
197
|
+
return { docRowColumnStyle, alertStackStyle, docLabelStyle }
|
|
198
|
+
},
|
|
199
|
+
template: `
|
|
200
|
+
<div :style="docRowColumnStyle">
|
|
201
|
+
<div :style="alertStackStyle">
|
|
202
|
+
<span :style="docLabelStyle">Closable</span>
|
|
203
|
+
<CpAlert
|
|
204
|
+
color="accent"
|
|
205
|
+
title="Closable alert"
|
|
206
|
+
content="Click the × to dismiss."
|
|
207
|
+
:is-closable="true"
|
|
208
|
+
/>
|
|
209
|
+
</div>
|
|
210
|
+
<div :style="alertStackStyle">
|
|
211
|
+
<span :style="docLabelStyle">Primary action</span>
|
|
212
|
+
<CpAlert
|
|
213
|
+
color="accent"
|
|
214
|
+
title="Action required"
|
|
215
|
+
content="Use the primary action to move forward."
|
|
216
|
+
primary-action-label="Confirm"
|
|
217
|
+
/>
|
|
218
|
+
</div>
|
|
219
|
+
<div :style="alertStackStyle">
|
|
220
|
+
<span :style="docLabelStyle">Secondary action</span>
|
|
221
|
+
<CpAlert
|
|
222
|
+
color="accent"
|
|
223
|
+
title="Optional action"
|
|
224
|
+
content="The secondary action is visually less prominent."
|
|
225
|
+
secondary-action-label="Learn more"
|
|
226
|
+
/>
|
|
227
|
+
</div>
|
|
228
|
+
<div :style="alertStackStyle">
|
|
229
|
+
<span :style="docLabelStyle">Both actions</span>
|
|
230
|
+
<CpAlert
|
|
231
|
+
color="accent"
|
|
232
|
+
title="Choose what to do"
|
|
233
|
+
content="Two actions are shown side by side."
|
|
234
|
+
primary-action-label="Confirm"
|
|
235
|
+
secondary-action-label="Cancel"
|
|
236
|
+
/>
|
|
204
237
|
</div>
|
|
205
238
|
</div>
|
|
206
239
|
`,
|
|
207
240
|
}),
|
|
208
|
-
parameters: {
|
|
209
|
-
controls: { disable: true },
|
|
210
|
-
docs: {
|
|
211
|
-
source: {
|
|
212
|
-
code: null,
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
241
|
}
|
|
217
242
|
|
|
218
|
-
|
|
243
|
+
/* -------------------------------------------------------------------------- */
|
|
244
|
+
/* Icon */
|
|
245
|
+
/* -------------------------------------------------------------------------- */
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Override the default color-specific icon with any icon name.
|
|
249
|
+
*/
|
|
250
|
+
export const CustomIcon: Story = {
|
|
219
251
|
args: {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
title: '
|
|
223
|
-
content: '
|
|
224
|
-
|
|
225
|
-
icon: undefined,
|
|
226
|
-
primaryActionLabel: undefined,
|
|
227
|
-
secondaryActionLabel: undefined,
|
|
252
|
+
...Default.args,
|
|
253
|
+
color: 'accent',
|
|
254
|
+
title: 'Custom icon',
|
|
255
|
+
content: 'Any icon from the design system can replace the default one.',
|
|
256
|
+
icon: 'bell',
|
|
228
257
|
},
|
|
229
258
|
render: defaultRender,
|
|
230
259
|
}
|
|
231
260
|
|
|
261
|
+
/* -------------------------------------------------------------------------- */
|
|
262
|
+
/* Slots */
|
|
263
|
+
/* -------------------------------------------------------------------------- */
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Customize every part of the alert using slots: `icon`, `title`, default
|
|
267
|
+
* (content), `primary-action` and `secondary-action`.
|
|
268
|
+
*/
|
|
232
269
|
export const WithSlots: Story = {
|
|
233
270
|
args: {
|
|
234
271
|
color: 'accent',
|