@ilo-org/react 0.0.1 → 0.0.3
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/.storybook/styles.scss +1 -1
- package/.turbo/turbo-build.log +74 -64
- package/.turbo/turbo-check.log +2 -2
- package/.turbo/turbo-test.log +14 -14
- package/CHANGELOG.md +18 -0
- package/package.json +3 -3
- package/src/components/Button/Button.args.ts +128 -0
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/Callout/Callout.args.ts +4 -4
- package/src/stories/Button.stories.tsx +253 -390
- package/src/stories/Callout.stories.tsx +28 -0
- package/src/stories/ContextMenu.stories.tsx +10 -2
- package/src/stories/Hero.stories.tsx +49 -0
- package/src/stories/Loading.stories.tsx +0 -10
- package/src/stories/Notification.stories.tsx +14 -1
- package/src/stories/TableOfContents.stories.tsx +3 -3
- package/src/stories/Tag.stories.tsx +21 -0
- package/storybook-static/a46b8d4aa3504103cdde.ttf +0 -0
- package/storybook-static/iframe.html +2 -2
- package/storybook-static/main.10a8ad63.iframe.bundle.js +1 -0
- package/storybook-static/static/css/main.b43a53aa.css +3 -0
- package/storybook-static/static/css/main.b43a53aa.css.map +1 -0
- package/storybook-static/12ec02e7e66abaf38243.eot +0 -0
- package/storybook-static/1cc3364249fd0db446ad.ttf +0 -0
- package/storybook-static/248db78ddf1e3568728d.woff +0 -0
- package/storybook-static/2ac1a95228cf06e17040.woff2 +0 -0
- package/storybook-static/3579203659b1428de036.eot +0 -0
- package/storybook-static/36229f80a738c199462d.woff2 +0 -0
- package/storybook-static/51d7da3f5e58e3a24a84.woff +0 -0
- package/storybook-static/6f781753b674130d947a.ttf +0 -0
- package/storybook-static/70a240717e773fe567b3.woff2 +0 -0
- package/storybook-static/88739612501023fa15e3.woff +0 -0
- package/storybook-static/a41d7e330757fb4b2125.woff2 +0 -0
- package/storybook-static/ab3494afe25b712485ed.woff +0 -0
- package/storybook-static/b70a9c0ad8e8b43f5e6c.ttf +0 -0
- package/storybook-static/c5116d16544f932eba4b.eot +0 -0
- package/storybook-static/e2625b8a1277972c9240.ttf +0 -0
- package/storybook-static/f469ea3aa8aacf7ad83a.eot +0 -0
- package/storybook-static/main.01e6a863.iframe.bundle.js +0 -1
- package/storybook-static/static/css/main.3d116812.css +0 -3
- package/storybook-static/static/css/main.3d116812.css.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Meta, Story } from "@storybook/react";
|
|
2
2
|
import {
|
|
3
3
|
Title,
|
|
4
4
|
Subtitle,
|
|
@@ -12,6 +12,11 @@ import { Button } from "../components/Button";
|
|
|
12
12
|
import { ButtonProps } from "../components/Button/Button.props";
|
|
13
13
|
import buttonArgs from "../components/Button/Button.args";
|
|
14
14
|
|
|
15
|
+
const mainDoc = `
|
|
16
|
+
### Usage
|
|
17
|
+
Buttons are used primarily on action items (for actions like submitting a form, or triggering open a modal) that do not navigate the user to another page or view, though sometimes an anchor element may be styled as a button. (See below regarding the \`url\` prop).
|
|
18
|
+
`;
|
|
19
|
+
|
|
15
20
|
const themeDoc = `
|
|
16
21
|
By changing the \`size\` prop you can change the size of the button. By default this is set to \`large\`.
|
|
17
22
|
|
|
@@ -33,6 +38,25 @@ By changing the \`type\` prop you can change the type of the button, which affec
|
|
|
33
38
|
| \`alert\` | Button type for an alert button. |
|
|
34
39
|
`;
|
|
35
40
|
|
|
41
|
+
const iconDoc = `
|
|
42
|
+
By changing the \`icon\` and \`iconPosition\` props you can set the icon to use, and set its position in the button. Additonally, you can set the \`icononly\` prop to \`true\` if you want the button's label to be visually hidden.
|
|
43
|
+
|
|
44
|
+
| Prop | Description |
|
|
45
|
+
|----------|-------------|
|
|
46
|
+
| \`icon\` | Sets the icon. Must match the name of an icon in the @ilo-org icons package. |
|
|
47
|
+
| \`iconPosition\` | left or right. On which side of the label does the icon display? |
|
|
48
|
+
| \`icononly\` | Boolean. If true, no label is shown visually (though one is still provided to screen readers). |
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
const hrefDoc = `
|
|
52
|
+
Populating the \`url\` prop with a valid url and/or an anchor to an id in the current document (e.g. \`#my-id\`) will result in the same design being displayed, but "under the hood," in the html, an \`<a>\` element will be used, allowing link functionality. When this is populated, the \`target\` prop is also read. Populating this, sets the \`target\` attribute of the anchor tag, which opens the link url in a new tab or window.
|
|
53
|
+
|
|
54
|
+
| Prop | Description |
|
|
55
|
+
|----------|-------------|
|
|
56
|
+
| \`url\` | Should be a valid url or anchor in the page. |
|
|
57
|
+
| \`target\` | Should be a valid value for the anchor tag's target attribute. |
|
|
58
|
+
`;
|
|
59
|
+
|
|
36
60
|
/**
|
|
37
61
|
* Button Story
|
|
38
62
|
*
|
|
@@ -48,16 +72,17 @@ export default {
|
|
|
48
72
|
<>
|
|
49
73
|
<Subtitle />
|
|
50
74
|
<Title />
|
|
51
|
-
<Description>
|
|
52
|
-
The button component creates either an HTML button, or an anchor
|
|
53
|
-
link styled like a button.
|
|
54
|
-
</Description>
|
|
75
|
+
<Description>{mainDoc}</Description>
|
|
55
76
|
<Primary />
|
|
56
77
|
<ArgsTable />
|
|
57
78
|
<Subheading>Theme Prop</Subheading>
|
|
58
79
|
<Description>{themeDoc}</Description>
|
|
59
80
|
<Subheading>Type Prop</Subheading>
|
|
60
81
|
<Description>{typeDoc}</Description>
|
|
82
|
+
<Subheading>Icon Props</Subheading>
|
|
83
|
+
<Description>{iconDoc}</Description>
|
|
84
|
+
<Subheading>Link Props</Subheading>
|
|
85
|
+
<Description>{hrefDoc}</Description>
|
|
61
86
|
<Stories title="Examples"></Stories>
|
|
62
87
|
</>
|
|
63
88
|
),
|
|
@@ -66,426 +91,264 @@ export default {
|
|
|
66
91
|
} as Meta<typeof Button>;
|
|
67
92
|
|
|
68
93
|
/**
|
|
69
|
-
* Button Template
|
|
94
|
+
* Base Button Template
|
|
70
95
|
*
|
|
71
96
|
* create a Storybook template for this component
|
|
72
97
|
*
|
|
73
|
-
*@param (
|
|
98
|
+
*@param args (Array) - props to be passed to the component
|
|
74
99
|
*/
|
|
75
|
-
const
|
|
100
|
+
const BaseButtonTemplate: Story<ButtonProps> = (args) => <Button {...args} />;
|
|
76
101
|
|
|
77
102
|
/**
|
|
78
|
-
*
|
|
103
|
+
* Base Button Instance
|
|
79
104
|
*
|
|
80
105
|
*/
|
|
81
|
-
export const
|
|
106
|
+
export const A_BaseButton = BaseButtonTemplate.bind({});
|
|
107
|
+
// enumerate the props for the base button
|
|
108
|
+
// @ts-ignore
|
|
109
|
+
A_BaseButton.args = buttonArgs.primary;
|
|
110
|
+
A_BaseButton.storyName = "Default Button";
|
|
82
111
|
|
|
83
112
|
/**
|
|
84
|
-
*
|
|
113
|
+
* Primary Button Template
|
|
85
114
|
*
|
|
86
|
-
|
|
87
|
-
export const MediumButton = ButtonTemplate.bind({});
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Small Button Instance
|
|
115
|
+
* create a Storybook template for this component
|
|
91
116
|
*
|
|
92
|
-
|
|
93
|
-
|
|
117
|
+
*@param args (Object) - props to be passed to the component
|
|
118
|
+
*/
|
|
119
|
+
const PrimaryButtonTemplate: Story<ButtonProps> = (args) => (
|
|
120
|
+
<>
|
|
121
|
+
{primarybuttons.map((button, i) => (
|
|
122
|
+
<Button
|
|
123
|
+
{...args}
|
|
124
|
+
label={button.label}
|
|
125
|
+
size={button.size}
|
|
126
|
+
target={button.target}
|
|
127
|
+
kind={button.kind}
|
|
128
|
+
disabled={button.disabled}
|
|
129
|
+
type={button.type}
|
|
130
|
+
url={button.url}
|
|
131
|
+
icon={button.icon}
|
|
132
|
+
icononly={button.icononly}
|
|
133
|
+
iconPosition={button.iconPosition}
|
|
134
|
+
key={i}
|
|
135
|
+
/>
|
|
136
|
+
))}
|
|
137
|
+
<Button {...primarybuttons[0]} label={`Disabled Primary`} disabled={true} />
|
|
138
|
+
</>
|
|
139
|
+
);
|
|
94
140
|
|
|
95
141
|
/**
|
|
96
142
|
* Primary Button Instance
|
|
97
143
|
*
|
|
98
144
|
*/
|
|
99
|
-
export const
|
|
145
|
+
export const B_PrimaryButton = PrimaryButtonTemplate.bind({});
|
|
146
|
+
const primarybuttons = [
|
|
147
|
+
buttonArgs.primary,
|
|
148
|
+
buttonArgs.iconleftlgprimary,
|
|
149
|
+
buttonArgs.iconrightlgprimary,
|
|
150
|
+
buttonArgs.icononlylgprimary,
|
|
151
|
+
buttonArgs.medium,
|
|
152
|
+
buttonArgs.iconleftmprimary,
|
|
153
|
+
buttonArgs.iconrightmprimary,
|
|
154
|
+
buttonArgs.icononlymprimary,
|
|
155
|
+
buttonArgs.small,
|
|
156
|
+
buttonArgs.iconleftsmprimary,
|
|
157
|
+
buttonArgs.iconrightsmprimary,
|
|
158
|
+
buttonArgs.icononlysmprimary,
|
|
159
|
+
];
|
|
160
|
+
// @ts-ignore
|
|
161
|
+
B_PrimaryButton.storyName = "Primary Button";
|
|
162
|
+
B_PrimaryButton.parameters = {
|
|
163
|
+
docs: {
|
|
164
|
+
description: {
|
|
165
|
+
story:
|
|
166
|
+
"Primary buttons are the default button style, most-often used. They usually indicate positive action.",
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
};
|
|
100
170
|
|
|
101
171
|
/**
|
|
102
|
-
* Secondary Button
|
|
172
|
+
* Secondary Button Template
|
|
103
173
|
*
|
|
104
|
-
|
|
105
|
-
export const SecondaryButton = ButtonTemplate.bind({});
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Tertiary Button Instance
|
|
174
|
+
* create a Storybook template for this component
|
|
109
175
|
*
|
|
110
|
-
|
|
111
|
-
|
|
176
|
+
*@param args (Object) - props to be passed to the component
|
|
177
|
+
*/
|
|
178
|
+
const SecondaryButtonTemplate: Story<ButtonProps> = (args) => (
|
|
179
|
+
<>
|
|
180
|
+
{secondarybuttons.map((button, i) => (
|
|
181
|
+
<Button
|
|
182
|
+
{...args}
|
|
183
|
+
label={button.label}
|
|
184
|
+
size={button.size}
|
|
185
|
+
target={button.target}
|
|
186
|
+
kind={button.kind}
|
|
187
|
+
disabled={button.disabled}
|
|
188
|
+
type={button.type}
|
|
189
|
+
url={button.url}
|
|
190
|
+
icon={button.icon}
|
|
191
|
+
icononly={button.icononly}
|
|
192
|
+
iconPosition={button.iconPosition}
|
|
193
|
+
key={i}
|
|
194
|
+
/>
|
|
195
|
+
))}
|
|
196
|
+
<Button
|
|
197
|
+
{...secondarybuttons[0]}
|
|
198
|
+
label={`Disabled Secondary`}
|
|
199
|
+
disabled={true}
|
|
200
|
+
/>
|
|
201
|
+
</>
|
|
202
|
+
);
|
|
112
203
|
|
|
113
204
|
/**
|
|
114
|
-
*
|
|
205
|
+
* Medium Button Instance
|
|
115
206
|
*
|
|
116
207
|
*/
|
|
117
|
-
export const
|
|
208
|
+
export const C_SecondaryButton = SecondaryButtonTemplate.bind({});
|
|
209
|
+
|
|
210
|
+
const secondarybuttons = [
|
|
211
|
+
buttonArgs.secondary,
|
|
212
|
+
buttonArgs.iconleftlgsecondary,
|
|
213
|
+
buttonArgs.iconrightlgsecondary,
|
|
214
|
+
buttonArgs.icononlylgsecondary,
|
|
215
|
+
buttonArgs.secondarym,
|
|
216
|
+
buttonArgs.iconleftmsecondary,
|
|
217
|
+
buttonArgs.iconrightmsecondary,
|
|
218
|
+
buttonArgs.icononlymsecondary,
|
|
219
|
+
buttonArgs.secondarysm,
|
|
220
|
+
buttonArgs.iconleftsmsecondary,
|
|
221
|
+
buttonArgs.iconrightsmsecondary,
|
|
222
|
+
buttonArgs.icononlysmsecondary,
|
|
223
|
+
];
|
|
224
|
+
C_SecondaryButton.storyName = "Secondary Button";
|
|
225
|
+
C_SecondaryButton.parameters = {
|
|
226
|
+
docs: {
|
|
227
|
+
description: {
|
|
228
|
+
story:
|
|
229
|
+
"Secondary buttons are usually seen alongside Primary buttons when there are two action options, especially a positive and a negative option (e.g. a Cancel button next to a Submit button) or when there is a hierarchy of action (for example, the File Upload button in a form is a Secondary Button and the Submit button is a Primary button).",
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
};
|
|
118
233
|
|
|
119
234
|
/**
|
|
120
|
-
* Tertiary Button
|
|
235
|
+
* Tertiary Button Template
|
|
121
236
|
*
|
|
122
|
-
|
|
123
|
-
export const TertiaryButtonM = ButtonTemplate.bind({});
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Secondary Button Instance
|
|
237
|
+
* create a Storybook template for this component
|
|
127
238
|
*
|
|
128
|
-
|
|
129
|
-
|
|
239
|
+
*@param args (Object) - props to be passed to the component
|
|
240
|
+
*/
|
|
241
|
+
const TertiaryButtonTemplate: Story<ButtonProps> = (args) => (
|
|
242
|
+
<>
|
|
243
|
+
{tertiarybuttons.map((button, i) => (
|
|
244
|
+
<Button
|
|
245
|
+
{...args}
|
|
246
|
+
label={button.label}
|
|
247
|
+
size={button.size}
|
|
248
|
+
target={button.target}
|
|
249
|
+
kind={button.kind}
|
|
250
|
+
disabled={button.disabled}
|
|
251
|
+
type={button.type}
|
|
252
|
+
url={button.url}
|
|
253
|
+
icon={button.icon}
|
|
254
|
+
icononly={button.icononly}
|
|
255
|
+
iconPosition={button.iconPosition}
|
|
256
|
+
key={i}
|
|
257
|
+
/>
|
|
258
|
+
))}
|
|
259
|
+
<Button
|
|
260
|
+
{...tertiarybuttons[0]}
|
|
261
|
+
label={`Disabled Tertiary`}
|
|
262
|
+
disabled={true}
|
|
263
|
+
/>
|
|
264
|
+
</>
|
|
265
|
+
);
|
|
130
266
|
|
|
131
267
|
/**
|
|
132
268
|
* Tertiary Button Instance
|
|
133
269
|
*
|
|
134
270
|
*/
|
|
135
|
-
export const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Large Button With Icon on the Right Instance
|
|
163
|
-
*
|
|
164
|
-
*/
|
|
165
|
-
export const LgIconRightButton = ButtonTemplate.bind({});
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Medium Button With Icon on the Right Instance
|
|
169
|
-
*
|
|
170
|
-
*/
|
|
171
|
-
export const MIconRightButton = ButtonTemplate.bind({});
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Small Button With Icon on the Right Instance
|
|
175
|
-
*
|
|
176
|
-
*/
|
|
177
|
-
export const SmIconRightButton = ButtonTemplate.bind({});
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Large Button With Icon on the Left Instance
|
|
181
|
-
*
|
|
182
|
-
*/
|
|
183
|
-
export const LgSecondaryIconLeftButton = ButtonTemplate.bind({});
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Medium Button With Icon on the Left Instance
|
|
187
|
-
*
|
|
188
|
-
*/
|
|
189
|
-
export const MSecondaryIconLeftButton = ButtonTemplate.bind({});
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Small Button With Icon on the Left Instance
|
|
193
|
-
*
|
|
194
|
-
*/
|
|
195
|
-
export const SmSecondaryIconLeftButton = ButtonTemplate.bind({});
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Large Button With Icon on the Right Instance
|
|
199
|
-
*
|
|
200
|
-
*/
|
|
201
|
-
export const LgSecondaryIconRightButton = ButtonTemplate.bind({});
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Medium Button With Icon on the Right Instance
|
|
205
|
-
*
|
|
206
|
-
*/
|
|
207
|
-
export const MSecondaryIconRightButton = ButtonTemplate.bind({});
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Small Button With Icon on the Right Instance
|
|
211
|
-
*
|
|
212
|
-
*/
|
|
213
|
-
export const SmSecondaryIconRightButton = ButtonTemplate.bind({});
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Large Button With Icon on the Left Instance
|
|
217
|
-
*
|
|
218
|
-
*/
|
|
219
|
-
export const LgTertiaryIconLeftButton = ButtonTemplate.bind({});
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Medium Button With Icon on the Left Instance
|
|
223
|
-
*
|
|
224
|
-
*/
|
|
225
|
-
export const MTertiaryIconLeftButton = ButtonTemplate.bind({});
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Small Button With Icon on the Left Instance
|
|
229
|
-
*
|
|
230
|
-
*/
|
|
231
|
-
export const SmTertiaryIconLeftButton = ButtonTemplate.bind({});
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Large Button With Icon on the Right Instance
|
|
235
|
-
*
|
|
236
|
-
*/
|
|
237
|
-
export const LgTertiaryIconRightButton = ButtonTemplate.bind({});
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Medium Button With Icon on the Right Instance
|
|
241
|
-
*
|
|
242
|
-
*/
|
|
243
|
-
export const MTertiaryIconRightButton = ButtonTemplate.bind({});
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Small Button With Icon on the Right Instance
|
|
247
|
-
*
|
|
248
|
-
*/
|
|
249
|
-
export const SmTertiaryIconRightButton = ButtonTemplate.bind({});
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Large Button With Icon on the Left Instance
|
|
253
|
-
*
|
|
254
|
-
*/
|
|
255
|
-
export const LgAlertIconLeftButton = ButtonTemplate.bind({});
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Medium Button With Icon on the Left Instance
|
|
259
|
-
*
|
|
260
|
-
*/
|
|
261
|
-
export const MAlertIconLeftButton = ButtonTemplate.bind({});
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Small Button With Icon on the Left Instance
|
|
265
|
-
*
|
|
266
|
-
*/
|
|
267
|
-
export const SmAlertIconLeftButton = ButtonTemplate.bind({});
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Large Button With Icon on the Right Instance
|
|
271
|
-
*
|
|
272
|
-
*/
|
|
273
|
-
export const LgAlertIconRightButton = ButtonTemplate.bind({});
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Medium Button With Icon on the Right Instance
|
|
277
|
-
*
|
|
278
|
-
*/
|
|
279
|
-
export const MAlertIconRightButton = ButtonTemplate.bind({});
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Small Button With Icon on the Right Instance
|
|
283
|
-
*
|
|
284
|
-
*/
|
|
285
|
-
export const SmAlertIconRightButton = ButtonTemplate.bind({});
|
|
271
|
+
export const D_TertiaryButton = TertiaryButtonTemplate.bind({});
|
|
272
|
+
|
|
273
|
+
const tertiarybuttons = [
|
|
274
|
+
buttonArgs.tertiary,
|
|
275
|
+
buttonArgs.iconleftlgtertiary,
|
|
276
|
+
buttonArgs.iconrightlgtertiary,
|
|
277
|
+
buttonArgs.icononlylgtertiary,
|
|
278
|
+
buttonArgs.tertiarym,
|
|
279
|
+
buttonArgs.iconleftmtertiary,
|
|
280
|
+
buttonArgs.iconrightmtertiary,
|
|
281
|
+
buttonArgs.icononlymtertiary,
|
|
282
|
+
buttonArgs.tertiarysm,
|
|
283
|
+
buttonArgs.iconleftsmtertiary,
|
|
284
|
+
buttonArgs.iconrightsmtertiary,
|
|
285
|
+
buttonArgs.icononlysmtertiary,
|
|
286
|
+
];
|
|
287
|
+
D_TertiaryButton.storyName = "Tertiary Button";
|
|
288
|
+
D_TertiaryButton.parameters = {
|
|
289
|
+
docs: {
|
|
290
|
+
description: {
|
|
291
|
+
story:
|
|
292
|
+
"Tertiary buttons are used when the action taken is not of primary importance to the component functionality, especially when the action is optional (for example, the call to action in a Callout component).",
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
};
|
|
286
296
|
|
|
287
297
|
/**
|
|
288
|
-
*
|
|
298
|
+
* Alert Button Template
|
|
289
299
|
*
|
|
290
|
-
|
|
291
|
-
export const ButtonAlertM = ButtonTemplate.bind({});
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Tertiary Button Instance
|
|
300
|
+
* create a Storybook template for this component
|
|
295
301
|
*
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
// enumerate the props for the tertiary button
|
|
350
|
-
ButtonAlertM.args = buttonArgs.alertm;
|
|
351
|
-
ButtonAlertM.args.url = "";
|
|
352
|
-
ButtonAlertM.storyName = "Alert Medium";
|
|
353
|
-
|
|
354
|
-
// enumerate the props for the secondary button
|
|
355
|
-
ButtonAlertSm.args = buttonArgs.alertsm;
|
|
356
|
-
ButtonAlertSm.args.url = "";
|
|
357
|
-
ButtonAlertSm.storyName = "Alert Small";
|
|
358
|
-
|
|
359
|
-
// enumerate the props for a disabled button
|
|
360
|
-
DisabledButton.args = buttonArgs.disabled;
|
|
361
|
-
DisabledButton.args.url = "";
|
|
362
|
-
DisabledButton.storyName = "Disabled Button";
|
|
363
|
-
|
|
364
|
-
// enumerate the props for a large primary icon left button
|
|
365
|
-
LgIconLeftButton.args = buttonArgs.iconleftlgprimary;
|
|
366
|
-
LgIconLeftButton.args.url = "";
|
|
367
|
-
LgIconLeftButton.storyName = "Large Primary Button with icon on left";
|
|
368
|
-
|
|
369
|
-
// enumerate the props for a medium primary icon left button
|
|
370
|
-
MIconLeftButton.args = buttonArgs.iconleftmprimary;
|
|
371
|
-
MIconLeftButton.args.url = "";
|
|
372
|
-
MIconLeftButton.storyName = "Medium Primary Button with icon on left";
|
|
373
|
-
|
|
374
|
-
// enumerate the props for a small primary icon left button
|
|
375
|
-
SmIconLeftButton.args = buttonArgs.iconleftsmprimary;
|
|
376
|
-
SmIconLeftButton.args.url = "";
|
|
377
|
-
SmIconLeftButton.storyName = "Small Primary Button with icon on left";
|
|
378
|
-
|
|
379
|
-
// enumerate the props for a large primary icon right button
|
|
380
|
-
LgIconRightButton.args = buttonArgs.iconrightlgprimary;
|
|
381
|
-
LgIconRightButton.args.url = "";
|
|
382
|
-
LgIconRightButton.storyName = "Large Primary Button with icon on right";
|
|
383
|
-
|
|
384
|
-
// enumerate the props for a medium primary icon right button
|
|
385
|
-
MIconRightButton.args = buttonArgs.iconrightmprimary;
|
|
386
|
-
MIconRightButton.args.url = "";
|
|
387
|
-
MIconRightButton.storyName = "Medium Primary Button with icon on right";
|
|
388
|
-
|
|
389
|
-
// enumerate the props for a small primary icon right button
|
|
390
|
-
SmIconRightButton.args = buttonArgs.iconrightsmprimary;
|
|
391
|
-
SmIconRightButton.args.url = "";
|
|
392
|
-
SmIconRightButton.storyName = "Small Primary Button with icon on right;";
|
|
393
|
-
|
|
394
|
-
// enumerate the props for a large secondary icon left button
|
|
395
|
-
LgSecondaryIconLeftButton.args = buttonArgs.iconleftlgsecondary;
|
|
396
|
-
LgSecondaryIconLeftButton.args.url = "";
|
|
397
|
-
LgSecondaryIconLeftButton.storyName =
|
|
398
|
-
"Large Secondary Button with icon on left";
|
|
399
|
-
|
|
400
|
-
// enumerate the props for a medium secondary icon left button
|
|
401
|
-
MSecondaryIconLeftButton.args = buttonArgs.iconleftmsecondary;
|
|
402
|
-
MSecondaryIconLeftButton.args.url = "";
|
|
403
|
-
MSecondaryIconLeftButton.storyName =
|
|
404
|
-
"Medium Secondary Button with icon on left";
|
|
405
|
-
|
|
406
|
-
// enumerate the props for a small secondary icon left button
|
|
407
|
-
SmSecondaryIconLeftButton.args = buttonArgs.iconleftsmsecondary;
|
|
408
|
-
SmSecondaryIconLeftButton.args.url = "";
|
|
409
|
-
SmSecondaryIconLeftButton.storyName =
|
|
410
|
-
"Small Secondary Button with icon on left";
|
|
411
|
-
|
|
412
|
-
// enumerate the props for a large secondary icon right button
|
|
413
|
-
LgSecondaryIconRightButton.args = buttonArgs.iconrightlgsecondary;
|
|
414
|
-
LgSecondaryIconRightButton.args.url = "";
|
|
415
|
-
LgSecondaryIconRightButton.storyName =
|
|
416
|
-
"Large Secondary Button with icon on right";
|
|
417
|
-
|
|
418
|
-
// enumerate the props for a medium secondary icon right button
|
|
419
|
-
MSecondaryIconRightButton.args = buttonArgs.iconrightmsecondary;
|
|
420
|
-
MSecondaryIconRightButton.args.url = "";
|
|
421
|
-
MSecondaryIconRightButton.storyName =
|
|
422
|
-
"Medium Secondary Button with icon on right";
|
|
423
|
-
|
|
424
|
-
// enumerate the props for a small secondary icon right button
|
|
425
|
-
SmSecondaryIconRightButton.args = buttonArgs.iconrightsmsecondary;
|
|
426
|
-
SmSecondaryIconRightButton.args.url = "";
|
|
427
|
-
SmSecondaryIconRightButton.storyName =
|
|
428
|
-
"Small Secondary Button with icon on right;";
|
|
429
|
-
|
|
430
|
-
// enumerate the props for a large tertiary icon left button
|
|
431
|
-
LgTertiaryIconLeftButton.args = buttonArgs.iconleftlgtertiary;
|
|
432
|
-
LgTertiaryIconLeftButton.args.url = "";
|
|
433
|
-
LgTertiaryIconLeftButton.storyName = "Large Tertiary Button with icon on left";
|
|
434
|
-
|
|
435
|
-
// enumerate the props for a medium tertiary icon left button
|
|
436
|
-
MTertiaryIconLeftButton.args = buttonArgs.iconleftmtertiary;
|
|
437
|
-
MTertiaryIconLeftButton.args.url = "";
|
|
438
|
-
MTertiaryIconLeftButton.storyName = "Medium Tertiary Button with icon on left";
|
|
439
|
-
|
|
440
|
-
// enumerate the props for a small tertiary icon left button
|
|
441
|
-
SmTertiaryIconLeftButton.args = buttonArgs.iconleftsmtertiary;
|
|
442
|
-
SmTertiaryIconLeftButton.args.url = "";
|
|
443
|
-
SmTertiaryIconLeftButton.storyName = "Small Tertiary Button with icon on left";
|
|
444
|
-
|
|
445
|
-
// enumerate the props for a large tertiary icon right button
|
|
446
|
-
LgTertiaryIconRightButton.args = buttonArgs.iconrightlgtertiary;
|
|
447
|
-
LgTertiaryIconRightButton.args.url = "";
|
|
448
|
-
LgTertiaryIconRightButton.storyName =
|
|
449
|
-
"Large Tertiary Button with icon on right";
|
|
450
|
-
|
|
451
|
-
// enumerate the props for a medium tertiary icon right button
|
|
452
|
-
MTertiaryIconRightButton.args = buttonArgs.iconrightmtertiary;
|
|
453
|
-
MTertiaryIconRightButton.args.url = "";
|
|
454
|
-
MTertiaryIconRightButton.storyName =
|
|
455
|
-
"Medium Tertiary Button with icon on right";
|
|
456
|
-
|
|
457
|
-
// enumerate the props for a small tertiary icon right button
|
|
458
|
-
SmTertiaryIconRightButton.args = buttonArgs.iconrightsmtertiary;
|
|
459
|
-
SmTertiaryIconRightButton.args.url = "";
|
|
460
|
-
SmTertiaryIconRightButton.storyName =
|
|
461
|
-
"Small Tertiary Button with icon on right;";
|
|
462
|
-
|
|
463
|
-
// enumerate the props for a large alert icon left button
|
|
464
|
-
LgAlertIconLeftButton.args = buttonArgs.iconleftlgalert;
|
|
465
|
-
LgAlertIconLeftButton.args.url = "";
|
|
466
|
-
LgAlertIconLeftButton.storyName = "Large Alert Button with icon on left";
|
|
467
|
-
|
|
468
|
-
// enumerate the props for a medium alert icon left button
|
|
469
|
-
MAlertIconLeftButton.args = buttonArgs.iconleftmalert;
|
|
470
|
-
MAlertIconLeftButton.args.url = "";
|
|
471
|
-
MAlertIconLeftButton.storyName = "Medium Alert Button with icon on left";
|
|
472
|
-
|
|
473
|
-
// enumerate the props for a small alert icon left button
|
|
474
|
-
SmAlertIconLeftButton.args = buttonArgs.iconleftsmalert;
|
|
475
|
-
SmAlertIconLeftButton.args.url = "";
|
|
476
|
-
SmAlertIconLeftButton.storyName = "Small Alert Button with icon on left";
|
|
477
|
-
|
|
478
|
-
// enumerate the props for a large alert icon right button
|
|
479
|
-
LgAlertIconRightButton.args = buttonArgs.iconrightlgalert;
|
|
480
|
-
LgAlertIconRightButton.args.url = "";
|
|
481
|
-
LgAlertIconRightButton.storyName = "Large Alert Button with icon on right";
|
|
482
|
-
|
|
483
|
-
// enumerate the props for a medium alert icon right button
|
|
484
|
-
MAlertIconRightButton.args = buttonArgs.iconrightmalert;
|
|
485
|
-
MAlertIconRightButton.args.url = "";
|
|
486
|
-
MAlertIconRightButton.storyName = "Medium Alert Button with icon on right";
|
|
487
|
-
|
|
488
|
-
// enumerate the props for a small alert icon right button
|
|
489
|
-
SmAlertIconRightButton.args = buttonArgs.iconrightsmalert;
|
|
490
|
-
SmAlertIconRightButton.args.url = "";
|
|
491
|
-
SmAlertIconRightButton.storyName = "Small Alert Button with icon on right;";
|
|
302
|
+
*@param args (Object) - props to be passed to the component
|
|
303
|
+
*/
|
|
304
|
+
const AlertButtonTemplate: Story<ButtonProps> = (args) => (
|
|
305
|
+
<>
|
|
306
|
+
{alertbuttons.map((button, i) => (
|
|
307
|
+
<Button
|
|
308
|
+
{...args}
|
|
309
|
+
label={button.label}
|
|
310
|
+
size={button.size}
|
|
311
|
+
target={button.target}
|
|
312
|
+
kind={button.kind}
|
|
313
|
+
disabled={button.disabled}
|
|
314
|
+
type={button.type}
|
|
315
|
+
url={button.url}
|
|
316
|
+
icon={button.icon}
|
|
317
|
+
icononly={button.icononly}
|
|
318
|
+
iconPosition={button.iconPosition}
|
|
319
|
+
key={i}
|
|
320
|
+
/>
|
|
321
|
+
))}
|
|
322
|
+
<Button {...alertbuttons[0]} label={`Disabled Alert`} disabled={true} />
|
|
323
|
+
</>
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Alert Button Instance
|
|
328
|
+
*
|
|
329
|
+
*/
|
|
330
|
+
export const E_AlertButton = AlertButtonTemplate.bind({});
|
|
331
|
+
|
|
332
|
+
const alertbuttons = [
|
|
333
|
+
buttonArgs.alert,
|
|
334
|
+
buttonArgs.iconleftlgalert,
|
|
335
|
+
buttonArgs.iconrightlgalert,
|
|
336
|
+
buttonArgs.icononlylgalert,
|
|
337
|
+
buttonArgs.alertm,
|
|
338
|
+
buttonArgs.iconleftmalert,
|
|
339
|
+
buttonArgs.iconrightmalert,
|
|
340
|
+
buttonArgs.icononlymalert,
|
|
341
|
+
buttonArgs.alertsm,
|
|
342
|
+
buttonArgs.iconleftsmalert,
|
|
343
|
+
buttonArgs.iconrightsmalert,
|
|
344
|
+
buttonArgs.icononlysmalert,
|
|
345
|
+
];
|
|
346
|
+
E_AlertButton.storyName = "Alert Button";
|
|
347
|
+
E_AlertButton.parameters = {
|
|
348
|
+
docs: {
|
|
349
|
+
description: {
|
|
350
|
+
story:
|
|
351
|
+
"Alert buttons are used when the action resolves an emergecny or responds to an alert.",
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
};
|