@qhealth-design-system/core 1.20.2 → 1.21.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/.storybook/globals.js +79 -69
- package/.storybook/main.js +2 -0
- package/.storybook/preview-head.html +1 -0
- package/.storybook/preview.js +2 -1
- package/.storybook/vite-plugin-hbs.js +52 -0
- package/.stylelintignore +5 -0
- package/.stylelintrc.json +24 -0
- package/CHANGELOG.md +2 -0
- package/eslint.config.mjs +60 -0
- package/package.json +25 -18
- package/prettier.config.js +17 -0
- package/src/component-loader.js +10 -0
- package/src/components/_global/css/cta_links/component.scss +1 -1
- package/src/components/_global/css/link_columns/component.scss +8 -0
- package/src/components/_global/css/table/component.scss +6 -118
- package/src/components/accordion/js/global.js +12 -13
- package/src/components/banner/html/component.hbs +31 -3
- package/src/components/banner_advanced/css/component.scss +298 -2
- package/src/components/basic_search/html/component.hbs +4 -4
- package/src/components/global_alert/js/global.js +31 -47
- package/src/components/in_page_navigation/html/component.hbs +9 -16
- package/src/components/in_page_navigation/js/global.js +25 -3
- package/src/components/main_navigation/js/global.js +1 -39
- package/src/components/mega_main_navigation/js/global.js +160 -158
- package/src/data/current.json +0 -187
- package/src/helpers/Handlebars/renderEncoded.js +9 -0
- package/src/html/home.html +1 -6
- package/src/html/inner-with-nav.html +1 -3
- package/src/stories/AZListing/a-z_listing.stories.js +72 -0
- package/src/stories/Abstract/abstract.stories.js +68 -0
- package/src/stories/BackToTop/BackToTop.stories.js +12 -22
- package/src/stories/Banner/banner.stories.js +76 -0
- package/src/stories/Banner/bannerAdvanced.stories.js +234 -0
- package/src/stories/Banner/bannerBasic.stories.js +105 -0
- package/src/stories/Body/body.stories.js +94 -0
- package/src/stories/Breadcrumbs/Breadcrumbs.stories.js +16 -21
- package/src/stories/Button/Button.stories.js +70 -0
- package/src/stories/CTALink/CTALink.stories.js +83 -31
- package/src/stories/Callout/Callout.stories.js +25 -35
- package/src/stories/Cards/CardFeature.stories.js +164 -0
- package/src/stories/Cards/CardMultiAction.stories.js +212 -0
- package/src/stories/Cards/CardNoAction.stories.js +201 -0
- package/src/stories/Cards/CardSingleAction.stories.js +197 -0
- package/src/stories/Cards/Toowoomba-web.jpeg +0 -0
- package/src/stories/DirectionLinks/DirectionLinks.stories.js +2 -8
- package/src/stories/Footer/Footer.stories.js +7 -13
- package/src/stories/{Checkboxes → Forms/Checkboxes}/Checkboxes.stories.js +4 -9
- package/src/stories/{RadioButtons → Forms/RadioButtons}/RadioButtons.stories.js +5 -10
- package/src/stories/{SelectBox → Forms/SelectBox}/SelectBox.stories.js +5 -10
- package/src/stories/Forms/forms.stories.js +188 -0
- package/src/stories/Forms/numberInput.stories.js +68 -0
- package/src/stories/Forms/textInput.stories.js +147 -0
- package/src/stories/Forms/textarea.stories.js +145 -0
- package/src/stories/GlobalAlert/GlobalAlert.stories.js +135 -0
- package/src/stories/Header/Header.js +2 -4
- package/src/stories/Header/Header.stories.js +5 -8
- package/src/stories/Iconography/Iconography.stories.js +2 -7
- package/src/stories/InPageAlert/InPageAlert.stories.js +27 -31
- package/src/stories/InPageNavigation/InPageNavigation.stories.js +89 -0
- package/src/stories/Introduction.mdx +3 -36
- package/src/stories/LinkColumns/LinkColumns.stories.js +35 -23
- package/src/stories/LoadingSpinner/LoadingSpinner.stories.js +11 -25
- package/src/stories/MegaMainNavigation/mega_main_navigation.a11y.stories.js +138 -0
- package/src/stories/MegaMainNavigation/mega_main_navigation.stories.js +245 -0
- package/src/stories/Navbar/Navbar.js +2 -5
- package/src/stories/Navbar/Navbar.stories.js +2 -12
- package/src/stories/Pagination/Pagination.stories.js +4 -10
- package/src/stories/PromoPanel/PromoPanel.stories.js +8 -44
- package/src/stories/Table/table.stories.js +112 -0
- package/src/stories/Tags/Tags.stories.js +3 -8
- package/src/stories/VideoPlayer/VideoPlayer.stories.js +8 -20
- package/src/styles/imports/utilities.scss +80 -0
- package/src/components/banner_intermediate/css/component.scss +0 -289
- package/src/components/banner_intermediate/html/component.hbs +0 -196
- package/src/components/banner_intermediate/js/global.js +0 -6
- package/src/components/banner_intermediate/js/manifest.json +0 -249
- package/src/components/card_no_action/js/global.js +0 -6
- package/src/html/component-a-z_listing.html +0 -57
- package/src/html/component-abstract.html +0 -582
- package/src/html/component-banner.html +0 -581
- package/src/html/component-banner_advanced.html +0 -70
- package/src/html/component-banner_basic.html +0 -55
- package/src/html/component-banner_intermediate.html +0 -64
- package/src/html/component-body.html +0 -605
- package/src/html/component-breadcrumbs.html +0 -583
- package/src/html/component-btn.html +0 -640
- package/src/html/component-callout.html +0 -582
- package/src/html/component-card_feature.html +0 -601
- package/src/html/component-card_multi_action.html +0 -1227
- package/src/html/component-card_no_action.html +0 -395
- package/src/html/component-card_single_action.html +0 -602
- package/src/html/component-footer.html +0 -583
- package/src/html/component-forms.html +0 -1612
- package/src/html/component-global_alert.html +0 -582
- package/src/html/component-header.html +0 -583
- package/src/html/component-in_page_navigation.html +0 -605
- package/src/html/component-loading_spinner.html +0 -45
- package/src/html/component-overflow_menu.html +0 -62
- package/src/html/component-page_alert.html +0 -582
- package/src/html/component-page_footer_info.html +0 -583
- package/src/html/component-pagination.html +0 -583
- package/src/html/component-promo_panel.html +0 -46
- package/src/html/component-tag_list.html +0 -1027
- package/src/html/component-video_player.html +0 -57
- package/src/stories/BackToTop/BackToTop.js +0 -8
- package/src/stories/BackToTop/BackToTop.mdx +0 -24
- package/src/stories/Breadcrumbs/Breadcrumbs.mdx +0 -30
- package/src/stories/CTALink/CTALink.mdx +0 -36
- package/src/stories/Callout/Callout.mdx +0 -28
- package/src/stories/Checkboxes/Checkboxes.mdx +0 -42
- package/src/stories/DirectionLinks/DirectionLinks.mdx +0 -34
- package/src/stories/Footer/Footer.mdx +0 -36
- package/src/stories/Header/Header.mdx +0 -61
- package/src/stories/Iconography/Iconography.mdx +0 -23
- package/src/stories/InPageAlert/InPageAlert.mdx +0 -64
- package/src/stories/LinkColumns/LinkColumns.mdx +0 -28
- package/src/stories/LoadingSpinner/LoadingSpinner.mdx +0 -30
- package/src/stories/Navbar/Navbar.mdx +0 -37
- package/src/stories/Pagination/Pagination.mdx +0 -26
- package/src/stories/PromoPanel/PromoPanel.mdx +0 -26
- package/src/stories/RadioButtons/RadioButtons.mdx +0 -42
- package/src/stories/SelectBox/SelectBox.mdx +0 -118
- package/src/stories/Tags/Tags.mdx +0 -63
- package/src/stories/VideoPlayer/VideoPlayer.mdx +0 -26
- /package/src/stories/{Checkboxes → Forms/Checkboxes}/Checkboxes.js +0 -0
- /package/src/stories/{RadioButtons → Forms/RadioButtons}/RadioButtons.js +0 -0
- /package/src/stories/{SelectBox → Forms/SelectBox}/SelectBox.js +0 -0
package/.storybook/globals.js
CHANGED
|
@@ -38,107 +38,117 @@ export const dummyText =
|
|
|
38
38
|
|
|
39
39
|
export const dummyLink = "https://www.google.com";
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
const dsBase = "https://www.designsystem.qld.gov.au";
|
|
42
|
+
const figmaBase = "https://www.figma.com/design/qKsxl3ogIlBp7dafgxXuCA/QGDS-UI-kit";
|
|
43
|
+
|
|
44
|
+
export const componentLinks = {
|
|
45
|
+
accordion: { ds: `${dsBase}/components/accordion` },
|
|
45
46
|
backToTop: {
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
ds: `${dsBase}/patterns/back-to-top`,
|
|
48
|
+
figma: `${figmaBase}?node-id=135268-27564&t=Gk55sISVPoJM2wm4-0`,
|
|
48
49
|
},
|
|
50
|
+
banner: { ds: `${dsBase}/components/banner`, figma: `${figmaBase}?node-id=120353-65175&t=Lne25vgTT2xUkJcD-0` },
|
|
49
51
|
breadcrumbs: {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
ds: `${dsBase}/components/breadcrumbs`,
|
|
53
|
+
figma: `${figmaBase}?node-id=5990-98076&p=f&t=4xsFBWGSPA5BjG6z-0`,
|
|
52
54
|
},
|
|
53
|
-
button: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
design: "https://www.figma.com/design/qKsxl3ogIlBp7dafgxXuCA/QGDS-UI-kit?node-id=5990-98115&p=f&t=3aGzWYalpb1UXS73-0",
|
|
59
|
-
ds: "https://www.designsystem.qld.gov.au/components/callout",
|
|
55
|
+
button: { ds: `${dsBase}/components/button`, figma: `${figmaBase}?node-id=5990-98058&p=f&t=pMQreNNlQuuKMxlD-0` },
|
|
56
|
+
callout: { ds: `${dsBase}/components/callout`, figma: `${figmaBase}?node-id=5990-98115&p=f&t=3aGzWYalpb1UXS73-0` },
|
|
57
|
+
card: {
|
|
58
|
+
ds: `${dsBase}/components/card`,
|
|
59
|
+
figma: `${figmaBase}?node-id=120360-98159&t=SzNNrsljtXa1LjkF-0`,
|
|
60
60
|
},
|
|
61
61
|
checkboxes: {
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
ds: `${dsBase}/components/checkbox`,
|
|
63
|
+
figma: `${figmaBase}?node-id=11056-321348&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
64
64
|
},
|
|
65
65
|
ctaLink: {
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
ds: `${dsBase}/components/call-to-action-cta`,
|
|
67
|
+
figma: `${figmaBase}?node-id=11056-321367&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
68
68
|
},
|
|
69
69
|
directionLinks: {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
ds: `${dsBase}/components/direction-link`,
|
|
71
|
+
figma: `${figmaBase}?node-id=11056-321363&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
72
72
|
},
|
|
73
|
+
footer: { ds: `${dsBase}/components/footer`, figma: `${figmaBase}?node-id=5990-97582&p=f&t=xM7nOPN0NPouiFDO-0` },
|
|
74
|
+
forms: { ds: `${dsBase}/components/forms` },
|
|
73
75
|
globalAlert: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
ds: `${dsBase}/components/global-alert`,
|
|
77
|
+
figma: `${figmaBase}?node-id=5990-97590&p=f&t=DWJ5IM0EPnQV6Sui-0`,
|
|
76
78
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
header: { ds: `${dsBase}/components/header`, figma: `${figmaBase}?node-id=5990-97586&p=f&t=UZuh698yg2zKvMDG-0` },
|
|
80
|
+
horizontalRule: {
|
|
81
|
+
ds: `${dsBase}/components/horizontal-rule`,
|
|
82
|
+
figma: `${figmaBase}?node-id=5990-97954&p=f&t=avPgpU6waAIMt5Tt-0`,
|
|
79
83
|
},
|
|
84
|
+
iconography: { ds: `${dsBase}/styles/iconography` },
|
|
80
85
|
inPageAlert: {
|
|
81
|
-
|
|
82
|
-
|
|
86
|
+
ds: `${dsBase}/components/alerts-in-page`,
|
|
87
|
+
figma: `${figmaBase}?node-id=5990-98125&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
83
88
|
},
|
|
84
89
|
inPageNavigation: {
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
ds: `${dsBase}/components/in-page-navigation`,
|
|
91
|
+
figma: `${figmaBase}?node-id=7905-252906&p=f&t=Tb6VtPPWrZ7Na35f-0`,
|
|
87
92
|
},
|
|
88
93
|
linkColumns: {
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
ds: `${dsBase}/components/link-columns-link-list`,
|
|
95
|
+
figma: `${figmaBase}?node-id=11056-321574&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
91
96
|
},
|
|
92
97
|
loadingSpinner: {
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
ds: `${dsBase}/components/loading-spinner`,
|
|
99
|
+
figma: `${figmaBase}?node-id=49314-16705&p=f&t=N6vEZVb73vuDEtRO-0`,
|
|
100
|
+
},
|
|
101
|
+
navbar: {
|
|
102
|
+
ds: `${dsBase}/components/navigation-horizontal`,
|
|
103
|
+
figma: `${figmaBase}?node-id=5990-97586&p=f&t=UZuh698yg2zKvMDG-0`,
|
|
95
104
|
},
|
|
96
105
|
pagination: {
|
|
97
|
-
|
|
98
|
-
|
|
106
|
+
ds: `${dsBase}/components/pagination`,
|
|
107
|
+
figma: `${figmaBase}?node-id=11056-321779&p=f&t=wdrRF6qJa1fuzxWP-0`,
|
|
99
108
|
},
|
|
100
109
|
promoPanel: {
|
|
101
|
-
|
|
102
|
-
|
|
110
|
+
ds: `${dsBase}/components/promotional-panel`,
|
|
111
|
+
figma: `${figmaBase}?node-id=23269-286312&p=f&t=ub7vIB4rUQNZ6zzo-0`,
|
|
103
112
|
},
|
|
104
113
|
radioButtons: {
|
|
105
|
-
|
|
106
|
-
|
|
114
|
+
ds: `${dsBase}/components/radio-buttons`,
|
|
115
|
+
figma: `${figmaBase}?node-id=11056-321347&p=f&t=kHfUZsyKYuDkprji-0`,
|
|
107
116
|
},
|
|
108
117
|
selectBox: {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
tabs: {
|
|
113
|
-
design: "https://www.figma.com/design/qKsxl3ogIlBp7dafgxXuCA/QGDS-UI-kit?node-id=25951-236134&p=f&t=pMQreNNlQuuKMxlD-0",
|
|
114
|
-
ds: "https://www.designsystem.qld.gov.au/components/tabs",
|
|
115
|
-
},
|
|
116
|
-
tags: {
|
|
117
|
-
design: "https://www.figma.com/design/qKsxl3ogIlBp7dafgxXuCA/QGDS-UI-kit?node-id=5990-97596&p=f&t=WmKMIp3MbkVrYkUf-0",
|
|
118
|
-
ds: "https://www.designsystem.qld.gov.au/components/tags",
|
|
118
|
+
ds: `${dsBase}/components/input-fields-select-box`,
|
|
119
|
+
figma: `${figmaBase}?node-id=11056-321345&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
119
120
|
},
|
|
121
|
+
table: { ds: `${dsBase}/components/table`, figma: `${figmaBase}?node-id=120418-57729&t=VPLTzrxLs85peK9J-0` },
|
|
122
|
+
tabs: { ds: `${dsBase}/components/tabs`, figma: `${figmaBase}?node-id=25951-236134&p=f&t=pMQreNNlQuuKMxlD-0` },
|
|
123
|
+
tags: { ds: `${dsBase}/components/tags`, figma: `${figmaBase}?node-id=5990-97596&p=f&t=WmKMIp3MbkVrYkUf-0` },
|
|
120
124
|
textInput: {
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
ds: `${dsBase}/components/text-input`,
|
|
126
|
+
figma: `${figmaBase}?node-id=5990-97997&p=f&t=yRd2EKrtkEkPbBDT-0`,
|
|
123
127
|
},
|
|
124
128
|
videoPlayer: {
|
|
125
|
-
|
|
126
|
-
ds: "https://www.designsystem.qld.gov.au/components",
|
|
127
|
-
},
|
|
128
|
-
header: {
|
|
129
|
-
design: "https://www.figma.com/design/qKsxl3ogIlBp7dafgxXuCA/QGDS-UI-kit?node-id=5990-97586&p=f&t=UZuh698yg2zKvMDG-0",
|
|
130
|
-
ds: "https://www.designsystem.qld.gov.au/components/header",
|
|
131
|
-
},
|
|
132
|
-
horizontalRule: {
|
|
133
|
-
design: "https://www.figma.com/design/qKsxl3ogIlBp7dafgxXuCA/QGDS-UI-kit?node-id=5990-97954&p=f&t=avPgpU6waAIMt5Tt-0",
|
|
134
|
-
ds: "https://www.designsystem.qld.gov.au/components/horizontal-rule",
|
|
135
|
-
},
|
|
136
|
-
navbar: {
|
|
137
|
-
design: "https://www.figma.com/design/qKsxl3ogIlBp7dafgxXuCA/QGDS-UI-kit?node-id=5990-97586&p=f&t=UZuh698yg2zKvMDG-0",
|
|
138
|
-
ds: "https://www.designsystem.qld.gov.au/components/navigation-horizontal",
|
|
139
|
-
},
|
|
140
|
-
footer: {
|
|
141
|
-
design: "https://www.figma.com/design/qKsxl3ogIlBp7dafgxXuCA/QGDS-UI-kit?node-id=5990-97582&p=f&t=xM7nOPN0NPouiFDO-0",
|
|
142
|
-
ds: "https://www.designsystem.qld.gov.au/components/footer",
|
|
129
|
+
figma: `${figmaBase}?node-id=13297-214065&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
143
130
|
},
|
|
144
131
|
};
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Standard docs parameters for a story.
|
|
135
|
+
* Renders a Resources line at the top of autodocs with links to the QLD Design System
|
|
136
|
+
* and Figma (when available). Both are looked up automatically from the component key.
|
|
137
|
+
*
|
|
138
|
+
* @param {keyof typeof componentLinks} componentKey
|
|
139
|
+
*/
|
|
140
|
+
export function storyParams(componentKey) {
|
|
141
|
+
const { ds, figma } = componentLinks[componentKey] ?? {};
|
|
142
|
+
const links = ds ? [`[QLD Design System ↗](${ds})`] : [];
|
|
143
|
+
if (figma) links.push(`[Figma UI Kit ↗](${figma})`);
|
|
144
|
+
return {
|
|
145
|
+
docs: {
|
|
146
|
+
toc: true,
|
|
147
|
+
codePanel: true,
|
|
148
|
+
description: {
|
|
149
|
+
component: `**Resources:** ${links.join(" · ")}`,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
...(figma && { design: { type: "figma", url: figma } }),
|
|
153
|
+
};
|
|
154
|
+
}
|
package/.storybook/main.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @type { import('@storybook/html-vite').StorybookConfig } */
|
|
2
2
|
import sassGlobImports from "vite-plugin-sass-glob-import";
|
|
3
|
+
import hbsPlugin from "./vite-plugin-hbs.js"
|
|
3
4
|
|
|
4
5
|
const config = {
|
|
5
6
|
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
@@ -10,6 +11,7 @@ const config = {
|
|
|
10
11
|
},
|
|
11
12
|
async viteFinal(config) {
|
|
12
13
|
config.plugins.push(sassGlobImports());
|
|
14
|
+
config.plugins.push(hbsPlugin())
|
|
13
15
|
return config;
|
|
14
16
|
},
|
|
15
17
|
staticDirs: ["../dist/mysource_files/img", "./core-assets", "./assets"],
|
package/.storybook/preview.js
CHANGED
|
@@ -21,6 +21,7 @@ const iconsIds = fetch(getSvgPath())
|
|
|
21
21
|
|
|
22
22
|
/** @type { import('@storybook/html-vite').Preview } */
|
|
23
23
|
const preview = {
|
|
24
|
+
tags: ["autodocs"],
|
|
24
25
|
parameters: {
|
|
25
26
|
controls: {
|
|
26
27
|
matchers: {
|
|
@@ -97,7 +98,7 @@ const preview = {
|
|
|
97
98
|
return storyFn();
|
|
98
99
|
}
|
|
99
100
|
// Get the theme key from the background, to use within the decorator
|
|
100
|
-
const themeKey = Object.keys(themeColours).find((key) =>
|
|
101
|
+
const themeKey = Object.keys(themeColours).find((key) => key === context.globals.backgrounds?.value);
|
|
101
102
|
const wrapper = document.createElement("div");
|
|
102
103
|
wrapper.className = themes[themeKey] || themes["white"];
|
|
103
104
|
const story = storyFn();
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import Handlebars from 'handlebars';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Vite plugin that transforms Handlebars component templates (.hbs)
|
|
5
|
+
* into pre-compiled JavaScript modules for use in Storybook.
|
|
6
|
+
*
|
|
7
|
+
* Without this plugin, Vite cannot handle .hbs files. Stories would need to import
|
|
8
|
+
* templates as raw strings (?raw) and call Handlebars.compile() at runtime in the
|
|
9
|
+
* browser on every render. This plugin moves compilation to build time instead.
|
|
10
|
+
*
|
|
11
|
+
* How it works:
|
|
12
|
+
* 1. Vite intercepts any import ending in .hbs
|
|
13
|
+
* 2. Handlebars.precompile() converts the template source into a serialisable
|
|
14
|
+
* template spec (a plain JS object) at build time in Node
|
|
15
|
+
* 3. The plugin emits a JS module that calls Handlebars.template(spec) to wrap
|
|
16
|
+
* the spec in a callable function — no parsing or compilation in the browser
|
|
17
|
+
*
|
|
18
|
+
* The emitted module imports the full 'handlebars' package (not 'handlebars/runtime')
|
|
19
|
+
* so that custom helpers registered in .storybook/core-assets/handlebar-helpers.js
|
|
20
|
+
* are available on the same Handlebars instance at runtime.
|
|
21
|
+
*
|
|
22
|
+
* Usage in a story:
|
|
23
|
+
* import Template from './html/component.hbs';
|
|
24
|
+
* Template({ component: { data: { metadata: { ... } } } }); // → HTML string
|
|
25
|
+
*
|
|
26
|
+
* Note: Files imported with the ?raw suffix bypass this plugin entirely — Vite's
|
|
27
|
+
* built-in raw loader handles those and returns the template source as a string.
|
|
28
|
+
*
|
|
29
|
+
* @returns {import('vite').Plugin}
|
|
30
|
+
*/
|
|
31
|
+
export default function hbsPlugin() {
|
|
32
|
+
return {
|
|
33
|
+
name: 'vite-plugin-hbs',
|
|
34
|
+
|
|
35
|
+
transform(src, id) {
|
|
36
|
+
if (!id.endsWith('.hbs')) return;
|
|
37
|
+
|
|
38
|
+
const templateSpec = Handlebars.precompile(src);
|
|
39
|
+
|
|
40
|
+
const code = `
|
|
41
|
+
import Handlebars from 'handlebars';
|
|
42
|
+
const template = Handlebars.template(${templateSpec});
|
|
43
|
+
export default template;
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
code,
|
|
48
|
+
map: null,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
package/.stylelintignore
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["stylelint-config-standard"],
|
|
3
|
+
"plugins": ["stylelint-scss"],
|
|
4
|
+
"rules": {
|
|
5
|
+
"selector-class-pattern": [
|
|
6
|
+
"^[a-z][a-z0-9-]*(__[a-z0-9][a-z0-9_-]*)*(--[a-z0-9][a-z0-9-]*)?$",
|
|
7
|
+
{ "message": "Expected class selector to use BEM naming convention" }
|
|
8
|
+
],
|
|
9
|
+
"custom-property-pattern": null
|
|
10
|
+
},
|
|
11
|
+
"overrides": [
|
|
12
|
+
{
|
|
13
|
+
"files": ["**/*.scss"],
|
|
14
|
+
"customSyntax": "postcss-scss",
|
|
15
|
+
"rules": {
|
|
16
|
+
"at-rule-no-unknown": null,
|
|
17
|
+
"scss/at-rule-no-unknown": true,
|
|
18
|
+
"function-no-unknown": null,
|
|
19
|
+
"no-descending-specificity": null,
|
|
20
|
+
"annotation-no-unknown": null
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
import json from "@eslint/json";
|
|
4
|
+
import markdown from "@eslint/markdown";
|
|
5
|
+
import css from "@eslint/css";
|
|
6
|
+
import { defineConfig, globalIgnores } from "eslint/config";
|
|
7
|
+
import eslintConfigPrettier from "eslint-config-prettier/flat";
|
|
8
|
+
import storybook from "eslint-plugin-storybook";
|
|
9
|
+
|
|
10
|
+
export default defineConfig([
|
|
11
|
+
globalIgnores(["!.storybook"], "Include Storybook Directory"),
|
|
12
|
+
globalIgnores(["storybook-static", "*.min.js", "src/externals", "dist"]),
|
|
13
|
+
{
|
|
14
|
+
files: ["src/**/*.js", ".storybook/**/*.js"],
|
|
15
|
+
plugins: { js },
|
|
16
|
+
extends: ["js/recommended"],
|
|
17
|
+
languageOptions: {
|
|
18
|
+
sourceType: "module",
|
|
19
|
+
globals: globals.browser,
|
|
20
|
+
parserOptions: {
|
|
21
|
+
allowImportExportEverywhere: true,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
rules: {
|
|
25
|
+
"no-const-assign": "warn",
|
|
26
|
+
"no-this-before-super": "warn",
|
|
27
|
+
"no-undef": "warn",
|
|
28
|
+
"no-unreachable": "warn",
|
|
29
|
+
"no-unused-vars": "warn",
|
|
30
|
+
"constructor-super": "warn",
|
|
31
|
+
"valid-typeof": "warn",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
files: ["webpack/**/*.js", "scripts/**/*.js", "*.config.js", "postcss.config.js"],
|
|
36
|
+
plugins: { js },
|
|
37
|
+
extends: ["js/recommended"],
|
|
38
|
+
languageOptions: {
|
|
39
|
+
sourceType: "commonjs",
|
|
40
|
+
globals: globals.node,
|
|
41
|
+
parserOptions: {
|
|
42
|
+
allowImportExportEverywhere: true,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
rules: {
|
|
46
|
+
"no-const-assign": "warn",
|
|
47
|
+
"no-this-before-super": "warn",
|
|
48
|
+
"no-undef": "warn",
|
|
49
|
+
"no-unreachable": "warn",
|
|
50
|
+
"no-unused-vars": "warn",
|
|
51
|
+
"constructor-super": "warn",
|
|
52
|
+
"valid-typeof": "warn",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{ files: ["**/*.json"], plugins: { json }, language: "json/json", extends: ["json/recommended"] },
|
|
56
|
+
{ files: ["**/*.md"], plugins: { markdown }, language: "markdown/gfm", extends: ["markdown/recommended"] },
|
|
57
|
+
{ files: ["**/*.css"], plugins: { css }, language: "css/css", extends: ["css/recommended"] },
|
|
58
|
+
eslintConfigPrettier,
|
|
59
|
+
...storybook.configs["flat/recommended"],
|
|
60
|
+
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qhealth-design-system/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"serve": "webpack-dev-server --open --config webpack/webpack.dev.js",
|
|
15
15
|
"add-component": "bash scripts/add_component.sh",
|
|
16
16
|
"jsdoc": "./node_modules/jsdoc/jsdoc.js -a all -c jsdoc.json -r -R README.md ./src/components/ -d ./documentation/jsdoc",
|
|
17
|
-
"lint:js": "eslint
|
|
18
|
-
"lint:styles": "stylelint \"
|
|
17
|
+
"lint:js": "eslint .",
|
|
18
|
+
"lint:styles": "stylelint \"**/*.{css,scss}\"",
|
|
19
19
|
"lint": "npm run lint:js && npm run lint:styles",
|
|
20
20
|
"build-storybook": "node .storybook/prepare-storybook.js && storybook build",
|
|
21
21
|
"storybook": "storybook dev -p 6006",
|
|
@@ -26,24 +26,30 @@
|
|
|
26
26
|
"license": "ISC",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/core": "^7.22.5",
|
|
29
|
-
"@babel/eslint-parser": "^7.22.9",
|
|
30
29
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
31
30
|
"@babel/preset-env": "^7.22.5",
|
|
32
31
|
"@babel/preset-react": "^7.22.5",
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
32
|
+
"@eslint/css": "^1.3.0",
|
|
33
|
+
"@eslint/js": "^10.0.1",
|
|
34
|
+
"@eslint/json": "^2.0.0",
|
|
35
|
+
"@eslint/markdown": "^8.0.2",
|
|
36
|
+
"@poliklot/prettier-plugin-handlebars": "^0.2.12",
|
|
37
|
+
"@storybook/addon-a11y": "^10.4.0",
|
|
38
|
+
"@storybook/addon-designs": "^11.1.3",
|
|
39
|
+
"@storybook/addon-docs": "^10.4.0",
|
|
40
|
+
"@storybook/addon-themes": "^10.4.0",
|
|
41
|
+
"@storybook/html-vite": "^10.4.0",
|
|
38
42
|
"autoprefixer": "^10.4.14",
|
|
39
|
-
"chromatic": "^
|
|
43
|
+
"chromatic": "^17.0.0",
|
|
40
44
|
"copy-webpack-plugin": "^11.0.0",
|
|
41
45
|
"core-js": "^3.31.0",
|
|
42
46
|
"css-loader": "^5.2.6",
|
|
43
|
-
"eslint": "^
|
|
44
|
-
"eslint-
|
|
45
|
-
"eslint-
|
|
47
|
+
"eslint": "^10.4.1",
|
|
48
|
+
"eslint-config-prettier": "^10.1.8",
|
|
49
|
+
"eslint-plugin-storybook": "^10.4.0",
|
|
50
|
+
"eslint-webpack-plugin": "^6.0.0",
|
|
46
51
|
"glob": "^7.2.0",
|
|
52
|
+
"globals": "^17.6.0",
|
|
47
53
|
"handlebars": "^4.7.8",
|
|
48
54
|
"html-loader": "^0.5.5",
|
|
49
55
|
"html-webpack-plugin": "^5.5.3",
|
|
@@ -52,15 +58,16 @@
|
|
|
52
58
|
"jsdoc": "^4.0.2",
|
|
53
59
|
"mini-css-extract-plugin": "^2.7.6",
|
|
54
60
|
"postcss-loader": "^7.3.3",
|
|
61
|
+
"postcss-scss": "^4.0.9",
|
|
62
|
+
"prettier": "3.8.3",
|
|
55
63
|
"sass": "^1.63.6",
|
|
56
64
|
"sass-loader": "^13.3.2",
|
|
57
|
-
"storybook": "^10.
|
|
65
|
+
"storybook": "^10.4.0",
|
|
58
66
|
"string-replace-loader": "^3.1.0",
|
|
59
67
|
"style-loader": "^3.3.3",
|
|
60
|
-
"stylelint": "^
|
|
61
|
-
"stylelint-config-standard": "^
|
|
62
|
-
"stylelint-scss": "^
|
|
63
|
-
"stylelint-webpack-plugin": "^4.1.1",
|
|
68
|
+
"stylelint": "^17.12.0",
|
|
69
|
+
"stylelint-config-standard": "^40.0.0",
|
|
70
|
+
"stylelint-scss": "^7.1.0",
|
|
64
71
|
"terser-webpack-plugin": "^5.3.9",
|
|
65
72
|
"url-loader": "^4.1.1",
|
|
66
73
|
"vite": "^7.2.6",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @type {import("prettier").Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
printWidth: 240,
|
|
4
|
+
semi: true,
|
|
5
|
+
tabWidth: 4,
|
|
6
|
+
singleQuote: false,
|
|
7
|
+
trailingComma: "all",
|
|
8
|
+
plugins: ["@poliklot/prettier-plugin-handlebars"],
|
|
9
|
+
overrides: [
|
|
10
|
+
{
|
|
11
|
+
files: ["*.hbs", "*.handlebars"],
|
|
12
|
+
options: {
|
|
13
|
+
parser: "handlebars",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
};
|
package/src/component-loader.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Global utilities (sets up window.QLD / QLD.utils) — must load before any init runs
|
|
2
|
+
import "./components/_global/js/global.js";
|
|
3
|
+
|
|
1
4
|
// Standard components
|
|
2
5
|
import initHeader from "./components/header/js/global.js";
|
|
3
6
|
import initInPageNavigation from "./components/in_page_navigation/js/global.js";
|
|
@@ -5,6 +8,8 @@ import initInternalNavigation from "./components/internal_navigation/js/global.j
|
|
|
5
8
|
import initLeftHandNav from "./components/left_hand_navigation/js/global.js";
|
|
6
9
|
import initPromoPanel from "./components/promo_panel/js/global.js";
|
|
7
10
|
import initVideoPlayer from "./components/video_player/js/global.js";
|
|
11
|
+
import { initMegaMenu } from "./components/mega_main_navigation/js/global";
|
|
12
|
+
import { initGlobalAlert } from "./components/global_alert/js/global.js";
|
|
8
13
|
|
|
9
14
|
// Global components
|
|
10
15
|
import initCtaLinks from "./components/_global/js/cta_links/global.js";
|
|
@@ -12,12 +17,17 @@ import initSelectBoxes from "./components/_global/js/select_boxes/global.js";
|
|
|
12
17
|
|
|
13
18
|
// Adding ES module initialisation for components
|
|
14
19
|
export default function initComponents() {
|
|
20
|
+
// Call initGlobalAlert outside the DOMContentLoaded callback so it executes immediately. There is a noticeable
|
|
21
|
+
// delay before the DOMContentLoaded event fires, which can cause dismissed global alerts to stay visible for a few
|
|
22
|
+
// seconds before they are removed. Likely to remove DOMContentLoaded event listener in the future.
|
|
23
|
+
initGlobalAlert();
|
|
15
24
|
document.addEventListener("DOMContentLoaded", () => {
|
|
16
25
|
initCtaLinks(document);
|
|
17
26
|
initHeader(document);
|
|
18
27
|
initInPageNavigation(document);
|
|
19
28
|
initInternalNavigation(document);
|
|
20
29
|
initLeftHandNav(document);
|
|
30
|
+
initMegaMenu();
|
|
21
31
|
initPromoPanel(document);
|
|
22
32
|
initSelectBoxes(document);
|
|
23
33
|
initVideoPlayer(document);
|
|
@@ -43,6 +43,14 @@
|
|
|
43
43
|
padding-right: 2rem;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
// Rule that ensures that if a cta-link is used in the link columns, the correct arrow is displayed
|
|
47
|
+
a.qld__cta-link:not(.qld__cta-link--view-all) {
|
|
48
|
+
&::before,
|
|
49
|
+
&::after {
|
|
50
|
+
display: none;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
&::before {
|
|
47
55
|
@include QLD-space(margin, 0 0.5unit 0 0.5unit);
|
|
48
56
|
flex: 0 0 auto;
|