@aarhus-university/au-lib-react-components 11.5.1 → 11.6.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 (100) hide show
  1. package/.eslintrc.js +34 -34
  2. package/.storybook/main.js +20 -20
  3. package/.storybook/preview.js +17 -17
  4. package/README.md +19 -19
  5. package/__tests__/jest/AUButtonComponent.test.tsx +165 -165
  6. package/__tests__/jest/AUErrorComponent.test.tsx +142 -142
  7. package/__tests__/jest/AUModalComponent.test.tsx +186 -186
  8. package/__tests__/jest/AUNotificationComponent.test.tsx +115 -115
  9. package/__tests__/jest/AUSpinnerComponent.test.tsx +57 -57
  10. package/__tests__/jest/AUToolbarComponent.test.tsx +46 -46
  11. package/__tests__/jest/context.test.ts +25 -25
  12. package/__tests__/jest/helpers.test.ts +15 -15
  13. package/__tests__/jest/setupTests.ts +2 -2
  14. package/babel.config.js +8 -8
  15. package/build/umd/all.css +2 -2
  16. package/build/umd/all.js +1 -1
  17. package/build/umd/alphabox.js +1 -1
  18. package/build/umd/databox.js +1 -1
  19. package/build/umd/diagramme.js +1 -1
  20. package/build/umd/flowbox.js +1 -1
  21. package/build/umd/universe.js +1 -1
  22. package/build-storybook.log +367 -367
  23. package/package.json +114 -114
  24. package/src/components/AUAlertComponent.tsx +113 -113
  25. package/src/components/AUAutoSuggestComponent.js +158 -158
  26. package/src/components/AUButtonComponent.tsx +87 -87
  27. package/src/components/AUCalendarComponent.tsx +493 -493
  28. package/src/components/AUContentToggleComponent.tsx +47 -47
  29. package/src/components/AUDatepickerComponent.tsx +121 -121
  30. package/src/components/AUEditFilterComponent.tsx +24 -67
  31. package/src/components/AUErrorComponent.tsx +78 -78
  32. package/src/components/AUMobilePrefixComponent.tsx +15 -15
  33. package/src/components/AUModalComponent.tsx +68 -68
  34. package/src/components/AUNotificationComponent.tsx +43 -43
  35. package/src/components/AUReceiptComponent.tsx +33 -33
  36. package/src/components/AUSpinnerComponent.tsx +36 -36
  37. package/src/components/AUStepComponent.tsx +47 -47
  38. package/src/components/AUSubNavComponent.tsx +48 -48
  39. package/src/components/AUSubmitButtonContainerComponent.tsx +29 -29
  40. package/src/components/AUTabbedContentComponent.tsx +145 -145
  41. package/src/components/AUTableComponent.tsx +24 -24
  42. package/src/components/AUToastComponent.tsx +104 -104
  43. package/src/components/AUToolbarComponent.tsx +101 -106
  44. package/src/components/AUTruncatorComponent.tsx +124 -124
  45. package/src/components/wrapping/AUEmbedComponent.js +47 -47
  46. package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +143 -143
  47. package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
  48. package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
  49. package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
  50. package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
  51. package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
  52. package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
  53. package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
  54. package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
  55. package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
  56. package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
  57. package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
  58. package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
  59. package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
  60. package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
  61. package/src/layout-2016/components/profile/AUProfileAvatar2016Component.js +103 -103
  62. package/src/layout-2016/components/universe/StaffTopComponent.js +363 -363
  63. package/src/layout-2016/components/universe/StudentTopComponent.js +137 -137
  64. package/src/layout-2016/components/universe/UniverseContainerComponent.js +65 -65
  65. package/src/layout-2016/lib/all.js +3 -3
  66. package/src/layout-2016/lib/au-alphabox.js +100 -100
  67. package/src/layout-2016/lib/au-databox.js +400 -400
  68. package/src/layout-2016/lib/au-diagramme.js +85 -85
  69. package/src/layout-2016/lib/au-flowbox.js +93 -93
  70. package/src/layout-2016/lib/universe.js +9 -9
  71. package/src/lib/context.tsx +51 -51
  72. package/src/lib/dates.ts +50 -50
  73. package/src/lib/helpers.ts +208 -208
  74. package/src/lib/hooks.ts +75 -75
  75. package/src/lib/i18n.ts +600 -600
  76. package/src/lib/portals.tsx +145 -119
  77. package/src/lib/tracking.ts +69 -69
  78. package/src/lib/wrapping.ts +21 -21
  79. package/src/styles/_settings.scss +10 -10
  80. package/src/styles/alphabox.scss +222 -222
  81. package/src/styles/app.scss +7 -7
  82. package/src/styles/autosuggest.scss +57 -57
  83. package/src/styles/databox.scss +563 -563
  84. package/src/styles/diagramme.scss +119 -119
  85. package/src/styles/flowbox.scss +72 -72
  86. package/src/styles/maps.scss +395 -395
  87. package/stories/AUAlertComponent.stories.tsx +120 -120
  88. package/stories/AUButtonComponent.stories.tsx +127 -127
  89. package/stories/AUContentToggleComponent.stories.tsx +63 -63
  90. package/stories/AUEditFilterComponent.stories.tsx +29 -29
  91. package/stories/AUErrorComponent.stories.tsx +98 -98
  92. package/stories/AUModalComponent.stories.tsx +84 -84
  93. package/stories/AUNotificationComponent.stories.tsx +116 -116
  94. package/stories/AUSpinnerComponent.stories.tsx +41 -41
  95. package/stories/AUStepComponent.stories.tsx +40 -40
  96. package/stories/AUToolbarComponent.stories.tsx +326 -327
  97. package/stories/AUTruncatorComponent.stories.tsx +101 -101
  98. package/stories/lib/helpers.tsx +128 -128
  99. package/tsconfig.json +46 -46
  100. package/webpack.config.js +89 -89
