@qld-gov-au/qgds-bootstrap5 2.0.5 → 2.0.6
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/.storybook/dynamicThemeDecorator.js +28 -24
- package/.storybook/main.js +4 -2
- package/.storybook/preview.js +1 -1
- 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/css/qld.bootstrap.legacy.css +2 -0
- package/dist/assets/css/qld.bootstrap.legacy.css.map +7 -0
- 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 +1 -1
- package/esbuild.js +6 -1
- package/package.json +1 -1
- package/src/components/bs5/accordion/accordion.scss +3 -3
- package/src/components/bs5/button/button.scss +25 -45
- package/src/components/bs5/callout/callout.stories.js +15 -21
- package/src/components/bs5/card/card.scss +5 -5
- package/src/components/bs5/footer/footer.scss +3 -7
- package/src/components/bs5/pagination/pagination.scss +290 -274
- package/src/components/bs5/pagination/pagination.stories.js +18 -33
- package/src/components/bs5/textbox/textInput.scss +55 -39
- package/src/components/bs5/video/video.scss +41 -27
- package/src/css/main.legacy.scss +19 -0
- package/src/css/main.scss +17 -0
- package/src/css/qld-tokens-legacy.scss +94 -0
- package/src/css/qld-tokens.scss +92 -77
- package/src/css/qld-variables.scss +37 -30
- package/src/css/main.masterbrand.scss +0 -137
- package/src/css/themes/masterbrand.scss +0 -109
|
@@ -6,7 +6,7 @@ let currentTheme = "masterbrand";
|
|
|
6
6
|
// Automatically generate theme modules based on available theme files
|
|
7
7
|
const themeModules = (() => {
|
|
8
8
|
const modules = {
|
|
9
|
-
|
|
9
|
+
masterbrand: () => import("../src/css/main.scss"),
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
// Get all theme files in the themes directory
|
|
@@ -50,27 +50,23 @@ function mapStyleElementsByTheme(callback) {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
const unloadTheme = (themeName) => {
|
|
54
|
-
// Cache current theme's style elements before removing
|
|
55
|
-
// Remove existing style elements for current theme
|
|
56
|
-
const currentStyleElements = [];
|
|
57
|
-
const themeNotExist = themeName && !themeStyleElements.has(themeName);
|
|
58
|
-
mapStyleElementsByTheme((element) => {
|
|
59
|
-
if (themeNotExist) {
|
|
60
|
-
currentStyleElements.push(element.cloneNode(true));
|
|
61
|
-
}
|
|
62
|
-
element.remove();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
if (currentStyleElements.length > 0) {
|
|
66
|
-
themeStyleElements.set(themeName, currentStyleElements);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
53
|
const loadTheme = async (themeName) => {
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
|
|
54
|
+
// Store the previous theme name before changing
|
|
55
|
+
const previousTheme = currentTheme;
|
|
56
|
+
|
|
57
|
+
// Cache previous theme's elements BEFORE loading new theme
|
|
58
|
+
const previousThemeElements = [];
|
|
59
|
+
if (previousTheme && previousTheme !== themeName) {
|
|
60
|
+
mapStyleElementsByTheme((element) => {
|
|
61
|
+
previousThemeElements.push(element);
|
|
62
|
+
});
|
|
63
|
+
// Store in cache if not already cached
|
|
64
|
+
if (!themeStyleElements.has(previousTheme)) {
|
|
65
|
+
themeStyleElements.set(
|
|
66
|
+
previousTheme,
|
|
67
|
+
previousThemeElements.map((el) => el.cloneNode(true)),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
74
70
|
}
|
|
75
71
|
|
|
76
72
|
// If theme style elements are cached, restore them
|
|
@@ -79,6 +75,10 @@ const loadTheme = async (themeName) => {
|
|
|
79
75
|
cachedElements.forEach((element) => {
|
|
80
76
|
document.head.appendChild(element.cloneNode(true));
|
|
81
77
|
});
|
|
78
|
+
// Remove previous theme elements after new theme is fully loaded
|
|
79
|
+
previousThemeElements.forEach((element) => {
|
|
80
|
+
element.remove();
|
|
81
|
+
});
|
|
82
82
|
currentTheme = themeName;
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
@@ -108,6 +108,11 @@ const loadTheme = async (themeName) => {
|
|
|
108
108
|
// Store references
|
|
109
109
|
loadedThemes.set(themeName, true);
|
|
110
110
|
currentTheme = themeName;
|
|
111
|
+
|
|
112
|
+
// Remove previous theme elements after new theme is fully loaded
|
|
113
|
+
previousThemeElements.forEach((element) => {
|
|
114
|
+
element.remove();
|
|
115
|
+
});
|
|
111
116
|
} catch (error) {
|
|
112
117
|
console.warn(`Failed to load theme: ${themeName}`, error);
|
|
113
118
|
}
|
|
@@ -132,11 +137,11 @@ export const dynamicThemeGlobalTypes = {
|
|
|
132
137
|
icon: "switchalt",
|
|
133
138
|
items: (() => {
|
|
134
139
|
// Dynamically generate toolbar items from available themes
|
|
135
|
-
const items = [];
|
|
140
|
+
const items = [{ value: "masterbrand", title: "Masterbrand theme" }];
|
|
136
141
|
|
|
137
142
|
// Add items for all discovered themes
|
|
138
143
|
Object.keys(themeModules).forEach((themeName) => {
|
|
139
|
-
if (themeName !== "
|
|
144
|
+
if (themeName !== "masterbrand") {
|
|
140
145
|
const capitalizedName =
|
|
141
146
|
themeName.charAt(0).toUpperCase() + themeName.slice(1);
|
|
142
147
|
items.push({
|
|
@@ -145,7 +150,6 @@ export const dynamicThemeGlobalTypes = {
|
|
|
145
150
|
});
|
|
146
151
|
}
|
|
147
152
|
});
|
|
148
|
-
items.push({ value: "customized", title: "Customized theme" });
|
|
149
153
|
return items;
|
|
150
154
|
})(),
|
|
151
155
|
showName: true,
|
package/.storybook/main.js
CHANGED
|
@@ -46,11 +46,13 @@ const config = {
|
|
|
46
46
|
|
|
47
47
|
viteFinal: async (config, { configType }) => {
|
|
48
48
|
config.root = "./dist";
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
// Define environment variables for the browser
|
|
51
51
|
config.define = {
|
|
52
52
|
...config.define,
|
|
53
|
-
|
|
53
|
+
"import.meta.env.ENABLE_DYNAMIC_THEME": JSON.stringify(
|
|
54
|
+
process.env.ENABLE_DYNAMIC_THEME === "true",
|
|
55
|
+
),
|
|
54
56
|
};
|
|
55
57
|
// config.plugins.push({
|
|
56
58
|
// name: "html-transform",
|
package/.storybook/preview.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js";
|
|
2
2
|
import "../src/js/qld.bootstrap.js";
|
|
3
|
-
import "../src/css/main.
|
|
3
|
+
import "../src/css/main.scss";
|
|
4
4
|
import { withThemeByClassName } from "@storybook/addon-themes";
|
|
5
5
|
import {
|
|
6
6
|
withDynamicTheme,
|
|
@@ -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.6","branch":"HEAD","tag":"v2.0.6","commit":"8e01e15b93ee3bf9a4f97638ef79324fdf6a97a7","majorVersion":"v2"} -->
|
|
3
3
|
|
|
4
4
|
{{! Select environment, used verbatium if not using predefind key
|
|
5
5
|
cdn := PROD|STAGING|BETA|TEST|DEV|???
|