@nationalarchives/frontend 0.1.64 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/.babelrc.json +19 -0
- package/config/.eslintrc.js +25 -0
- package/config/.htmlvalidate.json +17 -0
- package/config/stylelint.config.js +240 -0
- package/nationalarchives/all.css +1 -3
- package/nationalarchives/all.css.map +1 -1
- package/nationalarchives/all.js +1 -1
- package/nationalarchives/all.js.map +1 -1
- package/nationalarchives/all.mjs +34 -18
- package/nationalarchives/all.scss +0 -2
- package/nationalarchives/components/_forms.scss +9 -0
- package/nationalarchives/components/_index.scss +2 -34
- package/nationalarchives/components/_presentation.scss +23 -0
- package/nationalarchives/components/accordion/accordion.css +1 -1
- package/nationalarchives/components/accordion/accordion.css.map +1 -1
- package/nationalarchives/components/accordion/accordion.js +1 -1
- package/nationalarchives/components/accordion/accordion.js.map +1 -1
- package/nationalarchives/components/accordion/accordion.mjs +92 -24
- package/nationalarchives/components/accordion/accordion.scss +56 -18
- package/nationalarchives/components/accordion/fixtures.json +34 -7
- package/nationalarchives/components/accordion/macro-options.json +14 -2
- package/nationalarchives/components/accordion/template.njk +7 -5
- package/nationalarchives/components/breadcrumbs/breadcrumbs.css +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.scss +0 -10
- package/nationalarchives/components/breadcrumbs/template.njk +1 -1
- package/nationalarchives/components/button/button.css +1 -1
- package/nationalarchives/components/button/button.css.map +1 -1
- package/nationalarchives/components/button/button.scss +32 -10
- package/nationalarchives/components/button/macro-options.json +6 -0
- package/nationalarchives/components/button/template.njk +3 -1
- package/nationalarchives/components/card/card.css +1 -1
- package/nationalarchives/components/card/card.css.map +1 -1
- package/nationalarchives/components/card/template.njk +5 -5
- package/nationalarchives/components/checkboxes/checkboxes.css +1 -1
- package/nationalarchives/components/checkboxes/checkboxes.css.map +1 -1
- package/nationalarchives/components/checkboxes/checkboxes.njk +1 -1
- package/nationalarchives/components/checkboxes/checkboxes.scss +1 -1
- package/nationalarchives/components/checkboxes/macro-options.json +6 -0
- package/nationalarchives/components/checkboxes/template.njk +1 -1
- package/nationalarchives/components/compound-filters/compound-filters.css.map +1 -1
- package/nationalarchives/components/compound-filters/template.njk +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.css +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.css.map +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.scss +0 -2
- package/nationalarchives/components/cookie-banner/template.njk +1 -2
- package/nationalarchives/components/date-input/date-input.css +1 -1
- package/nationalarchives/components/date-input/date-input.css.map +1 -1
- package/nationalarchives/components/date-input/date-input.scss +2 -2
- package/nationalarchives/components/date-input/fixtures.json +5 -5
- package/nationalarchives/components/date-input/template.njk +2 -2
- package/nationalarchives/components/date-search/date-search.css +1 -1
- package/nationalarchives/components/date-search/date-search.css.map +1 -1
- package/nationalarchives/components/date-search/date-search.njk +2 -2
- package/nationalarchives/components/date-search/date-search.scss +2 -2
- package/nationalarchives/components/date-search/template.njk +1 -1
- package/nationalarchives/components/details/details.css.map +1 -1
- package/nationalarchives/components/details/template.njk +1 -1
- package/nationalarchives/components/error-summary/error-summary.css +1 -1
- package/nationalarchives/components/error-summary/error-summary.css.map +1 -1
- package/nationalarchives/components/error-summary/error-summary.js +1 -1
- package/nationalarchives/components/error-summary/error-summary.js.map +1 -1
- package/nationalarchives/components/error-summary/error-summary.mjs +1 -1
- package/nationalarchives/components/error-summary/error-summary.scss +3 -4
- package/nationalarchives/components/error-summary/template.njk +1 -1
- package/nationalarchives/components/files-list/_index.scss +1 -0
- package/nationalarchives/components/files-list/files-list.css +1 -0
- package/nationalarchives/components/files-list/files-list.css.map +1 -0
- package/nationalarchives/components/files-list/files-list.scss +80 -0
- package/nationalarchives/components/files-list/fixtures.json +71 -0
- package/nationalarchives/components/{sensitive-image → files-list}/macro-options.json +20 -20
- package/nationalarchives/components/files-list/macro.njk +3 -0
- package/nationalarchives/components/files-list/template.njk +33 -0
- package/nationalarchives/components/footer/footer.css +1 -1
- package/nationalarchives/components/footer/footer.css.map +1 -1
- package/nationalarchives/components/footer/footer.scss +0 -2
- package/nationalarchives/components/footer/macro-options.json +0 -6
- package/nationalarchives/components/footer/template.njk +1 -1
- package/nationalarchives/components/gallery/fixtures.json +35 -1
- package/nationalarchives/components/gallery/gallery.css +1 -1
- package/nationalarchives/components/gallery/gallery.css.map +1 -1
- package/nationalarchives/components/gallery/gallery.js +1 -1
- package/nationalarchives/components/gallery/gallery.js.map +1 -1
- package/nationalarchives/components/gallery/gallery.mjs +192 -53
- package/nationalarchives/components/gallery/gallery.scss +317 -56
- package/nationalarchives/components/gallery/macro-options.json +34 -49
- package/nationalarchives/components/gallery/template.njk +74 -33
- package/nationalarchives/components/global-header/global-header.css +1 -1
- package/nationalarchives/components/global-header/global-header.css.map +1 -1
- package/nationalarchives/components/global-header/global-header.scss +0 -2
- package/nationalarchives/components/global-header/template.njk +1 -1
- package/nationalarchives/components/header/header.css +1 -1
- package/nationalarchives/components/header/header.css.map +1 -1
- package/nationalarchives/components/header/header.scss +3 -5
- package/nationalarchives/components/header/template.njk +1 -1
- package/nationalarchives/components/hero/hero.css +1 -1
- package/nationalarchives/components/hero/hero.css.map +1 -1
- package/nationalarchives/components/hero/hero.scss +0 -24
- package/nationalarchives/components/hero/template.njk +1 -1
- package/nationalarchives/components/index-grid/index-grid.css +1 -1
- package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
- package/nationalarchives/components/index-grid/index-grid.scss +1 -1
- package/nationalarchives/components/index-grid/template.njk +3 -3
- package/nationalarchives/components/pagination/pagination.css +1 -1
- package/nationalarchives/components/pagination/pagination.css.map +1 -1
- package/nationalarchives/components/pagination/pagination.scss +1 -1
- package/nationalarchives/components/pagination/template.njk +1 -1
- package/nationalarchives/components/phase-banner/phase-banner.css +1 -1
- package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
- package/nationalarchives/components/phase-banner/phase-banner.scss +0 -2
- package/nationalarchives/components/phase-banner/template.njk +1 -1
- package/nationalarchives/components/picture/picture.css.map +1 -1
- package/nationalarchives/components/picture/picture.js +1 -1
- package/nationalarchives/components/picture/picture.js.map +1 -1
- package/nationalarchives/components/picture/picture.mjs +2 -2
- package/nationalarchives/components/picture/template.njk +1 -1
- package/nationalarchives/components/quick-filters/quick-filters.css +1 -1
- package/nationalarchives/components/quick-filters/quick-filters.css.map +1 -1
- package/nationalarchives/components/quick-filters/template.njk +1 -1
- package/nationalarchives/components/radios/radios.css +1 -1
- package/nationalarchives/components/radios/radios.css.map +1 -1
- package/nationalarchives/components/radios/radios.njk +1 -1
- package/nationalarchives/components/radios/radios.scss +1 -1
- package/nationalarchives/components/radios/template.njk +1 -1
- package/nationalarchives/components/records-list/_index.scss +1 -0
- package/nationalarchives/components/records-list/fixtures.json +42 -0
- package/nationalarchives/components/records-list/macro.njk +3 -0
- package/nationalarchives/components/records-list/records-list.css +1 -0
- package/nationalarchives/components/records-list/records-list.css.map +1 -0
- package/nationalarchives/components/{featured-records/featured-records.scss → records-list/records-list.scss} +2 -2
- package/nationalarchives/components/records-list/template.njk +21 -0
- package/nationalarchives/components/search-field/search-field.css +1 -1
- package/nationalarchives/components/search-field/search-field.css.map +1 -1
- package/nationalarchives/components/search-field/search-field.scss +3 -2
- package/nationalarchives/components/search-field/template.njk +2 -2
- package/nationalarchives/components/select/select.css +1 -1
- package/nationalarchives/components/select/select.css.map +1 -1
- package/nationalarchives/components/select/select.scss +2 -2
- package/nationalarchives/components/select/template.njk +2 -2
- package/nationalarchives/components/sidebar/fixtures.json +18 -8
- package/nationalarchives/components/sidebar/macro-options.json +9 -2
- package/nationalarchives/components/sidebar/sidebar.css +1 -1
- package/nationalarchives/components/sidebar/sidebar.css.map +1 -1
- package/nationalarchives/components/sidebar/template.njk +12 -3
- package/nationalarchives/components/skip-link/skip-link.css +1 -1
- package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
- package/nationalarchives/components/skip-link/skip-link.scss +0 -2
- package/nationalarchives/components/skip-link/template.njk +1 -1
- package/nationalarchives/components/tabs/tabs.css +1 -1
- package/nationalarchives/components/tabs/tabs.css.map +1 -1
- package/nationalarchives/components/tabs/tabs.scss +0 -12
- package/nationalarchives/components/tabs/template.njk +1 -1
- package/nationalarchives/components/text-input/template.njk +1 -1
- package/nationalarchives/components/text-input/text-input.css +1 -1
- package/nationalarchives/components/text-input/text-input.css.map +1 -1
- package/nationalarchives/components/text-input/text-input.njk +2 -2
- package/nationalarchives/components/text-input/text-input.scss +2 -2
- package/nationalarchives/components/textarea/template.njk +2 -2
- package/nationalarchives/components/textarea/textarea.css +1 -1
- package/nationalarchives/components/textarea/textarea.css.map +1 -1
- package/nationalarchives/components/textarea/textarea.scss +2 -2
- package/nationalarchives/components/warning/template.njk +1 -1
- package/nationalarchives/components/warning/warning.css +1 -1
- package/nationalarchives/components/warning/warning.css.map +1 -1
- package/nationalarchives/components/warning/warning.scss +2 -0
- package/nationalarchives/global-header-package.css +1 -1
- package/nationalarchives/global-header-package.css.map +1 -1
- package/nationalarchives/global-header-package.scss +1 -1
- package/nationalarchives/print.css +6 -0
- package/nationalarchives/print.css.map +1 -0
- package/nationalarchives/print.scss +44 -0
- package/nationalarchives/prototype-kit.css +1 -3
- package/nationalarchives/prototype-kit.css.map +1 -1
- package/nationalarchives/templates/layouts/_generic.njk +6 -6
- package/nationalarchives/tools/_a11y.scss +4 -0
- package/nationalarchives/tools/_colour.scss +75 -79
- package/nationalarchives/tools/_media.scss +0 -10
- package/nationalarchives/utilities/_columns.scss +1 -1
- package/nationalarchives/utilities/_index.scss +1 -0
- package/nationalarchives/utilities/_reset.scss +2 -8
- package/nationalarchives/utilities/{_colour.scss → colour/_index.scss} +2 -2
- package/nationalarchives/utilities/{_forms.scss → forms/_index.scss} +6 -6
- package/nationalarchives/utilities/grid/macro.njk +3 -0
- package/nationalarchives/{components → utilities}/grid/template.njk +1 -1
- package/nationalarchives/utilities/{_lists.scss → lists/_index.scss} +16 -7
- package/nationalarchives/utilities/{_overrides.scss → overrides/_index.scss} +8 -2
- package/nationalarchives/utilities/{_tables.scss → tables/_index.scss} +5 -5
- package/nationalarchives/utilities/{_typography.scss → typography/_index.scss} +8 -5
- package/nationalarchives/variables/_colour.scss +12 -5
- package/package.json +1 -1
- package/nationalarchives/components/accordion/accordion.stories.js +0 -410
- package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +0 -128
- package/nationalarchives/components/button/button-group.stories.js +0 -114
- package/nationalarchives/components/button/button.stories.js +0 -204
- package/nationalarchives/components/card/card.stories.js +0 -402
- package/nationalarchives/components/checkboxes/checkboxes.stories.js +0 -241
- package/nationalarchives/components/compound-filters/compound-filters.stories.js +0 -61
- package/nationalarchives/components/cookie-banner/cookie-banner.stories.js +0 -250
- package/nationalarchives/components/date-input/date-input.stories.js +0 -119
- package/nationalarchives/components/date-search/date-search.stories.js +0 -124
- package/nationalarchives/components/details/details.stories.js +0 -33
- package/nationalarchives/components/error-summary/error-summary.stories.js +0 -59
- package/nationalarchives/components/featured-records/_index.scss +0 -1
- package/nationalarchives/components/featured-records/featured-records.css +0 -1
- package/nationalarchives/components/featured-records/featured-records.css.map +0 -1
- package/nationalarchives/components/featured-records/featured-records.stories.js +0 -50
- package/nationalarchives/components/featured-records/fixtures.json +0 -42
- package/nationalarchives/components/featured-records/macro.njk +0 -3
- package/nationalarchives/components/featured-records/template.njk +0 -21
- package/nationalarchives/components/footer/footer.stories.js +0 -241
- package/nationalarchives/components/gallery/gallery.stories.js +0 -74
- package/nationalarchives/components/global-header/global-header.stories.js +0 -364
- package/nationalarchives/components/grid/_index.scss +0 -1
- package/nationalarchives/components/grid/grid.css +0 -1
- package/nationalarchives/components/grid/grid.css.map +0 -1
- package/nationalarchives/components/grid/grid.stories.js +0 -279
- package/nationalarchives/components/grid/macro.njk +0 -3
- package/nationalarchives/components/header/header.stories.js +0 -239
- package/nationalarchives/components/hero/hero.stories.js +0 -326
- package/nationalarchives/components/index-grid/index-grid.stories.js +0 -128
- package/nationalarchives/components/pagination/pagination.stories.js +0 -532
- package/nationalarchives/components/phase-banner/phase-banner.stories.js +0 -39
- package/nationalarchives/components/picture/picture.stories.js +0 -75
- package/nationalarchives/components/quick-filters/quick-filters.stories.js +0 -76
- package/nationalarchives/components/radios/radios.stories.js +0 -244
- package/nationalarchives/components/search-field/search-field.stories.js +0 -88
- package/nationalarchives/components/search-filters/_index.scss +0 -1
- package/nationalarchives/components/search-filters/fixtures.json +0 -16
- package/nationalarchives/components/search-filters/macro-options.json +0 -39
- package/nationalarchives/components/search-filters/macro.njk +0 -3
- package/nationalarchives/components/search-filters/search-filters.css +0 -1
- package/nationalarchives/components/search-filters/search-filters.css.map +0 -1
- package/nationalarchives/components/search-filters/search-filters.js +0 -2
- package/nationalarchives/components/search-filters/search-filters.js.map +0 -1
- package/nationalarchives/components/search-filters/search-filters.mjs +0 -67
- package/nationalarchives/components/search-filters/search-filters.scss +0 -198
- package/nationalarchives/components/search-filters/search-filters.stories.js +0 -207
- package/nationalarchives/components/search-filters/template.njk +0 -108
- package/nationalarchives/components/select/select.stories.js +0 -197
- package/nationalarchives/components/sensitive-image/_index.scss +0 -1
- package/nationalarchives/components/sensitive-image/fixtures.json +0 -51
- package/nationalarchives/components/sensitive-image/macro.njk +0 -3
- package/nationalarchives/components/sensitive-image/sensitive-image.css +0 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.css.map +0 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.js +0 -2
- package/nationalarchives/components/sensitive-image/sensitive-image.js.map +0 -1
- package/nationalarchives/components/sensitive-image/sensitive-image.mjs +0 -23
- package/nationalarchives/components/sensitive-image/sensitive-image.scss +0 -85
- package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +0 -86
- package/nationalarchives/components/sensitive-image/template.njk +0 -11
- package/nationalarchives/components/sidebar/sidebar.stories.js +0 -224
- package/nationalarchives/components/skip-link/skip-link.stories.js +0 -76
- package/nationalarchives/components/tabs/tabs.stories.js +0 -300
- package/nationalarchives/components/text-input/text-input.stories.js +0 -188
- package/nationalarchives/components/textarea/textarea.stories.js +0 -130
- package/nationalarchives/components/warning/warning.stories.js +0 -39
- package/nationalarchives/stories/intro.mdx +0 -13
- package/nationalarchives/stories/utilities/colour-schemes/colour-combinations.stories.js +0 -293
- package/nationalarchives/stories/utilities/colour-schemes/colour-themes.stories.js +0 -1535
- package/nationalarchives/stories/utilities/forms/forms.mdx +0 -117
- package/nationalarchives/stories/utilities/lists/lists.stories.js +0 -212
- package/nationalarchives/stories/utilities/overrides/overrides.stories.js +0 -42
- package/nationalarchives/stories/utilities/tables/tables.stories.js +0 -47
- package/nationalarchives/stories/utilities/typography/heading-groups.stories.js +0 -94
- package/nationalarchives/stories/utilities/typography/headings.stories.js +0 -33
- package/nationalarchives/stories/utilities/typography/typography.stories.js +0 -91
- package/nationalarchives/components/{featured-records → records-list}/macro-options.json +0 -0
- package/nationalarchives/{components/grid/grid.scss → utilities/grid/_index.scss} +3 -3
- /package/nationalarchives/{components → utilities}/grid/fixtures.json +0 -0
- /package/nationalarchives/{components → utilities}/grid/macro-options.json +0 -0
@@ -1,2 +1,2 @@
|
|
1
|
-
!function(e
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("TNAFrontend",[],e):"object"==typeof exports?exports.TNAFrontend=e():t.TNAFrontend=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,r(i.key),i)}}function r(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}t.r(e),t.d(e,{Gallery:()=>o});var o=function(){return t=function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$module=e,this.$itemsContainer=e&&e.querySelector(".tna-gallery__items"),this.$items=this.$itemsContainer&&this.$itemsContainer.querySelectorAll(".tna-gallery__item"),this.$navigation=e&&e.querySelector(".tna-gallery__navigation"),this.$navigationItems=this.$navigation&&e.querySelectorAll(".tna-gallery__navigation-item"),this.$options=e&&e.querySelector(".tna-gallery__options"),this.$navigationButtons=e&&e.querySelector(".tna-gallery__navigation-buttons"),this.$module&&this.$itemsContainer&&this.$items&&this.$navigation&&this.$navigationItems&&this.$options&&this.$navigationButtons&&(this.$module.classList.add("tna-gallery--js"),this.$showIndex=this.$options.querySelector('button[value="show-index"]'),this.$enterFullscreen=this.$options.querySelector('button[value="enter-fullscreen"]'),this.$exitFullscreen=this.$options.querySelector('button[value="exit-fullscreen"]'),this.$navigationButtonPrev=this.$navigationButtons.querySelector(".tna-gallery__navigation-prev"),this.$navigationButtonNext=this.$navigationButtons.querySelector(".tna-gallery__navigation-next"),this.$module.addEventListener("fullscreenchange",(function(){return n.syncFullScreen()})),this.setup(),this.allowIndex=!1,this.allowIndex?this.showIndex():(this.currentId=this.$items[0].id,this.showItem(this.currentId)))},e=[{key:"setup",value:function(){var t,e,n,i,r,o,s,l=this;this.$items.forEach((function(t){t.setAttribute("hidden","until-found"),t.setAttribute("role","tabpanel")})),this.$navigation.removeAttribute("hidden"),this.$navigationItems.forEach((function(t){t.addEventListener("click",(function(){return l.showItem(t.getAttribute("aria-controls"),!0)}))})),this.$module.setAttribute("tabindex","0"),this.$module.addEventListener("keydown",(function(t){switch(t.key){case"ArrowLeft":case"ArrowUp":l.showPreviousItem();break;case"ArrowRight":case"ArrowDown":l.showNextItem();break;case"Home":l.showFirstItem();break;case"End":l.showLastItem()}})),this.$options.removeAttribute("hidden"),document.fullscreenEnabled&&this.$enterFullscreen&&this.$exitFullscreen&&(null===(r=this.$enterFullscreen)||void 0===r||r.addEventListener("click",(function(){return l.enterFullScreen()})),null===(o=this.$exitFullscreen)||void 0===o||o.addEventListener("click",(function(){return l.exitFullScreen()})),null===(s=this.$enterFullscreen)||void 0===s||s.removeAttribute("hidden")),null===(t=this.$showIndex)||void 0===t||t.addEventListener("click",(function(){return l.showIndex()})),null===(e=this.$navigationButtons)||void 0===e||e.removeAttribute("hidden"),null===(n=this.$navigationButtonPrev)||void 0===n||n.addEventListener("click",(function(){return l.showPreviousItem()})),null===(i=this.$navigationButtonNext)||void 0===i||i.addEventListener("click",(function(){return l.showNextItem()}))}},{key:"showIndex",value:function(){var t;this.showItem(""),this.$itemsContainer.setAttribute("tabindex","-1"),null===(t=this.$showIndex)||void 0===t||t.setAttribute("hidden",!0)}},{key:"showItem",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.$items.forEach((function(e){t&&e.id===t?(e.removeAttribute("hidden"),e.removeAttribute("tabindex")):(e.setAttribute("hidden","until-found"),e.setAttribute("tabindex","-1"))})),this.$navigationItems.forEach((function(e,n){t?e.getAttribute("aria-controls")===t?(e.setAttribute("aria-selected","true"),e.setAttribute("tabindex","0")):(e.setAttribute("aria-selected","false"),e.setAttribute("tabindex","-1")):(e.setAttribute("aria-selected","false"),e.setAttribute("tabindex",0===n?"0":"-1"))})),this.allowIndex&&(null===(e=this.$showIndex)||void 0===e||e.removeAttribute("hidden")),this.currentId=t,this.$itemsContainer.setAttribute("tabindex","0"),n&&this.$itemsContainer.focus()}},{key:"getCurrentItemIndex",value:function(){var t=this;return Array.from(this.$items).findIndex((function(e){return e.id===t.currentId}))}},{key:"showPreviousItem",value:function(){var t=this.getCurrentItemIndex()-1;t<0&&(t=this.$items.length-1),this.showItem(this.$items[t].id,!0)}},{key:"showNextItem",value:function(){var t=this.getCurrentItemIndex()+1;t>=this.$items.length&&(t=0),this.showItem(this.$items[t].id,!0)}},{key:"showFirstItem",value:function(){this.showItem(this.$items[0].id,!0)}},{key:"showLastItem",value:function(){this.showItem(this.$items[this.$items.length-1].id,!0)}},{key:"toggleFullScreen",value:function(){document.fullscreenElement?document.exitFullscreen&&this.exitFullScreen():this.enterFullScreen()}},{key:"enterFullScreen",value:function(){this.$module.requestFullscreen(),this.syncFullScreen()}},{key:"exitFullScreen",value:function(){document.exitFullscreen(),this.syncFullScreen()}},{key:"syncFullScreen",value:function(){document.fullscreenElement?(this.$enterFullscreen.setAttribute("hidden",!0),this.$exitFullscreen.removeAttribute("hidden"),this.$module.classList.add("tna-gallery--fullscreen")):(this.$exitFullscreen.setAttribute("hidden",!0),this.$enterFullscreen.removeAttribute("hidden"),this.$module.classList.remove("tna-gallery--fullscreen"))}}],e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();return e})()));
|
2
2
|
//# sourceMappingURL=gallery.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"components/gallery/gallery.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,IAEzBD,EAAkB,YAAIC,GACvB,CATD,CASGK,MAAM,I,yDCDT,QARe,WAAH,OACT,CAAC,MAAQ,KAAO,KAAO,KAAO,MAAMC,QAAQ,UAAU,SAACC,GAAC,OAErDA,EACCC,OAAOC,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Ac,UAC7Cf,KAAKa,eAAeH,UAAUC,IAC5B,sBACA,aACA,sBAEFX,KAAKa,eAAeD,aAAa,gBAAiBL,GAClDP,KAAKa,eAAeD,aAAa,iBAAiB,GAClDZ,KAAKa,eAAeG,UAAY,QAAHR,OAAWR,KAAKI,MAAK,WAWlDJ,KAAKa,eAAeI,iBAAiB,SAAS,WAI5CnB,EAAKoB,qBACP,IAEAlB,KAAKmB,sBAAwBL,SAASC,cAAc,OACpDf,KAAKmB,sBAAsBT,UAAUC,IACnC,aACA,mBACA,+BAGFX,KAAKmB,sBAAsBC,YAAYpB,KAAKa,gBAC5Cb,KAAKC,OAAOoB,cAAcD,YAAYpB,KAAKmB,uBAE3CnB,KAAKC,OAAOW,aAAa,KAAML,EACjC,CACF,G,EAAC,EAAA1B,IAAA,sBAAAc,MAED,WACEK,KAAKG,QAAUH,KAAKG,OAChBH,KAAKG,QACPH,KAAKH,QAAQa,UAAUY,OAAO,0BAC9BtB,KAAKa,eAAeD,aAAa,iBAAiB,GAClDZ,KAAKa,eAAeG,UAAY,eAChChB,KAAKC,OAAOW,aAAa,WAAY,KACrCZ,KAAKC,OAAOsB,QACZvB,KAAKC,OAAOW,aAAa,WAAY,QAErCZ,KAAKH,QAAQa,UAAUC,IAAI,0BAC3BX,KAAKa,eAAeD,aAAa,iBAAiB,GAClDZ,KAAKa,eAAeG,UAAY,QAAHR,OAAWR,KAAKI,MAAK,WAEtD,M,6EAAC,CA1EiB,G","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/uuid.mjs","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/gallery/gallery.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","const uuidv4 = () =>\n ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>\n (\n c ^\n (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))\n ).toString(16),\n );\n\nexport default uuidv4;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import uuidv4 from \"../../lib/uuid.mjs\";\n\nexport class Gallery {\n constructor($module) {\n this.$module = $module;\n this.$items = $module && $module.querySelector(\".tna-gallery__items\");\n this.opened = false;\n\n if (!this.$module || !this.$items) {\n return;\n }\n\n const supportTouchHorizontal = false;\n\n this.items = this.$module.querySelectorAll(\".tna-gallery__item\").length;\n\n if (this.items > 1) {\n const uniqueId = `tna-gallery-${uuidv4()}`;\n\n this.$module.classList.add(\"tna-gallery--collapsed\");\n this.$items.setAttribute(\"tabindex\", \"-1\");\n\n this.$galleryToggle = document.createElement(\"button\");\n this.$galleryToggle.classList.add(\n \"tna-gallery__toggle\",\n \"tna-button\",\n \"tna-button--accent\",\n );\n this.$galleryToggle.setAttribute(\"aria-controls\", uniqueId);\n this.$galleryToggle.setAttribute(\"aria-expanded\", false);\n this.$galleryToggle.innerText = `View ${this.items} images`;\n\n const onFirstTouch = () => {\n this.$module.removeEventListener(\"touchstart\", onFirstTouch);\n this.$module.classList.add(\"tna-gallery--touchable\");\n };\n\n if (supportTouchHorizontal) {\n this.$module.addEventListener(\"touchstart\", onFirstTouch);\n }\n\n this.$galleryToggle.addEventListener(\"click\", () => {\n if (supportTouchHorizontal) {\n this.$module.removeEventListener(\"touchstart\", onFirstTouch);\n }\n this.handleToggleGallery();\n });\n\n this.$galleryToggleWrapper = document.createElement(\"div\");\n this.$galleryToggleWrapper.classList.add(\n \"tna-column\",\n \"tna-column--full\",\n \"tna-gallery__toggle-wrapper\",\n );\n\n this.$galleryToggleWrapper.appendChild(this.$galleryToggle);\n this.$items.parentElement.appendChild(this.$galleryToggleWrapper);\n\n this.$items.setAttribute(\"id\", uniqueId);\n }\n }\n\n handleToggleGallery() {\n this.opened = !this.opened;\n if (this.opened) {\n this.$module.classList.remove(\"tna-gallery--collapsed\");\n this.$galleryToggle.setAttribute(\"aria-expanded\", true);\n this.$galleryToggle.innerText = \"Close images\";\n this.$items.setAttribute(\"tabindex\", \"0\");\n this.$items.focus();\n this.$items.setAttribute(\"tabindex\", \"-1\");\n } else {\n this.$module.classList.add(\"tna-gallery--collapsed\");\n this.$galleryToggle.setAttribute(\"aria-expanded\", false);\n this.$galleryToggle.innerText = `View ${this.items} images`;\n }\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","replace","c","crypto","getRandomValues","Uint8Array","toString","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","Gallery","$module","_this","_classCallCheck","this","$items","querySelector","opened","items","querySelectorAll","length","uniqueId","concat","uuidv4","classList","add","setAttribute","$galleryToggle","document","createElement","innerText","addEventListener","handleToggleGallery","$galleryToggleWrapper","appendChild","parentElement","remove","focus"],"sourceRoot":""}
|
1
|
+
{"version":3,"file":"components/gallery/gallery.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,IAEzBD,EAAkB,YAAIC,GACvB,CATD,CASGK,MAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,GAAO,G,usBCLvD,IAAMC,EAAO,WA0DjB,O,EAzDD,SAAAA,EAAYC,GAAS,IAAAC,EAAA,M,4FAAAC,CAAA,KAAAH,GACnBI,KAAKH,QAAUA,EACfG,KAAKC,gBACHJ,GAAWA,EAAQK,cAAc,uBACnCF,KAAKG,OACHH,KAAKC,iBACLD,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KG,OAAO,GAAGmB,IAAI,EACnC,GAAC,CAAAxC,IAAA,eAAAa,MAED,WACEK,KAAKuB,SAASvB,KAAKG,OAAOH,KAAKG,OAAO+C,OAAS,GAAG5B,IAAI,EACxD,GAAC,CAAAxC,IAAA,mBAAAa,MAED,WACO+C,SAASkB,kBAEHlB,SAASmB,gBAClB7D,KAAK6C,iBAFL7C,KAAK4C,iBAIT,GAAC,CAAA9D,IAAA,kBAAAa,MAED,WACEK,KAAKH,QAAQiE,oBACb9D,KAAKiB,gBACP,GAAC,CAAAnC,IAAA,iBAAAa,MAED,WACE+C,SAASmB,iBACT7D,KAAKiB,gBACP,GAAC,CAAAnC,IAAA,iBAAAa,MAED,WACM+C,SAASkB,mBACX5D,KAAKY,iBAAiBsB,aAAa,UAAU,GAC7ClC,KAAKa,gBAAgBsB,gBAAgB,UACrCnC,KAAKH,QAAQY,UAAUC,IAAI,6BAE3BV,KAAKa,gBAAgBqB,aAAa,UAAU,GAC5ClC,KAAKY,iBAAiBuB,gBAAgB,UACtCnC,KAAKH,QAAQY,UAAUsD,OAAO,2BAElC,I,gFAAC,CAvNiB,G","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/gallery/gallery.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export class Gallery {\n constructor($module) {\n this.$module = $module;\n this.$itemsContainer =\n $module && $module.querySelector(\".tna-gallery__items\");\n this.$items =\n this.$itemsContainer &&\n this.$itemsContainer.querySelectorAll(\".tna-gallery__item\");\n this.$navigation =\n $module && $module.querySelector(\".tna-gallery__navigation\");\n this.$navigationItems =\n this.$navigation &&\n $module.querySelectorAll(\".tna-gallery__navigation-item\");\n this.$options = $module && $module.querySelector(\".tna-gallery__options\");\n this.$navigationButtons =\n $module && $module.querySelector(\".tna-gallery__navigation-buttons\");\n\n if (\n !this.$module ||\n !this.$itemsContainer ||\n !this.$items ||\n !this.$navigation ||\n !this.$navigationItems ||\n !this.$options ||\n !this.$navigationButtons\n ) {\n return;\n }\n\n this.$module.classList.add(\"tna-gallery--js\");\n\n this.$showIndex = this.$options.querySelector('button[value=\"show-index\"]');\n this.$enterFullscreen = this.$options.querySelector(\n 'button[value=\"enter-fullscreen\"]',\n );\n this.$exitFullscreen = this.$options.querySelector(\n 'button[value=\"exit-fullscreen\"]',\n );\n\n this.$navigationButtonPrev = this.$navigationButtons.querySelector(\n \".tna-gallery__navigation-prev\",\n );\n this.$navigationButtonNext = this.$navigationButtons.querySelector(\n \".tna-gallery__navigation-next\",\n );\n\n this.$module.addEventListener(\"fullscreenchange\", () =>\n this.syncFullScreen(),\n );\n\n this.setup();\n this.allowIndex = false;\n if (this.allowIndex) {\n this.showIndex();\n } else {\n this.currentId = this.$items[0].id;\n this.showItem(this.currentId);\n }\n }\n\n setup() {\n this.$items.forEach(($item) => {\n $item.setAttribute(\"hidden\", \"until-found\");\n $item.setAttribute(\"role\", \"tabpanel\");\n });\n this.$navigation.removeAttribute(\"hidden\");\n this.$navigationItems.forEach(($item) => {\n $item.addEventListener(\"click\", () =>\n this.showItem($item.getAttribute(\"aria-controls\"), true),\n );\n });\n this.$module.setAttribute(\"tabindex\", \"0\");\n this.$module.addEventListener(\"keydown\", (e) => {\n switch (e.key) {\n case \"ArrowLeft\":\n case \"ArrowUp\":\n this.showPreviousItem();\n break;\n case \"ArrowRight\":\n case \"ArrowDown\":\n this.showNextItem();\n break;\n case \"Home\":\n this.showFirstItem();\n break;\n case \"End\":\n this.showLastItem();\n break;\n }\n });\n this.$options.removeAttribute(\"hidden\");\n if (\n document.fullscreenEnabled &&\n this.$enterFullscreen &&\n this.$exitFullscreen\n ) {\n this.$enterFullscreen?.addEventListener(\"click\", () =>\n this.enterFullScreen(),\n );\n this.$exitFullscreen?.addEventListener(\"click\", () =>\n this.exitFullScreen(),\n );\n this.$enterFullscreen?.removeAttribute(\"hidden\");\n }\n this.$showIndex?.addEventListener(\"click\", () => this.showIndex());\n this.$navigationButtons?.removeAttribute(\"hidden\");\n this.$navigationButtonPrev?.addEventListener(\"click\", () =>\n this.showPreviousItem(),\n );\n this.$navigationButtonNext?.addEventListener(\"click\", () =>\n this.showNextItem(),\n );\n }\n\n showIndex() {\n this.showItem(\"\");\n this.$itemsContainer.setAttribute(\"tabindex\", \"-1\");\n this.$showIndex?.setAttribute(\"hidden\", true);\n }\n\n showItem(id, focusItem = false) {\n this.$items.forEach(($item) => {\n if (id && $item.id === id) {\n $item.removeAttribute(\"hidden\");\n $item.removeAttribute(\"tabindex\");\n } else {\n $item.setAttribute(\"hidden\", \"until-found\");\n $item.setAttribute(\"tabindex\", \"-1\");\n }\n });\n this.$navigationItems.forEach(($item, index) => {\n if (id) {\n if ($item.getAttribute(\"aria-controls\") === id) {\n $item.setAttribute(\"aria-selected\", \"true\");\n $item.setAttribute(\"tabindex\", \"0\");\n // if (focusItem) {\n // $item.focus();\n // }\n } else {\n $item.setAttribute(\"aria-selected\", \"false\");\n $item.setAttribute(\"tabindex\", \"-1\");\n }\n } else {\n $item.setAttribute(\"aria-selected\", \"false\");\n $item.setAttribute(\"tabindex\", index === 0 ? \"0\" : \"-1\");\n }\n });\n if (this.allowIndex) {\n this.$showIndex?.removeAttribute(\"hidden\");\n }\n this.currentId = id;\n this.$itemsContainer.setAttribute(\"tabindex\", \"0\");\n if (focusItem) {\n this.$itemsContainer.focus();\n }\n }\n\n getCurrentItemIndex() {\n return Array.from(this.$items).findIndex(\n ($item) => $item.id === this.currentId,\n );\n }\n\n showPreviousItem() {\n let nextIndexToShow = this.getCurrentItemIndex() - 1;\n if (nextIndexToShow < 0) {\n nextIndexToShow = this.$items.length - 1;\n }\n this.showItem(this.$items[nextIndexToShow].id, true);\n }\n\n showNextItem() {\n let nextIndexToShow = this.getCurrentItemIndex() + 1;\n if (nextIndexToShow >= this.$items.length) {\n nextIndexToShow = 0;\n }\n this.showItem(this.$items[nextIndexToShow].id, true);\n }\n\n showFirstItem() {\n this.showItem(this.$items[0].id, true);\n }\n\n showLastItem() {\n this.showItem(this.$items[this.$items.length - 1].id, true);\n }\n\n toggleFullScreen() {\n if (!document.fullscreenElement) {\n this.enterFullScreen();\n } else if (document.exitFullscreen) {\n this.exitFullScreen();\n }\n }\n\n enterFullScreen() {\n this.$module.requestFullscreen();\n this.syncFullScreen();\n }\n\n exitFullScreen() {\n document.exitFullscreen();\n this.syncFullScreen();\n }\n\n syncFullScreen() {\n if (document.fullscreenElement) {\n this.$enterFullscreen.setAttribute(\"hidden\", true);\n this.$exitFullscreen.removeAttribute(\"hidden\");\n this.$module.classList.add(\"tna-gallery--fullscreen\");\n } else {\n this.$exitFullscreen.setAttribute(\"hidden\", true);\n this.$enterFullscreen.removeAttribute(\"hidden\");\n this.$module.classList.remove(\"tna-gallery--fullscreen\");\n }\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","Gallery","$module","_this","_classCallCheck","this","$itemsContainer","querySelector","$items","querySelectorAll","$navigation","$navigationItems","$options","$navigationButtons","classList","add","$showIndex","$enterFullscreen","$exitFullscreen","$navigationButtonPrev","$navigationButtonNext","addEventListener","syncFullScreen","setup","allowIndex","showIndex","currentId","id","showItem","_this$$showIndex","_this$$navigationButt","_this$$navigationButt2","_this$$navigationButt3","_this$$enterFullscree","_this$$exitFullscreen","_this$$enterFullscree2","_this2","forEach","$item","setAttribute","removeAttribute","getAttribute","e","showPreviousItem","showNextItem","showFirstItem","showLastItem","document","fullscreenEnabled","enterFullScreen","exitFullScreen","_this$$showIndex2","_this$$showIndex3","focusItem","arguments","length","undefined","index","focus","_this3","Array","from","findIndex","nextIndexToShow","getCurrentItemIndex","fullscreenElement","exitFullscreen","requestFullscreen","remove"],"sourceRoot":""}
|
@@ -1,78 +1,217 @@
|
|
1
|
-
import uuidv4 from "../../lib/uuid.mjs";
|
2
|
-
|
3
1
|
export class Gallery {
|
4
2
|
constructor($module) {
|
5
3
|
this.$module = $module;
|
6
|
-
this.$
|
7
|
-
|
4
|
+
this.$itemsContainer =
|
5
|
+
$module && $module.querySelector(".tna-gallery__items");
|
6
|
+
this.$items =
|
7
|
+
this.$itemsContainer &&
|
8
|
+
this.$itemsContainer.querySelectorAll(".tna-gallery__item");
|
9
|
+
this.$navigation =
|
10
|
+
$module && $module.querySelector(".tna-gallery__navigation");
|
11
|
+
this.$navigationItems =
|
12
|
+
this.$navigation &&
|
13
|
+
$module.querySelectorAll(".tna-gallery__navigation-item");
|
14
|
+
this.$options = $module && $module.querySelector(".tna-gallery__options");
|
15
|
+
this.$navigationButtons =
|
16
|
+
$module && $module.querySelector(".tna-gallery__navigation-buttons");
|
8
17
|
|
9
|
-
if (
|
18
|
+
if (
|
19
|
+
!this.$module ||
|
20
|
+
!this.$itemsContainer ||
|
21
|
+
!this.$items ||
|
22
|
+
!this.$navigation ||
|
23
|
+
!this.$navigationItems ||
|
24
|
+
!this.$options ||
|
25
|
+
!this.$navigationButtons
|
26
|
+
) {
|
10
27
|
return;
|
11
28
|
}
|
12
29
|
|
13
|
-
|
30
|
+
this.$module.classList.add("tna-gallery--js");
|
31
|
+
|
32
|
+
this.$showIndex = this.$options.querySelector('button[value="show-index"]');
|
33
|
+
this.$enterFullscreen = this.$options.querySelector(
|
34
|
+
'button[value="enter-fullscreen"]',
|
35
|
+
);
|
36
|
+
this.$exitFullscreen = this.$options.querySelector(
|
37
|
+
'button[value="exit-fullscreen"]',
|
38
|
+
);
|
14
39
|
|
15
|
-
this
|
40
|
+
this.$navigationButtonPrev = this.$navigationButtons.querySelector(
|
41
|
+
".tna-gallery__navigation-prev",
|
42
|
+
);
|
43
|
+
this.$navigationButtonNext = this.$navigationButtons.querySelector(
|
44
|
+
".tna-gallery__navigation-next",
|
45
|
+
);
|
16
46
|
|
17
|
-
|
18
|
-
|
47
|
+
this.$module.addEventListener("fullscreenchange", () =>
|
48
|
+
this.syncFullScreen(),
|
49
|
+
);
|
19
50
|
|
20
|
-
|
21
|
-
|
51
|
+
this.setup();
|
52
|
+
this.allowIndex = false;
|
53
|
+
if (this.allowIndex) {
|
54
|
+
this.showIndex();
|
55
|
+
} else {
|
56
|
+
this.currentId = this.$items[0].id;
|
57
|
+
this.showItem(this.currentId);
|
58
|
+
}
|
59
|
+
}
|
22
60
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
61
|
+
setup() {
|
62
|
+
this.$items.forEach(($item) => {
|
63
|
+
$item.setAttribute("hidden", "until-found");
|
64
|
+
$item.setAttribute("role", "tabpanel");
|
65
|
+
});
|
66
|
+
this.$navigation.removeAttribute("hidden");
|
67
|
+
this.$navigationItems.forEach(($item) => {
|
68
|
+
$item.addEventListener("click", () =>
|
69
|
+
this.showItem($item.getAttribute("aria-controls"), true),
|
70
|
+
);
|
71
|
+
});
|
72
|
+
this.$module.setAttribute("tabindex", "0");
|
73
|
+
this.$module.addEventListener("keydown", (e) => {
|
74
|
+
switch (e.key) {
|
75
|
+
case "ArrowLeft":
|
76
|
+
case "ArrowUp":
|
77
|
+
this.showPreviousItem();
|
78
|
+
break;
|
79
|
+
case "ArrowRight":
|
80
|
+
case "ArrowDown":
|
81
|
+
this.showNextItem();
|
82
|
+
break;
|
83
|
+
case "Home":
|
84
|
+
this.showFirstItem();
|
85
|
+
break;
|
86
|
+
case "End":
|
87
|
+
this.showLastItem();
|
88
|
+
break;
|
89
|
+
}
|
90
|
+
});
|
91
|
+
this.$options.removeAttribute("hidden");
|
92
|
+
if (
|
93
|
+
document.fullscreenEnabled &&
|
94
|
+
this.$enterFullscreen &&
|
95
|
+
this.$exitFullscreen
|
96
|
+
) {
|
97
|
+
this.$enterFullscreen?.addEventListener("click", () =>
|
98
|
+
this.enterFullScreen(),
|
99
|
+
);
|
100
|
+
this.$exitFullscreen?.addEventListener("click", () =>
|
101
|
+
this.exitFullScreen(),
|
28
102
|
);
|
29
|
-
this.$
|
30
|
-
|
31
|
-
|
103
|
+
this.$enterFullscreen?.removeAttribute("hidden");
|
104
|
+
}
|
105
|
+
this.$showIndex?.addEventListener("click", () => this.showIndex());
|
106
|
+
this.$navigationButtons?.removeAttribute("hidden");
|
107
|
+
this.$navigationButtonPrev?.addEventListener("click", () =>
|
108
|
+
this.showPreviousItem(),
|
109
|
+
);
|
110
|
+
this.$navigationButtonNext?.addEventListener("click", () =>
|
111
|
+
this.showNextItem(),
|
112
|
+
);
|
113
|
+
}
|
32
114
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
115
|
+
showIndex() {
|
116
|
+
this.showItem("");
|
117
|
+
this.$itemsContainer.setAttribute("tabindex", "-1");
|
118
|
+
this.$showIndex?.setAttribute("hidden", true);
|
119
|
+
}
|
37
120
|
|
38
|
-
|
39
|
-
|
121
|
+
showItem(id, focusItem = false) {
|
122
|
+
this.$items.forEach(($item) => {
|
123
|
+
if (id && $item.id === id) {
|
124
|
+
$item.removeAttribute("hidden");
|
125
|
+
$item.removeAttribute("tabindex");
|
126
|
+
} else {
|
127
|
+
$item.setAttribute("hidden", "until-found");
|
128
|
+
$item.setAttribute("tabindex", "-1");
|
40
129
|
}
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
130
|
+
});
|
131
|
+
this.$navigationItems.forEach(($item, index) => {
|
132
|
+
if (id) {
|
133
|
+
if ($item.getAttribute("aria-controls") === id) {
|
134
|
+
$item.setAttribute("aria-selected", "true");
|
135
|
+
$item.setAttribute("tabindex", "0");
|
136
|
+
// if (focusItem) {
|
137
|
+
// $item.focus();
|
138
|
+
// }
|
139
|
+
} else {
|
140
|
+
$item.setAttribute("aria-selected", "false");
|
141
|
+
$item.setAttribute("tabindex", "-1");
|
45
142
|
}
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
143
|
+
} else {
|
144
|
+
$item.setAttribute("aria-selected", "false");
|
145
|
+
$item.setAttribute("tabindex", index === 0 ? "0" : "-1");
|
146
|
+
}
|
147
|
+
});
|
148
|
+
if (this.allowIndex) {
|
149
|
+
this.$showIndex?.removeAttribute("hidden");
|
150
|
+
}
|
151
|
+
this.currentId = id;
|
152
|
+
this.$itemsContainer.setAttribute("tabindex", "0");
|
153
|
+
if (focusItem) {
|
154
|
+
this.$itemsContainer.focus();
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
getCurrentItemIndex() {
|
159
|
+
return Array.from(this.$items).findIndex(
|
160
|
+
($item) => $item.id === this.currentId,
|
161
|
+
);
|
162
|
+
}
|
163
|
+
|
164
|
+
showPreviousItem() {
|
165
|
+
let nextIndexToShow = this.getCurrentItemIndex() - 1;
|
166
|
+
if (nextIndexToShow < 0) {
|
167
|
+
nextIndexToShow = this.$items.length - 1;
|
168
|
+
}
|
169
|
+
this.showItem(this.$items[nextIndexToShow].id, true);
|
170
|
+
}
|
171
|
+
|
172
|
+
showNextItem() {
|
173
|
+
let nextIndexToShow = this.getCurrentItemIndex() + 1;
|
174
|
+
if (nextIndexToShow >= this.$items.length) {
|
175
|
+
nextIndexToShow = 0;
|
176
|
+
}
|
177
|
+
this.showItem(this.$items[nextIndexToShow].id, true);
|
178
|
+
}
|
179
|
+
|
180
|
+
showFirstItem() {
|
181
|
+
this.showItem(this.$items[0].id, true);
|
182
|
+
}
|
55
183
|
|
56
|
-
|
57
|
-
|
184
|
+
showLastItem() {
|
185
|
+
this.showItem(this.$items[this.$items.length - 1].id, true);
|
186
|
+
}
|
58
187
|
|
59
|
-
|
188
|
+
toggleFullScreen() {
|
189
|
+
if (!document.fullscreenElement) {
|
190
|
+
this.enterFullScreen();
|
191
|
+
} else if (document.exitFullscreen) {
|
192
|
+
this.exitFullScreen();
|
60
193
|
}
|
61
194
|
}
|
62
195
|
|
63
|
-
|
64
|
-
this.
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
196
|
+
enterFullScreen() {
|
197
|
+
this.$module.requestFullscreen();
|
198
|
+
this.syncFullScreen();
|
199
|
+
}
|
200
|
+
|
201
|
+
exitFullScreen() {
|
202
|
+
document.exitFullscreen();
|
203
|
+
this.syncFullScreen();
|
204
|
+
}
|
205
|
+
|
206
|
+
syncFullScreen() {
|
207
|
+
if (document.fullscreenElement) {
|
208
|
+
this.$enterFullscreen.setAttribute("hidden", true);
|
209
|
+
this.$exitFullscreen.removeAttribute("hidden");
|
210
|
+
this.$module.classList.add("tna-gallery--fullscreen");
|
72
211
|
} else {
|
73
|
-
this.$
|
74
|
-
this.$
|
75
|
-
this.$
|
212
|
+
this.$exitFullscreen.setAttribute("hidden", true);
|
213
|
+
this.$enterFullscreen.removeAttribute("hidden");
|
214
|
+
this.$module.classList.remove("tna-gallery--fullscreen");
|
76
215
|
}
|
77
216
|
}
|
78
217
|
}
|