@qhealth-design-system/core 1.21.1 → 1.22.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/.prettierignore +14 -0
- package/.storybook/assets/storybook.scss +39 -39
- package/.storybook/decorators.js +36 -0
- package/.storybook/globals.js +192 -128
- package/.storybook/helper-functions.js +50 -7
- package/.storybook/main.js +20 -13
- package/.storybook/prepare-storybook.js +14 -14
- package/.storybook/preview-head.html +4 -1
- package/.storybook/preview.js +83 -80
- package/.storybook/vite-plugin-hbs.js +13 -13
- package/.stylelintrc.json +23 -23
- package/CHANGELOG.md +2 -0
- package/README.md +56 -520
- package/chromatic.config.json +5 -0
- package/eslint.config.mjs +71 -51
- package/package.json +95 -87
- package/prettier.config.js +10 -14
- package/src/component-loader.js +39 -15
- package/src/components/_global/css/admin/component.scss +112 -112
- package/src/components/_global/css/body/component.scss +944 -924
- package/src/components/_global/css/btn/component.scss +518 -512
- package/src/components/_global/css/cta_links/component.scss +192 -192
- package/src/components/_global/css/direction_links/component.scss +98 -98
- package/src/components/_global/css/example/component.scss +43 -37
- package/src/components/_global/css/flex/flexbox-utility-classes.scss +586 -594
- package/src/components/_global/css/forms/control_inputs/component.scss +269 -266
- package/src/components/_global/css/forms/general/component.scss +210 -210
- package/src/components/_global/css/forms/select/component.scss +324 -312
- package/src/components/_global/css/forms/text/component.scss +358 -348
- package/src/components/_global/css/global.scss +14 -15
- package/src/components/_global/css/grid-12/component.scss +254 -260
- package/src/components/_global/css/headings/component.scss +153 -153
- package/src/components/_global/css/icons/component.scss +115 -115
- package/src/components/_global/css/img/images.scss +64 -62
- package/src/components/_global/css/link_columns/component.scss +199 -199
- package/src/components/_global/css/link_list/component.scss +33 -33
- package/src/components/_global/css/links/components.scss +61 -57
- package/src/components/_global/css/modal/component.scss +162 -162
- package/src/components/_global/css/table/component.scss +274 -272
- package/src/components/_global/css/tabs/component.scss +26 -26
- package/src/components/_global/css/tags/component.scss +307 -307
- package/src/components/_global/css/toggle_and_tool_tip/component.scss +199 -195
- package/src/components/_global/css/user_location/component.scss +35 -33
- package/src/components/_global/css/version/component.scss +37 -37
- package/src/components/_global/html/component.hbs +130 -77
- package/src/components/_global/html/ds_component.hbs +21 -24
- package/src/components/_global/html/head.html +16 -5
- package/src/components/_global/html/scripts.html +15 -15
- package/src/components/_global/js/_polyfills/global.js +12 -11
- package/src/components/_global/js/animate/global.js +303 -319
- package/src/components/_global/js/collapsible.js +203 -0
- package/src/components/_global/js/cta_links/global.js +19 -14
- package/src/components/_global/js/global.js +316 -309
- package/src/components/_global/js/manifest.json +9 -10
- package/src/components/_global/js/modal/global.js +241 -224
- package/src/components/_global/js/popover/controller.js +168 -0
- package/src/components/_global/js/popover/position.js +372 -0
- package/src/components/_global/js/select_boxes/global.js +21 -18
- package/src/components/_global/js/tabs/global.js +305 -301
- package/src/components/_template/css/component.scss +10 -15
- package/src/components/_template/html/component-page.html +57 -61
- package/src/components/_template/html/component.hbs +3 -3
- package/src/components/_template/js/global.js +2 -5
- package/src/components/_template/js/manifest.json +39 -39
- package/src/components/a-z_listing/css/component.scss +124 -127
- package/src/components/a-z_listing/html/component.hbs +15 -13
- package/src/components/a-z_listing/js/global.js +93 -75
- package/src/components/a-z_listing/js/manifest.json +13594 -13553
- package/src/components/abstract/css/component.scss +63 -65
- package/src/components/abstract/html/component.hbs +8 -7
- package/src/components/abstract/js/manifest.json +28 -28
- package/src/components/accordion/css/component.scss +253 -247
- package/src/components/accordion/html/accordion-group.html +158 -152
- package/src/components/accordion/html/component.hbs +43 -30
- package/src/components/accordion/html/default.html +94 -87
- package/src/components/accordion/js/global.js +171 -449
- package/src/components/accordion/js/manifest.json +475 -440
- package/src/components/banner/css/component.scss +450 -434
- package/src/components/banner/html/component.hbs +148 -97
- package/src/components/banner/js/manifest.json +9 -10
- package/src/components/banner_advanced/css/component.scss +210 -226
- package/src/components/banner_advanced/html/component.hbs +425 -233
- package/src/components/banner_advanced/js/global.js +13 -4
- package/src/components/banner_advanced/js/manifest.json +1502 -1502
- package/src/components/banner_basic/css/component.scss +34 -40
- package/src/components/banner_basic/html/component.hbs +214 -132
- package/src/components/banner_basic/js/global.js +2 -5
- package/src/components/banner_basic/js/manifest.json +92 -92
- package/src/components/basic_search/css/component.scss +208 -202
- package/src/components/basic_search/html/component.hbs +724 -366
- package/src/components/basic_search/js/global.js +80 -63
- package/src/components/basic_search/js/manifest.json +771 -797
- package/src/components/body/css/component.scss +7 -8
- package/src/components/body/html/component.hbs +13 -4
- package/src/components/body/js/manifest.json +47 -47
- package/src/components/breadcrumbs/css/component.scss +176 -171
- package/src/components/breadcrumbs/html/component.hbs +82 -50
- package/src/components/breadcrumbs/js/global.js +279 -219
- package/src/components/breadcrumbs/js/manifest.json +8 -8
- package/src/components/callout/css/component.scss +124 -120
- package/src/components/callout/html/component.hbs +36 -25
- package/src/components/callout/js/manifest.json +126 -126
- package/src/components/card_feature/css/component.scss +66 -66
- package/src/components/card_feature/html/component.hbs +179 -104
- package/src/components/card_feature/js/manifest.json +1487 -1456
- package/src/components/card_multi_action/css/component.scss +234 -208
- package/src/components/card_multi_action/html/component.hbs +315 -177
- package/src/components/card_multi_action/js/manifest.json +1372 -1312
- package/src/components/card_no_action/css/component.scss +536 -524
- package/src/components/card_no_action/html/component.hbs +134 -114
- package/src/components/card_no_action/js/global.js +15 -0
- package/src/components/card_no_action/js/manifest.json +1314 -1277
- package/src/components/card_single_action/css/component.scss +111 -104
- package/src/components/card_single_action/html/component.hbs +285 -139
- package/src/components/card_single_action/js/manifest.json +1317 -1284
- package/src/components/code/css/component.scss +365 -353
- package/src/components/code/html/component.hbs +430 -157
- package/src/components/code/js/global.js +243 -180
- package/src/components/code/js/manifest.json +189 -177
- package/src/components/file_upload/css/component.scss +387 -387
- package/src/components/file_upload/html/component.hbs +86 -41
- package/src/components/file_upload/js/global.js +960 -813
- package/src/components/file_upload/js/manifest.json +61 -61
- package/src/components/footer/css/component.scss +428 -420
- package/src/components/footer/html/component.hbs +314 -191
- package/src/components/footer/js/manifest.json +8 -8
- package/src/components/global_alert/css/component.scss +210 -210
- package/src/components/global_alert/html/component.hbs +278 -125
- package/src/components/global_alert/js/global.js +32 -27
- package/src/components/global_alert/js/manifest.json +8 -8
- package/src/components/header/css/component.scss +518 -516
- package/src/components/header/html/component.hbs +281 -132
- package/src/components/header/js/global.js +157 -141
- package/src/components/header/js/manifest.json +8 -9
- package/src/components/horizontal_rule/css/component.scss +52 -52
- package/src/components/horizontal_rule/html/component.hbs +21 -5
- package/src/components/horizontal_rule/js/manifest.json +69 -69
- package/src/components/in_page_navigation/css/component.scss +42 -42
- package/src/components/in_page_navigation/html/component.hbs +13 -9
- package/src/components/in_page_navigation/js/global.js +78 -57
- package/src/components/in_page_navigation/js/manifest.json +34 -34
- package/src/components/internal_navigation/css/component.scss +294 -286
- package/src/components/internal_navigation/html/component.hbs +70 -51
- package/src/components/internal_navigation/js/global.js +36 -27
- package/src/components/internal_navigation/js/manifest.json +9 -10
- package/src/components/left_hand_navigation/css/component.scss +322 -309
- package/src/components/left_hand_navigation/html/component.hbs +136 -81
- package/src/components/left_hand_navigation/js/global.js +44 -30
- package/src/components/left_hand_navigation/js/manifest.json +39 -39
- package/src/components/loading_spinner/css/component.scss +57 -66
- package/src/components/loading_spinner/html/component.hbs +20 -4
- package/src/components/loading_spinner/js/global.js +2 -5
- package/src/components/loading_spinner/js/manifest.json +48 -48
- package/src/components/main_navigation/css/component.scss +713 -675
- package/src/components/main_navigation/html/component.hbs +222 -85
- package/src/components/main_navigation/js/global.js +355 -372
- package/src/components/main_navigation/js/manifest.json +9 -10
- package/src/components/mega_main_navigation/css/component.scss +504 -485
- package/src/components/mega_main_navigation/html/component.hbs +337 -145
- package/src/components/mega_main_navigation/js/global.js +133 -113
- package/src/components/mega_main_navigation/js/manifest.json +8 -8
- package/src/components/multi_column/css/component.scss +5 -5
- package/src/components/multi_column/html/component.hbs +404 -399
- package/src/components/multi_column/js/manifest.json +1203 -1203
- package/src/components/overflow_menu/css/component.scss +153 -152
- package/src/components/overflow_menu/html/component.hbs +82 -39
- package/src/components/overflow_menu/js/global.js +90 -5
- package/src/components/overflow_menu/js/manifest.json +39 -39
- package/src/components/page_alert/css/component.scss +127 -127
- package/src/components/page_alert/html/component.hbs +78 -32
- package/src/components/page_alert/js/manifest.json +77 -77
- package/src/components/pagination/css/component.scss +261 -250
- package/src/components/pagination/html/component.hbs +79 -38
- package/src/components/pagination/html/default.html +31 -22
- package/src/components/pagination/js/manifest.json +51 -51
- package/src/components/prefooter/css/component.scss +52 -45
- package/src/components/prefooter/html/component.hbs +97 -90
- package/src/components/prefooter/js/manifest.json +7 -7
- package/src/components/promo_panel/css/component.scss +810 -754
- package/src/components/promo_panel/html/component.hbs +173 -101
- package/src/components/promo_panel/js/global.js +23 -20
- package/src/components/promo_panel/js/manifest.json +223 -223
- package/src/components/search_box/css/component.scss +80 -79
- package/src/components/search_box/html/component.html +24 -12
- package/src/components/search_box/js/manifest.json +72 -72
- package/src/components/tab/css/component.scss +924 -814
- package/src/components/tab/html/component.hbs +576 -153
- package/src/components/tab/js/global.js +203 -297
- package/src/components/tab/js/manifest.json +917 -892
- package/src/components/toggle_tip/css/component.scss +3 -3
- package/src/components/toggle_tip/js/global.js +136 -137
- package/src/components/tool_tip/css/component.scss +3 -3
- package/src/components/tool_tip/js/global.js +95 -98
- package/src/components/video_player/css/component.scss +204 -211
- package/src/components/video_player/html/component.hbs +250 -138
- package/src/components/video_player/js/global.js +31 -14
- package/src/components/video_player/js/manifest.json +207 -207
- package/src/data/current.json +385 -433
- package/src/data/current_admin.json +13 -13
- package/src/data/model_component.js +13 -13
- package/src/data/site.json +967 -967
- package/src/helpers/Handlebars/appendIf.js +5 -5
- package/src/helpers/Handlebars/arrayLength.js +2 -2
- package/src/helpers/Handlebars/arrayWith.js +9 -11
- package/src/helpers/Handlebars/capitaliseFirst.js +8 -8
- package/src/helpers/Handlebars/charMax.js +6 -7
- package/src/helpers/Handlebars/checkIf.js +38 -18
- package/src/helpers/Handlebars/columnWidth.js +32 -35
- package/src/helpers/Handlebars/contains.js +4 -4
- package/src/helpers/Handlebars/createMap.js +15 -15
- package/src/helpers/Handlebars/dsMapFromID.js +8 -8
- package/src/helpers/Handlebars/dsMapFromProp.js +8 -8
- package/src/helpers/Handlebars/eachByName.js +19 -15
- package/src/helpers/Handlebars/eachDS.js +7 -7
- package/src/helpers/Handlebars/eachFrom.js +12 -12
- package/src/helpers/Handlebars/eachUpTo.js +7 -7
- package/src/helpers/Handlebars/eachWhen.js +30 -29
- package/src/helpers/Handlebars/formatDate.js +53 -53
- package/src/helpers/Handlebars/generateDates.js +75 -61
- package/src/helpers/Handlebars/getDistance.js +33 -32
- package/src/helpers/Handlebars/getObject.js +2 -2
- package/src/helpers/Handlebars/getParamaterByName.js +11 -11
- package/src/helpers/Handlebars/getPossibleValues.js +11 -11
- package/src/helpers/Handlebars/getProp.js +2 -2
- package/src/helpers/Handlebars/getTags.js +15 -16
- package/src/helpers/Handlebars/getThumbnailAlt.js +6 -4
- package/src/helpers/Handlebars/getTitle.js +3 -3
- package/src/helpers/Handlebars/iconSwitch.js +17 -0
- package/src/helpers/Handlebars/ifAny.js +6 -6
- package/src/helpers/Handlebars/ifArray.js +2 -2
- package/src/helpers/Handlebars/ifCond.js +30 -29
- package/src/helpers/Handlebars/ifEqualsOrChained.js +10 -10
- package/src/helpers/Handlebars/ifProp.js +2 -2
- package/src/helpers/Handlebars/if_eq.js +7 -7
- package/src/helpers/Handlebars/inArray.js +7 -7
- package/src/helpers/Handlebars/isPage.js +12 -7
- package/src/helpers/Handlebars/itemAt.js +8 -8
- package/src/helpers/Handlebars/jsonParse.js +7 -8
- package/src/helpers/Handlebars/jsonStringify.js +3 -3
- package/src/helpers/Handlebars/listAZ.js +74 -50
- package/src/helpers/Handlebars/listAZOptions.js +36 -29
- package/src/helpers/Handlebars/listByClosest.js +59 -53
- package/src/helpers/Handlebars/listByClosestWithOffset.js +58 -52
- package/src/helpers/Handlebars/math.js +11 -11
- package/src/helpers/Handlebars/newLineToBreak.js +3 -4
- package/src/helpers/Handlebars/nonBreakingSpaces.js +5 -6
- package/src/helpers/Handlebars/objectFromSelect.js +23 -16
- package/src/helpers/Handlebars/partialReplace.js +5 -6
- package/src/helpers/Handlebars/printAccordion.js +20 -20
- package/src/helpers/Handlebars/renderEncoded.js +13 -10
- package/src/helpers/Handlebars/renderSpecialChar.js +13 -11
- package/src/helpers/Handlebars/replace.js +5 -6
- package/src/helpers/Handlebars/replaceMany.js +3 -3
- package/src/helpers/Handlebars/sizeFormat.js +3 -3
- package/src/helpers/Handlebars/split.js +5 -6
- package/src/helpers/Handlebars/toUpperCase.js +4 -4
- package/src/helpers/Handlebars/urldecode.js +1 -1
- package/src/helpers/Handlebars/urlencode.js +1 -1
- package/src/helpers/Handlebars/withinObject.js +4 -4
- package/src/helpers/global-helpers.js +74 -48
- package/src/stories/AZListing/a-z_listing.stories.js +53 -53
- package/src/stories/Abstract/abstract.stories.js +48 -47
- package/src/stories/Accordion/accordion.stories.js +191 -0
- package/src/stories/BackToTop/BackToTop.stories.js +6 -6
- package/src/stories/Banner/banner.stories.js +68 -53
- package/src/stories/Banner/bannerAdvanced.stories.js +254 -189
- package/src/stories/Banner/bannerBasic.stories.js +104 -79
- package/src/stories/BasicSearch/BasicSearch.stories.js +160 -0
- package/src/stories/BlockQuote/BlockQuote.stories.js +72 -0
- package/src/stories/Body/body.stories.js +73 -66
- package/src/stories/Breadcrumbs/Breadcrumbs.stories.js +116 -93
- package/src/stories/Button/Button.stories.js +53 -44
- package/src/stories/CTALink/CTALink.stories.js +113 -159
- package/src/stories/Callout/Callout.stories.js +144 -110
- package/src/stories/Cards/CardFeature.stories.js +189 -119
- package/src/stories/Cards/CardMultiAction.stories.js +279 -151
- package/src/stories/Cards/CardNoAction.stories.js +261 -143
- package/src/stories/Cards/CardSingleAction.stories.js +244 -139
- package/src/stories/Code/Code.stories.js +239 -0
- package/src/stories/Colours/Colours.stories.js +98 -0
- package/src/stories/Colours/colours.js +135 -0
- package/src/stories/DirectionLinks/DirectionLinks.js +1 -1
- package/src/stories/DirectionLinks/DirectionLinks.stories.js +51 -44
- package/src/stories/Footer/Footer.stories.js +181 -159
- package/src/stories/Forms/Checkboxes/Checkboxes.js +37 -24
- package/src/stories/Forms/Checkboxes/Checkboxes.stories.js +245 -123
- package/src/stories/Forms/FileUpload/FileUpload.stories.js +214 -0
- package/src/stories/Forms/RadioButtons/RadioButtons.js +37 -24
- package/src/stories/Forms/RadioButtons/RadioButtons.stories.js +245 -123
- package/src/stories/Forms/SelectBox/SelectBox.js +41 -27
- package/src/stories/Forms/SelectBox/SelectBox.stories.js +253 -139
- package/src/stories/Forms/forms.stories.js +195 -158
- package/src/stories/Forms/numberInput.stories.js +55 -53
- package/src/stories/Forms/textInput.stories.js +135 -109
- package/src/stories/Forms/textarea.stories.js +136 -109
- package/src/stories/GlobalAlert/GlobalAlert.stories.js +114 -105
- package/src/stories/GlobalNavigation/LeftHandNavigation/LeftHandNavigation.stories.js +206 -0
- package/src/stories/GlobalNavigation/MegaMainNavigation/mega_main_navigation.a11y.stories.js +154 -0
- package/src/stories/GlobalNavigation/MegaMainNavigation/mega_main_navigation.stories.js +428 -0
- package/src/stories/Header/Header.js +83 -67
- package/src/stories/Header/Header.stories.js +389 -377
- package/src/stories/Horizontal/Horizontal.stories.js +185 -0
- package/src/stories/Iconography/Iconography.js +1 -1
- package/src/stories/Iconography/Iconography.stories.js +83 -75
- package/src/stories/Image/Image.stories.js +102 -0
- package/src/stories/InPageAlert/InPageAlert.stories.js +73 -65
- package/src/stories/Link/Link.stories.js +136 -0
- package/src/stories/LinkColumns/LinkColumns.js +21 -13
- package/src/stories/LinkColumns/LinkColumns.stories.js +97 -87
- package/src/stories/LoadingSpinner/LoadingSpinner.stories.js +47 -44
- package/src/stories/MultiColumn/MultiColumn.stories.js +320 -0
- package/src/stories/Navigation/InPageNavigation/InPageNavigation.stories.js +212 -0
- package/src/stories/Navigation/InternalNavigation/InternalNavigation.stories.js +158 -0
- package/src/stories/Pagination/Pagination.stories.js +195 -195
- package/src/stories/Prefooter/Prefooter.stories.js +107 -0
- package/src/stories/PromoPanel/PromoPanel.stories.js +193 -144
- package/src/stories/SearchInput/SearchInput.stories.js +176 -0
- package/src/stories/SkipLinks/SkipLinks.stories.js +106 -0
- package/src/stories/Table/table.stories.js +68 -50
- package/src/stories/Tabs/Tabs.stories.js +319 -0
- package/src/stories/Tags/Tags.js +19 -19
- package/src/stories/Tags/Tags.stories.js +83 -73
- package/src/stories/ToggleTip/ToggleTip.a11y.stories.js +130 -0
- package/src/stories/ToggleTip/ToggleTip.stories.js +213 -0
- package/src/stories/ToolTip/ToolTip.a11y.stories.js +85 -0
- package/src/stories/ToolTip/ToolTip.stories.js +187 -0
- package/src/stories/Typography/Typography.stories.js +218 -0
- package/src/stories/Typography/typography.js +94 -0
- package/src/stories/VideoPlayer/VideoPlayer.stories.js +246 -131
- package/src/styles/banner_contained/globals.scss +228 -232
- package/src/styles/core-styles.scss +32 -32
- package/src/styles/imports/cssbackup.css +498 -577
- package/src/styles/imports/functions.scss +348 -343
- package/src/styles/imports/mixins.scss +639 -565
- package/src/styles/imports/placeholders.scss +41 -39
- package/src/styles/imports/utilities.scss +376 -374
- package/src/styles/imports/variables.scss +178 -134
- package/src/styles/postcss.config.js +1 -2
- package/thankyou.md +26 -0
- package/vitest.config.js +34 -0
- package/.storybook/assets/accordion-js.js +0 -344
- package/.storybook/assets/animate-js.js +0 -247
- package/.storybook/assets/breadcrumbs-js.js +0 -216
- package/.storybook/assets/index.js +0 -23
- package/src/components/_global/js/toggle_and_tool_tip/global.js +0 -319
- package/src/html/component-accordion.html +0 -583
- package/src/html/component-basic_search.html +0 -42
- package/src/html/component-code.html +0 -57
- package/src/html/component-file_upload.html +0 -57
- package/src/html/component-mega_main_navigation.html +0 -583
- package/src/html/component-tab.html +0 -57
- package/src/html/component-toggle_tip.html +0 -569
- package/src/html/component-tool_tip.html +0 -294
- package/src/stories/CTALink/CTALink.js +0 -5
- package/src/stories/InPageNavigation/InPageNavigation.stories.js +0 -89
- package/src/stories/MegaMainNavigation/mega_main_navigation.a11y.stories.js +0 -138
- package/src/stories/MegaMainNavigation/mega_main_navigation.stories.js +0 -245
- package/src/stories/Navbar/Navbar.js +0 -117
- package/src/stories/Navbar/Navbar.stories.js +0 -80
package/.prettierignore
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Ignore artifacts:
|
|
2
|
+
build
|
|
3
|
+
coverage
|
|
4
|
+
dist
|
|
5
|
+
storybook-static
|
|
6
|
+
src/externals
|
|
7
|
+
|
|
8
|
+
# html-loader interpolate templates: the ${...} blocks are parsed as JS by
|
|
9
|
+
# esprima, which cannot handle strings wrapped across lines by Prettier
|
|
10
|
+
src/html
|
|
11
|
+
|
|
12
|
+
# Don't let Prettier reformat Markdown
|
|
13
|
+
*.md
|
|
14
|
+
|
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
/* Storybook specific styling */
|
|
2
2
|
|
|
3
3
|
#storybook-docs {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
/* Reset the styling of the radio buttons */
|
|
5
|
+
.docblock-argstable .docblock-argstable-body input[type="radio"] {
|
|
6
|
+
border: initial;
|
|
7
|
+
clip: auto;
|
|
8
|
+
height: auto;
|
|
9
|
+
overflow: visible;
|
|
10
|
+
padding: initial;
|
|
11
|
+
position: static;
|
|
12
|
+
width: auto;
|
|
13
|
+
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
15
|
+
/* Remove the default chevron down in SB select elements */
|
|
16
|
+
.docblock-argstable .docblock-argstable-body .css-1x3be6s {
|
|
17
|
+
> svg {
|
|
18
|
+
display: none;
|
|
20
19
|
}
|
|
20
|
+
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.figma-link {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
> p {
|
|
25
|
+
color: #09549f; /* $QLD-color-light__action--primary */
|
|
26
|
+
text-decoration: underline;
|
|
27
|
+
cursor: pointer;
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
29
|
+
&:hover {
|
|
30
|
+
color: #003e7d; /* $QLD-color-light__action--primary-hover */
|
|
32
31
|
}
|
|
32
|
+
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
.iconography-container {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
flex-wrap: wrap;
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
.iconography-item {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
align-items: center;
|
|
44
|
+
border: 1px solid var(--QLD-color-light__heading);
|
|
45
|
+
border-radius: 8px;
|
|
46
|
+
gap: 1rem;
|
|
47
|
+
margin: 1rem;
|
|
48
|
+
padding: 2rem 1rem;
|
|
49
|
+
width: 12rem;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
51
|
+
.qld__dark &,
|
|
52
|
+
.qld__dark-alt & {
|
|
53
|
+
border-color: white;
|
|
55
54
|
}
|
|
55
|
+
}
|
|
56
56
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decorator factory that runs component init functions after each story renders.
|
|
3
|
+
*
|
|
4
|
+
* The DOM isn't ready when a Storybook decorator runs synchronously, so init
|
|
5
|
+
* is deferred via setTimeout. Each init function receives the story's
|
|
6
|
+
* canvasElement as its root, scoping any DOM queries to that story's container.
|
|
7
|
+
* This makes the decorator safe in docs mode where multiple stories share the
|
|
8
|
+
* same page.
|
|
9
|
+
*
|
|
10
|
+
* Init functions may optionally return a clean-up function. If they do, it will
|
|
11
|
+
* be called before the next render — covering both story navigation and arg
|
|
12
|
+
* changes — to remove any event listeners or other side effects.
|
|
13
|
+
*
|
|
14
|
+
* @param {Array<function(Document|Element): (function|void)>} initFunctions
|
|
15
|
+
* @returns {function} Storybook decorator
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // In a story file:
|
|
19
|
+
* export default {
|
|
20
|
+
* decorators: [initComponents([initMegaMenu, initToggleTip])],
|
|
21
|
+
* };
|
|
22
|
+
*/
|
|
23
|
+
export function initComponents(initFunctions = []) {
|
|
24
|
+
let cleanups = [];
|
|
25
|
+
return (storyFn, context) => {
|
|
26
|
+
cleanups.forEach((fn) => fn?.());
|
|
27
|
+
cleanups = [];
|
|
28
|
+
const story = storyFn();
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
cleanups = initFunctions
|
|
31
|
+
.map((initFunction) => initFunction(context.canvasElement))
|
|
32
|
+
.filter(Boolean);
|
|
33
|
+
}, 0);
|
|
34
|
+
return story;
|
|
35
|
+
};
|
|
36
|
+
}
|
package/.storybook/globals.js
CHANGED
|
@@ -1,137 +1,200 @@
|
|
|
1
1
|
export const viewports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
// QLD-media Breakpoints from variables.scss
|
|
3
|
+
small: { name: "Small", styles: { width: "400px", height: "800px" } },
|
|
4
|
+
medium: { name: "Medium", styles: { width: "699px", height: "800px" } },
|
|
5
|
+
large: { name: "Large", styles: { width: "992px", height: "800px" } },
|
|
6
|
+
xlarge: {
|
|
7
|
+
name: "Extra large",
|
|
8
|
+
styles: { width: "1312px", height: "1000px" },
|
|
9
|
+
},
|
|
10
|
+
xxlarge: {
|
|
11
|
+
name: "Extra extra large",
|
|
12
|
+
styles: { width: "1599px", height: "1000px" },
|
|
13
|
+
},
|
|
14
|
+
mainNavBreakpoint: {
|
|
15
|
+
name: "Main nav breakpoint",
|
|
16
|
+
styles: { width: "992px", height: "800px" },
|
|
17
|
+
},
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export const themes = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
white: "js qld__body qld__grid",
|
|
22
|
+
light: "js qld__body qld__body--light qld__light",
|
|
23
|
+
"light alt": "js qld__body qld__body--alt qld__light-alt",
|
|
24
|
+
dark: "js qld__body qld__body--dark qld__dark",
|
|
25
|
+
"dark alt": "js qld__body qld__body--dark-alt qld__dark-alt",
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export const themeColours = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
white: "",
|
|
30
|
+
light: "var(--QLD-color-light__background)",
|
|
31
|
+
"light alt": "var(--QLD-color-light__background--alt)",
|
|
32
|
+
dark: "var(--QLD-color-dark__background)",
|
|
33
|
+
"dark alt": "var(--QLD-color-dark__background--alt)",
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
export const dummyText =
|
|
37
|
-
|
|
37
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
|
|
38
38
|
|
|
39
39
|
export const dummyLink = "https://www.google.com";
|
|
40
|
+
export const dummyImageLink =
|
|
41
|
+
"https://www.choreport.health.qld.gov.au/__data/assets/image/0013/140512/Culex_annulirostris_female2.jpg";
|
|
40
42
|
|
|
41
43
|
// Path to the icon sprite, relative to the Storybook preview iframe. Used for
|
|
42
44
|
// <use href> references and the coreSiteIcons metadata across stories.
|
|
43
45
|
export const iconSpritePath = "QLD-icons.svg";
|
|
44
46
|
|
|
45
47
|
const dsBase = "https://www.designsystem.qld.gov.au";
|
|
46
|
-
const figmaBase =
|
|
48
|
+
const figmaBase =
|
|
49
|
+
"https://www.figma.com/design/qKsxl3ogIlBp7dafgxXuCA/QGDS-UI-kit";
|
|
47
50
|
|
|
48
51
|
export const componentLinks = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
52
|
+
accordion: {
|
|
53
|
+
ds: `${dsBase}/components/accordion`,
|
|
54
|
+
figma: `${figmaBase}?node-id=120348-3558&t=oLOAet6SqqLBklzJ-0`,
|
|
55
|
+
},
|
|
56
|
+
backToTop: {
|
|
57
|
+
ds: `${dsBase}/patterns/back-to-top`,
|
|
58
|
+
figma: `${figmaBase}?node-id=135268-27564&t=Gk55sISVPoJM2wm4-0`,
|
|
59
|
+
},
|
|
60
|
+
banner: {
|
|
61
|
+
ds: `${dsBase}/components/banner`,
|
|
62
|
+
figma: `${figmaBase}?node-id=120353-65175&t=Lne25vgTT2xUkJcD-0`,
|
|
63
|
+
},
|
|
64
|
+
blockquote: {
|
|
65
|
+
ds: `${dsBase}/components/blockquote`,
|
|
66
|
+
figma: `${figmaBase}?node-id=133254-206548&t=Ix1loY6jzMoPl0rM-0`,
|
|
67
|
+
},
|
|
68
|
+
breadcrumbs: {
|
|
69
|
+
ds: `${dsBase}/components/breadcrumbs`,
|
|
70
|
+
figma: `${figmaBase}?node-id=5990-98076&p=f&t=4xsFBWGSPA5BjG6z-0`,
|
|
71
|
+
},
|
|
72
|
+
button: {
|
|
73
|
+
ds: `${dsBase}/components/button`,
|
|
74
|
+
figma: `${figmaBase}?node-id=5990-98058&p=f&t=pMQreNNlQuuKMxlD-0`,
|
|
75
|
+
},
|
|
76
|
+
callout: {
|
|
77
|
+
ds: `${dsBase}/components/callout`,
|
|
78
|
+
figma: `${figmaBase}?node-id=5990-98115&p=f&t=3aGzWYalpb1UXS73-0`,
|
|
79
|
+
},
|
|
80
|
+
card: {
|
|
81
|
+
ds: `${dsBase}/components/card`,
|
|
82
|
+
figma: `${figmaBase}?node-id=120360-98159&t=SzNNrsljtXa1LjkF-0`,
|
|
83
|
+
},
|
|
84
|
+
checkboxes: {
|
|
85
|
+
ds: `${dsBase}/components/checkbox`,
|
|
86
|
+
figma: `${figmaBase}?node-id=11056-321348&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
87
|
+
},
|
|
88
|
+
ctaLink: {
|
|
89
|
+
ds: `${dsBase}/components/call-to-action-cta`,
|
|
90
|
+
figma: `${figmaBase}?node-id=11056-321367&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
91
|
+
},
|
|
92
|
+
directionLinks: {
|
|
93
|
+
ds: `${dsBase}/components/direction-link`,
|
|
94
|
+
figma: `${figmaBase}?node-id=11056-321363&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
95
|
+
},
|
|
96
|
+
fileUpload: {
|
|
97
|
+
ds: `${dsBase}/components/file-upload`,
|
|
98
|
+
figma: `${figmaBase}?node-id=120418-69592&t=reDR6N8B4YziXnTh-0`,
|
|
99
|
+
},
|
|
100
|
+
footer: {
|
|
101
|
+
ds: `${dsBase}/components/footer`,
|
|
102
|
+
figma: `${figmaBase}?node-id=5990-97582&p=f&t=xM7nOPN0NPouiFDO-0`,
|
|
103
|
+
},
|
|
104
|
+
forms: { ds: `${dsBase}/components/forms` },
|
|
105
|
+
globalAlert: {
|
|
106
|
+
ds: `${dsBase}/components/global-alert`,
|
|
107
|
+
figma: `${figmaBase}?node-id=5990-97590&p=f&t=DWJ5IM0EPnQV6Sui-0`,
|
|
108
|
+
},
|
|
109
|
+
header: {
|
|
110
|
+
ds: `${dsBase}/components/header`,
|
|
111
|
+
figma: `${figmaBase}?node-id=5990-97586&p=f&t=UZuh698yg2zKvMDG-0`,
|
|
112
|
+
},
|
|
113
|
+
horizontalRule: {
|
|
114
|
+
ds: `${dsBase}/components/horizontal-rule`,
|
|
115
|
+
figma: `${figmaBase}?node-id=5990-97954&p=f&t=avPgpU6waAIMt5Tt-0`,
|
|
116
|
+
},
|
|
117
|
+
iconography: { ds: `${dsBase}/styles/iconography` },
|
|
118
|
+
image: { ds: `${dsBase}/styles/images` },
|
|
119
|
+
inPageAlert: {
|
|
120
|
+
ds: `${dsBase}/components/alerts-in-page`,
|
|
121
|
+
figma: `${figmaBase}?node-id=5990-98125&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
122
|
+
},
|
|
123
|
+
inPageNavigation: {
|
|
124
|
+
ds: `${dsBase}/components/in-page-navigation`,
|
|
125
|
+
figma: `${figmaBase}?node-id=7905-252906&p=f&t=Tb6VtPPWrZ7Na35f-0`,
|
|
126
|
+
},
|
|
127
|
+
internalNavigation: {
|
|
128
|
+
ds: `${dsBase}/components/side-navigation`,
|
|
129
|
+
figma: `${figmaBase}?node-id=120418-56310&t=QVD97pKrIpIBHqDI-0`,
|
|
130
|
+
},
|
|
131
|
+
leftHandNavigation: {
|
|
132
|
+
ds: `${dsBase}/components/navigation-vertical`,
|
|
133
|
+
},
|
|
134
|
+
link: {
|
|
135
|
+
ds: `${dsBase}/styles/typography#section__text-links`,
|
|
136
|
+
figma: `${figmaBase}?node-id=12900-201779&p=f&t=yOj3gpnlDy5EdiKF-0`,
|
|
137
|
+
},
|
|
138
|
+
linkColumns: {
|
|
139
|
+
ds: `${dsBase}/components/link-columns-link-list`,
|
|
140
|
+
figma: `${figmaBase}?node-id=11056-321574&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
141
|
+
},
|
|
142
|
+
loadingSpinner: {
|
|
143
|
+
ds: `${dsBase}/components/loading-spinner`,
|
|
144
|
+
figma: `${figmaBase}?node-id=49314-16705&p=f&t=N6vEZVb73vuDEtRO-0`,
|
|
145
|
+
},
|
|
146
|
+
multiColumns: {
|
|
147
|
+
ds: `${dsBase}/styles/layout-foundations`,
|
|
148
|
+
},
|
|
149
|
+
navbar: {
|
|
150
|
+
ds: `${dsBase}/components/navigation-horizontal`,
|
|
151
|
+
figma: `${figmaBase}?node-id=5990-97586&p=f&t=UZuh698yg2zKvMDG-0`,
|
|
152
|
+
},
|
|
153
|
+
pagination: {
|
|
154
|
+
ds: `${dsBase}/components/pagination`,
|
|
155
|
+
figma: `${figmaBase}?node-id=11056-321779&p=f&t=wdrRF6qJa1fuzxWP-0`,
|
|
156
|
+
},
|
|
157
|
+
promoPanel: {
|
|
158
|
+
ds: `${dsBase}/components/promotional-panel`,
|
|
159
|
+
figma: `${figmaBase}?node-id=23269-286312&p=f&t=ub7vIB4rUQNZ6zzo-0`,
|
|
160
|
+
},
|
|
161
|
+
radioButtons: {
|
|
162
|
+
ds: `${dsBase}/components/radio-buttons`,
|
|
163
|
+
figma: `${figmaBase}?node-id=11056-321347&p=f&t=kHfUZsyKYuDkprji-0`,
|
|
164
|
+
},
|
|
165
|
+
searchInput: {
|
|
166
|
+
figma: `${figmaBase}?node-id=5990-97871&p=f&t=LQ9pTTJMMZTjWz1k-0`,
|
|
167
|
+
},
|
|
168
|
+
selectBox: {
|
|
169
|
+
ds: `${dsBase}/components/input-fields-select-box`,
|
|
170
|
+
figma: `${figmaBase}?node-id=11056-321345&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
171
|
+
},
|
|
172
|
+
skipLinks: {
|
|
173
|
+
ds: `${dsBase}/components/header`,
|
|
174
|
+
},
|
|
175
|
+
table: {
|
|
176
|
+
ds: `${dsBase}/components/table`,
|
|
177
|
+
figma: `${figmaBase}?node-id=120418-57729&t=VPLTzrxLs85peK9J-0`,
|
|
178
|
+
},
|
|
179
|
+
tabs: {
|
|
180
|
+
ds: `${dsBase}/components/tabs`,
|
|
181
|
+
figma: `${figmaBase}?node-id=25951-236134&p=f&t=pMQreNNlQuuKMxlD-0`,
|
|
182
|
+
},
|
|
183
|
+
tags: {
|
|
184
|
+
ds: `${dsBase}/components/tags`,
|
|
185
|
+
figma: `${figmaBase}?node-id=5990-97596&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
186
|
+
},
|
|
187
|
+
textInput: {
|
|
188
|
+
ds: `${dsBase}/components/text-input`,
|
|
189
|
+
figma: `${figmaBase}?node-id=5990-97997&p=f&t=yRd2EKrtkEkPbBDT-0`,
|
|
190
|
+
},
|
|
191
|
+
typography: {
|
|
192
|
+
ds: `${dsBase}/styles/typography`,
|
|
193
|
+
figma: `${figmaBase}?node-id=58880-54175&t=HJaBKJMDC0c6s7KB-0`,
|
|
194
|
+
},
|
|
195
|
+
videoPlayer: {
|
|
196
|
+
figma: `${figmaBase}?node-id=13297-214065&p=f&t=WmKMIp3MbkVrYkUf-0`,
|
|
197
|
+
},
|
|
135
198
|
};
|
|
136
199
|
|
|
137
200
|
/**
|
|
@@ -140,19 +203,20 @@ export const componentLinks = {
|
|
|
140
203
|
* and Figma (when available). Both are looked up automatically from the component key.
|
|
141
204
|
*
|
|
142
205
|
* @param {keyof typeof componentLinks} componentKey
|
|
206
|
+
* @param {string} [extraDescription] Additional description to include in the story.
|
|
143
207
|
*/
|
|
144
|
-
export function storyParams(componentKey) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
208
|
+
export function storyParams(componentKey, extraDescription) {
|
|
209
|
+
const { ds, figma } = componentLinks[componentKey] ?? {};
|
|
210
|
+
const links = ds ? [`[QLD Design System ↗](${ds})`] : [];
|
|
211
|
+
if (figma) links.push(`[Figma UI Kit ↗](${figma})`);
|
|
212
|
+
return {
|
|
213
|
+
docs: {
|
|
214
|
+
toc: true,
|
|
215
|
+
codePanel: true,
|
|
216
|
+
description: {
|
|
217
|
+
component: `**Resources:** ${links.join(" · ")}${extraDescription ? `\n\n${extraDescription}` : ""}`,
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
...(figma && { design: { type: "figma", url: figma } }),
|
|
221
|
+
};
|
|
158
222
|
}
|
|
@@ -4,14 +4,57 @@
|
|
|
4
4
|
* @returns {string} - cleaned HTML
|
|
5
5
|
*/
|
|
6
6
|
export const cleanStorybookUrls = (html) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
return (
|
|
8
|
+
html
|
|
9
|
+
.replace(/(\b(?:href|src|srcset)=["'])\.\/\?a=/g, "$1")
|
|
10
|
+
// CSS url(./?a=...)
|
|
11
|
+
.replace(/url\(\s*\.\/\?a=/g, "url(")
|
|
12
|
+
);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export const themeWrapper = (theme, content) => {
|
|
16
|
-
|
|
16
|
+
return `<div class="${theme}" style="padding: 2rem;">${content}</div>`;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const VOID_ELEMENTS =
|
|
20
|
+
/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/i;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Pretty-print an HTML string for the Storybook code panel.
|
|
24
|
+
*
|
|
25
|
+
* Storybook's built-in `docs.source.format` only supports "dedent" (stripping
|
|
26
|
+
* common leading whitespace) in this build — it does not reflow HTML — so we
|
|
27
|
+
* re-indent it ourselves. Entities are preserved (no DOM round-trip), making it
|
|
28
|
+
* safe for escaped markup like `<p>`.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} html - the raw rendered HTML
|
|
31
|
+
* @returns {string} - the re-indented HTML
|
|
32
|
+
*/
|
|
33
|
+
export const formatHtmlSource = (html) => {
|
|
34
|
+
// Put each tag on its own line, then re-indent based on nesting.
|
|
35
|
+
const lines = html
|
|
36
|
+
.replace(/>\s*</g, ">\n<")
|
|
37
|
+
.split("\n")
|
|
38
|
+
.map((line) => line.trim())
|
|
39
|
+
.filter(Boolean);
|
|
40
|
+
|
|
41
|
+
let depth = 0;
|
|
42
|
+
const indentOf = (n) => " ".repeat(Math.max(n, 0));
|
|
43
|
+
|
|
44
|
+
return lines
|
|
45
|
+
.map((line) => {
|
|
46
|
+
const tag = line.match(/^<\/?([a-zA-Z0-9-]+)/)?.[1] ?? "";
|
|
47
|
+
const isComment = line.startsWith("<!--");
|
|
48
|
+
const isClosing = line.startsWith("</");
|
|
49
|
+
const isOpening = /^<[a-zA-Z]/.test(line) && !isClosing;
|
|
50
|
+
const isVoid = VOID_ELEMENTS.test(tag) || /\/>\s*$/.test(line);
|
|
51
|
+
// e.g. <p>text</p> opens and closes on the same line.
|
|
52
|
+
const isSelfContained = isOpening && /<\/[a-zA-Z0-9-]+>\s*$/.test(line);
|
|
53
|
+
|
|
54
|
+
if (isClosing) depth -= 1;
|
|
55
|
+
const out = indentOf(depth) + line;
|
|
56
|
+
if (isOpening && !isVoid && !isComment && !isSelfContained) depth += 1;
|
|
57
|
+
return out;
|
|
58
|
+
})
|
|
59
|
+
.join("\n");
|
|
17
60
|
};
|
package/.storybook/main.js
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
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
|
+
import hbsPlugin from "./vite-plugin-hbs.js";
|
|
4
4
|
|
|
5
5
|
const config = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
7
|
+
addons: [
|
|
8
|
+
"@storybook/addon-a11y",
|
|
9
|
+
"@storybook/addon-themes",
|
|
10
|
+
"@storybook/addon-designs",
|
|
11
|
+
"@storybook/addon-docs",
|
|
12
|
+
"@storybook/addon-vitest",
|
|
13
|
+
"@chromatic-com/storybook",
|
|
14
|
+
],
|
|
15
|
+
framework: {
|
|
16
|
+
name: "@storybook/html-vite",
|
|
17
|
+
options: {},
|
|
18
|
+
},
|
|
19
|
+
async viteFinal(config) {
|
|
20
|
+
config.plugins.push(sassGlobImports());
|
|
21
|
+
config.plugins.push(hbsPlugin());
|
|
22
|
+
return config;
|
|
23
|
+
},
|
|
24
|
+
staticDirs: ["../dist/mysource_files/img", "./core-assets", "./assets"],
|
|
18
25
|
};
|
|
19
26
|
export default config;
|
|
@@ -7,31 +7,31 @@ const destDir = path.resolve(".storybook/core-assets");
|
|
|
7
7
|
|
|
8
8
|
// Purge directory for a fresh start
|
|
9
9
|
if (fs.existsSync(destDir)) {
|
|
10
|
-
|
|
10
|
+
fs.rmSync(destDir, { recursive: true, force: true });
|
|
11
11
|
}
|
|
12
12
|
fs.mkdirSync(destDir, { recursive: true });
|
|
13
13
|
|
|
14
14
|
// Copy over certain assets from dist
|
|
15
15
|
filesToCopy.forEach((relativePath) => {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const srcPath = path.join(srcDir, relativePath);
|
|
17
|
+
const destPath = path.join(destDir, path.basename(relativePath));
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
if (fs.existsSync(srcPath)) {
|
|
20
|
+
fs.copyFileSync(srcPath, destPath);
|
|
21
|
+
console.log(`Copied: ${relativePath}`);
|
|
22
|
+
} else {
|
|
23
|
+
console.warn(`File not found: ${srcPath}`);
|
|
24
|
+
}
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
// Add import line to handlebar-helpers.js
|
|
28
28
|
const handlebarHelpersPath = path.join(destDir, "helpers.js");
|
|
29
29
|
const newDestPath = path.join(destDir, "handlebar-helpers.js");
|
|
30
30
|
try {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const importLine = `import Handlebars from "handlebars";\n`;
|
|
32
|
+
const helpersContent = fs.readFileSync(handlebarHelpersPath, "utf-8");
|
|
33
|
+
fs.writeFileSync(handlebarHelpersPath, importLine + helpersContent, "utf-8");
|
|
34
|
+
fs.renameSync(handlebarHelpersPath, newDestPath);
|
|
35
35
|
} catch (err) {
|
|
36
|
-
|
|
36
|
+
console.warn(`Failed to update ${handlebarHelpersPath}:`);
|
|
37
37
|
}
|