@qld-gov-au/qgds-bootstrap5 2.0.4 → 2.0.5
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/.esbuild/helpers/scssOverrideTheme.js +40 -0
- package/.esbuild/plugins/qgds-plugin-handlebar-partial-builder.js +4 -0
- package/.storybook/dynamicThemeDecorator.js +155 -0
- package/.storybook/main.js +6 -0
- package/.storybook/preview.js +20 -1
- package/README.md +26 -18
- package/dist/README.md +26 -18
- package/dist/assets/components/bs5/head/head.hbs +1 -1
- package/dist/assets/css/qld.bootstrap.css +1 -1
- package/dist/assets/css/qld.bootstrap.css.map +3 -3
- package/dist/assets/js/handlebars.init.min.js +1 -1
- package/dist/assets/node/handlebars.init.min.js +1 -1
- package/dist/components/bs5/head/head.hbs +1 -1
- package/dist/package.json +6 -2
- package/esbuild.js +34 -9
- package/package.json +6 -2
- package/src/components/bs5/card/card--icon-list-footer.stories.js +171 -0
- package/src/components/bs5/card/card.scss +15 -0
- package/src/components/bs5/header/header.scss +8 -0
- package/src/components/bs5/pageLayout/pageLayout.stories.js +2 -2
- package/src/components/bs5/searchInput/searchInput.test.js +21 -5
- package/src/css/main.masterbrand.scss +137 -0
- package/src/css/qld-tokens.scss +95 -0
- package/src/css/qld-variables.scss +10 -3
- package/src/css/readme.md +6 -1
- package/src/css/themes/masterbrand.scss +109 -0
|
@@ -825,7 +825,7 @@
|
|
|
825
825
|
</section>
|
|
826
826
|
{{/each }}
|
|
827
827
|
</div>`;var R=`
|
|
828
|
-
<!-- VERSION_DETAILS={"project_id":"@qld-gov-au/qgds-bootstrap5","version":"2.0.
|
|
828
|
+
<!-- VERSION_DETAILS={"project_id":"@qld-gov-au/qgds-bootstrap5","version":"2.0.5","branch":"HEAD","tag":"v2.0.5","commit":"7972857bf46e8fa3db8ca361447711262fffc21e","majorVersion":"v2"} -->
|
|
829
829
|
|
|
830
830
|
{{! Select environment, used verbatium if not using predefind key
|
|
831
831
|
cdn := PROD|STAGING|BETA|TEST|DEV|???
|
|
@@ -808,7 +808,7 @@ var head_default;
|
|
|
808
808
|
var init_head = __esm({
|
|
809
809
|
"src/components/bs5/head/head.hbs?raw"() {
|
|
810
810
|
head_default = `
|
|
811
|
-
<!-- VERSION_DETAILS={"project_id":"@qld-gov-au/qgds-bootstrap5","version":"2.0.
|
|
811
|
+
<!-- VERSION_DETAILS={"project_id":"@qld-gov-au/qgds-bootstrap5","version":"2.0.5","branch":"HEAD","tag":"v2.0.5","commit":"7972857bf46e8fa3db8ca361447711262fffc21e","majorVersion":"v2"} -->
|
|
812
812
|
|
|
813
813
|
{{! Select environment, used verbatium if not using predefind key
|
|
814
814
|
cdn := PROD|STAGING|BETA|TEST|DEV|???
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
<!-- VERSION_DETAILS={"project_id":"@qld-gov-au/qgds-bootstrap5","version":"2.0.
|
|
2
|
+
<!-- VERSION_DETAILS={"project_id":"@qld-gov-au/qgds-bootstrap5","version":"2.0.5","branch":"HEAD","tag":"v2.0.5","commit":"7972857bf46e8fa3db8ca361447711262fffc21e","majorVersion":"v2"} -->
|
|
3
3
|
|
|
4
4
|
{{! Select environment, used verbatium if not using predefind key
|
|
5
5
|
cdn := PROD|STAGING|BETA|TEST|DEV|???
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qld-gov-au/qgds-bootstrap5",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"prepare": "npm run build",
|
|
12
12
|
"start": "npm run build",
|
|
13
|
-
"lint": "eslint --fix --ext .js,.json --ignore-pattern 'docs/*' --ignore-pattern 'dist/*' --ignore-pattern 'storybook-static/*' .",
|
|
13
|
+
"lint": "eslint --fix --ext .js,.json --ignore-pattern 'docs/*' --ignore-pattern 'dist/*' --ignore-pattern 'storybook-static/*' --ignore-pattern 'src/js/handlebars.partials.js' .",
|
|
14
14
|
"build": "node esbuild.js",
|
|
15
15
|
"build:icons": "node esbuild.js --icons",
|
|
16
|
+
"build:theme": "node esbuild.js --theme",
|
|
17
|
+
"build:theme:icons": "node esbuild.js --theme --icons",
|
|
16
18
|
"test": "vitest",
|
|
17
19
|
"test:ui": "vitest --ui",
|
|
18
20
|
"test:integration": "npm-run-all --parallel --race serve:test test:testrunner",
|
|
@@ -22,7 +24,9 @@
|
|
|
22
24
|
"serve:test": "http-server dist -p 8081 --silent",
|
|
23
25
|
"dev-storybook": "npm-run-all --parallel watch storybook",
|
|
24
26
|
"storybook": "storybook dev -p 6006",
|
|
27
|
+
"storybook:themes": "ENABLE_DYNAMIC_THEME=true storybook dev -p 6006",
|
|
25
28
|
"build-storybook": "storybook build --webpack-stats-json ",
|
|
29
|
+
"build-storybook:themes": "ENABLE_DYNAMIC_THEME=true storybook build --webpack-stats-json ",
|
|
26
30
|
"build-storybook:serve": "http-server storybook-static -p 8080"
|
|
27
31
|
},
|
|
28
32
|
"keywords": [],
|
package/esbuild.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* global process */
|
|
2
2
|
// ESBUILD PROJECT DEPENDENCIES
|
|
3
3
|
import * as esbuild from "esbuild";
|
|
4
|
+
import path from "path";
|
|
4
5
|
|
|
5
6
|
//Local ESBUILD PLUGINS
|
|
6
7
|
import QGDSupdateHandlebarsPartialsPlugin from "./.esbuild/plugins/qgds-plugin-handlebar-partial-builder.js";
|
|
@@ -10,6 +11,7 @@ import QDGSbuildLog from "./.esbuild/plugins/qgds-plugin-build-log.js";
|
|
|
10
11
|
import QDGScopy from "./.esbuild/plugins/qgds-plugin-copy-assets.js";
|
|
11
12
|
import { QGDSgenerateIconAssetsPlugin } from "./.esbuild/plugins/qgds-plugin-generate-icon-assets.js";
|
|
12
13
|
import { versionPlugin } from "./.esbuild/plugins/qgds-plugin-version.js";
|
|
14
|
+
import { createOverrideThemeScssEntry } from "./.esbuild/helpers/scssOverrideTheme.js";
|
|
13
15
|
|
|
14
16
|
//Open source ESBUILD PLUGINS
|
|
15
17
|
import { sassPlugin } from "esbuild-sass-plugin";
|
|
@@ -19,7 +21,6 @@ import handlebarsPlugin from "esbuild-plugin-handlebars";
|
|
|
19
21
|
import minimist from "minimist";
|
|
20
22
|
const argv = minimist(process.argv.slice(2));
|
|
21
23
|
|
|
22
|
-
|
|
23
24
|
// https://esbuild.github.io/getting-started/#build-scripts
|
|
24
25
|
const buildConfig = {
|
|
25
26
|
bundle: true,
|
|
@@ -65,7 +66,12 @@ const buildConfig = {
|
|
|
65
66
|
versionPlugin(),
|
|
66
67
|
QDGScleanFolders(),
|
|
67
68
|
handlebarsPlugin(),
|
|
68
|
-
sassPlugin(
|
|
69
|
+
sassPlugin({
|
|
70
|
+
//Hide sass deprecation warnings with a quiet flag... npm run build -- --quiet
|
|
71
|
+
silenceDeprecations: argv.quiet
|
|
72
|
+
? ["import", "global-builtin", "mixed-decls", "color-functions"]
|
|
73
|
+
: [],
|
|
74
|
+
}),
|
|
69
75
|
QDGSbuildLog(),
|
|
70
76
|
],
|
|
71
77
|
};
|
|
@@ -81,7 +87,7 @@ const buildNodeConfig = {
|
|
|
81
87
|
external: buildConfig.external,
|
|
82
88
|
platform: "node",
|
|
83
89
|
target: ["node20"],
|
|
84
|
-
format:
|
|
90
|
+
format: "esm",
|
|
85
91
|
entryPoints: [
|
|
86
92
|
{
|
|
87
93
|
in: "./src/js/handlebars.init.cjs",
|
|
@@ -95,26 +101,45 @@ const buildNodeConfig = {
|
|
|
95
101
|
versionPlugin(),
|
|
96
102
|
handlebarsPlugin(),
|
|
97
103
|
],
|
|
98
|
-
}
|
|
104
|
+
};
|
|
99
105
|
|
|
100
106
|
async function StartBuild() {
|
|
101
|
-
|
|
107
|
+
// Choose configuration based on theme
|
|
108
|
+
let config = buildConfig;
|
|
109
|
+
const tempEntries = [];
|
|
110
|
+
if (argv.theme) {
|
|
111
|
+
const themes = Array.isArray(argv.theme) ? argv.theme : [argv.theme];
|
|
112
|
+
const cssDir = path.resolve("src/css");
|
|
113
|
+
const mainScss = path.join(cssDir, "main.scss");
|
|
102
114
|
|
|
115
|
+
themes.forEach((themeVar) => {
|
|
116
|
+
const tempEntry = createOverrideThemeScssEntry({
|
|
117
|
+
cssDir,
|
|
118
|
+
mainScss,
|
|
119
|
+
themeVar,
|
|
120
|
+
});
|
|
121
|
+
tempEntries.push(tempEntry);
|
|
122
|
+
config.entryPoints.push({
|
|
123
|
+
in: tempEntry,
|
|
124
|
+
out: `./assets/css/qld.${themeVar}.bootstrap`,
|
|
125
|
+
});
|
|
126
|
+
console.log(`theme SCSS entry created: ${tempEntry}`);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
let ctx = await esbuild.context(config);
|
|
103
131
|
if (argv.watch === true) {
|
|
104
|
-
// "npm run watch"
|
|
105
132
|
await ctx.watch();
|
|
106
|
-
|
|
107
133
|
} else {
|
|
108
|
-
// "npm run build" or "node build.js"
|
|
109
134
|
await ctx.rebuild();
|
|
110
135
|
await ctx.dispose();
|
|
136
|
+
// Note: Temp files are preserved for performance - they're only recreated when content changes
|
|
111
137
|
}
|
|
112
138
|
|
|
113
139
|
//node js module
|
|
114
140
|
let ctxNode = await esbuild.context(buildNodeConfig);
|
|
115
141
|
await ctxNode.rebuild();
|
|
116
142
|
await ctxNode.dispose();
|
|
117
|
-
|
|
118
143
|
}
|
|
119
144
|
|
|
120
145
|
//Initate the project build...
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qld-gov-au/qgds-bootstrap5",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"prepare": "npm run build",
|
|
12
12
|
"start": "npm run build",
|
|
13
|
-
"lint": "eslint --fix --ext .js,.json --ignore-pattern 'docs/*' --ignore-pattern 'dist/*' --ignore-pattern 'storybook-static/*' .",
|
|
13
|
+
"lint": "eslint --fix --ext .js,.json --ignore-pattern 'docs/*' --ignore-pattern 'dist/*' --ignore-pattern 'storybook-static/*' --ignore-pattern 'src/js/handlebars.partials.js' .",
|
|
14
14
|
"build": "node esbuild.js",
|
|
15
15
|
"build:icons": "node esbuild.js --icons",
|
|
16
|
+
"build:theme": "node esbuild.js --theme",
|
|
17
|
+
"build:theme:icons": "node esbuild.js --theme --icons",
|
|
16
18
|
"test": "vitest",
|
|
17
19
|
"test:ui": "vitest --ui",
|
|
18
20
|
"test:integration": "npm-run-all --parallel --race serve:test test:testrunner",
|
|
@@ -22,7 +24,9 @@
|
|
|
22
24
|
"serve:test": "http-server dist -p 8081 --silent",
|
|
23
25
|
"dev-storybook": "npm-run-all --parallel watch storybook",
|
|
24
26
|
"storybook": "storybook dev -p 6006",
|
|
27
|
+
"storybook:themes": "ENABLE_DYNAMIC_THEME=true storybook dev -p 6006",
|
|
25
28
|
"build-storybook": "storybook build --webpack-stats-json ",
|
|
29
|
+
"build-storybook:themes": "ENABLE_DYNAMIC_THEME=true storybook build --webpack-stats-json ",
|
|
26
30
|
"build-storybook:serve": "http-server storybook-static -p 8080"
|
|
27
31
|
},
|
|
28
32
|
"keywords": [],
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// card--icon-list-footer.stories.js
|
|
2
|
+
import { Card } from "./Card.js";
|
|
3
|
+
import { Link } from "../link/link.js";
|
|
4
|
+
import defaultdata from "./card.data.json";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
title: "3. Components/Card/Icon List Footer",
|
|
9
|
+
render: (args) => {
|
|
10
|
+
// Create icon list for card footer following Figma design pattern
|
|
11
|
+
const figmaLinkData = {
|
|
12
|
+
title: "Related links",
|
|
13
|
+
linkList: [
|
|
14
|
+
{
|
|
15
|
+
url: "#",
|
|
16
|
+
id: "link-1",
|
|
17
|
+
label: "Label",
|
|
18
|
+
target: "_self",
|
|
19
|
+
arialabel: "Label",
|
|
20
|
+
iconClass: "qld-icon-arrow-right",
|
|
21
|
+
iconPosition: "leading",
|
|
22
|
+
download: null,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
url: "#",
|
|
26
|
+
id: "link-2",
|
|
27
|
+
label: "Label",
|
|
28
|
+
target: "_self",
|
|
29
|
+
arialabel: "Label",
|
|
30
|
+
iconClass: "qld-icon-profile",
|
|
31
|
+
iconPosition: "leading",
|
|
32
|
+
download: null,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
url: "#",
|
|
36
|
+
id: "link-3",
|
|
37
|
+
label: "Label",
|
|
38
|
+
target: "_self",
|
|
39
|
+
arialabel: "Label",
|
|
40
|
+
iconClass: "qld-icon-like",
|
|
41
|
+
iconPosition: "leading",
|
|
42
|
+
download: null,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
const iconListHtml = new Link(figmaLinkData).html;
|
|
47
|
+
|
|
48
|
+
return `
|
|
49
|
+
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-4">
|
|
50
|
+
${new Card({ ...args, footer: iconListHtml }).html}
|
|
51
|
+
${new Card({ ...args, variantClass: "light", footer: iconListHtml }).html}
|
|
52
|
+
${new Card({ ...args, variantClass: "alt", footer: iconListHtml }).html}
|
|
53
|
+
${new Card({ ...args, variantClass: "dark", footer: iconListHtml }).html}
|
|
54
|
+
${new Card({ ...args, variantClass: "dark-alt", footer: iconListHtml }).html}
|
|
55
|
+
${
|
|
56
|
+
new Card({
|
|
57
|
+
...args,
|
|
58
|
+
iconClasses: "qld-icon-design",
|
|
59
|
+
iconPosition: "icon-left",
|
|
60
|
+
footer: iconListHtml,
|
|
61
|
+
}).html
|
|
62
|
+
}
|
|
63
|
+
${
|
|
64
|
+
new Card({
|
|
65
|
+
...args,
|
|
66
|
+
iconClasses: "qld-icon-design",
|
|
67
|
+
iconPosition: "icon-top",
|
|
68
|
+
footer: iconListHtml,
|
|
69
|
+
}).html
|
|
70
|
+
}
|
|
71
|
+
${
|
|
72
|
+
new Card({
|
|
73
|
+
...args,
|
|
74
|
+
image: "./img/image-placeholder.png",
|
|
75
|
+
imageAlt: "A grey placeholder image with an icon in the centre.",
|
|
76
|
+
footer: iconListHtml,
|
|
77
|
+
}).html
|
|
78
|
+
}
|
|
79
|
+
${
|
|
80
|
+
new Card({
|
|
81
|
+
...args,
|
|
82
|
+
image: "./img/image-placeholder.png",
|
|
83
|
+
imageAlt: "A grey placeholder image with an icon in the centre.",
|
|
84
|
+
video: true,
|
|
85
|
+
videoDuration: "2:34",
|
|
86
|
+
footer: iconListHtml,
|
|
87
|
+
}).html
|
|
88
|
+
}
|
|
89
|
+
</div>
|
|
90
|
+
`;
|
|
91
|
+
},
|
|
92
|
+
args: {
|
|
93
|
+
...defaultdata.multiAction,
|
|
94
|
+
title: "Card with Icon List Footer",
|
|
95
|
+
description:
|
|
96
|
+
"This card demonstrates the proper nesting of an Icon List component into the Card Footer following the Figma design pattern with 0.75rem gap spacing between links and 12px gap between icons and text.",
|
|
97
|
+
},
|
|
98
|
+
argTypes: {
|
|
99
|
+
date: {
|
|
100
|
+
control: "text",
|
|
101
|
+
},
|
|
102
|
+
variantClass: {
|
|
103
|
+
control: "select",
|
|
104
|
+
options: {
|
|
105
|
+
Default: "default",
|
|
106
|
+
Light: "light",
|
|
107
|
+
Alternative: "alt",
|
|
108
|
+
Dark: "dark",
|
|
109
|
+
"Dark alternative": "dark-alt",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
action: {
|
|
113
|
+
control: "select",
|
|
114
|
+
options: {
|
|
115
|
+
None: "no",
|
|
116
|
+
Single: "single",
|
|
117
|
+
Multi: "multi",
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
parameters: {
|
|
122
|
+
docs: {
|
|
123
|
+
description: {
|
|
124
|
+
story:
|
|
125
|
+
"This story demonstrates how to properly nest an Icon List component into the Card Footer following the Figma design pattern with 0.75rem gap spacing between links and 12px gap between icons and text. Each link uses consistent 'Label' text with different leading icons (arrow-right, profile, like) as shown in the design reference.",
|
|
126
|
+
},
|
|
127
|
+
controls: {
|
|
128
|
+
exclude: ["link", "arrow", "iconPosition", "footer"],
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
design: {
|
|
132
|
+
name: "QGDS Figma Reference - Cards",
|
|
133
|
+
type: "figma",
|
|
134
|
+
url: "https://www.figma.com/design/qKsxl3ogIlBp7dafgxXuCA/QGDS-UI-kit?node-id=card-component",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const Default = {};
|
|
140
|
+
|
|
141
|
+
export const WithLeadingIcons = {
|
|
142
|
+
name: "With leading icon variant",
|
|
143
|
+
args: {
|
|
144
|
+
iconClasses: "qld-icon-design",
|
|
145
|
+
iconPosition: "icon-left",
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const LightTheme = {
|
|
150
|
+
name: "Light theme with icon list",
|
|
151
|
+
args: {
|
|
152
|
+
variantClass: "light",
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const DarkTheme = {
|
|
157
|
+
name: "Dark theme with icon list",
|
|
158
|
+
args: {
|
|
159
|
+
variantClass: "dark",
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export const WithVideo = {
|
|
164
|
+
name: "Video card with icon list footer",
|
|
165
|
+
args: {
|
|
166
|
+
image: "./img/image-placeholder.png",
|
|
167
|
+
imageAlt: "A grey placeholder image with an icon in the centre.",
|
|
168
|
+
video: true,
|
|
169
|
+
videoDuration: "2:34",
|
|
170
|
+
},
|
|
171
|
+
};
|
|
@@ -431,6 +431,21 @@
|
|
|
431
431
|
margin: 0;
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
+
/////////////////////////////////////////////
|
|
435
|
+
// Override default spacing on link list component for icon links
|
|
436
|
+
.link-list {
|
|
437
|
+
display: flex;
|
|
438
|
+
flex-direction: column;
|
|
439
|
+
margin: 1rem 0;
|
|
440
|
+
padding: 0;
|
|
441
|
+
gap: 0.75rem;
|
|
442
|
+
.link-item {
|
|
443
|
+
margin: 0;
|
|
444
|
+
a {
|
|
445
|
+
gap: 12px;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
434
449
|
}
|
|
435
450
|
.card-footer {
|
|
436
451
|
font-size: 1.25rem;
|
|
@@ -293,6 +293,14 @@
|
|
|
293
293
|
position: relative;
|
|
294
294
|
color: var(--#{$prefix}header-color-text);
|
|
295
295
|
background: var(--#{$prefix}header-color-bg);
|
|
296
|
+
|
|
297
|
+
// Patch for v2.0.5. Redundant after header QGDS-266 is merged
|
|
298
|
+
border-bottom: 0.25rem solid var(--qld-light-accent);
|
|
299
|
+
|
|
300
|
+
@include media-breakpoint-up(lg) {
|
|
301
|
+
border-bottom: none;
|
|
302
|
+
}
|
|
303
|
+
// End patch for v2.0.5
|
|
296
304
|
}
|
|
297
305
|
|
|
298
306
|
&-brand {
|
|
@@ -43,12 +43,12 @@ const sideNavData = {
|
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
link: "#",
|
|
46
|
-
label: "Content page (
|
|
46
|
+
label: "Content page (with bar)",
|
|
47
47
|
class: "",
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
link: "#",
|
|
51
|
-
label: "
|
|
51
|
+
label: "Page with form",
|
|
52
52
|
class: "",
|
|
53
53
|
},
|
|
54
54
|
],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { expect, it, describe, test, beforeEach } from "vitest";
|
|
1
|
+
import { expect, it, describe, test, beforeEach, afterEach } from "vitest";
|
|
2
2
|
import { JSDOM } from "jsdom";
|
|
3
3
|
import { SearchInput } from "./SearchInput.js";
|
|
4
4
|
import mockData from "./searchInput.data.json";
|
|
@@ -63,12 +63,15 @@ describe("SearchInput", () => {
|
|
|
63
63
|
d = dom.window.document;
|
|
64
64
|
window = dom.window;
|
|
65
65
|
|
|
66
|
-
// Wait for scripts to execute
|
|
67
|
-
await waitFor();
|
|
66
|
+
// Wait for scripts to execute and DOM to be fully ready
|
|
67
|
+
await waitFor(100);
|
|
68
|
+
|
|
69
|
+
// Additional wait to ensure all scripts are fully initialized
|
|
70
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
68
71
|
|
|
69
72
|
form = d.querySelector(".site-search");
|
|
70
|
-
searchInput = form
|
|
71
|
-
suggestions = form
|
|
73
|
+
searchInput = form?.querySelector(".qld-search-input input");
|
|
74
|
+
suggestions = form?.querySelector(".suggestions");
|
|
72
75
|
|
|
73
76
|
// Ensure elements exist
|
|
74
77
|
if (!form || !searchInput || !suggestions) {
|
|
@@ -76,6 +79,19 @@ describe("SearchInput", () => {
|
|
|
76
79
|
}
|
|
77
80
|
});
|
|
78
81
|
|
|
82
|
+
afterEach(() => {
|
|
83
|
+
// Clean up DOM and prevent memory leaks
|
|
84
|
+
if (dom) {
|
|
85
|
+
dom.window.close();
|
|
86
|
+
dom = null;
|
|
87
|
+
d = null;
|
|
88
|
+
window = null;
|
|
89
|
+
form = null;
|
|
90
|
+
searchInput = null;
|
|
91
|
+
suggestions = null;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
79
95
|
it("Renders as expected", () => {
|
|
80
96
|
const SearchInputComponent = new SearchInput(mockData);
|
|
81
97
|
expect(SearchInputComponent.html).toMatchSnapshot();
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
@import './themes/masterbrand.scss';// Guidelines for this setup: https://getbootstrap.com/docs/5.3/customize/sass/
|
|
2
|
+
|
|
3
|
+
// External fonts
|
|
4
|
+
@import url("https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;700&family=Noto+Sans:wght@400;600;900&display=swap");
|
|
5
|
+
$font-family-sans-serif:
|
|
6
|
+
"Noto Sans",
|
|
7
|
+
system-ui,
|
|
8
|
+
-apple-system,
|
|
9
|
+
"Segoe UI",
|
|
10
|
+
Roboto,
|
|
11
|
+
"Helvetica Neue",
|
|
12
|
+
"Noto Sans",
|
|
13
|
+
"Liberation Sans",
|
|
14
|
+
Arial,
|
|
15
|
+
sans-serif,
|
|
16
|
+
"Apple Color Emoji",
|
|
17
|
+
"Segoe UI Emoji",
|
|
18
|
+
"Segoe UI Symbol",
|
|
19
|
+
"Noto Color Emoji" !default;
|
|
20
|
+
$font-family-sitename: "Fira Sans";
|
|
21
|
+
|
|
22
|
+
//Prefix to namespace design-system classes
|
|
23
|
+
$prefix: "qld-";
|
|
24
|
+
$enable-cssgrid: true;
|
|
25
|
+
$color-mode-type: data;
|
|
26
|
+
$enable-dark-mode: true;
|
|
27
|
+
|
|
28
|
+
// 1. Include bootstraps functions and variables first (so they can be referenced by proceeding files)
|
|
29
|
+
@import "../../node_modules/bootstrap/scss/functions";
|
|
30
|
+
@import "../../node_modules/bootstrap/scss/variables";
|
|
31
|
+
@import "../../node_modules/bootstrap/scss/variables-dark";
|
|
32
|
+
|
|
33
|
+
// 2. QLD Design System variables (Bootstrap overrides)
|
|
34
|
+
@import "./qld-variables";
|
|
35
|
+
@import "variables";
|
|
36
|
+
|
|
37
|
+
// 3. Include remainder of bootstrap
|
|
38
|
+
// 3.1 Required
|
|
39
|
+
@import "../../node_modules/bootstrap/scss/maps";
|
|
40
|
+
@import "../../node_modules/bootstrap/scss/mixins";
|
|
41
|
+
@import "../../node_modules/bootstrap/scss/utilities";
|
|
42
|
+
|
|
43
|
+
// 3.2 QLD Design System utilities (is dependent on maps, mixins and utilities being available)
|
|
44
|
+
@import "./qld-utilities";
|
|
45
|
+
|
|
46
|
+
// 3.2 Recommended, Resets and shared
|
|
47
|
+
@import "../../node_modules/bootstrap/scss/root";
|
|
48
|
+
@import "../../node_modules/bootstrap/scss/reboot";
|
|
49
|
+
@import "../../node_modules/bootstrap/scss/type";
|
|
50
|
+
@import "../../node_modules/bootstrap/scss/containers";
|
|
51
|
+
@import "../../node_modules/bootstrap/scss/grid";
|
|
52
|
+
@import "../../node_modules/bootstrap/scss/helpers";
|
|
53
|
+
|
|
54
|
+
// 3.3 Optional components
|
|
55
|
+
@import "../../node_modules/bootstrap/scss/accordion";
|
|
56
|
+
@import "../../node_modules/bootstrap/scss/alert";
|
|
57
|
+
@import "../../node_modules/bootstrap/scss/badge";
|
|
58
|
+
@import "../../node_modules/bootstrap/scss/buttons";
|
|
59
|
+
@import "../../node_modules/bootstrap/scss/button-group";
|
|
60
|
+
@import "../../node_modules/bootstrap/scss/breadcrumb";
|
|
61
|
+
@import "../../node_modules/bootstrap/scss/card";
|
|
62
|
+
@import "../../node_modules/bootstrap/scss/carousel";
|
|
63
|
+
@import "../../node_modules/bootstrap/scss/close";
|
|
64
|
+
@import "../../node_modules/bootstrap/scss/dropdown";
|
|
65
|
+
@import "../../node_modules/bootstrap/scss/forms";
|
|
66
|
+
@import "../../node_modules/bootstrap/scss/list-group";
|
|
67
|
+
@import "../../node_modules/bootstrap/scss/images";
|
|
68
|
+
@import "../../node_modules/bootstrap/scss/modal";
|
|
69
|
+
@import "../../node_modules/bootstrap/scss/progress";
|
|
70
|
+
@import "../../node_modules/bootstrap/scss/transitions";
|
|
71
|
+
@import "../../node_modules/bootstrap/scss/nav";
|
|
72
|
+
@import "../../node_modules/bootstrap/scss/navbar";
|
|
73
|
+
@import "../../node_modules/bootstrap/scss/offcanvas";
|
|
74
|
+
@import "../../node_modules/bootstrap/scss/pagination";
|
|
75
|
+
@import "../../node_modules/bootstrap/scss/placeholders";
|
|
76
|
+
@import "../../node_modules/bootstrap/scss/popover";
|
|
77
|
+
@import "../../node_modules/bootstrap/scss/spinners";
|
|
78
|
+
@import "../../node_modules/bootstrap/scss/tables";
|
|
79
|
+
@import "../../node_modules/bootstrap/scss/toasts";
|
|
80
|
+
@import "../../node_modules/bootstrap/scss/tooltip";
|
|
81
|
+
|
|
82
|
+
// 7. Optionally include utilities API last to generate classes based on the Sass map in `_utilities.scss`
|
|
83
|
+
@import "../../node_modules/bootstrap/scss/utilities/api";
|
|
84
|
+
|
|
85
|
+
// Themes
|
|
86
|
+
@import "qld-theme";
|
|
87
|
+
|
|
88
|
+
//8. QLD Design System typography (bootstrap overrides and custom). Please maintain naming consistency.
|
|
89
|
+
@import "./qld-type";
|
|
90
|
+
|
|
91
|
+
// Common Layout Blocks
|
|
92
|
+
@import "../components/common/layout/content";
|
|
93
|
+
@import "../components/common/layout/container";
|
|
94
|
+
|
|
95
|
+
// 9. QLD Design System components (bootstrap overrides and custom). Please maintain naming consistency.
|
|
96
|
+
@import "../components/bs5/accordion/accordion";
|
|
97
|
+
@import "../components/bs5/banner/banner";
|
|
98
|
+
@import "../components/bs5/blockquote/blockquote";
|
|
99
|
+
@import "../components/bs5/breadcrumbs/breadcrumbs";
|
|
100
|
+
@import "../components/bs5/button/button";
|
|
101
|
+
@import "../components/bs5/callout/callout";
|
|
102
|
+
@import "../components/bs5/card/card";
|
|
103
|
+
@import "../components/bs5/callToAction/callToAction";
|
|
104
|
+
@import "../components/bs5/correctincorrect/correctincorrect";
|
|
105
|
+
@import "../components/bs5/dateinput/dateinput";
|
|
106
|
+
@import "../components/bs5/directionLinks/directionLinks";
|
|
107
|
+
@import "../components/bs5/formcheck/formcheck";
|
|
108
|
+
@import "../components/bs5/footer/footer";
|
|
109
|
+
@import "../components/bs5/globalAlert/globalAlert";
|
|
110
|
+
@import "../components/bs5/link/link";
|
|
111
|
+
@import "../components/bs5/header/header";
|
|
112
|
+
@import "../components/bs5/icons/icons";
|
|
113
|
+
@import "../components/bs5/inpageAlert/inpageAlert";
|
|
114
|
+
@import "../components/bs5/image/image";
|
|
115
|
+
@import "../components/bs5/inpagenav/inpagenav";
|
|
116
|
+
@import "../components/bs5/linkColumns/linkColumns";
|
|
117
|
+
@import "../components/bs5/modal/modal";
|
|
118
|
+
@import "../components/bs5/navbar/navbar";
|
|
119
|
+
@import "../components/bs5/pagination/pagination";
|
|
120
|
+
@import "../components/bs5/promotionalPanel/promotionalPanel";
|
|
121
|
+
@import "../components/bs5/quickexit/quickexit";
|
|
122
|
+
@import "../components/bs5/sidenav/sidenav";
|
|
123
|
+
@import "../components/bs5/searchInput/searchInput";
|
|
124
|
+
@import "../components/bs5/skiplinks/skipLinks";
|
|
125
|
+
@import "../components/bs5/spinner/spinner";
|
|
126
|
+
@import "../components/bs5/table/table";
|
|
127
|
+
@import "../components/bs5/tabs/tabs";
|
|
128
|
+
@import "../components/bs5/tag/tag";
|
|
129
|
+
@import "../components/bs5/textbox/textInput";
|
|
130
|
+
@import "../components/bs5/typography/typography";
|
|
131
|
+
@import "../components/bs5/video/video";
|
|
132
|
+
|
|
133
|
+
// Custom utility classes
|
|
134
|
+
@import "utilities";
|
|
135
|
+
|
|
136
|
+
// Print
|
|
137
|
+
@import "qld-print";
|