@aarhus-university/au-lib-react-components 12.5.1 → 12.6.1

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 (115) hide show
  1. package/.claude/settings.local.json +12 -0
  2. package/.eslintrc.js +35 -35
  3. package/.storybook/main.js +34 -34
  4. package/.storybook/preview.js +17 -17
  5. package/.vscode/settings.json +22 -0
  6. package/README.md +19 -19
  7. package/__tests__/jest/AUButtonComponent.test.tsx +165 -165
  8. package/__tests__/jest/AUDynamicContentComponent.test.tsx +386 -0
  9. package/__tests__/jest/AUErrorComponent.test.tsx +142 -142
  10. package/__tests__/jest/AUModalComponent.test.tsx +186 -186
  11. package/__tests__/jest/AUNotificationComponent.test.tsx +115 -115
  12. package/__tests__/jest/AUSpinnerComponent.test.tsx +57 -57
  13. package/__tests__/jest/AUToolbarComponent.test.tsx +46 -46
  14. package/__tests__/jest/context.test.ts +25 -25
  15. package/__tests__/jest/helpers.test.ts +15 -15
  16. package/__tests__/jest/setupTests.ts +2 -2
  17. package/babel.config.js +8 -8
  18. package/build/umd/all.css +3 -2
  19. package/build/umd/all.css.map +1 -7
  20. package/build/umd/all.js +2 -45
  21. package/build/umd/all.js.map +1 -7
  22. package/build/umd/alphabox.js +2 -45
  23. package/build/umd/alphabox.js.map +1 -7
  24. package/build/umd/databox.js +2 -45
  25. package/build/umd/databox.js.map +1 -7
  26. package/build/umd/diagramme.js +2 -44
  27. package/build/umd/diagramme.js.map +1 -7
  28. package/build/umd/flowbox.js +2 -44
  29. package/build/umd/flowbox.js.map +1 -7
  30. package/build/umd/universe.js +1 -1
  31. package/build-storybook.log +386 -386
  32. package/esbuild.mjs +22 -22
  33. package/package.json +107 -105
  34. package/src/components/AUAlertComponent.tsx +128 -128
  35. package/src/components/AUAutoSuggestComponent.js +148 -148
  36. package/src/components/AUButtonComponent.tsx +99 -97
  37. package/src/components/AUCalendarComponent.tsx +497 -497
  38. package/src/components/AUCharacterCountComponent.tsx +56 -56
  39. package/src/components/AUComboBoxComponent.tsx +195 -195
  40. package/src/components/AUContentToggleComponent.tsx +50 -50
  41. package/src/components/AUDatepickerComponent.tsx +124 -124
  42. package/src/components/AUDialogModalComponent.tsx +124 -124
  43. package/src/components/AUDynamicContentComponent.tsx +137 -0
  44. package/src/components/AUEditorComponent.tsx +126 -117
  45. package/src/components/AUErrorComponent.tsx +73 -73
  46. package/src/components/AUMobilePrefixComponent.tsx +20 -20
  47. package/src/components/AUModalComponent.tsx +72 -72
  48. package/src/components/AUNotificationComponent.tsx +44 -44
  49. package/src/components/AUReceiptComponent.tsx +34 -34
  50. package/src/components/AUSpinnerComponent.tsx +40 -40
  51. package/src/components/AUStepComponent.tsx +75 -75
  52. package/src/components/AUSubNavComponent.tsx +57 -57
  53. package/src/components/AUSubmitButtonContainerComponent.tsx +38 -38
  54. package/src/components/AUTabbedContentComponent.tsx +154 -154
  55. package/src/components/AUTableComponent.tsx +29 -29
  56. package/src/components/AUToastComponent.tsx +104 -104
  57. package/src/components/AUToolbarComponent.tsx +108 -108
  58. package/src/components/AUTruncatorComponent.tsx +141 -141
  59. package/src/components/wrapping/AUEmbedComponent.js +47 -47
  60. package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +142 -143
  61. package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
  62. package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
  63. package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
  64. package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
  65. package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
  66. package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
  67. package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
  68. package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
  69. package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
  70. package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
  71. package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
  72. package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
  73. package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
  74. package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
  75. package/src/layout-2016/lib/all.js +3 -3
  76. package/src/layout-2016/lib/au-alphabox.js +99 -100
  77. package/src/layout-2016/lib/au-databox.js +399 -400
  78. package/src/layout-2016/lib/au-diagramme.js +85 -85
  79. package/src/layout-2016/lib/au-flowbox.js +119 -93
  80. package/src/lib/context.tsx +59 -59
  81. package/src/lib/dates.ts +52 -52
  82. package/src/lib/helpers.ts +208 -208
  83. package/src/lib/hooks.ts +157 -157
  84. package/src/lib/i18n.ts +600 -600
  85. package/src/lib/portals.tsx +150 -150
  86. package/src/lib/tinymce.ts +84 -84
  87. package/src/lib/wrapping.ts +21 -21
  88. package/src/styles/_settings.scss +10 -10
  89. package/src/styles/alphabox.scss +222 -222
  90. package/src/styles/app.scss +7 -7
  91. package/src/styles/autosuggest.scss +57 -57
  92. package/src/styles/databox.scss +563 -563
  93. package/src/styles/diagramme.scss +119 -119
  94. package/src/styles/flowbox.scss +72 -72
  95. package/src/styles/maps.scss +395 -395
  96. package/stories/AUAlertComponent.stories.tsx +133 -133
  97. package/stories/AUAutoSuggestComponent.stories.tsx +95 -95
  98. package/stories/AUButtonComponent.stories.tsx +139 -139
  99. package/stories/AUCharacterCountComponent.stories.tsx +121 -121
  100. package/stories/AUComboBoxComponent.stories.tsx +101 -101
  101. package/stories/AUContentToggleComponent.stories.tsx +87 -87
  102. package/stories/AUDialogModalComponent.stories.tsx +75 -75
  103. package/stories/AUDynamicContentComponent.stories.tsx +119 -0
  104. package/stories/AUEditorComponent.stories.tsx +66 -66
  105. package/stories/AUErrorComponent.stories.tsx +132 -132
  106. package/stories/AUModalComponent.stories.tsx +160 -160
  107. package/stories/AUNotificationComponent.stories.tsx +151 -151
  108. package/stories/AUSpinnerComponent.stories.tsx +44 -44
  109. package/stories/AUStepComponent.stories.tsx +91 -91
  110. package/stories/AUToolbarComponent.stories.tsx +389 -389
  111. package/stories/AUTruncatorComponent.stories.tsx +123 -123
  112. package/stories/lib/helpers.tsx +146 -146
  113. package/tsconfig.json +46 -46
  114. package/webpack.config.js +88 -88
  115. package/src/lib/tracking.ts +0 -69
