@nanoporetech-digital/components 2.1.2 → 2.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/CHANGELOG.md +28 -0
- package/README.md +1 -1
- package/dist/cjs/{algoliasearch.umd-79e17a1a.js → algoliasearch.umd-dcf18a4a.js} +3 -3
- package/dist/cjs/{algoliasearch.umd-79e17a1a.js.map → algoliasearch.umd-dcf18a4a.js.map} +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-algolia-input.cjs.entry.js +1 -1
- package/dist/cjs/nano-algolia.cjs.entry.js +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-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/nano-file-upload.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-search-results.cjs.entry.js +38 -28
- 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 +284 -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/cjs/nano-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/{popover-86f1775c.js → popover-55c687c2.js} +7 -3
- package/dist/cjs/popover-55c687c2.js.map +1 -0
- 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 +27 -8
- package/dist/collection/components/global-search-results/global-search-results.js +37 -27
- 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 +479 -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/algoliasearch.umd.js +2 -2
- package/dist/components/algoliasearch.umd.js.map +1 -1
- 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 +38 -28
- 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 +315 -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/components/popover.js +6 -2
- package/dist/components/popover.js.map +1 -1
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +326 -37
- package/dist/custom-elements/index.js.map +1 -1
- package/dist/esm/{algoliasearch.umd-6d09b727.js → algoliasearch.umd-6143495f.js} +3 -3
- package/dist/esm/{algoliasearch.umd-6d09b727.js.map → algoliasearch.umd-6143495f.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-algolia-input.entry.js +1 -1
- package/dist/esm/nano-algolia.entry.js +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-dropdown.entry.js +1 -1
- package/dist/esm/nano-file-upload.entry.js.map +1 -1
- package/dist/esm/nano-global-nav.entry.js +1 -1
- package/dist/esm/nano-global-nav.entry.js.map +1 -1
- package/dist/esm/nano-global-search-results.entry.js +38 -28
- 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 +280 -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/nano-tooltip.entry.js +1 -1
- package/dist/esm/{popover-db86a392.js → popover-d9dc8e13.js} +7 -3
- package/dist/esm/popover-d9dc8e13.js.map +1 -0
- package/dist/esm-es5/{algoliasearch.umd-6d09b727.js → algoliasearch.umd-6143495f.js} +3 -3
- package/dist/esm-es5/{algoliasearch.umd-6d09b727.js.map → algoliasearch.umd-6143495f.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-algolia-input.entry.js +1 -1
- package/dist/esm-es5/nano-algolia.entry.js +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-dropdown.entry.js +1 -1
- package/dist/esm-es5/nano-file-upload.entry.js.map +1 -1
- package/dist/esm-es5/nano-global-nav.entry.js +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/esm-es5/nano-tooltip.entry.js +1 -1
- package/dist/esm-es5/popover-d9dc8e13.js +5 -0
- package/dist/esm-es5/popover-d9dc8e13.js.map +1 -0
- 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-46d0bb7b.entry.js → p-08ffc9a1.entry.js} +2 -2
- package/dist/nano-components/{p-46d0bb7b.entry.js.map → p-08ffc9a1.entry.js.map} +0 -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-1a293bd0.entry.js → p-17bf76c4.entry.js} +2 -2
- package/dist/nano-components/{p-1a293bd0.entry.js.map → p-17bf76c4.entry.js.map} +0 -0
- package/dist/nano-components/p-1e974cad.entry.js.map +1 -1
- package/dist/nano-components/{p-a4075d49.entry.js → p-1ec44caf.entry.js} +2 -2
- package/dist/nano-components/p-1ec44caf.entry.js.map +1 -0
- 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-3c3e9fec.system.js +5 -0
- package/dist/nano-components/p-3c3e9fec.system.js.map +1 -0
- 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-3a725f1f.system.entry.js → p-58419bed.system.entry.js} +2 -2
- package/dist/nano-components/p-58419bed.system.entry.js.map +1 -0
- package/dist/nano-components/p-5a476bba.system.entry.js.map +1 -1
- package/dist/nano-components/p-625d3733.js +5 -0
- package/dist/nano-components/p-625d3733.js.map +1 -0
- package/dist/nano-components/{p-f1bf1099.entry.js → p-65c10b3f.entry.js} +2 -2
- package/dist/nano-components/{p-f1bf1099.entry.js.map → p-65c10b3f.entry.js.map} +0 -0
- 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-09066701.system.entry.js → p-7fcbc27f.system.entry.js} +2 -2
- package/dist/nano-components/{p-09066701.system.entry.js.map → p-7fcbc27f.system.entry.js.map} +0 -0
- package/dist/nano-components/p-8a8f893b.system.entry.js.map +1 -1
- package/dist/nano-components/{p-774e090b.system.entry.js → p-92f85aaf.system.entry.js} +2 -2
- package/dist/nano-components/{p-774e090b.system.entry.js.map → p-92f85aaf.system.entry.js.map} +0 -0
- 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-82f4b071.entry.js → p-a0515a0f.entry.js} +2 -2
- package/dist/nano-components/{p-82f4b071.entry.js.map → p-a0515a0f.entry.js.map} +0 -0
- package/dist/nano-components/{p-e3583b00.js → p-a77e3fbb.js} +3 -3
- package/dist/nano-components/{p-e3583b00.js.map → p-a77e3fbb.js.map} +1 -1
- package/dist/nano-components/{p-0bee6fe6.system.entry.js → p-a898bf92.system.entry.js} +2 -2
- package/dist/nano-components/{p-0bee6fe6.system.entry.js.map → p-a898bf92.system.entry.js.map} +0 -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-05c7bde1.system.entry.js → p-ca466250.system.entry.js} +2 -2
- package/dist/nano-components/{p-05c7bde1.system.entry.js.map → p-ca466250.system.entry.js.map} +0 -0
- package/dist/nano-components/{p-67cc0d9b.system.js → p-d24811c8.system.js} +3 -3
- package/dist/nano-components/{p-67cc0d9b.system.js.map → p-d24811c8.system.js.map} +1 -1
- package/dist/nano-components/p-d628547b.entry.js +5 -0
- package/dist/nano-components/p-d628547b.entry.js.map +1 -0
- package/dist/nano-components/p-d6569144.entry.js.map +1 -1
- package/dist/nano-components/p-d87ebf95.system.entry.js +5 -0
- package/dist/nano-components/p-d87ebf95.system.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 +76 -0
- package/dist/types/components.d.ts +89 -0
- package/dist/types/utils/drag.d.ts +1 -0
- package/docs-json.json +309 -2
- package/docs-vscode.json +53 -0
- package/package.json +8 -6
- package/dist/cjs/popover-86f1775c.js.map +0 -1
- package/dist/esm/popover-db86a392.js.map +0 -1
- package/dist/esm-es5/popover-db86a392.js +0 -5
- package/dist/esm-es5/popover-db86a392.js.map +0 -1
- package/dist/nano-components/p-3a725f1f.system.entry.js.map +0 -1
- package/dist/nano-components/p-3cf35ac4.system.entry.js.map +0 -1
- package/dist/nano-components/p-52ab579e.system.entry.js +0 -5
- package/dist/nano-components/p-52ab579e.system.entry.js.map +0 -1
- package/dist/nano-components/p-7be6b7f3.system.js +0 -5
- package/dist/nano-components/p-7be6b7f3.system.js.map +0 -1
- package/dist/nano-components/p-a4075d49.entry.js.map +0 -1
- package/dist/nano-components/p-bbe6b7af.entry.js.map +0 -1
- package/dist/nano-components/p-d9c7909e.js +0 -5
- package/dist/nano-components/p-d9c7909e.js.map +0 -1
- package/dist/nano-components/p-e35eac75.entry.js.map +0 -1
- package/dist/nano-components/p-e6f41b97.entry.js +0 -5
- package/dist/nano-components/p-e6f41b97.entry.js.map +0 -1
- package/dist/nano-components/p-e6f8f9f7.system.entry.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["src/components/date-input/date-input.scss?tag=nano-date-input&encapsulation=scoped","src/components/date-input/date-input.tsx"],"names":["dateInputCss","DateRegxps","d","m","y","inputIds","DateInput","[object Object]","hostRef","this","directInput","dateOrderIndeces","inputId","locale","window","navigator","languages","language","undefined","_invalid","helperText","helperTextFormat","year","month","day","floatLabel","name","readonly","disabled","autofocus","clearInput","value","validateOn","showInlineError","dateOrder","required","hideLabel","picker","pickerOpen","closeAfterPicked","onInputChange","e","stopPropagation","setValue","target","onInputValidate","detail","isValid","nanoValidate","emit","errorMessage","originalEvent","onInputKey","onDatePicked","onDropdownHide","setTimeout","_","trigger","focus","onDropdownShow","pickerEle","setFocus","pickerOpenSource","onTriggerClick","onTriggerKey","includes","key","onCloseClick","onCloseKeyDown","shiftKey","preventDefault","invalid","inputValue","formatIsoDate","nanoChange","date","parseISODate","setDatePattern","valueDate","min","max","error","toLocaleDateString","async","input","getInputElement","length","setCustomValidity","showError","dropdown","open","validateFirst","reportValidity","message","dateRegexOrdered","dateStrOrd","Array","from","map","datepart","i","push","pattern","join","placeholder","isoDate","matches","match","RegExp","formatted","createDate","Date","dateStr","printISODate","handleValueChange","pickerCloseBtn","firstFocusEle","tetherTo","handlePickerOpenChange","placement","host","ownerDocument","dir","hasHelperSlot","querySelector","h","Host","class","Object","assign","createColorClasses","color","slot","label","onNanoChange","onNanoInput","onNanoValidate","form","size","ref","inputmode","type","onKeyDown","onClick","onNanoHide","onNanoShow","dialogTitle","onMouseDown","pickerClose","onNanoDatePicked","is-modal","localization","selectedDate","initialPickerDate","firstDayOfWeek","vhidden"],"mappings":";;;sJAAA,MAAMA,EAAe,yvGC+BrB,MAAMC,EAAa,CACjBC,EAAG,aACHC,EAAG,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Nc,KAAK,SACLM,YAAa1I,KAAK0D,aAClB2E,UAAWrI,KAAK2D,eAChBuE,IAAMS,GAAiB3I,KAAK0G,eAAiBiC,GAE7CvB,EAAA,YAAA,CAAWnG,KAAK,gBAChBmG,EAAA,OAAA,CAAME,MAAM,WAAS,kBAGzBF,EAAA,mBAAA,CACEwB,iBAAkB5I,KAAK4C,aACvB0B,IAAKtE,KAAKsE,KAAO7D,UACjB8D,IAAKvE,KAAKuE,KAAO9D,UAASoI,WAChB,KACVX,IAAMtG,GAAY5B,KAAKmD,UAAYvB,EACnCkH,aAAc9I,KAAK8I,aACnBC,aAAc/I,KAAKsB,OAAStB,KAAKgJ,kBACjCC,eAAgBjJ,KAAKiJ,eACrBvB,MAAO1H,KAAK0H,OAASjH,gBAK3ByG,GAAiBlH,KAAKW,YAAcX,KAAKwB,kBACzC4F,EAAA,OAAA,CAAMO,KAAK,UACTP,EAAA,OAAA,CAAME,MAAO,CAAE4B,UAAWlJ,KAAKsB,MAAMuD,SACnCuC,EAAA,OAAA,CAAMnG,KAAK,YAEZjB,KAAKW,cAAgB0D,GACpB+C,EAAA,OAAA,KACG/C,EAAUI,mBACTzE,KAAKI,OACLJ,KAAKY,qBAOjBwG,EAAA,QAAA,CAAOgB,KAAK,SAAS9G,MAAOtB,KAAKsB,MAAOL,KAAMjB,KAAKiB","sourcesContent":["@import '../../global/style/nano-theme/form';\n@import '../../global/style/utilities/globals';\n\n:host {\n /**\n * @prop --focus-shadow: defaults to #{$control-focus-style};\n * @prop --open-btn-color: defaults to #{$button-bg-color};\n * @prop --open-btn-border: defaults to none;\n * @prop --close-btn-color: defaults to #{$color-celsius};\n * @prop --picker-base-size: Base font size of the date picker component. Defaults to 16px;\n */\n\n display: inline-block;\n width: 100%;\n\n --focus-shadow: #{$control-focus-style};\n --open-btn-color: #{$button-bg-color};\n --open-btn-border: none;\n --close-btn-color: #{$button-bg-color};\n --picker-base-size: 16px;\n}\n\n:host(.nano-color) {\n --focus-shadow: #{$control-focus-size current-color(tint, 0.56)};\n}\n\nnano-icon {\n pointer-events: none;\n}\n\n.date-field {\n display: flex;\n flex-direction: column;\n position: relative;\n\n @media (max-width: 35.9375em) {\n &::before {\n content: '';\n position: fixed;\n background: rgba(0, 0, 0, 0);\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: -1;\n transition: z-index 0.001s ease 1s, background 0.2s ease;\n\n :host([picker-open]) & {\n transition: z-index 0.001s ease, background 0.2s ease 0.001s;\n background: rgba(0, 0, 0, 0.5);\n z-index: 100;\n }\n }\n }\n\n &__dropdown {\n --padding: 0;\n --overflow: visible;\n\n padding: 0 !important;\n width: 0 !important;\n width: 100%;\n }\n\n &__close-bar {\n align-items: center;\n display: flex;\n justify-content: space-between;\n text-overflow: ellipsis;\n white-space: nowrap;\n border: 0;\n margin: 0;\n overflow: visible;\n padding: 0;\n position: absolute;\n right: -8px;\n top: -8px;\n width: auto;\n z-index: 1;\n }\n\n &__open {\n background: var(--open-btn-color);\n border: var(--open-btn-border);\n margin: 0;\n appearance: none;\n\n &:focus {\n box-shadow: var(--focus-shadow);\n outline: none;\n }\n }\n\n &__close {\n -webkit-appearance: none;\n align-items: center;\n appearance: none;\n background: var(--close-btn-color);\n border: 0;\n border-radius: 50%;\n cursor: pointer;\n display: flex;\n height: 24px;\n justify-content: center;\n padding: 0;\n width: 24px;\n\n @media (min-width: 36em) {\n opacity: 0;\n }\n\n &:focus {\n box-shadow: var(--focus-shadow);\n outline: none;\n\n @media (min-width: 36em) {\n opacity: 1;\n }\n }\n\n nano-icon {\n margin: 0 auto;\n }\n }\n\n nano-date-picker {\n font-size: var(--picker-base-size);\n }\n}\n\n.vhidden {\n @include visually-hide();\n}\n","import {\n Component,\n ComponentInterface,\n Element,\n h,\n Prop,\n Watch,\n State,\n Event,\n EventEmitter,\n Host,\n Method,\n} from '@stencil/core';\nimport {\n createDate,\n DaysOfWeek,\n printISODate,\n parseISODate,\n} from '../../utils/date-utils';\n\nimport {\n PickerChangeEvent,\n DateInputChangeEventDetail,\n Color,\n LocalDateOpts,\n DuetLocalizedText,\n ControlValidity,\n ControlValidityEventDetail,\n} from '../../interface';\nimport { createColorClasses } from '../../utils';\n\nconst DateRegxps = {\n d: '(\\\\d{1,2})',\n m: '(\\\\d{1,2})',\n y: '(\\\\d{4})',\n};\n\nlet inputIds = 0;\n\n/**\n * The date-input component combines `nano-dropdown`, `nano-input` and `nano-date-picker` components to make a fully featured date form field. It has specific options for localisation, date formatting and validation.\n *\n * @slot label - if you do not set a label attribute, you can use this slot for more complex markup\n * @slot helper - helper text to accompany the form field underneath.\n * @slot start - input start slot\n * @slot end - input end slot\n */\n@Component({\n tag: 'nano-date-input',\n styleUrl: 'date-input.scss',\n scoped: true,\n})\nexport class DateInput implements ComponentInterface {\n private pickerEle!: HTMLNanoDatePickerElement;\n private trigger!: HTMLButtonElement;\n private pickerCloseBtn!: HTMLButtonElement;\n private dropdown!: HTMLNanoDropdownElement;\n private input: HTMLNanoInputElement;\n private pickerOpenSource: 'key' | 'mouse';\n\n private directInput = false;\n private dateOrderIndeces = { d: 0, m: 1, y: 3 };\n private inputId = `nano-input-${inputIds++}`;\n private locale =\n (window.navigator.languages as string[]) ||\n window.navigator.language ||\n undefined;\n\n @Element() host: HTMLNanoDateInputElement;\n\n // Private state\n\n @State() pattern!: string;\n @State() inputValue: string;\n\n // Public Api / Prop\n\n /**\n * This will be true when the control is in an invalid state.\n * Validity is determined by the `required` prop. Or if custom validity message is set. @readonly\n */\n @Prop({ reflect: true })\n get invalid() {\n return this._invalid;\n }\n @State() _invalid = false;\n\n /**\n * Whether to show a long form, confirmation date string of the one currently entered\n */\n @Prop() helperText: boolean = true;\n\n /**\n * Options for the date string display. Refer to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString.\n */\n @Prop() helperTextFormat: LocalDateOpts = {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n };\n\n /**\n * Enable floating label behaviour. Will disable placeholder if set.\n */\n @Prop() floatLabel: boolean = false;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * If `true`, the user cannot modify the value.\n */\n @Prop() readonly = false;\n\n /**\n * The initial size (number of characters) of the control.\n */\n @Prop() size?: number;\n\n /**\n * The form element to associate the select with (its form owner). Must be the id of a form.\n */\n @Prop() form?: string | null;\n\n /**\n * Which day is considered first day of the week? `0` for Sunday, `1` for Monday, etc.\n * Default is Monday.\n */\n @Prop() firstDayOfWeek?: DaysOfWeek;\n\n /**\n * Button labels, day names, month names, etc, used for localization.\n * Default is English.\n */\n @Prop() localization?: DuetLocalizedText;\n\n /**\n * If `true`, the user cannot interact with the input.\n */\n @Prop() disabled = false;\n\n /**\n * The color to use from the application's color palette.\n */\n @Prop() color?: Color;\n\n /**\n * This Boolean attribute lets you specify that a form control should have input focus when the page loads.\n */\n @Prop() autofocus = false;\n\n /**\n * If `true`, a clear icon will appear in the input when there is a value. Clicking it clears the input.\n */\n @Prop() clearInput = false;\n\n /**\n * String to place within a label element. Alternatively you may use a label slot.\n */\n @Prop() label?: string;\n\n /**\n * Instructional text that shows before the input has a value.\n * The pattern prop will be used to create a placeholder automatically if unused.\n */\n @Prop({ mutable: true }) placeholder: string;\n\n /**\n * Current value. Must be in IS0-8601 format: YYYY-MM-DD.\n */\n @Prop({ reflect: true, mutable: true }) value: string = '';\n\n @Watch('value')\n handleValueChange() {\n if (!this.directInput) this.inputValue = this.formatIsoDate(this.value);\n this.nanoChange.emit({ value: this.value, date: parseISODate(this.value) });\n this.directInput = false;\n }\n\n /**\n * When should the field perform validation\n */\n @Prop() validateOn?: 'dirty' | 'submit' | 'submitThenDirty' = 'submit';\n\n /**\n * Whether to show validation errors underneath input\n */\n @Prop({ reflect: true }) showInlineError = true;\n\n /**\n * The order of the date parts for entry and display.\n * e.g. dmy = dd mm yyyy\n */\n @Prop() dateOrder: 'dmy' | 'mdy' | 'ymd' | 'dym' = 'dmy';\n\n @Watch('dateOrder')\n handleDateOrderChange() {\n this.setDatePattern();\n }\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * Minimum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the max property.\n */\n @Prop() min?: string;\n\n /**\n * Maximum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the min property.\n */\n @Prop() max?: string;\n\n /**\n * Visually hide the label - but make it accessible.\n */\n @Prop() hideLabel?: boolean = false;\n\n @Watch('min')\n @Watch('max')\n @Watch('value')\n testDateValidity() {\n const valueDate = parseISODate(this.value);\n let min: Date,\n max: Date,\n error: string = '';\n\n if (this.value && valueDate) {\n if (this.min && (min = parseISODate(this.min)) && valueDate < min) {\n error =\n 'Date below the minimum: ' +\n min.toLocaleDateString(this.locale, this.helperTextFormat);\n } else if (\n this.max &&\n (max = parseISODate(this.max)) &&\n valueDate > max\n ) {\n error =\n 'Date above the maximum: ' +\n max.toLocaleDateString(this.locale, this.helperTextFormat);\n }\n }\n\n setTimeout(async (_) => {\n if (!this.input) return;\n const input = await this.input.getInputElement();\n if (this.value.length && !valueDate) error = 'Please enter a valid date';\n\n input.setCustomValidity(error);\n if (this.input.validateOn === 'dirty') {\n this.input.showError(error);\n }\n }, 100);\n }\n\n /**\n * Show a date picker. Date pickers are not very useful\n * if the potential input is too far in the distance or past\n * e.g. Birthdays\n */\n @Prop() picker: boolean = true;\n\n /**\n * Initial picker date. Will be to `value` if set. Will be today's date if nothing set.\n * Must be in IS0-8601 format: YYYY-MM-DD.\n */\n @Prop() initialPickerDate?: string;\n\n /**\n * Set / read whether the picker is currently open.\n */\n @Prop({ reflect: true, mutable: true }) pickerOpen: boolean = false;\n\n @Watch('pickerOpen')\n handlePickerOpenChange() {\n this.dropdown.open = this.pickerOpen;\n }\n\n /**\n * Close the picker after a date is selected\n */\n @Prop() closeAfterPicked: boolean = true;\n\n // Event emitters\n\n /**\n * Event emitted when a date is selected.\n */\n @Event() nanoChange: EventEmitter<DateInputChangeEventDetail>;\n\n /**\n * Called when validation is performed (which depends on `validateOn`).\n * @returns event.detail: `{ isValid: boolean, errorMessage: string, originalEvent: Event }`.\n */\n @Event() nanoValidate: EventEmitter<ControlValidityEventDetail>;\n\n // Methods\n\n /**\n * Get the current state of the control.\n * @param validateFirst - perform validation first before reporting\n * @returns `{ isValid: boolean, errorMessage: string }`\n */\n @Method()\n async reportValidity(validateFirst: boolean): Promise<ControlValidity> {\n return await this.input.reportValidity(validateFirst);\n }\n\n /**\n * Sets focus on the child `nano-input`.\n */\n @Method()\n async setFocus() {\n if (this.input) this.input.setFocus();\n }\n\n /**\n * Returns the native `<input>` element used under the hood.\n */\n @Method()\n async getInputElement() {\n return await this.input.getInputElement();\n }\n\n /**\n * Invalidate the field and show a custom error message. To clear the error you will need to re-call this method with an empty string.\n */\n @Method()\n async showError(message: string) {\n if (!this.input) return;\n this.input.showError(message);\n }\n\n // Event handlers\n\n private onInputChange = (\n e: CustomEvent & {\n target: HTMLInputElement;\n }\n ) => {\n e.stopPropagation();\n this.setValue(e.target.value);\n };\n\n private onInputValidate = (e: CustomEvent<ControlValidityEventDetail>) => {\n e.stopPropagation();\n this._invalid = !e.detail.isValid;\n this.nanoValidate.emit({\n isValid: e.detail.isValid,\n errorMessage: e.detail.errorMessage,\n originalEvent: e.detail.originalEvent,\n });\n };\n\n private onInputKey = () => {\n this.directInput = true;\n };\n\n private onDatePicked = (e: { detail: PickerChangeEvent }) => {\n this.directInput = false;\n this.value = e.detail.value;\n if (this.closeAfterPicked) this.pickerOpen = false;\n };\n\n private onDropdownHide = () => {\n setTimeout((_) => (this.pickerOpen = false), 200);\n setTimeout((_) => this.trigger.focus(), 50);\n };\n\n private onDropdownShow = () => {\n setTimeout((_) => {\n this.pickerEle.setFocus(false, this.pickerOpenSource === 'key');\n this.pickerOpenSource = null;\n }, 200);\n };\n\n private onTriggerClick = () => {\n if (!this.pickerOpen) {\n this.pickerOpen = true;\n this.pickerOpenSource = 'mouse';\n }\n };\n\n private onTriggerKey = (e: KeyboardEvent) => {\n if ([' ', 'Enter'].includes(e.key)) {\n if (!this.pickerOpen) {\n this.pickerOpen = true;\n this.pickerOpenSource = 'key';\n }\n }\n };\n\n private onCloseClick = () => {\n if (this.pickerOpen) this.pickerOpen = false;\n };\n\n private onCloseKeyDown = (e: KeyboardEvent) => {\n // this ensures focus is trapped inside the picker\n if (e.key === 'Tab' && e.shiftKey) {\n this.pickerEle.setFocus(true);\n e.preventDefault();\n }\n if (e.key === ' ' || e.key === 'Enter') {\n if (this.pickerOpen) this.pickerOpen = false;\n }\n };\n\n // Private logic\n\n // set the regexp input pattern and placeholder (if necessary)\n private setDatePattern() {\n let dateRegexOrdered = [];\n let dateStrOrd = [];\n Array.from(this.dateOrder).map((datepart, i) => {\n dateRegexOrdered.push(DateRegxps[datepart]);\n this.dateOrderIndeces[datepart] = i;\n dateStrOrd.push(datepart === 'y' ? 'yyyy' : datepart + datepart);\n });\n this.pattern = dateRegexOrdered.join('\\\\W+');\n\n if (!this.placeholder && this.placeholder !== 'false')\n this.placeholder = dateStrOrd.join(' ');\n }\n\n // set the public facing date string\n private formatIsoDate(isoDate: string) {\n let dateRegexOrdered = [];\n Array.from('ymd').map((datepart) =>\n dateRegexOrdered.push(DateRegxps[datepart])\n );\n const matches = isoDate.match(new RegExp(dateRegexOrdered.join('\\\\W+')));\n if (!matches) return '';\n\n let formatted = [];\n formatted[this.dateOrderIndeces.d] = matches[3];\n formatted[this.dateOrderIndeces.m] = matches[2];\n formatted[this.dateOrderIndeces.y] = matches[1];\n\n return formatted.join(' ');\n }\n\n // on manual user entry, set the value that will be sent with the form field\n private setValue(inputValue: string) {\n const matches = inputValue.match(new RegExp(this.pattern));\n\n // it's an invalid date, but we still need to set it\n if (!matches) {\n this.value = inputValue;\n return;\n }\n\n let date = createDate(\n matches[this.dateOrderIndeces.y + 1],\n matches[this.dateOrderIndeces.m + 1],\n matches[this.dateOrderIndeces.d + 1]\n );\n\n if (!date) {\n // last ditch attempt - see if the browser can get something\n date = new Date(inputValue);\n\n // it's definitely an invalid date, but set it anyway for validation messages\n if (!date) {\n this.value = inputValue;\n return;\n }\n }\n\n const dateStr = printISODate(date);\n this.value = dateStr;\n return dateStr;\n }\n\n connectedCallback() {\n this.setDatePattern();\n this.handleValueChange();\n }\n\n componentDidLoad() {\n if (!this.pickerCloseBtn || !this.picker) return;\n this.pickerEle.firstFocusEle = this.pickerCloseBtn;\n this.dropdown.tetherTo = this.trigger;\n setTimeout((_) => this.handlePickerOpenChange(), 300);\n }\n\n render() {\n this.locale =\n (navigator.languages as string[]) || navigator.language || undefined;\n let placement: 'bottom-start' | 'bottom-end' =\n (this.host.ownerDocument as Document).dir === 'rtl'\n ? 'bottom-start'\n : 'bottom-end';\n const valueDate = parseISODate(this.value);\n const hasHelperSlot = !!this.host.querySelector('[slot=\"helper\"]');\n\n return (\n <Host class={{ ...createColorClasses(this.color) }}>\n <div class=\"date-field\">\n <nano-input\n class=\"date-field__input\"\n slot=\"trigger\"\n required={this.required || undefined}\n showInlineError={this.showInlineError}\n validateOn={this.validateOn}\n placeholder={\n this.placeholder !== 'false' ? this.placeholder : undefined\n }\n pattern={this.pattern}\n label={this.label}\n disabled={this.disabled || undefined}\n color={this.color || undefined}\n autofocus={this.autofocus || undefined}\n clearInput={this.clearInput || undefined}\n onNanoChange={this.onInputChange}\n onNanoInput={this.onInputKey}\n onNanoValidate={this.onInputValidate}\n name=\"\"\n form={this.form || undefined}\n size={this.size || undefined}\n readonly={this.readonly}\n value={this.inputValue}\n ref={(input) => (this.input = input)}\n floatLabel={this.floatLabel}\n hideLabel={this.hideLabel}\n inputmode={'numeric'}\n >\n <slot name=\"start\" slot=\"start\" />\n <slot name=\"label\" />\n <slot name=\"end\" slot=\"end\" />\n {this.picker && [\n <button\n slot=\"end\"\n class=\"date-field__open\"\n type=\"button\"\n onKeyDown={this.onTriggerKey}\n onClick={this.onTriggerClick}\n ref={(trigger) => (this.trigger = trigger)}\n disabled={this.disabled || this.readonly}\n >\n <nano-icon name=\"light/calendar-alt\"></nano-icon>\n </button>,\n\n <nano-dropdown\n slot=\"end\"\n placement={placement}\n onNanoHide={this.onDropdownHide}\n onNanoShow={this.onDropdownShow}\n dialogTitle=\"Choose a date\"\n class=\"date-field__dropdown\"\n ref={(dropdown) => (this.dropdown = dropdown)}\n >\n <div>\n <div class=\"date-field__close-bar\">\n <button\n class=\"date-field__close\"\n type=\"button\"\n onMouseDown={this.onCloseClick}\n onKeyDown={this.onCloseKeyDown}\n ref={(pickerClose) => (this.pickerCloseBtn = pickerClose)}\n >\n <nano-icon name=\"light/times\"></nano-icon>\n <span class=\"vhidden\">Close window</span>\n </button>\n </div>\n <nano-date-picker\n onNanoDatePicked={this.onDatePicked}\n min={this.min || undefined}\n max={this.max || undefined}\n is-modal={true}\n ref={(picker) => (this.pickerEle = picker)}\n localization={this.localization}\n selectedDate={this.value || this.initialPickerDate}\n firstDayOfWeek={this.firstDayOfWeek}\n color={this.color || undefined}\n ></nano-date-picker>\n </div>\n </nano-dropdown>,\n ]}\n {(hasHelperSlot || this.helperText || this.showInlineError) && (\n <span slot=\"helper\">\n <span class={{ vhidden: !!this.value.length }}>\n <slot name=\"helper\" />\n </span>\n {this.helperText && !!valueDate && (\n <span>\n {valueDate.toLocaleDateString(\n this.locale,\n this.helperTextFormat\n )}\n </span>\n )}\n </span>\n )}\n </nano-input>\n <input type=\"hidden\" value={this.value} name={this.name} />\n </div>\n </Host>\n );\n }\n}\n"]}
|
1
|
+
{"version":3,"sources":["src/components/date-input/date-input.scss?tag=nano-date-input&encapsulation=scoped","src/components/date-input/date-input.tsx"],"names":["dateInputCss","DateRegxps","d","m","y","inputIds","DateInput","[object Object]","hostRef","this","directInput","dateOrderIndeces","inputId","locale","window","navigator","languages","language","undefined","_invalid","helperText","helperTextFormat","year","month","day","floatLabel","name","readonly","disabled","autofocus","clearInput","value","validateOn","showInlineError","dateOrder","required","hideLabel","picker","pickerOpen","closeAfterPicked","onInputChange","e","stopPropagation","setValue","target","onInputValidate","detail","isValid","nanoValidate","emit","errorMessage","originalEvent","onInputKey","onDatePicked","onDropdownHide","setTimeout","_","trigger","focus","onDropdownShow","pickerEle","setFocus","pickerOpenSource","onTriggerClick","onTriggerKey","includes","key","onCloseClick","onCloseKeyDown","shiftKey","preventDefault","invalid","inputValue","formatIsoDate","nanoChange","date","parseISODate","setDatePattern","valueDate","min","max","error","toLocaleDateString","async","input","getInputElement","length","setCustomValidity","showError","dropdown","open","validateFirst","reportValidity","message","dateRegexOrdered","dateStrOrd","Array","from","map","datepart","i","push","pattern","join","placeholder","isoDate","matches","match","RegExp","formatted","createDate","Date","dateStr","printISODate","handleValueChange","pickerCloseBtn","firstFocusEle","tetherTo","handlePickerOpenChange","placement","host","ownerDocument","dir","hasHelperSlot","querySelector","h","Host","class","Object","assign","createColorClasses","color","slot","label","onNanoChange","onNanoInput","onNanoValidate","form","size","ref","inputmode","type","onKeyDown","onClick","onNanoHide","onNanoShow","dialogTitle","onMouseDown","pickerClose","onNanoDatePicked","is-modal","localization","selectedDate","initialPickerDate","firstDayOfWeek","vhidden"],"mappings":";;;sJAAA,MAAMA,EAAe,yvGC+BrB,MAAMC,EAAa,CACjBC,EAAG,aACHC,EAAG,aACHC,EAAG,YAGL,IAAIC,EAAW,MAeFC,EAAS,MALtBC,YAAAC,+FAaUC,KAAAC,YAAc,MACdD,KAAAE,iBAAmB,CAAET,EAAG,EAAGC,EAAG,EAAGC,EAAG,GACpCK,KAAAG,QAAU,cAAcP,MACxBI,KAAAI,OACLC,OAAOC,UAAUC,WAClBF,OAAOC,UAAUE,UACjBC,UAmBOT,KAAAU,SAAW,MAKZV,KAAAW,WAAsB,KAKtBX,KAAAY,iBAAkC,CACxCC,KAAM,UACNC,MAAO,OACPC,IAAK,WAMCf,KAAAgB,WAAsB,MAKtBhB,KAAAiB,KAAejB,KAAKG,QAKpBH,KAAAkB,SAAW,MA2BXlB,KAAAmB,SAAW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J,eACrBvB,MAAO1H,KAAK0H,OAASjH,gBAK3ByG,GAAiBlH,KAAKW,YAAcX,KAAKwB,kBACzC4F,EAAA,OAAA,CAAMO,KAAK,UACTP,EAAA,OAAA,CAAME,MAAO,CAAE4B,UAAWlJ,KAAKsB,MAAMuD,SACnCuC,EAAA,OAAA,CAAMnG,KAAK,YAEZjB,KAAKW,cAAgB0D,GACpB+C,EAAA,OAAA,KACG/C,EAAUI,mBACTzE,KAAKI,OACLJ,KAAKY,qBAOjBwG,EAAA,QAAA,CAAOgB,KAAK,SAAS9G,MAAOtB,KAAKsB,MAAOL,KAAMjB,KAAKiB","sourcesContent":["@use 'sass:map';\n@use 'sass:list';\n\n@import '../../global/style/nano-theme/form';\n@import '../../global/style/utilities/globals';\n\n:host {\n /**\n * @prop --focus-shadow: defaults to #{$control-focus-style};\n * @prop --open-btn-color: defaults to #{$button-bg-color};\n * @prop --open-btn-border: defaults to none;\n * @prop --close-btn-color: defaults to #{map.get($colors, celsius)};\n * @prop --picker-base-size: Base font size of the date picker component. Defaults to 16px;\n */\n\n display: inline-block;\n width: 100%;\n\n --focus-shadow: #{$control-focus-style};\n --open-btn-color: #{$button-bg-color};\n --open-btn-border: none;\n --close-btn-color: #{$button-bg-color};\n --picker-base-size: 16px;\n}\n\n:host(.nano-color) {\n --focus-shadow: #{$control-focus-size current-color(tint, 0.56)};\n}\n\nnano-icon {\n pointer-events: none;\n}\n\n.date-field {\n display: flex;\n flex-direction: column;\n position: relative;\n\n @media (max-width: 35.9375em) {\n &::before {\n content: '';\n position: fixed;\n background: rgba(0, 0, 0, 0);\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: -1;\n transition: z-index 0.001s ease 1s, background 0.2s ease;\n\n :host([picker-open]) & {\n transition: z-index 0.001s ease, background 0.2s ease 0.001s;\n background: rgba(0, 0, 0, 0.5);\n z-index: 100;\n }\n }\n }\n\n &__dropdown {\n --padding: 0;\n --overflow: visible;\n\n padding: 0 !important;\n width: 0 !important;\n width: 100%;\n }\n\n &__close-bar {\n align-items: center;\n display: flex;\n justify-content: space-between;\n text-overflow: ellipsis;\n white-space: nowrap;\n border: 0;\n margin: 0;\n overflow: visible;\n padding: 0;\n position: absolute;\n right: -8px;\n top: -8px;\n width: auto;\n z-index: 1;\n }\n\n &__open {\n background: var(--open-btn-color);\n border: var(--open-btn-border);\n margin: 0;\n appearance: none;\n\n &:focus {\n box-shadow: var(--focus-shadow);\n outline: none;\n }\n }\n\n &__close {\n -webkit-appearance: none;\n align-items: center;\n appearance: none;\n background: var(--close-btn-color);\n border: 0;\n border-radius: 50%;\n cursor: pointer;\n display: flex;\n height: 24px;\n justify-content: center;\n padding: 0;\n width: 24px;\n\n @media (min-width: 36em) {\n opacity: 0;\n }\n\n &:focus {\n box-shadow: var(--focus-shadow);\n outline: none;\n\n @media (min-width: 36em) {\n opacity: 1;\n }\n }\n\n nano-icon {\n margin: 0 auto;\n }\n }\n\n nano-date-picker {\n font-size: var(--picker-base-size);\n }\n}\n\n.vhidden {\n @include visually-hide();\n}\n","import {\n Component,\n ComponentInterface,\n Element,\n h,\n Prop,\n Watch,\n State,\n Event,\n EventEmitter,\n Host,\n Method,\n} from '@stencil/core';\nimport {\n createDate,\n DaysOfWeek,\n printISODate,\n parseISODate,\n} from '../../utils/date-utils';\n\nimport {\n PickerChangeEvent,\n DateInputChangeEventDetail,\n Color,\n LocalDateOpts,\n DuetLocalizedText,\n ControlValidity,\n ControlValidityEventDetail,\n} from '../../interface';\nimport { createColorClasses } from '../../utils';\n\nconst DateRegxps = {\n d: '(\\\\d{1,2})',\n m: '(\\\\d{1,2})',\n y: '(\\\\d{4})',\n};\n\nlet inputIds = 0;\n\n/**\n * The date-input component combines `nano-dropdown`, `nano-input` and `nano-date-picker` components to make a fully featured date form field. It has specific options for localisation, date formatting and validation.\n *\n * @slot label - if you do not set a label attribute, you can use this slot for more complex markup\n * @slot helper - helper text to accompany the form field underneath.\n * @slot start - input start slot\n * @slot end - input end slot\n */\n@Component({\n tag: 'nano-date-input',\n styleUrl: 'date-input.scss',\n scoped: true,\n})\nexport class DateInput implements ComponentInterface {\n private pickerEle!: HTMLNanoDatePickerElement;\n private trigger!: HTMLButtonElement;\n private pickerCloseBtn!: HTMLButtonElement;\n private dropdown!: HTMLNanoDropdownElement;\n private input: HTMLNanoInputElement;\n private pickerOpenSource: 'key' | 'mouse';\n\n private directInput = false;\n private dateOrderIndeces = { d: 0, m: 1, y: 3 };\n private inputId = `nano-input-${inputIds++}`;\n private locale =\n (window.navigator.languages as string[]) ||\n window.navigator.language ||\n undefined;\n\n @Element() host: HTMLNanoDateInputElement;\n\n // Private state\n\n @State() pattern!: string;\n @State() inputValue: string;\n\n // Public Api / Prop\n\n /**\n * This will be true when the control is in an invalid state.\n * Validity is determined by the `required` prop. Or if custom validity message is set. @readonly\n */\n @Prop({ reflect: true })\n get invalid() {\n return this._invalid;\n }\n @State() _invalid = false;\n\n /**\n * Whether to show a long form, confirmation date string of the one currently entered\n */\n @Prop() helperText: boolean = true;\n\n /**\n * Options for the date string display. Refer to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString.\n */\n @Prop() helperTextFormat: LocalDateOpts = {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n };\n\n /**\n * Enable floating label behaviour. Will disable placeholder if set.\n */\n @Prop() floatLabel: boolean = false;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * If `true`, the user cannot modify the value.\n */\n @Prop() readonly = false;\n\n /**\n * The initial size (number of characters) of the control.\n */\n @Prop() size?: number;\n\n /**\n * The form element to associate the select with (its form owner). Must be the id of a form.\n */\n @Prop() form?: string | null;\n\n /**\n * Which day is considered first day of the week? `0` for Sunday, `1` for Monday, etc.\n * Default is Monday.\n */\n @Prop() firstDayOfWeek?: DaysOfWeek;\n\n /**\n * Button labels, day names, month names, etc, used for localization.\n * Default is English.\n */\n @Prop() localization?: DuetLocalizedText;\n\n /**\n * If `true`, the user cannot interact with the input.\n */\n @Prop() disabled = false;\n\n /**\n * The color to use from the application's color palette.\n */\n @Prop() color?: Color;\n\n /**\n * This Boolean attribute lets you specify that a form control should have input focus when the page loads.\n */\n @Prop() autofocus = false;\n\n /**\n * If `true`, a clear icon will appear in the input when there is a value. Clicking it clears the input.\n */\n @Prop() clearInput = false;\n\n /**\n * String to place within a label element. Alternatively you may use a label slot.\n */\n @Prop() label?: string;\n\n /**\n * Instructional text that shows before the input has a value.\n * The pattern prop will be used to create a placeholder automatically if unused.\n */\n @Prop({ mutable: true }) placeholder: string;\n\n /**\n * Current value. Must be in IS0-8601 format: YYYY-MM-DD.\n */\n @Prop({ reflect: true, mutable: true }) value: string = '';\n\n @Watch('value')\n handleValueChange() {\n if (!this.directInput) this.inputValue = this.formatIsoDate(this.value);\n this.nanoChange.emit({ value: this.value, date: parseISODate(this.value) });\n this.directInput = false;\n }\n\n /**\n * When should the field perform validation\n */\n @Prop() validateOn?: 'dirty' | 'submit' | 'submitThenDirty' = 'submit';\n\n /**\n * Whether to show validation errors underneath input\n */\n @Prop({ reflect: true }) showInlineError = true;\n\n /**\n * The order of the date parts for entry and display.\n * e.g. dmy = dd mm yyyy\n */\n @Prop() dateOrder: 'dmy' | 'mdy' | 'ymd' | 'dym' = 'dmy';\n\n @Watch('dateOrder')\n handleDateOrderChange() {\n this.setDatePattern();\n }\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * Minimum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the max property.\n */\n @Prop() min?: string;\n\n /**\n * Maximum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the min property.\n */\n @Prop() max?: string;\n\n /**\n * Visually hide the label - but make it accessible.\n */\n @Prop() hideLabel?: boolean = false;\n\n @Watch('min')\n @Watch('max')\n @Watch('value')\n testDateValidity() {\n const valueDate = parseISODate(this.value);\n let min: Date,\n max: Date,\n error: string = '';\n\n if (this.value && valueDate) {\n if (this.min && (min = parseISODate(this.min)) && valueDate < min) {\n error =\n 'Date below the minimum: ' +\n min.toLocaleDateString(this.locale, this.helperTextFormat);\n } else if (\n this.max &&\n (max = parseISODate(this.max)) &&\n valueDate > max\n ) {\n error =\n 'Date above the maximum: ' +\n max.toLocaleDateString(this.locale, this.helperTextFormat);\n }\n }\n\n setTimeout(async (_) => {\n if (!this.input) return;\n const input = await this.input.getInputElement();\n if (this.value.length && !valueDate) error = 'Please enter a valid date';\n\n input.setCustomValidity(error);\n if (this.input.validateOn === 'dirty') {\n this.input.showError(error);\n }\n }, 100);\n }\n\n /**\n * Show a date picker. Date pickers are not very useful\n * if the potential input is too far in the distance or past\n * e.g. Birthdays\n */\n @Prop() picker: boolean = true;\n\n /**\n * Initial picker date. Will be to `value` if set. Will be today's date if nothing set.\n * Must be in IS0-8601 format: YYYY-MM-DD.\n */\n @Prop() initialPickerDate?: string;\n\n /**\n * Set / read whether the picker is currently open.\n */\n @Prop({ reflect: true, mutable: true }) pickerOpen: boolean = false;\n\n @Watch('pickerOpen')\n handlePickerOpenChange() {\n this.dropdown.open = this.pickerOpen;\n }\n\n /**\n * Close the picker after a date is selected\n */\n @Prop() closeAfterPicked: boolean = true;\n\n // Event emitters\n\n /**\n * Event emitted when a date is selected.\n */\n @Event() nanoChange: EventEmitter<DateInputChangeEventDetail>;\n\n /**\n * Called when validation is performed (which depends on `validateOn`).\n * @returns event.detail: `{ isValid: boolean, errorMessage: string, originalEvent: Event }`.\n */\n @Event() nanoValidate: EventEmitter<ControlValidityEventDetail>;\n\n // Methods\n\n /**\n * Get the current state of the control.\n * @param validateFirst - perform validation first before reporting\n * @returns `{ isValid: boolean, errorMessage: string }`\n */\n @Method()\n async reportValidity(validateFirst: boolean): Promise<ControlValidity> {\n return await this.input.reportValidity(validateFirst);\n }\n\n /**\n * Sets focus on the child `nano-input`.\n */\n @Method()\n async setFocus() {\n if (this.input) this.input.setFocus();\n }\n\n /**\n * Returns the native `<input>` element used under the hood.\n */\n @Method()\n async getInputElement() {\n return await this.input.getInputElement();\n }\n\n /**\n * Invalidate the field and show a custom error message. To clear the error you will need to re-call this method with an empty string.\n */\n @Method()\n async showError(message: string) {\n if (!this.input) return;\n this.input.showError(message);\n }\n\n // Event handlers\n\n private onInputChange = (\n e: CustomEvent & {\n target: HTMLInputElement;\n }\n ) => {\n e.stopPropagation();\n this.setValue(e.target.value);\n };\n\n private onInputValidate = (e: CustomEvent<ControlValidityEventDetail>) => {\n e.stopPropagation();\n this._invalid = !e.detail.isValid;\n this.nanoValidate.emit({\n isValid: e.detail.isValid,\n errorMessage: e.detail.errorMessage,\n originalEvent: e.detail.originalEvent,\n });\n };\n\n private onInputKey = () => {\n this.directInput = true;\n };\n\n private onDatePicked = (e: { detail: PickerChangeEvent }) => {\n this.directInput = false;\n this.value = e.detail.value;\n if (this.closeAfterPicked) this.pickerOpen = false;\n };\n\n private onDropdownHide = () => {\n setTimeout((_) => (this.pickerOpen = false), 200);\n setTimeout((_) => this.trigger.focus(), 50);\n };\n\n private onDropdownShow = () => {\n setTimeout((_) => {\n this.pickerEle.setFocus(false, this.pickerOpenSource === 'key');\n this.pickerOpenSource = null;\n }, 200);\n };\n\n private onTriggerClick = () => {\n if (!this.pickerOpen) {\n this.pickerOpen = true;\n this.pickerOpenSource = 'mouse';\n }\n };\n\n private onTriggerKey = (e: KeyboardEvent) => {\n if ([' ', 'Enter'].includes(e.key)) {\n if (!this.pickerOpen) {\n this.pickerOpen = true;\n this.pickerOpenSource = 'key';\n }\n }\n };\n\n private onCloseClick = () => {\n if (this.pickerOpen) this.pickerOpen = false;\n };\n\n private onCloseKeyDown = (e: KeyboardEvent) => {\n // this ensures focus is trapped inside the picker\n if (e.key === 'Tab' && e.shiftKey) {\n this.pickerEle.setFocus(true);\n e.preventDefault();\n }\n if (e.key === ' ' || e.key === 'Enter') {\n if (this.pickerOpen) this.pickerOpen = false;\n }\n };\n\n // Private logic\n\n // set the regexp input pattern and placeholder (if necessary)\n private setDatePattern() {\n let dateRegexOrdered = [];\n let dateStrOrd = [];\n Array.from(this.dateOrder).map((datepart, i) => {\n dateRegexOrdered.push(DateRegxps[datepart]);\n this.dateOrderIndeces[datepart] = i;\n dateStrOrd.push(datepart === 'y' ? 'yyyy' : datepart + datepart);\n });\n this.pattern = dateRegexOrdered.join('\\\\W+');\n\n if (!this.placeholder && this.placeholder !== 'false')\n this.placeholder = dateStrOrd.join(' ');\n }\n\n // set the public facing date string\n private formatIsoDate(isoDate: string) {\n let dateRegexOrdered = [];\n Array.from('ymd').map((datepart) =>\n dateRegexOrdered.push(DateRegxps[datepart])\n );\n const matches = isoDate.match(new RegExp(dateRegexOrdered.join('\\\\W+')));\n if (!matches) return '';\n\n let formatted = [];\n formatted[this.dateOrderIndeces.d] = matches[3];\n formatted[this.dateOrderIndeces.m] = matches[2];\n formatted[this.dateOrderIndeces.y] = matches[1];\n\n return formatted.join(' ');\n }\n\n // on manual user entry, set the value that will be sent with the form field\n private setValue(inputValue: string) {\n const matches = inputValue.match(new RegExp(this.pattern));\n\n // it's an invalid date, but we still need to set it\n if (!matches) {\n this.value = inputValue;\n return;\n }\n\n let date = createDate(\n matches[this.dateOrderIndeces.y + 1],\n matches[this.dateOrderIndeces.m + 1],\n matches[this.dateOrderIndeces.d + 1]\n );\n\n if (!date) {\n // last ditch attempt - see if the browser can get something\n date = new Date(inputValue);\n\n // it's definitely an invalid date, but set it anyway for validation messages\n if (!date) {\n this.value = inputValue;\n return;\n }\n }\n\n const dateStr = printISODate(date);\n this.value = dateStr;\n return dateStr;\n }\n\n connectedCallback() {\n this.setDatePattern();\n this.handleValueChange();\n }\n\n componentDidLoad() {\n if (!this.pickerCloseBtn || !this.picker) return;\n this.pickerEle.firstFocusEle = this.pickerCloseBtn;\n this.dropdown.tetherTo = this.trigger;\n setTimeout((_) => this.handlePickerOpenChange(), 300);\n }\n\n render() {\n this.locale =\n (navigator.languages as string[]) || navigator.language || undefined;\n let placement: 'bottom-start' | 'bottom-end' =\n (this.host.ownerDocument as Document).dir === 'rtl'\n ? 'bottom-start'\n : 'bottom-end';\n const valueDate = parseISODate(this.value);\n const hasHelperSlot = !!this.host.querySelector('[slot=\"helper\"]');\n\n return (\n <Host class={{ ...createColorClasses(this.color) }}>\n <div class=\"date-field\">\n <nano-input\n class=\"date-field__input\"\n slot=\"trigger\"\n required={this.required || undefined}\n showInlineError={this.showInlineError}\n validateOn={this.validateOn}\n placeholder={\n this.placeholder !== 'false' ? this.placeholder : undefined\n }\n pattern={this.pattern}\n label={this.label}\n disabled={this.disabled || undefined}\n color={this.color || undefined}\n autofocus={this.autofocus || undefined}\n clearInput={this.clearInput || undefined}\n onNanoChange={this.onInputChange}\n onNanoInput={this.onInputKey}\n onNanoValidate={this.onInputValidate}\n name=\"\"\n form={this.form || undefined}\n size={this.size || undefined}\n readonly={this.readonly}\n value={this.inputValue}\n ref={(input) => (this.input = input)}\n floatLabel={this.floatLabel}\n hideLabel={this.hideLabel}\n inputmode={'numeric'}\n >\n <slot name=\"start\" slot=\"start\" />\n <slot name=\"label\" />\n <slot name=\"end\" slot=\"end\" />\n {this.picker && [\n <button\n slot=\"end\"\n class=\"date-field__open\"\n type=\"button\"\n onKeyDown={this.onTriggerKey}\n onClick={this.onTriggerClick}\n ref={(trigger) => (this.trigger = trigger)}\n disabled={this.disabled || this.readonly}\n >\n <nano-icon name=\"light/calendar-alt\"></nano-icon>\n </button>,\n\n <nano-dropdown\n slot=\"end\"\n placement={placement}\n onNanoHide={this.onDropdownHide}\n onNanoShow={this.onDropdownShow}\n dialogTitle=\"Choose a date\"\n class=\"date-field__dropdown\"\n ref={(dropdown) => (this.dropdown = dropdown)}\n >\n <div>\n <div class=\"date-field__close-bar\">\n <button\n class=\"date-field__close\"\n type=\"button\"\n onMouseDown={this.onCloseClick}\n onKeyDown={this.onCloseKeyDown}\n ref={(pickerClose) => (this.pickerCloseBtn = pickerClose)}\n >\n <nano-icon name=\"light/times\"></nano-icon>\n <span class=\"vhidden\">Close window</span>\n </button>\n </div>\n <nano-date-picker\n onNanoDatePicked={this.onDatePicked}\n min={this.min || undefined}\n max={this.max || undefined}\n is-modal={true}\n ref={(picker) => (this.pickerEle = picker)}\n localization={this.localization}\n selectedDate={this.value || this.initialPickerDate}\n firstDayOfWeek={this.firstDayOfWeek}\n color={this.color || undefined}\n ></nano-date-picker>\n </div>\n </nano-dropdown>,\n ]}\n {(hasHelperSlot || this.helperText || this.showInlineError) && (\n <span slot=\"helper\">\n <span class={{ vhidden: !!this.value.length }}>\n <slot name=\"helper\" />\n </span>\n {this.helperText && !!valueDate && (\n <span>\n {valueDate.toLocaleDateString(\n this.locale,\n this.helperTextFormat\n )}\n </span>\n )}\n </span>\n )}\n </nano-input>\n <input type=\"hidden\" value={this.value} name={this.name} />\n </div>\n </Host>\n );\n }\n}\n"]}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function s(e){try{h(o.next(e))}catch(t){r(t)}}function a(e){try{h(o["throw"](e))}catch(t){r(t)}}function h(e){e.done?n(e.value):i(e.value).then(s,a)}h((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return h([e,t])}}function h(s){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=s[0]&2?i["return"]:s[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;if(i=0,r)s=[s[0]&2,r.value];switch(s[0]){case 0:case 1:r=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;i=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!r||s[1]>r[0]&&s[1]<r[3])){n.label=s[1];break}if(s[0]===6&&n.label<r[1]){n.label=r[1];r=s;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(s);break}if(r[2])n.ops.pop();n.trys.pop();continue}s=t.call(e,n)}catch(a){s=[6,a];i=0}finally{o=r=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};
|
2
2
|
/*!
|
3
3
|
* Web Components for Nanopore digital Web Apps
|
4
|
-
*/System.register(["./p-59b3d24b.system.js","./p-
|
5
|
-
//# sourceMappingURL=p-
|
4
|
+
*/System.register(["./p-59b3d24b.system.js","./p-3c3e9fec.system.js","./p-09d2d944.system.js","./p-9de508a5.system.js"],(function(e){"use strict";var t,n,o,i,r,s,a;return{setters:[function(e){t=e.r;n=e.c;o=e.h;i=e.g},function(e){r=e.P},function(e){s=e.g},function(e){a=e.a}],execute:function(){var h=":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{--width:auto;--border:var(--nano-layer-border-style, 1px solid var(--nano-layer-border-color, rgba(0, 0, 0, 0.1)));--border-radius:var(--nano-layer-border-radius, var(--nano-border-radius-medium, 4px));--background:var(--nano-layer-bg, #fff);--padding:10px 0;--overflow:hidden;--dropdown-z-index:var(--nano-layer-index-dropdown, 300);--min-width:0;--box-shadow:var(--nano-layer-shadow-large, 0 2px 8px rgba(0, 0, 0, 0.2));display:-webkit-box;display:-ms-flexbox;display:flex}.dropdown{position:relative}.dropdown__trigger{display:block}.dropdown__positioner{position:absolute;z-index:var(--dropdown-z-index);min-width:var(--min-width)}@media (max-width: 35.9375em){.dropdown__positioner{z-index:100}}.dropdown__panel{padding:var(--padding);background:var(--background);min-width:var(--min-width);width:var(--width);border:var(--border);border-radius:var(--border-radius);color:currentColor;-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);opacity:0;-webkit-transition:0.2s ease opacity, 0.2s ease transform, 0.2s ease min-height;transition:0.2s ease opacity, 0.2s ease transform, 0.2s ease min-height;min-height:20px;overflow:var(--overflow);-webkit-box-sizing:content-box !important;box-sizing:content-box !important}.dropdown__panel.loading{overflow-y:hidden}.dropdown__panel.top{-webkit-transform:translateY(-20px) translateZ(0);transform:translateY(-20px) translateZ(0)}.dropdown__panel.bottom{-webkit-transform:translateY(20px) translateZ(0);transform:translateY(20px) translateZ(0)}.dropdown__positioner.popover-visible .dropdown__panel{opacity:1;-webkit-transform:translateY(0) translateZ(0);transform:translateY(0) translateZ(0)}.dropdown__panel ::slotted(nano-menu){max-height:50vh}.dropdown__accessible-title{clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;width:1px;margin:-1px;overflow:hidden;padding:0;position:absolute}";var d=0;var l=e("nano_dropdown",function(){function e(e){var o=this;t(this,e);this.nanoShow=n(this,"nanoShow",7);this.nanoAfterShow=n(this,"nanoAfterShow",7);this.nanoHide=n(this,"nanoHide",7);this.nanoAfterHide=n(this,"nanoAfterHide",7);this.dropdownId="dropdown-"+d++;this.labelId=this.dropdownId+"-title";this.ignoreOpenWatcher=false;this.didLoad=false;this.autoOpen=true;this.open=false;this.closeOnSelect=true;this.tetherTo=null;this.placement="bottom-start";this.distance=2;this.skidding=0;this.hoist=false;this.togglePanel=function(){if(!o.autoOpen)return;o.open?o.hide():o.show()};this.handleTriggerKeyDown=function(e){if(["ArrowDown","ArrowUp"," "].includes(e.key)){o.show();e.preventDefault();e.stopPropagation();if(o.menu)o.menu.setFocus()}};this.handleTriggerSlotChange=function(){o.updateAccessibleTrigger()}}Object.defineProperty(e.prototype,"menu",{get:function(){return this.host.querySelector("nano-menu")},enumerable:false,configurable:true});e.prototype.handleOpenChange=function(){if(this.ignoreOpenWatcher)return;this.open?this.show():this.hide();if(this.accessibleTrigger){this.accessibleTrigger.setAttribute("aria-expanded",this.open.toString());return}this.updateAccessibleTrigger()};e.prototype.handleTetherToChange=function(){this.createPopover();this.updateAccessibleTrigger()};e.prototype.handlePopoverOptionsChange=function(){this.popover.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,skidding:this.skidding,distance:this.distance})};e.prototype.secondaryOpen=function(e){var t=this;if(!e.detail.secondaryMenu)return;e.stopPropagation();this.panel.classList.add("loading");this.panel.addEventListener("transitionend",(function(){t.panel.classList.remove("loading")}),{once:true});this.panel.style.minHeight=e.detail.secondaryMenu.scrollHeight+"px"};e.prototype.secondaryClose=function(e){if(!e.detail.secondaryMenu)return;e.stopPropagation();if(!e.target.parentElement)return;this.panel.style.minHeight=e.target.parentElement.scrollHeight+"px"};e.prototype.handlePanelSelect=function(e){var t=e.target;if(this.closeOnSelect&&t.tagName.toLowerCase()==="nano-menu")this.hide()};e.prototype.show=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){this.ignoreOpenWatcher=true;this.open=true;e=this.nanoShow.emit();if(e.defaultPrevented){this.open=false;this.ignoreOpenWatcher=false;return[2]}this.popover.show();this.ignoreOpenWatcher=false;document.addEventListener("mousedown",this.handleDocumentMouseDown);document.addEventListener("keydown",this.handleDocumentKeyDown);return[2]}))}))};e.prototype.hide=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){this.ignoreOpenWatcher=true;this.open=false;e=this.nanoHide.emit();if(e.defaultPrevented){this.open=true;this.ignoreOpenWatcher=false;return[2]}if(this.popover)this.popover.hide();this.ignoreOpenWatcher=false;document.removeEventListener("mousedown",this.handleDocumentMouseDown);document.removeEventListener("keydown",this.handleDocumentKeyDown);if(this.accessibleTrigger&&this.focusEleInDropDwn()){this.accessibleTrigger.focus()}return[2]}))}))};e.prototype.focusEleInDropDwn=function(e){var t;var n=s();if(e&&((t=e.composedPath())===null||t===void 0?void 0:t.length)){var o=e.composedPath().includes(this.containingElement);return!e.composedPath().includes(this.accessibleTrigger)&&o}return n&&n.closest(this.containingElement.tagName.toLowerCase())===this.containingElement&&n!==this.accessibleTrigger};e.prototype.updateAccessibleTrigger=function(){if(!this.didLoad)return;var e;this.accessibleTrigger=null;if(!this.tetherTo){var t=Array.from(this.host.querySelectorAll('[slot="trigger"]'));e=t.map(a)[0]}else{e=a(this.tetherTo)}if(e){e.setAttribute("aria-haspopup","true");e.setAttribute("aria-expanded",this.open?"true":"false");this.accessibleTrigger=e}};e.prototype.handleDocumentKeyDown=function(e){var t=this;if(e.key==="Escape"){this.hide();return}if(e.key==="Tab"){setTimeout((function(){if(document.activeElement&&document.activeElement.closest(t.containingElement.tagName.toLowerCase())!==t.containingElement){t.hide();return}}))}if(this.menu&&["ArrowDown","ArrowUp"].includes(e.key)){if(!this.open||this.focusEleInDropDwn(e))return;e.preventDefault();this.menu.setFocus();return}var n=e.composedPath();if(this.menu&&n.length&&!n.find((function(e){return e!==t.menu}))){this.menu.dispatchEvent(new KeyboardEvent(e.type,e));return}};e.prototype.handleDocumentMouseDown=function(e){if(!this.focusEleInDropDwn(e)){this.hide();return}};e.prototype.createPopover=function(){var e=this;if(this.popover){if(this.open)this.hide();this.popover.destroy();this.popover=null}this.popover=new r(this.tetherTo||this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:function(){return e.nanoAfterHide.emit()},onAfterShow:function(){return e.nanoAfterShow.emit()},onTransitionEnd:function(){if(!e.open){e.panel.scrollTop=0}else if(e.menu){e.menu.showActiveElement()}}});if(this.open){this.show()}};e.prototype.connectedCallback=function(){this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this);this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this);if(!this.containingElement)this.containingElement=this.host};e.prototype.componentDidLoad=function(){var e=this;this.didLoad=true;this.createPopover();setTimeout((function(){return e.updateAccessibleTrigger()}),100)};e.prototype.disconnectedCallback=function(){this.hide();if(this.popover)this.popover.destroy()};e.prototype.render=function(){var e=this;return o("div",{part:"base",id:this.dropdownId,class:{dropdown:true,"dropdown--open":this.open}},o("span",{part:"trigger",class:"dropdown__trigger",ref:function(t){return e.trigger=t},onKeyDown:this.handleTriggerKeyDown,onClick:this.togglePanel},o("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),o("div",{ref:function(t){return e.positioner=t},class:"dropdown__positioner"},o("div",{ref:function(t){return e.panel=t},part:"panel",class:"dropdown__panel "+this.placement.split("-").join(" "),"aria-hidden":!this.open,role:"dialog","aria-modal":"true","aria-labelledby":this.dialogTitle?this.labelId:undefined},this.dialogTitle&&o("h2",{id:this.labelId,class:"dropdown__accessible-title","aria-live":"polite"},this.dialogTitle),o("slot",null))))};Object.defineProperty(e.prototype,"host",{get:function(){return i(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{open:["handleOpenChange"],tetherTo:["handleTetherToChange"],placement:["handlePopoverOptionsChange"],distance:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"]}},enumerable:false,configurable:true});return e}());l.style=h}}}));
|
5
|
+
//# sourceMappingURL=p-7fcbc27f.system.entry.js.map
|
package/dist/nano-components/{p-09066701.system.entry.js.map → p-7fcbc27f.system.entry.js.map}
RENAMED
File without changes
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["src/components/rating/rating.scss?tag=nano-rating&encapsulation=scoped","src/components/rating/rating.tsx"],"names":["ratingCss","CANSHADOW","document","head","attachShadow","Rating","exports","class_1","hostRef","_this","this","hoverValue","isHovering","value","max","precision","readonly","disabled","name","symbolName","symbol","_","handleClick","event","newValue","getValueFromMousePosition","handleKeyDown","key","decrement","shiftKey","roundToPrecision","Math","preventDefault","increment","min","handleMouseEnter","handleMouseLeave","handleFocus","nanoFocus","emit","handleBlur","nanoBlur","handleMouseMove","prototype","handleValueChange","nanoChange","handleSymbolChange","setFocus","rating","focus","removeFocus","blur","containerLeft","getBoundingClientRect","left","containerWidth","width","num","clientX","isRtl","clamp","numberToRound","multiplier","ceil","clip","displayValue","tw","_getRoot","host","shadowRoot","_fixClassNames","ctxClasses","className","split","filter","classStr","match","eles","querySelectorAll","Array","from","map","ele","classList","add","componentDidLoad","focusVisible","observe","setTimeout","indicator","style","connectedCallback","dir","ownerDocument","disconnectedCallback","unobserve","componentDidRender","render","counter","keys","h","class","ref","el","part","rating--readonly","rating--disabled","aria-disabled","aria-readonly","aria-valuenow","aria-valuemin","aria-valuemax","tabIndex","onClick","onKeyDown","onMouseEnter","onMouseLeave","onMouseMove","onFocus","onBlur","index","rating__symbol","rating__symbol--hover","role","innerHTML","span","type"],"mappings":";;;yPAAA,IAAMA,EAAY,+5ECelB,IAAMC,IAAcC,SAASC,KAAKC,iBAUrBC,EAAMC,EAAA,cAAA,WALnB,SAAAC,EAAAC,GAAA,IAAAC,EAAAC,8HAYWA,KAAAC,WAAa,EACbD,KAAAE,WAAa,MAKkBF,KAAAG,MAAQ,EAKxCH,KAAAI,IAAM,EAKNJ,KAAAK,UAAY,EAKZL,KAAAM,SAAW,MAKXN,KAAAO,SAAW,MAKXP,KAAAQ,KAAO,GAKPR,KAAAS,WAAa,aAObT,KAAAU,OAAS,SAACC,GAChB,MAAA,oBAAsBZ,EAAKU,WAAa,kBA+DlCT,KAAAY,YAAc,SAACC,GACrB,GAAId,EAAKQ,UAAYR,EAAKO,SAAU,CAClC,OAGF,IAAMQ,EAAWf,EAAKgB,0BAA0BF,GAChDd,EAAKI,MAAQW,IAAaf,EAAKI,MAAQ,EAAIW,EAC3Cf,EAAKG,WAAa,OAGZF,KAAAgB,cAAgB,SAACH,GACvB,GAAId,EAAKQ,UAAYR,EAAKO,SAAU,CAClC,OAGF,GAAIO,EAAMI,MAAQ,YAAa,CAC7B,IAAMC,EAAYL,EAAMM,SAAW,EAAIpB,EAAKM,UAC5CN,EAAKI,MAAQJ,EAAKqB,iBAAiBC,KAAKjB,IAAI,EAAGL,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,UAAWnH,EAAKW,OAAOoG,EAAQ,SAKrCpB,EAAA,OAAA,CACEE,IAAK,SAACuB,GAAI,OAAMpH,EAAKgF,UAAYoC,GACjCxB,MAAM,6CACNX,MAAO,CACL1B,KAAMtD,KAAKsD,KAAKC,KAGjBiC,EAAQjB,KAAI,SAACuC,GAAK,OACjBpB,EAAA,OAAA,CACEC,MAAO,CACLoB,eAAgB,KAChBC,wBACEjH,EAAKG,YAAcmB,KAAKgC,KAAKE,KAAkBuD,EAAQ,GAE3DG,KAAK,eACLC,UAAWnH,EAAKW,OAAOoG,EAAQ,SAIrCpB,EAAA,QAAA,CACE0B,KAAK,SACL5G,KAAMR,KAAKQ,KACXL,MAAOH,KAAKG,MACZI,SAAUP,KAAKO,UAAYP,KAAKM,oSA5SzB","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"]}
|
1
|
+
{"version":3,"sources":["src/components/rating/rating.scss?tag=nano-rating&encapsulation=scoped","src/components/rating/rating.tsx"],"names":["ratingCss","CANSHADOW","document","head","attachShadow","Rating","exports","class_1","hostRef","_this","this","hoverValue","isHovering","value","max","precision","readonly","disabled","name","symbolName","symbol","_","handleClick","event","newValue","getValueFromMousePosition","handleKeyDown","key","decrement","shiftKey","roundToPrecision","Math","preventDefault","increment","min","handleMouseEnter","handleMouseLeave","handleFocus","nanoFocus","emit","handleBlur","nanoBlur","handleMouseMove","prototype","handleValueChange","nanoChange","handleSymbolChange","setFocus","rating","focus","removeFocus","blur","containerLeft","getBoundingClientRect","left","containerWidth","width","num","clientX","isRtl","clamp","numberToRound","multiplier","ceil","clip","displayValue","tw","_getRoot","host","shadowRoot","_fixClassNames","ctxClasses","className","split","filter","classStr","match","eles","querySelectorAll","Array","from","map","ele","classList","add","componentDidLoad","focusVisible","observe","setTimeout","indicator","style","connectedCallback","dir","ownerDocument","disconnectedCallback","unobserve","componentDidRender","render","counter","keys","h","class","ref","el","part","rating--readonly","rating--disabled","aria-disabled","aria-readonly","aria-valuenow","aria-valuemin","aria-valuemax","tabIndex","onClick","onKeyDown","onMouseEnter","onMouseLeave","onMouseMove","onFocus","onBlur","index","rating__symbol","rating__symbol--hover","role","innerHTML","span","type"],"mappings":";;;yPAAA,IAAMA,EAAY,+5ECelB,IAAMC,IAAcC,SAASC,KAAKC,iBAUrBC,EAAMC,EAAA,cAAA,WALnB,SAAAC,EAAAC,GAAA,IAAAC,EAAAC,8HAYWA,KAAAC,WAAa,EACbD,KAAAE,WAAa,MAKkBF,KAAAG,MAAQ,EAKxCH,KAAAI,IAAM,EAKNJ,KAAAK,UAAY,EAKZL,KAAAM,SAAW,MAKXN,KAAAO,SAAW,MAKXP,KAAAQ,KAAO,GAKPR,KAAAS,WAAa,aAObT,KAAAU,OAAS,SAACC,GAChB,MAAA,oBAAsBZ,EAAKU,WAAa,kBA+DlCT,KAAAY,YAAc,SAACC,GACrB,GAAId,EAAKQ,UAAYR,EAAKO,SAAU,CAClC,OAGF,IAAMQ,EAAWf,EAAKgB,0BAA0BF,GAChDd,EAAKI,MAAQW,IAAaf,EAAKI,MAAQ,EAAIW,EAC3Cf,EAAKG,WAAa,OAGZF,KAAAgB,cAAgB,SAACH,GACvB,GAAId,EAAKQ,UAAYR,EAAKO,SAAU,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ACjBpB,EAAA,OAAA,CACEC,MAAO,CACLoB,eAAgB,KAChBC,wBACEjH,EAAKG,YAAcmB,KAAKgC,KAAKE,KAAkBuD,EAAQ,GAE3DG,KAAK,eAILR,aAAc1G,EAAK0B,iBACnByF,UAAWnH,EAAKW,OAAOoG,EAAQ,SAKrCpB,EAAA,OAAA,CACEE,IAAK,SAACuB,GAAI,OAAMpH,EAAKgF,UAAYoC,GACjCxB,MAAM,6CACNX,MAAO,CACL1B,KAAMtD,KAAKsD,KAAKC,KAGjBiC,EAAQjB,KAAI,SAACuC,GAAK,OACjBpB,EAAA,OAAA,CACEC,MAAO,CACLoB,eAAgB,KAChBC,wBACEjH,EAAKG,YAAcmB,KAAKgC,KAAKE,KAAkBuD,EAAQ,GAE3DG,KAAK,eACLC,UAAWnH,EAAKW,OAAOoG,EAAQ,SAIrCpB,EAAA,QAAA,CACE0B,KAAK,SACL5G,KAAMR,KAAKQ,KACXL,MAAOH,KAAKG,MACZI,SAAUP,KAAKO,UAAYP,KAAKM,oSA5SzB","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"]}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(e,t,n,i){function s(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{l(i.next(e))}catch(t){r(t)}}function o(e){try{l(i["throw"](e))}catch(t){r(t)}}function l(e){e.done?n(e.value):s(e.value).then(a,o)}l((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,s,r,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(e){return function(t){return l([e,t])}}function l(a){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,s&&(r=a[0]&2?s["return"]:a[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;if(s=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;s=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(o){a=[6,o];s=0}finally{i=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t){for(var n=0,i=t.length,s=e.length;n<i;n++,s++)e[s]=t[n];return e};
|
2
2
|
/*!
|
3
3
|
* Web Components for Nanopore digital Web Apps
|
4
|
-
*/System.register(["./p-59b3d24b.system.js","./p-41a2e2e4.system.js","./p-1c216ca4.system.js","./p-67cc0d9b.system.js","./p-9edbf25d.system.js","./p-e1f46998.system.js","./p-1d13dbdf.system.js","./p-ef053a2f.system.js"],(function(e){"use strict";var t,n,i,s,r,a,o,l,u,c,h,f,d,p,g,v,y;return{setters:[function(e){t=e.g;n=e.l;i=e.r;s=e.c;r=e.f;a=e.i;o=e.h;l=e.e},function(e){u=e.S},function(e){c=e.r},function(e){h=e.a},function(e){f=e.b;d=e.c;p=e.a},function(e){g=e.C},function(e){v=e.g},function(e){y=e.d}],execute:function(){var m=new Map;var x=function(e,t){var n=e.fields,i=e.updater;n.forEach((function(e){i(e,t[e])}))};var b={create:function(e,n){var i=t(e);var s=new Map;var r={wormholes:s,state:n};m.set(e,r);var a=e.connectedCallback;e.connectedCallback=function(){m.set(e,r);if(a){a.call(e)}};var o=e.disconnectedCallback;e.disconnectedCallback=function(){m.delete(e);if(o){o.call(e)}};i.addEventListener("openWormhole",(function(e){e.stopPropagation();var t=e.detail,n=t.consumer,i=t.onOpen;if(s.has(n))return;if(typeof n!=="symbol"){var a=n.connectedCallback,o=n.disconnectedCallback;n.connectedCallback=function(){s.set(n,e.detail);if(a){a.call(n)}};n.disconnectedCallback=function(){s.delete(n);if(o){o.call(n)}}}s.set(n,e.detail);x(e.detail,r.state);i===null||i===void 0?void 0:i.resolve((function(){s.delete(n)}))}));i.addEventListener("closeWormhole",(function(e){var t=e.detail;s.delete(t)}))},Provider:function(e,t){var i=e.state;var s=n();if(m.has(s)){var r=m.get(s);r.state=i;r.wormholes.forEach((function(e){x(e,i)}))}return t}};var w=d((function(e,t){!function(e,n){n(t)}(p,(function(e){function t(e){var n,i,s=new Error(e);return n=s,i=t.prototype,Object.setPrototypeOf?Object.setPrototypeOf(n,i):n.__proto__=i,s}function n(e,n,i){var s=n.slice(0,i).split(/\n/),r=s.length,a=s[r-1].length+1;throw t(e+=" at line "+r+" col "+a+":\n\n "+n.split(/\n/)[r-1]+"\n "+Array(a).join(" ")+"^")}t.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var i=new Function("return this")().Promise,s=!1;try{s=new Function("return (async function(){}).constructor")()}catch(e){if(!(e instanceof SyntaxError))throw e}function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function a(e,t,n){for(var i in t)r(t,i)&&(null==t[i]||"object"!=typeof t[i]||"storage"!==i&&"prefixes"!==i||n?e[i]=t[i]:e[i]=a({},t[i]));return e}var o=/^async +/,l=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,u=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,c=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,h=/[.*+\-?^${}()|[\]\\]/g;function f(e){return h.test(e)?e.replace(h,"\\$&"):e}function d(e,i){i.rmWhitespace&&(e=e.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),l.lastIndex=0,u.lastIndex=0,c.lastIndex=0;var s=i.prefixes,r=[s.h,s.b,s.i,s.r,s.c,s.e].reduce((function(e,t){return e&&t?e+"|"+f(t):t?f(t):e}),""),a=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+f(i.tags[1])+")","g"),h=new RegExp("([^]*?)"+f(i.tags[0])+"(-|_)?\\s*("+r+")?\\s*","g"),d=0,p=!1;function g(t,s){var r,f={f:[]},g=0,v="c";function y(t){var s=e.slice(d,t),r=s.trim();if("f"===v)"safe"===r?f.raw=!0:i.async&&o.test(r)?(r=r.replace(o,""),f.f.push([r,"",!0])):f.f.push([r,""]);else if("fp"===v)f.f[f.f.length-1][1]+=r;else if("err"===v){if(r){var a=s.search(/\S/);n("invalid syntax",e,d+a)}}else f[v]=r;d=t+1}for("h"===s||"b"===s||"c"===s?v="n":"r"===s&&(f.raw=!0,s="i"),a.lastIndex=d;null!==(r=a.exec(e));){var m=r[1],x=r[2],b=r[3],w=r[4],I=r[5],F=r.index;if(m)"("===m?(0===g&&("n"===v?(y(F),v="p"):"f"===v&&(y(F),v="fp")),g++):")"===m?0===--g&&"c"!==v&&(y(F),v="err"):0===g&&"|"===m?(y(F),v="f"):"=>"===m&&(y(F),d+=1,v="res");else if(x){if("/*"===x){var _=e.indexOf("*/",a.lastIndex);-1===_&&n("unclosed comment",e,r.index),a.lastIndex=_+2}else if("'"===x){u.lastIndex=r.index,u.exec(e)?a.lastIndex=u.lastIndex:n("unclosed string",e,r.index)}else if('"'===x){c.lastIndex=r.index,c.exec(e)?a.lastIndex=c.lastIndex:n("unclosed string",e,r.index)}else if("`"===x){l.lastIndex=r.index,l.exec(e)?a.lastIndex=l.lastIndex:n("unclosed string",e,r.index)}}else if(b)return y(F),d=F+r[0].length,h.lastIndex=d,p=I,w&&"h"===s&&(s="s"),f.t=s,f}return n("unclosed tag",e,t),f}var v=function r(a,l){a.b=[],a.d=[];var u,c=!1,f=[];function v(e,t){e&&(e=function(e,t,n,i){var s,r;return"string"==typeof t.autoTrim?s=r=t.autoTrim:Array.isArray(t.autoTrim)&&(s=t.autoTrim[1],r=t.autoTrim[0]),(n||!1===n)&&(s=n),(i||!1===i)&&(r=i),"slurp"===s&&"slurp"===r?e.trim():("_"===s||"slurp"===s?e=String.prototype.trimLeft?e.trimLeft():e.replace(/^[\s\uFEFF\xA0]+/,""):"-"!==s&&"nl"!==s||(e=e.replace(/^(?:\n|\r|\r\n)/,"")),"_"===r||"slurp"===r?e=String.prototype.trimRight?e.trimRight():e.replace(/[\s\uFEFF\xA0]+$/,""):"-"!==r&&"nl"!==r||(e=e.replace(/(?:\n|\r|\r\n)$/,"")),e)}(e,i,p,t))&&(e=e.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),f.push(e))}for(;null!==(u=h.exec(e));){var y,m=u[1],x=u[2],b=u[3]||"";for(var w in s)if(s[w]===b){y=w;break}v(m,x),d=u.index+u[0].length,y||n("unrecognized tag type: "+b,e,d);var I=g(u.index,y),F=I.t;if("h"===F){var _=I.n||"";i.async&&o.test(_)&&(I.a=!0,I.n=_.replace(o,"")),I=r(I),f.push(I)}else if("c"===F){if(a.n===I.n)return c?(c.d=f,a.b.push(c)):a.d=f,a;n("Helper start and end don't match",e,u.index+u[0].length)}else if("b"===F){c?(c.d=f,a.b.push(c)):a.d=f;var R=I.n||"";i.async&&o.test(R)&&(I.a=!0,I.n=R.replace(o,"")),c=I,f=[]}else if("s"===F){var C=I.n||"";i.async&&o.test(C)&&(I.a=!0,I.n=C.replace(o,"")),f.push(I)}else f.push(I)}if(!l)throw t('unclosed helper "'+a.n+'"');return v(e.slice(d,e.length),!1),a.d=f,a}({f:[]},!0);if(i.plugins)for(var y=0;y<i.plugins.length;y++){var m=i.plugins[y];m.processAST&&(v.d=m.processAST(v.d,i))}return v.d}function p(e,t){var n=d(e,t),i="var tR='';"+(t.useWith?"with("+t.varName+"||{}){":"")+x(n,t)+"if(cb){cb(null,tR)} return tR"+(t.useWith?"}":"");if(t.plugins)for(var s=0;s<t.plugins.length;s++){var r=t.plugins[s];r.processFnString&&(i=r.processFnString(i,t))}return i}function g(e,t){for(var n=0;n<t.length;n++){var i=t[n][0],s=t[n][1];e=(t[n][2]?"await ":"")+"c.l('F','"+i+"')("+e,s&&(e+=","+s),e+=")"}return e}function v(e,t,n,i,s,r){var a="{exec:"+(s?"async ":"")+m(n,t,e)+",params:["+i+"]";return r&&(a+=",name:'"+r+"'"),s&&(a+=",async:true"),a+="}"}function y(e,t){for(var n="[",i=0;i<e.length;i++){var s=e[i];n+=v(t,s.res||"",s.d,s.p||"",s.a,s.n),i<e.length&&(n+=",")}return n+="]"}function m(e,t,n){return"function("+t+"){var tR='';"+x(e,n)+"return tR}"}function x(e,t){for(var n=0,i=e.length,s="";n<i;n++){var r=e[n];if("string"==typeof r){s+="tR+='"+r+"';"}else{var a=r.t,o=r.c||"",l=r.f,u=r.n||"",c=r.p||"",h=r.res||"",f=r.b,d=!!r.a;if("i"===a){t.defaultFilter&&(o="c.l('F','"+t.defaultFilter+"')("+o+")");var p=g(o,l);!r.raw&&t.autoEscape&&(p="c.l('F','e')("+p+")"),s+="tR+="+p+";"}else if("h"===a)if(t.storage.nativeHelpers.get(u))s+=t.storage.nativeHelpers.get(u)(r,t);else{var m=(d?"await ":"")+"c.l('H','"+u+"')("+v(t,h,r.d,c,d);m+=f?","+y(f,t):",[]",s+="tR+="+g(m+=",c)",l)+";"}else"s"===a?s+="tR+="+g((d?"await ":"")+"c.l('H','"+u+"')({params:["+c+"]},[],c)",l)+";":"e"===a&&(s+=o+"\n")}}return s}var b=function(){function e(e){this.cache=e}return e.prototype.define=function(e,t){this.cache[e]=t},e.prototype.get=function(e){return this.cache[e]},e.prototype.remove=function(e){delete this.cache[e]},e.prototype.reset=function(){this.cache={}},e.prototype.load=function(e){a(this.cache,e,!0)},e}();function w(e,n,i,s){if(n&&n.length>0)throw t((s?"Native":"")+"Helper '"+e+"' doesn't accept blocks");if(i&&i.length>0)throw t((s?"Native":"")+"Helper '"+e+"' doesn't accept filters")}var I={"&":"&","<":"<",">":">",'"':""","'":"'"};function F(e){return I[e]}var _=new b({}),R=new b({each:function(e,t){var n="",i=e.params[0];if(w("each",t,!1),e.async)return new Promise((function(t){!function e(t,n,i,s,r){i(t[n],n).then((function(a){s+=a,n===t.length-1?r(s):e(t,n+1,i,s,r)}))}(i,0,e.exec,n,t)}));for(var s=0;s<i.length;s++)n+=e.exec(i[s],s);return n},foreach:function(e,t){var n=e.params[0];if(w("foreach",t,!1),e.async)return new Promise((function(t){!function e(t,n,i,s,r,a){s(n[i],t[n[i]]).then((function(o){r+=o,i===n.length-1?a(r):e(t,n,i+1,s,r,a)}))}(n,Object.keys(n),0,e.exec,"",t)}));var i="";for(var s in n)r(n,s)&&(i+=e.exec(s,n[s]));return i},include:function(e,n,i){w("include",n,!1);var s=i.storage.templates.get(e.params[0]);if(!s)throw t('Could not fetch template "'+e.params[0]+'"');return s(e.params[1],i)},extends:function(e,n,i){var s=e.params[1]||{};s.content=e.exec();for(var r=0;r<n.length;r++){var a=n[r];s[a.name]=a.exec()}var o=i.storage.templates.get(e.params[0]);if(!o)throw t('Could not fetch template "'+e.params[0]+'"');return o(s,i)},useScope:function(e,t){return w("useScope",t,!1),e.exec(e.params[0])}}),C=new b({if:function(e,t){w("if",!1,e.f,!0);var n="if("+e.p+"){"+x(e.d,t)+"}";if(e.b)for(var i=0;i<e.b.length;i++){var s=e.b[i];"else"===s.n?n+="else{"+x(s.d,t)+"}":"elif"===s.n&&(n+="else if("+s.p+"){"+x(s.d,t)+"}")}return n},try:function(e,n){if(w("try",!1,e.f,!0),!e.b||1!==e.b.length||"catch"!==e.b[0].n)throw t("native helper 'try' only accepts 1 block, 'catch'");var i="try{"+x(e.d,n)+"}",s=e.b[0];return i+="catch"+(s.res?"("+s.res+")":"")+"{"+x(s.d,n)+"}"},block:function(e,t){return w("block",e.b,e.f,!0),"if(!"+t.varName+"["+e.p+"]){tR+=("+m(e.d,"",t)+")()}else{tR+="+t.varName+"["+e.p+"]}"}}),P=new b({e:function(e){var t=String(e);return/[&<>"']/.test(t)?t.replace(/[&<>"']/g,F):t}}),S={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(e,n){if("H"===e){var i=this.storage.helpers.get(n);if(i)return i;throw t("Can't find helper '"+n+"'")}if("F"===e){var s=this.storage.filters.get(n);if(s)return s;throw t("Can't find filter '"+n+"'")}},async:!1,storage:{helpers:R,nativeHelpers:C,filters:P,templates:_},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function k(e,t){var n={};return a(n,S),t&&a(n,t),e&&a(n,e),n.l.bind(n),n}function A(e,n){var i=k(n||{}),r=Function;if(i.async){if(!s)throw t("This environment doesn't support async/await");r=s}try{return new r(i.varName,"c","cb",p(e,i))}catch(n){throw n instanceof SyntaxError?t("Bad template syntax\n\n"+n.message+"\n"+Array(n.message.length+1).join("=")+"\n"+p(e,i)):n}}function E(e,t){var n;return t.cache&&t.name&&t.storage.templates.get(t.name)?t.storage.templates.get(t.name):(n="function"==typeof e?e:A(e,t),t.cache&&t.name&&t.storage.templates.define(t.name,n),n)}S.l.bind(S),e.compile=A,e.compileScope=x,e.compileScopeIntoFunction=m,e.compileToString=p,e.defaultConfig=S,e.filters=P,e.getConfig=k,e.helpers=R,e.nativeHelpers=C,e.parse=d,e.render=function(e,n,s,r){var a=k(s||{});if(!a.async)return E(e,a)(n,a);if(!r){if("function"==typeof i)return new i((function(t,i){try{t(E(e,a)(n,a))}catch(e){i(e)}}));throw t("Please provide a callback function, this env doesn't support Promises")}try{E(e,a)(n,a,r)}catch(e){return r(e)}},e.templates=_,Object.defineProperty(e,"__esModule",{value:!0})}))}));var I=f(w);var F=Object.freeze(Object.assign(Object.create(null),w,{default:I}));var _=F;_.filters.define("date_long",(function(e,t){if(t===void 0){t={year:"numeric",month:"long",day:"numeric"}}if(!e)return;var n=new Date(parseInt(e)*1e3);e=n.toLocaleDateString("en-GB",t);return e}));_.filters.define("date_short",(function(e,t){if(t===void 0){t="d/m/y"}if(!e)return;var n=new Date(parseInt(e)*1e3);e=t.replace(/(d)/,n.getDate().toString());e=e.replace(/(m)/,(n.getMonth()+1).toString());e=e.replace(/(y)/,n.getFullYear().toString());return e}));_.filters.define("public_name",(function(e){if(!e)return;e=e.split("_").map((function(e){return e.length<3?e.toUpperCase():e})).join(" ");return e.charAt(0).toUpperCase()+e.slice(1)}));_.filters.define("trim_to",(function(e,t){if(t===void 0){t=100}if(!e)return;if(e.length<=t)return e;return e.substr(0,t)+"..."}));_.filters.define("classname",(function(e){if(!e)return;return e.replace(/[\W]+/g,"")}));_.filters.define("abs_url",(function(e,t,n){if(t===void 0){t=null}if(!t)return e;if(!e)return;var i=undefined;if(t.domains&&n&&n.origin){var s=t.domains.find((function(e){return e.origin===n.origin}));i=s?s.domain:""}else if(t.domain)i=t.domain;if(!i)return e;return e.match(/^http/)?e:location.protocol+"//"+i+e}));_.filters.define("replace",(function(e,t,n){return e.replace(t,n)}));_.filters.define("remove_spaces",(function(e){return e.replace(/ /g,"_")}));_.filters.define("add_spaces",(function(e){return e=e.replace(/[_\-]/g," ")}));_.filters.define("capitalise",(function(e){return e=e.charAt(0).toUpperCase()+e.slice(1)}));_.filters.define("lowercase",(function(e){return e=e.toLowerCase()}));var R=_;var C=function(){function e(){this.queue=[];this.workingOnPromise=false;this.stop=false;this.limit=null}e.prototype.enqueue=function(e){var t=this;return new Promise((function(n,i){t.queue.push({promise:e,resolve:n,reject:i});t.dequeue()}))};e.prototype.dequeue=function(){var e=this;if(this.workingOnPromise){return false}if(this.stop){this.queue=[];this.stop=false;return}var t=this.queue.shift();if(!t){return false}try{this.workingOnPromise=true;t.promise().then((function(n){e.workingOnPromise=false;t.resolve(n);e.dequeue()})).catch((function(n){e.workingOnPromise=false;t.reject(n);e.dequeue()}))}catch(n){this.workingOnPromise=false;t.reject(n);this.dequeue()}return true};return e}();C.pendingPromise=false;var P=":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{position:relative;display:block}:host ::slotted([slot=search-template]),:host::slotted([slot=search-template]){display:none !important}.loader{opacity:0;position:fixed;height:100%;width:100%;min-height:100%;max-height:100vh !important;max-width:100vw !important;left:0;top:0;z-index:-10;font-size:60px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:opacity 0.2s ease, z-index 0.01s ease 0.2s;transition:opacity 0.2s ease, z-index 0.01s ease 0.2s}.loader.loading{opacity:1;z-index:10;-webkit-transition:z-index 0.01s ease, opacity 0.2s ease 0.01s;transition:z-index 0.01s ease, opacity 0.2s ease 0.01s}.default{height:100%}.default:focus{outline:none}.results{opacity:0;outline:none;overflow:auto;-webkit-transition:opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s, -webkit-transform 0.3s ease;transition:opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s, -webkit-transform 0.3s ease;transition:transform 0.3s ease, opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s;transition:transform 0.3s ease, opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s, -webkit-transform 0.3s ease;-webkit-transform:translate(0, 100px);transform:translate(0, 100px);visibility:hidden;z-index:-1;position:absolute;top:0;left:0;display:none}.results-container{position:relative}.results.show{-webkit-transition:z-index 0.01s ease, visibility 0.01s ease, opacity 0.3s ease 0.01s, -webkit-transform 0.3s ease 0.01s;transition:z-index 0.01s ease, visibility 0.01s ease, opacity 0.3s ease 0.01s, -webkit-transform 0.3s ease 0.01s;transition:z-index 0.01s ease, visibility 0.01s ease, transform 0.3s ease 0.01s, opacity 0.3s ease 0.01s;transition:z-index 0.01s ease, visibility 0.01s ease, transform 0.3s ease 0.01s, opacity 0.3s ease 0.01s, -webkit-transform 0.3s ease 0.01s;-webkit-transform:translate(0, 0);transform:translate(0, 0);visibility:visible;opacity:1;z-index:10;overflow:hidden}.results.shown{height:auto !important;width:auto !important;display:block;position:static;-webkit-transform:none;transform:none;z-index:auto;visibility:inherit;opacity:initial}";var S=!!document.head.attachShadow;var k=e("nano_algolia",function(){function e(e){var t=this;i(this,e);this.nanoDidLoad=s(this,"nanoDidLoad",7);this.nanoResultsShown=s(this,"nanoResultsShown",3);this.nanoBeforeQuery=s(this,"nanoBeforeQuery",7);this.nanoAfterQuery=s(this,"nanoAfterQuery",7);this.nanoNewResults=s(this,"nanoNewResults",7);this.staticFacetFilters={};this.dynFacetFilters={};this.hasLoadSlot=false;this.placedAlgoliaEles=[];this.promiseQueue=new C;this._dynFacetFilters={};this.indeces=[];this.filterChanged="";this.changeEvent=u.Init;this.isLoading=false;this.wormholeState=this;this.showResults=false;this.resultsPage=0;this.searchIndex={};this.searchIndexName="";this.listenTo=null;this.query="";this.operator="and";this.filters=[];this.tplEngine=R;this.tplRenderFn=R.render;this.replicaIndex="";this.browseIndex=false;this.minChars=2;this.storeMethod="session";this.searchChange=function(){return __awaiter(t,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){if(!this.algoliaIndex)return[2];if(!this.query||this.query.length<this.minChars){if(!this.browseIndex){if(!this.query||this.query.length===0){this.handleSearchReset();return[2]}else return[2]}else if(this.query!=="*"){this.query="*";return[2]}}this.isLoading=true;setTimeout((function(){return __awaiter(e,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){switch(t.label){case 0:this.resetPage();return[4,this.algoliaSearch(u.Init)];case 1:t.sent();return[4,this.updateContent()];case 2:t.sent();setTimeout((function(t){return e.isLoading=false}),800);this.showResults=true;this.nanoResultsShown.emit(this.indexResults);return[2]}}))}))}),200);return[2]}))}))};this.makeAppliedFilters=function(){var e=[];var n=function(t){Object.values(t).forEach((function(t){if(t.value&&t.value.length){var n=e.find((function(e){return e.name===t.facetName}));if(!n)e.push({name:t.facetName,values:__spreadArray([],t.value)});else n.values=__spreadArray(__spreadArray([],n.values),t.value)}}))};n(t.dynFacetFilters);n(t.staticFacetFilters);if(e.length)return e;return null};this.algoliaSearch=function(e){return __awaiter(t,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){return[2,this.promiseQueue.enqueue((function(){return t.queueSearch(e)}))]}))}))};this.queueSearch=function(e){return __awaiter(t,void 0,void 0,(function(){var t,n;var i=this;return __generator(this,(function(s){switch(s.label){case 0:if(!this.algoliaIndex||!this.query||!this.searchIndex||!this.searchIndex.index)return[2];this.nanoBeforeQuery.emit(this.indexResults);if(u.Init===e)this.clearAllFacetFilters();t={filters:this.algoliaFilterStr(),page:this.indexResults?this.indexResults.currentPage:0};if(this.searchIndex.filters)t.facets=this.searchIndex.filters;if(this.searchIndex.hitsPerPage)t.hitsPerPage=this.searchIndex.hitsPerPage;return[4,this.algoliaIndex.search(this.query,t)];case 1:n=s.sent();n=this.fixDomain(n);this.changeEvent=e;if(e===u.Init||!this.indexResults){this.indexResults={currentPage:0,totalHits:n.nbHits,hitsPerPage:null,origFilters:n.facets,query:this.query,domain:this.searchIndex.domain||null,legacy:!S,totalHitsWithFilters:0,results:[],totalPages:0,appliedFilters:this.makeAppliedFilters(),indexName:this.searchIndex.name||null,index:this.searchIndex.index}}this.indexResults.dynFilters=n.facets;this.indexResults.results=n.hits;this.indexResults.totalHitsWithFilters=n.nbHits;this.indexResults.currentPage=n.page;this.indexResults.totalPages=n.nbPages;this.indexResults.hitsPerPage=n.hitsPerPage;this.indexResults.query=n.query;if(this.changeEvent!==u.Page&&this.changeEvent!==u.Replica){this.facets=n.facets}this.nanoAfterQuery.emit(this.indexResults);return[2,new Promise((function(e){setTimeout((function(){return e("tpl updated")}),20)})).then((function(e){i.currentHits=i.indexResults.results;i.resultsPage=i.indexResults.currentPage}))]}}))}))};this.handleSearchReset=function(){t.showResults=false;t.indexResults=null};this.onResultDisplay=function(){r((function(){t.resultsDiv.removeEventListener("transitionend",t.onResultDisplay);if(!t.showResults)t.resultsDiv.style.display="none";else{t.defaultDiv.style.display="none";t.resultsDiv.classList.add("shown");t.resultsDiv.style.minHeight="";t.resultsDiv.style.width=""}}))}}e.prototype.removeFilters=function(e,t){return __awaiter(this,void 0,void 0,(function(){var n=this;return __generator(this,(function(i){if(!e&&!t)this.clearAllFacetFilters();else{Object.keys(this._dynFacetFilters).forEach((function(i){if(e&&n._dynFacetFilters[i].facetName===e){if(!t)n._dynFacetFilters[i].element.value="";else{n._dynFacetFilters[i].element.value=n._dynFacetFilters[i].value.filter((function(e){return e!==t}))}}}))}return[2]}))}))};e.prototype.onAllTplUpdate=function(e){var t=this;e.stopPropagation();if(e.target.tagName==="NANO-ALGOLIA-RESULTS"){c((function(){t.nanoNewResults.emit(t.indexResults)}))}};e.prototype.onPageChange=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:if(!this.indexResults)return[2];t=this.resultsPage;if(e){e.stopPropagation();t=e.detail.page}t=Math.min(this.indexResults.totalPages-1,t);t=Math.max(t,0);if(this.indexResults.currentPage===t)return[2];this.indexResults.currentPage=t;return[4,this.algoliaSearch(u.Page)];case 1:n.sent();return[2]}}))}))};e.prototype.onFilterChange=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n;return __generator(this,(function(i){e.stopPropagation();t={};n=e.detail;n.element=e.target;if(this.indexResults){if(this.staticFacetFilters[n.filterId])this.staticFacetFilters[n.filterId]=n;else{t[n.filterId]=n;this._dynFacetFilters=Object.assign(Object.assign({},this._dynFacetFilters),t)}this.indexResults.appliedFilters=this.makeAppliedFilters()}else this.staticFacetFilters[n.filterId]=n;this.filterChanged=n.value&&n.value.length?n.filterId:"all";this.resetPage();this.algoliaSearch(u.Filter);return[2]}))}))};e.prototype.dynFacetFiltersChange=function(){var e=this;Object.values(this._dynFacetFilters).forEach((function(t){if(e.host.ownerDocument===t.element.ownerDocument)e.dynFacetFilters[t.filterId]=t;else delete e.dynFacetFilters[t.filterId]}))};e.prototype.browseIndexChange=function(){if(this.browseIndex&&(!this.query||this.query.length<this.minChars)){this.query="*"}};e.prototype.inputFieldSet=function(){if(!this.inputField)return;if(this.query!=="*"&&this.inputField&&this.inputField.value!==this.query)this.inputField.value=this.query};e.prototype.queryChange=function(){this.searchChange()};e.prototype.internalIndexSwitch=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(!this.replicaIndex||!this.indexResults||this.indexResults.index===this.replicaIndex)return[2];this.indexResults.index=this.replicaIndex;this.algoliaIndex=this.algoliaClient.initIndex(this.indexResults.index);this.resetPage();this.algoliaSearch(u.Replica);return[2]}))}))};e.prototype.pageChange=function(){this.onPageChange()};e.prototype.searchIndexNameChange=function(){if(!this.searchIndexName||!this.searchIndexName.length||this.searchIndex&&this.searchIndex.index===this.searchIndexName)return;this.searchIndex={index:this.searchIndexName}};e.prototype.initAlgoliaClient=function(){if(!this.appId||!this.apiKey)return;this.algoliaClient=h(this.appId,this.apiKey)};e.prototype.initAlgoliaIndex=function(){if(!this.algoliaClient||!this.searchIndex)return;if(this.searchIndex.index){if(this.replicaIndex)this.searchIndex.index=this.replicaIndex;this.searchIndexName=this.searchIndex.index;this.algoliaIndex=this.algoliaClient.initIndex(this.searchIndex.index);this.searchChange()}};e.prototype.showResultsChange=function(){var e=this;if(!this.resultsDiv||!this.defaultDiv)return;if(this.showResults){this.resultsDiv.style.width=this.host.scrollWidth+"px";this.resultsDiv.style.minHeight=this.host.scrollHeight+"px";r((function(){e.resultsDiv.addEventListener("transitionend",e.onResultDisplay);e.resultsDiv.style.display="block";setTimeout((function(){return e.resultsDiv.classList.add("show")}),50)}))}else{r((function(){e.resultsDiv.classList.remove("shown");e.defaultDiv.style.display="block";setTimeout((function(){e.resultsDiv.addEventListener("transitionend",e.onResultDisplay);e.resultsDiv.classList.remove("show");if(!!e.slottedInput)e.slottedInput.focus({preventScroll:true});else e.defaultDiv.focus({preventScroll:true})}),50)}))}};e.prototype.fixDomain=function(e){var t=this;if(!this.searchIndex||!this.searchIndex.domain)return e;e.hits.map((function(e){if(e.url&&!e.url.match(/^http/))e.url=location.protocol+"//"+t.searchIndex.domain+e.url}));return e};e.prototype.resetPage=function(){if(!this.indexResults)return;this.indexResults.currentPage=0};e.prototype.clearAllFacetFilters=function(){Object.values(this._dynFacetFilters).forEach((function(e){e.element.value=""}));this._dynFacetFilters={}};e.prototype.algoliaFilterStr=function(){var e={};var t=function(t){var n;var i;Object.keys(t).forEach((function(s){n=t[s];e[s]=e[s]||{name:n.facetName,or:[],and:[],not:[]};i=e[s][n.operator];if(n.value&&n.value.length){e[s][n.operator]=__spreadArray(__spreadArray([],i),n.value)}}))};t(this.dynFacetFilters);t(this.staticFacetFilters);var n=function(e,t){if(t.indexOf(" ")>-1)return e+':"'+t+'"';else return e+":"+t};var i=[];var s;var r;Object.values(e).forEach((function(e){Object.keys(e).filter((function(e){return e.match(/(or|and|not)/)})).forEach((function(t){s=e;r=e.name;if(t==="or"||t==="and"){if(s[t].length){i.push("( "+s[t].map((function(e){if(e.length)return n(r,e)})).join(" "+t.toLocaleUpperCase()+" ")+" )")}}else{if(s.not.length){i.push("( "+s[t].map((function(e){if(e.length)return"NOT "+n(r,e)})).join(" AND ")+" )")}}}))}));i=__spreadArray(__spreadArray([],this.filters),i);return i.join(" "+this.operator.toLocaleUpperCase()+" ")};e.prototype.handleInputChange=function(e){if(e.target!==this.inputField)return;this.query=this.inputField.value};e.prototype.updateContent=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){return[2,this.promiseQueue.enqueue((function(){return e.updateContentQueue()}))]}))}))};e.prototype.updateContentQueue=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;var i=this;return __generator(this,(function(s){e=this.outputSlot||this.resultsDiv;if(!e||!this.tpl)return[2,"no tpl"];t=document.createElement("div");t.innerHTML=this.tpl;n=[];this.placedAlgoliaEles=[];Array.from(t.querySelectorAll("nano-algolia, nano-algolia-filter, nano-algolia-results")).forEach((function(e,t){var i=document.createElement("div");i.dataset.placeholderId=t.toString();i.classList.add("nano-ele-placeholder");n.push(e);e.parentNode.replaceChild(i,e)}));e.innerHTML=this.tplRenderFn(t.innerHTML.replace(/>/gm,">").replace(/</gm,"<").replace(/&/gm,"&"),this.indexResults);Array.from(e.querySelectorAll("div.nano-ele-placeholder")).forEach((function(e){e.parentNode.replaceChild(n[parseInt(e.dataset.placeholderId)],e);i.placedAlgoliaEles.push(n[parseInt(e.dataset.placeholderId)])}));if(!this.placedAlgoliaEles.length)return[2,Promise.resolve("algolia setup")];return[2,new Promise((function(t){var n=function(s){i.placedAlgoliaEles=i.placedAlgoliaEles.filter((function(e){return e!==s.detail}));if(!i.placedAlgoliaEles.length){setTimeout((function(){return t("tpl updated")}),500);e.removeEventListener("nanoTplUpdated",n)}};e.addEventListener("nanoTplUpdated",n)}))]}))}))};e.prototype.componentWillLoad=function(){var e=this;a((function(t){e.tplSlot=v(e.host,'[slot="template"]')[0];e.outputSlot=v(e.host,'[slot="output"]')[0];e.slottedInput=v(e.host,'[slot="search-input"]')[0];e.hasLoadSlot=!!v(e.host,'[slot="loader"]')[0];if(!!e.tplSlot)e.tpl=e.tplSlot.innerHTML;if(e.slottedInput&&(e.slottedInput.tagName.toLocaleLowerCase()==="nano-input"||e.slottedInput instanceof HTMLInputElement)){e.inputField=e.slottedInput}else if(e.slottedInput){e.inputField=e.slottedInput.querySelector('nano-input, input:not([type="radio"]):not([type="checkbox"])')}r((function(t){if(e.showResults&&e.tpl)e.searchChange()}))}));this.searchIndexNameChange();this.initAlgoliaClient();this.initAlgoliaIndex();b.create(this,this.wormholeState);if(this.storeId){g.init(this,["query","replicaIndex"],this.storeMethod,this.storeId);g.init(this,["apiKey","appId","searchIndex"],"session",this.storeId+"_api")}this.internalIndexSwitch()};e.prototype.connectedCallback=function(){this.searchChange=y(this.searchChange,300);this.browseIndexChange();this.host.dispatchEvent(new CustomEvent("nanoDidLoad",{detail:this.host}))};e.prototype.render=function(){var e=this;var t={indexResults:this.indexResults,results:this.currentHits,filterChanged:this.filterChanged,tplRenderFn:this.tplRenderFn,resultsPage:this.resultsPage,changeEvent:this.changeEvent,facets:this.facets,algoliaIndex:this.algoliaIndex,searchIndex:this.searchIndex,globalStoreMethod:this.storeMethod,isLoading:this.isLoading};return o(l,{class:{"show-results":this.showResults,"is-loading":this.isLoading},"aria-busy":this.isLoading},this.hasLoadSlot&&o("div",{hidden:!this.isLoading},o("slot",{name:"loader"})),!this.hasLoadSlot&&o("div",{class:{loader:true,loading:this.isLoading}},o("nano-spinner",{overlay:true,type:"circle"})),o(b.Provider,{state:t},o("slot",{name:"search-input"}),o("div",{class:"results-container","aria-live":"polite"},o("div",{ref:function(t){return e.resultsDiv=t},class:"results"},o("slot",{name:"output"})))),o("div",{ref:function(t){return e.defaultDiv=t},class:"default",tabindex:"-1"},o("slot",null)))};Object.defineProperty(e.prototype,"host",{get:function(){return t(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{_dynFacetFilters:["dynFacetFiltersChange"],browseIndex:["browseIndexChange"],inputField:["inputFieldSet"],query:["queryChange"],replicaIndex:["internalIndexSwitch"],resultsPage:["pageChange"],searchIndexName:["searchIndexNameChange"],apiKey:["initAlgoliaClient"],appId:["initAlgoliaClient"],searchIndex:["initAlgoliaIndex"],showResults:["showResultsChange"]}},enumerable:false,configurable:true});return e}());k.style=P}}}));
|
5
|
-
//# sourceMappingURL=p-
|
4
|
+
*/System.register(["./p-59b3d24b.system.js","./p-41a2e2e4.system.js","./p-1c216ca4.system.js","./p-d24811c8.system.js","./p-9edbf25d.system.js","./p-e1f46998.system.js","./p-1d13dbdf.system.js","./p-ef053a2f.system.js"],(function(e){"use strict";var t,n,i,s,r,a,o,l,u,c,h,f,d,p,g,v,y;return{setters:[function(e){t=e.g;n=e.l;i=e.r;s=e.c;r=e.f;a=e.i;o=e.h;l=e.e},function(e){u=e.S},function(e){c=e.r},function(e){h=e.a},function(e){f=e.b;d=e.c;p=e.a},function(e){g=e.C},function(e){v=e.g},function(e){y=e.d}],execute:function(){var m=new Map;var x=function(e,t){var n=e.fields,i=e.updater;n.forEach((function(e){i(e,t[e])}))};var b={create:function(e,n){var i=t(e);var s=new Map;var r={wormholes:s,state:n};m.set(e,r);var a=e.connectedCallback;e.connectedCallback=function(){m.set(e,r);if(a){a.call(e)}};var o=e.disconnectedCallback;e.disconnectedCallback=function(){m.delete(e);if(o){o.call(e)}};i.addEventListener("openWormhole",(function(e){e.stopPropagation();var t=e.detail,n=t.consumer,i=t.onOpen;if(s.has(n))return;if(typeof n!=="symbol"){var a=n.connectedCallback,o=n.disconnectedCallback;n.connectedCallback=function(){s.set(n,e.detail);if(a){a.call(n)}};n.disconnectedCallback=function(){s.delete(n);if(o){o.call(n)}}}s.set(n,e.detail);x(e.detail,r.state);i===null||i===void 0?void 0:i.resolve((function(){s.delete(n)}))}));i.addEventListener("closeWormhole",(function(e){var t=e.detail;s.delete(t)}))},Provider:function(e,t){var i=e.state;var s=n();if(m.has(s)){var r=m.get(s);r.state=i;r.wormholes.forEach((function(e){x(e,i)}))}return t}};var w=d((function(e,t){!function(e,n){n(t)}(p,(function(e){function t(e){var n,i,s=new Error(e);return n=s,i=t.prototype,Object.setPrototypeOf?Object.setPrototypeOf(n,i):n.__proto__=i,s}function n(e,n,i){var s=n.slice(0,i).split(/\n/),r=s.length,a=s[r-1].length+1;throw t(e+=" at line "+r+" col "+a+":\n\n "+n.split(/\n/)[r-1]+"\n "+Array(a).join(" ")+"^")}t.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var i=new Function("return this")().Promise,s=!1;try{s=new Function("return (async function(){}).constructor")()}catch(e){if(!(e instanceof SyntaxError))throw e}function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function a(e,t,n){for(var i in t)r(t,i)&&(null==t[i]||"object"!=typeof t[i]||"storage"!==i&&"prefixes"!==i||n?e[i]=t[i]:e[i]=a({},t[i]));return e}var o=/^async +/,l=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,u=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,c=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,h=/[.*+\-?^${}()|[\]\\]/g;function f(e){return h.test(e)?e.replace(h,"\\$&"):e}function d(e,i){i.rmWhitespace&&(e=e.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),l.lastIndex=0,u.lastIndex=0,c.lastIndex=0;var s=i.prefixes,r=[s.h,s.b,s.i,s.r,s.c,s.e].reduce((function(e,t){return e&&t?e+"|"+f(t):t?f(t):e}),""),a=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+f(i.tags[1])+")","g"),h=new RegExp("([^]*?)"+f(i.tags[0])+"(-|_)?\\s*("+r+")?\\s*","g"),d=0,p=!1;function g(t,s){var r,f={f:[]},g=0,v="c";function y(t){var s=e.slice(d,t),r=s.trim();if("f"===v)"safe"===r?f.raw=!0:i.async&&o.test(r)?(r=r.replace(o,""),f.f.push([r,"",!0])):f.f.push([r,""]);else if("fp"===v)f.f[f.f.length-1][1]+=r;else if("err"===v){if(r){var a=s.search(/\S/);n("invalid syntax",e,d+a)}}else f[v]=r;d=t+1}for("h"===s||"b"===s||"c"===s?v="n":"r"===s&&(f.raw=!0,s="i"),a.lastIndex=d;null!==(r=a.exec(e));){var m=r[1],x=r[2],b=r[3],w=r[4],I=r[5],F=r.index;if(m)"("===m?(0===g&&("n"===v?(y(F),v="p"):"f"===v&&(y(F),v="fp")),g++):")"===m?0===--g&&"c"!==v&&(y(F),v="err"):0===g&&"|"===m?(y(F),v="f"):"=>"===m&&(y(F),d+=1,v="res");else if(x){if("/*"===x){var _=e.indexOf("*/",a.lastIndex);-1===_&&n("unclosed comment",e,r.index),a.lastIndex=_+2}else if("'"===x){u.lastIndex=r.index,u.exec(e)?a.lastIndex=u.lastIndex:n("unclosed string",e,r.index)}else if('"'===x){c.lastIndex=r.index,c.exec(e)?a.lastIndex=c.lastIndex:n("unclosed string",e,r.index)}else if("`"===x){l.lastIndex=r.index,l.exec(e)?a.lastIndex=l.lastIndex:n("unclosed string",e,r.index)}}else if(b)return y(F),d=F+r[0].length,h.lastIndex=d,p=I,w&&"h"===s&&(s="s"),f.t=s,f}return n("unclosed tag",e,t),f}var v=function r(a,l){a.b=[],a.d=[];var u,c=!1,f=[];function v(e,t){e&&(e=function(e,t,n,i){var s,r;return"string"==typeof t.autoTrim?s=r=t.autoTrim:Array.isArray(t.autoTrim)&&(s=t.autoTrim[1],r=t.autoTrim[0]),(n||!1===n)&&(s=n),(i||!1===i)&&(r=i),"slurp"===s&&"slurp"===r?e.trim():("_"===s||"slurp"===s?e=String.prototype.trimLeft?e.trimLeft():e.replace(/^[\s\uFEFF\xA0]+/,""):"-"!==s&&"nl"!==s||(e=e.replace(/^(?:\n|\r|\r\n)/,"")),"_"===r||"slurp"===r?e=String.prototype.trimRight?e.trimRight():e.replace(/[\s\uFEFF\xA0]+$/,""):"-"!==r&&"nl"!==r||(e=e.replace(/(?:\n|\r|\r\n)$/,"")),e)}(e,i,p,t))&&(e=e.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),f.push(e))}for(;null!==(u=h.exec(e));){var y,m=u[1],x=u[2],b=u[3]||"";for(var w in s)if(s[w]===b){y=w;break}v(m,x),d=u.index+u[0].length,y||n("unrecognized tag type: "+b,e,d);var I=g(u.index,y),F=I.t;if("h"===F){var _=I.n||"";i.async&&o.test(_)&&(I.a=!0,I.n=_.replace(o,"")),I=r(I),f.push(I)}else if("c"===F){if(a.n===I.n)return c?(c.d=f,a.b.push(c)):a.d=f,a;n("Helper start and end don't match",e,u.index+u[0].length)}else if("b"===F){c?(c.d=f,a.b.push(c)):a.d=f;var R=I.n||"";i.async&&o.test(R)&&(I.a=!0,I.n=R.replace(o,"")),c=I,f=[]}else if("s"===F){var C=I.n||"";i.async&&o.test(C)&&(I.a=!0,I.n=C.replace(o,"")),f.push(I)}else f.push(I)}if(!l)throw t('unclosed helper "'+a.n+'"');return v(e.slice(d,e.length),!1),a.d=f,a}({f:[]},!0);if(i.plugins)for(var y=0;y<i.plugins.length;y++){var m=i.plugins[y];m.processAST&&(v.d=m.processAST(v.d,i))}return v.d}function p(e,t){var n=d(e,t),i="var tR='';"+(t.useWith?"with("+t.varName+"||{}){":"")+x(n,t)+"if(cb){cb(null,tR)} return tR"+(t.useWith?"}":"");if(t.plugins)for(var s=0;s<t.plugins.length;s++){var r=t.plugins[s];r.processFnString&&(i=r.processFnString(i,t))}return i}function g(e,t){for(var n=0;n<t.length;n++){var i=t[n][0],s=t[n][1];e=(t[n][2]?"await ":"")+"c.l('F','"+i+"')("+e,s&&(e+=","+s),e+=")"}return e}function v(e,t,n,i,s,r){var a="{exec:"+(s?"async ":"")+m(n,t,e)+",params:["+i+"]";return r&&(a+=",name:'"+r+"'"),s&&(a+=",async:true"),a+="}"}function y(e,t){for(var n="[",i=0;i<e.length;i++){var s=e[i];n+=v(t,s.res||"",s.d,s.p||"",s.a,s.n),i<e.length&&(n+=",")}return n+="]"}function m(e,t,n){return"function("+t+"){var tR='';"+x(e,n)+"return tR}"}function x(e,t){for(var n=0,i=e.length,s="";n<i;n++){var r=e[n];if("string"==typeof r){s+="tR+='"+r+"';"}else{var a=r.t,o=r.c||"",l=r.f,u=r.n||"",c=r.p||"",h=r.res||"",f=r.b,d=!!r.a;if("i"===a){t.defaultFilter&&(o="c.l('F','"+t.defaultFilter+"')("+o+")");var p=g(o,l);!r.raw&&t.autoEscape&&(p="c.l('F','e')("+p+")"),s+="tR+="+p+";"}else if("h"===a)if(t.storage.nativeHelpers.get(u))s+=t.storage.nativeHelpers.get(u)(r,t);else{var m=(d?"await ":"")+"c.l('H','"+u+"')("+v(t,h,r.d,c,d);m+=f?","+y(f,t):",[]",s+="tR+="+g(m+=",c)",l)+";"}else"s"===a?s+="tR+="+g((d?"await ":"")+"c.l('H','"+u+"')({params:["+c+"]},[],c)",l)+";":"e"===a&&(s+=o+"\n")}}return s}var b=function(){function e(e){this.cache=e}return e.prototype.define=function(e,t){this.cache[e]=t},e.prototype.get=function(e){return this.cache[e]},e.prototype.remove=function(e){delete this.cache[e]},e.prototype.reset=function(){this.cache={}},e.prototype.load=function(e){a(this.cache,e,!0)},e}();function w(e,n,i,s){if(n&&n.length>0)throw t((s?"Native":"")+"Helper '"+e+"' doesn't accept blocks");if(i&&i.length>0)throw t((s?"Native":"")+"Helper '"+e+"' doesn't accept filters")}var I={"&":"&","<":"<",">":">",'"':""","'":"'"};function F(e){return I[e]}var _=new b({}),R=new b({each:function(e,t){var n="",i=e.params[0];if(w("each",t,!1),e.async)return new Promise((function(t){!function e(t,n,i,s,r){i(t[n],n).then((function(a){s+=a,n===t.length-1?r(s):e(t,n+1,i,s,r)}))}(i,0,e.exec,n,t)}));for(var s=0;s<i.length;s++)n+=e.exec(i[s],s);return n},foreach:function(e,t){var n=e.params[0];if(w("foreach",t,!1),e.async)return new Promise((function(t){!function e(t,n,i,s,r,a){s(n[i],t[n[i]]).then((function(o){r+=o,i===n.length-1?a(r):e(t,n,i+1,s,r,a)}))}(n,Object.keys(n),0,e.exec,"",t)}));var i="";for(var s in n)r(n,s)&&(i+=e.exec(s,n[s]));return i},include:function(e,n,i){w("include",n,!1);var s=i.storage.templates.get(e.params[0]);if(!s)throw t('Could not fetch template "'+e.params[0]+'"');return s(e.params[1],i)},extends:function(e,n,i){var s=e.params[1]||{};s.content=e.exec();for(var r=0;r<n.length;r++){var a=n[r];s[a.name]=a.exec()}var o=i.storage.templates.get(e.params[0]);if(!o)throw t('Could not fetch template "'+e.params[0]+'"');return o(s,i)},useScope:function(e,t){return w("useScope",t,!1),e.exec(e.params[0])}}),C=new b({if:function(e,t){w("if",!1,e.f,!0);var n="if("+e.p+"){"+x(e.d,t)+"}";if(e.b)for(var i=0;i<e.b.length;i++){var s=e.b[i];"else"===s.n?n+="else{"+x(s.d,t)+"}":"elif"===s.n&&(n+="else if("+s.p+"){"+x(s.d,t)+"}")}return n},try:function(e,n){if(w("try",!1,e.f,!0),!e.b||1!==e.b.length||"catch"!==e.b[0].n)throw t("native helper 'try' only accepts 1 block, 'catch'");var i="try{"+x(e.d,n)+"}",s=e.b[0];return i+="catch"+(s.res?"("+s.res+")":"")+"{"+x(s.d,n)+"}"},block:function(e,t){return w("block",e.b,e.f,!0),"if(!"+t.varName+"["+e.p+"]){tR+=("+m(e.d,"",t)+")()}else{tR+="+t.varName+"["+e.p+"]}"}}),P=new b({e:function(e){var t=String(e);return/[&<>"']/.test(t)?t.replace(/[&<>"']/g,F):t}}),S={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(e,n){if("H"===e){var i=this.storage.helpers.get(n);if(i)return i;throw t("Can't find helper '"+n+"'")}if("F"===e){var s=this.storage.filters.get(n);if(s)return s;throw t("Can't find filter '"+n+"'")}},async:!1,storage:{helpers:R,nativeHelpers:C,filters:P,templates:_},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function k(e,t){var n={};return a(n,S),t&&a(n,t),e&&a(n,e),n.l.bind(n),n}function A(e,n){var i=k(n||{}),r=Function;if(i.async){if(!s)throw t("This environment doesn't support async/await");r=s}try{return new r(i.varName,"c","cb",p(e,i))}catch(n){throw n instanceof SyntaxError?t("Bad template syntax\n\n"+n.message+"\n"+Array(n.message.length+1).join("=")+"\n"+p(e,i)):n}}function E(e,t){var n;return t.cache&&t.name&&t.storage.templates.get(t.name)?t.storage.templates.get(t.name):(n="function"==typeof e?e:A(e,t),t.cache&&t.name&&t.storage.templates.define(t.name,n),n)}S.l.bind(S),e.compile=A,e.compileScope=x,e.compileScopeIntoFunction=m,e.compileToString=p,e.defaultConfig=S,e.filters=P,e.getConfig=k,e.helpers=R,e.nativeHelpers=C,e.parse=d,e.render=function(e,n,s,r){var a=k(s||{});if(!a.async)return E(e,a)(n,a);if(!r){if("function"==typeof i)return new i((function(t,i){try{t(E(e,a)(n,a))}catch(e){i(e)}}));throw t("Please provide a callback function, this env doesn't support Promises")}try{E(e,a)(n,a,r)}catch(e){return r(e)}},e.templates=_,Object.defineProperty(e,"__esModule",{value:!0})}))}));var I=f(w);var F=Object.freeze(Object.assign(Object.create(null),w,{default:I}));var _=F;_.filters.define("date_long",(function(e,t){if(t===void 0){t={year:"numeric",month:"long",day:"numeric"}}if(!e)return;var n=new Date(parseInt(e)*1e3);e=n.toLocaleDateString("en-GB",t);return e}));_.filters.define("date_short",(function(e,t){if(t===void 0){t="d/m/y"}if(!e)return;var n=new Date(parseInt(e)*1e3);e=t.replace(/(d)/,n.getDate().toString());e=e.replace(/(m)/,(n.getMonth()+1).toString());e=e.replace(/(y)/,n.getFullYear().toString());return e}));_.filters.define("public_name",(function(e){if(!e)return;e=e.split("_").map((function(e){return e.length<3?e.toUpperCase():e})).join(" ");return e.charAt(0).toUpperCase()+e.slice(1)}));_.filters.define("trim_to",(function(e,t){if(t===void 0){t=100}if(!e)return;if(e.length<=t)return e;return e.substr(0,t)+"..."}));_.filters.define("classname",(function(e){if(!e)return;return e.replace(/[\W]+/g,"")}));_.filters.define("abs_url",(function(e,t,n){if(t===void 0){t=null}if(!t)return e;if(!e)return;var i=undefined;if(t.domains&&n&&n.origin){var s=t.domains.find((function(e){return e.origin===n.origin}));i=s?s.domain:""}else if(t.domain)i=t.domain;if(!i)return e;return e.match(/^http/)?e:location.protocol+"//"+i+e}));_.filters.define("replace",(function(e,t,n){return e.replace(t,n)}));_.filters.define("remove_spaces",(function(e){return e.replace(/ /g,"_")}));_.filters.define("add_spaces",(function(e){return e=e.replace(/[_\-]/g," ")}));_.filters.define("capitalise",(function(e){return e=e.charAt(0).toUpperCase()+e.slice(1)}));_.filters.define("lowercase",(function(e){return e=e.toLowerCase()}));var R=_;var C=function(){function e(){this.queue=[];this.workingOnPromise=false;this.stop=false;this.limit=null}e.prototype.enqueue=function(e){var t=this;return new Promise((function(n,i){t.queue.push({promise:e,resolve:n,reject:i});t.dequeue()}))};e.prototype.dequeue=function(){var e=this;if(this.workingOnPromise){return false}if(this.stop){this.queue=[];this.stop=false;return}var t=this.queue.shift();if(!t){return false}try{this.workingOnPromise=true;t.promise().then((function(n){e.workingOnPromise=false;t.resolve(n);e.dequeue()})).catch((function(n){e.workingOnPromise=false;t.reject(n);e.dequeue()}))}catch(n){this.workingOnPromise=false;t.reject(n);this.dequeue()}return true};return e}();C.pendingPromise=false;var P=":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{position:relative;display:block}:host ::slotted([slot=search-template]),:host::slotted([slot=search-template]){display:none !important}.loader{opacity:0;position:fixed;height:100%;width:100%;min-height:100%;max-height:100vh !important;max-width:100vw !important;left:0;top:0;z-index:-10;font-size:60px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:opacity 0.2s ease, z-index 0.01s ease 0.2s;transition:opacity 0.2s ease, z-index 0.01s ease 0.2s}.loader.loading{opacity:1;z-index:10;-webkit-transition:z-index 0.01s ease, opacity 0.2s ease 0.01s;transition:z-index 0.01s ease, opacity 0.2s ease 0.01s}.default{height:100%}.default:focus{outline:none}.results{opacity:0;outline:none;overflow:auto;-webkit-transition:opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s, -webkit-transform 0.3s ease;transition:opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s, -webkit-transform 0.3s ease;transition:transform 0.3s ease, opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s;transition:transform 0.3s ease, opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s, -webkit-transform 0.3s ease;-webkit-transform:translate(0, 100px);transform:translate(0, 100px);visibility:hidden;z-index:-1;position:absolute;top:0;left:0;display:none}.results-container{position:relative}.results.show{-webkit-transition:z-index 0.01s ease, visibility 0.01s ease, opacity 0.3s ease 0.01s, -webkit-transform 0.3s ease 0.01s;transition:z-index 0.01s ease, visibility 0.01s ease, opacity 0.3s ease 0.01s, -webkit-transform 0.3s ease 0.01s;transition:z-index 0.01s ease, visibility 0.01s ease, transform 0.3s ease 0.01s, opacity 0.3s ease 0.01s;transition:z-index 0.01s ease, visibility 0.01s ease, transform 0.3s ease 0.01s, opacity 0.3s ease 0.01s, -webkit-transform 0.3s ease 0.01s;-webkit-transform:translate(0, 0);transform:translate(0, 0);visibility:visible;opacity:1;z-index:10;overflow:hidden}.results.shown{height:auto !important;width:auto !important;display:block;position:static;-webkit-transform:none;transform:none;z-index:auto;visibility:inherit;opacity:initial}";var S=!!document.head.attachShadow;var k=e("nano_algolia",function(){function e(e){var t=this;i(this,e);this.nanoDidLoad=s(this,"nanoDidLoad",7);this.nanoResultsShown=s(this,"nanoResultsShown",3);this.nanoBeforeQuery=s(this,"nanoBeforeQuery",7);this.nanoAfterQuery=s(this,"nanoAfterQuery",7);this.nanoNewResults=s(this,"nanoNewResults",7);this.staticFacetFilters={};this.dynFacetFilters={};this.hasLoadSlot=false;this.placedAlgoliaEles=[];this.promiseQueue=new C;this._dynFacetFilters={};this.indeces=[];this.filterChanged="";this.changeEvent=u.Init;this.isLoading=false;this.wormholeState=this;this.showResults=false;this.resultsPage=0;this.searchIndex={};this.searchIndexName="";this.listenTo=null;this.query="";this.operator="and";this.filters=[];this.tplEngine=R;this.tplRenderFn=R.render;this.replicaIndex="";this.browseIndex=false;this.minChars=2;this.storeMethod="session";this.searchChange=function(){return __awaiter(t,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){if(!this.algoliaIndex)return[2];if(!this.query||this.query.length<this.minChars){if(!this.browseIndex){if(!this.query||this.query.length===0){this.handleSearchReset();return[2]}else return[2]}else if(this.query!=="*"){this.query="*";return[2]}}this.isLoading=true;setTimeout((function(){return __awaiter(e,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){switch(t.label){case 0:this.resetPage();return[4,this.algoliaSearch(u.Init)];case 1:t.sent();return[4,this.updateContent()];case 2:t.sent();setTimeout((function(t){return e.isLoading=false}),800);this.showResults=true;this.nanoResultsShown.emit(this.indexResults);return[2]}}))}))}),200);return[2]}))}))};this.makeAppliedFilters=function(){var e=[];var n=function(t){Object.values(t).forEach((function(t){if(t.value&&t.value.length){var n=e.find((function(e){return e.name===t.facetName}));if(!n)e.push({name:t.facetName,values:__spreadArray([],t.value)});else n.values=__spreadArray(__spreadArray([],n.values),t.value)}}))};n(t.dynFacetFilters);n(t.staticFacetFilters);if(e.length)return e;return null};this.algoliaSearch=function(e){return __awaiter(t,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){return[2,this.promiseQueue.enqueue((function(){return t.queueSearch(e)}))]}))}))};this.queueSearch=function(e){return __awaiter(t,void 0,void 0,(function(){var t,n;var i=this;return __generator(this,(function(s){switch(s.label){case 0:if(!this.algoliaIndex||!this.query||!this.searchIndex||!this.searchIndex.index)return[2];this.nanoBeforeQuery.emit(this.indexResults);if(u.Init===e)this.clearAllFacetFilters();t={filters:this.algoliaFilterStr(),page:this.indexResults?this.indexResults.currentPage:0};if(this.searchIndex.filters)t.facets=this.searchIndex.filters;if(this.searchIndex.hitsPerPage)t.hitsPerPage=this.searchIndex.hitsPerPage;return[4,this.algoliaIndex.search(this.query,t)];case 1:n=s.sent();n=this.fixDomain(n);this.changeEvent=e;if(e===u.Init||!this.indexResults){this.indexResults={currentPage:0,totalHits:n.nbHits,hitsPerPage:null,origFilters:n.facets,query:this.query,domain:this.searchIndex.domain||null,legacy:!S,totalHitsWithFilters:0,results:[],totalPages:0,appliedFilters:this.makeAppliedFilters(),indexName:this.searchIndex.name||null,index:this.searchIndex.index}}this.indexResults.dynFilters=n.facets;this.indexResults.results=n.hits;this.indexResults.totalHitsWithFilters=n.nbHits;this.indexResults.currentPage=n.page;this.indexResults.totalPages=n.nbPages;this.indexResults.hitsPerPage=n.hitsPerPage;this.indexResults.query=n.query;if(this.changeEvent!==u.Page&&this.changeEvent!==u.Replica){this.facets=n.facets}this.nanoAfterQuery.emit(this.indexResults);return[2,new Promise((function(e){setTimeout((function(){return e("tpl updated")}),20)})).then((function(e){i.currentHits=i.indexResults.results;i.resultsPage=i.indexResults.currentPage}))]}}))}))};this.handleSearchReset=function(){t.showResults=false;t.indexResults=null};this.onResultDisplay=function(){r((function(){t.resultsDiv.removeEventListener("transitionend",t.onResultDisplay);if(!t.showResults)t.resultsDiv.style.display="none";else{t.defaultDiv.style.display="none";t.resultsDiv.classList.add("shown");t.resultsDiv.style.minHeight="";t.resultsDiv.style.width=""}}))}}e.prototype.removeFilters=function(e,t){return __awaiter(this,void 0,void 0,(function(){var n=this;return __generator(this,(function(i){if(!e&&!t)this.clearAllFacetFilters();else{Object.keys(this._dynFacetFilters).forEach((function(i){if(e&&n._dynFacetFilters[i].facetName===e){if(!t)n._dynFacetFilters[i].element.value="";else{n._dynFacetFilters[i].element.value=n._dynFacetFilters[i].value.filter((function(e){return e!==t}))}}}))}return[2]}))}))};e.prototype.onAllTplUpdate=function(e){var t=this;e.stopPropagation();if(e.target.tagName==="NANO-ALGOLIA-RESULTS"){c((function(){t.nanoNewResults.emit(t.indexResults)}))}};e.prototype.onPageChange=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:if(!this.indexResults)return[2];t=this.resultsPage;if(e){e.stopPropagation();t=e.detail.page}t=Math.min(this.indexResults.totalPages-1,t);t=Math.max(t,0);if(this.indexResults.currentPage===t)return[2];this.indexResults.currentPage=t;return[4,this.algoliaSearch(u.Page)];case 1:n.sent();return[2]}}))}))};e.prototype.onFilterChange=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n;return __generator(this,(function(i){e.stopPropagation();t={};n=e.detail;n.element=e.target;if(this.indexResults){if(this.staticFacetFilters[n.filterId])this.staticFacetFilters[n.filterId]=n;else{t[n.filterId]=n;this._dynFacetFilters=Object.assign(Object.assign({},this._dynFacetFilters),t)}this.indexResults.appliedFilters=this.makeAppliedFilters()}else this.staticFacetFilters[n.filterId]=n;this.filterChanged=n.value&&n.value.length?n.filterId:"all";this.resetPage();this.algoliaSearch(u.Filter);return[2]}))}))};e.prototype.dynFacetFiltersChange=function(){var e=this;Object.values(this._dynFacetFilters).forEach((function(t){if(e.host.ownerDocument===t.element.ownerDocument)e.dynFacetFilters[t.filterId]=t;else delete e.dynFacetFilters[t.filterId]}))};e.prototype.browseIndexChange=function(){if(this.browseIndex&&(!this.query||this.query.length<this.minChars)){this.query="*"}};e.prototype.inputFieldSet=function(){if(!this.inputField)return;if(this.query!=="*"&&this.inputField&&this.inputField.value!==this.query)this.inputField.value=this.query};e.prototype.queryChange=function(){this.searchChange()};e.prototype.internalIndexSwitch=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(!this.replicaIndex||!this.indexResults||this.indexResults.index===this.replicaIndex)return[2];this.indexResults.index=this.replicaIndex;this.algoliaIndex=this.algoliaClient.initIndex(this.indexResults.index);this.resetPage();this.algoliaSearch(u.Replica);return[2]}))}))};e.prototype.pageChange=function(){this.onPageChange()};e.prototype.searchIndexNameChange=function(){if(!this.searchIndexName||!this.searchIndexName.length||this.searchIndex&&this.searchIndex.index===this.searchIndexName)return;this.searchIndex={index:this.searchIndexName}};e.prototype.initAlgoliaClient=function(){if(!this.appId||!this.apiKey)return;this.algoliaClient=h(this.appId,this.apiKey)};e.prototype.initAlgoliaIndex=function(){if(!this.algoliaClient||!this.searchIndex)return;if(this.searchIndex.index){if(this.replicaIndex)this.searchIndex.index=this.replicaIndex;this.searchIndexName=this.searchIndex.index;this.algoliaIndex=this.algoliaClient.initIndex(this.searchIndex.index);this.searchChange()}};e.prototype.showResultsChange=function(){var e=this;if(!this.resultsDiv||!this.defaultDiv)return;if(this.showResults){this.resultsDiv.style.width=this.host.scrollWidth+"px";this.resultsDiv.style.minHeight=this.host.scrollHeight+"px";r((function(){e.resultsDiv.addEventListener("transitionend",e.onResultDisplay);e.resultsDiv.style.display="block";setTimeout((function(){return e.resultsDiv.classList.add("show")}),50)}))}else{r((function(){e.resultsDiv.classList.remove("shown");e.defaultDiv.style.display="block";setTimeout((function(){e.resultsDiv.addEventListener("transitionend",e.onResultDisplay);e.resultsDiv.classList.remove("show");if(!!e.slottedInput)e.slottedInput.focus({preventScroll:true});else e.defaultDiv.focus({preventScroll:true})}),50)}))}};e.prototype.fixDomain=function(e){var t=this;if(!this.searchIndex||!this.searchIndex.domain)return e;e.hits.map((function(e){if(e.url&&!e.url.match(/^http/))e.url=location.protocol+"//"+t.searchIndex.domain+e.url}));return e};e.prototype.resetPage=function(){if(!this.indexResults)return;this.indexResults.currentPage=0};e.prototype.clearAllFacetFilters=function(){Object.values(this._dynFacetFilters).forEach((function(e){e.element.value=""}));this._dynFacetFilters={}};e.prototype.algoliaFilterStr=function(){var e={};var t=function(t){var n;var i;Object.keys(t).forEach((function(s){n=t[s];e[s]=e[s]||{name:n.facetName,or:[],and:[],not:[]};i=e[s][n.operator];if(n.value&&n.value.length){e[s][n.operator]=__spreadArray(__spreadArray([],i),n.value)}}))};t(this.dynFacetFilters);t(this.staticFacetFilters);var n=function(e,t){if(t.indexOf(" ")>-1)return e+':"'+t+'"';else return e+":"+t};var i=[];var s;var r;Object.values(e).forEach((function(e){Object.keys(e).filter((function(e){return e.match(/(or|and|not)/)})).forEach((function(t){s=e;r=e.name;if(t==="or"||t==="and"){if(s[t].length){i.push("( "+s[t].map((function(e){if(e.length)return n(r,e)})).join(" "+t.toLocaleUpperCase()+" ")+" )")}}else{if(s.not.length){i.push("( "+s[t].map((function(e){if(e.length)return"NOT "+n(r,e)})).join(" AND ")+" )")}}}))}));i=__spreadArray(__spreadArray([],this.filters),i);return i.join(" "+this.operator.toLocaleUpperCase()+" ")};e.prototype.handleInputChange=function(e){if(e.target!==this.inputField)return;this.query=this.inputField.value};e.prototype.updateContent=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){return[2,this.promiseQueue.enqueue((function(){return e.updateContentQueue()}))]}))}))};e.prototype.updateContentQueue=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;var i=this;return __generator(this,(function(s){e=this.outputSlot||this.resultsDiv;if(!e||!this.tpl)return[2,"no tpl"];t=document.createElement("div");t.innerHTML=this.tpl;n=[];this.placedAlgoliaEles=[];Array.from(t.querySelectorAll("nano-algolia, nano-algolia-filter, nano-algolia-results")).forEach((function(e,t){var i=document.createElement("div");i.dataset.placeholderId=t.toString();i.classList.add("nano-ele-placeholder");n.push(e);e.parentNode.replaceChild(i,e)}));e.innerHTML=this.tplRenderFn(t.innerHTML.replace(/>/gm,">").replace(/</gm,"<").replace(/&/gm,"&"),this.indexResults);Array.from(e.querySelectorAll("div.nano-ele-placeholder")).forEach((function(e){e.parentNode.replaceChild(n[parseInt(e.dataset.placeholderId)],e);i.placedAlgoliaEles.push(n[parseInt(e.dataset.placeholderId)])}));if(!this.placedAlgoliaEles.length)return[2,Promise.resolve("algolia setup")];return[2,new Promise((function(t){var n=function(s){i.placedAlgoliaEles=i.placedAlgoliaEles.filter((function(e){return e!==s.detail}));if(!i.placedAlgoliaEles.length){setTimeout((function(){return t("tpl updated")}),500);e.removeEventListener("nanoTplUpdated",n)}};e.addEventListener("nanoTplUpdated",n)}))]}))}))};e.prototype.componentWillLoad=function(){var e=this;a((function(t){e.tplSlot=v(e.host,'[slot="template"]')[0];e.outputSlot=v(e.host,'[slot="output"]')[0];e.slottedInput=v(e.host,'[slot="search-input"]')[0];e.hasLoadSlot=!!v(e.host,'[slot="loader"]')[0];if(!!e.tplSlot)e.tpl=e.tplSlot.innerHTML;if(e.slottedInput&&(e.slottedInput.tagName.toLocaleLowerCase()==="nano-input"||e.slottedInput instanceof HTMLInputElement)){e.inputField=e.slottedInput}else if(e.slottedInput){e.inputField=e.slottedInput.querySelector('nano-input, input:not([type="radio"]):not([type="checkbox"])')}r((function(t){if(e.showResults&&e.tpl)e.searchChange()}))}));this.searchIndexNameChange();this.initAlgoliaClient();this.initAlgoliaIndex();b.create(this,this.wormholeState);if(this.storeId){g.init(this,["query","replicaIndex"],this.storeMethod,this.storeId);g.init(this,["apiKey","appId","searchIndex"],"session",this.storeId+"_api")}this.internalIndexSwitch()};e.prototype.connectedCallback=function(){this.searchChange=y(this.searchChange,300);this.browseIndexChange();this.host.dispatchEvent(new CustomEvent("nanoDidLoad",{detail:this.host}))};e.prototype.render=function(){var e=this;var t={indexResults:this.indexResults,results:this.currentHits,filterChanged:this.filterChanged,tplRenderFn:this.tplRenderFn,resultsPage:this.resultsPage,changeEvent:this.changeEvent,facets:this.facets,algoliaIndex:this.algoliaIndex,searchIndex:this.searchIndex,globalStoreMethod:this.storeMethod,isLoading:this.isLoading};return o(l,{class:{"show-results":this.showResults,"is-loading":this.isLoading},"aria-busy":this.isLoading},this.hasLoadSlot&&o("div",{hidden:!this.isLoading},o("slot",{name:"loader"})),!this.hasLoadSlot&&o("div",{class:{loader:true,loading:this.isLoading}},o("nano-spinner",{overlay:true,type:"circle"})),o(b.Provider,{state:t},o("slot",{name:"search-input"}),o("div",{class:"results-container","aria-live":"polite"},o("div",{ref:function(t){return e.resultsDiv=t},class:"results"},o("slot",{name:"output"})))),o("div",{ref:function(t){return e.defaultDiv=t},class:"default",tabindex:"-1"},o("slot",null)))};Object.defineProperty(e.prototype,"host",{get:function(){return t(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{_dynFacetFilters:["dynFacetFiltersChange"],browseIndex:["browseIndexChange"],inputField:["inputFieldSet"],query:["queryChange"],replicaIndex:["internalIndexSwitch"],resultsPage:["pageChange"],searchIndexName:["searchIndexNameChange"],apiKey:["initAlgoliaClient"],appId:["initAlgoliaClient"],searchIndex:["initAlgoliaIndex"],showResults:["showResultsChange"]}},enumerable:false,configurable:true});return e}());k.style=P}}}));
|
5
|
+
//# sourceMappingURL=p-92f85aaf.system.entry.js.map
|
package/dist/nano-components/{p-774e090b.system.entry.js.map → p-92f85aaf.system.entry.js.map}
RENAMED
File without changes
|