@aarhus-university/au-lib-react-components 12.0.2 → 12.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/.storybook/preview.js +1 -1
- package/package.json +15 -14
- package/src/components/AUCharacterCountComponent.tsx +56 -0
- package/src/components/AUEditorComponent.tsx +123 -0
- package/src/lib/hooks.ts +83 -1
- package/src/lib/tinymce.ts +84 -0
- package/stories/AUAlertComponent.stories.tsx +37 -25
- package/stories/AUAutoSuggestComponent.stories.tsx +69 -70
- package/stories/AUButtonComponent.stories.tsx +62 -51
- package/stories/AUCharacterCountComponent.stories.tsx +146 -0
- package/stories/AUComboBoxComponent.stories.tsx +13 -12
- package/stories/AUContentToggleComponent.stories.tsx +54 -30
- package/stories/AUEditorComponent.stories.tsx +68 -0
- package/stories/AUErrorComponent.stories.tsx +93 -58
- package/stories/AUModalComponent.stories.tsx +124 -48
- package/stories/AUNotificationComponent.stories.tsx +107 -71
- package/stories/AUSpinnerComponent.stories.tsx +15 -12
- package/stories/AUStepComponent.stories.tsx +70 -41
- package/stories/AUToolbarComponent.stories.tsx +338 -276
- package/stories/AUTruncatorComponent.stories.tsx +87 -66
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StoryObj, Meta } from '@storybook/react';
|
|
3
3
|
import AUErrorComponent from '../src/components/AUErrorComponent';
|
|
4
4
|
import { ThemeWrapper } from './lib/helpers';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
title: 'Delphinus/Error',
|
|
8
8
|
component: AUErrorComponent,
|
|
9
|
+
argTypes: {
|
|
10
|
+
error: {
|
|
11
|
+
table: {
|
|
12
|
+
disable: true,
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
fetchError: {
|
|
16
|
+
table: {
|
|
17
|
+
disable: true,
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
serializedError: {
|
|
21
|
+
table: {
|
|
22
|
+
disable: true,
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
},
|
|
9
26
|
decorators: [
|
|
10
27
|
(Story, context) => (
|
|
11
28
|
<ThemeWrapper theme={context.globals.theme}>
|
|
@@ -13,86 +30,104 @@ export default {
|
|
|
13
30
|
</ThemeWrapper>
|
|
14
31
|
)
|
|
15
32
|
],
|
|
16
|
-
} as
|
|
33
|
+
} as Meta<typeof AUErrorComponent>;
|
|
17
34
|
|
|
18
|
-
|
|
35
|
+
type Story = StoryObj<typeof AUErrorComponent>;
|
|
19
36
|
|
|
20
|
-
export const AU_Error =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
37
|
+
export const AU_Error: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
error: {
|
|
40
|
+
header: 'Our own custom error',
|
|
41
|
+
message: 'With a nice header and descriptive error message',
|
|
42
|
+
status: 500,
|
|
43
|
+
},
|
|
44
|
+
withStatus: false,
|
|
26
45
|
},
|
|
46
|
+
render: (args) => <AUErrorComponent {...args} />,
|
|
27
47
|
};
|
|
28
48
|
|
|
29
|
-
export const AU_Error_With_Status =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
49
|
+
export const AU_Error_With_Status: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
error: {
|
|
52
|
+
header: 'Our own custom error',
|
|
53
|
+
message: 'With a nice header and descriptive error message',
|
|
54
|
+
status: 500,
|
|
55
|
+
},
|
|
56
|
+
withStatus: true,
|
|
35
57
|
},
|
|
36
|
-
|
|
58
|
+
render: (args) => <AUErrorComponent {...args} />,
|
|
37
59
|
};
|
|
38
60
|
|
|
39
|
-
export const Fetch_Error =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
61
|
+
export const Fetch_Error: Story = {
|
|
62
|
+
args: {
|
|
63
|
+
fetchError: {
|
|
64
|
+
error: 'Something horrible has happened on the server...',
|
|
65
|
+
status: 'FETCH_ERROR',
|
|
66
|
+
},
|
|
67
|
+
withStatus: false,
|
|
44
68
|
},
|
|
69
|
+
render: (args) => <AUErrorComponent {...args} />,
|
|
45
70
|
};
|
|
46
71
|
|
|
47
|
-
export const Fetch_Error_With_Status =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
72
|
+
export const Fetch_Error_With_Status: Story = {
|
|
73
|
+
args: {
|
|
74
|
+
fetchError: {
|
|
75
|
+
error: 'Something horrible has happened on the server...',
|
|
76
|
+
status: 'FETCH_ERROR',
|
|
77
|
+
},
|
|
78
|
+
withStatus: true,
|
|
52
79
|
},
|
|
53
|
-
|
|
80
|
+
render: (args) => <AUErrorComponent {...args} />,
|
|
54
81
|
};
|
|
55
82
|
|
|
56
|
-
export const Fetch_Error_With_Data =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
83
|
+
export const Fetch_Error_With_Data: Story = {
|
|
84
|
+
args: {
|
|
85
|
+
fetchError: {
|
|
86
|
+
data: {
|
|
87
|
+
status: 'Error',
|
|
88
|
+
message: 'This could be anything...',
|
|
89
|
+
somethingElse: 'Even this...',
|
|
90
|
+
},
|
|
91
|
+
status: 500,
|
|
63
92
|
},
|
|
64
|
-
|
|
93
|
+
withStatus: false,
|
|
65
94
|
},
|
|
66
|
-
|
|
95
|
+
render: (args) => <AUErrorComponent {...args} />,
|
|
67
96
|
};
|
|
68
97
|
|
|
69
|
-
export const Fetch_Error_With_Data_And_Status =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
98
|
+
export const Fetch_Error_With_Data_And_Status: Story = {
|
|
99
|
+
args: {
|
|
100
|
+
fetchError: {
|
|
101
|
+
data: {
|
|
102
|
+
status: 'Error',
|
|
103
|
+
message: 'This could be anything...',
|
|
104
|
+
somethingElse: 'Even this...',
|
|
105
|
+
},
|
|
106
|
+
status: 500,
|
|
76
107
|
},
|
|
77
|
-
|
|
108
|
+
withStatus: true,
|
|
78
109
|
},
|
|
79
|
-
|
|
110
|
+
render: (args) => <AUErrorComponent {...args} />,
|
|
80
111
|
};
|
|
81
112
|
|
|
82
|
-
export const Serialized_Error =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
113
|
+
export const Serialized_Error: Story = {
|
|
114
|
+
args: {
|
|
115
|
+
serializedError: {
|
|
116
|
+
message: 'Something funky has happened in the code...',
|
|
117
|
+
code: '500',
|
|
118
|
+
},
|
|
119
|
+
withStatus: false,
|
|
87
120
|
},
|
|
88
|
-
|
|
121
|
+
render: (args) => <AUErrorComponent {...args} />,
|
|
89
122
|
};
|
|
90
123
|
|
|
91
|
-
export const Serialized_Error_With_Code =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
124
|
+
export const Serialized_Error_With_Code: Story = {
|
|
125
|
+
args: {
|
|
126
|
+
serializedError: {
|
|
127
|
+
message: 'Something funky has happened in the code...',
|
|
128
|
+
code: '500',
|
|
129
|
+
},
|
|
130
|
+
withStatus: true,
|
|
96
131
|
},
|
|
97
|
-
|
|
98
|
-
};
|
|
132
|
+
render: (args) => <AUErrorComponent {...args} />,
|
|
133
|
+
};
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { useArgs } from '@storybook/
|
|
2
|
+
import { StoryObj, Meta } from '@storybook/react';
|
|
3
|
+
import { useArgs } from '@storybook/preview-api';
|
|
4
4
|
import AUModalComponent from '../src/components/AUModalComponent';
|
|
5
5
|
import AUButtonComponent from '../src/components/AUButtonComponent';
|
|
6
6
|
import { ThemeWrapper } from './lib/helpers';
|
|
7
7
|
|
|
8
|
+
const modalContent = (
|
|
9
|
+
<>
|
|
10
|
+
<h2 className="modal-view__header">
|
|
11
|
+
The quick brown fox jumps over the lazy dog
|
|
12
|
+
</h2>
|
|
13
|
+
<div className="modal-view__content">
|
|
14
|
+
<p>"The quick brown fox jumps over the lazy dog" is an English-language pangram—a sentence that contains all of the letters of the alphabet. It is commonly used for touch-typing practice, testing typewriters and computer keyboards, displaying examples of fonts, and other applications involving text where the use of all letters in the alphabet is desired. Owing to its brevity and coherence, it has become widely known.</p><h3>History</h3><p>The earliest known appearance of the phrase is from The Boston Journal. In an article titled "Current Notes" in the February 10, 1885, morning edition, the phrase is mentioned as a good practice sentence for writing students: "A favorite copy set by writing teachers for their pupils is the following, because it contains every letter of the alphabet: 'A quick brown fox jumps over the lazy dog.'"[1] Dozens of other newspapers published the phrase over the next few months, all using the version of the sentence starting with "A" rather than "The".[2] The earliest known use of the phrase in its modern form (starting with "The") is from the 1888 book Illustrative Shorthand by Linda Bronson.[3] The modern form (starting with "The") became more common despite the fact that it is slightly longer than the original (starting with "A").</p>
|
|
15
|
+
</div>
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
|
|
8
19
|
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
9
20
|
export default {
|
|
10
21
|
title: 'Delphinus/Modal',
|
|
@@ -23,62 +34,127 @@ export default {
|
|
|
23
34
|
</ThemeWrapper>
|
|
24
35
|
)
|
|
25
36
|
],
|
|
26
|
-
} as
|
|
37
|
+
} as Meta<typeof AUModalComponent>;
|
|
27
38
|
|
|
28
39
|
const fakeBtn = document.createElement('button');
|
|
29
40
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<>
|
|
41
|
-
<h2 className="modal-view__header">
|
|
42
|
-
The quick brown fox jumps over the lazy dog
|
|
43
|
-
</h2>
|
|
44
|
-
<div className="modal-view__content">
|
|
45
|
-
<p>"The quick brown fox jumps over the lazy dog" is an English-language pangram—a sentence that contains all of the letters of the alphabet. It is commonly used for touch-typing practice, testing typewriters and computer keyboards, displaying examples of fonts, and other applications involving text where the use of all letters in the alphabet is desired. Owing to its brevity and coherence, it has become widely known.</p><h3>History</h3><p>The earliest known appearance of the phrase is from The Boston Journal. In an article titled "Current Notes" in the February 10, 1885, morning edition, the phrase is mentioned as a good practice sentence for writing students: "A favorite copy set by writing teachers for their pupils is the following, because it contains every letter of the alphabet: 'A quick brown fox jumps over the lazy dog.'"[1] Dozens of other newspapers published the phrase over the next few months, all using the version of the sentence starting with "A" rather than "The".[2] The earliest known use of the phrase in its modern form (starting with "The") is from the 1888 book Illustrative Shorthand by Linda Bronson.[3] The modern form (starting with "The") became more common despite the fact that it is slightly longer than the original (starting with "A").</p>
|
|
46
|
-
</div>
|
|
47
|
-
</>
|
|
48
|
-
</AUModalComponent>
|
|
49
|
-
</div>
|
|
50
|
-
)
|
|
51
|
-
};
|
|
41
|
+
type Story = StoryObj<typeof AUModalComponent>;
|
|
42
|
+
|
|
43
|
+
export const Default: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
show: true,
|
|
46
|
+
sender: fakeBtn,
|
|
47
|
+
closeButtonDisabled: false,
|
|
48
|
+
},
|
|
49
|
+
render: (args) => {
|
|
50
|
+
const [_, updateArgs] = useArgs();
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
return (
|
|
53
|
+
<div className="page__content__block">
|
|
54
|
+
<AUButtonComponent
|
|
55
|
+
label="Open modal"
|
|
56
|
+
ariaHasPopup
|
|
57
|
+
onClick={() => updateArgs({ ...args, show: true })}
|
|
58
|
+
/>
|
|
59
|
+
<AUModalComponent {...args} onClose={() => updateArgs({ ...args, show: false })}>
|
|
60
|
+
{modalContent}
|
|
61
|
+
</AUModalComponent>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
},
|
|
57
65
|
};
|
|
58
66
|
|
|
59
|
-
export const Hidden =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
export const Hidden: Story = {
|
|
68
|
+
args: {
|
|
69
|
+
show: false,
|
|
70
|
+
sender: fakeBtn,
|
|
71
|
+
},
|
|
72
|
+
render: (args) => {
|
|
73
|
+
const [_, updateArgs] = useArgs();
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div className="page__content__block">
|
|
77
|
+
<AUButtonComponent
|
|
78
|
+
label="Open modal"
|
|
79
|
+
ariaHasPopup
|
|
80
|
+
onClick={() => updateArgs({ ...args, show: true })}
|
|
81
|
+
/>
|
|
82
|
+
<AUModalComponent {...args} onClose={() => updateArgs({ ...args, show: false })}>
|
|
83
|
+
{modalContent}
|
|
84
|
+
</AUModalComponent>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
},
|
|
63
88
|
};
|
|
64
89
|
|
|
65
|
-
export const Wide =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
90
|
+
export const Wide: Story = {
|
|
91
|
+
args: {
|
|
92
|
+
className: 'modal-view modal-view--wide',
|
|
93
|
+
show: true,
|
|
94
|
+
sender: fakeBtn,
|
|
95
|
+
},
|
|
96
|
+
render: (args) => {
|
|
97
|
+
const [_, updateArgs] = useArgs();
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<div className="page__content__block">
|
|
101
|
+
<AUButtonComponent
|
|
102
|
+
label="Open modal"
|
|
103
|
+
ariaHasPopup
|
|
104
|
+
onClick={() => updateArgs({ ...args, show: true })}
|
|
105
|
+
/>
|
|
106
|
+
<AUModalComponent {...args} onClose={() => updateArgs({ ...args, show: false })}>
|
|
107
|
+
{modalContent}
|
|
108
|
+
</AUModalComponent>
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
},
|
|
70
112
|
};
|
|
71
113
|
|
|
72
|
-
export const High =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
114
|
+
export const High: Story = {
|
|
115
|
+
args: {
|
|
116
|
+
className: 'modal-view modal-view--high',
|
|
117
|
+
show: true,
|
|
118
|
+
sender: fakeBtn,
|
|
119
|
+
},
|
|
120
|
+
render: (args) => {
|
|
121
|
+
const [_, updateArgs] = useArgs();
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<div className="page__content__block">
|
|
125
|
+
<AUButtonComponent
|
|
126
|
+
label="Open modal"
|
|
127
|
+
ariaHasPopup
|
|
128
|
+
onClick={() => updateArgs({ ...args, show: true })}
|
|
129
|
+
/>
|
|
130
|
+
<AUModalComponent {...args} onClose={() => updateArgs({ ...args, show: false })}>
|
|
131
|
+
{modalContent}
|
|
132
|
+
</AUModalComponent>
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
},
|
|
77
136
|
};
|
|
78
137
|
|
|
79
|
-
export const Non_Closable =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
138
|
+
export const Non_Closable: Story = {
|
|
139
|
+
args: {
|
|
140
|
+
show: true,
|
|
141
|
+
sender: fakeBtn,
|
|
142
|
+
closeButtonDisabled: true,
|
|
143
|
+
},
|
|
144
|
+
render: (args) => {
|
|
145
|
+
const [_, updateArgs] = useArgs();
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<div className="page__content__block">
|
|
149
|
+
<AUButtonComponent
|
|
150
|
+
label="Open modal"
|
|
151
|
+
ariaHasPopup
|
|
152
|
+
onClick={() => updateArgs({ ...args, show: true })}
|
|
153
|
+
/>
|
|
154
|
+
<AUModalComponent {...args} onClose={() => updateArgs({ ...args, show: false })}>
|
|
155
|
+
{modalContent}
|
|
156
|
+
</AUModalComponent>
|
|
157
|
+
</div>
|
|
158
|
+
);
|
|
159
|
+
},
|
|
84
160
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StoryObj, Meta } from '@storybook/react';
|
|
3
3
|
import AUNotificationComponent from '../src/components/AUNotificationComponent';
|
|
4
4
|
import AUButtonComponent from '../src/components/AUButtonComponent';
|
|
5
5
|
import { ThemeWrapper } from './lib/helpers';
|
|
@@ -18,7 +18,27 @@ export default {
|
|
|
18
18
|
'attention',
|
|
19
19
|
'confirm',
|
|
20
20
|
],
|
|
21
|
-
}
|
|
21
|
+
},
|
|
22
|
+
header: {
|
|
23
|
+
table: {
|
|
24
|
+
disable: true,
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
content: {
|
|
28
|
+
table: {
|
|
29
|
+
disable: true,
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
actions: {
|
|
33
|
+
table: {
|
|
34
|
+
disable: true,
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
classNames: {
|
|
38
|
+
table: {
|
|
39
|
+
disable: true,
|
|
40
|
+
}
|
|
41
|
+
},
|
|
22
42
|
},
|
|
23
43
|
decorators: [
|
|
24
44
|
(Story, context) => (
|
|
@@ -27,90 +47,106 @@ export default {
|
|
|
27
47
|
</ThemeWrapper>
|
|
28
48
|
)
|
|
29
49
|
],
|
|
30
|
-
} as
|
|
50
|
+
} as Meta<typeof AUNotificationComponent>;
|
|
31
51
|
|
|
32
|
-
|
|
52
|
+
type Story = StoryObj<typeof AUNotificationComponent>;
|
|
33
53
|
|
|
34
|
-
export const Default =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const Warning = Template.bind({});
|
|
43
|
-
Warning.args = {
|
|
44
|
-
header: 'Oops! An error has occurred',
|
|
45
|
-
type: 'warning',
|
|
46
|
-
content: [
|
|
47
|
-
<p>Shit's fucked, yo!</p>
|
|
48
|
-
],
|
|
54
|
+
export const Default: Story = {
|
|
55
|
+
args: {
|
|
56
|
+
header: 'This is a notification',
|
|
57
|
+
content: [
|
|
58
|
+
<p>This might be of importance...</p>
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
render: (args) => <AUNotificationComponent {...args} />,
|
|
49
62
|
};
|
|
50
63
|
|
|
51
|
-
export const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
export const Warning: Story = {
|
|
65
|
+
args: {
|
|
66
|
+
header: 'Oops! An error has occurred',
|
|
67
|
+
type: 'warning',
|
|
68
|
+
content: [
|
|
69
|
+
<p>Shit's fucked, yo!</p>
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
render: (args) => <AUNotificationComponent {...args} />,
|
|
58
73
|
};
|
|
59
74
|
|
|
60
|
-
export const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
export const Attention: Story = {
|
|
76
|
+
args: {
|
|
77
|
+
header: 'Please read this',
|
|
78
|
+
type: 'attention',
|
|
79
|
+
content: [
|
|
80
|
+
<p>We really want you to read this.</p>
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
render: (args) => <AUNotificationComponent {...args} />,
|
|
67
84
|
};
|
|
68
85
|
|
|
69
|
-
export const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
label="Ok"
|
|
79
|
-
/>
|
|
80
|
-
],
|
|
86
|
+
export const Confirm: Story = {
|
|
87
|
+
args: {
|
|
88
|
+
header: 'Great success',
|
|
89
|
+
type: 'confirm',
|
|
90
|
+
content: [
|
|
91
|
+
<p>You the man now, dawg!</p>
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
render: (args) => <AUNotificationComponent {...args} />,
|
|
81
95
|
};
|
|
82
96
|
|
|
83
|
-
export const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
<div className="button-container">
|
|
97
|
+
export const Single_Action: Story = {
|
|
98
|
+
args: {
|
|
99
|
+
header: 'Do you want to do this?',
|
|
100
|
+
type: 'attention',
|
|
101
|
+
content: [
|
|
102
|
+
<p>Please confirm.</p>
|
|
103
|
+
],
|
|
104
|
+
actions: [
|
|
92
105
|
<AUButtonComponent
|
|
93
106
|
label="Ok"
|
|
94
107
|
/>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/>
|
|
99
|
-
</div>,
|
|
100
|
-
],
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
render: (args) => <AUNotificationComponent {...args} />,
|
|
101
111
|
};
|
|
102
112
|
|
|
103
|
-
export const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
113
|
+
export const Multiple_Actions: Story = {
|
|
114
|
+
args: {
|
|
115
|
+
header: 'Do you want to do this?',
|
|
116
|
+
type: 'attention',
|
|
117
|
+
content: [
|
|
118
|
+
<p>Please confirm.</p>
|
|
119
|
+
],
|
|
120
|
+
actions: [
|
|
121
|
+
<div className="button-container">
|
|
122
|
+
<AUButtonComponent
|
|
123
|
+
label="Ok"
|
|
124
|
+
/>
|
|
125
|
+
<AUButtonComponent
|
|
126
|
+
label="Cancel"
|
|
127
|
+
type="text"
|
|
128
|
+
/>
|
|
129
|
+
</div>,
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
render: (args) => <AUNotificationComponent {...args} />,
|
|
108
133
|
};
|
|
109
134
|
|
|
110
|
-
export const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
135
|
+
export const No_Header: Story = {
|
|
136
|
+
args: {
|
|
137
|
+
content: [
|
|
138
|
+
<p>This might be of importance...</p>
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
render: (args) => <AUNotificationComponent {...args} />,
|
|
116
142
|
};
|
|
143
|
+
|
|
144
|
+
export const Constrained_Width: Story = {
|
|
145
|
+
args: {
|
|
146
|
+
header: 'This is a notification',
|
|
147
|
+
content: [
|
|
148
|
+
<p>This might be of importance...</p>
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
render: (args) => <AUNotificationComponent {...args} />,
|
|
152
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StoryObj, Meta } from '@storybook/react';
|
|
3
3
|
import AUSpinnerComponent from '../src/components/AUSpinnerComponent';
|
|
4
4
|
import { ThemeWrapper } from './lib/helpers';
|
|
5
5
|
|
|
@@ -17,6 +17,11 @@ export default {
|
|
|
17
17
|
'table',
|
|
18
18
|
],
|
|
19
19
|
},
|
|
20
|
+
className: {
|
|
21
|
+
table: {
|
|
22
|
+
disable: true,
|
|
23
|
+
}
|
|
24
|
+
},
|
|
20
25
|
},
|
|
21
26
|
decorators: [
|
|
22
27
|
(Story, context) => (
|
|
@@ -25,17 +30,15 @@ export default {
|
|
|
25
30
|
</ThemeWrapper>
|
|
26
31
|
)
|
|
27
32
|
],
|
|
28
|
-
} as
|
|
33
|
+
} as Meta<typeof AUSpinnerComponent>;
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
<AUSpinnerComponent {...args}>
|
|
32
|
-
<p>Child content</p>
|
|
33
|
-
</AUSpinnerComponent>
|
|
34
|
-
);
|
|
35
|
+
type Story = StoryObj<typeof AUSpinnerComponent>;
|
|
35
36
|
|
|
36
|
-
export const Spinner =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
export const Spinner: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
loaded: false,
|
|
40
|
+
height: '20rem',
|
|
41
|
+
init: 'box',
|
|
42
|
+
},
|
|
43
|
+
render: (args) => <AUSpinnerComponent {...args}><p>Child content</p></AUSpinnerComponent>,
|
|
41
44
|
};
|