@@ -1,120 +1,120 @@
1
- import React, { FC, useState } from 'react';
2
- import { ComponentStory, ComponentMeta } from '@storybook/react';
3
- import AUAlertComponent from '../src/components/AUAlertComponent';
4
- import { ThemeWrapper } from './lib/helpers';
5
-
6
- const AlertWrapper: FC<AUAlertComponentProps> = ({
7
- confirm,
8
- label,
9
- mode,
10
- header,
11
- message,
12
- okButtonText,
13
- cancelButtonText,
14
- }) => {
15
- const [processing, setProcessing] = useState<boolean>(false);
16
- const [done, setDone] = useState<boolean>(false);
17
-
18
- return (
19
- <AUAlertComponent
20
- modalId="alertModal"
21
- confirm={confirm}
22
- label={label}
23
- mode={mode}
24
- header={header}
25
- message={message}
26
- okButtonText={okButtonText}
27
- cancelButtonText={cancelButtonText}
28
- processing={processing}
29
- done={done}
30
- onClick={() => {
31
- setDone(false);
32
- setProcessing(true);
33
- setTimeout(() => {
34
- setDone(true);
35
- setProcessing(false);
36
- }, 2500);
37
- }}
38
- />
39
- );
40
- };
41
-
42
- export default {
43
- title: 'Delphinus/Alert and Confirm',
44
- component: AUAlertComponent,
45
- argTypes: {
46
- label: {
47
- table: {
48
- disable: true,
49
- }
50
- },
51
- mode: {
52
- table: {
53
- disable: true,
54
- }
55
- },
56
- onClick: {
57
- table: {
58
- disable: true,
59
- }
60
- },
61
- modalId: {
62
- table: {
63
- disable: true,
64
- }
65
- },
66
- confirm: {
67
- table: {
68
- disable: true,
69
- }
70
- },
71
- processing: {
72
- table: {
73
- disable: true,
74
- }
75
- },
76
- done: {
77
- table: {
78
- disable: true,
79
- }
80
- },
81
- cancelButtonText: {
82
- table: {
83
- disable: true,
84
- }
85
- },
86
- },
87
- decorators: [
88
- (Story, context) => (
89
- <ThemeWrapper theme={context.globals.theme}>
90
- {Story()}
91
- </ThemeWrapper>
92
- )
93
- ],
94
- } as ComponentMeta<typeof AUAlertComponent>;
95
-
96
- const Template: ComponentStory<typeof AUAlertComponent> = (args) => <AlertWrapper {...args} />;
97
-
98
- export const Alert = Template.bind({});
99
-
100
- Alert.args = {
101
- label: 'Slet',
102
- mode: 'ireversable-action',
103
- header: 'Advarsel',
104
- message: '<p>Den valgte fil vil blive slettet.</p>',
105
- okButtonText: 'Ok, forstået',
106
- onClick: () => console.log('Clicked'),
107
- };
108
-
109
- export const Confirm = Template.bind({});
110
-
111
- Confirm.args = {
112
- confirm: true,
113
- label: 'Slet',
114
- mode: 'ireversable-action',
115
- header: 'Bekræft',
116
- message: '<p>Er du sikker på, at du vil slette den valgte fil?</p>',
117
- okButtonText: 'Ja',
118
- cancelButtonText: 'Annuller',
119
- onClick: () => console.log('Clicked'),
120
- };
1
+ import React, { FC, useState } from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ import AUAlertComponent from '../src/components/AUAlertComponent';
4
+ import { ThemeWrapper } from './lib/helpers';
5
+
6
+ const AlertWrapper: FC<AUAlertComponentProps> = ({
7
+ confirm,
8
+ label,
9
+ mode,
10
+ header,
11
+ message,
12
+ okButtonText,
13
+ cancelButtonText,
14
+ }) => {
15
+ const [processing, setProcessing] = useState<boolean>(false);
16
+ const [done, setDone] = useState<boolean>(false);
17
+
18
+ return (
19
+ <AUAlertComponent
20
+ modalId="alertModal"
21
+ confirm={confirm}
22
+ label={label}
23
+ mode={mode}
24
+ header={header}
25
+ message={message}
26
+ okButtonText={okButtonText}
27
+ cancelButtonText={cancelButtonText}
28
+ processing={processing}
29
+ done={done}
30
+ onClick={() => {
31
+ setDone(false);
32
+ setProcessing(true);
33
+ setTimeout(() => {
34
+ setDone(true);
35
+ setProcessing(false);
36
+ }, 2500);
37
+ }}
38
+ />
39
+ );
40
+ };
41
+
42
+ export default {
43
+ title: 'Delphinus/Alert and Confirm',
44
+ component: AUAlertComponent,
45
+ argTypes: {
46
+ label: {
47
+ table: {
48
+ disable: true,
49
+ }
50
+ },
51
+ mode: {
52
+ table: {
53
+ disable: true,
54
+ }
55
+ },
56
+ onClick: {
57
+ table: {
58
+ disable: true,
59
+ }
60
+ },
61
+ modalId: {
62
+ table: {
63
+ disable: true,
64
+ }
65
+ },
66
+ confirm: {
67
+ table: {
68
+ disable: true,
69
+ }
70
+ },
71
+ processing: {
72
+ table: {
73
+ disable: true,
74
+ }
75
+ },
76
+ done: {
77
+ table: {
78
+ disable: true,
79
+ }
80
+ },
81
+ cancelButtonText: {
82
+ table: {
83
+ disable: true,
84
+ }
85
+ },
86
+ },
87
+ decorators: [
88
+ (Story, context) => (
89
+ <ThemeWrapper theme={context.globals.theme}>
90
+ {Story()}
91
+ </ThemeWrapper>
92
+ )
93
+ ],
94
+ } as ComponentMeta<typeof AUAlertComponent>;
95
+
96
+ const Template: ComponentStory<typeof AUAlertComponent> = (args) => <AlertWrapper {...args} />;
97
+
98
+ export const Alert = Template.bind({});
99
+
100
+ Alert.args = {
101
+ label: 'Slet',
102
+ mode: 'ireversable-action',
103
+ header: 'Advarsel',
104
+ message: '<p>Den valgte fil vil blive slettet.</p>',
105
+ okButtonText: 'Ok, forstået',
106
+ onClick: () => console.log('Clicked'),
107
+ };
108
+
109
+ export const Confirm = Template.bind({});
110
+
111
+ Confirm.args = {
112
+ confirm: true,
113
+ label: 'Slet',
114
+ mode: 'ireversable-action',
115
+ header: 'Bekræft',
116
+ message: '<p>Er du sikker på, at du vil slette den valgte fil?</p>',
117
+ okButtonText: 'Ja',
118
+ cancelButtonText: 'Annuller',
119
+ onClick: () => console.log('Clicked'),
120
+ };
@@ -1,128 +1,128 @@
1
- import React from 'react';
2
- import { ComponentStory, ComponentMeta } from '@storybook/react';
3
- import AUButtonComponent from '../src/components/AUButtonComponent';
4
- import { ThemeWrapper } from './lib/helpers';
5
-
6
- export default {
7
- title: 'Delphinus/Button',
8
- component: AUButtonComponent,
9
- argTypes: {
10
- type: {
11
- control: {
12
- type: 'radio',
13
- },
14
- options: [
15
- 'default',
16
- 'text',
17
- 'dimmed',
18
- ]
19
- },
20
- size: {
21
- control: {
22
- type: 'radio',
23
- },
24
- options: [
25
- 'small',
26
- 'default',
27
- 'large',
28
- ]
29
- },
30
- icon: {
31
- control: {
32
- type: 'select',
33
- },
34
- options: ['add', 'attachment', 'award', 'bike', 'bookmark', 'brand-linkedin', 'brand-mendeley', 'brand-orcid', 'brand-researchgate', 'brand-twitter', 'calendar', 'camera', 'car', 'class', 'close', 'collapse', 'confirm', 'confirm-circle', 'context-menu', 'copy', 'current-semester', 'dark-mode', 'delphinus', 'delete', 'design', 'download', 'edit', 'email', 'exam', 'expand', 'failed', 'failed-circle', 'file', 'filter', 'finish', 'heart', 'hide', 'infinity', 'info', 'info-circle', 'instructor', 'instructor-with-class', 'language', 'location', 'link-chain', 'link-internal', 'link-external', 'link-external-square', 'lms-course-common', 'lms-course-sections', 'lms-course-additional', 'lms-course-merge-with', 'lms-course-merged', 'mailbox', 'menu', 'news', 'next', 'note', 'notifications', 'passed-exemption', 'phone', 'phone-landline', 'previous', 'print', 'public-transport', 'receipt', 'refresh', 'reorder', 'replay', 'route', 'search', 'season-autumn', 'season-christmas', 'season-easter', 'season-halloween', 'season-spring', 'season-summer', 'season-winter', 'send', 'settings', 'source-system', 'student-place-accepted', 'student-place-not-offered', 'student-place-offered', 'student-place-rejected', 'student-place-standby', 'sign-in', 'sign-out', 'spock', 'sync', 'theme-chooser', 'tip', 'tools', 'tooltip', 'upload', 'user-profile', 'user-impersonation', 'view', 'viewport-default', 'viewport-medium', 'viewport-wide', 'walking', 'warning', 'warning-triangle'],
35
- },
36
- iconPosition: {
37
- control: {
38
- type: 'select',
39
- },
40
- options: [
41
- 'left',
42
- 'right',
43
- ],
44
- if: {
45
- arg: 'icon',
46
- }
47
- },
48
- hideLabel: {
49
- control: {
50
- type: 'boolean',
51
- },
52
- if: {
53
- arg: 'icon',
54
- },
55
- },
56
- mode: {
57
- table: {
58
- disable: true,
59
- }
60
- },
61
- },
62
- decorators: [
63
- (Story, context) => (
64
- <ThemeWrapper theme={context.globals.theme}>
65
- {Story()}
66
- </ThemeWrapper>
67
- )
68
- ],
69
- } as ComponentMeta<typeof AUButtonComponent>;
70
-
71
- const Template: ComponentStory<typeof AUButtonComponent> = (args) => <AUButtonComponent {...args} />;
72
-
73
- export const Default = Template.bind({});
74
- Default.args = {
75
- label: 'Button',
76
- type: 'default',
77
- size: 'default',
78
- mode: 'none',
79
- };
80
-
81
- export const With_Icon = Template.bind({});
82
- With_Icon.args = {
83
- label: 'Button',
84
- type: 'default',
85
- size: 'default',
86
- mode: 'none',
87
- icon: 'delphinus',
88
- iconPosition: 'left',
89
- hideLabel: false,
90
- };
91
-
92
- export const Icon_Only = Template.bind({});
93
- Icon_Only.args = {
94
- label: 'Button',
95
- type: 'default',
96
- size: 'default',
97
- mode: 'none',
98
- icon: 'delphinus',
99
- iconPosition: 'left',
100
- hideLabel: true,
101
- };
102
-
103
- export const Irreversible_Action = Template.bind({});
104
- Irreversible_Action.args = {
105
- label: 'Button',
106
- type: 'default',
107
- size: 'default',
108
- mode: 'ireversable-action',
109
- icon: 'delphinus',
110
- };
111
-
112
- export const Confirmable_Action = Template.bind({});
113
- Confirmable_Action.args = {
114
- label: 'Button',
115
- type: 'default',
116
- size: 'default',
117
- mode: 'confirmable-action',
118
- icon: 'delphinus',
119
- };
120
-
121
- export const Processing = Template.bind({});
122
- Processing.args = {
123
- label: 'Button',
124
- type: 'default',
125
- size: 'default',
126
- mode: 'processing',
127
- disabled: true,
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ import AUButtonComponent from '../src/components/AUButtonComponent';
4
+ import { ThemeWrapper } from './lib/helpers';
5
+
6
+ export default {
7
+ title: 'Delphinus/Button',
8
+ component: AUButtonComponent,
9
+ argTypes: {
10
+ type: {
11
+ control: {
12
+ type: 'radio',
13
+ },
14
+ options: [
15
+ 'default',
16
+ 'text',
17
+ 'dimmed',
18
+ ]
19
+ },
20
+ size: {
21
+ control: {
22
+ type: 'radio',
23
+ },
24
+ options: [
25
+ 'small',
26
+ 'default',
27
+ 'large',
28
+ ]
29
+ },
30
+ icon: {
31
+ control: {
32
+ type: 'select',
33
+ },
34
+ options: ['add', 'attachment', 'award', 'bike', 'bookmark', 'brand-linkedin', 'brand-mendeley', 'brand-orcid', 'brand-researchgate', 'brand-twitter', 'calendar', 'camera', 'car', 'class', 'close', 'collapse', 'confirm', 'confirm-circle', 'context-menu', 'copy', 'current-semester', 'dark-mode', 'delphinus', 'delete', 'design', 'download', 'edit', 'email', 'exam', 'expand', 'failed', 'failed-circle', 'file', 'filter', 'finish', 'heart', 'hide', 'infinity', 'info', 'info-circle', 'instructor', 'instructor-with-class', 'language', 'location', 'link-chain', 'link-internal', 'link-external', 'link-external-square', 'lms-course-common', 'lms-course-sections', 'lms-course-additional', 'lms-course-merge-with', 'lms-course-merged', 'mailbox', 'menu', 'news', 'next', 'note', 'notifications', 'passed-exemption', 'phone', 'phone-landline', 'previous', 'print', 'public-transport', 'receipt', 'refresh', 'reorder', 'replay', 'route', 'search', 'season-autumn', 'season-christmas', 'season-easter', 'season-halloween', 'season-spring', 'season-summer', 'season-winter', 'send', 'settings', 'source-system', 'student-place-accepted', 'student-place-not-offered', 'student-place-offered', 'student-place-rejected', 'student-place-standby', 'sign-in', 'sign-out', 'spock', 'sync', 'theme-chooser', 'tip', 'tools', 'tooltip', 'upload', 'user-profile', 'user-impersonation', 'view', 'viewport-default', 'viewport-medium', 'viewport-wide', 'walking', 'warning', 'warning-triangle'],
35
+ },
36
+ iconPosition: {
37
+ control: {
38
+ type: 'select',
39
+ },
40
+ options: [
41
+ 'left',
42
+ 'right',
43
+ ],
44
+ if: {
45
+ arg: 'icon',
46
+ }
47
+ },
48
+ hideLabel: {
49
+ control: {
50
+ type: 'boolean',
51
+ },
52
+ if: {
53
+ arg: 'icon',
54
+ },
55
+ },
56
+ mode: {
57
+ table: {
58
+ disable: true,
59
+ }
60
+ },
61
+ },
62
+ decorators: [
63
+ (Story, context) => (
64
+ <ThemeWrapper theme={context.globals.theme}>
65
+ {Story()}
66
+ </ThemeWrapper>
67
+ )
68
+ ],
69
+ } as ComponentMeta<typeof AUButtonComponent>;
70
+
71
+ const Template: ComponentStory<typeof AUButtonComponent> = (args) => <AUButtonComponent {...args} />;
72
+
73
+ export const Default = Template.bind({});
74
+ Default.args = {
75
+ label: 'Button',
76
+ type: 'default',
77
+ size: 'default',
78
+ mode: 'none',
79
+ };
80
+
81
+ export const With_Icon = Template.bind({});
82
+ With_Icon.args = {
83
+ label: 'Button',
84
+ type: 'default',
85
+ size: 'default',
86
+ mode: 'none',
87
+ icon: 'delphinus',
88
+ iconPosition: 'left',
89
+ hideLabel: false,
90
+ };
91
+
92
+ export const Icon_Only = Template.bind({});
93
+ Icon_Only.args = {
94
+ label: 'Button',
95
+ type: 'default',
96
+ size: 'default',
97
+ mode: 'none',
98
+ icon: 'delphinus',
99
+ iconPosition: 'left',
100
+ hideLabel: true,
101
+ };
102
+
103
+ export const Irreversible_Action = Template.bind({});
104
+ Irreversible_Action.args = {
105
+ label: 'Button',
106
+ type: 'default',
107
+ size: 'default',
108
+ mode: 'ireversable-action',
109
+ icon: 'delphinus',
110
+ };
111
+
112
+ export const Confirmable_Action = Template.bind({});
113
+ Confirmable_Action.args = {
114
+ label: 'Button',
115
+ type: 'default',
116
+ size: 'default',
117
+ mode: 'confirmable-action',
118
+ icon: 'delphinus',
119
+ };
120
+
121
+ export const Processing = Template.bind({});
122
+ Processing.args = {
123
+ label: 'Button',
124
+ type: 'default',
125
+ size: 'default',
126
+ mode: 'processing',
127
+ disabled: true,
128
128
  };
@@ -1,63 +1,63 @@
1
- import React from 'react';
2
- import { ComponentStory, ComponentMeta } from '@storybook/react';
3
- import AUContentToggleComponent from '../src/components/AUContentToggleComponent';
4
- import { ThemeWrapper } from './lib/helpers';
5
-
6
- export default {
7
- title: 'Delphinus/Content Toggle',
8
- component: AUContentToggleComponent,
9
- argTypes: {
10
- toggled: {
11
- table: {
12
- disable: true,
13
- }
14
- },
15
- children: {
16
- table: {
17
- disable: true,
18
- }
19
- },
20
- },
21
- decorators: [
22
- (Story, context) => (
23
- <ThemeWrapper theme={context.globals.theme}>
24
- {Story()}
25
- </ThemeWrapper>
26
- )
27
- ],
28
- } as ComponentMeta<typeof AUContentToggleComponent>;
29
-
30
- const Template: ComponentStory<typeof AUContentToggleComponent> = (args) => <AUContentToggleComponent {...args} />;
31
-
32
- export const Hidden_when_loaded = Template.bind({});
33
- Hidden_when_loaded.args = {
34
- toggled: false,
35
- children: (
36
- <div className="box theme--background-secondary box--constrain-width">
37
- <button className="content-toggle__toggle button button--small" aria-expanded="false">
38
- Very interesting content is hidden
39
- </button>
40
- <div className="content-toggle__content vertical-spacing-top" hidden>
41
- <h4 className="text--label-header text--pull">The content that is toggled</h4>
42
- <p>Collapsible sections are perhaps the most rudimentary of interactive design patterns on the web. All they do is let you toggle the visibility of content by clicking that content's label. Big whoop.</p>
43
- </div>
44
- </div>
45
- ),
46
- };
47
-
48
- export const Shown_when_loaded = Template.bind({});
49
- Shown_when_loaded.args = {
50
- toggled: true,
51
- children: (
52
- <div className="box theme--background-secondary box--constrain-width">
53
- <button className="content-toggle__toggle button button--small" aria-expanded="true">
54
- Very interesting content is hidden
55
- </button>
56
- <div className="content-toggle__content vertical-spacing-top">
57
- <h4 className="text--label-header text--pull">The content that is toggled</h4>
58
- <p>Collapsible sections are perhaps the most rudimentary of interactive design patterns on the web. All they do is let you toggle the visibility of content by clicking that content's label. Big whoop.</p>
59
- </div>
60
- </div>
61
- ),
62
- };
63
-
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ import AUContentToggleComponent from '../src/components/AUContentToggleComponent';
4
+ import { ThemeWrapper } from './lib/helpers';
5
+
6
+ export default {
7
+ title: 'Delphinus/Content Toggle',
8
+ component: AUContentToggleComponent,
9
+ argTypes: {
10
+ toggled: {
11
+ table: {
12
+ disable: true,
13
+ }
14
+ },
15
+ children: {
16
+ table: {
17
+ disable: true,
18
+ }
19
+ },
20
+ },
21
+ decorators: [
22
+ (Story, context) => (
23
+ <ThemeWrapper theme={context.globals.theme}>
24
+ {Story()}
25
+ </ThemeWrapper>
26
+ )
27
+ ],
28
+ } as ComponentMeta<typeof AUContentToggleComponent>;
29
+
30
+ const Template: ComponentStory<typeof AUContentToggleComponent> = (args) => <AUContentToggleComponent {...args} />;
31
+
32
+ export const Hidden_when_loaded = Template.bind({});
33
+ Hidden_when_loaded.args = {
34
+ toggled: false,
35
+ children: (
36
+ <div className="box theme--background-secondary box--constrain-width">
37
+ <button className="content-toggle__toggle button button--small" aria-expanded="false">
38
+ Very interesting content is hidden
39
+ </button>
40
+ <div className="content-toggle__content vertical-spacing-top" hidden>
41
+ <h4 className="text--label-header text--pull">The content that is toggled</h4>
42
+ <p>Collapsible sections are perhaps the most rudimentary of interactive design patterns on the web. All they do is let you toggle the visibility of content by clicking that content's label. Big whoop.</p>
43
+ </div>
44
+ </div>
45
+ ),
46
+ };
47
+
48
+ export const Shown_when_loaded = Template.bind({});
49
+ Shown_when_loaded.args = {
50
+ toggled: true,
51
+ children: (
52
+ <div className="box theme--background-secondary box--constrain-width">
53
+ <button className="content-toggle__toggle button button--small" aria-expanded="true">
54
+ Very interesting content is hidden
55
+ </button>
56
+ <div className="content-toggle__content vertical-spacing-top">
57
+ <h4 className="text--label-header text--pull">The content that is toggled</h4>
58
+ <p>Collapsible sections are perhaps the most rudimentary of interactive design patterns on the web. All they do is let you toggle the visibility of content by clicking that content's label. Big whoop.</p>
59
+ </div>
60
+ </div>
61
+ ),
62
+ };
63
+