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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/.eslintrc.js +35 -35
  2. package/.storybook/main.js +34 -34
  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/AUDynamicContentComponent.test.tsx +386 -386
  7. package/__tests__/jest/AUErrorComponent.test.tsx +142 -142
  8. package/__tests__/jest/AUModalComponent.test.tsx +186 -186
  9. package/__tests__/jest/AUNotificationComponent.test.tsx +115 -115
  10. package/__tests__/jest/AUSpinnerComponent.test.tsx +57 -57
  11. package/__tests__/jest/AUToolbarComponent.test.tsx +46 -46
  12. package/__tests__/jest/context.test.ts +25 -25
  13. package/__tests__/jest/helpers.test.ts +15 -15
  14. package/__tests__/jest/setupTests.ts +2 -2
  15. package/babel.config.js +8 -8
  16. package/build/umd/all.css +2 -2
  17. package/build/umd/all.js +1 -1
  18. package/build/umd/alphabox.js +1 -1
  19. package/build/umd/databox.js +1 -1
  20. package/build/umd/diagramme.js +1 -1
  21. package/build/umd/flowbox.js +1 -1
  22. package/build/umd/flowbox.js.map +1 -1
  23. package/build/umd/universe.js +1 -1
  24. package/build-storybook.log +386 -386
  25. package/esbuild.mjs +22 -22
  26. package/package.json +107 -107
  27. package/src/components/AUAlertComponent.tsx +128 -128
  28. package/src/components/AUAutoSuggestComponent.js +148 -148
  29. package/src/components/AUButtonComponent.tsx +99 -99
  30. package/src/components/AUCalendarComponent.tsx +497 -497
  31. package/src/components/AUCharacterCountComponent.tsx +56 -56
  32. package/src/components/AUComboBoxComponent.tsx +195 -195
  33. package/src/components/AUContentToggleComponent.tsx +50 -50
  34. package/src/components/AUDatepickerComponent.tsx +124 -124
  35. package/src/components/AUDialogModalComponent.tsx +124 -124
  36. package/src/components/AUDynamicContentComponent.tsx +137 -137
  37. package/src/components/AUEditorComponent.tsx +126 -126
  38. package/src/components/AUErrorComponent.tsx +73 -73
  39. package/src/components/AUMobilePrefixComponent.tsx +20 -20
  40. package/src/components/AUModalComponent.tsx +72 -72
  41. package/src/components/AUNotificationComponent.tsx +44 -44
  42. package/src/components/AUReceiptComponent.tsx +34 -34
  43. package/src/components/AUSpinnerComponent.tsx +40 -40
  44. package/src/components/AUStepComponent.tsx +75 -75
  45. package/src/components/AUSubNavComponent.tsx +57 -57
  46. package/src/components/AUSubmitButtonContainerComponent.tsx +38 -38
  47. package/src/components/AUTabbedContentComponent.tsx +154 -154
  48. package/src/components/AUTableComponent.tsx +29 -29
  49. package/src/components/AUToastComponent.tsx +104 -104
  50. package/src/components/AUToolbarComponent.tsx +108 -108
  51. package/src/components/AUTruncatorComponent.tsx +141 -141
  52. package/src/components/wrapping/AUEmbedComponent.js +47 -47
  53. package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +142 -142
  54. package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
  55. package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
  56. package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
  57. package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
  58. package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
  59. package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
  60. package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
  61. package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
  62. package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
  63. package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
  64. package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
  65. package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
  66. package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
  67. package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
  68. package/src/layout-2016/lib/all.js +3 -3
  69. package/src/layout-2016/lib/au-alphabox.js +99 -99
  70. package/src/layout-2016/lib/au-databox.js +399 -399
  71. package/src/layout-2016/lib/au-diagramme.js +85 -85
  72. package/src/layout-2016/lib/au-flowbox.js +116 -119
  73. package/src/lib/context.tsx +59 -59
  74. package/src/lib/dates.ts +52 -52
  75. package/src/lib/helpers.ts +208 -208
  76. package/src/lib/hooks.ts +157 -157
  77. package/src/lib/i18n.ts +600 -600
  78. package/src/lib/portals.tsx +150 -150
  79. package/src/lib/tinymce.ts +84 -84
  80. package/src/lib/wrapping.ts +21 -21
  81. package/src/styles/_settings.scss +10 -10
  82. package/src/styles/alphabox.scss +222 -222
  83. package/src/styles/app.scss +7 -7
  84. package/src/styles/autosuggest.scss +57 -57
  85. package/src/styles/databox.scss +563 -563
  86. package/src/styles/diagramme.scss +119 -119
  87. package/src/styles/flowbox.scss +72 -72
  88. package/src/styles/maps.scss +395 -395
  89. package/stories/AUAlertComponent.stories.tsx +133 -133
  90. package/stories/AUAutoSuggestComponent.stories.tsx +95 -95
  91. package/stories/AUButtonComponent.stories.tsx +139 -139
  92. package/stories/AUCharacterCountComponent.stories.tsx +121 -121
  93. package/stories/AUComboBoxComponent.stories.tsx +101 -101
  94. package/stories/AUContentToggleComponent.stories.tsx +87 -87
  95. package/stories/AUDialogModalComponent.stories.tsx +75 -75
  96. package/stories/AUDynamicContentComponent.stories.tsx +119 -119
  97. package/stories/AUEditorComponent.stories.tsx +66 -66
  98. package/stories/AUErrorComponent.stories.tsx +132 -132
  99. package/stories/AUModalComponent.stories.tsx +160 -160
  100. package/stories/AUNotificationComponent.stories.tsx +151 -151
  101. package/stories/AUSpinnerComponent.stories.tsx +44 -44
  102. package/stories/AUStepComponent.stories.tsx +91 -91
  103. package/stories/AUToolbarComponent.stories.tsx +389 -389
  104. package/stories/AUTruncatorComponent.stories.tsx +123 -123
  105. package/stories/lib/helpers.tsx +146 -146
  106. package/tsconfig.json +46 -46
  107. package/webpack.config.js +88 -88
  108. package/.claude/settings.local.json +0 -12
  109. package/.vscode/settings.json +0 -22
@@ -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
+ };