@aarhus-university/au-lib-react-components 10.6.0 → 10.9.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 (97) hide show
  1. package/.eslintrc.js +34 -34
  2. package/.storybook/main.js +20 -7
  3. package/.storybook/preview.js +10 -10
  4. package/README.md +19 -19
  5. package/__tests__/jest/AUButtonComponent.test.tsx +165 -163
  6. package/__tests__/jest/AUErrorComponent.test.tsx +142 -0
  7. package/__tests__/jest/AUModalComponent.test.tsx +186 -0
  8. package/__tests__/jest/AUNotificationComponent.test.tsx +115 -0
  9. package/__tests__/jest/AUSpinnerComponent.test.tsx +57 -57
  10. package/__tests__/jest/AUToolbarComponent.test.tsx +46 -0
  11. package/__tests__/jest/helpers.test.ts +15 -15
  12. package/__tests__/jest/setupTests.ts +2 -2
  13. package/babel.config.js +8 -8
  14. package/build/umd/universe.js.map +1 -1
  15. package/package.json +108 -107
  16. package/src/components/AUAlertComponent.tsx +70 -70
  17. package/src/components/AUAutoSuggestComponent.js +158 -158
  18. package/src/components/AUButtonComponent.tsx +83 -77
  19. package/src/components/AUCalendarComponent.tsx +493 -493
  20. package/src/components/AUContentToggleComponent.tsx +33 -33
  21. package/src/components/AUDatepickerComponent.tsx +117 -117
  22. package/src/components/AUErrorComponent.tsx +78 -0
  23. package/src/components/AUMobilePrefixComponent.tsx +15 -15
  24. package/src/components/AUModalComponent.tsx +64 -80
  25. package/src/components/AUNotificationComponent.tsx +42 -0
  26. package/src/components/AUReceiptComponent.tsx +33 -33
  27. package/src/components/AUSpinnerComponent.tsx +33 -33
  28. package/src/components/AUSubNavComponent.tsx +48 -48
  29. package/src/components/AUSubmitButtonContainerComponent.tsx +31 -31
  30. package/src/components/AUTabbedContentComponent.tsx +145 -145
  31. package/src/components/AUTableComponent.tsx +24 -24
  32. package/src/components/AUToastComponent.tsx +103 -103
  33. package/src/components/AUToolbarComponent.tsx +52 -45
  34. package/src/components/profile/AUProfileActions.js +128 -128
  35. package/src/components/profile/AUProfileAvatarComponent.js +83 -83
  36. package/src/components/profile/AUProfileAvatarV2Component.js +91 -91
  37. package/src/components/profile/AUProfileAvatarV3Component.tsx +42 -42
  38. package/src/components/profile/AUProfileContainerComponent.js +283 -283
  39. package/src/components/profile/AUProfileHooks.js +30 -30
  40. package/src/components/profile/AUProfileItemComponent.js +54 -54
  41. package/src/components/profile/AUProfileLanguageComponent.js +131 -131
  42. package/src/components/profile/AUProfileLoginComponent.tsx +26 -26
  43. package/src/components/profile/AUProfileMailComponent.js +307 -307
  44. package/src/components/profile/AUProfileMobileComponent.js +164 -164
  45. package/src/components/profile/AUProfileNameComponent.js +253 -253
  46. package/src/components/profile/AUProfileNextOfKinComponent.js +216 -216
  47. package/src/components/profile/AUProfileReducer.js +230 -230
  48. package/src/components/profile/AUProfileWidgetComponent.js +95 -95
  49. package/src/components/profile/AUProfileWidgetV2Component.js +116 -116
  50. package/src/components/profile/AUProfileWidgetV3Component.tsx +122 -122
  51. package/src/components/wrapping/AUEmbedComponent.js +47 -47
  52. package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +143 -143
  53. package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
  54. package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
  55. package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
  56. package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
  57. package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
  58. package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
  59. package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
  60. package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
  61. package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
  62. package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
  63. package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
  64. package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
  65. package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
  66. package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
  67. package/src/layout-2016/components/profile/AUProfileAvatar2016Component.js +103 -103
  68. package/src/layout-2016/components/universe/StaffTopComponent.js +363 -363
  69. package/src/layout-2016/components/universe/StudentTopComponent.js +137 -137
  70. package/src/layout-2016/components/universe/UniverseContainerComponent.js +65 -65
  71. package/src/layout-2016/lib/all.js +3 -3
  72. package/src/layout-2016/lib/au-alphabox.js +100 -100
  73. package/src/layout-2016/lib/au-databox.js +400 -400
  74. package/src/layout-2016/lib/au-diagramme.js +85 -85
  75. package/src/layout-2016/lib/au-flowbox.js +93 -93
  76. package/src/layout-2016/lib/universe.js +9 -9
  77. package/src/lib/helpers.ts +194 -194
  78. package/src/lib/hooks.ts +37 -33
  79. package/src/lib/i18n.ts +600 -600
  80. package/src/lib/tracking.ts +69 -69
  81. package/src/lib/wrapping.ts +21 -21
  82. package/src/styles/_settings.scss +10 -10
  83. package/src/styles/alphabox.scss +222 -222
  84. package/src/styles/app.scss +7 -7
  85. package/src/styles/autosuggest.scss +57 -57
  86. package/src/styles/databox.scss +563 -563
  87. package/src/styles/diagramme.scss +119 -119
  88. package/src/styles/flowbox.scss +72 -72
  89. package/src/styles/maps.scss +395 -395
  90. package/stories/AUButtonComponent.stories.tsx +85 -85
  91. package/stories/AUErrorComponent.stories.tsx +117 -0
  92. package/stories/AUModalComponent.stories.tsx +92 -0
  93. package/stories/AUNotificationComponent.stories.tsx +116 -0
  94. package/stories/AUSpinnerComponent.stories.tsx +41 -41
  95. package/stories/AUToolbarComponent.stories.tsx +96 -0
  96. package/tsconfig.json +46 -46
  97. package/webpack.config.js +89 -89