@@ -1,389 +1,389 @@
1
- import React from 'react';
2
- import { StoryObj, Meta } from '@storybook/react';
3
- import { closeAllContentTogglesInToolbar, contentToggleEdgeHandling, findToolbar, lockBodyScroll, unlockBodyScroll } from '@aarhus-university/au-designsystem-delphinus/source/js/components/toolbar';
4
- import AUToolbarComponent from '../src/components/AUToolbarComponent';
5
- import AUButtonComponent from '../src/components/AUButtonComponent';
6
- import AUContentToggleComponent from '../src/components/AUContentToggleComponent';
7
- import { ThemeWrapper } from './lib/helpers';
8
- import { isElementWithClassNameInEventPath } from '@aarhus-university/au-designsystem-delphinus/source/js/components/helpers';
9
-
10
- export default {
11
- title: 'Delphinus/Toolbar',
12
- component: AUToolbarComponent,
13
- argTypes: {
14
- lang: {
15
- table: {
16
- disable: true,
17
- }
18
- },
19
- elements: {
20
- table: {
21
- disable: true,
22
- }
23
- },
24
- onCloseContentToggles: {
25
- table: {
26
- disable: true,
27
- }
28
- },
29
- buttonElements: {
30
- table: {
31
- disable: true,
32
- }
33
- },
34
- buttonClass: {
35
- table: {
36
- disable: true,
37
- }
38
- },
39
- title: {
40
- table: {
41
- disable: true,
42
- }
43
- },
44
- center: {
45
- table: {
46
- disable: true,
47
- }
48
- },
49
- noCollapse: {
50
- table: {
51
- disable: true,
52
- }
53
- },
54
- },
55
- decorators: [
56
- (Story, context) => (
57
- <ThemeWrapper theme={context.globals.theme}>
58
- {Story()}
59
- </ThemeWrapper>
60
- )
61
- ],
62
- } as Meta<typeof AUToolbarComponent>;
63
-
64
- type Story = StoryObj<typeof AUToolbarComponent>;
65
-
66
- export const Form_Field_and_Buttons_and_Link: Story = {
67
- args: {
68
- lang: 'da',
69
- elements: [
70
- <form className="form">
71
- <div className="form__inline-submit">
72
- <div className="form__field form__field--inline-label">
73
- <label htmlFor="demo-search">Search</label>
74
- <input type="search" autoComplete="off" autoCorrect="off" autoCapitalize="off" id="demo-search" />
75
- </div>
76
- <input className="form__inline-submit__button" type="submit" value="Submit" />
77
- </div>
78
- </form>,
79
- <AUButtonComponent icon="confirm-circle" label="Mark as read" />,
80
- <AUButtonComponent icon="delete" hideLabel label="Delete" />,
81
- <AUButtonComponent type="text" label="Select all" />,
82
- <div className="toolbar__split" />,
83
- <div className="toolbar__text-item">
84
- <a className="a--text-link" href="#">Open in new tab</a>
85
- </div>,
86
- ],
87
- },
88
- render: (args) => (
89
- <>
90
- <AUToolbarComponent {...args} />
91
- <div className="box theme--background-secondary">
92
- <p>Content goes here...</p>
93
- </div>
94
- </>
95
- ),
96
- };
97
-
98
- export const Many_Actions: Story = {
99
- args: {
100
- lang: 'da',
101
- elements: Array(25).fill(null).map((_, i) => <AUButtonComponent label={`Action ${i + 1}`} />),
102
- },
103
- render: (args) => (
104
- <>
105
- <AUToolbarComponent {...args} />
106
- <div className="box theme--background-secondary">
107
- <p>Content goes here...</p>
108
- </div>
109
- </>
110
- ),
111
- };
112
-
113
- export const Groupings: Story = {
114
- args: {
115
- lang: 'da',
116
- elements: [
117
- <div className="toolbar__group">
118
- <div className="form__field form__field--horizontal">
119
- <label htmlFor="demo-all">All issues</label>
120
- <input type="radio" name="demo" value="all" id="demo-all" defaultChecked />
121
- </div>
122
- <div className="form__field form__field--horizontal">
123
- <label htmlFor="demo-open">Open</label>
124
- <input type="radio" name="demo" value="all" id="demo-open" />
125
- </div>
126
- <div className="form__field form__field--horizontal">
127
- <label htmlFor="demo-resolved">Resolved</label>
128
- <input type="radio" name="demo" value="all" id="demo-resolved" />
129
- </div>
130
- </div>,
131
- <div className="toolbar__split" />,
132
- <div className="toolbar__group">
133
- <div className="form__field form__field--horizontal">
134
- <label htmlFor="demo-epics">Epics</label>
135
- <input type="checkbox" id="demo-epics" defaultChecked />
136
- </div>
137
- <div className="form__field form__field--horizontal">
138
- <label htmlFor="demo-stories">Stories</label>
139
- <input type="checkbox" id="demo-stories" defaultChecked />
140
- </div>
141
- <div className="form__field form__field--horizontal">
142
- <label htmlFor="demo-tasks">Tasks</label>
143
- <input type="checkbox" id="demo-tasks" defaultChecked />
144
- </div>
145
- </div>,
146
- ],
147
- },
148
- render: (args) => (
149
- <>
150
- <AUToolbarComponent {...args} />
151
- <div className="box theme--background-secondary">
152
- <p>Content goes here...</p>
153
- </div>
154
- </>
155
- ),
156
- };
157
-
158
- export const Filter: Story = {
159
- args: {
160
- lang: 'da',
161
- elements: [
162
- <AUContentToggleComponent
163
- toggled={false}
164
- onClick={(popout: HTMLElement) => {
165
- contentToggleEdgeHandling(popout);
166
- lockBodyScroll();
167
- }}
168
- beforeCallback={(content: HTMLElement) => closeAllContentTogglesInToolbar(findToolbar(content))}
169
- afterCallback={(content: HTMLElement, button: HTMLButtonElement) => {
170
- const ariaExpanded = button.getAttribute('aria-expanded');
171
- const toolbar = findToolbar(content);
172
- if (ariaExpanded === 'true') {
173
- toolbar?.classList.add('toolbar--has-popout');
174
- } else {
175
- toolbar?.classList.remove('toolbar--has-popout');
176
- }
177
-
178
- content.addEventListener('click', (event: MouseEvent) => {
179
- if ((event.target as HTMLElement).classList.contains('toolbar__popout')
180
- && !isElementWithClassNameInEventPath(event as MouseEvent, 'toolbar__filter__content')) {
181
- closeAllContentTogglesInToolbar(toolbar);
182
- unlockBodyScroll();
183
- }
184
- });
185
- }}
186
- >
187
- <div className="toolbar__filter">
188
- <button
189
- type="button"
190
- className="toolbar__filter__toggle content-toggle__toggle"
191
- aria-expanded={false}
192
- aria-label="Filter 1"
193
- >
194
- Filter 1
195
- </button>
196
- <div
197
- className="toolbar__popout content-toggle__content"
198
- hidden
199
- >
200
- <div className="toolbar__filter__content toolbar__popout__content theme--normal">
201
- <h3 className="toolbar__filter__content__title">
202
- Vælg Filter 1
203
- </h3>
204
-
205
- <form className="form toolbar__filter__content__search">
206
- <div className="form__inline-submit">
207
- <div className="form__field form__field--inline-label">
208
- <label htmlFor="search-filter-1">
209
- Søg
210
- </label>
211
- <input
212
- type="search"
213
- id="search-filter-1"
214
- />
215
- </div>
216
- <input className="form__inline-submit__button" type="submit" value="Søg" />
217
- </div>
218
- </form>
219
- <form
220
- className="toolbar__filter__content__options-and-actions"
221
- onSubmit={(event) => {
222
- event.preventDefault();
223
- unlockBodyScroll();
224
- }}
225
- >
226
- <div
227
- className="toolbar__filter__content__options"
228
- >
229
- <div className="toolbar__filter__content__options__scroll-container">
230
- <fieldset className="selection-list">
231
- <legend>
232
- 5 valgmuligheder
233
- </legend>
234
- <div className="selection-list__option">
235
- <input type="checkbox" id="option-1" />
236
- <label htmlFor="option-1">Valgmulighed 1</label>
237
- </div>
238
- <div className="selection-list__option">
239
- <input type="checkbox" id="option-2" />
240
- <label htmlFor="option-2">Valgmulighed 2</label>
241
- </div>
242
- <div className="selection-list__option">
243
- <input type="checkbox" id="option-3" />
244
- <label htmlFor="option-3">Valgmulighed 3</label>
245
- </div>
246
- <div className="selection-list__option">
247
- <input type="checkbox" id="option-4" />
248
- <label htmlFor="option-4">Valgmulighed 4</label>
249
- </div>
250
- <div className="selection-list__option">
251
- <input type="checkbox" id="option-5" />
252
- <label htmlFor="option-5">Valgmulighed 5</label>
253
- </div>
254
- </fieldset>
255
- </div>
256
- </div>
257
- <div className="toolbar__filter__content__actions">
258
- <div className="button-container">
259
- <input type="submit" className="content-toggle__close button button--small" value="Gem" />
260
- </div>
261
- </div>
262
- </form>
263
- </div>
264
- <button
265
- type="button"
266
- className="toolbar__popout__close content-toggle__close button button--icon button--icon--hide-label icon-close"
267
- onClick={() => unlockBodyScroll()}
268
- >
269
- Luk
270
- </button>
271
- </div>
272
- </div>
273
- </AUContentToggleComponent>,
274
- <AUContentToggleComponent
275
- toggled={false}
276
- onClick={(popout: HTMLElement) => {
277
- contentToggleEdgeHandling(popout);
278
- lockBodyScroll();
279
- }}
280
- beforeCallback={(content: HTMLElement) => closeAllContentTogglesInToolbar(findToolbar(content))}
281
- afterCallback={(content: HTMLElement, button: HTMLButtonElement) => {
282
- const ariaExpanded = button.getAttribute('aria-expanded');
283
- const toolbar = findToolbar(content);
284
- if (ariaExpanded === 'true') {
285
- toolbar?.classList.add('toolbar--has-popout');
286
- } else {
287
- toolbar?.classList.remove('toolbar--has-popout');
288
- }
289
-
290
- content.addEventListener('click', (event: MouseEvent) => {
291
- if ((event.target as HTMLElement).classList.contains('toolbar__popout')
292
- && !isElementWithClassNameInEventPath(event as MouseEvent, 'toolbar__filter__content')) {
293
- closeAllContentTogglesInToolbar(toolbar);
294
- unlockBodyScroll();
295
- }
296
- });
297
- }}
298
- >
299
- <div className="toolbar__filter">
300
- <button
301
- type="button"
302
- className="toolbar__filter__toggle content-toggle__toggle"
303
- aria-expanded={false}
304
- aria-label="Filter 1"
305
- >
306
- Filter 2
307
- </button>
308
- <div
309
- className="toolbar__popout content-toggle__content"
310
- hidden
311
- >
312
- <div className="toolbar__filter__content toolbar__popout__content theme--normal">
313
- <h3 className="toolbar__filter__content__title">
314
- Vælg Filter 2
315
- </h3>
316
-
317
- <form className="form toolbar__filter__content__search">
318
- <div className="form__inline-submit">
319
- <div className="form__field form__field--inline-label">
320
- <label htmlFor="search-filter-2">
321
- Søg
322
- </label>
323
- <input
324
- type="search"
325
- id="search-filter-2"
326
- />
327
- </div>
328
- <input className="form__inline-submit__button" type="submit" value="Søg" />
329
- </div>
330
- </form>
331
- <form
332
- className="toolbar__filter__content__options-and-actions"
333
- onSubmit={(event) => {
334
- event.preventDefault();
335
- unlockBodyScroll();
336
- }}
337
- >
338
- <div
339
- className="toolbar__filter__content__options"
340
- >
341
- <div className="toolbar__filter__content__options__scroll-container">
342
- <fieldset className="selection-list">
343
- <legend>
344
- 3 valgmuligheder
345
- </legend>
346
- <div className="selection-list__option">
347
- <input type="checkbox" id="option-10" />
348
- <label htmlFor="option-10">Valgmulighed 1</label>
349
- </div>
350
- <div className="selection-list__option">
351
- <input type="checkbox" id="option-20" />
352
- <label htmlFor="option-20">Valgmulighed 2</label>
353
- </div>
354
- <div className="selection-list__option">
355
- <input type="checkbox" id="option-30" />
356
- <label htmlFor="option-30">Valgmulighed 3</label>
357
- </div>
358
- </fieldset>
359
- </div>
360
- </div>
361
- <div className="toolbar__filter__content__actions">
362
- <div className="button-container">
363
- <input type="submit" className="content-toggle__close button button--small" value="Gem" />
364
- </div>
365
- </div>
366
- </form>
367
- </div>
368
- <button
369
- type="button"
370
- className="toolbar__popout__close content-toggle__close button button--icon button--icon--hide-label icon-close"
371
- onClick={() => unlockBodyScroll()}
372
- >
373
- Luk
374
- </button>
375
- </div>
376
- </div>
377
- </AUContentToggleComponent>
378
- ],
379
- onCloseContentToggles: () => console.log('luuuuuk?'),
380
- },
381
- render: (args) => (
382
- <>
383
- <AUToolbarComponent {...args} />
384
- <div className="box theme--background-secondary">
385
- <p>Content goes here...</p>
386
- </div>
387
- </>
388
- ),
389
- };
1
+ import React from 'react';
2
+ import { StoryObj, Meta } from '@storybook/react';
3
+ import { closeAllContentTogglesInToolbar, contentToggleEdgeHandling, findToolbar, lockBodyScroll, unlockBodyScroll } from '@aarhus-university/au-designsystem-delphinus/source/js/components/toolbar';
4
+ import AUToolbarComponent from '../src/components/AUToolbarComponent';
5
+ import AUButtonComponent from '../src/components/AUButtonComponent';
6
+ import AUContentToggleComponent from '../src/components/AUContentToggleComponent';
7
+ import { ThemeWrapper } from './lib/helpers';
8
+ import { isElementWithClassNameInEventPath } from '@aarhus-university/au-designsystem-delphinus/source/js/components/helpers';
9
+
10
+ export default {
11
+ title: 'Delphinus/Toolbar',
12
+ component: AUToolbarComponent,
13
+ argTypes: {
14
+ lang: {
15
+ table: {
16
+ disable: true,
17
+ }
18
+ },
19
+ elements: {
20
+ table: {
21
+ disable: true,
22
+ }
23
+ },
24
+ onCloseContentToggles: {
25
+ table: {
26
+ disable: true,
27
+ }
28
+ },
29
+ buttonElements: {
30
+ table: {
31
+ disable: true,
32
+ }
33
+ },
34
+ buttonClass: {
35
+ table: {
36
+ disable: true,
37
+ }
38
+ },
39
+ title: {
40
+ table: {
41
+ disable: true,
42
+ }
43
+ },
44
+ center: {
45
+ table: {
46
+ disable: true,
47
+ }
48
+ },
49
+ noCollapse: {
50
+ table: {
51
+ disable: true,
52
+ }
53
+ },
54
+ },
55
+ decorators: [
56
+ (Story, context) => (
57
+ <ThemeWrapper theme={context.globals.theme}>
58
+ {Story()}
59
+ </ThemeWrapper>
60
+ )
61
+ ],
62
+ } as Meta<typeof AUToolbarComponent>;
63
+
64
+ type Story = StoryObj<typeof AUToolbarComponent>;
65
+
66
+ export const Form_Field_and_Buttons_and_Link: Story = {
67
+ args: {
68
+ lang: 'da',
69
+ elements: [
70
+ <form className="form">
71
+ <div className="form__inline-submit">
72
+ <div className="form__field form__field--inline-label">
73
+ <label htmlFor="demo-search">Search</label>
74
+ <input type="search" autoComplete="off" autoCorrect="off" autoCapitalize="off" id="demo-search" />
75
+ </div>
76
+ <input className="form__inline-submit__button" type="submit" value="Submit" />
77
+ </div>
78
+ </form>,
79
+ <AUButtonComponent icon="confirm-circle" label="Mark as read" />,
80
+ <AUButtonComponent icon="delete" hideLabel label="Delete" />,
81
+ <AUButtonComponent type="text" label="Select all" />,
82
+ <div className="toolbar__split" />,
83
+ <div className="toolbar__text-item">
84
+ <a className="a--text-link" href="#">Open in new tab</a>
85
+ </div>,
86
+ ],
87
+ },
88
+ render: (args) => (
89
+ <>
90
+ <AUToolbarComponent {...args} />
91
+ <div className="box theme--background-secondary">
92
+ <p>Content goes here...</p>
93
+ </div>
94
+ </>
95
+ ),
96
+ };
97
+
98
+ export const Many_Actions: Story = {
99
+ args: {
100
+ lang: 'da',
101
+ elements: Array(25).fill(null).map((_, i) => <AUButtonComponent label={`Action ${i + 1}`} />),
102
+ },
103
+ render: (args) => (
104
+ <>
105
+ <AUToolbarComponent {...args} />
106
+ <div className="box theme--background-secondary">
107
+ <p>Content goes here...</p>
108
+ </div>
109
+ </>
110
+ ),
111
+ };
112
+
113
+ export const Groupings: Story = {
114
+ args: {
115
+ lang: 'da',
116
+ elements: [
117
+ <div className="toolbar__group">
118
+ <div className="form__field form__field--horizontal">
119
+ <label htmlFor="demo-all">All issues</label>
120
+ <input type="radio" name="demo" value="all" id="demo-all" defaultChecked />
121
+ </div>
122
+ <div className="form__field form__field--horizontal">
123
+ <label htmlFor="demo-open">Open</label>
124
+ <input type="radio" name="demo" value="all" id="demo-open" />
125
+ </div>
126
+ <div className="form__field form__field--horizontal">
127
+ <label htmlFor="demo-resolved">Resolved</label>
128
+ <input type="radio" name="demo" value="all" id="demo-resolved" />
129
+ </div>
130
+ </div>,
131
+ <div className="toolbar__split" />,
132
+ <div className="toolbar__group">
133
+ <div className="form__field form__field--horizontal">
134
+ <label htmlFor="demo-epics">Epics</label>
135
+ <input type="checkbox" id="demo-epics" defaultChecked />
136
+ </div>
137
+ <div className="form__field form__field--horizontal">
138
+ <label htmlFor="demo-stories">Stories</label>
139
+ <input type="checkbox" id="demo-stories" defaultChecked />
140
+ </div>
141
+ <div className="form__field form__field--horizontal">
142
+ <label htmlFor="demo-tasks">Tasks</label>
143
+ <input type="checkbox" id="demo-tasks" defaultChecked />
144
+ </div>
145
+ </div>,
146
+ ],
147
+ },
148
+ render: (args) => (
149
+ <>
150
+ <AUToolbarComponent {...args} />
151
+ <div className="box theme--background-secondary">
152
+ <p>Content goes here...</p>
153
+ </div>
154
+ </>
155
+ ),
156
+ };
157
+
158
+ export const Filter: Story = {
159
+ args: {
160
+ lang: 'da',
161
+ elements: [
162
+ <AUContentToggleComponent
163
+ toggled={false}
164
+ onClick={(popout: HTMLElement) => {
165
+ contentToggleEdgeHandling(popout);
166
+ lockBodyScroll();
167
+ }}
168
+ beforeCallback={(content: HTMLElement) => closeAllContentTogglesInToolbar(findToolbar(content))}
169
+ afterCallback={(content: HTMLElement, button: HTMLButtonElement) => {
170
+ const ariaExpanded = button.getAttribute('aria-expanded');
171
+ const toolbar = findToolbar(content);
172
+ if (ariaExpanded === 'true') {
173
+ toolbar?.classList.add('toolbar--has-popout');
174
+ } else {
175
+ toolbar?.classList.remove('toolbar--has-popout');
176
+ }
177
+
178
+ content.addEventListener('click', (event: MouseEvent) => {
179
+ if ((event.target as HTMLElement).classList.contains('toolbar__popout')
180
+ && !isElementWithClassNameInEventPath(event as MouseEvent, 'toolbar__filter__content')) {
181
+ closeAllContentTogglesInToolbar(toolbar);
182
+ unlockBodyScroll();
183
+ }
184
+ });
185
+ }}
186
+ >
187
+ <div className="toolbar__filter">
188
+ <button
189
+ type="button"
190
+ className="toolbar__filter__toggle content-toggle__toggle"
191
+ aria-expanded={false}
192
+ aria-label="Filter 1"
193
+ >
194
+ Filter 1
195
+ </button>
196
+ <div
197
+ className="toolbar__popout content-toggle__content"
198
+ hidden
199
+ >
200
+ <div className="toolbar__filter__content toolbar__popout__content theme--normal">
201
+ <h3 className="toolbar__filter__content__title">
202
+ Vælg Filter 1
203
+ </h3>
204
+
205
+ <form className="form toolbar__filter__content__search">
206
+ <div className="form__inline-submit">
207
+ <div className="form__field form__field--inline-label">
208
+ <label htmlFor="search-filter-1">
209
+ Søg
210
+ </label>
211
+ <input
212
+ type="search"
213
+ id="search-filter-1"
214
+ />
215
+ </div>
216
+ <input className="form__inline-submit__button" type="submit" value="Søg" />
217
+ </div>
218
+ </form>
219
+ <form
220
+ className="toolbar__filter__content__options-and-actions"
221
+ onSubmit={(event) => {
222
+ event.preventDefault();
223
+ unlockBodyScroll();
224
+ }}
225
+ >
226
+ <div
227
+ className="toolbar__filter__content__options"
228
+ >
229
+ <div className="toolbar__filter__content__options__scroll-container">
230
+ <fieldset className="selection-list">
231
+ <legend>
232
+ 5 valgmuligheder
233
+ </legend>
234
+ <div className="selection-list__option">
235
+ <input type="checkbox" id="option-1" />
236
+ <label htmlFor="option-1">Valgmulighed 1</label>
237
+ </div>
238
+ <div className="selection-list__option">
239
+ <input type="checkbox" id="option-2" />
240
+ <label htmlFor="option-2">Valgmulighed 2</label>
241
+ </div>
242
+ <div className="selection-list__option">
243
+ <input type="checkbox" id="option-3" />
244
+ <label htmlFor="option-3">Valgmulighed 3</label>
245
+ </div>
246
+ <div className="selection-list__option">
247
+ <input type="checkbox" id="option-4" />
248
+ <label htmlFor="option-4">Valgmulighed 4</label>
249
+ </div>
250
+ <div className="selection-list__option">
251
+ <input type="checkbox" id="option-5" />
252
+ <label htmlFor="option-5">Valgmulighed 5</label>
253
+ </div>
254
+ </fieldset>
255
+ </div>
256
+ </div>
257
+ <div className="toolbar__filter__content__actions">
258
+ <div className="button-container">
259
+ <input type="submit" className="content-toggle__close button button--small" value="Gem" />
260
+ </div>
261
+ </div>
262
+ </form>
263
+ </div>
264
+ <button
265
+ type="button"
266
+ className="toolbar__popout__close content-toggle__close button button--icon button--icon--hide-label icon-close"
267
+ onClick={() => unlockBodyScroll()}
268
+ >
269
+ Luk
270
+ </button>
271
+ </div>
272
+ </div>
273
+ </AUContentToggleComponent>,
274
+ <AUContentToggleComponent
275
+ toggled={false}
276
+ onClick={(popout: HTMLElement) => {
277
+ contentToggleEdgeHandling(popout);
278
+ lockBodyScroll();
279
+ }}
280
+ beforeCallback={(content: HTMLElement) => closeAllContentTogglesInToolbar(findToolbar(content))}
281
+ afterCallback={(content: HTMLElement, button: HTMLButtonElement) => {
282
+ const ariaExpanded = button.getAttribute('aria-expanded');
283
+ const toolbar = findToolbar(content);
284
+ if (ariaExpanded === 'true') {
285
+ toolbar?.classList.add('toolbar--has-popout');
286
+ } else {
287
+ toolbar?.classList.remove('toolbar--has-popout');
288
+ }
289
+
290
+ content.addEventListener('click', (event: MouseEvent) => {
291
+ if ((event.target as HTMLElement).classList.contains('toolbar__popout')
292
+ && !isElementWithClassNameInEventPath(event as MouseEvent, 'toolbar__filter__content')) {
293
+ closeAllContentTogglesInToolbar(toolbar);
294
+ unlockBodyScroll();
295
+ }
296
+ });
297
+ }}
298
+ >
299
+ <div className="toolbar__filter">
300
+ <button
301
+ type="button"
302
+ className="toolbar__filter__toggle content-toggle__toggle"
303
+ aria-expanded={false}
304
+ aria-label="Filter 1"
305
+ >
306
+ Filter 2
307
+ </button>
308
+ <div
309
+ className="toolbar__popout content-toggle__content"
310
+ hidden
311
+ >
312
+ <div className="toolbar__filter__content toolbar__popout__content theme--normal">
313
+ <h3 className="toolbar__filter__content__title">
314
+ Vælg Filter 2
315
+ </h3>
316
+
317
+ <form className="form toolbar__filter__content__search">
318
+ <div className="form__inline-submit">
319
+ <div className="form__field form__field--inline-label">
320
+ <label htmlFor="search-filter-2">
321
+ Søg
322
+ </label>
323
+ <input
324
+ type="search"
325
+ id="search-filter-2"
326
+ />
327
+ </div>
328
+ <input className="form__inline-submit__button" type="submit" value="Søg" />
329
+ </div>
330
+ </form>
331
+ <form
332
+ className="toolbar__filter__content__options-and-actions"
333
+ onSubmit={(event) => {
334
+ event.preventDefault();
335
+ unlockBodyScroll();
336
+ }}
337
+ >
338
+ <div
339
+ className="toolbar__filter__content__options"
340
+ >
341
+ <div className="toolbar__filter__content__options__scroll-container">
342
+ <fieldset className="selection-list">
343
+ <legend>
344
+ 3 valgmuligheder
345
+ </legend>
346
+ <div className="selection-list__option">
347
+ <input type="checkbox" id="option-10" />
348
+ <label htmlFor="option-10">Valgmulighed 1</label>
349
+ </div>
350
+ <div className="selection-list__option">
351
+ <input type="checkbox" id="option-20" />
352
+ <label htmlFor="option-20">Valgmulighed 2</label>
353
+ </div>
354
+ <div className="selection-list__option">
355
+ <input type="checkbox" id="option-30" />
356
+ <label htmlFor="option-30">Valgmulighed 3</label>
357
+ </div>
358
+ </fieldset>
359
+ </div>
360
+ </div>
361
+ <div className="toolbar__filter__content__actions">
362
+ <div className="button-container">
363
+ <input type="submit" className="content-toggle__close button button--small" value="Gem" />
364
+ </div>
365
+ </div>
366
+ </form>
367
+ </div>
368
+ <button
369
+ type="button"
370
+ className="toolbar__popout__close content-toggle__close button button--icon button--icon--hide-label icon-close"
371
+ onClick={() => unlockBodyScroll()}
372
+ >
373
+ Luk
374
+ </button>
375
+ </div>
376
+ </div>
377
+ </AUContentToggleComponent>
378
+ ],
379
+ onCloseContentToggles: () => console.log('luuuuuk?'),
380
+ },
381
+ render: (args) => (
382
+ <>
383
+ <AUToolbarComponent {...args} />
384
+ <div className="box theme--background-secondary">
385
+ <p>Content goes here...</p>
386
+ </div>
387
+ </>
388
+ ),
389
+ };