@qld-gov-au/qgds-bootstrap5 1.1.30 → 1.1.32
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/plugins/qgds-plugin-generate-icon-assets.js +103 -0
- package/dist/assets/components/bs5/head/head.hbs +1 -1
- package/dist/assets/components/bs5/image/image.hbs +24 -0
- package/dist/assets/css/qld.bootstrap.css +1 -1
- package/dist/assets/css/qld.bootstrap.css.map +3 -3
- package/dist/assets/img/icons-sprite.svg +479 -0
- package/dist/assets/img/image-content-example.jpg +0 -0
- package/dist/assets/img/image-example-couple-beach-md.jpg +0 -0
- package/dist/assets/img/image-example-couple-beach-sm.jpg +0 -0
- package/dist/assets/img/image-example-couple-beach-xl.jpg +0 -0
- package/dist/assets/img/image-example-health-workers-md.jpg +0 -0
- package/dist/assets/img/image-example-health-workers-sm.jpg +0 -0
- package/dist/assets/img/image-example-health-workers-xl.jpg +0 -0
- package/dist/assets/img/image-ratio-4x3-blank.png +0 -0
- package/dist/assets/js/handlebars.init.min.js +50 -27
- package/dist/assets/js/handlebars.init.min.js.map +4 -4
- package/dist/assets/js/handlebars.partials.js +2 -0
- package/dist/assets/node/handlebars.init.min.js +11 -1
- package/dist/assets/node/handlebars.init.min.js.map +3 -3
- package/dist/components/bs5/head/head.hbs +1 -1
- package/dist/components/bs5/image/image.hbs +24 -0
- package/dist/components/handlebars.partials.js +2 -0
- package/dist/package.json +4 -1
- package/dist/sample-data/image/image.data.json +15 -0
- package/esbuild.js +3 -0
- package/package.json +4 -1
- package/src/components/bs5/accordion/accordion.scss +15 -15
- package/src/components/bs5/callToAction/callToAction.scss +22 -25
- package/src/components/bs5/callToAction/callToAction.stories.js +46 -1
- package/src/components/bs5/icons/Icons.mdx +15 -0
- package/src/components/bs5/icons/_icons-multicolours.list.scss +10 -0
- package/src/components/bs5/icons/_icons.list.js +114 -0
- package/src/components/bs5/icons/_icons.list.scss +114 -0
- package/src/components/bs5/icons/_icons.variables.scss +114 -0
- package/src/components/bs5/icons/icons.scss +68 -0
- package/src/components/bs5/icons/icons.stories.js +112 -0
- package/src/components/bs5/icons/story-icon-sizing.html +131 -0
- package/src/components/bs5/icons/story-icon-usage.html +89 -0
- package/src/components/bs5/image/Image.js +21 -0
- package/src/components/bs5/image/Image.mdx +17 -0
- package/src/components/bs5/image/image.data.json +15 -0
- package/src/components/bs5/image/image.hbs +24 -0
- package/src/components/bs5/image/image.scss +108 -0
- package/src/components/bs5/image/image.stories.js +306 -0
- package/src/components/bs5/linkColumns/linkColumns.scss +6 -10
- package/src/components/bs5/typography/typography.scss +57 -39
- package/src/css/main.scss +5 -1
- package/src/css/qld-type.scss +7 -1
- package/src/css/qld-utilities.scss +20 -0
- package/src/css/qld-variables.scss +21 -6
- package/src/img/icons/Spinner Step 1.svg +3 -0
- package/src/img/icons/Spinner Step 2.svg +3 -0
- package/src/img/icons/Spinner Step 3.svg +3 -0
- package/src/img/icons/Spinner Step 4.svg +3 -0
- package/src/img/icons/X.svg +3 -0
- package/src/img/icons/YouTube.svg +3 -0
- package/src/img/icons/accessibility.svg +3 -0
- package/src/img/icons/alert-cancel.svg +3 -0
- package/src/img/icons/alert-danger.svg +3 -0
- package/src/img/icons/alert-error.svg +3 -0
- package/src/img/icons/alert-information.svg +3 -0
- package/src/img/icons/alert-maintenance.svg +3 -0
- package/src/img/icons/alert-success.svg +3 -0
- package/src/img/icons/alert-warning.svg +3 -0
- package/src/img/icons/announcement.svg +3 -0
- package/src/img/icons/arrow-down.svg +3 -0
- package/src/img/icons/arrow-left.svg +3 -0
- package/src/img/icons/arrow-right.svg +3 -0
- package/src/img/icons/arrow-up.svg +3 -0
- package/src/img/icons/article.svg +3 -0
- package/src/img/icons/attach.svg +3 -0
- package/src/img/icons/audio.svg +3 -0
- package/src/img/icons/calendar.svg +3 -0
- package/src/img/icons/car.svg +3 -0
- package/src/img/icons/chart.svg +3 -0
- package/src/img/icons/chevron-down.svg +3 -0
- package/src/img/icons/chevron-left.svg +3 -0
- package/src/img/icons/chevron-right.svg +3 -0
- package/src/img/icons/chevron-up.svg +3 -0
- package/src/img/icons/clock.svg +3 -0
- package/src/img/icons/close.svg +3 -0
- package/src/img/icons/code.svg +3 -0
- package/src/img/icons/copy.svg +3 -0
- package/src/img/icons/cost money.svg +3 -0
- package/src/img/icons/delete.svg +3 -0
- package/src/img/icons/design.svg +3 -0
- package/src/img/icons/direction-up-down.svg +3 -0
- package/src/img/icons/directions.svg +3 -0
- package/src/img/icons/document-error.svg +4 -0
- package/src/img/icons/document-pdf.svg +5 -0
- package/src/img/icons/document-spreadsheet.svg +4 -0
- package/src/img/icons/document-word.svg +4 -0
- package/src/img/icons/document.svg +3 -0
- package/src/img/icons/download.svg +8 -0
- package/src/img/icons/edit.svg +3 -0
- package/src/img/icons/email.svg +3 -0
- package/src/img/icons/enlarge.svg +3 -0
- package/src/img/icons/external-link.svg +3 -0
- package/src/img/icons/facebook.svg +3 -0
- package/src/img/icons/favourite.svg +3 -0
- package/src/img/icons/filter.svg +3 -0
- package/src/img/icons/global-nav.svg +3 -0
- package/src/img/icons/help.svg +3 -0
- package/src/img/icons/hide.svg +3 -0
- package/src/img/icons/home.svg +3 -0
- package/src/img/icons/identity-face.svg +3 -0
- package/src/img/icons/identity.svg +3 -0
- package/src/img/icons/image.svg +3 -0
- package/src/img/icons/instagram.svg +3 -0
- package/src/img/icons/language.svg +3 -0
- package/src/img/icons/like.svg +3 -0
- package/src/img/icons/linkedin.svg +3 -0
- package/src/img/icons/links.svg +3 -0
- package/src/img/icons/location.svg +3 -0
- package/src/img/icons/lock-open.svg +8 -0
- package/src/img/icons/lock.svg +8 -0
- package/src/img/icons/login.svg +3 -0
- package/src/img/icons/logout.svg +3 -0
- package/src/img/icons/manage-accounts.svg +3 -0
- package/src/img/icons/menu.svg +3 -0
- package/src/img/icons/microphone.svg +3 -0
- package/src/img/icons/minus.svg +4 -0
- package/src/img/icons/more-horizontal.svg +3 -0
- package/src/img/icons/more-vertical.svg +3 -0
- package/src/img/icons/notifications-circle.svg +3 -0
- package/src/img/icons/notifications.svg +3 -0
- package/src/img/icons/op-ed.svg +3 -0
- package/src/img/icons/parking.svg +3 -0
- package/src/img/icons/pause-circle.svg +3 -0
- package/src/img/icons/pdf.svg +3 -0
- package/src/img/icons/pending.svg +3 -0
- package/src/img/icons/phone.svg +3 -0
- package/src/img/icons/play-circle.svg +3 -0
- package/src/img/icons/plus.svg +3 -0
- package/src/img/icons/podcasts.svg +3 -0
- package/src/img/icons/print.svg +3 -0
- package/src/img/icons/profile.svg +3 -0
- package/src/img/icons/refresh.svg +3 -0
- package/src/img/icons/save.svg +3 -0
- package/src/img/icons/search.svg +3 -0
- package/src/img/icons/settings.svg +3 -0
- package/src/img/icons/share.svg +3 -0
- package/src/img/icons/show.svg +3 -0
- package/src/img/icons/sort-alpha.svg +3 -0
- package/src/img/icons/speech.svg +3 -0
- package/src/img/icons/spreadsheet.svg +3 -0
- package/src/img/icons/status-cancel.svg +4 -0
- package/src/img/icons/status-danger.svg +4 -0
- package/src/img/icons/status-error.svg +4 -0
- package/src/img/icons/status-information.svg +4 -0
- package/src/img/icons/status-maintenance.svg +4 -0
- package/src/img/icons/status-success.svg +4 -0
- package/src/img/icons/status-warning.svg +4 -0
- package/src/img/icons/stop circle.svg +3 -0
- package/src/img/icons/tick.svg +3 -0
- package/src/img/icons/transcript.svg +3 -0
- package/src/img/icons/upload.svg +4 -0
- package/src/img/icons/users.svg +3 -0
- package/src/img/icons/video.svg +3 -0
- package/src/img/icons/view-all.svg +3 -0
- package/src/img/icons/wheelchair.svg +3 -0
- package/src/img/icons/zoom.svg +3 -0
- package/src/img/icons-sprite.svg +479 -0
- package/src/img/image-content-example.jpg +0 -0
- package/src/img/image-example-couple-beach-md.jpg +0 -0
- package/src/img/image-example-couple-beach-sm.jpg +0 -0
- package/src/img/image-example-couple-beach-xl.jpg +0 -0
- package/src/img/image-example-health-workers-md.jpg +0 -0
- package/src/img/image-example-health-workers-sm.jpg +0 -0
- package/src/img/image-example-health-workers-xl.jpg +0 -0
- package/src/img/image-ratio-4x3-blank.png +0 -0
- package/src/js/handlebars.partials.js +2 -0
- package/dist/assets/img/colour-photo-example.jpg +0 -0
- package/dist/assets/img/demo-image-unsplash-motorbike.jpg +0 -0
- package/src/components/bs5/icons/data.json +0 -0
- package/src/components/bs5/icons/icons.html +0 -1
- package/src/img/colour-photo-example.jpg +0 -0
- package/src/img/demo-image-unsplash-motorbike.jpg +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import log from "../helpers/logger.js";
|
|
4
|
+
import svgToMiniDataURI from "mini-svg-data-uri";
|
|
5
|
+
import { parse } from "node-html-parser";
|
|
6
|
+
|
|
7
|
+
const PREFIX_QGDS = 'qgds-icon-';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Generate CSS variables of icons from SVG files.
|
|
11
|
+
* @param {string} inputDir - Directory containing SVG icon files
|
|
12
|
+
* @param {string} outputIconVars - Output SASS file for the generated CSS variables
|
|
13
|
+
* @param {string} outputIconNames - Output SASS file for the generated icon names - to build icon utility classes
|
|
14
|
+
* @param {string} outputIconJs - Output JS file for the generated icon names - to be used in Storybook
|
|
15
|
+
*/
|
|
16
|
+
export function QGDSgenerateIconAssetsPlugin(inputDir = "./src/img/icons",
|
|
17
|
+
outputIconSprite = "./src/img/icons-sprite.svg",
|
|
18
|
+
outputIconVars = "./src/components/bs5/icons/_icons.variables.scss",
|
|
19
|
+
outputIconNames = "./src/components/bs5/icons/_icons.list.scss",
|
|
20
|
+
outputIconJs = "./src/components/bs5/icons/_icons.list.js") {
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
name: "qgds-generate-icon-variables",
|
|
24
|
+
|
|
25
|
+
setup(build) {
|
|
26
|
+
|
|
27
|
+
const regenerate = () => {
|
|
28
|
+
|
|
29
|
+
log("yellow", "\n Start generating icons assets... \n");
|
|
30
|
+
|
|
31
|
+
if (!fs.existsSync(inputDir)) {
|
|
32
|
+
console.error(`Input directory not found: ${inputDir}`);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const icons = fs.readdirSync(inputDir).filter((file) => file.endsWith(".svg"));
|
|
37
|
+
|
|
38
|
+
if (icons.length === 0) {
|
|
39
|
+
log("red", `SVG files not found in ${inputDir}`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let spriteContent = `<svg xmlns="http://www.w3.org/2000/svg" role="img">\n`;
|
|
44
|
+
let cssVariables = `:root {\n`;
|
|
45
|
+
let sassVariables = `$icon-names: (\n`;
|
|
46
|
+
let jsVariables = [];
|
|
47
|
+
|
|
48
|
+
for (const file of icons) {
|
|
49
|
+
const name = path.basename(file, ".svg");
|
|
50
|
+
const fullPath = path.join(inputDir, file);
|
|
51
|
+
const svgContent = fs.readFileSync(fullPath, "utf8");
|
|
52
|
+
const root = parse(svgContent);
|
|
53
|
+
const svg = root.querySelector("svg");
|
|
54
|
+
const viewBox = svg.getAttribute("viewBox") || "0 0 32 32";
|
|
55
|
+
const innerContent = svg.innerHTML.trim();
|
|
56
|
+
const dataUri = svgToMiniDataURI(svgContent);
|
|
57
|
+
|
|
58
|
+
log("blue", ` Processing icon: ${name} (${fullPath})`);
|
|
59
|
+
if (!svg) {
|
|
60
|
+
log("red", ` Invalid SVG on file - ${file}`);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Sanitise the name to avoid issues with special characters (and space) on filename
|
|
65
|
+
const sanitisedName = name.replace(/[^a-zA-Z0-9\-_]/g, '-').toLowerCase();
|
|
66
|
+
if (sanitisedName !== name) {
|
|
67
|
+
log("yellow", ` Renaming icon: "${name}" to "${sanitisedName}"`);
|
|
68
|
+
}
|
|
69
|
+
spriteContent += ` <symbol id="${PREFIX_QGDS}${sanitisedName}" viewBox="${viewBox}">\n`;
|
|
70
|
+
spriteContent += ` ${innerContent}\n`;
|
|
71
|
+
spriteContent += ` </symbol>\n\n`;
|
|
72
|
+
|
|
73
|
+
cssVariables += ` --${PREFIX_QGDS}${sanitisedName}: url("${dataUri}");\n`;
|
|
74
|
+
|
|
75
|
+
sassVariables += ` ${sanitisedName},\n`;
|
|
76
|
+
|
|
77
|
+
jsVariables.push(sanitisedName);
|
|
78
|
+
}
|
|
79
|
+
spriteContent += `</svg>\n`;
|
|
80
|
+
cssVariables += `}\n`;
|
|
81
|
+
sassVariables += `);\n`;
|
|
82
|
+
|
|
83
|
+
fs.writeFileSync(outputIconSprite, spriteContent);
|
|
84
|
+
fs.writeFileSync(outputIconVars, cssVariables);
|
|
85
|
+
fs.writeFileSync(outputIconNames, sassVariables);
|
|
86
|
+
fs.writeFileSync(outputIconJs, `export default ${JSON.stringify(jsVariables, null, 2)};\n`);
|
|
87
|
+
|
|
88
|
+
log("magenta", `Successfully generated icons assets:
|
|
89
|
+
- Sprite file ${outputIconSprite}
|
|
90
|
+
- CSS variables ${outputIconVars}
|
|
91
|
+
- SASS names ${outputIconNames}
|
|
92
|
+
- JS names ${outputIconJs}
|
|
93
|
+
\n\n`);
|
|
94
|
+
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
build.onStart(() => {
|
|
98
|
+
regenerate();
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
<!-- VERSION_DETAILS={"project_id":"@qld-gov-au/qgds-bootstrap5","version":"1.1.
|
|
2
|
+
<!-- VERSION_DETAILS={"project_id":"@qld-gov-au/qgds-bootstrap5","version":"1.1.32","branch":"HEAD","tag":"v1.1.32","commit":"1d55b56ad069b4146612bbea841bb366a02dc355","majorVersion":"v1"} -->
|
|
3
3
|
|
|
4
4
|
{{! Select environment, used verbatium if not using predefind key
|
|
5
5
|
cdn := PROD|STAGING|BETA|TEST|DEV|???
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{{! Image template }}
|
|
2
|
+
{{#*inline "imageTag"}}
|
|
3
|
+
<img class="{{ ratioClass }} {{ otherClass }} {{ positionX }} {{ positionY }}"
|
|
4
|
+
src="{{ src }}"
|
|
5
|
+
alt="{{ alt }}"
|
|
6
|
+
{{~#if width}} width="{{ width }}{{ widthUnit }}"{{/if~}}
|
|
7
|
+
{{~#if height}} height="{{ height }}{{ heightUnit }}"{{/if~}}
|
|
8
|
+
{{~#if lazy}} loading="lazy"{{/if~}}
|
|
9
|
+
{{~#if style}} style="{{ style }}"{{/if~}}
|
|
10
|
+
{{~#if tabindex}} tabindex="{{ tabindex }}"{{/if~}}
|
|
11
|
+
{{~#if role}} role="{{ role }}"{{/if~}}
|
|
12
|
+
/>
|
|
13
|
+
{{/inline}}
|
|
14
|
+
|
|
15
|
+
{{#if src}}
|
|
16
|
+
{{#if caption}}
|
|
17
|
+
<figure class="{{ figureClass }}" {{#if width}}style="width:{{ width }}{{ widthUnit }}"{{/if}}>
|
|
18
|
+
{{> imageTag}}
|
|
19
|
+
<figcaption>{{ caption }}</figcaption>
|
|
20
|
+
</figure>
|
|
21
|
+
{{else}}
|
|
22
|
+
{{> imageTag}}
|
|
23
|
+
{{/if}}
|
|
24
|
+
{{/if}}
|