@qhealth-design-system/core 1.0.38
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/.babelrc +15 -0
- package/.browserslistrc +5 -0
- package/.editorconfig +19 -0
- package/.eslintignore +1 -0
- package/.eslintrc +25 -0
- package/.gitattributes +2 -0
- package/.github/workflows/release_package.yml +103 -0
- package/CHANGELOG.md +14 -0
- package/README.md +534 -0
- package/dist/api/service_finder/schemas.json +1 -0
- package/dist/component-abstract.html +884 -0
- package/dist/component-accordion.html +1157 -0
- package/dist/component-banner.html +928 -0
- package/dist/component-banner_advanced.html +1524 -0
- package/dist/component-banner_basic.html +1189 -0
- package/dist/component-banner_intermediate.html +1288 -0
- package/dist/component-body.html +919 -0
- package/dist/component-breadcrumbs.html +881 -0
- package/dist/component-btn.html +829 -0
- package/dist/component-callout.html +964 -0
- package/dist/component-card_feature.html +1805 -0
- package/dist/component-card_multi_action.html +1965 -0
- package/dist/component-card_no_action.html +1632 -0
- package/dist/component-card_single_action.html +1772 -0
- package/dist/component-code.html +928 -0
- package/dist/component-footer.html +1131 -0
- package/dist/component-forms.html +1297 -0
- package/dist/component-global-elements.html +1243 -0
- package/dist/component-global_alert.html +891 -0
- package/dist/component-header.html +1155 -0
- package/dist/component-in_page_navigation.html +920 -0
- package/dist/component-internal_navigation.html +1097 -0
- package/dist/component-left_hand_navigation.html +995 -0
- package/dist/component-main_navigation.html +999 -0
- package/dist/component-mega_main_navigation.html +1145 -0
- package/dist/component-multi_column.html +1116 -0
- package/dist/component-page_alert.html +911 -0
- package/dist/component-pagination.html +971 -0
- package/dist/component-tag_list.html +979 -0
- package/dist/component-updated_date.html +778 -0
- package/dist/component-widgets.html +851 -0
- package/dist/components/_global/import.xml +95 -0
- package/dist/components/_global/manifest.json +11 -0
- package/dist/components/_global/presentation.js +50 -0
- package/dist/components/_global/static.html +30 -0
- package/dist/components/_template/import.xml +299 -0
- package/dist/components/_template/manifest.json +40 -0
- package/dist/components/_template/presentation.js +12 -0
- package/dist/components/_template/static.html +4 -0
- package/dist/components/abstract/import.xml +231 -0
- package/dist/components/abstract/manifest.json +29 -0
- package/dist/components/abstract/presentation.js +33 -0
- package/dist/components/abstract/static.html +9 -0
- package/dist/components/accordion/import.xml +1929 -0
- package/dist/components/accordion/manifest.json +427 -0
- package/dist/components/accordion/presentation.js +112 -0
- package/dist/components/accordion/static.html +56 -0
- package/dist/components/banner/import.xml +95 -0
- package/dist/components/banner/manifest.json +11 -0
- package/dist/components/banner/presentation.js +138 -0
- package/dist/components/banner/static.html +39 -0
- package/dist/components/banner_advanced/import.xml +1969 -0
- package/dist/components/banner_advanced/manifest.json +1450 -0
- package/dist/components/banner_advanced/presentation.js +564 -0
- package/dist/components/banner_advanced/static.html +159 -0
- package/dist/components/banner_basic/import.xml +907 -0
- package/dist/components/banner_basic/manifest.json +151 -0
- package/dist/components/banner_basic/presentation.js +325 -0
- package/dist/components/banner_basic/static.html +86 -0
- package/dist/components/banner_intermediate/import.xml +1473 -0
- package/dist/components/banner_intermediate/manifest.json +248 -0
- package/dist/components/banner_intermediate/presentation.js +410 -0
- package/dist/components/banner_intermediate/static.html +102 -0
- package/dist/components/body/import.xml +343 -0
- package/dist/components/body/manifest.json +46 -0
- package/dist/components/body/presentation.js +37 -0
- package/dist/components/body/static.html +5 -0
- package/dist/components/breadcrumbs/import.xml +95 -0
- package/dist/components/breadcrumbs/manifest.json +9 -0
- package/dist/components/breadcrumbs/presentation.js +99 -0
- package/dist/components/breadcrumbs/static.html +21 -0
- package/dist/components/callout/import.xml +953 -0
- package/dist/components/callout/manifest.json +121 -0
- package/dist/components/callout/presentation.js +103 -0
- package/dist/components/callout/static.html +10 -0
- package/dist/components/card_feature/import.xml +2355 -0
- package/dist/components/card_feature/manifest.json +1390 -0
- package/dist/components/card_feature/presentation.js +365 -0
- package/dist/components/card_feature/static.html +80 -0
- package/dist/components/card_multi_action/import.xml +1539 -0
- package/dist/components/card_multi_action/manifest.json +1314 -0
- package/dist/components/card_multi_action/presentation.js +638 -0
- package/dist/components/card_multi_action/static.html +120 -0
- package/dist/components/card_no_action/import.xml +1449 -0
- package/dist/components/card_no_action/manifest.json +1264 -0
- package/dist/components/card_no_action/presentation.js +454 -0
- package/dist/components/card_no_action/static.html +94 -0
- package/dist/components/card_single_action/import.xml +1539 -0
- package/dist/components/card_single_action/manifest.json +1273 -0
- package/dist/components/card_single_action/presentation.js +498 -0
- package/dist/components/card_single_action/static.html +103 -0
- package/dist/components/code/import.xml +569 -0
- package/dist/components/code/manifest.json +112 -0
- package/dist/components/code/presentation.js +124 -0
- package/dist/components/code/static.html +15 -0
- package/dist/components/footer/import.xml +95 -0
- package/dist/components/footer/manifest.json +9 -0
- package/dist/components/footer/presentation.js +409 -0
- package/dist/components/footer/static.html +146 -0
- package/dist/components/global_alert/import.xml +95 -0
- package/dist/components/global_alert/manifest.json +9 -0
- package/dist/components/global_alert/presentation.js +81 -0
- package/dist/components/global_alert/static.html +26 -0
- package/dist/components/header/import.xml +95 -0
- package/dist/components/header/manifest.json +11 -0
- package/dist/components/header/presentation.js +190 -0
- package/dist/components/header/static.html +158 -0
- package/dist/components/horizontal_rule/import.xml +547 -0
- package/dist/components/horizontal_rule/manifest.json +69 -0
- package/dist/components/horizontal_rule/presentation.js +50 -0
- package/dist/components/horizontal_rule/static.html +4 -0
- package/dist/components/in_page_navigation/import.xml +253 -0
- package/dist/components/in_page_navigation/manifest.json +35 -0
- package/dist/components/in_page_navigation/presentation.js +14 -0
- package/dist/components/in_page_navigation/static.html +13 -0
- package/dist/components/internal_navigation/import.xml +95 -0
- package/dist/components/internal_navigation/manifest.json +11 -0
- package/dist/components/internal_navigation/presentation.js +165 -0
- package/dist/components/internal_navigation/static.html +130 -0
- package/dist/components/left_hand_navigation/import.xml +299 -0
- package/dist/components/left_hand_navigation/manifest.json +40 -0
- package/dist/components/left_hand_navigation/presentation.js +178 -0
- package/dist/components/left_hand_navigation/static.html +64 -0
- package/dist/components/main_navigation/import.xml +95 -0
- package/dist/components/main_navigation/manifest.json +11 -0
- package/dist/components/main_navigation/presentation.js +150 -0
- package/dist/components/main_navigation/static.html +80 -0
- package/dist/components/mega_main_navigation/import.xml +95 -0
- package/dist/components/mega_main_navigation/manifest.json +9 -0
- package/dist/components/mega_main_navigation/presentation.js +380 -0
- package/dist/components/mega_main_navigation/static.html +153 -0
- package/dist/components/multi_column/import.xml +1631 -0
- package/dist/components/multi_column/manifest.json +233 -0
- package/dist/components/multi_column/presentation.js +249 -0
- package/dist/components/multi_column/static.html +36 -0
- package/dist/components/page_alert/import.xml +479 -0
- package/dist/components/page_alert/manifest.json +63 -0
- package/dist/components/page_alert/presentation.js +67 -0
- package/dist/components/page_alert/static.html +8 -0
- package/dist/components/pagination/import.xml +95 -0
- package/dist/components/pagination/manifest.json +42 -0
- package/dist/components/pagination/presentation.js +84 -0
- package/dist/components/pagination/static.html +5 -0
- package/dist/components/updated_date/import.xml +95 -0
- package/dist/components/updated_date/manifest.json +9 -0
- package/dist/components/updated_date/presentation.js +34 -0
- package/dist/components/updated_date/static.html +6 -0
- package/dist/components/widgets/import.xml +95 -0
- package/dist/components/widgets/manifest.json +9 -0
- package/dist/components/widgets/presentation.js +40 -0
- package/dist/components/widgets/static.html +0 -0
- package/dist/components.html +790 -0
- package/dist/externals/componentPreview.js +101 -0
- package/dist/externals/dsComponentLoader.js +410 -0
- package/dist/externals/esri-leaflet-vector.js +5 -0
- package/dist/externals/esri-leaflet.js +12 -0
- package/dist/externals/fb-handlebars.min.js +29 -0
- package/dist/externals/fb-typeahead.bundle.min.js +6 -0
- package/dist/externals/funnelback.autocompletion-2.6.0.js +678 -0
- package/dist/externals/getPagination.js +62 -0
- package/dist/externals/handlebars.min-v4.7.6.js +29 -0
- package/dist/externals/leaflet.js +6 -0
- package/dist/externals/populateDatastoreSim.js +381 -0
- package/dist/externals/tinymce_classes.css +62 -0
- package/dist/home.html +694 -0
- package/dist/index.html +710 -0
- package/dist/inner-with-nav.html +1853 -0
- package/dist/inner.html +671 -0
- package/dist/js/helpers.js +892 -0
- package/dist/js/main.js +55 -0
- package/dist/js/main.js.map +1 -0
- package/dist/js/runtime.js +2 -0
- package/dist/js/runtime.js.map +1 -0
- package/dist/main.css +918 -0
- package/dist/main.css.map +1 -0
- package/dist/mysource_files/ajax-loader.gif +0 -0
- package/dist/mysource_files/favicons/favicon.ico +0 -0
- package/dist/mysource_files/img/100x100.jpg +0 -0
- package/dist/mysource_files/img/600x260.jpg +0 -0
- package/dist/mysource_files/img/Heart-Pattern-Dark.png +0 -0
- package/dist/mysource_files/img/Heart-Pattern.png +0 -0
- package/dist/mysource_files/img/banner-background--desktop.png +0 -0
- package/dist/mysource_files/img/banner-background--mobile.png +0 -0
- package/dist/mysource_files/img/banner-bg.png +0 -0
- package/dist/mysource_files/img/banner.png +0 -0
- package/dist/mysource_files/img/card--brand.png +0 -0
- package/dist/mysource_files/img/card--components.png +0 -0
- package/dist/mysource_files/img/card--content.png +0 -0
- package/dist/mysource_files/img/header-logo-agov.png +0 -0
- package/dist/mysource_files/img/header-logo-qgov--dark.svg +63 -0
- package/dist/mysource_files/img/header-logo-qgov--light.svg +56 -0
- package/dist/mysource_files/img/header-logo-qgov--pre-dark.svg +56 -0
- package/dist/mysource_files/img/header-search.svg +3 -0
- package/dist/mysource_files/img/layers-2x.png +0 -0
- package/dist/mysource_files/img/layers.png +0 -0
- package/dist/mysource_files/img/marker-icon.png +0 -0
- package/dist/mysource_files/img/svg-icons.svg +155 -0
- package/dist/mysource_files/img/video-play.svg +3 -0
- package/dist/mysource_files/slick.eot +0 -0
- package/dist/mysource_files/slick.svg +14 -0
- package/dist/mysource_files/slick.ttf +0 -0
- package/dist/mysource_files/slick.woff +0 -0
- package/package-lock.json +14276 -0
- package/package.json +79 -0
- package/scripts/add_component.sh +109 -0
- package/src/assets/favicons/favicon.ico +0 -0
- package/src/assets/img/100x100.jpg +0 -0
- package/src/assets/img/600x260.jpg +0 -0
- package/src/assets/img/Heart-Pattern-Dark.png +0 -0
- package/src/assets/img/Heart-Pattern.png +0 -0
- package/src/assets/img/banner-background--desktop.png +0 -0
- package/src/assets/img/banner-background--mobile.png +0 -0
- package/src/assets/img/banner-bg.png +0 -0
- package/src/assets/img/banner.png +0 -0
- package/src/assets/img/card--brand.png +0 -0
- package/src/assets/img/card--components.png +0 -0
- package/src/assets/img/card--content.png +0 -0
- package/src/assets/img/header-logo-agov.png +0 -0
- package/src/assets/img/header-logo-qgov--dark.svg +63 -0
- package/src/assets/img/header-logo-qgov--light.svg +56 -0
- package/src/assets/img/header-logo-qgov--pre-dark.svg +56 -0
- package/src/assets/img/header-search.svg +3 -0
- package/src/assets/img/layers-2x.png +0 -0
- package/src/assets/img/layers.png +0 -0
- package/src/assets/img/marker-icon.png +0 -0
- package/src/assets/img/svg-icons.svg +155 -0
- package/src/assets/img/video-play.svg +3 -0
- package/src/components/_global/css/admin/component.scss +71 -0
- package/src/components/_global/css/body/component.scss +897 -0
- package/src/components/_global/css/btn/component.scss +564 -0
- package/src/components/_global/css/cta_links/component.scss +121 -0
- package/src/components/_global/css/direction_links/component.scss +196 -0
- package/src/components/_global/css/example/component.scss +54 -0
- package/src/components/_global/css/forms/control_inputs/component.scss +349 -0
- package/src/components/_global/css/forms/general/component.scss +298 -0
- package/src/components/_global/css/forms/select/component.scss +230 -0
- package/src/components/_global/css/forms/text/component.scss +402 -0
- package/src/components/_global/css/global.scss +42 -0
- package/src/components/_global/css/grid-12/component.scss +331 -0
- package/src/components/_global/css/headings/component.scss +172 -0
- package/src/components/_global/css/icons/component.scss +29 -0
- package/src/components/_global/css/link_columns/component.scss +194 -0
- package/src/components/_global/css/link_list/component.scss +37 -0
- package/src/components/_global/css/modal/component.scss +182 -0
- package/src/components/_global/css/slick/component.scss +25 -0
- package/src/components/_global/css/table/component.scss +211 -0
- package/src/components/_global/css/tabs/component.scss +43 -0
- package/src/components/_global/css/tags/component.scss +272 -0
- package/src/components/_global/css/user_location/component.scss +38 -0
- package/src/components/_global/css/version/component.scss +47 -0
- package/src/components/_global/html/component.hbs +108 -0
- package/src/components/_global/html/ds_component.hbs +30 -0
- package/src/components/_global/html/head.html +63 -0
- package/src/components/_global/html/scripts.html +58 -0
- package/src/components/_global/js/_polyfills/global.js +18 -0
- package/src/components/_global/js/animate/global.js +324 -0
- package/src/components/_global/js/forms/global.js +182 -0
- package/src/components/_global/js/global.js +302 -0
- package/src/components/_global/js/manifest.json +11 -0
- package/src/components/_global/js/modal/global.js +236 -0
- package/src/components/_global/js/slick/global.js +153 -0
- package/src/components/_global/js/tabs/global.js +305 -0
- package/src/components/_global/js/user_location/global.js +116 -0
- package/src/components/_template/css/component.scss +22 -0
- package/src/components/_template/html/component-page.html +85 -0
- package/src/components/_template/html/component.hbs +4 -0
- package/src/components/_template/js/global.js +6 -0
- package/src/components/_template/js/manifest.json +40 -0
- package/src/components/abstract/css/component.scss +91 -0
- package/src/components/abstract/html/component.hbs +9 -0
- package/src/components/abstract/js/manifest.json +29 -0
- package/src/components/accordion/css/component.scss +329 -0
- package/src/components/accordion/html/accordion-group.html +157 -0
- package/src/components/accordion/html/component.hbs +46 -0
- package/src/components/accordion/html/default.html +92 -0
- package/src/components/accordion/js/global.js +413 -0
- package/src/components/accordion/js/manifest.json +427 -0
- package/src/components/banner/css/component.scss +664 -0
- package/src/components/banner/html/component.hbs +52 -0
- package/src/components/banner/js/manifest.json +11 -0
- package/src/components/banner_advanced/css/component.scss +7 -0
- package/src/components/banner_advanced/html/component.hbs +213 -0
- package/src/components/banner_advanced/js/global.js +6 -0
- package/src/components/banner_advanced/js/manifest.json +1450 -0
- package/src/components/banner_basic/css/component.scss +52 -0
- package/src/components/banner_basic/html/component.hbs +130 -0
- package/src/components/banner_basic/js/global.js +6 -0
- package/src/components/banner_basic/js/manifest.json +151 -0
- package/src/components/banner_intermediate/css/component.scss +276 -0
- package/src/components/banner_intermediate/html/component.hbs +165 -0
- package/src/components/banner_intermediate/js/global.js +6 -0
- package/src/components/banner_intermediate/js/manifest.json +248 -0
- package/src/components/body/css/component.scss +16 -0
- package/src/components/body/html/component.hbs +5 -0
- package/src/components/body/js/manifest.json +46 -0
- package/src/components/breadcrumbs/css/component.scss +236 -0
- package/src/components/breadcrumbs/html/component.hbs +29 -0
- package/src/components/breadcrumbs/js/manifest.json +9 -0
- package/src/components/callout/css/component.scss +146 -0
- package/src/components/callout/html/component.hbs +28 -0
- package/src/components/callout/js/manifest.json +121 -0
- package/src/components/card_feature/css/component.scss +224 -0
- package/src/components/card_feature/html/component.hbs +129 -0
- package/src/components/card_feature/js/manifest.json +1390 -0
- package/src/components/card_multi_action/css/component.scss +229 -0
- package/src/components/card_multi_action/html/component.hbs +192 -0
- package/src/components/card_multi_action/js/manifest.json +1314 -0
- package/src/components/card_no_action/css/component.scss +551 -0
- package/src/components/card_no_action/html/component.hbs +127 -0
- package/src/components/card_no_action/js/global.js +6 -0
- package/src/components/card_no_action/js/manifest.json +1264 -0
- package/src/components/card_single_action/css/component.scss +164 -0
- package/src/components/card_single_action/html/component.hbs +161 -0
- package/src/components/card_single_action/js/manifest.json +1273 -0
- package/src/components/code/css/component.scss +355 -0
- package/src/components/code/html/component.hbs +84 -0
- package/src/components/code/js/global.js +160 -0
- package/src/components/code/js/manifest.json +112 -0
- package/src/components/footer/css/component.scss +437 -0
- package/src/components/footer/html/component.hbs +177 -0
- package/src/components/footer/js/manifest.json +9 -0
- package/src/components/global_alert/css/component.scss +169 -0
- package/src/components/global_alert/html/component.hbs +38 -0
- package/src/components/global_alert/js/global.js +39 -0
- package/src/components/global_alert/js/manifest.json +9 -0
- package/src/components/header/css/component.scss +697 -0
- package/src/components/header/html/component.hbs +186 -0
- package/src/components/header/js/global.js +188 -0
- package/src/components/header/js/manifest.json +11 -0
- package/src/components/horizontal_rule/css/component.scss +37 -0
- package/src/components/horizontal_rule/html/component.hbs +6 -0
- package/src/components/horizontal_rule/js/manifest.json +69 -0
- package/src/components/in_page_navigation/css/component.scss +54 -0
- package/src/components/in_page_navigation/html/component.hbs +17 -0
- package/src/components/in_page_navigation/js/global.js +51 -0
- package/src/components/in_page_navigation/js/manifest.json +35 -0
- package/src/components/internal_navigation/css/component.scss +437 -0
- package/src/components/internal_navigation/html/component.hbs +57 -0
- package/src/components/internal_navigation/js/manifest.json +11 -0
- package/src/components/left_hand_navigation/css/component.scss +280 -0
- package/src/components/left_hand_navigation/html/component.hbs +77 -0
- package/src/components/left_hand_navigation/js/global.js +36 -0
- package/src/components/left_hand_navigation/js/manifest.json +40 -0
- package/src/components/main_navigation/css/component.scss +706 -0
- package/src/components/main_navigation/html/component.hbs +87 -0
- package/src/components/main_navigation/js/global.js +373 -0
- package/src/components/main_navigation/js/manifest.json +11 -0
- package/src/components/mega_main_navigation/css/component.scss +535 -0
- package/src/components/mega_main_navigation/html/component.hbs +157 -0
- package/src/components/mega_main_navigation/js/global.js +170 -0
- package/src/components/mega_main_navigation/js/manifest.json +9 -0
- package/src/components/multi_column/css/component.scss +11 -0
- package/src/components/multi_column/html/component.hbs +98 -0
- package/src/components/multi_column/js/manifest.json +233 -0
- package/src/components/page_alert/css/component.scss +132 -0
- package/src/components/page_alert/html/component.hbs +26 -0
- package/src/components/page_alert/js/manifest.json +63 -0
- package/src/components/pagination/css/component.scss +196 -0
- package/src/components/pagination/html/component.hbs +41 -0
- package/src/components/pagination/html/default.html +30 -0
- package/src/components/pagination/js/manifest.json +42 -0
- package/src/components/search_box/css/component.scss +48 -0
- package/src/components/search_box/html/component.html +11 -0
- package/src/components/search_box/js/manifest.json +73 -0
- package/src/components/updated_date/css/component.scss +0 -0
- package/src/components/updated_date/html/component.hbs +31 -0
- package/src/components/updated_date/js/manifest.json +9 -0
- package/src/components/widgets/css/component.scss +82 -0
- package/src/components/widgets/html/component.hbs +19 -0
- package/src/components/widgets/html/default.html +4 -0
- package/src/components/widgets/js/current.json +483 -0
- package/src/components/widgets/js/manifest.json +9 -0
- package/src/components/widgets/js/site.json +358 -0
- package/src/data/current.json +522 -0
- package/src/data/current_admin.json +305 -0
- package/src/data/model_component.js +14 -0
- package/src/data/site.json +762 -0
- package/src/externals/componentPreview.js +101 -0
- package/src/externals/dsComponentLoader.js +410 -0
- package/src/externals/esri-leaflet-vector.js +5 -0
- package/src/externals/esri-leaflet.js +12 -0
- package/src/externals/fb-handlebars.min.js +29 -0
- package/src/externals/fb-typeahead.bundle.min.js +6 -0
- package/src/externals/funnelback.autocompletion-2.6.0.js +678 -0
- package/src/externals/getPagination.js +62 -0
- package/src/externals/handlebars.min-v4.7.6.js +29 -0
- package/src/externals/leaflet.js +6 -0
- package/src/externals/populateDatastoreSim.js +381 -0
- package/src/externals/tinymce_classes.css +62 -0
- package/src/helpers/Handlebars/appendIf.js +6 -0
- package/src/helpers/Handlebars/arrayLength.js +3 -0
- package/src/helpers/Handlebars/arrayWith.js +13 -0
- package/src/helpers/Handlebars/capitaliseFirst.js +8 -0
- package/src/helpers/Handlebars/charMax.js +8 -0
- package/src/helpers/Handlebars/checkIf.js +20 -0
- package/src/helpers/Handlebars/columnWidth.js +39 -0
- package/src/helpers/Handlebars/contains.js +7 -0
- package/src/helpers/Handlebars/createMap.js +19 -0
- package/src/helpers/Handlebars/dsMapFromID.js +8 -0
- package/src/helpers/Handlebars/dsMapFromProp.js +8 -0
- package/src/helpers/Handlebars/eachByName.js +18 -0
- package/src/helpers/Handlebars/eachDS.js +7 -0
- package/src/helpers/Handlebars/eachFrom.js +13 -0
- package/src/helpers/Handlebars/eachUpTo.js +8 -0
- package/src/helpers/Handlebars/eachWhen.js +33 -0
- package/src/helpers/Handlebars/formatDate.js +62 -0
- package/src/helpers/Handlebars/generateDates.js +74 -0
- package/src/helpers/Handlebars/getDistance.js +40 -0
- package/src/helpers/Handlebars/getObject.js +3 -0
- package/src/helpers/Handlebars/getParamaterByName.js +11 -0
- package/src/helpers/Handlebars/getPossibleValues.js +13 -0
- package/src/helpers/Handlebars/getProp.js +3 -0
- package/src/helpers/Handlebars/getTags.js +20 -0
- package/src/helpers/Handlebars/getTitle.js +4 -0
- package/src/helpers/Handlebars/ifAny.js +9 -0
- package/src/helpers/Handlebars/ifArray.js +3 -0
- package/src/helpers/Handlebars/ifCond.js +31 -0
- package/src/helpers/Handlebars/ifEqualsOrChained.js +12 -0
- package/src/helpers/Handlebars/ifProp.js +3 -0
- package/src/helpers/Handlebars/if_eq.js +9 -0
- package/src/helpers/Handlebars/inArray.js +8 -0
- package/src/helpers/Handlebars/isPage.js +7 -0
- package/src/helpers/Handlebars/itemAt.js +11 -0
- package/src/helpers/Handlebars/jsonParse.js +8 -0
- package/src/helpers/Handlebars/jsonStringify.js +3 -0
- package/src/helpers/Handlebars/listAZ.js +51 -0
- package/src/helpers/Handlebars/listAZOptions.js +34 -0
- package/src/helpers/Handlebars/listByClosest.js +60 -0
- package/src/helpers/Handlebars/listByClosestWithOffset.js +63 -0
- package/src/helpers/Handlebars/math.js +11 -0
- package/src/helpers/Handlebars/newLineToBreak.js +6 -0
- package/src/helpers/Handlebars/nonBreakingSpaces.js +6 -0
- package/src/helpers/Handlebars/objectFromSelect.js +21 -0
- package/src/helpers/Handlebars/partialReplace.js +9 -0
- package/src/helpers/Handlebars/printAccordion.js +24 -0
- package/src/helpers/Handlebars/replace.js +8 -0
- package/src/helpers/Handlebars/replaceMany.js +5 -0
- package/src/helpers/Handlebars/sizeFormat.js +11 -0
- package/src/helpers/Handlebars/split.js +6 -0
- package/src/helpers/Handlebars/toUpperCase.js +7 -0
- package/src/helpers/Handlebars/urldecode.js +3 -0
- package/src/helpers/Handlebars/urlencode.js +3 -0
- package/src/helpers/Handlebars/withinObject.js +13 -0
- package/src/html/component-abstract.html +86 -0
- package/src/html/component-accordion.html +87 -0
- package/src/html/component-banner.html +84 -0
- package/src/html/component-banner_advanced.html +97 -0
- package/src/html/component-banner_basic.html +163 -0
- package/src/html/component-banner_intermediate.html +91 -0
- package/src/html/component-body.html +116 -0
- package/src/html/component-breadcrumbs.html +88 -0
- package/src/html/component-btn.html +117 -0
- package/src/html/component-callout.html +86 -0
- package/src/html/component-card_feature.html +631 -0
- package/src/html/component-card_multi_action.html +793 -0
- package/src/html/component-card_no_action.html +521 -0
- package/src/html/component-card_single_action.html +631 -0
- package/src/html/component-code.html +84 -0
- package/src/html/component-footer.html +87 -0
- package/src/html/component-forms.html +585 -0
- package/src/html/component-global-elements.html +531 -0
- package/src/html/component-global_alert.html +87 -0
- package/src/html/component-header.html +88 -0
- package/src/html/component-in_page_navigation.html +109 -0
- package/src/html/component-internal_navigation.html +87 -0
- package/src/html/component-left_hand_navigation.html +85 -0
- package/src/html/component-main_navigation.html +87 -0
- package/src/html/component-mega_main_navigation.html +88 -0
- package/src/html/component-multi_column.html +86 -0
- package/src/html/component-page_alert.html +86 -0
- package/src/html/component-pagination.html +86 -0
- package/src/html/component-tag_list.html +340 -0
- package/src/html/component-updated_date.html +88 -0
- package/src/html/component-widgets.html +90 -0
- package/src/html/components.html +136 -0
- package/src/html/home.html +126 -0
- package/src/html/index.html +142 -0
- package/src/html/inner-with-nav.html +1126 -0
- package/src/html/inner.html +107 -0
- package/src/index.js +12 -0
- package/src/styles/global.scss +120 -0
- package/src/styles/imports/figma.scss +0 -0
- package/src/styles/imports/functions.scss +519 -0
- package/src/styles/imports/mixins.scss +658 -0
- package/src/styles/imports/placeholders.scss +68 -0
- package/src/styles/imports/utilities.scss +185 -0
- package/src/styles/imports/variables.scss +484 -0
- package/src/styles/postcss.config.js +4 -0
- package/webpack/JsonMergePlugin.js +35 -0
- package/webpack/PrecompilePlugin.js +369 -0
- package/webpack/webpack.common.js +151 -0
- package/webpack/webpack.dev.js +54 -0
- package/webpack/webpack.prod.js +70 -0
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Funnelback auto-completion plugin
|
|
3
|
+
* version 2.6.1
|
|
4
|
+
*
|
|
5
|
+
* author: Liliana Nowak
|
|
6
|
+
* Copyright Funnelback, 2015-2019
|
|
7
|
+
*
|
|
8
|
+
* @requires jQuery https://jquery.com@1.10.2
|
|
9
|
+
* @requires Typeahead https://twitter.github.io/typeahead.js@0.11.1
|
|
10
|
+
* @requires Handlebars https://handlebarsjs.com@4.0.5
|
|
11
|
+
*/
|
|
12
|
+
(function($) {
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
var autocompletion = function(element, options) {
|
|
16
|
+
// Global references
|
|
17
|
+
this.$element = $(element);
|
|
18
|
+
this.options = options;
|
|
19
|
+
|
|
20
|
+
this.init();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Default options
|
|
24
|
+
autocompletion.defaults = {
|
|
25
|
+
// set configuration
|
|
26
|
+
datasets : null, // {set1: {url: ''}, set2: {...}, set3: {...}}
|
|
27
|
+
/*
|
|
28
|
+
defaultCall : { // 'string'|[]|{}; use to trigger auto-completion when input value is empty and length=0
|
|
29
|
+
params : {}, // {}; list of parameters added to request
|
|
30
|
+
url : '' // 'string'; URL to call request
|
|
31
|
+
transform : customFunctionToMapData,// function(set, data); transform function used to map response data
|
|
32
|
+
},
|
|
33
|
+
defaultCall : '', // 'string'; query to replace empty value and call request
|
|
34
|
+
defaultCall : [], // [{value: '', label: ''}, {value: '', label: ''}]; list of hardcoded data to fulfill dropdown menu
|
|
35
|
+
defaultCall : {
|
|
36
|
+
data : [], // []; list of hardcoded data
|
|
37
|
+
transform : function // function(set, data); transform function used to map hardcoded data
|
|
38
|
+
},
|
|
39
|
+
*/
|
|
40
|
+
callback : null, // function(set, suggestions); callback function applied to suggestions before returning them to typeahead plugin
|
|
41
|
+
debounceDelay : 300, // integer; the debounce delay in milliseconds between the time the user stops typing a letter and the time the request is done\
|
|
42
|
+
group : false, // true|false; enable grouping suggestions based on parameter itemGroup
|
|
43
|
+
groupOrder : [], // []; list of group headers used to sort grouped suggestions in that order
|
|
44
|
+
facets : { // {}; list of parameters applied when default search-based auto-completion is enabled
|
|
45
|
+
blacklist : [], // []; list of facet categories names not to displayed
|
|
46
|
+
whitelist : [], // []; list of facet categories names to display
|
|
47
|
+
show : 2, // integer; maximum number of facets values to display per facet category; if not set will display all facet category values
|
|
48
|
+
url : null, // string; the target URL to apply facets parameters to; By default it'll be current location
|
|
49
|
+
},
|
|
50
|
+
itemGroup : 'category', // 'string'; the name of field used to group suggestions and display as group header in dropdown
|
|
51
|
+
itemLabel : 'value', // 'string'; the name of a field to be displayed in input field
|
|
52
|
+
template : { // {notFound: '', pending: '', header: '', footer: '', group: '', suggestion: ''}
|
|
53
|
+
group: function(context) { return $('<div>').html(String(context.label)); },
|
|
54
|
+
suggestion: function(context) { return $('<div>').html(String(context.label)); }
|
|
55
|
+
},
|
|
56
|
+
templateMerge : true, // true|false; to wrap notFound and pending template with header and footer template
|
|
57
|
+
transform : _processSetData, // function(set, suggestion, index); transform function used to map response data
|
|
58
|
+
|
|
59
|
+
// URL settings
|
|
60
|
+
collection : null, // 'string'; the collection name
|
|
61
|
+
dataType : 'json', // 'json'|'jsonp'; the type of data returned back from the server
|
|
62
|
+
alpha : '0.5', // 'string'; adjust the balance between length and relevancy for spelling based suggestions
|
|
63
|
+
format : 'extended', // 'simple|extended'; mapping into 'json' or 'json++'
|
|
64
|
+
params : null, // {}; custom URL parameters
|
|
65
|
+
profile : '_default', // 'string'; the profile name
|
|
66
|
+
program : '/s/suggest.json', // 'string'; program/URL used to generate auto-completion suggestions
|
|
67
|
+
show : 10, // integer; maximum number of suggestions to diplay in dropdown per set
|
|
68
|
+
sort : 0, // integer; set the auto-completion suggestions sort order when program='/s/suggest.json'
|
|
69
|
+
queryKey : 'partial_query', // 'string'; the name of URL parameter to run search query
|
|
70
|
+
queryVal : '%QUERY', // 'string'; the value to be replaced in url with the URI encoded query
|
|
71
|
+
|
|
72
|
+
// display settings
|
|
73
|
+
length : 3, // integer; the minimum character length to trigger query completion
|
|
74
|
+
horizontal : false, // true|false; if true, display datasets in columns, else one below the other
|
|
75
|
+
scrollable : false, // true|false; to limit height of a menu dropdown to maxheight by adding vertical scroll
|
|
76
|
+
|
|
77
|
+
// logs
|
|
78
|
+
logging : true,
|
|
79
|
+
interactionLog : '/s/log',
|
|
80
|
+
|
|
81
|
+
//typeahead settings
|
|
82
|
+
typeahead: {
|
|
83
|
+
classNames : {}, // {}; to override any of default classes, more https://github.com/twitter/typeahead.js/blob/master/doc/jquery_typeahead.md#class-names
|
|
84
|
+
highlight : true, // true|false; when suggestions are rendered, pattern matches for the current query in text nodes will be wrapped in a strong element with its class set to {{classNames.highlight}}
|
|
85
|
+
hint : false, // true|false; to show a hint in input field,
|
|
86
|
+
events : { // {eventName: function}; events get triggered on the input element during the life-cycle of a typeahead
|
|
87
|
+
select : function(event, suggestion) {
|
|
88
|
+
_selectItem(suggestion, $(event.target));
|
|
89
|
+
},
|
|
90
|
+
afterselect: function(event, suggestion) {
|
|
91
|
+
if (suggestion.extra.action_t == 'E') $(event.target).focus();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/* Public methods */
|
|
98
|
+
|
|
99
|
+
autocompletion.prototype.init = function() {
|
|
100
|
+
this.option(this.options);
|
|
101
|
+
|
|
102
|
+
if (_isEnabled(this.options)) this.initTypeahead();
|
|
103
|
+
else this.destroy();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
autocompletion.prototype.destroy = function () {
|
|
107
|
+
this.destroyTypeahead;
|
|
108
|
+
|
|
109
|
+
this.$element = null;
|
|
110
|
+
this.options = {};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
autocompletion.prototype.option = function(key, val) {
|
|
114
|
+
if (arguments.length === 0) {
|
|
115
|
+
return this.options;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
var that = this, options = $.isObject(key) ? key : {}, parts;
|
|
119
|
+
if ($.isString(key)) {
|
|
120
|
+
if (arguments.length === 1 || !$.isDefinied(val)) {
|
|
121
|
+
return $.dataVals($.extend({}, that.options), key);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
options[key] = val;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
for (var k in options) _setOption(k, options[k]);
|
|
128
|
+
|
|
129
|
+
function _setOption(key, val) {
|
|
130
|
+
if (key === 'datasets') that.options[key] = _mapOptions(that.options, val);
|
|
131
|
+
if (key === 'debug') _debug = val;
|
|
132
|
+
if (key === 'horizontal' && val) {
|
|
133
|
+
that.setTypeaheadClass('menu', 'tt-horizontal');
|
|
134
|
+
|
|
135
|
+
that.options.typeahead.events.render = function(event) {
|
|
136
|
+
_renderSetWidth(that.getTypeaheadMenu(), 'tt-horizontal', 'tt-dataset');
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if (key === 'scrollable' && val) that.setTypeaheadClass('menu', 'tt-scrollable');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
autocompletion.prototype.horizontal = function(val) {
|
|
144
|
+
return this.option('horizontal', val);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
autocompletion.prototype.scrollable = function(val) {
|
|
148
|
+
return this.option('scrollable', val);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Typeahead
|
|
152
|
+
autocompletion.prototype.initTypeahead = function() {
|
|
153
|
+
var that = this, data = [];
|
|
154
|
+
|
|
155
|
+
$.each(that.options.datasets, function(name, set) {
|
|
156
|
+
data.push(_getSetData(set, name));
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
that.$element.typeahead({
|
|
160
|
+
minLength : parseInt(that.options.length),
|
|
161
|
+
hint : that.options.typeahead.hint,
|
|
162
|
+
highlight : that.options.typeahead.highlight,
|
|
163
|
+
classNames: that.options.typeahead.classNames
|
|
164
|
+
}, data);
|
|
165
|
+
|
|
166
|
+
if (that.options.typeahead.events) {
|
|
167
|
+
$.each(that.options.typeahead.events, function(eventName, func) {
|
|
168
|
+
that.$element.on('typeahead:' + eventName, func);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (that.options.horizontal) {
|
|
173
|
+
var data = that.$element.data(), menu = that.getTypeaheadMenu();
|
|
174
|
+
|
|
175
|
+
/*
|
|
176
|
+
* 37 - code for left arrow key
|
|
177
|
+
* 38 - code for up arrow key
|
|
178
|
+
* 39 - code for right arrow key
|
|
179
|
+
* 40 - code for down arrow key
|
|
180
|
+
*/
|
|
181
|
+
data.ttTypeahead._onDownKeyed = function() {
|
|
182
|
+
_navCursorUD(40, menu, that.$element);
|
|
183
|
+
};
|
|
184
|
+
data.ttTypeahead._onUpKeyed = function() {
|
|
185
|
+
_navCursorUD(38, menu, that.$element);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
var cols = menu.children('.tt-dataset');
|
|
189
|
+
if (cols.size() > 1) {
|
|
190
|
+
data.ttTypeahead._onLeftKeyed = function() {
|
|
191
|
+
_navCursorLR(37, cols, that.$element);
|
|
192
|
+
};
|
|
193
|
+
data.ttTypeahead._onRightKeyed = function() {
|
|
194
|
+
_navCursorLR(39, cols, that.$element);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
that.$element.on('keydown', function(event) {
|
|
199
|
+
var code = event.keyCode || event.which;
|
|
200
|
+
if (code == 38 || code == 40) return false;
|
|
201
|
+
if ((code == 37 || code == 39) && $.exist(_navCols.cursor)) return false;
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Log interactions
|
|
206
|
+
if (!that.options.logging) return;
|
|
207
|
+
that.$element.on('typeahead:select', function(event, suggestion) {
|
|
208
|
+
logInteraction(that.options, suggestion, $(event.target), 'select');
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
autocompletion.prototype.destroyTypeahead = function() {
|
|
213
|
+
this.$element.typeahead('destroy');
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
autocompletion.prototype.getTypeaheadMenu = function() {
|
|
217
|
+
return this.$element.siblings('.tt-menu');
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
autocompletion.prototype.setTypeaheadClass = function(name, className) {
|
|
221
|
+
if (!$.exist(this.options.typeahead.classNames[name], true)) this.options.typeahead.classNames[name] = 'tt-' + name; // default class
|
|
222
|
+
this.options.typeahead.classNames[name] += ' ' + className;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/* Private variables */
|
|
226
|
+
var _debug = false,
|
|
227
|
+
_mapKeys = ['collection', 'callback', 'dataType', 'alpha', 'facets', 'transform', 'format', 'group', 'groupOrder', 'itemGroup', 'itemLabel', 'params', 'profile', 'program', 'show', 'sort', 'queryKey', 'queryVal', 'template', 'templateMerge', 'debounceDelay'],
|
|
228
|
+
_navCols = {cursor : null, query : ''};
|
|
229
|
+
|
|
230
|
+
/* Private methods */
|
|
231
|
+
|
|
232
|
+
// Check if there is enough data to trigger auto-completion
|
|
233
|
+
function _isEnabled(options) {
|
|
234
|
+
var bState = false;
|
|
235
|
+
|
|
236
|
+
if (!$.isObject(options.datasets)) return bState;
|
|
237
|
+
|
|
238
|
+
$.each(options.datasets, function(name, set) {
|
|
239
|
+
if ($.exist(set.collection, true)) bState = true;
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
return bState;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Map global options per dataset
|
|
246
|
+
function _mapOptions(options, datasets) {
|
|
247
|
+
var map = {};
|
|
248
|
+
$.each(_mapKeys, function(i, key) { map[key] = options[key] });
|
|
249
|
+
$.each(datasets, function(name, set) { datasets[name] = $.extend(true, {}, map, set) });
|
|
250
|
+
return datasets;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Handle set
|
|
254
|
+
function _getSetData(set, name) {
|
|
255
|
+
var engine = new Bloodhound({
|
|
256
|
+
datumTokenizer : Bloodhound.tokenizers.obj.whitespace('value'),
|
|
257
|
+
queryTokenizer : Bloodhound.tokenizers.whitespace,
|
|
258
|
+
remote : getBloodhoundRemote()
|
|
259
|
+
});
|
|
260
|
+
engine.initialize();
|
|
261
|
+
|
|
262
|
+
return {
|
|
263
|
+
name : name,
|
|
264
|
+
limit : 10000, // hack to display all returned data
|
|
265
|
+
source : source,
|
|
266
|
+
display : displayVal,
|
|
267
|
+
templates : _renderSetTemplate(set)
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function displayVal(suggestion) {
|
|
271
|
+
return $.isFunction(set.itemLabel) ? set.itemLabel.call(undefined, suggestion) : $.dataVals(suggestion, set.itemLabel);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function getBloodhoundRemote() {
|
|
275
|
+
var remote = {
|
|
276
|
+
url : set.url ? set.url : _getSetUrl(set),
|
|
277
|
+
filter : function (response) {
|
|
278
|
+
var query = getQuery($(this).get(0).transport.lastReq);
|
|
279
|
+
return _handleSetData(set, $.map(response, function(suggestion, i) { return set.transform(set, suggestion, i, name, query) }));
|
|
280
|
+
},
|
|
281
|
+
rateLimitWait: set.debounceDelay
|
|
282
|
+
};
|
|
283
|
+
if (set.dataType === 'jsonp') {
|
|
284
|
+
remote['prepare'] = function(query, settings) {
|
|
285
|
+
settings.dataType = 'jsonp';
|
|
286
|
+
settings.url = settings.url.replace(set.queryVal, query);
|
|
287
|
+
return settings;
|
|
288
|
+
};
|
|
289
|
+
} else {
|
|
290
|
+
remote['wildcard'] = set.queryVal;
|
|
291
|
+
}
|
|
292
|
+
return remote;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function getQuery(str) {
|
|
296
|
+
if (!$.exist(str, true)) return str;
|
|
297
|
+
str = decodeURIComponent(str);
|
|
298
|
+
return str.substring(str.lastIndexOf(set.queryKey + '=') + (set.queryKey.length + 1), str.lastIndexOf('GET'));
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function displayVal(suggestion) {
|
|
302
|
+
return $.isFunction(set.itemLabel) ? set.itemLabel.call(undefined, suggestion) : $.dataVals(suggestion, set.itemLabel);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function source(query, sync, async) {
|
|
306
|
+
if (query.length < 1 && set.defaultCall) {
|
|
307
|
+
if ($.isString(set.defaultCall)) {
|
|
308
|
+
query = set.defaultCall;
|
|
309
|
+
}
|
|
310
|
+
else if ($.isArray(set.defaultCall)) {
|
|
311
|
+
sync(_handleSetData(set, set.defaultCall));
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
else if ($.exist(set.defaultCall.data)) {
|
|
315
|
+
sync(_handleSetData(set, set.defaultCall.transform(set, set.defaultCall.data)));
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
else if ($.exist(set.defaultCall.url, true)) {
|
|
319
|
+
$.get(set.defaultCall.url, set.defaultCall.params, function(data) {
|
|
320
|
+
async(_handleSetData(set.defaultCall.transform(set, data)));
|
|
321
|
+
return;
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
engine.search(query, sync, async);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Returned request URL based on provided parameters
|
|
331
|
+
function _getSetUrl(set) {
|
|
332
|
+
var params = {collection: set.collection};
|
|
333
|
+
|
|
334
|
+
if ($.exist(set.format, true)) params['fmt'] = set.format == 'simple' ? 'json' : 'json++';
|
|
335
|
+
if ($.exist(set.alpha, true)) params['alpha'] = set.alpha;
|
|
336
|
+
if ($.exist(set.profile, true)) params['profile'] = set.profile;
|
|
337
|
+
if ($.exist(set.show, true)) params['show'] = set.show;
|
|
338
|
+
if ($.exist(set.sort, true)) params['sort'] = set.sort;
|
|
339
|
+
if ($.isObject(set.param)) params = $.extend(true, {}, params, set.params);
|
|
340
|
+
|
|
341
|
+
return set.program + '?' + $.param(params) + '&' + set.queryKey + '=' + set.queryVal;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// Group results into categories
|
|
345
|
+
function _groupSetData(set, results) {
|
|
346
|
+
var grouped = {'':[]}, i, len;
|
|
347
|
+
|
|
348
|
+
if ($.exist(set.groupOrder)) {
|
|
349
|
+
for (i = 0, len = set.groupOrder.length; i < len; i++) {
|
|
350
|
+
grouped[set.groupOrder[i]] = [{label: set.groupOrder[i]}];
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
for (i = 0, len = results.length; i < len; i++) {
|
|
355
|
+
if (!$.exist(grouped[results[i][set.itemGroup]])) grouped[results[i][set.itemGroup]] = [{label: results[i][set.itemGroup]}];
|
|
356
|
+
grouped[results[i][set.itemGroup]].push(results[i]);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
results = [];
|
|
360
|
+
$.each(grouped, function(groupName, group) {
|
|
361
|
+
if (group.length > 1) {
|
|
362
|
+
if (!$.exist(groupName, true)) group.splice(0, 1);
|
|
363
|
+
$.merge(results, group);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
return results;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// Limit number of returned results
|
|
371
|
+
// Trigger grouping them or apply custom callback
|
|
372
|
+
function _handleSetData(set, results) {
|
|
373
|
+
results = results.slice(0, set.show);
|
|
374
|
+
if (set.callback && $.isFunction(set.callback)) results = set.callback.call(undefined, set, results) || [];
|
|
375
|
+
if (!set.group) return results;
|
|
376
|
+
return _groupSetData(set, results);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function _processSetData(set, suggestion, i, name, query) {
|
|
380
|
+
return $.autocompletion.processSetData(set, suggestion, i, name, query);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// Adjust columns width depends on columns number
|
|
384
|
+
// If column has assigned CSS "width" property with "!important" declaration, this will be respected
|
|
385
|
+
function _renderSetWidth(menu, classWrapper, className) {
|
|
386
|
+
var cols = 0, colsW = 0, styles, parts, menuW = menu.width();
|
|
387
|
+
className = '.' + className;
|
|
388
|
+
classWrapper = '.' + classWrapper;
|
|
389
|
+
|
|
390
|
+
$.each(menu.children(className), function() {
|
|
391
|
+
parts = $(this).attr('class').split(' ');
|
|
392
|
+
styles = $.cssStyle(classWrapper + ' .' + parts[1]) || $.cssStyle(classWrapper + ' .' + parts.join('.'));
|
|
393
|
+
|
|
394
|
+
if (styles.width && styles.width.indexOf('important') && styles.width.indexOf('auto') < 0 && styles.width.indexOf('initial') < 0 && styles.width.indexOf('inherit') < 0) {
|
|
395
|
+
if (styles.width.indexOf('%') > 0) colsW += menuW * parseFloat(styles.width) / 100;
|
|
396
|
+
else colsW += parseFloat(styles.width);
|
|
397
|
+
}
|
|
398
|
+
else if ($.hasContent($(this))) cols++;
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
if (cols) {
|
|
402
|
+
menuW -= colsW + 0.5;
|
|
403
|
+
var minW = parseFloat(menu.children(className).css('min-width')), colW = menuW / cols;
|
|
404
|
+
if (minW <= colW) menu.children(className).css('width', colW + 'px');
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// Pre-compile templates using Handlebars
|
|
409
|
+
function _renderSetTemplate(set) {
|
|
410
|
+
_setSetTemplateHeader(set);
|
|
411
|
+
|
|
412
|
+
if (!set.template || $.isEmptyObject(set.template)) return {};
|
|
413
|
+
|
|
414
|
+
$.each(set.template, function(k, obj) {
|
|
415
|
+
if ($.isObject(obj)) set.template[k] = obj.prop('outerHTML');
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
if (set.templateMerge) {
|
|
419
|
+
templateMerge('notFound');
|
|
420
|
+
templateMerge('pending');
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
$.each(set.template, function(k, obj) {
|
|
424
|
+
if ($.isString(obj)) set.template[k] = Handlebars.compile(obj);
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
return set.template;
|
|
428
|
+
|
|
429
|
+
function templateMerge(temp) {
|
|
430
|
+
if (set.template[temp] && $.isString(set.template[temp])) {
|
|
431
|
+
if (set.template.header && $.isString(set.template.header)) set.template[temp] = set.template.header + set.template[temp];
|
|
432
|
+
if (set.template.footer && $.isString(set.template.footer)) set.template[temp] += set.template.footer;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// Set default template to display column header if column name is defined
|
|
438
|
+
function _setSetTemplateHeader(set) {
|
|
439
|
+
if (!set.template.header && $.exist(set.name, true)) set.template.header = '<h5 class="tt-category">' + set.name + '</h5>';
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// Handle selected item based on "action_t" parameter
|
|
443
|
+
function _selectItem(item, target) {
|
|
444
|
+
if ($.exist(item.extra)) {
|
|
445
|
+
switch(item.extra.action_t) {
|
|
446
|
+
case 'C':
|
|
447
|
+
eval(item.extra.action); break;
|
|
448
|
+
case 'U':
|
|
449
|
+
document.location = item.extra.action; break;
|
|
450
|
+
case 'E':
|
|
451
|
+
target.typeahead('val', item.extra.action); break;
|
|
452
|
+
case undefined:
|
|
453
|
+
case '':
|
|
454
|
+
case 'S':
|
|
455
|
+
case 'Q':
|
|
456
|
+
default:
|
|
457
|
+
formSend(item.value); break;
|
|
458
|
+
}
|
|
459
|
+
} else {
|
|
460
|
+
formSend(item.value);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function formSend(val) { // Submit form on select
|
|
464
|
+
target.val(val);
|
|
465
|
+
target.closest('form').submit();
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function _getSelectableLabel(item) {
|
|
470
|
+
return $.exist(item.data()) ? item.data().ttSelectableDisplay : item.text();
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/* Handle Typeahead navigation */
|
|
474
|
+
|
|
475
|
+
// Navigate dropdown list left - right (switching between columns)
|
|
476
|
+
function _navCursorLR(code, cols, target) {
|
|
477
|
+
if (!$.exist(_navCols.cursor)) return;
|
|
478
|
+
|
|
479
|
+
var currCol = _navCols.cursor.parent(),
|
|
480
|
+
currColIdx = cols.index(currCol),
|
|
481
|
+
delta = code == 37 ? -1 : 1,
|
|
482
|
+
nextColItems = getNextColItems(currColIdx),
|
|
483
|
+
cursorIdx = $(currCol).children('.tt-selectable').index(_navCols.cursor),
|
|
484
|
+
nextCursor = $.exist(nextColItems[cursorIdx]) ? nextColItems[cursorIdx] : nextColItems[nextColItems.length - 1];
|
|
485
|
+
|
|
486
|
+
$(_navCols.cursor).removeClass('tt-cursor');
|
|
487
|
+
_navCols.cursor = $(nextCursor).addClass('tt-cursor');
|
|
488
|
+
target.data().ttTypeahead.input.setInputValue(_getSelectableLabel(_navCols.cursor));
|
|
489
|
+
|
|
490
|
+
function getNextColItems(currColIdx) {
|
|
491
|
+
var nextColIdx = code == 37
|
|
492
|
+
? $.exist(cols[currColIdx - 1]) ? currColIdx - 1 : cols.length - 1
|
|
493
|
+
: $.exist(cols[currColIdx + 1]) ? currColIdx + 1 : 0,
|
|
494
|
+
nextColItems = $(cols[nextColIdx]).children('.tt-selectable');
|
|
495
|
+
|
|
496
|
+
return $.exist(nextColItems) ? nextColItems : getNextColItems(nextColIdx);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// Navigate dropdown list up - down
|
|
501
|
+
function _navCursorUD(code, menu, target) {
|
|
502
|
+
if (!$.exist(menu.find('.tt-cursor'))) {
|
|
503
|
+
_navCols.cursor = code == 38 ? menu.find('.tt-selectable').last() : menu.find('.tt-selectable').first();
|
|
504
|
+
_navCols.cursor.addClass('tt-cursor');
|
|
505
|
+
_navCols.query = target.val();
|
|
506
|
+
target.data().ttTypeahead.input.setInputValue(_getSelectableLabel(_navCols.cursor));
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
var currCol = _navCols.cursor.parent(),
|
|
511
|
+
currColItems = $(currCol).children('.tt-selectable');
|
|
512
|
+
|
|
513
|
+
if(!$.exist(currColItems)) return;
|
|
514
|
+
|
|
515
|
+
var cursorIdx = currColItems.index(_navCols.cursor), delta = code == 38 ? -1 : 1;
|
|
516
|
+
|
|
517
|
+
$(_navCols.cursor).removeClass('tt-cursor');
|
|
518
|
+
|
|
519
|
+
if (!$.exist(currColItems[cursorIdx + delta])) {
|
|
520
|
+
_navCols.cursor = null;
|
|
521
|
+
target.data().ttTypeahead.input.resetInputValue();
|
|
522
|
+
target.data().ttTypeahead._updateHint();
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
_navCols.cursor = $(currColItems[cursorIdx + delta]).addClass('tt-cursor');
|
|
526
|
+
target.data().ttTypeahead.input.setInputValue(_getSelectableLabel(_navCols.cursor));
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
// Debug
|
|
531
|
+
function logDebug(options, input, output, msg) {
|
|
532
|
+
if (!_debug || !window.console) return;
|
|
533
|
+
|
|
534
|
+
console.log(msg);
|
|
535
|
+
console.log('Options: ', options);
|
|
536
|
+
console.log('Input: ', input);
|
|
537
|
+
console.log('Output: ', output);
|
|
538
|
+
console.log('--------');
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
function logInteraction(options, input, target, event) {
|
|
542
|
+
if (!options.logging || !$.exist(options.interactionLog, true)) return;
|
|
543
|
+
if (!input.dataset || !options.datasets[input.dataset]) return;
|
|
544
|
+
|
|
545
|
+
$.ajax({
|
|
546
|
+
dataType: 'jsonp',
|
|
547
|
+
type: 'GET',
|
|
548
|
+
url: getInteractionUrl(options.datasets[input.dataset], input),
|
|
549
|
+
}).fail(function(qXHR, textStatus, errorThrown) {
|
|
550
|
+
logDebug(options, input, qXHR, 'Interaction log error: ' + textStatus + ' ' + errorThrown);
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
function getInteractionUrl(set, suggestion) {
|
|
554
|
+
var params = {
|
|
555
|
+
collection: set.collection,
|
|
556
|
+
type: event,
|
|
557
|
+
partial_query: suggestion.query,
|
|
558
|
+
client_time: new Date().getTime()
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
if ($.exist(set.profile, true)) params['profile'] = set.profile;
|
|
562
|
+
if ($.exist(suggestion.extra)) params = $.extend(true, {}, params, suggestion.extra);
|
|
563
|
+
|
|
564
|
+
return options.interactionLog + '?' + $.param(params);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// Generate plugin
|
|
569
|
+
function Plugin() {
|
|
570
|
+
var args = [].slice.call(arguments), option = args.shift();
|
|
571
|
+
|
|
572
|
+
return this.each(function () {
|
|
573
|
+
var $this = $(this),
|
|
574
|
+
data = $this.data('flb.autocompletion'),
|
|
575
|
+
options = $.extend(true, {}, autocompletion.defaults, data || {}, $.isObject(option) && option);
|
|
576
|
+
|
|
577
|
+
if (!data && /destroy|hide/.test(option)) return;
|
|
578
|
+
if (!data) $this.data('flb.autocompletion', (data = new autocompletion(this, options)));
|
|
579
|
+
if ($.isString(option) && $.isFunction(data[option])) data[option].apply($this, args);
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
$.fn.autocompletion = Plugin;
|
|
584
|
+
$.fn.autocompletion.Constructor = autocompletion;
|
|
585
|
+
|
|
586
|
+
// List of predefined mapping functions
|
|
587
|
+
$.autocompletion = {
|
|
588
|
+
// Map /s/suggest.json output
|
|
589
|
+
processSetData: function(set, suggestion, i, name, query) {
|
|
590
|
+
var value = suggestion.key, label = suggestion.key;
|
|
591
|
+
if (suggestion.action_t == 'Q') value = suggestion.action;
|
|
592
|
+
if (suggestion.action_t == 'S') value = suggestion.disp;
|
|
593
|
+
if (suggestion.disp_t == 'C') label = eval(suggestion.disp);
|
|
594
|
+
else if (suggestion.disp) label = suggestion.disp;
|
|
595
|
+
|
|
596
|
+
return {
|
|
597
|
+
label : label,
|
|
598
|
+
value : value,
|
|
599
|
+
extra : suggestion,
|
|
600
|
+
category : suggestion.cat ? suggestion.cat : '',
|
|
601
|
+
rank : i + 1,
|
|
602
|
+
dataset : name,
|
|
603
|
+
query : query
|
|
604
|
+
};
|
|
605
|
+
},
|
|
606
|
+
|
|
607
|
+
// Map /s/search.json output
|
|
608
|
+
processSetDataFacets: function(set, suggestion, i, name, query) {
|
|
609
|
+
if (i !== 'response' || !$.exist(suggestion.facets)) return;
|
|
610
|
+
|
|
611
|
+
var suggestions = [], rank = 1;
|
|
612
|
+
for (var i = 0, leni = suggestion.facets.length; i < leni; i++) {
|
|
613
|
+
var facet = suggestion.facets[i];
|
|
614
|
+
|
|
615
|
+
if (!$.exist(facet.allValues)) continue;
|
|
616
|
+
if ($.exist(set.facets.blacklist) && set.facets.blacklist.indexOf(facet.name) > -1) continue;
|
|
617
|
+
if ($.exist(set.facets.whitelist) && set.facets.whitelist.indexOf(facet.name) < 0) continue;
|
|
618
|
+
|
|
619
|
+
for (var j = 0, lenj = facet.allValues.length; j < lenj; j++) {
|
|
620
|
+
if ($.exist(set.facets.show) && j > parseInt(set.facets.show) - 1) break;
|
|
621
|
+
if (!facet.allValues[j].count) continue;
|
|
622
|
+
|
|
623
|
+
suggestions.push({
|
|
624
|
+
label : facet.allValues[j].label,
|
|
625
|
+
value : facet.allValues[j].data,
|
|
626
|
+
extra : {
|
|
627
|
+
action : getUrl(facet.allValues[j]),
|
|
628
|
+
action_t: 'U'
|
|
629
|
+
},
|
|
630
|
+
category: facet.name,
|
|
631
|
+
rank : rank++,
|
|
632
|
+
dataset : name,
|
|
633
|
+
query : query
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
return suggestions;
|
|
639
|
+
|
|
640
|
+
function getUrl(facet) {
|
|
641
|
+
return ($.exist(set.facets.url, true) ? set.facets.url : window.location.origin + window.location.pathname) + facet.toggleUrl;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
// Helpers
|
|
647
|
+
$.exist = function(obj, bString) { if (!$.isDefinied(bString)) bString = false; var obj = bString ? obj : $(obj); return $.isDefinied(obj) && obj != null && ($.isString(obj) ? obj + '' : obj).length > 0; }
|
|
648
|
+
$.hasContent = function(obj) { return obj.html().trim().length ? true : false; }
|
|
649
|
+
$.isDefinied = function(obj) { return typeof(obj) !== 'undefined'; }
|
|
650
|
+
$.isFunction = function(obj) { return typeof(obj) === 'function'; }
|
|
651
|
+
$.isString = function(obj) { return typeof(obj) === 'string'; }
|
|
652
|
+
$.isObject = function(obj) { return typeof(obj) === 'object'; }
|
|
653
|
+
$.dataKeys = function(obj) { return iterateKeys(obj, ''); function iterateKeys(obj, prefix) { return $.map(Object.keys(obj), function(key) { if(obj[key] && $.isObject(obj[key])) return iterateKeys(obj[key], key); else return (prefix ? prefix + '-' + key : key);}); }}
|
|
654
|
+
$.dataVals = function(obj, key) { var parts = key.split('.'), key = parts.shift(); if (parts.length) { for (var i = 0, len = parts.length; i < len; i++) { obj = obj[key] || {}; key = parts[i]; } } return obj[key]; }
|
|
655
|
+
$.cssStyle = function(className) {
|
|
656
|
+
var styleSheets = window.document.styleSheets, styles = {};
|
|
657
|
+
for(var i = 0, leni = styleSheets.length; i < leni; i++){
|
|
658
|
+
if (styleSheets[i].href && styleSheets[i].href.indexOf(window.location.host) < 0) continue;
|
|
659
|
+
|
|
660
|
+
var classes = styleSheets[i].rules || styleSheets[i].cssRules;
|
|
661
|
+
if (!classes) continue;
|
|
662
|
+
|
|
663
|
+
for (var j = 0, lenj = classes.length; j < lenj; j++) {
|
|
664
|
+
if (classes[j].selectorText != className) continue;
|
|
665
|
+
|
|
666
|
+
var properties = classes[j].style.cssText.split(';');
|
|
667
|
+
for (var k = 0, lenk = properties.length; k < lenk; k++) {
|
|
668
|
+
var part = properties[k].split(':');
|
|
669
|
+
if (part.length == 2) styles[part[0].trim()] = part[1].trim();
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
return styles;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
}(jQuery));
|
|
677
|
+
|
|
678
|
+
String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); }
|