lbh-frontend 3.6.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +81 -0
- package/README.md +11 -1
- package/dist/{lbh-frontend-3.6.0.min.css → lbh-frontend-3.7.0.min.css} +1437 -817
- package/dist/lbh-frontend-3.7.0.min.js +1 -0
- package/lbh/components/lbh-accordion/accordion.d.ts +35 -0
- package/lbh/components/lbh-back-to-top/back-to-top.d.ts +10 -0
- package/lbh/components/lbh-back-to-top/back-to-top.js +13 -2
- package/lbh/components/lbh-button/button.d.ts +12 -0
- package/lbh/components/lbh-character-count/character-count.d.ts +21 -0
- package/lbh/components/lbh-checkboxes/checkboxes.d.ts +15 -0
- package/lbh/components/lbh-collapsible/collapsible.d.ts +9 -0
- package/lbh/components/lbh-contact-block/contact-block.d.ts +26 -0
- package/lbh/components/lbh-contact-block/contact-block.js +1 -1
- package/lbh/components/lbh-cookie-banner/cookie-banner.d.ts +13 -0
- package/lbh/components/lbh-details/details.d.ts +12 -0
- package/lbh/components/lbh-dialog/_dialog.scss +20 -4
- package/lbh/components/lbh-dialog/index.tsx +32 -25
- package/lbh/components/lbh-error-summary/error-summary.d.ts +13 -0
- package/lbh/components/lbh-header/_header.scss +2 -1
- package/lbh/components/lbh-radios/radios.d.ts +12 -0
- package/lbh/components/lbh-tabs/tabs.d.ts +33 -0
- package/lbh/core/core.test.js +1 -4
- package/lbh/helpers/colour.test.js +10 -10
- package/lbh/helpers/helpers.test.js +1 -3
- package/lbh/helpers/typography.test.js +1 -6
- package/lbh/index.d.ts +27 -246
- package/lbh/objects/objects.test.js +1 -4
- package/lbh/settings/settings.test.js +1 -5
- package/lbh/test/sass-render.cjs +63 -0
- package/lbh/tools/exports.test.js +1 -6
- package/package.json +50 -85
- package/dist/lbh-frontend-3.6.0.min.js +0 -386
- package/dist/lbh-frontend-ie8-3.6.0.min.css +0 -6405
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
@import "../../settings/all";
|
|
2
2
|
|
|
3
3
|
@include lbh-exports("lbh/component/dialog") {
|
|
4
|
-
.lbh-
|
|
5
|
-
position:
|
|
6
|
-
|
|
4
|
+
.lbh-dialog__overlay {
|
|
5
|
+
position: fixed;
|
|
6
|
+
inset: 0;
|
|
7
|
+
z-index: 1000;
|
|
8
|
+
background: rgba(lbh-colour("lbh-text"), 0.5);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.lbh-dialog.lbh-dialog--radix {
|
|
12
|
+
position: fixed;
|
|
13
|
+
left: 50%;
|
|
14
|
+
top: 7vh;
|
|
15
|
+
z-index: 1001;
|
|
7
16
|
width: 90%;
|
|
8
17
|
max-width: 500px;
|
|
9
|
-
margin:
|
|
18
|
+
margin: 0;
|
|
19
|
+
transform: translateX(-50%);
|
|
20
|
+
max-height: calc(100vh - 14vh);
|
|
21
|
+
overflow-y: auto;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
padding: govuk-spacing(4);
|
|
24
|
+
background: lbh-colour("lbh-white");
|
|
25
|
+
border: 4px solid lbh-colour("lbh-text");
|
|
10
26
|
|
|
11
27
|
&__title {
|
|
12
28
|
margin-top: 0;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from "react"
|
|
2
|
-
import
|
|
3
|
-
import "@reach/dialog/styles.css"
|
|
2
|
+
import * as RadixDialog from "@radix-ui/react-dialog"
|
|
4
3
|
|
|
5
4
|
interface Props {
|
|
6
5
|
isOpen: boolean
|
|
7
6
|
onDismiss: () => void
|
|
8
|
-
children: React.
|
|
7
|
+
children: React.ReactNode
|
|
9
8
|
title: string
|
|
10
9
|
}
|
|
11
10
|
|
|
@@ -16,30 +15,38 @@ const Dialog = ({
|
|
|
16
15
|
title,
|
|
17
16
|
...props
|
|
18
17
|
}: Props): React.ReactElement => (
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
{...props}
|
|
18
|
+
<RadixDialog.Root
|
|
19
|
+
open={isOpen}
|
|
20
|
+
onOpenChange={(open) => {
|
|
21
|
+
if (!open) onDismiss()
|
|
22
|
+
}}
|
|
25
23
|
>
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
<RadixDialog.Portal>
|
|
25
|
+
<RadixDialog.Overlay className="lbh-dialog__overlay" />
|
|
26
|
+
<RadixDialog.Content className="lbh-dialog lbh-dialog--radix" {...props}>
|
|
27
|
+
<RadixDialog.Title asChild>
|
|
28
|
+
<h2 className="lbh-heading-h2 lbh-dialog__title">{title}</h2>
|
|
29
|
+
</RadixDialog.Title>
|
|
30
|
+
{children}
|
|
31
|
+
<RadixDialog.Close asChild>
|
|
32
|
+
<button type="button" className="lbh-dialog__close">
|
|
33
|
+
<span className="govuk-visually-hidden">Close</span>
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
<svg width="18" height="18" viewBox="0 0 13 13" fill="none">
|
|
36
|
+
<path
|
|
37
|
+
d="M-0.0501709 1.36379L1.36404 -0.050415L12.6778 11.2633L11.2635 12.6775L-0.0501709 1.36379Z"
|
|
38
|
+
fill="#0B0C0C"
|
|
39
|
+
/>
|
|
40
|
+
<path
|
|
41
|
+
d="M11.2635 -0.050293L12.6778 1.36392L1.36404 12.6776L-0.0501709 11.2634L11.2635 -0.050293Z"
|
|
42
|
+
fill="#0B0C0C"
|
|
43
|
+
/>
|
|
44
|
+
</svg>
|
|
45
|
+
</button>
|
|
46
|
+
</RadixDialog.Close>
|
|
47
|
+
</RadixDialog.Content>
|
|
48
|
+
</RadixDialog.Portal>
|
|
49
|
+
</RadixDialog.Root>
|
|
43
50
|
)
|
|
44
51
|
|
|
45
52
|
export default Dialog
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class ErrorSummary {
|
|
2
|
+
$module: HTMLElement;
|
|
3
|
+
|
|
4
|
+
constructor($module: HTMLElement);
|
|
5
|
+
|
|
6
|
+
init(): void;
|
|
7
|
+
handleClick(event: MouseEvent): void;
|
|
8
|
+
focusTarget($target: HTMLElement): boolean;
|
|
9
|
+
getFragmentFromUrl(url: string): string | false;
|
|
10
|
+
getAssociatedLegendOrLabel($input: HTMLElement): HTMLElement | null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default ErrorSummary;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
position: relative;
|
|
4
4
|
z-index: lbh-depth-index("header");
|
|
5
5
|
margin-top: 0;
|
|
6
|
-
@include lbh-rem(padding-bottom,
|
|
6
|
+
@include lbh-rem(padding-bottom, 16);
|
|
7
7
|
border-bottom: 2px solid lbh-colour("lbh-a03");
|
|
8
8
|
background: lbh-colour("lbh-white");
|
|
9
9
|
|
|
@@ -140,6 +140,7 @@
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
&__logo-text {
|
|
143
|
+
color: lbh-colour("lbh-white");
|
|
143
144
|
@include govuk-visually-hidden;
|
|
144
145
|
}
|
|
145
146
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class Radios {
|
|
2
|
+
$module: HTMLElement;
|
|
3
|
+
$inputs: NodeListOf<HTMLInputElement>;
|
|
4
|
+
constructor($module: HTMLElement);
|
|
5
|
+
|
|
6
|
+
init(): void;
|
|
7
|
+
syncAllConditionalReveals(): void;
|
|
8
|
+
syncConditionalRevealWithInputState(): void;
|
|
9
|
+
handleClick(event: MouseEvent): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default Radios;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
class Tabs {
|
|
2
|
+
$module: HTMLElement;
|
|
3
|
+
$tabs: NodeListOf<HTMLElement>;
|
|
4
|
+
keys: { left: number; right: number; up: number; down: number };
|
|
5
|
+
jsHiddenClass: string;
|
|
6
|
+
|
|
7
|
+
constructor($module: HTMLElement);
|
|
8
|
+
|
|
9
|
+
init(): void;
|
|
10
|
+
setupResponsiveChecks(): void;
|
|
11
|
+
checkMode(): void;
|
|
12
|
+
setup(): void;
|
|
13
|
+
teardown(): void;
|
|
14
|
+
onHashChange(event: HashChangeEvent): void;
|
|
15
|
+
hideTab($tab: HTMLElement): void;
|
|
16
|
+
showTab($tab: HTMLElement): void;
|
|
17
|
+
getTab(hash: string): HTMLElement | null;
|
|
18
|
+
setAttributes($tab: HTMLElement): void;
|
|
19
|
+
unsetAttributes($tab: HTMLElement): void;
|
|
20
|
+
onTabClick(event: MouseEvent): void;
|
|
21
|
+
createHistoryEntry($tab: HTMLElement): void;
|
|
22
|
+
onTabKeydown(event: KeyboardEvent): void;
|
|
23
|
+
activateNextTab(): void;
|
|
24
|
+
activatePreviousTab(): void;
|
|
25
|
+
getPanel($tab: HTMLElement): HTMLElement | null;
|
|
26
|
+
showPanel($tab: HTMLElement): void;
|
|
27
|
+
hidePanel($tab: HTMLElement): void;
|
|
28
|
+
unhighlightTab($tab: HTMLElement): void;
|
|
29
|
+
getCurrentTab(): HTMLElement | null;
|
|
30
|
+
getHref($tab: HTMLElement): string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default Tabs;
|
package/lbh/core/core.test.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
const sass = require("node-sass");
|
|
3
|
-
|
|
4
|
-
const sassRender = util.promisify(sass.render);
|
|
1
|
+
const sassRender = require("../test/sass-render.cjs");
|
|
5
2
|
|
|
6
3
|
describe("The core layer", () => {
|
|
7
4
|
it("renders to CSS without errors", async () => {
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const util = require("util");
|
|
4
|
-
|
|
5
|
-
const sass = require("node-sass");
|
|
6
|
-
const sassRender = util.promisify(sass.render);
|
|
1
|
+
const sassRender = require("../test/sass-render.cjs");
|
|
7
2
|
|
|
8
3
|
const sassConfig = {
|
|
9
4
|
includePaths: ["lbh/"],
|
|
@@ -29,19 +24,24 @@ describe("@function lbh-colour", () => {
|
|
|
29
24
|
|
|
30
25
|
const results = await sassRender({ data: sass, ...sassConfig });
|
|
31
26
|
|
|
32
|
-
expect(results.css.toString().trim()).toBe(
|
|
27
|
+
expect(results.css.toString().trim()).toBe(
|
|
28
|
+
".foo {\n color: #ff0000;\n}"
|
|
29
|
+
);
|
|
33
30
|
});
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
// Dart Sass treats `red` as a colour value, not the string "red" like node-sass.
|
|
33
|
+
it("works with a string colour name", async () => {
|
|
36
34
|
const sass = `
|
|
37
35
|
${sassBootstrap}
|
|
38
36
|
.foo {
|
|
39
|
-
color: lbh-colour(red);
|
|
37
|
+
color: lbh-colour("red");
|
|
40
38
|
}`;
|
|
41
39
|
|
|
42
40
|
const results = await sassRender({ data: sass, ...sassConfig });
|
|
43
41
|
|
|
44
|
-
expect(results.css.toString().trim()).toBe(
|
|
42
|
+
expect(results.css.toString().trim()).toBe(
|
|
43
|
+
".foo {\n color: #ff0000;\n}"
|
|
44
|
+
);
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
it("throws an error if a non-existent colour is requested", async () => {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
const path = require("path");
|
|
2
|
-
const util = require("util");
|
|
3
2
|
|
|
4
|
-
const
|
|
5
|
-
const sassRender = util.promisify(sass.render);
|
|
3
|
+
const sassRender = require("../test/sass-render.cjs");
|
|
6
4
|
|
|
7
5
|
describe("The helpers layer", () => {
|
|
8
6
|
it("should not output any CSS", async () => {
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
/* eslint-env jest */
|
|
2
|
-
|
|
3
|
-
const util = require("util");
|
|
4
|
-
|
|
5
1
|
// const configPaths = require("../../config/paths.json");
|
|
6
2
|
|
|
7
3
|
const outdent = require("outdent");
|
|
8
|
-
const
|
|
9
|
-
const sassRender = util.promisify(sass.render);
|
|
4
|
+
const sassRender = require("../test/sass-render.cjs");
|
|
10
5
|
|
|
11
6
|
const sassConfig = {
|
|
12
7
|
includePaths: ["lbh/"],
|
package/lbh/index.d.ts
CHANGED
|
@@ -1,249 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
openAllClass: string;
|
|
14
|
-
iconClass: string;
|
|
15
|
-
|
|
16
|
-
sectionHeaderClass: string;
|
|
17
|
-
sectionHeaderFocusedClass: string;
|
|
18
|
-
sectionHeadingClass: string;
|
|
19
|
-
sectionSummaryClass: string;
|
|
20
|
-
sectionButtonClass: string;
|
|
21
|
-
sectionExpandedClass: string;
|
|
22
|
-
|
|
23
|
-
constructor($module: HTMLElement);
|
|
24
|
-
|
|
25
|
-
init(): void;
|
|
26
|
-
initControls(): void;
|
|
27
|
-
initSectionHeaders(): void;
|
|
28
|
-
initHeaderAttributes($headerWrapper: HTMLElement, index: number): void;
|
|
29
|
-
onSectionToggle($section: HTMLElement): void;
|
|
30
|
-
onOpenOrCloseAllToggle(): void;
|
|
31
|
-
setExpanded(expanded: boolean, $section: HTMLElement | null): void;
|
|
32
|
-
isExpanded(section: HTMLElement | null): boolean;
|
|
33
|
-
checkIfAllSectionsOpen(): boolean;
|
|
34
|
-
updateOpenAllButton(expanded: boolean): void;
|
|
35
|
-
storeState($section: HTMLElement): void;
|
|
36
|
-
setInitialState($section: HTMLElement): void;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface BackToTop {
|
|
40
|
-
new ($module: HTMLElement): BackToTop;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export class BackToTop {
|
|
44
|
-
$module: HTMLElement;
|
|
45
|
-
|
|
46
|
-
constructor($module: HTMLElement);
|
|
47
|
-
|
|
48
|
-
init(): void;
|
|
49
|
-
checkScrollPosition($element: HTMLElement): void;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface Button {
|
|
53
|
-
new ($module: HTMLElement): Button;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export class Button {
|
|
57
|
-
$module: HTMLElement;
|
|
58
|
-
debounceFormSubmitTimer: number | null;
|
|
59
|
-
|
|
60
|
-
constructor($module: HTMLElement);
|
|
61
|
-
|
|
62
|
-
handleKeyDown(event: KeyboardEvent): void;
|
|
63
|
-
debounce(event: MouseEvent): void | false;
|
|
64
|
-
init(): void;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface CharacterCount {
|
|
68
|
-
new ($module: HTMLElement): CharacterCount;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export class CharacterCount {
|
|
72
|
-
$module: HTMLElement;
|
|
73
|
-
$textarea: HTMLElement | null;
|
|
74
|
-
$countMessage: HTMLElement | null;
|
|
75
|
-
|
|
76
|
-
valueChecker: number | null;
|
|
77
|
-
|
|
78
|
-
constructor($module: HTMLElement);
|
|
79
|
-
|
|
80
|
-
init(): void;
|
|
81
|
-
sync(): void;
|
|
82
|
-
getDataset(): Record<string, string>;
|
|
83
|
-
count(text: string): number;
|
|
84
|
-
bindChangeEvents(): void;
|
|
85
|
-
checkIfValueChanged(): void;
|
|
86
|
-
updateCountMessage(): void;
|
|
87
|
-
handleFocus(): void;
|
|
88
|
-
handleBlur(): void;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface Checkboxes {
|
|
92
|
-
new ($module: HTMLElement): Checkboxes;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export class Checkboxes {
|
|
96
|
-
$module: HTMLElement;
|
|
97
|
-
$inputs: NodeListOf<HTMLInputElement>;
|
|
98
|
-
|
|
99
|
-
constructor($module: HTMLElement);
|
|
100
|
-
|
|
101
|
-
init(): void;
|
|
102
|
-
syncAllConditionalReveals(): void;
|
|
103
|
-
syncConditionalRevealWithInputState($input: HTMLInputElement): void;
|
|
104
|
-
unCheckAllInputsExcept($input: HTMLInputElement): void;
|
|
105
|
-
unCheckExclusiveInputs($input: HTMLInputElement): void;
|
|
106
|
-
handleClick(event: MouseEvent): void;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export interface Collapsible {
|
|
110
|
-
new ($module: HTMLElement): Collapsible;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export class Collapsible {
|
|
114
|
-
$module: HTMLElement;
|
|
115
|
-
|
|
116
|
-
constructor($module: HTMLElement);
|
|
117
|
-
|
|
118
|
-
init(): void;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface CookieBanner {
|
|
122
|
-
new ($module: HTMLElement): CookieBanner;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export class CookieBanner {
|
|
126
|
-
$module: HTMLElement;
|
|
127
|
-
$button: HTMLElement | null;
|
|
128
|
-
|
|
129
|
-
constructor($module: HTMLElement);
|
|
130
|
-
|
|
131
|
-
init(): void;
|
|
132
|
-
checkCookies(): string | null;
|
|
133
|
-
showCookieBanner(): void;
|
|
134
|
-
bindAcceptButton(): void;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export interface Details {
|
|
138
|
-
new ($module: HTMLElement): Details;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export class Details {
|
|
142
|
-
$module: HTMLElement;
|
|
143
|
-
|
|
144
|
-
constructor($module: HTMLElement);
|
|
145
|
-
|
|
146
|
-
init(): void;
|
|
147
|
-
polyfillDetails(): void;
|
|
148
|
-
polyfillSetAttributes(): true;
|
|
149
|
-
polyfillHandleInputs(node: HTMLElement, callback: Function): void;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface ErrorSummary {
|
|
153
|
-
new ($module: HTMLElement): ErrorSummary;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export class ErrorSummary {
|
|
157
|
-
$module: HTMLElement;
|
|
158
|
-
|
|
159
|
-
constructor($module: HTMLElement);
|
|
160
|
-
|
|
161
|
-
init(): void;
|
|
162
|
-
handleClick(event: MouseEvent): void;
|
|
163
|
-
focusTarget($target: HTMLElement): boolean;
|
|
164
|
-
getFragmentFromUrl(url: string): string | false;
|
|
165
|
-
getAssociatedLegendOrLabel($input: HTMLElement): HTMLElement | null;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export interface Map {
|
|
169
|
-
new ($module: HTMLElement): Map;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export class Map {
|
|
173
|
-
$module: HTMLElement;
|
|
174
|
-
moduleId: string;
|
|
175
|
-
accessToken: string;
|
|
176
|
-
markerLat: number | null;
|
|
177
|
-
markerLng: number | null;
|
|
178
|
-
centreLat: number;
|
|
179
|
-
centreLng: number;
|
|
180
|
-
maxZoom: number;
|
|
181
|
-
minZoom: number;
|
|
182
|
-
initialZoom: number;
|
|
183
|
-
showZoomControl: boolean;
|
|
184
|
-
minLat: number;
|
|
185
|
-
maxLat: number;
|
|
186
|
-
maxLng: number;
|
|
187
|
-
|
|
188
|
-
constructor($module: HTMLElement);
|
|
189
|
-
|
|
190
|
-
init(): void;
|
|
191
|
-
initLeaflet(): void;
|
|
192
|
-
setBounds(): void;
|
|
193
|
-
initMapboxTiles(): void;
|
|
194
|
-
addMarker(): void;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export interface Radios {
|
|
198
|
-
new ($module: HTMLElement): Radios;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export class Radios {
|
|
202
|
-
$module: HTMLElement;
|
|
203
|
-
$inputs: NodeListOf<HTMLInputElement>;
|
|
204
|
-
constructor($module: HTMLElement);
|
|
205
|
-
|
|
206
|
-
init(): void;
|
|
207
|
-
syncAllConditionalReveals(): void;
|
|
208
|
-
syncConditionalRevealWithInputState(): void;
|
|
209
|
-
handleClick(event: MouseEvent): void;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export interface Tabs {
|
|
213
|
-
new ($module: HTMLElement): Tabs;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export class Tabs {
|
|
217
|
-
$module: HTMLElement;
|
|
218
|
-
$tabs: NodeListOf<HTMLElement>;
|
|
219
|
-
keys: { left: number; right: number; up: number; down: number };
|
|
220
|
-
jsHiddenClass: string;
|
|
221
|
-
|
|
222
|
-
constructor($module: HTMLElement);
|
|
223
|
-
|
|
224
|
-
init(): void;
|
|
225
|
-
setupResponsiveChecks(): void;
|
|
226
|
-
checkMode(): void;
|
|
227
|
-
setup(): void;
|
|
228
|
-
teardown(): void;
|
|
229
|
-
onHashChange(event: HashChangeEvent): void;
|
|
230
|
-
hideTab($tab: HTMLElement): void;
|
|
231
|
-
showTab($tab: HTMLElement): void;
|
|
232
|
-
getTab(hash: string): HTMLElement | null;
|
|
233
|
-
setAttributes($tab: HTMLElement): void;
|
|
234
|
-
unsetAttributes($tab: HTMLElement): void;
|
|
235
|
-
onTabClick(event: MouseEvent): void;
|
|
236
|
-
createHistoryEntry($tab: HTMLElement): void;
|
|
237
|
-
onTabKeydown(event: KeyboardEvent): void;
|
|
238
|
-
activateNextTab(): void;
|
|
239
|
-
activatePreviousTab(): void;
|
|
240
|
-
getPanel($tab: HTMLElement): HTMLElement | null;
|
|
241
|
-
showPanel($tab: HTMLElement): void;
|
|
242
|
-
hidePanel($tab: HTMLElement): void;
|
|
243
|
-
unhighlightTab($tab: HTMLElement): void;
|
|
244
|
-
getCurrentTab(): HTMLElement | null;
|
|
245
|
-
getHref($tab: HTMLElement): string;
|
|
246
|
-
}
|
|
1
|
+
import { default as Accordion } from "./components/lbh-accordion/accordion";
|
|
2
|
+
import { default as BackToTop } from "./components/lbh-back-to-top/back-to-top";
|
|
3
|
+
import { default as Button } from "./components/lbh-button/button";
|
|
4
|
+
import { default as CharacterCount } from "./components/lbh-character-count/character-count";
|
|
5
|
+
import { default as Checkboxes } from "./components/lbh-checkboxes/checkboxes";
|
|
6
|
+
import { default as Collapsible } from "./components/lbh-collapsible/collapsible";
|
|
7
|
+
import { default as CookieBanner } from "./components/lbh-cookie-banner/cookie-banner";
|
|
8
|
+
import { default as Details } from "./components/lbh-details/details";
|
|
9
|
+
import { default as ErrorSummary } from "./components/lbh-error-summary/error-summary";
|
|
10
|
+
import { default as Map } from "./components/lbh-contact-block/contact-block";
|
|
11
|
+
import { default as Radios } from "./components/lbh-radios/radios";
|
|
12
|
+
import { default as Tabs } from "./components/lbh-tabs/tabs";
|
|
247
13
|
|
|
248
14
|
export interface InitOptions {
|
|
249
15
|
scope?: HTMLElement | Document;
|
|
@@ -251,6 +17,21 @@ export interface InitOptions {
|
|
|
251
17
|
|
|
252
18
|
export function initAll(options?: InitOptions): void;
|
|
253
19
|
|
|
20
|
+
export {
|
|
21
|
+
Accordion,
|
|
22
|
+
BackToTop,
|
|
23
|
+
Button,
|
|
24
|
+
CharacterCount,
|
|
25
|
+
Checkboxes,
|
|
26
|
+
Collapsible,
|
|
27
|
+
CookieBanner,
|
|
28
|
+
Details,
|
|
29
|
+
ErrorSummary,
|
|
30
|
+
Map,
|
|
31
|
+
Radios,
|
|
32
|
+
Tabs,
|
|
33
|
+
};
|
|
34
|
+
|
|
254
35
|
declare global {
|
|
255
36
|
interface Window {
|
|
256
37
|
LBHFrontend: {
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
const sass = require("node-sass");
|
|
3
|
-
|
|
4
|
-
const sassRender = util.promisify(sass.render);
|
|
1
|
+
const sassRender = require("../test/sass-render.cjs");
|
|
5
2
|
|
|
6
3
|
describe("The objects layer", () => {
|
|
7
4
|
it("renders to CSS without errors", async () => {
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
/* eslint-env jest */
|
|
2
|
-
|
|
3
1
|
const path = require("path");
|
|
4
|
-
const util = require("util");
|
|
5
2
|
|
|
6
|
-
const
|
|
7
|
-
const sassRender = util.promisify(sass.render);
|
|
3
|
+
const sassRender = require("../test/sass-render.cjs");
|
|
8
4
|
|
|
9
5
|
describe("The settings layer", () => {
|
|
10
6
|
it("should not output any CSS", async () => {
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const { execFileSync } = require("child_process");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const PROJECT_ROOT = path.dirname(require.resolve("../../package.json"));
|
|
5
|
+
|
|
6
|
+
const OUTPUT_STYLE_MAP = {
|
|
7
|
+
nested: "expanded",
|
|
8
|
+
compact: "expanded",
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
function resolveFromRoot (filePath) {
|
|
12
|
+
return path.isAbsolute(filePath)
|
|
13
|
+
? filePath
|
|
14
|
+
: path.join(PROJECT_ROOT, filePath);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const SASS_CLI = path.join(PROJECT_ROOT, "node_modules/sass/sass.js");
|
|
18
|
+
|
|
19
|
+
function renderWithCli ({ input, includePaths, outputStyle }) {
|
|
20
|
+
const style = OUTPUT_STYLE_MAP[outputStyle] || outputStyle || "expanded";
|
|
21
|
+
const args = [
|
|
22
|
+
"--stdin",
|
|
23
|
+
`--style=${style}`,
|
|
24
|
+
"--no-source-map",
|
|
25
|
+
...includePaths.flatMap((dir) => [`--load-path=${dir}`]),
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const css = execFileSync(process.execPath, [SASS_CLI, ...args], {
|
|
29
|
+
cwd: PROJECT_ROOT,
|
|
30
|
+
input,
|
|
31
|
+
encoding: "utf8",
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return { css: Buffer.from(css) };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function sassRender (options) {
|
|
38
|
+
const file = options.file && resolveFromRoot(options.file);
|
|
39
|
+
const includePaths = [PROJECT_ROOT];
|
|
40
|
+
if (options.includePaths) {
|
|
41
|
+
includePaths.push(...options.includePaths.map(resolveFromRoot));
|
|
42
|
+
}
|
|
43
|
+
if (file) {
|
|
44
|
+
includePaths.push(path.dirname(file));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
const input = file ? fs.readFileSync(file, "utf8") : options.data;
|
|
49
|
+
const result = renderWithCli({
|
|
50
|
+
input,
|
|
51
|
+
includePaths,
|
|
52
|
+
outputStyle: options.outputStyle,
|
|
53
|
+
});
|
|
54
|
+
return Promise.resolve({ css: result.css });
|
|
55
|
+
} catch (err) {
|
|
56
|
+
if (err.stdout) {
|
|
57
|
+
err.message = err.stderr?.toString() || err.message;
|
|
58
|
+
}
|
|
59
|
+
return Promise.reject(err);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
module.exports = sassRender;
|