@@ -1,86 +1,86 @@
1
- import React from 'react';
2
- import { ComponentStory, ComponentMeta } from '@storybook/react';
3
-
4
- import AUButtonComponent from '../src/components/AUButtonComponent';
5
-
6
- // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
7
- export default {
8
- title: 'Delphinus/Button',
9
- component: AUButtonComponent,
10
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
11
- decorators: [
12
- (Story) => { // , context) => {
13
- /*
14
- const { args: { themeColor, themeMode } } = context;
15
- const themeColorClass = themeColor === 'none' ? '' : `theme--${themeColor}`;
16
- const themeModeClass = themeMode === 'light' ? '' : `theme--${themeMode}`;
17
- */
18
- return (
19
- <div>
20
- <Story />
21
- </div>
22
- );
23
- }
24
- ]
25
- } as ComponentMeta<typeof AUButtonComponent>;
26
-
27
- // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
28
- const Template: ComponentStory<typeof AUButtonComponent> = (args) => <AUButtonComponent {...args} />;
29
-
30
- export const Default = Template.bind({});
31
- // More on args: https://storybook.js.org/docs/react/writing-stories/args
32
- Default.args = {
33
- label: 'Button',
34
- type: 'default',
35
- size: 'default',
36
- mode: 'none',
37
- };
38
-
39
- export const With_Icon = Template.bind({});
40
- With_Icon.args = {
41
- label: 'Button',
42
- type: 'default',
43
- size: 'default',
44
- mode: 'none',
45
- icon: '',
46
- iconPosition: 'left',
47
- hideLabel: false,
48
- };
49
-
50
- export const Icon_Only = Template.bind({});
51
- Icon_Only.args = {
52
- label: 'Button',
53
- type: 'default',
54
- size: 'default',
55
- mode: 'none',
56
- icon: '',
57
- iconPosition: 'left',
58
- hideLabel: true,
59
- };
60
-
61
- export const Irreversible_Action = Template.bind({});
62
- Irreversible_Action.args = {
63
- label: 'Button',
64
- type: 'default',
65
- size: 'default',
66
- mode: 'ireversable-action',
67
- icon: '',
68
- };
69
-
70
- export const Confirmable_Action = Template.bind({});
71
- Confirmable_Action.args = {
72
- label: 'Button',
73
- type: 'default',
74
- size: 'default',
75
- mode: 'confirmable-action',
76
- icon: '',
77
- };
78
-
79
- export const Processing = Template.bind({});
80
- Processing.args = {
81
- label: 'Button',
82
- type: 'default',
83
- size: 'default',
84
- mode: 'processing',
85
- disabled: true,
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+
4
+ import AUButtonComponent from '../src/components/AUButtonComponent';
5
+
6
+ // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
7
+ export default {
8
+ title: 'Delphinus/Button',
9
+ component: AUButtonComponent,
10
+ // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
11
+ decorators: [
12
+ (Story) => { // , context) => {
13
+ /*
14
+ const { args: { themeColor, themeMode } } = context;
15
+ const themeColorClass = themeColor === 'none' ? '' : `theme--${themeColor}`;
16
+ const themeModeClass = themeMode === 'light' ? '' : `theme--${themeMode}`;
17
+ */
18
+ return (
19
+ <div>
20
+ {Story()}
21
+ </div>
22
+ );
23
+ }
24
+ ]
25
+ } as ComponentMeta<typeof AUButtonComponent>;
26
+
27
+ // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
28
+ const Template: ComponentStory<typeof AUButtonComponent> = (args) => <AUButtonComponent {...args} />;
29
+
30
+ export const Default = Template.bind({});
31
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
32
+ Default.args = {
33
+ label: 'Button',
34
+ type: 'default',
35
+ size: 'default',
36
+ mode: 'none',
37
+ };
38
+
39
+ export const With_Icon = Template.bind({});
40
+ With_Icon.args = {
41
+ label: 'Button',
42
+ type: 'default',
43
+ size: 'default',
44
+ mode: 'none',
45
+ icon: '',
46
+ iconPosition: 'left',
47
+ hideLabel: false,
48
+ };
49
+
50
+ export const Icon_Only = Template.bind({});
51
+ Icon_Only.args = {
52
+ label: 'Button',
53
+ type: 'default',
54
+ size: 'default',
55
+ mode: 'none',
56
+ icon: '',
57
+ iconPosition: 'left',
58
+ hideLabel: true,
59
+ };
60
+
61
+ export const Irreversible_Action = Template.bind({});
62
+ Irreversible_Action.args = {
63
+ label: 'Button',
64
+ type: 'default',
65
+ size: 'default',
66
+ mode: 'ireversable-action',
67
+ icon: '',
68
+ };
69
+
70
+ export const Confirmable_Action = Template.bind({});
71
+ Confirmable_Action.args = {
72
+ label: 'Button',
73
+ type: 'default',
74
+ size: 'default',
75
+ mode: 'confirmable-action',
76
+ icon: '',
77
+ };
78
+
79
+ export const Processing = Template.bind({});
80
+ Processing.args = {
81
+ label: 'Button',
82
+ type: 'default',
83
+ size: 'default',
84
+ mode: 'processing',
85
+ disabled: true,
86
86
  };
@@ -0,0 +1,117 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+
4
+ import AUErrorComponent from '../src/components/AUErrorComponent';
5
+
6
+ // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
7
+ export default {
8
+ title: 'Delphinus/Error',
9
+ component: AUErrorComponent,
10
+ // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
11
+ decorators: [
12
+ (Story) => { // , context) => {
13
+ /*
14
+ const { args: { themeColor, themeMode } } = context;
15
+ const themeColorClass = themeColor === 'none' ? '' : `theme--${themeColor}`;
16
+ const themeModeClass = themeMode === 'light' ? '' : `theme--${themeMode}`;
17
+ */
18
+ return (
19
+ <div>
20
+ {Story()}
21
+ </div>
22
+ );
23
+ }
24
+ ]
25
+ } as ComponentMeta<typeof AUErrorComponent>;
26
+
27
+ // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
28
+ const Template: ComponentStory<typeof AUErrorComponent> = (args) => <AUErrorComponent {...args} />;
29
+
30
+ export const AU_Error = Template.bind({});
31
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
32
+ AU_Error.args = {
33
+ error: {
34
+ header: 'Our own custom error',
35
+ message: 'With a nice header and descriptive error message',
36
+ status: 500,
37
+ },
38
+ };
39
+
40
+ export const AU_Error_With_Status = Template.bind({});
41
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
42
+ AU_Error_With_Status.args = {
43
+ error: {
44
+ header: 'Our own custom error',
45
+ message: 'With a nice header and descriptive error message',
46
+ status: 500,
47
+ },
48
+ withStatus: true,
49
+ };
50
+
51
+ export const Fetch_Error = Template.bind({});
52
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
53
+ Fetch_Error.args = {
54
+ fetchError: {
55
+ error: 'Something horrible has happened on the server...',
56
+ status: 'FETCH_ERROR',
57
+ },
58
+ };
59
+
60
+ export const Fetch_Error_With_Status = Template.bind({});
61
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
62
+ Fetch_Error_With_Status.args = {
63
+ fetchError: {
64
+ error: 'Something horrible has happened on the server...',
65
+ status: 'FETCH_ERROR',
66
+ },
67
+ withStatus: true,
68
+ };
69
+
70
+ export const Fetch_Error_With_Data = Template.bind({});
71
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
72
+ Fetch_Error_With_Data.args = {
73
+ fetchError: {
74
+ data: {
75
+ status: 'Error',
76
+ message: 'This could be anything...',
77
+ somethingElse: 'Even this...',
78
+ },
79
+ status: 500,
80
+ },
81
+ withStatus: false,
82
+ };
83
+
84
+ export const Fetch_Error_With_Data_And_Status = Template.bind({});
85
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
86
+ Fetch_Error_With_Data_And_Status.args = {
87
+ fetchError: {
88
+ data: {
89
+ status: 'Error',
90
+ message: 'This could be anything...',
91
+ somethingElse: 'Even this...',
92
+ },
93
+ status: 500,
94
+ },
95
+ withStatus: true,
96
+ };
97
+
98
+ export const Serialized_Error = Template.bind({});
99
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
100
+ Serialized_Error.args = {
101
+ serializedError: {
102
+ message: 'Something funky has happened in the code...',
103
+ code: '500',
104
+ },
105
+ withStatus: false,
106
+ };
107
+
108
+ export const Serialized_Error_With_Code = Template.bind({});
109
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
110
+ Serialized_Error_With_Code.args = {
111
+ serializedError: {
112
+ message: 'Something funky has happened in the code...',
113
+ code: '500',
114
+ },
115
+ withStatus: true,
116
+ };
117
+
@@ -0,0 +1,92 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ import { useArgs } from '@storybook/client-api';
4
+
5
+ import AUModalComponent from '../src/components/AUModalComponent';
6
+ import AUButtonComponent from '../src/components/AUButtonComponent';
7
+
8
+ // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
9
+ export default {
10
+ title: 'Delphinus/Modal',
11
+ component: AUModalComponent,
12
+ // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
13
+ decorators: [
14
+ (Story) => {
15
+ // , context) => {
16
+ /*
17
+ const { args: { themeColor, themeMode } } = context;
18
+ const themeColorClass = themeColor === 'none' ? '' : `theme--${themeColor}`;
19
+ const themeModeClass = themeMode === 'light' ? '' : `theme--${themeMode}`;
20
+ */
21
+ return (
22
+ <div className="page">
23
+ {Story()}
24
+ </div>
25
+ );
26
+ },
27
+ ],
28
+ } as ComponentMeta<typeof AUModalComponent>;
29
+
30
+ const fakeBtn = document.createElement('button');
31
+
32
+ // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
33
+ const Template: ComponentStory<typeof AUModalComponent> = (args) => {
34
+ const [_, updateArgs] = useArgs();
35
+ return (
36
+ <div className="page__content__block">
37
+ <AUButtonComponent
38
+ label="Open modal"
39
+ onClick={() => updateArgs({ ...args, show: true })}
40
+ />
41
+ <AUModalComponent {...args} onClose={() => updateArgs({ ...args, show: false })}>
42
+ <div className="modal-view__body">
43
+ <h2 className="modal-view__header">
44
+ The quick brown fox jumps over the lazy dog
45
+ </h2>
46
+ <div className="modal-view__content">
47
+ <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>
48
+ </div>
49
+ </div>
50
+ </AUModalComponent>
51
+ </div>
52
+ )
53
+ };
54
+
55
+ export const Default = Template.bind({});
56
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
57
+ Default.args = {
58
+ show: true,
59
+ sender: fakeBtn,
60
+ };
61
+
62
+ export const Hidden = Template.bind({});
63
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
64
+ Hidden.args = {
65
+ show: false,
66
+ sender: fakeBtn,
67
+ };
68
+
69
+ export const Wide = Template.bind({});
70
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
71
+ Wide.args = {
72
+ className: 'modal-view modal-view--wide',
73
+ show: true,
74
+ sender: fakeBtn,
75
+ };
76
+
77
+ export const High = Template.bind({});
78
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
79
+ High.args = {
80
+ className: 'modal-view modal-view--high',
81
+ show: true,
82
+ sender: fakeBtn,
83
+ };
84
+
85
+ export const Non_Closable = Template.bind({});
86
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
87
+ Non_Closable.args = {
88
+ show: true,
89
+ sender: fakeBtn,
90
+ closeButtonDisabled: true,
91
+ };
92
+
@@ -0,0 +1,116 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+
4
+ import AUNotificationComponent from '../src/components/AUNotificationComponent';
5
+ import AUButtonComponent from '../src/components/AUButtonComponent';
6
+
7
+ // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
8
+ export default {
9
+ title: 'Delphinus/Notification',
10
+ component: AUNotificationComponent,
11
+ // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
12
+ decorators: [
13
+ (Story) => { // , context) => {
14
+ /*
15
+ const { args: { themeColor, themeMode } } = context;
16
+ const themeColorClass = themeColor === 'none' ? '' : `theme--${themeColor}`;
17
+ const themeModeClass = themeMode === 'light' ? '' : `theme--${themeMode}`;
18
+ */
19
+ return (
20
+ <div>
21
+ {Story()}
22
+ </div>
23
+ );
24
+ }
25
+ ]
26
+ } as ComponentMeta<typeof AUNotificationComponent>;
27
+
28
+ // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
29
+ const Template: ComponentStory<typeof AUNotificationComponent> = (args) => <AUNotificationComponent {...args} />;
30
+
31
+ export const Default = Template.bind({});
32
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
33
+ Default.args = {
34
+ header: 'This is a notification',
35
+ content: [
36
+ <p>This might be of importance...</p>
37
+ ],
38
+ };
39
+
40
+ export const Warning = Template.bind({});
41
+ Warning.args = {
42
+ header: 'Oops! An error has occurred',
43
+ type: 'warning',
44
+ content: [
45
+ <p>Shit's fucked, yo!</p>
46
+ ],
47
+ };
48
+
49
+ export const Attention = Template.bind({});
50
+ Attention.args = {
51
+ header: 'Please read this',
52
+ type: 'attention',
53
+ content: [
54
+ <p>We really want you to read this.</p>
55
+ ],
56
+ };
57
+
58
+ export const Confirm = Template.bind({});
59
+ Confirm.args = {
60
+ header: 'Great success',
61
+ type: 'confirm',
62
+ content: [
63
+ <p>You the man now, dawg!</p>
64
+ ],
65
+ };
66
+
67
+ export const Single_Action = Template.bind({});
68
+ Single_Action.args = {
69
+ header: 'Do you want to do this?',
70
+ type: 'attention',
71
+ content: [
72
+ <p>Please confirm.</p>
73
+ ],
74
+ actions: [
75
+ <AUButtonComponent
76
+ label="Ok"
77
+ />
78
+ ],
79
+ };
80
+
81
+ export const Multiple_Actions = Template.bind({});
82
+ Multiple_Actions.args = {
83
+ header: 'Do you want to do this?',
84
+ type: 'attention',
85
+ content: [
86
+ <p>Please confirm.</p>
87
+ ],
88
+ actions: [
89
+ <div className="button-container">
90
+ <AUButtonComponent
91
+ label="Ok"
92
+ />
93
+ <AUButtonComponent
94
+ label="Cancel"
95
+ type="text"
96
+ />
97
+ </div>,
98
+ ],
99
+ };
100
+
101
+ export const No_Header = Template.bind({});
102
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
103
+ No_Header.args = {
104
+ content: [
105
+ <p>This might be of importance...</p>
106
+ ],
107
+ };
108
+
109
+ export const Constrained_Width = Template.bind({});
110
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
111
+ Constrained_Width.args = {
112
+ content: [
113
+ <p>This might be of importance...</p>
114
+ ],
115
+ classNames: ['notification--constrain-width'],
116
+ };
@@ -1,41 +1,41 @@
1
- import React from 'react';
2
- import { ComponentStory, ComponentMeta } from '@storybook/react';
3
-
4
- import AUSpinnerComponent from '../src/components/AUSpinnerComponent';
5
-
6
- // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
7
- export default {
8
- title: 'Delphinus/Spinner',
9
- component: AUSpinnerComponent,
10
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
11
- decorators: [
12
- (Story) => {
13
- // , context) => {
14
- /*
15
- const { args: { themeColor, themeMode } } = context;
16
- const themeColorClass = themeColor === 'none' ? '' : `theme--${themeColor}`;
17
- const themeModeClass = themeMode === 'light' ? '' : `theme--${themeMode}`;
18
- */
19
- return (
20
- <div>
21
- <Story />
22
- </div>
23
- );
24
- },
25
- ],
26
- } as ComponentMeta<typeof AUSpinnerComponent>;
27
-
28
- // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
29
- const Template: ComponentStory<typeof AUSpinnerComponent> = (args) => (
30
- <AUSpinnerComponent {...args}>
31
- <p>Child content</p>
32
- </AUSpinnerComponent>
33
- );
34
-
35
- export const Spinner = Template.bind({});
36
- // More on args: https://storybook.js.org/docs/react/writing-stories/args
37
- Spinner.args = {
38
- loaded: false,
39
- height: '20rem',
40
- init: 'box',
41
- };
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+
4
+ import AUSpinnerComponent from '../src/components/AUSpinnerComponent';
5
+
6
+ // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
7
+ export default {
8
+ title: 'Delphinus/Spinner',
9
+ component: AUSpinnerComponent,
10
+ // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
11
+ decorators: [
12
+ (Story) => {
13
+ // , context) => {
14
+ /*
15
+ const { args: { themeColor, themeMode } } = context;
16
+ const themeColorClass = themeColor === 'none' ? '' : `theme--${themeColor}`;
17
+ const themeModeClass = themeMode === 'light' ? '' : `theme--${themeMode}`;
18
+ */
19
+ return (
20
+ <div>
21
+ {Story()}
22
+ </div>
23
+ );
24
+ },
25
+ ],
26
+ } as ComponentMeta<typeof AUSpinnerComponent>;
27
+
28
+ // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
29
+ const Template: ComponentStory<typeof AUSpinnerComponent> = (args) => (
30
+ <AUSpinnerComponent {...args}>
31
+ <p>Child content</p>
32
+ </AUSpinnerComponent>
33
+ );
34
+
35
+ export const Spinner = Template.bind({});
36
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
37
+ Spinner.args = {
38
+ loaded: false,
39
+ height: '20rem',
40
+ init: 'box',
41
+ };
@@ -0,0 +1,96 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+
4
+ import AUToolbarComponent from '../src/components/AUToolbarComponent';
5
+ import AUButtonComponent from '../src/components/AUButtonComponent';
6
+
7
+ // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
8
+ export default {
9
+ title: 'Delphinus/Toolbar',
10
+ component: AUToolbarComponent,
11
+ // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
12
+ decorators: [
13
+ (Story) => {
14
+ // , context) => {
15
+ /*
16
+ const { args: { themeColor, themeMode } } = context;
17
+ const themeColorClass = themeColor === 'none' ? '' : `theme--${themeColor}`;
18
+ const themeModeClass = themeMode === 'light' ? '' : `theme--${themeMode}`;
19
+ */
20
+ return (
21
+ <div>
22
+ {Story()}
23
+ <div className="box theme--background-secondary"><p>Content goes here...</p></div>
24
+ </div>
25
+ );
26
+ },
27
+ ],
28
+ } as ComponentMeta<typeof AUToolbarComponent>;
29
+
30
+ // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
31
+ const Template: ComponentStory<typeof AUToolbarComponent> = (args) => (
32
+ <AUToolbarComponent {...args} />
33
+ );
34
+
35
+ export const Form_Field_and_Buttons_and_Link = Template.bind({});
36
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
37
+ Form_Field_and_Buttons_and_Link.args = {
38
+ lang: 'da',
39
+ elements: [
40
+ <div className="form__field">
41
+ <label htmlFor="demo-search">Search</label>
42
+ <input type="search" autoComplete="off" autoCorrect="off" autoCapitalize="off" id="demo-search" />
43
+ </div>,
44
+ <AUButtonComponent icon="" label="Mark as read" />,
45
+ <AUButtonComponent icon="" hideLabel label="Delete" />,
46
+ <AUButtonComponent type="text" label="Select all" />,
47
+ <div className="toolbar__split" />,
48
+ <div className="toolbar__text-item">
49
+ <a className="a--text-link" href="#">Open in new tab</a>
50
+ </div>,
51
+ ]
52
+ };
53
+
54
+ export const Many_Actions = Template.bind({});
55
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
56
+ Many_Actions.args = {
57
+ lang: 'da',
58
+ elements: Array(25).fill(null).map((_, i) => <AUButtonComponent label={`Action ${i + 1}`} />),
59
+ };
60
+
61
+ export const Groupings = Template.bind({});
62
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
63
+ Groupings.args = {
64
+ lang: 'da',
65
+ elements: [
66
+ <div className="toolbar__group">
67
+ <div className="form__field form__field--horizontal">
68
+ <label htmlFor="demo-all">All issues</label>
69
+ <input type="radio" name="demo" value="all" id="demo-all" defaultChecked />
70
+ </div>
71
+ <div className="form__field form__field--horizontal">
72
+ <label htmlFor="demo-open">Open</label>
73
+ <input type="radio" name="demo" value="all" id="demo-open" />
74
+ </div>
75
+ <div className="form__field form__field--horizontal">
76
+ <label htmlFor="demo-resolved">Resolved</label>
77
+ <input type="radio" name="demo" value="all" id="demo-resolved" />
78
+ </div>
79
+ </div>,
80
+ <div className="toolbar__split" />,
81
+ <div className="toolbar__group">
82
+ <div className="form__field form__field--horizontal">
83
+ <label htmlFor="demo-epics">Epics</label>
84
+ <input type="checkbox" id="demo-epics" defaultChecked />
85
+ </div>
86
+ <div className="form__field form__field--horizontal">
87
+ <label htmlFor="demo-stories">Stories</label>
88
+ <input type="checkbox" id="demo-stories" defaultChecked />
89
+ </div>
90
+ <div className="form__field form__field--horizontal">
91
+ <label htmlFor="demo-tasks">Tasks</label>
92
+ <input type="checkbox" id="demo-tasks" defaultChecked />
93
+ </div>
94
+ </div>,
95
+ ],
96
+ };