forked from alphagov/govuk-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall.js
60 lines (51 loc) · 1.86 KB
/
all.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { nodeListForEach } from './common'
import Button from './components/button/button'
import Details from './components/details/details'
import CharacterCount from './components/character-count/character-count'
import Checkboxes from './components/checkboxes/checkboxes'
import ErrorSummary from './components/error-summary/error-summary'
import Header from './components/header/header'
import Radios from './components/radios/radios'
import Tabs from './components/tabs/tabs'
function initAll () {
// Find all buttons with [role=button] on the document to enhance.
new Button(document).init()
// Find all global details elements to enhance.
var $details = document.querySelectorAll('details')
nodeListForEach($details, function ($detail) {
new Details($detail).init()
})
var $characterCount = document.querySelectorAll('[data-module="character-count"]')
nodeListForEach($characterCount, function ($characterCount) {
new CharacterCount($characterCount).init()
})
var $checkboxes = document.querySelectorAll('[data-module="checkboxes"]')
nodeListForEach($checkboxes, function ($checkbox) {
new Checkboxes($checkbox).init()
})
// Find first error summary module to enhance.
var $errorSummary = document.querySelector('[data-module="error-summary"]')
new ErrorSummary($errorSummary).init()
// Find first header module to enhance.
var $toggleButton = document.querySelector('[data-module="header"]')
new Header($toggleButton).init()
var $radios = document.querySelectorAll('[data-module="radios"]')
nodeListForEach($radios, function ($radio) {
new Radios($radio).init()
})
var $tabs = document.querySelectorAll('[data-module="tabs"]')
nodeListForEach($tabs, function ($tabs) {
new Tabs($tabs).init()
})
}
export {
initAll,
Button,
Details,
CharacterCount,
Checkboxes,
ErrorSummary,
Header,
Radios,
Tabs
}