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