acinguiux-preact-components 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +56 -0
- package/src/content/themes/theme-acinguiux-amg/theme-acinguiux-amg.css +23 -0
- package/src/content/themes/theme-acinguiux-cafe/theme-acinguiux-cafe.css +47 -0
- package/src/content/themes/theme-acinguiux-energy/theme-acinguiux-energy.css +45 -0
- package/src/content/themes/theme-acinguiux-livewire/theme-acinguiux-livewire.css +22 -0
- package/src/content/themes/theme-acinguiux-livewire-italy/theme-acinguiux-livewire-italy.css +22 -0
- package/src/content/themes/theme-acinguiux-recharge/theme-acinguiux-recharge.css +49 -0
- package/src/content/themes/theme-allon/theme-allon.css +25 -0
- package/src/content/themes/theme-atlas/theme-atlas.css +31 -0
- package/src/content/themes/theme-aurvana/resources/favicon/apple-touch-icon.png +0 -0
- package/src/content/themes/theme-aurvana/resources/favicon/favico.ico +0 -0
- package/src/content/themes/theme-aurvana/resources/favicon/favicon-96x96.png +0 -0
- package/src/content/themes/theme-aurvana/resources/favicon/favicon.ico +0 -0
- package/src/content/themes/theme-aurvana/resources/favicon/favicon.png +0 -0
- package/src/content/themes/theme-aurvana/resources/favicon/favicon.svg +13 -0
- package/src/content/themes/theme-aurvana/resources/favicon/google-touch-icon.png +0 -0
- package/src/content/themes/theme-aurvana/resources/favicon/manifest.json +14 -0
- package/src/content/themes/theme-aurvana/resources/favicon/site.webmanifest +21 -0
- package/src/content/themes/theme-aurvana/resources/favicon/web-app-manifest-192x192.png +0 -0
- package/src/content/themes/theme-aurvana/resources/favicon/web-app-manifest-512x512.png +0 -0
- package/src/content/themes/theme-aurvana/theme-aurvana.css +49 -0
- package/src/content/themes/theme-base/theme-base.css +49 -0
- package/src/content/themes/theme-base2/resources/favicon/android-chrome-192x192.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/android-chrome-512x512.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/apple-touch-icon.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/favico.ico +0 -0
- package/src/content/themes/theme-base2/resources/favicon/favicon-16x16.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/favicon-32x32.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/favicon-96x96.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/favicon.ico +0 -0
- package/src/content/themes/theme-base2/resources/favicon/favicon.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/favicon.svg +9 -0
- package/src/content/themes/theme-base2/resources/favicon/google-touch-icon.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/manifest.json +14 -0
- package/src/content/themes/theme-base2/resources/favicon/site.webmanifest +1 -0
- package/src/content/themes/theme-base2/resources/favicon/web-app-manifest-192x192.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/web-app-manifest-512x512.png +0 -0
- package/src/content/themes/theme-base2/resources/fonts/acinguiux-typeface-la-heavy-221208.woff2 +0 -0
- package/src/content/themes/theme-base2/theme-base2.css +47 -0
- package/src/content/themes/theme-eco-marathon/theme-eco-marathon.css +22 -0
- package/src/content/themes/theme-energy-transition-campus-amsterdam/theme-energy-transition-campus-amsterdam.css +26 -0
- package/src/content/themes/theme-evpass/theme-evpass.css +46 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/apple-touch-icon.png +0 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/favico.ico +0 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/favicon-96x96.png +0 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/favicon.ico +0 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/favicon.png +0 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/favicon.svg +9 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/google-touch-icon.png +0 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/manifest.json +14 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/site.webmanifest +21 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/web-app-manifest-192x192.png +0 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/web-app-manifest-512x512.png +0 -0
- package/src/content/themes/theme-nam-2025/theme-nam-2025.css +47 -0
- package/src/content/themes/theme-pennzoil/theme-pennzoil.css +36 -0
- package/src/content/themes/theme-quaker-state/theme-quaker-state.css +63 -0
- package/src/content/themes/theme-tafawoq/theme-tafawoq.css +26 -0
- package/src/content/themes/theme-vegetable/resources/favicon/apple-touch-icon.png +0 -0
- package/src/content/themes/theme-vegetable/resources/favicon/favico.ico +0 -0
- package/src/content/themes/theme-vegetable/resources/favicon/favicon-96x96.png +0 -0
- package/src/content/themes/theme-vegetable/resources/favicon/favicon.ico +0 -0
- package/src/content/themes/theme-vegetable/resources/favicon/favicon.png +0 -0
- package/src/content/themes/theme-vegetable/resources/favicon/favicon.svg +13 -0
- package/src/content/themes/theme-vegetable/resources/favicon/google-touch-icon.png +0 -0
- package/src/content/themes/theme-vegetable/resources/favicon/manifest.json +14 -0
- package/src/content/themes/theme-vegetable/resources/favicon/site.webmanifest +21 -0
- package/src/content/themes/theme-vegetable/resources/favicon/web-app-manifest-192x192.png +0 -0
- package/src/content/themes/theme-vegetable/resources/favicon/web-app-manifest-512x512.png +0 -0
- package/src/content/themes/theme-vegetable/theme-vegetable.css +49 -0
- package/src/content/themes/theme-zeolyst/resources/fonts/type-ar-medium.woff2 +0 -0
- package/src/content/themes/theme-zeolyst/theme-zeolyst.css +29 -0
- package/src/main/atoms/audio.js +16 -0
- package/src/main/atoms/box.js +5 -0
- package/src/main/atoms/button.js +40 -0
- package/src/main/atoms/card.js +22 -0
- package/src/main/atoms/form.js +30 -0
- package/src/main/atoms/heading.js +17 -0
- package/src/main/atoms/icon.js +24 -0
- package/src/main/atoms/img.js +131 -0
- package/src/main/atoms/input.js +55 -0
- package/src/main/atoms/link-text.js +21 -0
- package/src/main/atoms/link.js +60 -0
- package/src/main/atoms/list.js +12 -0
- package/src/main/atoms/logo.js +9 -0
- package/src/main/atoms/menu.js +10 -0
- package/src/main/atoms/message.js +5 -0
- package/src/main/atoms/nav-link.js +49 -0
- package/src/main/atoms/popup.js +47 -0
- package/src/main/atoms/rich-text.js +128 -0
- package/src/main/atoms/scroller.js +224 -0
- package/src/main/atoms/svg.js +65 -0
- package/src/main/atoms/table.js +32 -0
- package/src/main/atoms/textarea.js +10 -0
- package/src/main/atoms/time.js +12 -0
- package/src/main/atoms/video.js +100 -0
- package/src/main/export-main.js +12 -0
- package/src/main/export-matter.js +86 -0
- package/src/main/export-preact-hooks.js +1 -0
- package/src/main/export-preact.js +1 -0
- package/src/main/index.js +13 -0
- package/src/main/molecules/asset.js +23 -0
- package/src/main/molecules/glossary.js +44 -0
- package/src/main/molecules/links.js +23 -0
- package/src/main/molecules/promo-text.js +27 -0
- package/src/main/molecules/tags.js +15 -0
- package/src/main/molecules/tree.js +51 -0
- package/src/main/organisms/accordion-item.js +106 -0
- package/src/main/organisms/author.js +29 -0
- package/src/main/organisms/breadcrumb.js +69 -0
- package/src/main/organisms/call-to-action.js +24 -0
- package/src/main/organisms/carousel.js +178 -0
- package/src/main/organisms/cart-item.js +156 -0
- package/src/main/organisms/cart.js +162 -0
- package/src/main/organisms/contact-form.js +141 -0
- package/src/main/organisms/container/ab-test.js +47 -0
- package/src/main/organisms/container/default.js +6 -0
- package/src/main/organisms/container/filtered-section.js +293 -0
- package/src/main/organisms/container/footer.js +12 -0
- package/src/main/organisms/container/grid.js +44 -0
- package/src/main/organisms/container/header.js +13 -0
- package/src/main/organisms/container/list.js +7 -0
- package/src/main/organisms/container/main.js +6 -0
- package/src/main/organisms/container/raw.js +7 -0
- package/src/main/organisms/container/section.js +28 -0
- package/src/main/organisms/container.js +29 -0
- package/src/main/organisms/content-owner.js +15 -0
- package/src/main/organisms/date-entry.js +56 -0
- package/src/main/organisms/external-search.js +73 -0
- package/src/main/organisms/filtered-item.js +163 -0
- package/src/main/organisms/footer-item.js +17 -0
- package/src/main/organisms/image-gallery.js +164 -0
- package/src/main/organisms/last-modified.js +20 -0
- package/src/main/organisms/legal-footer.js +16 -0
- package/src/main/organisms/list-item.js +48 -0
- package/src/main/organisms/metadata.js +11 -0
- package/src/main/organisms/navigation.js +232 -0
- package/src/main/organisms/notification.js +87 -0
- package/src/main/organisms/order-tracker.js +203 -0
- package/src/main/organisms/page-header-banner.js +26 -0
- package/src/main/organisms/page-header.js +33 -0
- package/src/main/organisms/page-tags.js +14 -0
- package/src/main/organisms/page.js +260 -0
- package/src/main/organisms/press-release.js +24 -0
- package/src/main/organisms/product-admin.js +204 -0
- package/src/main/organisms/promo-banner.js +28 -0
- package/src/main/organisms/promo-bottom.js +23 -0
- package/src/main/organisms/promo-button.js +8 -0
- package/src/main/organisms/promo-card-cover.js +35 -0
- package/src/main/organisms/promo-card.js +33 -0
- package/src/main/organisms/promo-full.js +20 -0
- package/src/main/organisms/promo-image.js +22 -0
- package/src/main/organisms/promo-lure.js +22 -0
- package/src/main/organisms/promo-product-card.js +187 -0
- package/src/main/organisms/promo-product-full.js +293 -0
- package/src/main/organisms/promo-simple.js +23 -0
- package/src/main/organisms/quote.js +21 -0
- package/src/main/organisms/search-form.js +42 -0
- package/src/main/organisms/search-nav.js +66 -0
- package/src/main/organisms/search-result.js +53 -0
- package/src/main/organisms/slider.js +26 -0
- package/src/main/organisms/standalone-asset.js +22 -0
- package/src/main/organisms/tabs.js +277 -0
- package/src/main/organisms/topbar.js +83 -0
- package/src/main/organisms/web-component.js +53 -0
- package/src/main/routing/annotation.js +9 -0
- package/src/main/routing/component.js +138 -0
- package/src/main/routing/empty.js +5 -0
- package/src/main/routing/error-handler.js +64 -0
- package/src/main/routing/placeholder-image.svg +5 -0
- package/src/main/routing/router.js +219 -0
- package/src/main/shared/analytics.js +677 -0
- package/src/main/shared/bubble-event.js +11 -0
- package/src/main/shared/custom-element.js +21 -0
- package/src/main/shared/deep-selector.js +28 -0
- package/src/main/shared/disable-transparency.js +10 -0
- package/src/main/shared/format-time.js +8 -0
- package/src/main/shared/get-id.js +5 -0
- package/src/main/shared/get-meta.js +3 -0
- package/src/main/shared/get-size-class.js +3 -0
- package/src/main/shared/get-size.js +11 -0
- package/src/main/shared/h.js +88 -0
- package/src/main/shared/hash-jump.js +33 -0
- package/src/main/shared/icons/arrow-back.svg +1 -0
- package/src/main/shared/icons/arrow-down.svg +1 -0
- package/src/main/shared/icons/arrow-next.svg +1 -0
- package/src/main/shared/icons/arrow-tail-right.svg +1 -0
- package/src/main/shared/icons/arrow-tail-up.svg +1 -0
- package/src/main/shared/icons/arrow-up.svg +1 -0
- package/src/main/shared/icons/asset-download.svg +1 -0
- package/src/main/shared/icons/logo.svg +5 -0
- package/src/main/shared/icons/low-carbon-placeholder.svg +9 -0
- package/src/main/shared/icons/media-pause.svg +1 -0
- package/src/main/shared/icons/media-play.svg +1 -0
- package/src/main/shared/icons/navigation-burger.svg +1 -0
- package/src/main/shared/icons/navigation-close.svg +1 -0
- package/src/main/shared/icons/navigation-link.svg +1 -0
- package/src/main/shared/icons/navigation-refresh.svg +1 -0
- package/src/main/shared/icons/navigation-search.svg +1 -0
- package/src/main/shared/icons/navigation-share.svg +1 -0
- package/src/main/shared/icons/toggle-newwindow.svg +1 -0
- package/src/main/shared/icons.js +18 -0
- package/src/main/shared/id-from-string.js +5 -0
- package/src/main/shared/mark-selection.js +19 -0
- package/src/main/shared/register.js +26 -0
- package/src/main/shared/renderer.js +43 -0
- package/src/main/shared/simple-consent-api.js +70 -0
- package/src/main/shared/split-links.js +11 -0
- package/src/main/shared/t.js +60 -0
- package/src/main/shared/twind.js +837 -0
- package/src/main/shared/update-head.js +34 -0
- package/src/main/shared/update-scrollbar-width.js +30 -0
- package/src/main/shared/use-link.js +151 -0
- package/src/main/shared/use-persistent-state.js +42 -0
- package/src/main/shared/wait-for-dom-ready.js +6 -0
- package/src/main/shared/wcm-mode.js +4 -0
- package/src/wcs/components/acinguiux-preact-doc/acinguiux-preact-doc.js +207 -0
- package/src/wcs/components/admin-dashboard/admin-dashboard.js +487 -0
- package/src/wcs/components/admin-login/admin-login.js +91 -0
- package/src/wcs/components/bazaar-voice/bazaar-voice.js +56 -0
- package/src/wcs/components/chatbot-koreai/chatbot-koreai.js +176 -0
- package/src/wcs/components/chatbot-koreai/koreai-transport.js +217 -0
- package/src/wcs/components/chatbot-ms/chatbot-ms.js +210 -0
- package/src/wcs/components/chatbot-test/chatbot-test.js +44 -0
- package/src/wcs/components/comparison-chart/comparison-chart.js +111 -0
- package/src/wcs/components/consent-banner/consent-banner.js +248 -0
- package/src/wcs/components/consent-banner/icons/ccpa.svg +6 -0
- package/src/wcs/components/consent-banner/icons/info.svg +1 -0
- package/src/wcs/components/consent-banner/provider-onetrust.js +131 -0
- package/src/wcs/components/decision-tree/arrow-back.svg +3 -0
- package/src/wcs/components/decision-tree/badges.js +37 -0
- package/src/wcs/components/decision-tree/decision-tree.js +162 -0
- package/src/wcs/components/dynamic-contact-details/dynamic-contact-details.js +111 -0
- package/src/wcs/components/example-accordion/example-accordion.js +10 -0
- package/src/wcs/components/example-asset/example-asset.js +12 -0
- package/src/wcs/components/example-form/example-form.js +59 -0
- package/src/wcs/components/example-nested/example-nested.js +10 -0
- package/src/wcs/components/example-routing/example-routing.js +51 -0
- package/src/wcs/components/example-rtl/example-rtl.js +28 -0
- package/src/wcs/components/example-tabs/example-tabs.js +12 -0
- package/src/wcs/components/example-web-component/example-web-component.js +34 -0
- package/src/wcs/components/floating-button/floating-button.js +17 -0
- package/src/wcs/components/formstack-form/fields/address.js +38 -0
- package/src/wcs/components/formstack-form/fields/checkbox.js +42 -0
- package/src/wcs/components/formstack-form/fields/date.js +22 -0
- package/src/wcs/components/formstack-form/fields/description.js +8 -0
- package/src/wcs/components/formstack-form/fields/input.js +8 -0
- package/src/wcs/components/formstack-form/fields/name.js +39 -0
- package/src/wcs/components/formstack-form/fields/radio.js +24 -0
- package/src/wcs/components/formstack-form/fields/rating.js +53 -0
- package/src/wcs/components/formstack-form/fields/section.js +8 -0
- package/src/wcs/components/formstack-form/fields/select.js +10 -0
- package/src/wcs/components/formstack-form/fields/textarea.js +8 -0
- package/src/wcs/components/formstack-form/fields/wrapper.js +11 -0
- package/src/wcs/components/formstack-form/formstack-form.js +280 -0
- package/src/wcs/components/fuel-prices/fuel-prices.js +45 -0
- package/src/wcs/components/furniture-overview/furniture-overview.js +115 -0
- package/src/wcs/components/gauge-value/gauge-value.js +65 -0
- package/src/wcs/components/help-centre/api.js +150 -0
- package/src/wcs/components/help-centre/help-centre.js +400 -0
- package/src/wcs/components/help-centre/icon-search.svg +1 -0
- package/src/wcs/components/image-gen/admin-panel.js +248 -0
- package/src/wcs/components/image-gen/image-gen.js +385 -0
- package/src/wcs/components/image-gen/labels.js +37 -0
- package/src/wcs/components/image-gen/use-api.js +392 -0
- package/src/wcs/components/inspired-gallery/inspired-gallery.js +118 -0
- package/src/wcs/components/launch-container/launch-container.js +95 -0
- package/src/wcs/components/launch-container/ledger.js +140 -0
- package/src/wcs/components/lng-map/lng-map.js +44 -0
- package/src/wcs/components/mouseflow-analytics/mouseflow-analytics.js +39 -0
- package/src/wcs/components/msds-search/msds-search.js +127 -0
- package/src/wcs/components/msds-search/navigation-search.svg +3 -0
- package/src/wcs/components/product-catalogue/icon-back.svg +3 -0
- package/src/wcs/components/product-catalogue/icon-cart.svg +3 -0
- package/src/wcs/components/product-catalogue/icon-close.svg +3 -0
- package/src/wcs/components/product-catalogue/product-catalogue.js +215 -0
- package/src/wcs/components/product-links/icon-cart.svg +3 -0
- package/src/wcs/components/product-links/product-links.js +43 -0
- package/src/wcs/components/rio-iframe/rio-iframe.js +137 -0
- package/src/wcs/components/salsify-products/filter-tools.js +60 -0
- package/src/wcs/components/salsify-products/icon-cart.svg +3 -0
- package/src/wcs/components/salsify-products/process-products.js +53 -0
- package/src/wcs/components/salsify-products/route-tools.js +54 -0
- package/src/wcs/components/salsify-products/salsify-products.js +281 -0
- package/src/wcs/components/shout-out/shout-out.js +51 -0
- package/src/wcs/components/simple-chart/simple-chart.js +53 -0
- package/src/wcs/components/single-stat/single-stat.js +85 -0
- package/src/wcs/components/site-feedback/site-feedback.js +56 -0
- package/src/wcs/components/skds-search/navigation-search.svg +3 -0
- package/src/wcs/components/skds-search/skds-search.js +103 -0
- package/src/wcs/components/smart-banner/smart-banner.js +104 -0
- package/src/wcs/components/standalone-table/arrow-up-down.svg +3 -0
- package/src/wcs/components/standalone-table/arrow-up.svg +3 -0
- package/src/wcs/components/standalone-table/standalone-table.js +440 -0
- package/src/wcs/components/station-locator/station-locator.js +49 -0
- package/src/wcs/components/store-badges/badges.js +60 -0
- package/src/wcs/components/store-badges/store-badges.js +93 -0
- package/src/wcs/components/topbar-button/person.svg +1 -0
- package/src/wcs/components/topbar-button/topbar-button.js +22 -0
- package/src/wcs/components/universal-gallery/universal-gallery.js +308 -0
- package/src/wcs/components/zendesk-chat/zendesk-chat.js +133 -0
- package/src/wcs/shared/chat-bot/README.md +61 -0
- package/src/wcs/shared/chat-bot/chat-bot.js +216 -0
- package/src/wcs/shared/chat-bot/resources/arrow-next.svg +1 -0
- package/src/wcs/shared/chat-bot/resources/navigation-close.svg +1 -0
- package/src/wcs/shared/chat-bot/resources/person.svg +1 -0
- package/src/wcs/shared/chat-bot/resources/upload.svg +1 -0
- package/src/wcs/shared/filtered-data/README.md +52 -0
- package/src/wcs/shared/filtered-data/fetch-data.js +33 -0
- package/src/wcs/shared/filtered-data/filtered-data.js +337 -0
- package/src/wcs/shared/promo-with-popup/icon-close.svg +3 -0
- package/src/wcs/shared/promo-with-popup/icon-next.svg +3 -0
- package/src/wcs/shared/promo-with-popup/icon-prev.svg +3 -0
- package/src/wcs/shared/promo-with-popup/promo-with-popup.js +93 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const { h, register, matter, preactHooks } = globalThis.ami
|
|
2
|
+
const { Box, SVG } = matter
|
|
3
|
+
const { useState, useEffect } = preactHooks
|
|
4
|
+
|
|
5
|
+
function StatContent ({ data }) {
|
|
6
|
+
const alignmentMap = { right: 'justify-end', center: 'justify-center' }
|
|
7
|
+
const alignmentClass = alignmentMap[data.customModel.elements.alignment.value] ?? ''
|
|
8
|
+
const prefix = data.customModel.elements.prefix?.value
|
|
9
|
+
const suffix = data.customModel.elements.suffix?.value
|
|
10
|
+
|
|
11
|
+
return h('div', { className: 'grow items-center h-full' },
|
|
12
|
+
h('div', { className: 'text-lg font-custom font-bold' }, data.customModel.elements.label.value),
|
|
13
|
+
h('div', { className: `grow flex items-end ${alignmentClass}` },
|
|
14
|
+
prefix && h('div', { className: 'flex items-end text-xl font-custom font-bold' },
|
|
15
|
+
h('div', { className: 'mr-1 mb-1' }, prefix)
|
|
16
|
+
),
|
|
17
|
+
h('div', { className: 'flex items-end text-5xl font-custom font-bold' },
|
|
18
|
+
h('div', data.customModel.elements.value.value)
|
|
19
|
+
),
|
|
20
|
+
suffix && h('div', { className: 'flex items-end text-xl font-custom font-bold' },
|
|
21
|
+
h('div', { className: 'ml-1 mb-1' }, suffix)
|
|
22
|
+
)
|
|
23
|
+
)
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function SingleStat ({ src }) {
|
|
28
|
+
if (!src) {
|
|
29
|
+
console.error('Missing data source.')
|
|
30
|
+
return null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const [data, setData] = useState()
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
(async () => {
|
|
36
|
+
const res = await fetch(src)
|
|
37
|
+
if (!res.ok) {
|
|
38
|
+
console.error(`Error fetching ${src}. Status: ${res.status}`)
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
const json = await res.json()
|
|
42
|
+
setData(json)
|
|
43
|
+
})().catch(console.error)
|
|
44
|
+
}, [src])
|
|
45
|
+
|
|
46
|
+
if (!data) {
|
|
47
|
+
return null
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const alignment = data.customModel.elements.alignment?.value
|
|
51
|
+
const icon = data.customModel.elements.icon?.value
|
|
52
|
+
|
|
53
|
+
return h(Box, {
|
|
54
|
+
_style: id => `${id} svg path { fill: currentColor }`,
|
|
55
|
+
className: 'text-center rounded-2xl w-full text-txa bg-bga',
|
|
56
|
+
children: h('div', { className: 'items-center h-full text-center w-full' },
|
|
57
|
+
h('div', { className: 'grow items-center h-full justify-center' },
|
|
58
|
+
h('div', { className: 'grow flex items-center h-full justify-center' },
|
|
59
|
+
alignment === 'left' && h('div', { className: 'flex items-end align-bottom' },
|
|
60
|
+
icon && h('div', { className: 'block w-14 h-14' },
|
|
61
|
+
h(SVG, { _model: { src: icon } })
|
|
62
|
+
),
|
|
63
|
+
icon && h('div', { className: 'w-4' }, ''),
|
|
64
|
+
h(StatContent, { data })
|
|
65
|
+
),
|
|
66
|
+
alignment === 'right' && h('div', { className: 'flex items-end align-bottom' },
|
|
67
|
+
h(StatContent, { data }),
|
|
68
|
+
icon && h('div', { className: 'w-4' }, ''),
|
|
69
|
+
icon && h('div', { className: 'block w-14 h-14' },
|
|
70
|
+
h(SVG, { _model: { src: icon } })
|
|
71
|
+
)
|
|
72
|
+
),
|
|
73
|
+
alignment === 'center' && h('div', { className: 'flex items-end align-bottom justify-center' },
|
|
74
|
+
h(StatContent, { data })
|
|
75
|
+
)
|
|
76
|
+
),
|
|
77
|
+
h('div', { className: 'grow flex items-center h-full justify-center mt-2' },
|
|
78
|
+
h('div', { className: 'text-xs' }, data.customModel.elements.supportingInfo.value)
|
|
79
|
+
)
|
|
80
|
+
)
|
|
81
|
+
)
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
register(SingleStat, 'single-stat')
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { FloatingButton } from '../floating-button/floating-button.js'
|
|
2
|
+
import { FormstackForm } from '../formstack-form/formstack-form.js'
|
|
3
|
+
const { h, register, matter, preactHooks } = globalThis.ami
|
|
4
|
+
const { useState } = preactHooks
|
|
5
|
+
const { Popup, Button } = matter
|
|
6
|
+
|
|
7
|
+
const ICON_CLOSE = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
8
|
+
<polygon fill="#595959" points="19.293 3.293 20.707 4.707 13.414 12 20.707 19.293 19.293 20.707 12 13.414 4.707 20.707 3.293 19.293 10.586 12 3.293 4.707 4.707 3.293 12 10.586"/>
|
|
9
|
+
</svg>`
|
|
10
|
+
|
|
11
|
+
const DEFAULTS = {
|
|
12
|
+
BUTTON_TEXT: 'Feedback',
|
|
13
|
+
CLOSE_TEXT: 'Close'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function SiteFeedback (props) {
|
|
17
|
+
const {
|
|
18
|
+
'button-text': buttonText = DEFAULTS.BUTTON_TEXT,
|
|
19
|
+
'close-text': closeText = DEFAULTS.CLOSE_TEXT,
|
|
20
|
+
'form-id': formId,
|
|
21
|
+
} = props
|
|
22
|
+
|
|
23
|
+
const [show, setShow] = useState(false)
|
|
24
|
+
|
|
25
|
+
if (!formId) {
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return [
|
|
30
|
+
h(FloatingButton, { label: buttonText, onClick: () => setShow(true) }),
|
|
31
|
+
h(Popup, { _show: show, _layout: 'center', 'aria-label': buttonText },
|
|
32
|
+
h('div', { className: 'flex justify-end' },
|
|
33
|
+
h(Button, {
|
|
34
|
+
_variant: 'plain',
|
|
35
|
+
_textless: true,
|
|
36
|
+
_size: 'xs',
|
|
37
|
+
_model: {
|
|
38
|
+
icon: ICON_CLOSE,
|
|
39
|
+
name: closeText
|
|
40
|
+
},
|
|
41
|
+
onClick: event => {
|
|
42
|
+
event.preventDefault()
|
|
43
|
+
setShow(false)
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
),
|
|
47
|
+
h('div', {
|
|
48
|
+
// Reset padding in the inner Box.
|
|
49
|
+
_style: id => `${id} form > div { padding: 0 }`,
|
|
50
|
+
children: h(FormstackForm, props)
|
|
51
|
+
})
|
|
52
|
+
)
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
register(SiteFeedback, 'site-feedback')
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
2
|
+
<path fill="#595959" d="M10.5,2 C15.1944204,2 19,5.80557963 19,10.5 C19,12.4865245 18.3185332,14.3138839 17.1766205,15.7610573 L21.7071068,20.2928932 L20.2928932,21.7071068 L15.7610573,17.1766205 C14.3138839,18.3185332 12.4865245,19 10.5,19 C5.80557963,19 2,15.1944204 2,10.5 C2,5.80557963 5.80557963,2 10.5,2 Z M10.5,4 C6.91014913,4 4,6.91014913 4,10.5 C4,14.0898509 6.91014913,17 10.5,17 C14.0898509,17 17,14.0898509 17,10.5 C17,6.91014913 14.0898509,4 10.5,4 Z"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import Excel from 'exceljs'
|
|
2
|
+
|
|
3
|
+
import ICON_NAVIGATION_SEARCH from './navigation-search.svg'
|
|
4
|
+
|
|
5
|
+
const { h, register, matter, preactHooks } = globalThis.ami
|
|
6
|
+
const { Box, Button, Form, Input, Table } = matter
|
|
7
|
+
const { useState, useEffect } = preactHooks
|
|
8
|
+
|
|
9
|
+
function SKDSSearch ({ src }) {
|
|
10
|
+
const [data, setData] = useState()
|
|
11
|
+
const [inputValue, setInputValue] = useState('')
|
|
12
|
+
|
|
13
|
+
if (!src) {
|
|
14
|
+
console.error('Missing document source.')
|
|
15
|
+
return null
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
(async function () {
|
|
20
|
+
const res = await fetch(src)
|
|
21
|
+
const buf = await res.arrayBuffer()
|
|
22
|
+
|
|
23
|
+
const workbook = new Excel.Workbook()
|
|
24
|
+
await workbook.xlsx.load(buf)
|
|
25
|
+
setData({ all: processWorksheets(workbook.worksheets), filtered: [], query: null })
|
|
26
|
+
})().catch(console.error)
|
|
27
|
+
}, [src])
|
|
28
|
+
|
|
29
|
+
if (!data) {
|
|
30
|
+
return null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return h(Box, { className: 'bg-bga text-txa rounded-2xl' },
|
|
34
|
+
h(Form, {
|
|
35
|
+
onSubmit: event => {
|
|
36
|
+
event.preventDefault()
|
|
37
|
+
const query = inputValue.trim()
|
|
38
|
+
const filtered = data.all.filter(row => row.BRN === query)
|
|
39
|
+
setData({ all: data.all, filtered, query })
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
h('div', { className: 'flex gap-5' },
|
|
43
|
+
h('div', { className: 'grow' },
|
|
44
|
+
h(Input, {
|
|
45
|
+
placeholder: 'Enter your BRN',
|
|
46
|
+
type: 'search',
|
|
47
|
+
value: inputValue,
|
|
48
|
+
onInput: e => setInputValue(e.target.value)
|
|
49
|
+
})
|
|
50
|
+
),
|
|
51
|
+
h('div', { className: 'grow-0' },
|
|
52
|
+
h(Button, {
|
|
53
|
+
type: 'submit',
|
|
54
|
+
_textless: true,
|
|
55
|
+
_model: {
|
|
56
|
+
name: 'Search',
|
|
57
|
+
title: 'Search',
|
|
58
|
+
icon: ICON_NAVIGATION_SEARCH
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
))
|
|
62
|
+
),
|
|
63
|
+
data.query !== null && data.filtered.length === 0 && h('p', 'No records found.'),
|
|
64
|
+
data.filtered.length > 0 && [
|
|
65
|
+
h('p', `Found ${data.filtered.length} record(s).`),
|
|
66
|
+
h(Table,
|
|
67
|
+
h('tr', Object.keys(data.all[0]).map(key =>
|
|
68
|
+
h('th', key)
|
|
69
|
+
)),
|
|
70
|
+
data.filtered.map(row =>
|
|
71
|
+
h('tr', Object.values(row).map(value =>
|
|
72
|
+
h('td', value)
|
|
73
|
+
))
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
]
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function processWorksheets (worksheets) {
|
|
81
|
+
if (worksheets.length < 1) {
|
|
82
|
+
throw new Error('No sheets found in the document.')
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const data = []
|
|
86
|
+
let headers
|
|
87
|
+
for (const row of worksheets[0]._rows) {
|
|
88
|
+
if (row.number === 1) {
|
|
89
|
+
headers = row._cells.map(cell => cell.value)
|
|
90
|
+
continue
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const obj = row._cells.reduce((acc, cell, ii) => {
|
|
94
|
+
acc[headers[ii]] = cell.value?.toString?.()?.trim?.()
|
|
95
|
+
return acc
|
|
96
|
+
}, {})
|
|
97
|
+
|
|
98
|
+
data.push(obj)
|
|
99
|
+
}
|
|
100
|
+
return data
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
register(SKDSSearch, 'skds-search')
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/* global localStorage */
|
|
2
|
+
import { NAVIGATION_CLOSE } from '#acinguiux-preact/main/shared/icons.js'
|
|
3
|
+
|
|
4
|
+
const { h, register, preactHooks, matter } = globalThis.ami
|
|
5
|
+
const { useState, useEffect } = preactHooks
|
|
6
|
+
const { Icon, Img } = matter
|
|
7
|
+
|
|
8
|
+
// Expire after 7 days (the value is in milliseconds).
|
|
9
|
+
const RETENTION = 604_800_000
|
|
10
|
+
const STORAGE_KEY = 'suppressed-smart-banners'
|
|
11
|
+
|
|
12
|
+
function getPlatform () {
|
|
13
|
+
if (/iPad|iPhone|iPod/.test(navigator.userAgent)) {
|
|
14
|
+
return 'ios'
|
|
15
|
+
} else if (/android/i.test(navigator.userAgent)) {
|
|
16
|
+
return 'android'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return null
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function isHidden (url) {
|
|
23
|
+
const obj = JSON.parse(localStorage.getItem(STORAGE_KEY)) ?? {}
|
|
24
|
+
const date = new Date(obj[url] ?? null)
|
|
25
|
+
if (Date.parse(date) + RETENTION < Date.now()) {
|
|
26
|
+
delete obj[url]
|
|
27
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(obj))
|
|
28
|
+
return false
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return true
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function hide (url) {
|
|
35
|
+
const obj = JSON.parse(localStorage.getItem(STORAGE_KEY)) ?? {}
|
|
36
|
+
obj[url] = new Date().toISOString()
|
|
37
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(obj))
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function SmartBanner ({ src }) {
|
|
41
|
+
if (!src) {
|
|
42
|
+
console.error('Missing data source.')
|
|
43
|
+
return null
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const platform = getPlatform()
|
|
47
|
+
if (!platform) {
|
|
48
|
+
return null
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const [data, setData] = useState()
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
(async () => {
|
|
54
|
+
const res = await fetch(src)
|
|
55
|
+
const json = await res.json()
|
|
56
|
+
setData(json)
|
|
57
|
+
})()
|
|
58
|
+
}, [])
|
|
59
|
+
|
|
60
|
+
if (!data) {
|
|
61
|
+
return null
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const suffix = data[`${platform}Suffix`]
|
|
65
|
+
const url = data[`${platform}Url`]
|
|
66
|
+
|
|
67
|
+
if (isHidden(url)) {
|
|
68
|
+
return null
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return h('div', { className: 'p-2 bg-bga text-txa w-full animate-fade flex gap-2 border-txa/90 border-b' },
|
|
72
|
+
h('button', {
|
|
73
|
+
className: 'm-2 cursor-pointer',
|
|
74
|
+
title: data.closeText,
|
|
75
|
+
'aria-label': data.closeText,
|
|
76
|
+
children: h(Icon, { _size: 'sm' }, NAVIGATION_CLOSE),
|
|
77
|
+
onClick: event => {
|
|
78
|
+
event.preventDefault()
|
|
79
|
+
hide(url)
|
|
80
|
+
setData({ ...data }) // Force update.
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
h('div', { className: 'flex items-center' },
|
|
84
|
+
h('div', { className: 'w-16 h-16' },
|
|
85
|
+
h(Img, { _tall: true, _model: { src: data.icon } })
|
|
86
|
+
)
|
|
87
|
+
),
|
|
88
|
+
h('div', { className: 'grow flex items-center text-sm' },
|
|
89
|
+
h('div',
|
|
90
|
+
h('div', data.title),
|
|
91
|
+
h('div', data.author),
|
|
92
|
+
h('div', suffix)
|
|
93
|
+
)
|
|
94
|
+
),
|
|
95
|
+
h('div', { className: 'flex items-center pe-2' }, // Compensate for bigger close button.
|
|
96
|
+
h('a', {
|
|
97
|
+
className: 'transition rounded-lg overflow-hidden border bg-bgb text-txb border-bgb hover:bg-txb hover:text-bgb font-bold py-1 px-2',
|
|
98
|
+
href: url
|
|
99
|
+
}, data.viewText)
|
|
100
|
+
)
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
register(SmartBanner, 'smart-banner')
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="#404040">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.746 9.046a.5.5 0 0 1-.707 0l-.693-.692a.5.5 0 0 1 0-.708l5.293-5.292a.5.5 0 0 1 .708 0l5.292 5.292a.5.5 0 0 1 0 .708l-.692.692a.5.5 0 0 1-.708 0L11.993 4.8 7.746 9.046Zm0 5.908a.5.5 0 0 0-.707 0l-.693.692a.5.5 0 0 0 0 .707l5.293 5.293a.5.5 0 0 0 .708 0l5.292-5.293a.5.5 0 0 0 0-.707l-.692-.693a.5.5 0 0 0-.708 0L11.993 19.2l-4.247-4.246Z"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="#404040">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" transform="translate(0,6)" d="M7.746 9.046a.5.5 0 0 1-.707 0l-.693-.692a.5.5 0 0 1 0-.708l5.293-5.292a.5.5 0 0 1 .708 0l5.292 5.292a.5.5 0 0 1 0 .708l-.692.692a.5.5 0 0 1-.708 0L11.993 4.8 7.746 9.046Zm0 5.908a.5.5 0 0 0-.707"/>
|
|
3
|
+
</svg>
|