@nanoporetech-digital/components 2.1.3 → 2.2.1
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/CHANGELOG.md +31 -0
- package/README.md +1 -1
- package/dist/cjs/index-cb62df44.js +5 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/nano-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-components.cjs.js +1 -1
- package/dist/cjs/nano-datalist_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-date-input.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-details.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-file-upload.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-search-results.cjs.entry.js +36 -26
- package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-hero.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-icon-button.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-menu-drawer.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-rating.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-split-pane.cjs.entry.js +278 -0
- package/dist/cjs/nano-split-pane.cjs.entry.js.map +1 -0
- package/dist/cjs/nano-tab-group.cjs.entry.js +1 -0
- package/dist/cjs/nano-tab-group.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tab.cjs.entry.js +1 -1
- package/dist/cjs/nano-tab.cjs.entry.js.map +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/accordion/accordion.js +1 -1
- package/dist/collection/components/alert/alert.js +1 -1
- package/dist/collection/components/algolia/algolia-filter.js +2 -2
- package/dist/collection/components/algolia/algolia-input.js +5 -5
- package/dist/collection/components/algolia/algolia-results.js +1 -1
- package/dist/collection/components/algolia/algolia.js +6 -6
- package/dist/collection/components/checkbox/checkbox-group.js +2 -2
- package/dist/collection/components/checkbox/checkbox.js +3 -3
- package/dist/collection/components/datalist/datalist.css +1 -1
- package/dist/collection/components/datalist/datalist.js +1 -1
- package/dist/collection/components/date-input/date-input.js +7 -7
- package/dist/collection/components/date-picker/date-picker.js +5 -5
- package/dist/collection/components/details/details.js +1 -1
- package/dist/collection/components/dialog/dialog.js +1 -1
- package/dist/collection/components/file-upload/file-upload.js +4 -4
- package/dist/collection/components/global-nav/global-nav.js +4 -4
- package/dist/collection/components/global-search-results/global-search-results.css +21 -0
- package/dist/collection/components/global-search-results/global-search-results.js +35 -25
- package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
- package/dist/collection/components/grid/grid-item.js +1 -1
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/input/input.js +5 -5
- package/dist/collection/components/nav-item/nav-item.js +4 -4
- package/dist/collection/components/range/range.js +4 -4
- package/dist/collection/components/resize-observe/resize-observe.js +1 -1
- package/dist/collection/components/select/select.js +7 -7
- package/dist/collection/components/slides/slides.js +7 -7
- package/dist/collection/components/split-pane/split-pane.css +104 -0
- package/dist/collection/components/split-pane/split-pane.js +464 -0
- package/dist/collection/components/split-pane/split-pane.js.map +1 -0
- package/dist/collection/components/tabs/tab-group.js +3 -2
- package/dist/collection/components/tabs/tab-group.js.map +1 -1
- package/dist/collection/components/tabs/tab.js +1 -1
- package/dist/collection/components/tabs/tab.js.map +1 -1
- package/dist/collection/utils/drag.js +21 -0
- package/dist/collection/utils/drag.js.map +1 -0
- package/dist/components/datalist.js.map +1 -1
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/menu.js.map +1 -1
- package/dist/components/nano-alert.js.map +1 -1
- package/dist/components/nano-checkbox.js.map +1 -1
- package/dist/components/nano-date-input.js.map +1 -1
- package/dist/components/nano-details.js.map +1 -1
- package/dist/components/nano-dialog.js.map +1 -1
- package/dist/components/nano-file-upload.js.map +1 -1
- package/dist/components/nano-global-nav.js.map +1 -1
- package/dist/components/nano-global-search-results.js +36 -26
- package/dist/components/nano-global-search-results.js.map +1 -1
- package/dist/components/nano-hero.js.map +1 -1
- package/dist/components/nano-menu-drawer.js.map +1 -1
- package/dist/components/nano-rating.js.map +1 -1
- package/dist/components/nano-split-pane.d.ts +11 -0
- package/dist/components/nano-split-pane.js +308 -0
- package/dist/components/nano-split-pane.js.map +1 -0
- package/dist/components/nano-tab-group.js +1 -0
- package/dist/components/nano-tab-group.js.map +1 -1
- package/dist/components/nano-tab.js +1 -1
- package/dist/components/nano-tab.js.map +1 -1
- package/dist/components/option.js.map +1 -1
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +310 -31
- package/dist/custom-elements/index.js.map +1 -1
- package/dist/esm/index-5f8d16e7.js +5 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/nano-alert.entry.js.map +1 -1
- package/dist/esm/nano-checkbox.entry.js.map +1 -1
- package/dist/esm/nano-components.js +1 -1
- package/dist/esm/nano-datalist_3.entry.js.map +1 -1
- package/dist/esm/nano-date-input.entry.js.map +1 -1
- package/dist/esm/nano-details.entry.js.map +1 -1
- package/dist/esm/nano-dialog.entry.js.map +1 -1
- package/dist/esm/nano-file-upload.entry.js.map +1 -1
- package/dist/esm/nano-global-nav.entry.js.map +1 -1
- package/dist/esm/nano-global-search-results.entry.js +36 -26
- package/dist/esm/nano-global-search-results.entry.js.map +1 -1
- package/dist/esm/nano-hero.entry.js.map +1 -1
- package/dist/esm/nano-icon-button.entry.js.map +1 -1
- package/dist/esm/nano-menu-drawer.entry.js.map +1 -1
- package/dist/esm/nano-rating.entry.js.map +1 -1
- package/dist/esm/nano-split-pane.entry.js +274 -0
- package/dist/esm/nano-split-pane.entry.js.map +1 -0
- package/dist/esm/nano-tab-group.entry.js +1 -0
- package/dist/esm/nano-tab-group.entry.js.map +1 -1
- package/dist/esm/nano-tab.entry.js +1 -1
- package/dist/esm/nano-tab.entry.js.map +1 -1
- package/dist/esm-es5/index-5f8d16e7.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/nano-alert.entry.js.map +1 -1
- package/dist/esm-es5/nano-checkbox.entry.js.map +1 -1
- package/dist/esm-es5/nano-components.js +1 -1
- package/dist/esm-es5/nano-components.js.map +1 -1
- package/dist/esm-es5/nano-datalist_3.entry.js.map +1 -1
- package/dist/esm-es5/nano-date-input.entry.js.map +1 -1
- package/dist/esm-es5/nano-details.entry.js.map +1 -1
- package/dist/esm-es5/nano-dialog.entry.js.map +1 -1
- package/dist/esm-es5/nano-file-upload.entry.js.map +1 -1
- package/dist/esm-es5/nano-global-nav.entry.js.map +1 -1
- package/dist/esm-es5/nano-global-search-results.entry.js +1 -1
- package/dist/esm-es5/nano-global-search-results.entry.js.map +1 -1
- package/dist/esm-es5/nano-hero.entry.js.map +1 -1
- package/dist/esm-es5/nano-icon-button.entry.js.map +1 -1
- package/dist/esm-es5/nano-menu-drawer.entry.js.map +1 -1
- package/dist/esm-es5/nano-rating.entry.js.map +1 -1
- package/dist/esm-es5/nano-split-pane.entry.js +5 -0
- package/dist/esm-es5/nano-split-pane.entry.js.map +1 -0
- package/dist/esm-es5/nano-tab-group.entry.js +1 -1
- package/dist/esm-es5/nano-tab-group.entry.js.map +1 -1
- package/dist/esm-es5/nano-tab.entry.js +2 -2
- package/dist/esm-es5/nano-tab.entry.js.map +1 -1
- package/dist/nano-components/nano-components.css +1 -1
- package/dist/nano-components/nano-components.esm.js +1 -1
- package/dist/nano-components/nano-components.esm.js.map +1 -1
- package/dist/nano-components/{p-e35eac75.entry.js → p-08b43111.entry.js} +2 -2
- package/dist/nano-components/p-08b43111.entry.js.map +1 -0
- package/dist/nano-components/p-090f22a9.system.entry.js.map +1 -1
- package/dist/nano-components/p-096682d9.system.js +1 -1
- package/dist/nano-components/p-096682d9.system.js.map +1 -1
- package/dist/nano-components/{p-e6f8f9f7.system.entry.js → p-1238f0fc.system.entry.js} +2 -2
- package/dist/nano-components/p-1238f0fc.system.entry.js.map +1 -0
- package/dist/nano-components/p-1e974cad.entry.js.map +1 -1
- package/dist/nano-components/p-1ec44caf.entry.js.map +1 -1
- package/dist/nano-components/p-1f99d776.entry.js +5 -0
- package/dist/nano-components/p-1f99d776.entry.js.map +1 -0
- package/dist/nano-components/p-20db18f3.entry.js.map +1 -1
- package/dist/nano-components/p-3456db01.entry.js.map +1 -1
- package/dist/nano-components/p-3ad1d5aa.system.entry.js.map +1 -1
- package/dist/nano-components/{p-3cf35ac4.system.entry.js → p-3f736fa2.system.entry.js} +2 -2
- package/dist/nano-components/p-3f736fa2.system.entry.js.map +1 -0
- package/dist/nano-components/p-4429caac.system.entry.js.map +1 -1
- package/dist/nano-components/p-531d5275.system.entry.js.map +1 -1
- package/dist/nano-components/p-56ba0d63.entry.js.map +1 -1
- package/dist/nano-components/p-58419bed.system.entry.js.map +1 -1
- package/dist/nano-components/p-5a476bba.system.entry.js.map +1 -1
- package/dist/nano-components/p-6afdb510.system.entry.js +5 -0
- package/dist/nano-components/p-6afdb510.system.entry.js.map +1 -0
- package/dist/nano-components/p-71c26ace.entry.js.map +1 -1
- package/dist/nano-components/p-730f60ea.entry.js.map +1 -1
- package/dist/nano-components/p-7d2e2685.entry.js.map +1 -1
- package/dist/nano-components/p-8a8f893b.system.entry.js.map +1 -1
- package/dist/nano-components/p-93448bcd.system.entry.js.map +1 -1
- package/dist/nano-components/p-94593617.system.entry.js.map +1 -1
- package/dist/nano-components/p-9ca5e023.system.entry.js +5 -0
- package/dist/nano-components/p-9ca5e023.system.entry.js.map +1 -0
- package/dist/nano-components/{p-bbe6b7af.entry.js → p-ad0715d1.entry.js} +2 -2
- package/dist/nano-components/p-ad0715d1.entry.js.map +1 -0
- package/dist/nano-components/p-b59d2bd5.entry.js.map +1 -1
- package/dist/nano-components/p-c0ddb4c3.entry.js.map +1 -1
- package/dist/nano-components/p-d6569144.entry.js.map +1 -1
- package/dist/nano-components/p-d9f2dda5.entry.js +5 -0
- package/dist/nano-components/p-d9f2dda5.entry.js.map +1 -0
- package/dist/nano-components/p-e11bd40d.entry.js.map +1 -1
- package/dist/nano-components/p-e15be516.system.entry.js.map +1 -1
- package/dist/nano-components/p-ef4e0912.system.entry.js.map +1 -1
- package/dist/nano-components/p-f2e7d2f9.system.entry.js.map +1 -1
- package/dist/themes/london-calling.css +1 -1
- package/dist/themes/london-calling.css.map +1 -1
- package/dist/themes/nanopore.css +1 -1
- package/dist/themes/nanopore.css.map +1 -1
- package/dist/types/components/split-pane/split-pane.d.ts +74 -0
- package/dist/types/components.d.ts +85 -0
- package/dist/types/utils/drag.d.ts +1 -0
- package/docs-json.json +294 -2
- package/docs-vscode.json +49 -0
- package/package.json +8 -6
- package/dist/nano-components/p-05844b46.system.entry.js +0 -5
- package/dist/nano-components/p-05844b46.system.entry.js.map +0 -1
- package/dist/nano-components/p-3cf35ac4.system.entry.js.map +0 -1
- package/dist/nano-components/p-bbe6b7af.entry.js.map +0 -1
- package/dist/nano-components/p-e35eac75.entry.js.map +0 -1
- package/dist/nano-components/p-e6f8f9f7.system.entry.js.map +0 -1
- package/dist/nano-components/p-fea32549.entry.js +0 -5
- package/dist/nano-components/p-fea32549.entry.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"file":"nano-hero.js","mappings":";;;;;;;;;;;AAAA,MAAM,OAAO,GAAG,iqOAAiqO;;ICgCpqO,IAAI;EALjB;;;;IAOU,aAAQ,GAAG,KAAK,CAAC;IAIhB,cAAS,GAAa,EAAE,CAAC;;;IAyC1B,cAAS,GAAY,IAAI,CAAC;;IAG1B,kBAAa,GAAW,GAAG,CAAC;;IAG5B,UAAK,GAAqB,MAAM,CAAC;;IAGjC,UAAK,GAAkB,KAAK,CAAC;IAmC7B,qBAAgB,GAAG,CAAC,CAAqC;MAC/D,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;KAC3B,CAAC;IAoBM,gBAAW,GAAG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YAAY,GAAG,CACtB;MACN,EAAC,IAAI,CAAC,WAAW,OAAG;KACrB,CACG,CACF,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/hero/hero.scss?tag=nano-hero&encapsulation=shadow","./src/components/hero/hero.tsx"],"sourcesContent":["@import '../../global/style/utilities/globals';\n@import '../../global/style/nano-theme/colours';\n\n:host {\n /**\n * @prop --nano-loader-base: Base colour of nano-skeleton. Default depends on theme;\n * @prop --nano-loader-tint: Tint colour of nano-skeleton. Default depends on theme;\n * @prop --theme-color: Text color. Default depends on theme;\n * @prop --theme-tint-color: Color used for bread crumbs and icons. Defaults to #{$color-lightblue};\n * @prop --scrim-color: Color of the gradient covering the background. Default depends on theme;\n * @prop --scrim-direction: Direction of the gradient covering the background. Default what content slots are present;\n * @prop --scrim-opacity-from: Starting opactiy of the gradient covering the background. Default .25;\n * @prop --scrim-opacity-to: Final opactiy of the gradient covering the background. Default depends on `theme`;\n * @prop --quote-size: Font size of the quote. Defaults to 1.3em and grows to 3rem on the xl breakpoint;\n */\n\n display: block;\n\n --nano-loader-base: #{$color-black};\n --nano-loader-tint: #{lighten($color-black, 20%)};\n --theme-color: #{$color-white};\n --theme-tint-color: #{$color-lightblue};\n --scrim-color: 0, 0, 0;\n --scrim-direction: 90deg;\n --scrim-opacity-from: 0.25;\n --scrim-opacity-to: 0.7;\n --padding: 0;\n --quote-size: 1.3rem;\n\n color: var(--theme-color);\n}\n\n:host(.is-xl) {\n --quote-size: 3rem;\n}\n\n:host([theme='light']) {\n --nano-loader-base: #{$color-white};\n --nano-loader-tint: #{lighten($color-white, 20%)};\n --theme-color: #{$color-black};\n --scrim-color: 255, 255, 255;\n --scrim-opacity-from: 0.25;\n --scrim-opacity-to: 1;\n --scrim-direction: 270deg;\n\n color: var(--theme-color);\n\n .hero__primary-content {\n --color: #{$color-black};\n }\n}\n\n.hero {\n position: relative;\n\n &--rtl {\n --scrim-direction: 270deg;\n }\n\n &--secondary:not(.hero--iconbox) {\n --scrim-direction: 0deg;\n }\n\n &__bg-wrap {\n overflow: hidden;\n }\n\n &__bg-slot {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n\n &__ctas {\n @media (max-width: 52em) {\n display: none;\n }\n\n @media (max-width: 58em) {\n margin-bottom: -48px;\n }\n\n display: flex;\n justify-content: flex-end;\n padding: 32px 32px 0;\n margin-bottom: -64px;\n position: relative;\n z-index: 1;\n\n ::slotted(a.button[slot='secondary-ctas']),\n &::slotted(a.button[slot='secondary-ctas']) {\n padding: 0.25rem 0.5rem !important;\n font-size: 0.875rem !important;\n margin: 0 0.25rem !important;\n }\n }\n\n &__img {\n display: block;\n\n --padding: inherit;\n }\n\n &__breadcrumbs {\n display: none;\n margin: 20px 14px 0;\n line-height: 14px;\n\n .hero--breadcrumb & {\n display: block;\n }\n\n .is-xl & {\n margin: 0 50px;\n max-width: 50%;\n }\n\n .is-xxl & {\n margin: 0 83px;\n }\n\n ::slotted(*[slot='breadcrumb']),\n &::slotted(*[slot='breadcrumb']) {\n font-size: 0.85rem;\n text-transform: uppercase;\n letter-spacing: 1.5px;\n font-weight: 600;\n font-stretch: 125%;\n display: inline-block;\n margin-bottom: 16px;\n position: relative;\n z-index: 2;\n\n .hero--hasbg & {\n text-shadow: 1px 1px rgb(0 0 0 / 15%);\n }\n }\n\n ::slotted(a[slot='breadcrumb']),\n &::slotted(a[slot='breadcrumb']) {\n color: var(--theme-tint-color) !important;\n cursor: pointer;\n }\n\n ::slotted(.slash[slot='breadcrumb']),\n &::slotted(.slash[slot='breadcrumb']) {\n color: var(--theme-color);\n position: relative;\n margin: 0 0.5rem;\n display: inline-block;\n }\n }\n\n &__scrim {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n z-index: 0;\n background:\n linear-gradient(\n var(--scrim-direction),\n rgba(var(--scrim-color), var(--scrim-opacity-from)) 0%,\n rgba(var(--scrim-color), var(--scrim-opacity-to)) 100%\n );\n\n .hero--scrim & {\n background: none;\n }\n }\n\n &__content {\n max-width: 1440px;\n\n --grid-row-gap: 0;\n\n margin: 0 auto;\n position: relative;\n\n &.is-xl {\n margin-top: 50px;\n max-width: 1540px;\n }\n\n &.is-xxl {\n margin-top: 83px;\n max-width: 1606px;\n }\n }\n\n &__primary {\n margin: 16px;\n\n .hero--breadcrumb & {\n margin: 0 16px;\n }\n\n .hero--backbtn & {\n margin-left: 0;\n }\n\n ::slotted(nano-icon-button[slot='back-btn']),\n &::slotted(nano-icon-button[slot='back-btn']) {\n font-size: 2rem;\n }\n\n .is-xl & {\n margin: 0 0 50px 50px;\n\n ::slotted(nano-icon-button[slot='back-btn']),\n &::slotted(nano-icon-button[slot='back-btn']) {\n @include margin(0, 0, 0, -3rem);\n }\n }\n\n .is-xxl & {\n margin: 0 0 83px 83px;\n }\n }\n\n &__primary-content {\n max-width: 45rem;\n\n --color: #fff;\n\n display: flex;\n\n .hero--backbtn & {\n > div {\n padding: 10px 0 0 0;\n }\n }\n\n ::slotted(h1[slot='primary-content']),\n &::slotted(h1[slot='primary-content']) {\n line-height: 26px !important;\n margin-top: 0 !important;\n margin-bottom: 18px !important;\n font-size: 2rem !important;\n }\n\n .is-xl & {\n ::slotted(h1[slot='primary-content']),\n &::slotted(h1[slot='primary-content']) {\n line-height: 31px !important;\n margin-bottom: 30px !important;\n }\n\n ::slotted(.button[slot='primary-content']),\n &::slotted(.button[slot='primary-content']) {\n margin-top: 20px !important;\n }\n }\n }\n\n &__secondary {\n display: none;\n height: 100%;\n padding: 0 14px 20px;\n\n .hero--secondary & {\n display: flex;\n align-items: center;\n }\n\n .is-xl & {\n padding: 0 50px 50px;\n justify-content: flex-end;\n }\n\n .is-xxl & {\n padding: 0 83px 83px;\n }\n }\n\n &__icon-box {\n background: rgba(0, 0, 0, 0.7);\n padding: 24px;\n width: 100%;\n margin-bottom: auto;\n display: flex;\n flex-direction: column;\n color: white;\n\n .is-xl & {\n max-width: 410px;\n flex: 0 1 410px;\n }\n\n // for silly IE\n &::slotted([slot='icon-box-item'] nano-icon) {\n color: var(--theme-tint-color);\n\n --nano-icon-size: 32px;\n --nano-icon-margin-end: 20px;\n }\n\n ::slotted([slot='icon-box-item']) {\n --nano-color-base: var(--theme-tint-color);\n --nano-icon-size: 32px;\n --nano-icon-margin-end: 20px;\n\n display: flex;\n align-items: center;\n font-size: 0.8125rem;\n margin-bottom: 20px;\n }\n\n ::slotted(.last[slot='icon-box-item']),\n &::slotted(.last[slot='icon-box-item']) {\n margin-bottom: 0;\n }\n }\n\n &__quote-content {\n margin-top: auto;\n text-align: center;\n width: 100%;\n\n .is-xl & {\n max-width: 500px;\n flex: 0 1 500px;\n text-align: initial;\n }\n }\n\n &__quote {\n &::before,\n &::after {\n content: '\"';\n font-size: var(--quote-size);\n font-weight: 700;\n font-style: italic;\n line-height: 0;\n color: #abb6b8;\n display: inline;\n position: relative;\n }\n\n ::slotted([slot='quote']),\n &::slotted([slot='quote']) {\n font-size: var(--quote-size);\n font-weight: 300;\n font-style: italic;\n display: inline;\n }\n }\n\n &__quote-author {\n text-align: right;\n text-align: end;\n font-size: 1rem;\n opacity: 0.8;\n }\n\n &--sub {\n .hero__content.is-xl {\n margin-top: 40px;\n\n .hero__primary {\n margin: 0 0 40px 50px;\n }\n\n .hero__secondary {\n padding: 0 50px 50px 40px;\n }\n\n ::slotted(.button[slot='primary-content']),\n &::slotted(.button[slot='primary-content']) {\n margin-top: 8px !important;\n }\n\n ::slotted(h1[slot='primary-content']),\n &::slotted(h1[slot='primary-content']) {\n margin-bottom: 18px !important;\n }\n }\n\n .hero__content.is-xxl {\n .hero__primary {\n margin: 0 0 40px 83px;\n }\n\n .hero__secondary {\n padding: 0 83px 83px 40px;\n }\n }\n }\n}\n","import {\n Component,\n Prop,\n h,\n ComponentInterface,\n VNode,\n State,\n Element,\n Watch,\n Host,\n} from '@stencil/core';\nimport { hasShadowDom } from '../../utils';\n\n/**\n * Hero components are designed to be used once per content page to add visual impact to the introductory section of a page.\n * @slot primary-content - title, leading paragraph and CTA\n * @slot breadcrumb - each individual bread crumb should be assigned seperately\n * @slot secondary-content - free form secondary content.\n * @slot icon-box - free form icon box container\n * @slot icon-box-item - seperate icon box items. Designed to contain 1 icon and 1 text element.\n * @slot secondary-ctas - CTAs. each individual button should be assigned seperately\n * @slot quote - quote content\n * @slot quote-author - quote author\n * @slot scrim - optional background overlay (e.g. faded colour or gradient)\n * @slot background - custom background. Only active when img-src is empty\n * @slot back-btn - a back button.\n */\n@Component({\n tag: 'nano-hero',\n styleUrl: 'hero.scss',\n shadow: true,\n})\nexport class Hero implements ComponentInterface {\n private mo?: MutationObserver;\n private isLegacy = false;\n\n @Element() host: HTMLNanoHeroElement;\n\n @State() gridSizes: string[] = [];\n @State() hasIconBox: boolean;\n @State() hasScrim: boolean;\n @State() hasSecondaryContent: boolean;\n @State() hasQuote: boolean;\n @State() hasBg: boolean;\n @State() hasBackBtn: boolean;\n @State() hasCtas: boolean;\n @State() breadCrumbs: Element[];\n @Watch('breadCrumbs')\n breadCrumbChange() {\n // safari doesn't support ::slotted()::after ... so this :/\n this.breadCrumbs\n .filter(\n (crumb) =>\n crumb.tagName === 'A' &&\n !crumb.nextElementSibling.classList.contains('slash')\n )\n .forEach((crumb) => {\n crumb.insertAdjacentHTML(\n 'afterend',\n '<span slot=\"breadcrumb\" class=\"slash\">/</span>'\n );\n });\n }\n @State() iconBoxItems: Element[];\n @Watch('iconBoxItems')\n iconBoxItemChange() {\n this.iconBoxItems.forEach((item) => item.classList.remove('last'));\n if (\n this.iconBoxItems[this.iconBoxItems.length - 1] &&\n this.iconBoxItems[this.iconBoxItems.length - 1].classList\n )\n this.iconBoxItems[this.iconBoxItems.length - 1].classList.add('last');\n }\n\n /** src for backgronund image. For more control use the `background` slot instead. */\n @Prop() imgSrc?: string;\n\n /** Optional list string providing media sizes with corresponding image srcs.\n * i.e. show img-x at 300px wide. Format `srcSet=\"200w src/imgSmall.jpg, 500h src/imgMed.png\"` */\n @Prop() imgSrcSet?: string = null;\n\n /** The Break Point width that the hero component will change to the large view. Defaults to the XL grid size (900px) */\n @Prop() largeScreenBP: number = 900;\n\n /** Base style for the hero. Either 'light' (white bg / dark text), or 'dark' (dark bg / white text) */\n @Prop() theme: 'dark' | 'light' = 'dark';\n\n /** Set the content structure level of the hero. Defaults to 'top' */\n @Prop() level: 'top' | 'sub' = 'top';\n\n private slotChangeObserver() {\n if (this.mo) this.mo.disconnect();\n const mo = (this.mo = new MutationObserver(() =>\n this.processSlottedContent()\n ));\n mo.observe(this.host, { childList: true });\n }\n\n // Event handlers\n\n private processSlottedContent() {\n this.hasCtas = !!this.host.querySelector('[slot=\"secondary-ctas\"]');\n this.iconBoxItems = Array.from(\n this.host.querySelectorAll('[slot=\"icon-box-item\"]')\n );\n this.hasIconBox =\n !!this.host.querySelector('[slot=\"icon-box\"]') ||\n !!this.iconBoxItems.length;\n this.hasScrim = !!this.host.querySelector('[slot=\"scrim\"]');\n this.breadCrumbs = Array.from(\n this.host.querySelectorAll('[slot=\"breadcrumb\"]')\n );\n this.hasSecondaryContent =\n !!this.host.querySelector('[slot=\"icon-box\"]') ||\n !!this.host.querySelector('[slot=\"quote\"]') ||\n !!this.host.querySelector('[slot=\"icon-box-item\"]') ||\n !!this.host.querySelector('[slot=\"secondary-content\"]');\n this.hasBg =\n !!this.host.querySelector('[slot=\"background\"]') || !!this.imgSrc;\n this.hasBackBtn = !!this.host.querySelector('[slot=\"back-btn\"]');\n this.hasQuote = !!this.host.querySelector('[slot=\"quote\"]');\n }\n\n private handleGridChange = (e: CustomEvent & { detail: string[] }) => {\n this.gridSizes = e.detail;\n };\n\n // Component lifecycle\n\n connectedCallback() {\n this.isLegacy = !hasShadowDom(this.host);\n }\n\n disconnectedCallback() {\n if (this.mo) this.mo.disconnect();\n }\n\n componentDidLoad() {\n this.slotChangeObserver();\n }\n\n componentWillLoad() {\n this.processSlottedContent();\n }\n\n private HeroContent = (): VNode[] => {\n return [\n !this.hasIconBox && this.hasCtas ? (\n <div class=\"hero__ctas\">\n <slot name=\"secondary-ctas\" />\n </div>\n ) : (\n ''\n ),\n <div class=\"hero__scrim\">\n <slot name=\"scrim\" />\n </div>,\n <nano-grid\n onNanoBpChange={this.handleGridChange}\n class=\"hero__content\"\n xlCols={2}\n xlSize={this.largeScreenBP}\n >\n <nano-grid-item gridStates=\"xl-col-span-2\">\n <div class=\"hero__breadcrumbs\">\n <slot name=\"breadcrumb\" />\n </div>\n </nano-grid-item>\n <nano-grid-item\n gridStates={\n this.hasSecondaryContent\n ? 'xl-col-span-1 xl-col-start-1 xl-row-start-2'\n : 'xl-col-span-2 xl-col-start-1 xl-row-start-2'\n }\n >\n <div class=\"hero__primary\">\n <div class=\"hero__primary-content\">\n <slot name=\"back-btn\" />\n <div>\n <slot name=\"primary-content\" />\n </div>\n </div>\n </div>\n </nano-grid-item>\n {this.hasSecondaryContent && (\n <nano-grid-item gridStates=\"xl-col-span-1 xl-col-start-2 xl-row-start-2\">\n <div class=\"hero__secondary\">\n <slot name=\"secondary-content\" />\n {this.hasIconBox && (\n <div class=\"hero__icon-box\">\n <slot name=\"icon-box\" />\n <slot name=\"icon-box-item\" />\n </div>\n )}\n {this.hasQuote && (\n <div class=\"hero__quote-content\">\n <span class=\"hero__quote\">\n <slot name=\"quote\" />\n </span>\n <div class=\"hero__quote-author\">\n <slot name=\"quote-author\" />\n </div>\n </div>\n )}\n </div>\n </nano-grid-item>\n )}\n </nano-grid>,\n ];\n };\n\n render() {\n const rtl =\n this.host.dir === 'rtl' ||\n (this.host.ownerDocument as Document).dir === 'rtl';\n\n return (\n <Host\n class={{\n [this.gridSizes.join(' ')]: true,\n }}\n >\n <div\n class={{\n hero: true,\n 'hero--light': this.theme === 'light',\n 'hero--secondary': this.hasSecondaryContent,\n 'hero--iconbox': this.hasIconBox,\n 'hero--rtl': rtl,\n 'hero--scrim': this.hasScrim,\n 'hero--legacy': this.isLegacy,\n 'hero--breadcrumb': !!this.breadCrumbs.length,\n 'hero--hasbg': this.hasBg,\n 'hero--backbtn': this.hasBackBtn,\n 'hero--sub': this.level === 'sub',\n }}\n >\n <div class=\"hero__bg-wrap\">\n {!!this.imgSrc && (\n <nano-img\n class=\"hero__img\"\n lazy={false}\n background\n srcSet={this.imgSrcSet}\n src={this.imgSrc}\n >\n <this.HeroContent />\n </nano-img>\n )}\n {!this.imgSrc && [\n <div class=\"hero__bg-slot\">\n <slot name=\"background\" />\n </div>,\n <this.HeroContent />,\n ]}\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
1
|
+
{"file":"nano-hero.js","mappings":";;;;;;;;;;;AAAA,MAAM,OAAO,GAAG,iqOAAiqO;;ICgCpqO,IAAI;EALjB;;;;IAOU,aAAQ,GAAG,KAAK,CAAC;IAIhB,cAAS,GAAa,EAAE,CAAC;;;IAyC1B,cAAS,GAAY,IAAI,CAAC;;IAG1B,kBAAa,GAAW,GAAG,CAAC;;IAG5B,UAAK,GAAqB,MAAM,CAAC;;IAGjC,UAAK,GAAkB,KAAK,CAAC;IAmC7B,qBAAgB,GAAG,CAAC,CAAqC;MAC/D,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;KAC3B,CAAC;IAoBM,gBAAW,GAAG;MACpB,OAAO;QACL,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,IAC9B,WAAK,KAAK,EAAC,YAAY,IACrB,YAAM,IAAI,EAAC,gBAAgB,GAAG,CAC1B,KAEN,EAAE,CACH;QACD,WAAK,KAAK,EAAC,aAAa,IACtB,YAAM,IAAI,EAAC,OAAO,GAAG,CACjB;QACN,iBACE,cAAc,EAAE,IAAI,CAAC,gBAAgB,EACrC,KAAK,EAAC,eAAe,EACrB,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,IAAI,CAAC,aAAa,IAE1B,sBAAgB,UAAU,EAAC,eAAe,IACxC,WAAK,KAAK,EAAC,mBAAm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,IAAI;OACjC,IAED,WACE,KAAK,EAAE;QACL,IAAI,EAAE,IAAI;QACV,aAAa,EAAE,IAAI,CAAC,KAAK,KAAK,OAAO;QACrC,iBAAiB,EAAE,IAAI,CAAC,mBAAmB;QAC3C,eAAe,EAAE,IAAI,CAAC,UAAU;QAChC,WAAW,EAAE,GAAG;QAChB,aAAa,EAAE,IAAI,CAAC,QAAQ;QAC5B,cAAc,EAAE,IAAI,CAAC,QAAQ;QAC7B,kBAAkB,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM;QAC7C,aAAa,EAAE,IAAI,CAAC,KAAK;QACzB,eAAe,EAAE,IAAI,CAAC,UAAU;QAChC,WAAW,EAAE,IAAI,CAAC,KAAK,KAAK,KAAK;OAClC,IAED,WAAK,KAAK,EAAC,eAAe,IACvB,CAAC,CAAC,IAAI,CAAC,MAAM,KACZ,gBACE,KAAK,EAAC,WAAW,EACjB,IAAI,EAAE,KAAK,EACX,UAAU,QACV,MAAM,EAAE,IAAI,CAAC,SAAS,EACtB,GAAG,EAAE,IAAI,CAAC,MAAM,IAEhB,EAAC,IAAI,CAAC,WAAW,OAAG,CACX,CACZ,EACA,CAAC,IAAI,CAAC,MAAM,IAAI;MACf,WAAK,KAAK,EAAC,eAAe,IACxB,YAAM,IAAI,EAAC,YAAY,GAAG,CACtB;MACN,EAAC,IAAI,CAAC,WAAW,OAAG;KACrB,CACG,CACF,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/hero/hero.scss?tag=nano-hero&encapsulation=shadow","./src/components/hero/hero.tsx"],"sourcesContent":["@use 'sass:map';\n@use 'sass:list';\n\n@import '../../global/style/utilities/globals';\n@import '../../global/style/nano-theme/colours';\n\n:host {\n /**\n * @prop --nano-loader-base: Base colour of nano-skeleton. Default depends on theme;\n * @prop --nano-loader-tint: Tint colour of nano-skeleton. Default depends on theme;\n * @prop --theme-color: Text color. Default depends on theme;\n * @prop --theme-tint-color: Color used for bread crumbs and icons. Defaults to #{map.get($colors, lightblue)};\n * @prop --scrim-color: Color of the gradient covering the background. Default depends on theme;\n * @prop --scrim-direction: Direction of the gradient covering the background. Default what content slots are present;\n * @prop --scrim-opacity-from: Starting opactiy of the gradient covering the background. Default .25;\n * @prop --scrim-opacity-to: Final opactiy of the gradient covering the background. Default depends on `theme`;\n * @prop --quote-size: Font size of the quote. Defaults to 1.3em and grows to 3rem on the xl breakpoint;\n */\n\n display: block;\n\n --nano-loader-base: #{map.get($colors, black)};\n --nano-loader-tint: #{lighten(map.get($colors, black), 20%)};\n --theme-color: #{map.get($colors, white)};\n --theme-tint-color: #{map.get($colors, lightblue)};\n --scrim-color: 0, 0, 0;\n --scrim-direction: 90deg;\n --scrim-opacity-from: 0.25;\n --scrim-opacity-to: 0.7;\n --padding: 0;\n --quote-size: 1.3rem;\n\n color: var(--theme-color);\n}\n\n:host(.is-xl) {\n --quote-size: 3rem;\n}\n\n:host([theme='light']) {\n --nano-loader-base: #{map.get($colors, white)};\n --nano-loader-tint: #{lighten(map.get($colors, white), 20%)};\n --theme-color: #{map.get($colors, black)};\n --scrim-color: 255, 255, 255;\n --scrim-opacity-from: 0.25;\n --scrim-opacity-to: 1;\n --scrim-direction: 270deg;\n\n color: var(--theme-color);\n\n .hero__primary-content {\n --color: #{map.get($colors, black)};\n }\n}\n\n.hero {\n position: relative;\n\n &--rtl {\n --scrim-direction: 270deg;\n }\n\n &--secondary:not(.hero--iconbox) {\n --scrim-direction: 0deg;\n }\n\n &__bg-wrap {\n overflow: hidden;\n }\n\n &__bg-slot {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n\n &__ctas {\n @media (max-width: 52em) {\n display: none;\n }\n\n @media (max-width: 58em) {\n margin-bottom: -48px;\n }\n\n display: flex;\n justify-content: flex-end;\n padding: 32px 32px 0;\n margin-bottom: -64px;\n position: relative;\n z-index: 1;\n\n ::slotted(a.button[slot='secondary-ctas']),\n &::slotted(a.button[slot='secondary-ctas']) {\n padding: 0.25rem 0.5rem !important;\n font-size: 0.875rem !important;\n margin: 0 0.25rem !important;\n }\n }\n\n &__img {\n display: block;\n\n --padding: inherit;\n }\n\n &__breadcrumbs {\n display: none;\n margin: 20px 14px 0;\n line-height: 14px;\n\n .hero--breadcrumb & {\n display: block;\n }\n\n .is-xl & {\n margin: 0 50px;\n max-width: 50%;\n }\n\n .is-xxl & {\n margin: 0 83px;\n }\n\n ::slotted(*[slot='breadcrumb']),\n &::slotted(*[slot='breadcrumb']) {\n font-size: 0.85rem;\n text-transform: uppercase;\n letter-spacing: 1.5px;\n font-weight: 600;\n font-stretch: 125%;\n display: inline-block;\n margin-bottom: 16px;\n position: relative;\n z-index: 2;\n\n .hero--hasbg & {\n text-shadow: 1px 1px rgb(0 0 0 / 15%);\n }\n }\n\n ::slotted(a[slot='breadcrumb']),\n &::slotted(a[slot='breadcrumb']) {\n color: var(--theme-tint-color) !important;\n cursor: pointer;\n }\n\n ::slotted(.slash[slot='breadcrumb']),\n &::slotted(.slash[slot='breadcrumb']) {\n color: var(--theme-color);\n position: relative;\n margin: 0 0.5rem;\n display: inline-block;\n }\n }\n\n &__scrim {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n z-index: 0;\n background:\n linear-gradient(\n var(--scrim-direction),\n rgba(var(--scrim-color), var(--scrim-opacity-from)) 0%,\n rgba(var(--scrim-color), var(--scrim-opacity-to)) 100%\n );\n\n .hero--scrim & {\n background: none;\n }\n }\n\n &__content {\n max-width: 1440px;\n\n --grid-row-gap: 0;\n\n margin: 0 auto;\n position: relative;\n\n &.is-xl {\n margin-top: 50px;\n max-width: 1540px;\n }\n\n &.is-xxl {\n margin-top: 83px;\n max-width: 1606px;\n }\n }\n\n &__primary {\n margin: 16px;\n\n .hero--breadcrumb & {\n margin: 0 16px;\n }\n\n .hero--backbtn & {\n margin-left: 0;\n }\n\n ::slotted(nano-icon-button[slot='back-btn']),\n &::slotted(nano-icon-button[slot='back-btn']) {\n font-size: 2rem;\n }\n\n .is-xl & {\n margin: 0 0 50px 50px;\n\n ::slotted(nano-icon-button[slot='back-btn']),\n &::slotted(nano-icon-button[slot='back-btn']) {\n @include margin(0, 0, 0, -3rem);\n }\n }\n\n .is-xxl & {\n margin: 0 0 83px 83px;\n }\n }\n\n &__primary-content {\n max-width: 45rem;\n\n --color: #fff;\n\n display: flex;\n\n .hero--backbtn & {\n > div {\n padding: 10px 0 0 0;\n }\n }\n\n ::slotted(h1[slot='primary-content']),\n &::slotted(h1[slot='primary-content']) {\n line-height: 26px !important;\n margin-top: 0 !important;\n margin-bottom: 18px !important;\n font-size: 2rem !important;\n }\n\n .is-xl & {\n ::slotted(h1[slot='primary-content']),\n &::slotted(h1[slot='primary-content']) {\n line-height: 31px !important;\n margin-bottom: 30px !important;\n }\n\n ::slotted(.button[slot='primary-content']),\n &::slotted(.button[slot='primary-content']) {\n margin-top: 20px !important;\n }\n }\n }\n\n &__secondary {\n display: none;\n height: 100%;\n padding: 0 14px 20px;\n\n .hero--secondary & {\n display: flex;\n align-items: center;\n }\n\n .is-xl & {\n padding: 0 50px 50px;\n justify-content: flex-end;\n }\n\n .is-xxl & {\n padding: 0 83px 83px;\n }\n }\n\n &__icon-box {\n background: rgba(0, 0, 0, 0.7);\n padding: 24px;\n width: 100%;\n margin-bottom: auto;\n display: flex;\n flex-direction: column;\n color: white;\n\n .is-xl & {\n max-width: 410px;\n flex: 0 1 410px;\n }\n\n // for silly IE\n &::slotted([slot='icon-box-item'] nano-icon) {\n color: var(--theme-tint-color);\n\n --nano-icon-size: 32px;\n --nano-icon-margin-end: 20px;\n }\n\n ::slotted([slot='icon-box-item']) {\n --nano-color-base: var(--theme-tint-color);\n --nano-icon-size: 32px;\n --nano-icon-margin-end: 20px;\n\n display: flex;\n align-items: center;\n font-size: 0.8125rem;\n margin-bottom: 20px;\n }\n\n ::slotted(.last[slot='icon-box-item']),\n &::slotted(.last[slot='icon-box-item']) {\n margin-bottom: 0;\n }\n }\n\n &__quote-content {\n margin-top: auto;\n text-align: center;\n width: 100%;\n\n .is-xl & {\n max-width: 500px;\n flex: 0 1 500px;\n text-align: initial;\n }\n }\n\n &__quote {\n &::before,\n &::after {\n content: '\"';\n font-size: var(--quote-size);\n font-weight: 700;\n font-style: italic;\n line-height: 0;\n color: #abb6b8;\n display: inline;\n position: relative;\n }\n\n ::slotted([slot='quote']),\n &::slotted([slot='quote']) {\n font-size: var(--quote-size);\n font-weight: 300;\n font-style: italic;\n display: inline;\n }\n }\n\n &__quote-author {\n text-align: right;\n text-align: end;\n font-size: 1rem;\n opacity: 0.8;\n }\n\n &--sub {\n .hero__content.is-xl {\n margin-top: 40px;\n\n .hero__primary {\n margin: 0 0 40px 50px;\n }\n\n .hero__secondary {\n padding: 0 50px 50px 40px;\n }\n\n ::slotted(.button[slot='primary-content']),\n &::slotted(.button[slot='primary-content']) {\n margin-top: 8px !important;\n }\n\n ::slotted(h1[slot='primary-content']),\n &::slotted(h1[slot='primary-content']) {\n margin-bottom: 18px !important;\n }\n }\n\n .hero__content.is-xxl {\n .hero__primary {\n margin: 0 0 40px 83px;\n }\n\n .hero__secondary {\n padding: 0 83px 83px 40px;\n }\n }\n }\n}\n","import {\n Component,\n Prop,\n h,\n ComponentInterface,\n VNode,\n State,\n Element,\n Watch,\n Host,\n} from '@stencil/core';\nimport { hasShadowDom } from '../../utils';\n\n/**\n * Hero components are designed to be used once per content page to add visual impact to the introductory section of a page.\n * @slot primary-content - title, leading paragraph and CTA\n * @slot breadcrumb - each individual bread crumb should be assigned seperately\n * @slot secondary-content - free form secondary content.\n * @slot icon-box - free form icon box container\n * @slot icon-box-item - seperate icon box items. Designed to contain 1 icon and 1 text element.\n * @slot secondary-ctas - CTAs. each individual button should be assigned seperately\n * @slot quote - quote content\n * @slot quote-author - quote author\n * @slot scrim - optional background overlay (e.g. faded colour or gradient)\n * @slot background - custom background. Only active when img-src is empty\n * @slot back-btn - a back button.\n */\n@Component({\n tag: 'nano-hero',\n styleUrl: 'hero.scss',\n shadow: true,\n})\nexport class Hero implements ComponentInterface {\n private mo?: MutationObserver;\n private isLegacy = false;\n\n @Element() host: HTMLNanoHeroElement;\n\n @State() gridSizes: string[] = [];\n @State() hasIconBox: boolean;\n @State() hasScrim: boolean;\n @State() hasSecondaryContent: boolean;\n @State() hasQuote: boolean;\n @State() hasBg: boolean;\n @State() hasBackBtn: boolean;\n @State() hasCtas: boolean;\n @State() breadCrumbs: Element[];\n @Watch('breadCrumbs')\n breadCrumbChange() {\n // safari doesn't support ::slotted()::after ... so this :/\n this.breadCrumbs\n .filter(\n (crumb) =>\n crumb.tagName === 'A' &&\n !crumb.nextElementSibling.classList.contains('slash')\n )\n .forEach((crumb) => {\n crumb.insertAdjacentHTML(\n 'afterend',\n '<span slot=\"breadcrumb\" class=\"slash\">/</span>'\n );\n });\n }\n @State() iconBoxItems: Element[];\n @Watch('iconBoxItems')\n iconBoxItemChange() {\n this.iconBoxItems.forEach((item) => item.classList.remove('last'));\n if (\n this.iconBoxItems[this.iconBoxItems.length - 1] &&\n this.iconBoxItems[this.iconBoxItems.length - 1].classList\n )\n this.iconBoxItems[this.iconBoxItems.length - 1].classList.add('last');\n }\n\n /** src for backgronund image. For more control use the `background` slot instead. */\n @Prop() imgSrc?: string;\n\n /** Optional list string providing media sizes with corresponding image srcs.\n * i.e. show img-x at 300px wide. Format `srcSet=\"200w src/imgSmall.jpg, 500h src/imgMed.png\"` */\n @Prop() imgSrcSet?: string = null;\n\n /** The Break Point width that the hero component will change to the large view. Defaults to the XL grid size (900px) */\n @Prop() largeScreenBP: number = 900;\n\n /** Base style for the hero. Either 'light' (white bg / dark text), or 'dark' (dark bg / white text) */\n @Prop() theme: 'dark' | 'light' = 'dark';\n\n /** Set the content structure level of the hero. Defaults to 'top' */\n @Prop() level: 'top' | 'sub' = 'top';\n\n private slotChangeObserver() {\n if (this.mo) this.mo.disconnect();\n const mo = (this.mo = new MutationObserver(() =>\n this.processSlottedContent()\n ));\n mo.observe(this.host, { childList: true });\n }\n\n // Event handlers\n\n private processSlottedContent() {\n this.hasCtas = !!this.host.querySelector('[slot=\"secondary-ctas\"]');\n this.iconBoxItems = Array.from(\n this.host.querySelectorAll('[slot=\"icon-box-item\"]')\n );\n this.hasIconBox =\n !!this.host.querySelector('[slot=\"icon-box\"]') ||\n !!this.iconBoxItems.length;\n this.hasScrim = !!this.host.querySelector('[slot=\"scrim\"]');\n this.breadCrumbs = Array.from(\n this.host.querySelectorAll('[slot=\"breadcrumb\"]')\n );\n this.hasSecondaryContent =\n !!this.host.querySelector('[slot=\"icon-box\"]') ||\n !!this.host.querySelector('[slot=\"quote\"]') ||\n !!this.host.querySelector('[slot=\"icon-box-item\"]') ||\n !!this.host.querySelector('[slot=\"secondary-content\"]');\n this.hasBg =\n !!this.host.querySelector('[slot=\"background\"]') || !!this.imgSrc;\n this.hasBackBtn = !!this.host.querySelector('[slot=\"back-btn\"]');\n this.hasQuote = !!this.host.querySelector('[slot=\"quote\"]');\n }\n\n private handleGridChange = (e: CustomEvent & { detail: string[] }) => {\n this.gridSizes = e.detail;\n };\n\n // Component lifecycle\n\n connectedCallback() {\n this.isLegacy = !hasShadowDom(this.host);\n }\n\n disconnectedCallback() {\n if (this.mo) this.mo.disconnect();\n }\n\n componentDidLoad() {\n this.slotChangeObserver();\n }\n\n componentWillLoad() {\n this.processSlottedContent();\n }\n\n private HeroContent = (): VNode[] => {\n return [\n !this.hasIconBox && this.hasCtas ? (\n <div class=\"hero__ctas\">\n <slot name=\"secondary-ctas\" />\n </div>\n ) : (\n ''\n ),\n <div class=\"hero__scrim\">\n <slot name=\"scrim\" />\n </div>,\n <nano-grid\n onNanoBpChange={this.handleGridChange}\n class=\"hero__content\"\n xlCols={2}\n xlSize={this.largeScreenBP}\n >\n <nano-grid-item gridStates=\"xl-col-span-2\">\n <div class=\"hero__breadcrumbs\">\n <slot name=\"breadcrumb\" />\n </div>\n </nano-grid-item>\n <nano-grid-item\n gridStates={\n this.hasSecondaryContent\n ? 'xl-col-span-1 xl-col-start-1 xl-row-start-2'\n : 'xl-col-span-2 xl-col-start-1 xl-row-start-2'\n }\n >\n <div class=\"hero__primary\">\n <div class=\"hero__primary-content\">\n <slot name=\"back-btn\" />\n <div>\n <slot name=\"primary-content\" />\n </div>\n </div>\n </div>\n </nano-grid-item>\n {this.hasSecondaryContent && (\n <nano-grid-item gridStates=\"xl-col-span-1 xl-col-start-2 xl-row-start-2\">\n <div class=\"hero__secondary\">\n <slot name=\"secondary-content\" />\n {this.hasIconBox && (\n <div class=\"hero__icon-box\">\n <slot name=\"icon-box\" />\n <slot name=\"icon-box-item\" />\n </div>\n )}\n {this.hasQuote && (\n <div class=\"hero__quote-content\">\n <span class=\"hero__quote\">\n <slot name=\"quote\" />\n </span>\n <div class=\"hero__quote-author\">\n <slot name=\"quote-author\" />\n </div>\n </div>\n )}\n </div>\n </nano-grid-item>\n )}\n </nano-grid>,\n ];\n };\n\n render() {\n const rtl =\n this.host.dir === 'rtl' ||\n (this.host.ownerDocument as Document).dir === 'rtl';\n\n return (\n <Host\n class={{\n [this.gridSizes.join(' ')]: true,\n }}\n >\n <div\n class={{\n hero: true,\n 'hero--light': this.theme === 'light',\n 'hero--secondary': this.hasSecondaryContent,\n 'hero--iconbox': this.hasIconBox,\n 'hero--rtl': rtl,\n 'hero--scrim': this.hasScrim,\n 'hero--legacy': this.isLegacy,\n 'hero--breadcrumb': !!this.breadCrumbs.length,\n 'hero--hasbg': this.hasBg,\n 'hero--backbtn': this.hasBackBtn,\n 'hero--sub': this.level === 'sub',\n }}\n >\n <div class=\"hero__bg-wrap\">\n {!!this.imgSrc && (\n <nano-img\n class=\"hero__img\"\n lazy={false}\n background\n srcSet={this.imgSrcSet}\n src={this.imgSrc}\n >\n <this.HeroContent />\n </nano-img>\n )}\n {!this.imgSrc && [\n <div class=\"hero__bg-slot\">\n <slot name=\"background\" />\n </div>,\n <this.HeroContent />,\n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AAG,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,GAChC,EACP,YAAM,IAAI,EAAC,MAAM,GAAG,CAChB,CACF,CACF,CACF,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/menu-drawer/menu-drawer.scss?tag=nano-menu-drawer&encapsulation=shadow","./src/components/menu-drawer/menu-drawer.tsx"],"sourcesContent":["@import '../../global/style/utilities/globals';\n@import '../../global/style/nano-theme/base';\n@import '../../global/style/nano-theme/colours';\n\n:host(.legacy) {\n ::slotted(*),\n * {\n --global-nav-height: 61px;\n --padding-top: 13px;\n --padding-end: 13px;\n --padding-bottom: 13px;\n --padding-start: 13px;\n --secondary-padding-end: 13px;\n --secondary-padding-bottom: 13px;\n --secondary-padding-start: 13px;\n --secondary-padding-top: 61px;\n --icon-size: 19px;\n --font-size: 11px;\n --bg-color: #001a21;\n --bg-color-hover: rgba(28, 62, 72, 0.8);\n --bg-color-selected: #274048;\n --bg-color-open: #274048;\n --bg-color-focus: rgba(28, 62, 72, 0.8);\n --focus-outline: none;\n --content-color: #{$color-white};\n --secondary-bg-color: rgb(28, 62, 72);\n }\n}\n\n:host {\n --padding-top: 13px;\n --padding-end: 12px;\n --padding-bottom: 13px;\n --padding-start: 12px;\n --icon-size: 19px;\n --font-size: 11px;\n --global-nav-height: 61px;\n --bg-color: #001a21;\n --bg-color-hover: rgba(28, 62, 72, 0.8);\n --bg-color-selected: #274048;\n --bg-color-focus: rgba(28, 62, 72, 0.8);\n --focus-outline: none;\n --content-color: #{$color-white};\n --secondary-bg-color: rgb(28, 62, 72);\n\n @include text-inherit();\n\n display: block;\n z-index: 1;\n background: var(--bg-color);\n\n ::slotted(nano-nav-item) {\n --secondary-padding-top: var(--global-nav-height);\n --nano-icon-size: var(--icon-size);\n\n color: var(--content-color);\n font-size: var(--font-size);\n // font-weight: bold;\n text-decoration: none;\n box-sizing: border-box;\n }\n\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n}\n\n:host(.hide) {\n display: none;\n}\n\n:host(.has-global-nav) {\n .content-wrap {\n padding-top: var(--global-nav-height);\n\n @at-root {\n @supports ((position: sticky)) {\n & {\n margin-top: calc(var(--global-nav-height) * -1);\n }\n }\n }\n }\n}\n\n.container {\n right: auto;\n flex: 0 0 calc((var(--padding-end, 1em) * 2) + var(--icon-size));\n background: var(--bg-color);\n color: var(--content-color);\n z-index: 1;\n width: calc((var(--padding-end, 1em) * 2) + var(--icon-size));\n height: 100%;\n}\n\n:host(.open) {\n .container {\n width: auto;\n }\n}\n\n:host(:not(.loading)) {\n .container {\n transition: width 0.3s ease;\n }\n}\n\n.content-wrap {\n left: 0;\n top: 0;\n width: inherit;\n max-width: inherit;\n background: var(--bg-color);\n color: $color-white;\n position: fixed;\n position: sticky;\n font-size: var(--icon-size);\n line-height: 1;\n display: flex;\n min-height: calc(100vh - 61px);\n min-height: calc((var(--vh, 1vh) * 100) - 61px);\n z-index: 1;\n\n @include rtl-host {\n right: 0;\n left: auto;\n }\n}\n\n.content {\n width: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background: var(--bg-color);\n flex: 1;\n\n &::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n background: var(--bg-color);\n z-index: -1;\n height: 100vh;\n }\n}\n\n.collapse-btn {\n background: var(--bg-color-selected);\n border: none;\n color: inherit;\n font-size: var(--icon-size);\n margin:\n var(--padding-top) auto var(--padding-bottom)\n calc(var(--padding-start) / 2);\n border-radius: 4px;\n padding: 6px 5px;\n display: flex;\n align-content: center;\n width: 30px;\n flex: 0 0 auto;\n\n nano-icon {\n font-size: var(--icon-size);\n transition: 0.2s transform ease-in-out;\n transform: translateZ(0) rotate(0deg);\n\n :host(.open) & {\n transform: translateZ(0) rotate(180deg);\n }\n }\n}\n\n.foot {\n margin-top: auto;\n}\n\n.measure-ele {\n height: 1px;\n}\n","import {\n Component,\n h,\n Host,\n Prop,\n writeTask,\n State,\n Element,\n Watch,\n Listen,\n Build,\n} from '@stencil/core';\nimport { closestElement } from '../../utils';\nimport { NavItemEventDetail } from '../../interface';\n\nconst CANSHADOW = !!document.head.attachShadow;\n\n/**\n * Menu drawer - digital specific navigation strip designed to be open (default) or closed.\n * Shows menu item logos only on minimised, expands to show entire menu item.\n * Used in conjunction with the [Globla-Nav](/story/compounds-global-nav) element -> it should be a direct descendent.\n * Only one nano-menu-drawer element should be present on any page. It is fixed to a side on larger screens and items are added to the global nav 'burger' on smaller screens.\n * @slot foot - nav items to be placed at the bottom of the drawer\n * @slot - default slot for nav items\n */\n@Component({\n tag: 'nano-menu-drawer',\n styleUrl: 'menu-drawer.scss',\n shadow: true,\n})\nexport class MenuDrawer {\n private containerDiv: HTMLDivElement;\n private contentDiv: HTMLElement;\n private measureEle: HTMLElement;\n private debounceResize: () => {};\n private globalNav: HTMLNanoGlobalNavElement;\n private children: Array<{ slot: string; element: HTMLNanoNavItemElement }> =\n [];\n private io: IntersectionObserver;\n private currHeight: number = window.innerHeight;\n\n @Element() private el: HTMLNanoMenuDrawerElement;\n\n @State() reset: boolean = false;\n @State() widthOk: boolean = true;\n @State() heightOk: boolean = true;\n @State() isLoading: boolean = true;\n @State() hide: boolean = false;\n\n /**\n * Set the initial menu drawer open or closed\n */\n @Prop() open: boolean = true;\n\n /**\n * Save open state to localStorage\n */\n @Prop() saveState: boolean = true;\n\n /**\n * Screen width to hide the menu drawer and move the items into the nano-global-nav\n */\n @Prop() hideWidth: number = 576;\n\n /**\n * Should element hide and move items into the nano-global-nav when items are cut off\n * (this will only work when nano-menu-drawer is displayed at full screen)\n */\n @Prop() hideHeight: boolean = true;\n\n @Listen('nanoOpen')\n @Listen('nanoClose')\n cancelNavItemEvents(ev: CustomEvent) {\n if (!(ev.detail as NavItemEventDetail).secondaryMenu) return;\n ev.stopPropagation();\n }\n\n @Watch('open')\n openChange() {\n if (this.saveState)\n localStorage.setItem('nanoMenuDrawerOpen', this.open.toString());\n if (this.containerDiv) {\n if (this.open)\n writeTask(\n () =>\n (this.containerDiv.style.width = this.contentDiv.scrollWidth + 'px')\n );\n else writeTask(() => (this.containerDiv.style.width = null));\n }\n }\n\n @Watch('widthOk')\n widthChange() {\n if (this.widthOk) this.moveItemsToDrawer();\n else this.moveItemsToGlobalNav();\n }\n\n @Watch('hideHeight')\n hideHeightChange() {\n if (this.hideHeight && !this.io) this.attachIO();\n else if (!this.hideHeight && this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n }\n\n private moveItemsToGlobalNav() {\n let currNavItems = this.el.querySelectorAll('nano-nav-item');\n // dimensions not cool - move items out of element and into global nav\n currNavItems.forEach((element) => {\n this.children.push({\n slot: element.getAttribute('slot'),\n element: element,\n });\n element.setAttribute('slot', 'overflow');\n element.classList.add('nano-global-nav-menu');\n this.globalNav.appendChild(element);\n });\n this.hide = true;\n }\n\n private moveItemsToDrawer() {\n if (!this.children || !this.children.length) return;\n\n this.children.forEach((child) => {\n child.element.removeAttribute('slot');\n child.element.classList.remove('nano-global-nav-menu');\n if (child.slot && child.slot.length)\n child.element.setAttribute('slot', child.slot);\n this.el.appendChild(child.element);\n });\n this.children = [];\n this.hide = false;\n if (!this.io) this.attachIO();\n }\n\n private onWindowResize = () => {\n if (window.innerWidth > this.hideWidth) this.widthOk = true;\n else this.widthOk = false;\n\n let vh = window.innerHeight * 0.01;\n this.el.style.setProperty('--vh', `${vh}px`);\n\n if (\n window.innerHeight > this.currHeight &&\n this.widthOk &&\n !this.heightOk\n ) {\n this.moveItemsToDrawer();\n }\n this.currHeight = window.innerHeight;\n };\n\n private toggle = (e: MouseEvent) => {\n e.preventDefault();\n this.open = !this.open;\n };\n\n private onToggleKeyDown = (ev: KeyboardEvent) => {\n switch (ev.key) {\n case 'Enter':\n case ' ':\n this.open = !this.open;\n break;\n }\n };\n\n private attachIO() {\n if (!this.hideHeight) return;\n const io: IntersectionObserver = (this.io = new (\n window as any\n ).IntersectionObserver(\n (data: IntersectionObserverEntry[]) => {\n this.heightOk = data[0].intersectionRatio !== 0;\n if (!this.heightOk) {\n this.moveItemsToGlobalNav();\n this.io.disconnect();\n this.io = undefined;\n }\n },\n { threshold: 1 }\n ));\n io.observe(this.measureEle);\n }\n\n @Listen('nanoIsReady', { target: 'body' })\n handleGlobalNavReady(e: CustomEvent & { target: HTMLNanoGlobalNavElement }) {\n if (e.target.tagName !== 'NANO-GLOBAL-NAV') return;\n\n setTimeout(() => {\n this.attachIO();\n this.openChange();\n this.onWindowResize();\n this.isLoading = false;\n }, 500);\n }\n\n componentWillLoad() {\n this.globalNav = closestElement(\n 'nano-global-nav',\n this.el\n ) as HTMLNanoGlobalNavElement;\n\n this.widthOk = window.innerWidth > this.hideWidth;\n this.currHeight = window.innerHeight;\n\n if (this.saveState) {\n let localState = localStorage.getItem('nanoMenuDrawerOpen');\n this.open = localState ? localState === 'true' : this.open;\n }\n }\n\n componentDidLoad() {\n if (Build.isBrowser) {\n window.addEventListener('resize', this.onWindowResize);\n }\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.debounceResize);\n if (this.io) {\n this.io.disconnect();\n this.io = null;\n }\n }\n\n render() {\n return (\n <Host\n class={{\n open: this.open,\n hide: this.hide,\n legacy: !CANSHADOW,\n loading: this.isLoading,\n 'has-global-nav': !!this.globalNav,\n }}\n dir={(this.el.ownerDocument as Document).dir === 'rtl' ? 'rtl' : null}\n >\n <div ref={(div) => (this.containerDiv = div)} class=\"container\">\n <div class=\"content-wrap\">\n <nav ref={(div) => (this.contentDiv = div)} class=\"content\">\n <button\n onMouseDown={this.toggle}\n onKeyDown={this.onToggleKeyDown}\n class=\"collapse-btn\"\n >\n <nano-icon\n name=\"light/arrow-alt-to-right\"\n aria-label=\"collapse / expand\"\n ></nano-icon>\n </button>\n <slot />\n <div class=\"foot\">\n <div\n class=\"measure-ele\"\n ref={(div) => (this.measureEle = div)}\n ></div>\n <slot name=\"foot\" />\n </div>\n </nav>\n </div>\n </div>\n </Host>\n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U,GAAG,GAAG,CAAC,GAChC,EACP,YAAM,IAAI,EAAC,MAAM,GAAG,CAChB,CACF,CACF,CACF,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/menu-drawer/menu-drawer.scss?tag=nano-menu-drawer&encapsulation=shadow","./src/components/menu-drawer/menu-drawer.tsx"],"sourcesContent":["@use 'sass:map';\n@use 'sass:list';\n\n@import '../../global/style/utilities/globals';\n@import '../../global/style/nano-theme/base';\n@import '../../global/style/nano-theme/colours';\n\n:host(.legacy) {\n ::slotted(*),\n * {\n --global-nav-height: 61px;\n --padding-top: 13px;\n --padding-end: 13px;\n --padding-bottom: 13px;\n --padding-start: 13px;\n --secondary-padding-end: 13px;\n --secondary-padding-bottom: 13px;\n --secondary-padding-start: 13px;\n --secondary-padding-top: 61px;\n --icon-size: 19px;\n --font-size: 11px;\n --bg-color: #001a21;\n --bg-color-hover: rgba(28, 62, 72, 0.8);\n --bg-color-selected: #274048;\n --bg-color-open: #274048;\n --bg-color-focus: rgba(28, 62, 72, 0.8);\n --focus-outline: none;\n --content-color: #{map.get($colors, white)};\n --secondary-bg-color: rgb(28, 62, 72);\n }\n}\n\n:host {\n --padding-top: 13px;\n --padding-end: 12px;\n --padding-bottom: 13px;\n --padding-start: 12px;\n --icon-size: 19px;\n --font-size: 11px;\n --global-nav-height: 61px;\n --bg-color: #001a21;\n --bg-color-hover: rgba(28, 62, 72, 0.8);\n --bg-color-selected: #274048;\n --bg-color-focus: rgba(28, 62, 72, 0.8);\n --focus-outline: none;\n --content-color: #{map.get($colors, white)};\n --secondary-bg-color: rgb(28, 62, 72);\n\n @include text-inherit();\n\n display: block;\n z-index: 1;\n background: var(--bg-color);\n\n ::slotted(nano-nav-item) {\n --secondary-padding-top: var(--global-nav-height);\n --nano-icon-size: var(--icon-size);\n\n color: var(--content-color);\n font-size: var(--font-size);\n // font-weight: bold;\n text-decoration: none;\n box-sizing: border-box;\n }\n\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n}\n\n:host(.hide) {\n display: none;\n}\n\n:host(.has-global-nav) {\n .content-wrap {\n padding-top: var(--global-nav-height);\n\n @at-root {\n @supports ((position: sticky)) {\n & {\n margin-top: calc(var(--global-nav-height) * -1);\n }\n }\n }\n }\n}\n\n.container {\n right: auto;\n flex: 0 0 calc((var(--padding-end, 1em) * 2) + var(--icon-size));\n background: var(--bg-color);\n color: var(--content-color);\n z-index: 1;\n width: calc((var(--padding-end, 1em) * 2) + var(--icon-size));\n height: 100%;\n}\n\n:host(.open) {\n .container {\n width: auto;\n }\n}\n\n:host(:not(.loading)) {\n .container {\n transition: width 0.3s ease;\n }\n}\n\n.content-wrap {\n left: 0;\n top: 0;\n width: inherit;\n max-width: inherit;\n background: var(--bg-color);\n color: map.get($colors, white);\n position: fixed;\n position: sticky;\n font-size: var(--icon-size);\n line-height: 1;\n display: flex;\n min-height: calc(100vh - 61px);\n min-height: calc((var(--vh, 1vh) * 100) - 61px);\n z-index: 1;\n\n @include rtl-host {\n right: 0;\n left: auto;\n }\n}\n\n.content {\n width: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background: var(--bg-color);\n flex: 1;\n\n &::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n background: var(--bg-color);\n z-index: -1;\n height: 100vh;\n }\n}\n\n.collapse-btn {\n background: var(--bg-color-selected);\n border: none;\n color: inherit;\n font-size: var(--icon-size);\n margin:\n var(--padding-top) auto var(--padding-bottom)\n calc(var(--padding-start) / 2);\n border-radius: 4px;\n padding: 6px 5px;\n display: flex;\n align-content: center;\n width: 30px;\n flex: 0 0 auto;\n\n nano-icon {\n font-size: var(--icon-size);\n transition: 0.2s transform ease-in-out;\n transform: translateZ(0) rotate(0deg);\n\n :host(.open) & {\n transform: translateZ(0) rotate(180deg);\n }\n }\n}\n\n.foot {\n margin-top: auto;\n}\n\n.measure-ele {\n height: 1px;\n}\n","import {\n Component,\n h,\n Host,\n Prop,\n writeTask,\n State,\n Element,\n Watch,\n Listen,\n Build,\n} from '@stencil/core';\nimport { closestElement } from '../../utils';\nimport { NavItemEventDetail } from '../../interface';\n\nconst CANSHADOW = !!document.head.attachShadow;\n\n/**\n * Menu drawer - digital specific navigation strip designed to be open (default) or closed.\n * Shows menu item logos only on minimised, expands to show entire menu item.\n * Used in conjunction with the [Globla-Nav](/story/compounds-global-nav) element -> it should be a direct descendent.\n * Only one nano-menu-drawer element should be present on any page. It is fixed to a side on larger screens and items are added to the global nav 'burger' on smaller screens.\n * @slot foot - nav items to be placed at the bottom of the drawer\n * @slot - default slot for nav items\n */\n@Component({\n tag: 'nano-menu-drawer',\n styleUrl: 'menu-drawer.scss',\n shadow: true,\n})\nexport class MenuDrawer {\n private containerDiv: HTMLDivElement;\n private contentDiv: HTMLElement;\n private measureEle: HTMLElement;\n private debounceResize: () => {};\n private globalNav: HTMLNanoGlobalNavElement;\n private children: Array<{ slot: string; element: HTMLNanoNavItemElement }> =\n [];\n private io: IntersectionObserver;\n private currHeight: number = window.innerHeight;\n\n @Element() private el: HTMLNanoMenuDrawerElement;\n\n @State() reset: boolean = false;\n @State() widthOk: boolean = true;\n @State() heightOk: boolean = true;\n @State() isLoading: boolean = true;\n @State() hide: boolean = false;\n\n /**\n * Set the initial menu drawer open or closed\n */\n @Prop() open: boolean = true;\n\n /**\n * Save open state to localStorage\n */\n @Prop() saveState: boolean = true;\n\n /**\n * Screen width to hide the menu drawer and move the items into the nano-global-nav\n */\n @Prop() hideWidth: number = 576;\n\n /**\n * Should element hide and move items into the nano-global-nav when items are cut off\n * (this will only work when nano-menu-drawer is displayed at full screen)\n */\n @Prop() hideHeight: boolean = true;\n\n @Listen('nanoOpen')\n @Listen('nanoClose')\n cancelNavItemEvents(ev: CustomEvent) {\n if (!(ev.detail as NavItemEventDetail).secondaryMenu) return;\n ev.stopPropagation();\n }\n\n @Watch('open')\n openChange() {\n if (this.saveState)\n localStorage.setItem('nanoMenuDrawerOpen', this.open.toString());\n if (this.containerDiv) {\n if (this.open)\n writeTask(\n () =>\n (this.containerDiv.style.width = this.contentDiv.scrollWidth + 'px')\n );\n else writeTask(() => (this.containerDiv.style.width = null));\n }\n }\n\n @Watch('widthOk')\n widthChange() {\n if (this.widthOk) this.moveItemsToDrawer();\n else this.moveItemsToGlobalNav();\n }\n\n @Watch('hideHeight')\n hideHeightChange() {\n if (this.hideHeight && !this.io) this.attachIO();\n else if (!this.hideHeight && this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n }\n\n private moveItemsToGlobalNav() {\n let currNavItems = this.el.querySelectorAll('nano-nav-item');\n // dimensions not cool - move items out of element and into global nav\n currNavItems.forEach((element) => {\n this.children.push({\n slot: element.getAttribute('slot'),\n element: element,\n });\n element.setAttribute('slot', 'overflow');\n element.classList.add('nano-global-nav-menu');\n this.globalNav.appendChild(element);\n });\n this.hide = true;\n }\n\n private moveItemsToDrawer() {\n if (!this.children || !this.children.length) return;\n\n this.children.forEach((child) => {\n child.element.removeAttribute('slot');\n child.element.classList.remove('nano-global-nav-menu');\n if (child.slot && child.slot.length)\n child.element.setAttribute('slot', child.slot);\n this.el.appendChild(child.element);\n });\n this.children = [];\n this.hide = false;\n if (!this.io) this.attachIO();\n }\n\n private onWindowResize = () => {\n if (window.innerWidth > this.hideWidth) this.widthOk = true;\n else this.widthOk = false;\n\n let vh = window.innerHeight * 0.01;\n this.el.style.setProperty('--vh', `${vh}px`);\n\n if (\n window.innerHeight > this.currHeight &&\n this.widthOk &&\n !this.heightOk\n ) {\n this.moveItemsToDrawer();\n }\n this.currHeight = window.innerHeight;\n };\n\n private toggle = (e: MouseEvent) => {\n e.preventDefault();\n this.open = !this.open;\n };\n\n private onToggleKeyDown = (ev: KeyboardEvent) => {\n switch (ev.key) {\n case 'Enter':\n case ' ':\n this.open = !this.open;\n break;\n }\n };\n\n private attachIO() {\n if (!this.hideHeight) return;\n const io: IntersectionObserver = (this.io = new (\n window as any\n ).IntersectionObserver(\n (data: IntersectionObserverEntry[]) => {\n this.heightOk = data[0].intersectionRatio !== 0;\n if (!this.heightOk) {\n this.moveItemsToGlobalNav();\n this.io.disconnect();\n this.io = undefined;\n }\n },\n { threshold: 1 }\n ));\n io.observe(this.measureEle);\n }\n\n @Listen('nanoIsReady', { target: 'body' })\n handleGlobalNavReady(e: CustomEvent & { target: HTMLNanoGlobalNavElement }) {\n if (e.target.tagName !== 'NANO-GLOBAL-NAV') return;\n\n setTimeout(() => {\n this.attachIO();\n this.openChange();\n this.onWindowResize();\n this.isLoading = false;\n }, 500);\n }\n\n componentWillLoad() {\n this.globalNav = closestElement(\n 'nano-global-nav',\n this.el\n ) as HTMLNanoGlobalNavElement;\n\n this.widthOk = window.innerWidth > this.hideWidth;\n this.currHeight = window.innerHeight;\n\n if (this.saveState) {\n let localState = localStorage.getItem('nanoMenuDrawerOpen');\n this.open = localState ? localState === 'true' : this.open;\n }\n }\n\n componentDidLoad() {\n if (Build.isBrowser) {\n window.addEventListener('resize', this.onWindowResize);\n }\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.debounceResize);\n if (this.io) {\n this.io.disconnect();\n this.io = null;\n }\n }\n\n render() {\n return (\n <Host\n class={{\n open: this.open,\n hide: this.hide,\n legacy: !CANSHADOW,\n loading: this.isLoading,\n 'has-global-nav': !!this.globalNav,\n }}\n dir={(this.el.ownerDocument as Document).dir === 'rtl' ? 'rtl' : null}\n >\n <div ref={(div) => (this.containerDiv = div)} class=\"container\">\n <div class=\"content-wrap\">\n <nav ref={(div) => (this.contentDiv = div)} class=\"content\">\n <button\n onMouseDown={this.toggle}\n onKeyDown={this.onToggleKeyDown}\n class=\"collapse-btn\"\n >\n <nano-icon\n name=\"light/arrow-alt-to-right\"\n aria-label=\"collapse / expand\"\n ></nano-icon>\n </button>\n <slot />\n <div class=\"foot\">\n <div\n class=\"measure-ele\"\n ref={(div) => (this.measureEle = div)}\n ></div>\n <slot name=\"foot\" />\n </div>\n </nav>\n </div>\n </div>\n </Host>\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EACP,aACE,IAAI,EAAC,QAAQ,EACb,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,GACxC,CACE,CACF,EACN;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/rating/rating.scss?tag=nano-rating&encapsulation=scoped","./src/components/rating/rating.tsx"],"sourcesContent":["@import '../../global/style/utilities/globals';\n@import '../../global/style/nano-theme/colours';\n@import '../../global/style/nano-theme/form';\n\n:host {\n /**\n * @prop --symbol-color: The inactive color for symbols. Defaults to #{$color-palegrey}\n * @prop --symbol-color-active: The active color for symbols. Defaults to #{$color-palegrey}\n * @prop --symbol-size: The size of symbols. Defaults to contextual font size\n * @prop --symbol-spacing: The spacing to use around symbols. Defaults to .25rem\n * @prop --focus-shadow: Box shadow style when focused. Defaults to #{$control-focus-style}\n */\n\n --symbol-color: #{$color-palegrey};\n --symbol-color-active: #{$color-yellow};\n --symbol-spacing: 0.25rem;\n --focus-shadow: #{$control-focus-style};\n\n display: inline-block;\n}\n\n.rating-wrap {\n position: relative;\n margin: 0 calc(var(--symbol-spacing) * -1);\n}\n\n.rating {\n position: relative;\n border-radius: 5px;\n vertical-align: middle;\n width: 100%;\n transition: box-shadow 0.15s ease;\n\n &:focus {\n outline: none;\n }\n\n &.focus-visible:focus {\n box-shadow: var(--focus-shadow);\n }\n\n &__symbols {\n display: flex;\n align-items: center;\n position: relative;\n font-size: var(--symbol-size);\n color: var(--symbol-color);\n white-space: nowrap;\n cursor: pointer;\n line-height: 0;\n justify-content: space-between;\n\n &--inactive {\n .rating__symbol > :not(nano-icon) {\n background-color: currentColor !important;\n }\n }\n\n > * {\n margin: var(--symbol-spacing);\n }\n\n &--indicator {\n position: absolute;\n top: 0;\n left: 0;\n color: var(--symbol-color-active);\n pointer-events: none;\n width: 100%;\n }\n }\n\n &__symbol {\n transition: 0.2s transform;\n text-align: center;\n\n &--hover {\n transform: scale(1.2);\n }\n }\n\n &--disabled,\n &--readonly {\n .rating__symbols {\n cursor: default;\n }\n\n .rating__symbol {\n transform: none !important;\n }\n }\n\n &--disabled {\n opacity: 0.5;\n\n .rating__symbols {\n cursor: not-allowed;\n }\n }\n}\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n Method,\n Prop,\n State,\n Watch,\n h,\n ComponentInterface,\n} from '@stencil/core';\nimport { focusVisible } from '../../utils/focus-visible';\nimport { clamp } from '../../utils';\n\nconst CANSHADOW = !!document.head.attachShadow;\n\n/**\n * Rating - a form element to allow the viewing and input of user feedback.\n */\n@Component({\n tag: 'nano-rating',\n styleUrl: 'rating.scss',\n scoped: true,\n})\nexport class Rating implements ComponentInterface {\n private rating: HTMLElement;\n private isRtl: boolean;\n private indicator: HTMLElement;\n\n @Element() host: HTMLNanoRatingElement;\n\n @State() hoverValue = 0;\n @State() isHovering = false;\n\n /**\n * The current rating.\n */\n @Prop({ mutable: true, reflect: true }) value = 0;\n\n /**\n * The highest rating to show.\n */\n @Prop() max = 5;\n\n /**\n * The minimum increment value allowed by the control.\n */\n @Prop() precision = 1;\n\n /**\n * Makes the rating readonly.\n */\n @Prop() readonly = false;\n\n /**\n * Disables the rating.\n */\n @Prop() disabled = false;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name = '';\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() symbolName = 'solid/star';\n\n /**\n * A function that returns the symbols to display.\n * Allows for more granular control than `symbol-name`.\n * Accepts an option `value` parameter you can use to map a specific symbol to a value.\n */\n @Prop() symbol = (_: number) =>\n '<nano-icon name=\"' + this.symbolName + '\"></nano-icon>';\n\n @Watch('value')\n handleValueChange() {\n this.nanoChange.emit();\n }\n\n @Watch('symbolName')\n handleSymbolChange() {\n this.symbol = (_: number) =>\n '<nano-icon name=\"' + this.symbolName + '\"></nano-icon>';\n }\n\n /**\n * Emitted when the rating's value changes.\n */\n @Event() nanoChange!: EventEmitter<void>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() nanoBlur!: EventEmitter<void>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() nanoFocus!: EventEmitter<void>;\n\n /**\n * Sets focus on the rating.\n */\n @Method()\n async setFocus() {\n this.rating.focus();\n }\n\n /**\n * Removes focus from the rating.\n */\n @Method()\n async removeFocus() {\n this.rating.blur();\n }\n\n private getValueFromMousePosition(event: MouseEvent) {\n const containerLeft = this.rating.getBoundingClientRect().left;\n const containerWidth = this.rating.getBoundingClientRect().width;\n\n let num: number;\n num = this.roundToPrecision(\n ((event.clientX - containerLeft) / containerWidth) * this.max,\n this.precision\n );\n if (this.isRtl) num = this.max + this.precision - num;\n\n return clamp(num, 0, this.max);\n }\n\n private roundToPrecision(numberToRound: number, precision = 0.5) {\n const multiplier = 1 / precision;\n return Math.ceil(numberToRound * multiplier) / multiplier;\n }\n\n private handleClick = (event: MouseEvent) => {\n if (this.disabled || this.readonly) {\n return;\n }\n\n const newValue = this.getValueFromMousePosition(event);\n this.value = newValue === this.value ? 0 : newValue;\n this.isHovering = false;\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (this.disabled || this.readonly) {\n return;\n }\n\n if (event.key === 'ArrowLeft') {\n const decrement = event.shiftKey ? 1 : this.precision;\n this.value = this.roundToPrecision(Math.max(0, this.value - decrement));\n event.preventDefault();\n }\n\n if (event.key === 'ArrowRight') {\n const increment = event.shiftKey ? 1 : this.precision;\n this.value = this.roundToPrecision(\n Math.min(this.max, this.value + increment)\n );\n event.preventDefault();\n }\n\n if (event.key === 'Home') {\n this.value = 0;\n event.preventDefault();\n }\n\n if (event.key === 'End') {\n this.value = this.max;\n event.preventDefault();\n }\n };\n\n private handleMouseEnter = () => {\n this.isHovering = true;\n };\n\n private handleMouseLeave = () => {\n this.isHovering = false;\n };\n\n private handleFocus = () => {\n this.nanoFocus.emit();\n };\n\n private handleBlur = () => {\n this.nanoBlur.emit();\n };\n\n private handleMouseMove = (event: MouseEvent) => {\n this.hoverValue = this.getValueFromMousePosition(event);\n };\n\n private clip(displayValue: number) {\n if (!this.rating) return;\n const tw = this.rating.getBoundingClientRect().width;\n if (this.isRtl)\n return `rect(0, ${tw}px, 2em, ${\n tw - (tw / 100) * ((displayValue / this.max) * 100)\n }px)`;\n return `rect(0, ${\n (tw / 100) * ((displayValue / this.max) * 100)\n }px, 2em, 0)`;\n }\n\n private _getRoot() {\n return this.host.shadowRoot ? this.host.shadowRoot : this.host;\n }\n\n private _fixClassNames() {\n let ctxClasses = this.rating.className\n .split(' ')\n .filter((classStr) => classStr.match(/^sc-nano/));\n let eles = this._getRoot().querySelectorAll('*');\n if (!eles) return;\n Array.from(eles).map((ele: HTMLElement) => {\n ctxClasses.map((classStr) => ele.classList.add(classStr));\n });\n }\n\n componentDidLoad() {\n focusVisible.observe(this.rating);\n setTimeout(() => (this.indicator.style.clip = this.clip(this.value)), 20);\n }\n\n connectedCallback() {\n this.isRtl =\n this.host.dir === 'rtl' ||\n (this.host.ownerDocument as Document).dir === 'rtl';\n }\n\n disconnectedCallback() {\n focusVisible.unobserve(this.rating);\n }\n\n componentDidRender() {\n if (!this.host.shadowRoot || !CANSHADOW) this._fixClassNames();\n }\n\n render() {\n this.isRtl =\n this.host.dir === 'rtl' ||\n (this.host.ownerDocument as Document).dir === 'rtl';\n\n let counter = Array.from(Array(this.max).keys());\n\n let displayValue = 0;\n if (this.disabled || this.readonly) {\n displayValue = this.value;\n } else {\n displayValue = this.isHovering ? this.hoverValue : this.value;\n }\n\n return (\n <div class=\"rating-wrap\">\n <div\n dir={this.isRtl ? 'rtl' : null}\n ref={(el) => (this.rating = el)}\n part=\"base\"\n class={{\n rating: true,\n 'rating--readonly': this.readonly,\n 'rating--disabled': this.disabled,\n }}\n aria-disabled={this.disabled ? 'true' : 'false'}\n aria-readonly={this.readonly ? 'true' : 'false'}\n aria-valuenow={this.value}\n aria-valuemin={0}\n aria-valuemax={this.max}\n tabIndex={this.disabled ? -1 : 0}\n onClick={this.handleClick}\n onKeyDown={this.handleKeyDown}\n onMouseEnter={this.handleMouseEnter}\n onMouseLeave={this.handleMouseLeave}\n onMouseMove={this.handleMouseMove}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n >\n <span class=\"rating__symbols rating__symbols--inactive\">\n {counter.map((index) => (\n <span\n class={{\n rating__symbol: true,\n 'rating__symbol--hover':\n this.isHovering && Math.ceil(displayValue) === index + 1,\n }}\n role=\"presentation\"\n // Users can click the current value to clear the rating. When this happens, we set this.isHovering to\n // false to prevent the hover state from confusing them as they move the mouse out of the control. This\n // extra mouseenter will reinstate it if they happen to mouse over an adjacent symbol.\n onMouseEnter={this.handleMouseEnter}\n innerHTML={this.symbol(index + 1)}\n />\n ))}\n </span>\n\n <span\n ref={(span) => (this.indicator = span)}\n class=\"rating__symbols rating__symbols--indicator\"\n style={{\n clip: this.clip(displayValue),\n }}\n >\n {counter.map((index) => (\n <span\n class={{\n rating__symbol: true,\n 'rating__symbol--hover':\n this.isHovering && Math.ceil(displayValue) === index + 1,\n }}\n role=\"presentation\"\n innerHTML={this.symbol(index + 1)}\n />\n ))}\n </span>\n <input\n type=\"hidden\"\n name={this.name}\n value={this.value}\n disabled={this.disabled || this.readonly}\n />\n </div>\n </div>\n );\n }\n}\n"],"version":3}
|
1
|
+
{"file":"nano-rating.js","mappings":";;;;;;;AAAA,MAAM,SAAS,GAAG,85EAA85E;;ACeh7E,MAAM,SAAS,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC;IAUlC,MAAM;EALnB;;;;;;IAYW,eAAU,GAAG,CAAC,CAAC;IACf,eAAU,GAAG,KAAK,CAAC;;;;IAKY,UAAK,GAAG,CAAC,CAAC;;;;IAK1C,QAAG,GAAG,CAAC,CAAC;;;;IAKR,cAAS,GAAG,CAAC,CAAC;;;;IAKd,aAAQ,GAAG,KAAK,CAAC;;;;IAKjB,aAAQ,GAAG,KAAK,C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AAK,EAAE;QACL,cAAc,EAAE,IAAI;QACpB,uBAAuB,EACrB,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,KAAK,GAAG,CAAC;OAC3D,EACD,IAAI,EAAC,cAAc;;;;MAInB,YAAY,EAAE,IAAI,CAAC,gBAAgB,EACnC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,GACjC,CACH,CAAC,CACG,EAEP,YACE,GAAG,EAAE,CAAC,IAAI,MAAM,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,EACtC,KAAK,EAAC,4CAA4C,EAClD,KAAK,EAAE;QACL,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;OAC9B,IAEA,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,MACjB,YACE,KAAK,EAAE;QACL,cAAc,EAAE,IAAI;QACpB,uBAAuB,EACrB,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,KAAK,GAAG,CAAC;OAC3D,EACD,IAAI,EAAC,cAAc,EACnB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,GACjC,CACH,CAAC,CACG,EACP,aACE,IAAI,EAAC,QAAQ,EACb,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,GACxC,CACE,CACF,EACN;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/rating/rating.scss?tag=nano-rating&encapsulation=scoped","./src/components/rating/rating.tsx"],"sourcesContent":["@use 'sass:map';\n@use 'sass:list';\n\n@import '../../global/style/utilities/globals';\n@import '../../global/style/nano-theme/colours';\n@import '../../global/style/nano-theme/form';\n\n:host {\n /**\n * @prop --symbol-color: The inactive color for symbols. Defaults to #{map.get($colors, palegrey)}\n * @prop --symbol-color-active: The active color for symbols. Defaults to #{map.get($colors, palegrey)}\n * @prop --symbol-size: The size of symbols. Defaults to contextual font size\n * @prop --symbol-spacing: The spacing to use around symbols. Defaults to .25rem\n * @prop --focus-shadow: Box shadow style when focused. Defaults to #{$control-focus-style}\n */\n\n --symbol-color: #{map.get($colors, palegrey)};\n --symbol-color-active: #{map.get($colors, yellow)};\n --symbol-spacing: 0.25rem;\n --focus-shadow: #{$control-focus-style};\n\n display: inline-block;\n}\n\n.rating-wrap {\n position: relative;\n margin: 0 calc(var(--symbol-spacing) * -1);\n}\n\n.rating {\n position: relative;\n border-radius: 5px;\n vertical-align: middle;\n width: 100%;\n transition: box-shadow 0.15s ease;\n\n &:focus {\n outline: none;\n }\n\n &.focus-visible:focus {\n box-shadow: var(--focus-shadow);\n }\n\n &__symbols {\n display: flex;\n align-items: center;\n position: relative;\n font-size: var(--symbol-size);\n color: var(--symbol-color);\n white-space: nowrap;\n cursor: pointer;\n line-height: 0;\n justify-content: space-between;\n\n &--inactive {\n .rating__symbol > :not(nano-icon) {\n background-color: currentColor !important;\n }\n }\n\n > * {\n margin: var(--symbol-spacing);\n }\n\n &--indicator {\n position: absolute;\n top: 0;\n left: 0;\n color: var(--symbol-color-active);\n pointer-events: none;\n width: 100%;\n }\n }\n\n &__symbol {\n transition: 0.2s transform;\n text-align: center;\n\n &--hover {\n transform: scale(1.2);\n }\n }\n\n &--disabled,\n &--readonly {\n .rating__symbols {\n cursor: default;\n }\n\n .rating__symbol {\n transform: none !important;\n }\n }\n\n &--disabled {\n opacity: 0.5;\n\n .rating__symbols {\n cursor: not-allowed;\n }\n }\n}\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n Method,\n Prop,\n State,\n Watch,\n h,\n ComponentInterface,\n} from '@stencil/core';\nimport { focusVisible } from '../../utils/focus-visible';\nimport { clamp } from '../../utils';\n\nconst CANSHADOW = !!document.head.attachShadow;\n\n/**\n * Rating - a form element to allow the viewing and input of user feedback.\n */\n@Component({\n tag: 'nano-rating',\n styleUrl: 'rating.scss',\n scoped: true,\n})\nexport class Rating implements ComponentInterface {\n private rating: HTMLElement;\n private isRtl: boolean;\n private indicator: HTMLElement;\n\n @Element() host: HTMLNanoRatingElement;\n\n @State() hoverValue = 0;\n @State() isHovering = false;\n\n /**\n * The current rating.\n */\n @Prop({ mutable: true, reflect: true }) value = 0;\n\n /**\n * The highest rating to show.\n */\n @Prop() max = 5;\n\n /**\n * The minimum increment value allowed by the control.\n */\n @Prop() precision = 1;\n\n /**\n * Makes the rating readonly.\n */\n @Prop() readonly = false;\n\n /**\n * Disables the rating.\n */\n @Prop() disabled = false;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name = '';\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() symbolName = 'solid/star';\n\n /**\n * A function that returns the symbols to display.\n * Allows for more granular control than `symbol-name`.\n * Accepts an option `value` parameter you can use to map a specific symbol to a value.\n */\n @Prop() symbol = (_: number) =>\n '<nano-icon name=\"' + this.symbolName + '\"></nano-icon>';\n\n @Watch('value')\n handleValueChange() {\n this.nanoChange.emit();\n }\n\n @Watch('symbolName')\n handleSymbolChange() {\n this.symbol = (_: number) =>\n '<nano-icon name=\"' + this.symbolName + '\"></nano-icon>';\n }\n\n /**\n * Emitted when the rating's value changes.\n */\n @Event() nanoChange!: EventEmitter<void>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() nanoBlur!: EventEmitter<void>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() nanoFocus!: EventEmitter<void>;\n\n /**\n * Sets focus on the rating.\n */\n @Method()\n async setFocus() {\n this.rating.focus();\n }\n\n /**\n * Removes focus from the rating.\n */\n @Method()\n async removeFocus() {\n this.rating.blur();\n }\n\n private getValueFromMousePosition(event: MouseEvent) {\n const containerLeft = this.rating.getBoundingClientRect().left;\n const containerWidth = this.rating.getBoundingClientRect().width;\n\n let num: number;\n num = this.roundToPrecision(\n ((event.clientX - containerLeft) / containerWidth) * this.max,\n this.precision\n );\n if (this.isRtl) num = this.max + this.precision - num;\n\n return clamp(num, 0, this.max);\n }\n\n private roundToPrecision(numberToRound: number, precision = 0.5) {\n const multiplier = 1 / precision;\n return Math.ceil(numberToRound * multiplier) / multiplier;\n }\n\n private handleClick = (event: MouseEvent) => {\n if (this.disabled || this.readonly) {\n return;\n }\n\n const newValue = this.getValueFromMousePosition(event);\n this.value = newValue === this.value ? 0 : newValue;\n this.isHovering = false;\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (this.disabled || this.readonly) {\n return;\n }\n\n if (event.key === 'ArrowLeft') {\n const decrement = event.shiftKey ? 1 : this.precision;\n this.value = this.roundToPrecision(Math.max(0, this.value - decrement));\n event.preventDefault();\n }\n\n if (event.key === 'ArrowRight') {\n const increment = event.shiftKey ? 1 : this.precision;\n this.value = this.roundToPrecision(\n Math.min(this.max, this.value + increment)\n );\n event.preventDefault();\n }\n\n if (event.key === 'Home') {\n this.value = 0;\n event.preventDefault();\n }\n\n if (event.key === 'End') {\n this.value = this.max;\n event.preventDefault();\n }\n };\n\n private handleMouseEnter = () => {\n this.isHovering = true;\n };\n\n private handleMouseLeave = () => {\n this.isHovering = false;\n };\n\n private handleFocus = () => {\n this.nanoFocus.emit();\n };\n\n private handleBlur = () => {\n this.nanoBlur.emit();\n };\n\n private handleMouseMove = (event: MouseEvent) => {\n this.hoverValue = this.getValueFromMousePosition(event);\n };\n\n private clip(displayValue: number) {\n if (!this.rating) return;\n const tw = this.rating.getBoundingClientRect().width;\n if (this.isRtl)\n return `rect(0, ${tw}px, 2em, ${\n tw - (tw / 100) * ((displayValue / this.max) * 100)\n }px)`;\n return `rect(0, ${\n (tw / 100) * ((displayValue / this.max) * 100)\n }px, 2em, 0)`;\n }\n\n private _getRoot() {\n return this.host.shadowRoot ? this.host.shadowRoot : this.host;\n }\n\n private _fixClassNames() {\n let ctxClasses = this.rating.className\n .split(' ')\n .filter((classStr) => classStr.match(/^sc-nano/));\n let eles = this._getRoot().querySelectorAll('*');\n if (!eles) return;\n Array.from(eles).map((ele: HTMLElement) => {\n ctxClasses.map((classStr) => ele.classList.add(classStr));\n });\n }\n\n componentDidLoad() {\n focusVisible.observe(this.rating);\n setTimeout(() => (this.indicator.style.clip = this.clip(this.value)), 20);\n }\n\n connectedCallback() {\n this.isRtl =\n this.host.dir === 'rtl' ||\n (this.host.ownerDocument as Document).dir === 'rtl';\n }\n\n disconnectedCallback() {\n focusVisible.unobserve(this.rating);\n }\n\n componentDidRender() {\n if (!this.host.shadowRoot || !CANSHADOW) this._fixClassNames();\n }\n\n render() {\n this.isRtl =\n this.host.dir === 'rtl' ||\n (this.host.ownerDocument as Document).dir === 'rtl';\n\n let counter = Array.from(Array(this.max).keys());\n\n let displayValue = 0;\n if (this.disabled || this.readonly) {\n displayValue = this.value;\n } else {\n displayValue = this.isHovering ? this.hoverValue : this.value;\n }\n\n return (\n <div class=\"rating-wrap\">\n <div\n dir={this.isRtl ? 'rtl' : null}\n ref={(el) => (this.rating = el)}\n part=\"base\"\n class={{\n rating: true,\n 'rating--readonly': this.readonly,\n 'rating--disabled': this.disabled,\n }}\n aria-disabled={this.disabled ? 'true' : 'false'}\n aria-readonly={this.readonly ? 'true' : 'false'}\n aria-valuenow={this.value}\n aria-valuemin={0}\n aria-valuemax={this.max}\n tabIndex={this.disabled ? -1 : 0}\n onClick={this.handleClick}\n onKeyDown={this.handleKeyDown}\n onMouseEnter={this.handleMouseEnter}\n onMouseLeave={this.handleMouseLeave}\n onMouseMove={this.handleMouseMove}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n >\n <span class=\"rating__symbols rating__symbols--inactive\">\n {counter.map((index) => (\n <span\n class={{\n rating__symbol: true,\n 'rating__symbol--hover':\n this.isHovering && Math.ceil(displayValue) === index + 1,\n }}\n role=\"presentation\"\n // Users can click the current value to clear the rating. When this happens, we set this.isHovering to\n // false to prevent the hover state from confusing them as they move the mouse out of the control. This\n // extra mouseenter will reinstate it if they happen to mouse over an adjacent symbol.\n onMouseEnter={this.handleMouseEnter}\n innerHTML={this.symbol(index + 1)}\n />\n ))}\n </span>\n\n <span\n ref={(span) => (this.indicator = span)}\n class=\"rating__symbols rating__symbols--indicator\"\n style={{\n clip: this.clip(displayValue),\n }}\n >\n {counter.map((index) => (\n <span\n class={{\n rating__symbol: true,\n 'rating__symbol--hover':\n this.isHovering && Math.ceil(displayValue) === index + 1,\n }}\n role=\"presentation\"\n innerHTML={this.symbol(index + 1)}\n />\n ))}\n </span>\n <input\n type=\"hidden\"\n name={this.name}\n value={this.value}\n disabled={this.disabled || this.readonly}\n />\n </div>\n </div>\n );\n }\n}\n"],"version":3}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { Components, JSX } from "../types/scss.vars";
|
2
|
+
|
3
|
+
interface NanoSplitPane extends Components.NanoSplitPane, HTMLElement {}
|
4
|
+
export const NanoSplitPane: {
|
5
|
+
prototype: NanoSplitPane;
|
6
|
+
new (): NanoSplitPane;
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* Used to define this component and all nested components recursively.
|
10
|
+
*/
|
11
|
+
export const defineCustomElement: () => void;
|
@@ -0,0 +1,308 @@
|
|
1
|
+
/*!
|
2
|
+
* Web Components for Nanopore digital Web Apps
|
3
|
+
*/
|
4
|
+
import { HTMLElement, createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
|
5
|
+
import { c as clamp, r as raf } from './index2.js';
|
6
|
+
import { d as defineCustomElement$2 } from './icon.js';
|
7
|
+
import { d as debounce } from './throttle.js';
|
8
|
+
|
9
|
+
function drag(container, onMove) {
|
10
|
+
function move(pointerEvent) {
|
11
|
+
const dims = container.getBoundingClientRect();
|
12
|
+
const defaultView = container.ownerDocument.defaultView;
|
13
|
+
const offsetX = dims.left + defaultView.pageXOffset;
|
14
|
+
const offsetY = dims.top + defaultView.pageYOffset;
|
15
|
+
const x = pointerEvent.pageX - offsetX;
|
16
|
+
const y = pointerEvent.pageY - offsetY;
|
17
|
+
onMove(x, y);
|
18
|
+
}
|
19
|
+
function stop() {
|
20
|
+
document.removeEventListener('pointermove', move);
|
21
|
+
document.removeEventListener('pointerup', stop);
|
22
|
+
}
|
23
|
+
document.addEventListener('pointermove', move, { passive: true });
|
24
|
+
document.addEventListener('pointerup', stop);
|
25
|
+
}
|
26
|
+
|
27
|
+
const splitPaneCss = ":host{-webkit-box-sizing:border-box;box-sizing:border-box}*,*::before,*::after{-webkit-box-sizing:border-box;box-sizing:border-box}[hidden]{display:none !important}:host{--divider-width:12px;--divider-hit-area:14px;--min:0%;--max:100%;--background-color:#e4e6e8;--content-color:#918b86;display:-ms-grid;display:grid}.start,.end{overflow:hidden}.divider{-webkit-box-flex:0;-ms-flex:0 0 var(--divider-width);flex:0 0 var(--divider-width);display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;background-color:var(--background-color);color:var(--content-color);z-index:1;font-size:0.8rem}.divider:focus{outline:none}:host(:not([disabled])) .divider:focus-visible{background-color:var(--nano-control-focus-color, rgba(144, 198, 231, 0.8))}:host([disabled]) .divider{cursor:not-allowed}:host(:not([vertical],[disabled])) .divider{cursor:col-resize}:host(:not([vertical])) .divider::after{display:-webkit-box;display:-ms-flexbox;display:flex;content:\"\";position:absolute;height:100%;left:calc(var(--divider-hit-area) / -2 + var(--divider-width) / 2);width:var(--divider-hit-area)}:host([vertical]){-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}:host([vertical]:not([disabled])) .divider{cursor:row-resize}:host([vertical]) .divider::after{content:\"\";position:absolute;width:100%;top:calc(var(--divider-hit-area) / -2 + var(--divider-width) / 2);height:var(--divider-hit-area)}";
|
28
|
+
|
29
|
+
let SplitPane = class extends HTMLElement {
|
30
|
+
constructor() {
|
31
|
+
super();
|
32
|
+
this.__registerHost();
|
33
|
+
this.__attachShadow();
|
34
|
+
this.nanoReposition = createEvent(this, "nanoReposition", 7);
|
35
|
+
this.nanoDragging = createEvent(this, "nanoDragging", 7);
|
36
|
+
this.isAnimating = false;
|
37
|
+
this.didLoad = false;
|
38
|
+
this._shouldAnimate = true;
|
39
|
+
/** Draws the split panel in a vertical orientation with the start and end panels stacked. */
|
40
|
+
this.vertical = false;
|
41
|
+
/** Disables resizing. Note that the position may still change as a result of resizing the host element. */
|
42
|
+
this.disabled = false;
|
43
|
+
/** How close the divider must be to a snap point until snapping occurs. */
|
44
|
+
this.snapThreshold = 12;
|
45
|
+
/** When changing `position` via property, the pane will animate into position. Make `animationDuration` 0 to disable. */
|
46
|
+
this.animationDuration = 0.6;
|
47
|
+
// Event handlers
|
48
|
+
this.handleDrag = (e) => {
|
49
|
+
if (this.disabled) {
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
// Prevent text selection when dragging
|
53
|
+
e.preventDefault();
|
54
|
+
drag(this.host, (x, y) => {
|
55
|
+
let newPositionInPixels = this.vertical ? y : x;
|
56
|
+
this.nanoDragging.emit(newPositionInPixels);
|
57
|
+
// Flip for end panels
|
58
|
+
if (this.primary === 'end') {
|
59
|
+
newPositionInPixels = this.size - newPositionInPixels;
|
60
|
+
}
|
61
|
+
// Check snap points
|
62
|
+
if (this.snap) {
|
63
|
+
const snaps = this.snap.split(' ');
|
64
|
+
snaps.forEach((value) => {
|
65
|
+
let snapPoint;
|
66
|
+
if (value.endsWith('%')) {
|
67
|
+
snapPoint = this.size * (parseFloat(value) / 100);
|
68
|
+
}
|
69
|
+
else {
|
70
|
+
snapPoint = parseFloat(value);
|
71
|
+
}
|
72
|
+
if (newPositionInPixels >= snapPoint - this.snapThreshold &&
|
73
|
+
newPositionInPixels <= snapPoint + this.snapThreshold) {
|
74
|
+
newPositionInPixels = snapPoint;
|
75
|
+
}
|
76
|
+
});
|
77
|
+
}
|
78
|
+
this.shouldAnimate = false;
|
79
|
+
this.position = clamp(this.pixelsToPercentage(newPositionInPixels), 0, 100);
|
80
|
+
raf(() => (this.shouldAnimate = true));
|
81
|
+
});
|
82
|
+
};
|
83
|
+
this.handleKeyDown = (event) => {
|
84
|
+
if (this.disabled) {
|
85
|
+
return;
|
86
|
+
}
|
87
|
+
if ([
|
88
|
+
'ArrowLeft',
|
89
|
+
'ArrowRight',
|
90
|
+
'ArrowUp',
|
91
|
+
'ArrowDown',
|
92
|
+
'Home',
|
93
|
+
'End',
|
94
|
+
].includes(event.key)) {
|
95
|
+
let newPosition = this.position;
|
96
|
+
const incr = (event.shiftKey ? 10 : 1) * (this.primary === 'end' ? -1 : 1);
|
97
|
+
event.preventDefault();
|
98
|
+
if ((event.key === 'ArrowLeft' && !this.vertical) ||
|
99
|
+
(event.key === 'ArrowUp' && this.vertical)) {
|
100
|
+
newPosition -= incr;
|
101
|
+
}
|
102
|
+
if ((event.key === 'ArrowRight' && !this.vertical) ||
|
103
|
+
(event.key === 'ArrowDown' && this.vertical)) {
|
104
|
+
newPosition += incr;
|
105
|
+
}
|
106
|
+
if (event.key === 'Home') {
|
107
|
+
newPosition = this.primary === 'end' ? 100 : 0;
|
108
|
+
}
|
109
|
+
if (event.key === 'End') {
|
110
|
+
newPosition = this.primary === 'end' ? 0 : 100;
|
111
|
+
}
|
112
|
+
this.shouldAnimate = false;
|
113
|
+
this.position = clamp(newPosition, 0, 100);
|
114
|
+
raf(() => (this.shouldAnimate = true));
|
115
|
+
}
|
116
|
+
};
|
117
|
+
this.handleResize = () => {
|
118
|
+
if (!this.didLoad || this.isAnimating)
|
119
|
+
return;
|
120
|
+
// Resize when a primary panel is set
|
121
|
+
if (this.primary) {
|
122
|
+
this.shouldAnimate = false;
|
123
|
+
this.position = this.pixelsToPercentage(this.cachedPositionInPixels);
|
124
|
+
raf(() => (this.shouldAnimate = true));
|
125
|
+
}
|
126
|
+
};
|
127
|
+
this.handlePositionChange = debounce(this.handlePositionChange.bind(this), 100);
|
128
|
+
}
|
129
|
+
get size() {
|
130
|
+
const { width, height } = this.host.getBoundingClientRect();
|
131
|
+
return this.vertical ? height : width;
|
132
|
+
}
|
133
|
+
get shouldAnimate() {
|
134
|
+
return this.didLoad && this._shouldAnimate;
|
135
|
+
}
|
136
|
+
set shouldAnimate(sa) {
|
137
|
+
this._shouldAnimate = sa;
|
138
|
+
}
|
139
|
+
/**
|
140
|
+
* The current position of the divider from the primary panel's edge as a percentage 0-100. Defaults to 50% of the
|
141
|
+
* container's initial size.
|
142
|
+
*/
|
143
|
+
get position() {
|
144
|
+
return this._position;
|
145
|
+
}
|
146
|
+
set position(pos) {
|
147
|
+
// override too high / low
|
148
|
+
pos = Math.min(Math.max(pos, 0), 100);
|
149
|
+
if (isNaN(pos) || pos === this._position)
|
150
|
+
return;
|
151
|
+
if (this.shouldAnimate &&
|
152
|
+
this.animationDuration > 0 &&
|
153
|
+
!isNaN(this.position)) {
|
154
|
+
this.animatePosition(pos);
|
155
|
+
return;
|
156
|
+
}
|
157
|
+
this._position = pos;
|
158
|
+
}
|
159
|
+
// eslint-disable-next-line @stencil/no-unused-watch
|
160
|
+
handlePositionChange() {
|
161
|
+
this.cachedPositionInPixels = this.percentageToPixels(this.position);
|
162
|
+
this.positionInPixels = this.percentageToPixels(this.position);
|
163
|
+
this.nanoReposition.emit();
|
164
|
+
}
|
165
|
+
handlePositionInPixelsChange() {
|
166
|
+
this.position = this.pixelsToPercentage(this.positionInPixels);
|
167
|
+
}
|
168
|
+
// Private logic
|
169
|
+
animatePosition(end) {
|
170
|
+
if (this.isAnimating)
|
171
|
+
return;
|
172
|
+
const duration = this.animationDuration; // seconds
|
173
|
+
const fps = 60;
|
174
|
+
const start = this.position;
|
175
|
+
const distance = end - start;
|
176
|
+
let position = start;
|
177
|
+
let time = 0;
|
178
|
+
function easeInOutQuad(t, s, e, d) {
|
179
|
+
if ((t /= d / 2) < 1)
|
180
|
+
return (e / 2) * t * t + s;
|
181
|
+
else
|
182
|
+
return (-e / 2) * (--t * (t - 2) - 1) + s;
|
183
|
+
}
|
184
|
+
const go = () => {
|
185
|
+
time += 1 / fps;
|
186
|
+
position = easeInOutQuad(time, start, distance, duration);
|
187
|
+
if ((end > start && position >= end) ||
|
188
|
+
(end < start && position <= end)) {
|
189
|
+
this.position = end;
|
190
|
+
this.shouldAnimate = true;
|
191
|
+
this.isAnimating = false;
|
192
|
+
return;
|
193
|
+
}
|
194
|
+
this.position = position;
|
195
|
+
raf(go);
|
196
|
+
};
|
197
|
+
this.shouldAnimate = false;
|
198
|
+
this.isAnimating = true;
|
199
|
+
raf(go);
|
200
|
+
}
|
201
|
+
percentageToPixels(value) {
|
202
|
+
return this.size * (value / 100);
|
203
|
+
}
|
204
|
+
pixelsToPercentage(value) {
|
205
|
+
return (value / this.size) * 100;
|
206
|
+
}
|
207
|
+
attachRO() {
|
208
|
+
this.detachRO();
|
209
|
+
this.ro = new ResizeObserver(() => this.handleResize());
|
210
|
+
this.ro.observe(this.host);
|
211
|
+
}
|
212
|
+
detachRO() {
|
213
|
+
if (!this.ro)
|
214
|
+
return;
|
215
|
+
this.ro.unobserve(this.host);
|
216
|
+
this.ro = undefined;
|
217
|
+
}
|
218
|
+
componentDidLoad() {
|
219
|
+
if (this.positionInPixels)
|
220
|
+
this.handlePositionInPixelsChange();
|
221
|
+
setTimeout(() => (this.didLoad = true));
|
222
|
+
}
|
223
|
+
connectedCallback() {
|
224
|
+
this.cachedPositionInPixels = this.percentageToPixels(this.position);
|
225
|
+
this.attachRO();
|
226
|
+
}
|
227
|
+
disconnectedCallback() {
|
228
|
+
this.detachRO();
|
229
|
+
}
|
230
|
+
componentDidRender() {
|
231
|
+
// bit hacky ... because we use getter / setter for position, there's a render *before* `position` is passed in via attribute
|
232
|
+
// if we set a default position in the class, this causes the divider to jump (from default to user set position)
|
233
|
+
// so - wait a render, see if there's a position passed in via attribute, *then* set default if not
|
234
|
+
raf(() => {
|
235
|
+
if (typeof this.position === 'undefined') {
|
236
|
+
this.position = 50;
|
237
|
+
}
|
238
|
+
});
|
239
|
+
}
|
240
|
+
render() {
|
241
|
+
if (typeof this.position === 'undefined')
|
242
|
+
return;
|
243
|
+
const styles = {};
|
244
|
+
const gridTemplate = this.vertical
|
245
|
+
? 'gridTemplateRows'
|
246
|
+
: 'gridTemplateColumns';
|
247
|
+
const primary = `
|
248
|
+
clamp(
|
249
|
+
0%,
|
250
|
+
clamp(
|
251
|
+
var(--min),
|
252
|
+
${this.position}% - var(--divider-width) / 2,
|
253
|
+
var(--max)
|
254
|
+
),
|
255
|
+
calc(100% - var(--divider-width))
|
256
|
+
)
|
257
|
+
`;
|
258
|
+
const secondary = 'auto';
|
259
|
+
if (this.primary === 'end') {
|
260
|
+
styles[gridTemplate] = `${secondary} var(--divider-width) ${primary}`;
|
261
|
+
}
|
262
|
+
else {
|
263
|
+
styles[gridTemplate] = `${primary} var(--divider-width) ${secondary}`;
|
264
|
+
}
|
265
|
+
return (h(Host, { style: styles }, h("div", { part: "panel start", class: "start" }, h("slot", { name: "start" })), h("div", { part: "divider", class: "divider", tabindex: this.disabled ? undefined : '0', role: "separator", "aria-label": "Resize", onKeyDown: this.handleKeyDown, onMouseDown: this.handleDrag, onTouchStart: this.handleDrag }, h("slot", { name: "handle" }, !this.disabled && this.vertical ? (h("nano-icon", { slot: "handle", name: "solid/grip-lines" })) : (h("nano-icon", { slot: "handle", name: "solid/grip-lines-vertical" })))), h("div", { part: "panel end", class: "end" }, h("slot", { name: "end" }))));
|
266
|
+
}
|
267
|
+
get host() { return this; }
|
268
|
+
static get watchers() { return {
|
269
|
+
"position": ["handlePositionChange"],
|
270
|
+
"positionInPixels": ["handlePositionInPixelsChange"]
|
271
|
+
}; }
|
272
|
+
static get style() { return splitPaneCss; }
|
273
|
+
};
|
274
|
+
SplitPane = /*@__PURE__*/ proxyCustomElement(SplitPane, [1, "nano-split-pane", {
|
275
|
+
"position": [6146],
|
276
|
+
"positionInPixels": [1026, "position-in-pixels"],
|
277
|
+
"vertical": [516],
|
278
|
+
"disabled": [516],
|
279
|
+
"primary": [1],
|
280
|
+
"snap": [1],
|
281
|
+
"snapThreshold": [2, "snap-threshold"],
|
282
|
+
"animationDuration": [2, "animation-duration"]
|
283
|
+
}]);
|
284
|
+
function defineCustomElement$1() {
|
285
|
+
if (typeof customElements === "undefined") {
|
286
|
+
return;
|
287
|
+
}
|
288
|
+
const components = ["nano-split-pane", "nano-icon"];
|
289
|
+
components.forEach(tagName => { switch (tagName) {
|
290
|
+
case "nano-split-pane":
|
291
|
+
if (!customElements.get(tagName)) {
|
292
|
+
customElements.define(tagName, SplitPane);
|
293
|
+
}
|
294
|
+
break;
|
295
|
+
case "nano-icon":
|
296
|
+
if (!customElements.get(tagName)) {
|
297
|
+
defineCustomElement$2();
|
298
|
+
}
|
299
|
+
break;
|
300
|
+
} });
|
301
|
+
}
|
302
|
+
|
303
|
+
const NanoSplitPane = SplitPane;
|
304
|
+
const defineCustomElement = defineCustomElement$1;
|
305
|
+
|
306
|
+
export { NanoSplitPane, defineCustomElement };
|
307
|
+
|
308
|
+
//# sourceMappingURL=nano-split-pane.js.map
|