@itcenteratunihelsinki/huds-lib 0.8.69 → 0.8.70

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.
Files changed (43) hide show
  1. package/components/hy-dropdown.js +147 -46
  2. package/components/hy-dropdown.js.map +1 -1
  3. package/dist/cjs/huds-lib.cjs.js +1 -1
  4. package/dist/cjs/hy-dropdown.cjs.entry.js +226 -0
  5. package/dist/cjs/hy-dropdown.cjs.entry.js.map +1 -0
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/collection/collection-manifest.json +5 -9
  8. package/dist/collection/components/hy-dropdown/hy-dropdown.css +48 -33
  9. package/dist/collection/components/hy-dropdown/hy-dropdown.js +232 -35
  10. package/dist/collection/components/hy-dropdown/hy-dropdown.js.map +1 -1
  11. package/dist/esm/huds-lib.js +1 -1
  12. package/dist/esm/hy-dropdown.entry.js +222 -0
  13. package/dist/esm/hy-dropdown.entry.js.map +1 -0
  14. package/dist/esm/loader.js +1 -1
  15. package/dist/huds-lib/huds-lib.esm.js +1 -1
  16. package/dist/huds-lib/huds-lib.esm.js.map +1 -1
  17. package/dist/huds-lib/hy-dropdown.entry.js +2 -0
  18. package/dist/huds-lib/hy-dropdown.entry.js.map +1 -0
  19. package/dist/types/components/hy-dropdown/hy-dropdown.d.ts +17 -3
  20. package/dist/types/components.d.ts +10 -36
  21. package/package.json +2 -2
  22. package/components/hy-dropdown-panel-item.d.ts +0 -11
  23. package/components/hy-dropdown-panel-item.js +0 -8
  24. package/components/hy-dropdown-panel-item.js.map +0 -1
  25. package/components/hy-dropdown-panel.d.ts +0 -11
  26. package/components/hy-dropdown-panel.js +0 -8
  27. package/components/hy-dropdown-panel.js.map +0 -1
  28. package/components/hy-dropdown.panel.item.js +0 -43
  29. package/components/hy-dropdown.panel.item.js.map +0 -1
  30. package/components/hy-dropdown.panel.js +0 -31
  31. package/components/hy-dropdown.panel.js.map +0 -1
  32. package/dist/cjs/hy-dropdown_3.cjs.entry.js +0 -141
  33. package/dist/cjs/hy-dropdown_3.cjs.entry.js.map +0 -1
  34. package/dist/collection/components/hy-dropdown/hy-dropdown.panel.item.js +0 -87
  35. package/dist/collection/components/hy-dropdown/hy-dropdown.panel.item.js.map +0 -1
  36. package/dist/collection/components/hy-dropdown/hy-dropdown.panel.js +0 -32
  37. package/dist/collection/components/hy-dropdown/hy-dropdown.panel.js.map +0 -1
  38. package/dist/esm/hy-dropdown_3.entry.js +0 -135
  39. package/dist/esm/hy-dropdown_3.entry.js.map +0 -1
  40. package/dist/huds-lib/hy-dropdown_3.entry.js +0 -2
  41. package/dist/huds-lib/hy-dropdown_3.entry.js.map +0 -1
  42. package/dist/types/components/hy-dropdown/hy-dropdown.panel.d.ts +0 -4
  43. package/dist/types/components/hy-dropdown/hy-dropdown.panel.item.d.ts +0 -7
@@ -1 +1 @@
1
- {"version":3,"names":["patchBrowser","importMeta","url","opts","resourcesUrl","URL","href","promiseResolve","then","options","bootstrapLazy","JSON","parse"],"sources":["../node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v3.4.2 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, plt, win, doc, promiseResolve, H } from '@stencil/core';\n/**\n * Helper method for querying a `meta` tag that contains a nonce value\n * out of a DOM's head.\n *\n * @param doc The DOM containing the `head` to query against\n * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag\n * exists or the tag has no content.\n */\nfunction queryNonceMetaTagContent(doc) {\n var _a, _b, _c;\n return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name=\"csp-nonce\"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;\n}\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\\s|-/g, '_')}`;\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n if (BUILD.cssVarShim) {\n // shim css vars\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n plt.$cssShim$ = win.__cssshim;\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n if (BUILD.profile && !performance.mark) {\n // not all browsers support performance.mark/measure (Safari 10)\n // because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,\n // simply stub the implementations out.\n // TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)\n // @ts-ignore\n performance.mark = performance.measure = () => {\n /*noop*/\n };\n performance.getEntriesByName = () => [];\n }\n // @ts-ignore\n const scriptElm = \n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {\n // Safari < v11 support: This IF is true if it's Safari below v11.\n // This fn cannot use async/await since Safari didn't support it until v11,\n // however, Safari 10 did support modules. Safari 10 also didn't support \"nomodule\",\n // so both the ESM file and nomodule file would get downloaded. Only Safari\n // has 'onbeforeload' in the script, and \"history.scrollRestoration\" was added\n // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.\n // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.\n return {\n then() {\n /* promise noop */\n },\n };\n }\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (!BUILD.safari10 && importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n }\n else if (BUILD.dynamicImportShim || BUILD.safari10) {\n opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim) {\n patchDynamicImport(opts.resourcesUrl, scriptElm);\n }\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim && !win.customElements) {\n // module support, but no custom elements support (Old Edge)\n // @ts-ignore\n return import(/* webpackChunkName: \"polyfills-dom\" */ './dom.js').then(() => opts);\n }\n }\n return promiseResolve(opts);\n};\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst patchDynamicImport = (base, orgScriptElm) => {\n const importFunctionName = getDynamicImportFunction(NAMESPACE);\n try {\n // test if this browser supports dynamic imports\n // There is a caching issue in V8, that breaks using import() in Function\n // By generating a random string, we can workaround it\n // Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info\n win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);\n }\n catch (e) {\n // this shim is specifically for browsers that do support \"esm\" imports\n // however, they do NOT support \"dynamic\" imports\n // basically this code is for old Edge, v18 and below\n const moduleMap = new Map();\n win[importFunctionName] = (src) => {\n var _a;\n const url = new URL(src, base).href;\n let mod = moduleMap.get(url);\n if (!mod) {\n const script = doc.createElement('script');\n script.type = 'module';\n script.crossOrigin = orgScriptElm.crossOrigin;\n script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {\n type: 'application/javascript',\n }));\n // Apply CSP nonce to the script tag if it exists\n const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);\n if (nonce != null) {\n script.setAttribute('nonce', nonce);\n }\n mod = new Promise((resolve) => {\n script.onload = () => {\n resolve(win[importFunctionName].m);\n script.remove();\n };\n });\n moduleMap.set(url, mod);\n doc.head.appendChild(script);\n }\n return mod;\n };\n }\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"mappings":"iIAmBA,MAAMA,EAAe,KAkCjB,MAAMC,cAAyBC,IAC/B,MAAMC,EAAqE,GAiB3E,GAAuBF,IAAe,GAAI,CACtCE,EAAKC,aAAe,IAAIC,IAAI,IAAKJ,GAAYK,IAGrD,CAcI,OAAOC,EAAeJ,EAAK,ECrF/BH,IAAeQ,MAAKC,GAEXC,EAAcC,KAAAC,MAAA,43mBAAuCH"}
1
+ {"version":3,"names":["patchBrowser","importMeta","url","opts","resourcesUrl","URL","href","promiseResolve","then","options","bootstrapLazy","JSON","parse"],"sources":["../node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v3.4.2 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, plt, win, doc, promiseResolve, H } from '@stencil/core';\n/**\n * Helper method for querying a `meta` tag that contains a nonce value\n * out of a DOM's head.\n *\n * @param doc The DOM containing the `head` to query against\n * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag\n * exists or the tag has no content.\n */\nfunction queryNonceMetaTagContent(doc) {\n var _a, _b, _c;\n return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name=\"csp-nonce\"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;\n}\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\\s|-/g, '_')}`;\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n if (BUILD.cssVarShim) {\n // shim css vars\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n plt.$cssShim$ = win.__cssshim;\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n if (BUILD.profile && !performance.mark) {\n // not all browsers support performance.mark/measure (Safari 10)\n // because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,\n // simply stub the implementations out.\n // TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)\n // @ts-ignore\n performance.mark = performance.measure = () => {\n /*noop*/\n };\n performance.getEntriesByName = () => [];\n }\n // @ts-ignore\n const scriptElm = \n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {\n // Safari < v11 support: This IF is true if it's Safari below v11.\n // This fn cannot use async/await since Safari didn't support it until v11,\n // however, Safari 10 did support modules. Safari 10 also didn't support \"nomodule\",\n // so both the ESM file and nomodule file would get downloaded. Only Safari\n // has 'onbeforeload' in the script, and \"history.scrollRestoration\" was added\n // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.\n // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.\n return {\n then() {\n /* promise noop */\n },\n };\n }\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (!BUILD.safari10 && importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n }\n else if (BUILD.dynamicImportShim || BUILD.safari10) {\n opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim) {\n patchDynamicImport(opts.resourcesUrl, scriptElm);\n }\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim && !win.customElements) {\n // module support, but no custom elements support (Old Edge)\n // @ts-ignore\n return import(/* webpackChunkName: \"polyfills-dom\" */ './dom.js').then(() => opts);\n }\n }\n return promiseResolve(opts);\n};\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst patchDynamicImport = (base, orgScriptElm) => {\n const importFunctionName = getDynamicImportFunction(NAMESPACE);\n try {\n // test if this browser supports dynamic imports\n // There is a caching issue in V8, that breaks using import() in Function\n // By generating a random string, we can workaround it\n // Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info\n win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);\n }\n catch (e) {\n // this shim is specifically for browsers that do support \"esm\" imports\n // however, they do NOT support \"dynamic\" imports\n // basically this code is for old Edge, v18 and below\n const moduleMap = new Map();\n win[importFunctionName] = (src) => {\n var _a;\n const url = new URL(src, base).href;\n let mod = moduleMap.get(url);\n if (!mod) {\n const script = doc.createElement('script');\n script.type = 'module';\n script.crossOrigin = orgScriptElm.crossOrigin;\n script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {\n type: 'application/javascript',\n }));\n // Apply CSP nonce to the script tag if it exists\n const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);\n if (nonce != null) {\n script.setAttribute('nonce', nonce);\n }\n mod = new Promise((resolve) => {\n script.onload = () => {\n resolve(win[importFunctionName].m);\n script.remove();\n };\n });\n moduleMap.set(url, mod);\n doc.head.appendChild(script);\n }\n return mod;\n };\n }\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"mappings":"iIAmBA,MAAMA,EAAe,KAkCjB,MAAMC,cAAyBC,IAC/B,MAAMC,EAAqE,GAiB3E,GAAuBF,IAAe,GAAI,CACtCE,EAAKC,aAAe,IAAIC,IAAI,IAAKJ,GAAYK,IAGrD,CAcI,OAAOC,EAAeJ,EAAK,ECrF/BH,IAAeQ,MAAKC,GAEXC,EAAcC,KAAAC,MAAA,yvmBAAuCH"}
@@ -0,0 +1,2 @@
1
+ import{r as i,c as e,h as t,H as o,g as n}from"./index-f84f2a7d.js";import{j as a}from"./globalScript-5a4b7abf.js";const d=':root{--brand-main:#0e688b;--brand-main-soft:#b1e7ff;--brand-main-bright:#48c5f8;--brand-main-light:#107eab;--brand-main-active:#005379;--brand-main-dark:#003146;--brand-main-nearly-black:#000222;--link-blue:#0479a4;--link-disabled:#767676;--grayscale-white:#fff;--grayscale-slightly-gray:#fefefe;--grayscale-light:#f8f8f8;--grayscale-medium:#d2d2d2;--grayscale-background-box:#f5f5f5;--grayscale-tabs-border:#e6e6e6;--grayscale-background-arrow:#dfdfdf;--grayscale-medium-dark:#979797;--grayscale-dark:#555555;--grayscale-dark-text:#222222;--grayscale-black:#000000;--additional-red-light:#e5053a;--additional-red-dark:#a31621;--additional-purple-light:#420039;--additional-yellow-light:#f9a21a;--additional-yellow:#c47f1b;--additional-skyblue:#48c5f8;--additional-orange:#d14600;--additional-green-light:#96ba3c;--additional-green-dark:#006400;--hover-gray:#eaeaea}*{-webkit-box-sizing:border-box;box-sizing:border-box}:root{--gutter-mobile:16px;--gutter-narrow:24px;--gutter-medium:24px;--gutter-wide:24px;--gutter-extrawide:32px}:root{--breakpoint-extrawide:75.0625rem;--breakpoint-max-width:75.0625rem;--breakpoint-medium:48rem;--breakpoint-narrow:30rem;--breakpoint-wide:60rem}.hy-dropdown{display:inline-block;min-width:100%;position:relative}@media (min-width: 30rem){.hy-dropdown{min-width:48.3%}}@media (min-width: 75.0625rem){.hy-dropdown{min-width:23.03%}}.hy-dropdown label.hy-dropdown__button-label{font-size:1rem;line-height:20px;font-weight:700;display:block;font-family:var(--main-font-family);letter-spacing:-0.32px;margin-bottom:8px}.hy-dropdown--single .hy-dropdown__panel{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:330px;min-width:100%}.hy-dropdown .hy-dropdown__hidden-input{display:none;height:0;font-size:0}.hy-dropdown__toggle{font-size:0.875rem;line-height:24px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--grayscale-white);border-radius:0;border:1px solid var(--grayscale-medium-dark);color:var(--link-blue);display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-family:var(--main-font-family);font-weight:600;min-height:40px;height:auto;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;letter-spacing:normal;padding:0 0 0 16px;text-align:left;max-width:280px;width:100%}@media (min-width: 30rem){.hy-dropdown__toggle{font-size:1rem;line-height:24px;min-height:44px}}@media (min-width: 75.0625rem){.hy-dropdown__toggle{min-height:48px}}.hy-dropdown__toggle:hover{border-color:var(--brand-main-light);cursor:pointer}.hy-dropdown__toggle:focus{border-color:var(--brand-main-light);border-style:solid inset solid solid;border-width:2px;outline:0;text-indent:-1px}.hy-dropdown__toggle svg{pointer-events:none}.hy-dropdown__toggle.is-open .hy-dropdown__icon{background-color:var(--brand-main-light);-webkit-transform:rotate(180deg);transform:rotate(180deg)}.hy-dropdown__toggle.is-open .hy-dropdown__icon::before{display:none}.hy-dropdown__toggle.is-open .hy-dropdown__icon svg{fill:var(--grayscale-white)}.hy-dropdown__icon{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-negative:0;flex-shrink:0;height:40px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin:0 0 0 16px;position:relative;width:40px}.hy-dropdown__icon::before{border-left:0.5px solid var(--grayscale-medium-dark);content:"";display:inline-block;height:65%;left:0;position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}@media (min-width: 30rem){.hy-dropdown__icon{height:44px;width:44px}}@media (min-width: 75.0625rem){.hy-dropdown__icon{height:48px;width:48px}}.hy-dropdown__icon svg{fill:var(--link-blue)}@media (min-width: 30rem){.hy-dropdown__icon svg{height:16px;width:16px}}.hy-dropdown__panel{background-color:var(--grayscale-white);-webkit-box-shadow:0 10px 20px 0 rgba(0, 49, 70, 0.2);box-shadow:0 10px 20px 0 rgba(0, 49, 70, 0.2);list-style:none;margin:0;padding:6px;position:absolute;width:100%;z-index:11}.hy-dropdown__panel.is-hidden{display:none;visibility:hidden}.hy-dropdown__panel-item{font-size:0.875rem;line-height:24px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--grayscale-white);border-radius:0;border:1px solid var(--grayscale-medium-dark);color:var(--link-blue);display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-family:var(--main-font-family);font-weight:600;min-height:40px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;letter-spacing:normal;position:relative;padding:0;text-align:left;width:100%}@media (min-width: 30rem){.hy-dropdown__panel-item{font-size:1rem;line-height:24px}}.hy-dropdown__panel-item:not(.is-last){margin-bottom:6px}.hy-dropdown__panel-item[aria-selected=true] .hy-dropdown__checkbox{border-color:var(--grayscale-black);border-style:solid inset solid solid;border-width:2px;color:var(--grayscale-black);outline:0;text-indent:-1px}.hy-dropdown__panel-item[aria-selected=true] .hy-dropdown__checkbox .hy-dropdown__label-icon{display:-webkit-inline-box !important;display:-ms-inline-flexbox !important;display:inline-flex !important;visibility:visible}.hy-dropdown__panel-item--focused{cursor:pointer;border-color:var(--brand-main-light);border-style:solid inset solid solid;border-width:2px;outline:0;text-indent:-1px}.hy-dropdown__label-icon{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:none !important;-ms-flex-negative:0;flex-shrink:0;height:40px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;position:relative;visibility:hidden;width:40px}.hy-dropdown__checkbox{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;min-height:40px;height:100%;margin:0;padding:0 16px;width:100%;z-index:10}.hy-dropdown__checkbox:hover{cursor:pointer;border-color:var(--brand-main-active)}.hy-dropdown__checkbox:focus-within{border-color:var(--brand-main-light);border-style:solid inset solid solid;border-width:2px;outline:0;text-indent:-1px}';const r=class{constructor(t){i(this,t);this.dropdownPanelToggled=e(this,"dropdownPanelToggled",7);this.dropdropValueChange=e(this,"dropdownValueChanged",7);this.dropdropMultiValueChange=e(this,"dropdownMultiValueChanged",7);this.dropdownKeyPress=e(this,"dropdownKeyPress",7);this.single=false;this.dropdownLabel=null;this.dropdownId="dropdownToggle";this.dropdownOptions=undefined;this.defaultLabel="All";this.type=null;this.defaultOption=null;this.isPanelOpen=false;this.isChecked=false;this.currentSingle=[{id:0,label:this.defaultLabel,value:0}];this.currentMulti=undefined;this.focusedOptionIndex=0}async componentWillLoad(){this._dropdownOptions=await a(this.dropdownOptions)}componentWillUpdate(){const i=this.el.querySelectorAll(".hy-dropdown__checkbox");if(i){if([...i].some((i=>i.checked==true))){this.isChecked=true}else{this.isChecked=false}}}watchPropHandler(i,e){if(!this.single)return;if(i!==e){const e=this.el.getElementsByClassName("hy-dropdown__checkbox");Array.from(e).filter((e=>{if(e.id==i){e.checked=true;this.currentSingle=this._dropdownOptions.filter((e=>e.id==i));return}return null}))}}panelListener(i){if(this.isPanelOpen&&i.detail.dropdownId!==this.dropdownId){this.isPanelOpen=false}}handleMultiClick(i,e){i.stopPropagation();const t=this.el.getElementsByClassName("hy-dropdown__checkbox");Array.from(t).filter((i=>{const t=i.closest("li");if(t.dataset.id==e.id&&!t.hasAttribute("aria-selected")){t.setAttribute("aria-selected","true");this.currentMulti=this.currentMulti&&this.currentMulti.length>0?[...this.currentMulti,e]:[e];return}if(t.dataset.id===e.id&&t.hasAttribute("aria-selected")){t.removeAttribute("aria-selected");if(this.currentMulti.length>0){const i=this.currentMulti.indexOf(e);this.currentMulti=this.currentMulti.splice(i,1)}return}return null}))}handleSingleClick(i,e){if(!this.single||!this.isPanelOpen)return;const t=this.el.getElementsByClassName("hy-dropdown__checkbox");i.stopPropagation();Array.from(t).filter((i=>{const t=i.closest("li");if(t.dataset.id==e.id){if(t.hasAttribute("aria-selected")){t.removeAttribute("aria-selected");this.currentSingle=[{id:null,label:this.defaultLabel,value:null}];return}t.setAttribute("aria-selected","true");this.currentSingle=this._dropdownOptions.filter((i=>i.id==e.id));return}if(t.dataset.id!==e.id&&t.hasAttribute("aria-selected")){t.removeAttribute("aria-selected");return}return null}))}handleKeyDown(i){i.stopPropagation();switch(i.key){case"ArrowDown":i.preventDefault();if(!this.isPanelOpen){this.handlePanelToggle(i);return}this.focusedOptionIndex=(this.focusedOptionIndex+1)%this._dropdownOptions.length;break;case"ArrowUp":this.focusedOptionIndex=(this.focusedOptionIndex-1+this._dropdownOptions.length)%this._dropdownOptions.length;i.preventDefault();break;case"Enter":case" ":if(!this.isPanelOpen){i.preventDefault();this.handlePanelToggle(i);return}if(this.single){this.handleOptionSingleClick(i,this._dropdownOptions[this.focusedOptionIndex])}else{this.handleMultiOptionClick(i,this._dropdownOptions[this.focusedOptionIndex])}const e={id:this.dropdownId,type:this.type,data:this._dropdownOptions[this.focusedOptionIndex]};this.dropdownKeyPress.emit(e);i.preventDefault();break;case"Escape":case"Tab":this.isPanelOpen=false;break}}handlePanelToggle(i){i.stopPropagation();this.isPanelOpen=!this.isPanelOpen;const e={dropdownId:this.dropdownId,panelOpen:this.isPanelOpen};this.dropdownPanelToggled.emit(e)}handlePanelClickOutside(i){i.stopPropagation();const e=this.el.querySelector(`#${this.dropdownId}`);const t=this.el.querySelector(".hy-dropdown__panel");const o=this.el.querySelectorAll(".hy-dropdown__panel-item");const n=this.el.querySelectorAll(".hy-dropdown__checkbox");const a=this.el.querySelectorAll(".hy-dropdown__icon");const{target:d}=i;const r=[this.el,e,t,...n,a,...o];if(this.isPanelOpen&&!r.includes(d)){this.isPanelOpen=false}}handleOptionSingleClick(i,e){i.stopPropagation();this.handleSingleClick(i,e);const t={id:this.dropdownId,type:this.type,data:e};this.dropdropValueChange.emit(t)}handleMultiOptionClick(i,e){i.stopPropagation();this.handleMultiClick(i,e);const t={id:this.dropdownId,type:this.type,data:this.currentMulti};this.dropdropMultiValueChange.emit(t)}handleOptionHover(i){this.focusedOptionIndex=i}render(){const{label:i,id:e,value:n}=this.currentSingle[0];const a=["hy-dropdown",this.single?"hy-dropdown--single":""].join(" ");if(this.single){return t(o,{class:a},this.dropdownLabel&&t("label",{class:"hy-dropdown__button-label",htmlFor:this.dropdownId},this.dropdownLabel),t("div",{id:this.dropdownId,class:`hy-dropdown__toggle ${this.isPanelOpen?"is-open":""}`,"aria-expanded":`${this.isPanelOpen||false}`,"aria-controls":"dropdownPanel","aria-haspopup":"listbox",role:"combobox",onClick:i=>this.handlePanelToggle(i),onKeyDown:i=>this.handleKeyDown(i),"aria-label":this.dropdownLabel,"data-current-id":e,"data-current-value":n,"data-value":e,tabIndex:0},t("input",{"aria-hidden":"true",class:"hy-dropdown__hidden-input",type:"hidden",value:e}),i,t("hy-icon",{class:"hy-dropdown__icon",icon:"hy-icon-caret-down",size:14,"aria-hidden":"true"})),t("ul",{"checkbox-checked":this.isChecked?"true":"false",id:"dropdownPanel",class:`hy-dropdown__panel ${!this.isPanelOpen?"is-hidden":""}`,"aria-expanded":`${!this.isPanelOpen||false}`,role:"listbox","aria-labelledby":"dropdownToggle"},this._dropdownOptions.map((({id:i,label:e,value:o},n,a)=>t("li",{key:i,"data-id":`${i}`,role:"option",class:`hy-dropdown__panel-item ${this._dropdownOptions.length-1===n?"is-last":""}\n ${this.focusedOptionIndex===n?"hy-dropdown__panel-item--focused":""}`,onClick:i=>this.handleOptionSingleClick(i,a[n]),onMouseEnter:()=>this.handleOptionHover(n)},t("span",{"data-id":`${i}`,class:"hy-dropdown__checkbox","data-value":`${o}`},e,t("hy-icon",{class:"hy-dropdown__label-icon",icon:"hy-icon-done",size:14,"aria-hidden":"true"})))))))}else{return t(o,{class:a},t("button",{id:this.dropdownId,class:`hy-dropdown__toggle ${this.isPanelOpen?"is-open":""}`,"aria-expanded":`${this.isPanelOpen||false}`,"aria-controls":"dropdownPanel","aria-haspopup":"listbox",role:"combobox",onClick:i=>this.handlePanelToggle(i),"aria-label":this.dropdownLabel,type:"button"},this.dropdownLabel&&this.dropdownLabel,t("hy-icon",{class:"hy-dropdown__icon",icon:"hy-icon-caret-down",size:14,"aria-hidden":"true"})),t("ul",{"checkbox-checked":this.isChecked?"true":"false",id:"dropdownPanel",class:`hy-dropdown__panel ${!this.isPanelOpen?"is-hidden":""}`,"aria-expanded":`${!this.isPanelOpen||false}`,role:"listbox","aria-labelledby":"dropdownToggle"},this._dropdownOptions.map((({id:i,label:e,value:o},n,a)=>t("li",{key:i,"data-id":`${i}`,role:"option",class:`hy-dropdown__panel-item ${this._dropdownOptions.length-1===n?"is-last":""}\n ${this.focusedOptionIndex===n?"hy-dropdown__panel-item--focused":""}`,onClick:i=>this.handleMultiOptionClick(i,a[n]),onMouseEnter:()=>this.handleOptionHover(n)},t("span",{"data-id":`${i}`,class:"hy-dropdown__checkbox","data-value":`${o}`},e,t("hy-icon",{class:"hy-dropdown__label-icon",icon:"hy-icon-done",size:14,"aria-hidden":"true"})))))))}}get el(){return n(this)}static get watchers(){return{defaultOption:["watchPropHandler"]}}};r.style=d;export{r as hy_dropdown};
2
+ //# sourceMappingURL=hy-dropdown.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["hyDropdownCss","HyDropdown","id","label","this","defaultLabel","value","async","_dropdownOptions","jsonParserWorker","dropdownOptions","componentWillUpdate","items","el","querySelectorAll","some","item","checked","isChecked","watchPropHandler","newValue","oldValue","single","dropdownPanelCheckboxElements","getElementsByClassName","Array","from","filter","currentSingle","option","panelListener","e","isPanelOpen","detail","dropdownId","handleMultiClick","event","stopPropagation","i","closest","dataset","hasAttribute","setAttribute","currentMulti","length","removeAttribute","index","indexOf","splice","handleSingleClick","o","handleKeyDown","key","preventDefault","handlePanelToggle","focusedOptionIndex","handleOptionSingleClick","handleMultiOptionClick","emitDetails","type","data","dropdownKeyPress","emit","panelOpen","dropdownPanelToggled","handlePanelClickOutside","dropdownToggleButtonElement","querySelector","dropdownPanelElement","dropdownPanelCheckboxes","dropdownToggleButtonIconElement","target","allowedElements","includes","dropdropValueChange","dropdropMultiValueChange","handleOptionHover","render","currentLabel","currentId","currentValue","classAttributes","join","h","Host","class","dropdownLabel","htmlFor","role","onClick","onKeyDown","tabIndex","icon","size","map","onMouseEnter"],"sources":["./src/components/hy-dropdown/hy-dropdown.scss?tag=hy-dropdown","./src/components/hy-dropdown/hy-dropdown.tsx"],"sourcesContent":[".hy-dropdown {\n display: inline-block;\n min-width: 100%;\n position: relative;\n\n @include breakpoint($narrow) {\n min-width: 48.3%;\n }\n\n @include breakpoint($extrawide) {\n min-width: 23.03%;\n }\n\n label.hy-dropdown__button-label {\n @include font-size(16px, 20px);\n @include font-weight($bold);\n\n display: block;\n font-family: var(--main-font-family);\n letter-spacing: -0.32px;\n margin-bottom: 8px;\n }\n\n &--single {\n .hy-dropdown__panel {\n width: max-content;\n max-width: 330px;\n min-width: 100%;\n }\n }\n\n .hy-dropdown__hidden-input {\n display: none;\n height: 0;\n font-size: 0;\n }\n}\n\n.hy-dropdown__toggle {\n @include font-size(14px, 24px);\n align-items: center;\n background-color: var(--grayscale-white);\n border-radius: 0;\n border: 1px solid var(--grayscale-medium-dark);\n color: var(--link-blue);\n display: inline-flex;\n font-family: var(--main-font-family);\n font-weight: $semibold;\n min-height: 40px;\n height: auto;\n justify-content: space-between;\n letter-spacing: normal;\n padding: 0 0 0 16px;\n text-align: left;\n max-width: 280px;\n width: 100%;\n\n @include breakpoint($narrow) {\n @include font-size(16px, 24px);\n min-height: 44px;\n }\n\n @include breakpoint($extrawide) {\n min-height: 48px;\n }\n\n &:hover {\n border-color: var(--brand-main-light);\n cursor: pointer;\n }\n\n &:focus {\n border-color: var(--brand-main-light);\n border-style: solid inset solid solid;\n border-width: 2px;\n outline: 0;\n text-indent: -1px; // Text stays in place.\n }\n\n svg {\n pointer-events: none;\n }\n\n &.is-open {\n .hy-dropdown__icon {\n background-color: var(--brand-main-light);\n transform: rotate(180deg);\n\n &::before {\n display: none;\n }\n\n svg {\n fill: var(--grayscale-white);\n }\n }\n }\n}\n\n.hy-dropdown__icon {\n align-items: center;\n display: inline-flex;\n flex-shrink: 0;\n height: 40px;\n justify-content: center;\n margin: 0 0 0 16px;\n position: relative;\n width: 40px;\n\n &::before {\n //border-left: 1px dashed var(--grayscale-medium-dark);\n //Line weight 0,5 px; Line color #979797\n border-left: 0.5px solid var(--grayscale-medium-dark);\n content: \"\";\n display: inline-block;\n height: 65%;\n left: 0;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n }\n\n @include breakpoint($narrow) {\n height: 44px;\n width: 44px;\n }\n\n @include breakpoint($extrawide) {\n height: 48px;\n width: 48px;\n }\n\n svg {\n fill: var(--link-blue);\n\n @include breakpoint($narrow) {\n height: 16px;\n width: 16px;\n }\n }\n}\n\n.hy-dropdown__panel {\n background-color: var(--grayscale-white);\n box-shadow: 0 10px 20px 0 rgba(0, 49, 70, 0.2);\n list-style: none;\n margin: 0;\n padding: 6px;\n position: absolute;\n width: 100%;\n z-index: 11;\n\n &.is-hidden {\n display: none;\n visibility: hidden;\n }\n}\n\n.hy-dropdown__panel-item {\n @include font-size(14px, 24px);\n align-items: center;\n background-color: var(--grayscale-white);\n border-radius: 0;\n border: 1px solid var(--grayscale-medium-dark);\n color: var(--link-blue);\n display: inline-flex;\n font-family: var(--main-font-family);\n font-weight: $semibold;\n min-height: 40px;\n justify-content: space-between;\n letter-spacing: normal;\n position: relative;\n padding: 0;\n text-align: left;\n width: 100%;\n\n @include breakpoint($narrow) {\n @include font-size(16px, 24px);\n }\n\n &:not(.is-last) {\n margin-bottom: 6px;\n }\n\n &[aria-selected=\"true\"] .hy-dropdown__checkbox {\n border-color: var(--grayscale-black);\n border-style: solid inset solid solid;\n border-width: 2px;\n color: var(--grayscale-black);\n outline: 0;\n text-indent: -1px; // Text stays in place.\n\n .hy-dropdown__label-icon {\n display: inline-flex !important;\n visibility: visible;\n }\n }\n\n &--focused {\n cursor: pointer;\n border-color: var(--brand-main-light);\n border-style: solid inset solid solid;\n border-width: 2px;\n outline: 0;\n text-indent: -1px; // Text stays in place.\n }\n}\n\n.hy-dropdown__label-icon {\n align-items: center;\n display: none !important;\n flex-shrink: 0;\n height: 40px;\n justify-content: center;\n position: relative;\n visibility: hidden;\n width: 40px;\n}\n\n.hy-dropdown__checkbox {\n display: flex;\n align-items: center;\n min-height: 40px;\n height: 100%;\n margin: 0;\n padding: 0 16px;\n width: 100%;\n z-index: 10;\n\n &:hover {\n cursor: pointer;\n border-color: var(--brand-main-active);\n }\n\n &:focus-within {\n & {\n border-color: var(--brand-main-light);\n border-style: solid inset solid solid;\n border-width: 2px;\n outline: 0;\n text-indent: -1px; // Text stays in place.\n }\n }\n}\n","import {Component, Element, Host, Listen, Event, EventEmitter, h, State, Prop, Watch} from \"@stencil/core\";\nimport {jsonParserWorker} from \"../../global/globalScript\";\n\nexport interface IDropdownItem {\n id: string | number;\n label: string;\n value: string | number;\n}\n\nexport interface DefaultValue {\n id: string | number;\n label: string;\n value: string | number;\n}\n\n@Component({\n tag: \"hy-dropdown\",\n styleUrl: \"hy-dropdown.scss\",\n shadow: false,\n})\nexport class HyDropdown {\n private _dropdownOptions: IDropdownItem[];\n @Element() el: HTMLElement;\n @Prop() single: boolean = false;\n @Prop() dropdownLabel: string = null;\n @Prop() dropdownId: string = \"dropdownToggle\";\n @Prop() dropdownOptions: IDropdownItem[] | string;\n @Prop() defaultLabel: string = \"All\";\n @Prop() type: string = null;\n @Prop({mutable: true}) defaultOption: string | number = null;\n @State() isPanelOpen: boolean = false;\n @State() isChecked: boolean = false;\n @State() currentSingle: DefaultValue[] = [{id: 0, label: this.defaultLabel, value: 0}];\n @State() currentMulti: IDropdownItem[];\n\n @State() focusedOptionIndex: number = 0;\n\n @Event({\n eventName: `dropdownPanelToggled`,\n composed: true,\n bubbles: true,\n })\n dropdownPanelToggled: EventEmitter;\n\n @Event({\n eventName: `dropdownValueChanged`,\n composed: true,\n })\n dropdropValueChange: EventEmitter;\n\n @Event({\n eventName: `dropdownMultiValueChanged`,\n composed: true,\n })\n dropdropMultiValueChange: EventEmitter;\n\n @Event({\n eventName: `dropdownKeyPress`,\n composed: true,\n })\n dropdownKeyPress: EventEmitter;\n\n async componentWillLoad() {\n this._dropdownOptions = await jsonParserWorker(this.dropdownOptions);\n }\n\n componentWillUpdate() {\n const items = this.el.querySelectorAll(\".hy-dropdown__checkbox\") as any;\n if (items) {\n if ([...items].some((item) => item.checked == true)) {\n this.isChecked = true;\n } else {\n this.isChecked = false;\n }\n }\n }\n\n @Watch(\"defaultOption\")\n watchPropHandler(newValue: string | number, oldValue: string | number) {\n if (!this.single) return;\n\n if (newValue !== oldValue) {\n const dropdownPanelCheckboxElements = this.el.getElementsByClassName(\"hy-dropdown__checkbox\") as HTMLCollectionOf<\n HTMLInputElement\n >;\n\n Array.from(dropdownPanelCheckboxElements).filter((item) => {\n if (item.id == newValue) {\n item.checked = true;\n this.currentSingle = this._dropdownOptions.filter((option) => option.id == newValue) as any;\n return;\n }\n return null;\n });\n }\n }\n\n @Listen(\"dropdownPanelToggled\", {target: \"window\"})\n panelListener(e) {\n if (this.isPanelOpen && e.detail.dropdownId !== this.dropdownId) {\n this.isPanelOpen = false;\n }\n }\n\n private handleMultiClick(event, option) {\n event.stopPropagation();\n const dropdownPanelCheckboxElements = this.el.getElementsByClassName(\"hy-dropdown__checkbox\") as HTMLCollectionOf<\n HTMLInputElement\n >;\n Array.from(dropdownPanelCheckboxElements).filter((i) => {\n const item = i.closest(\"li\");\n if (item.dataset.id == option.id && !item.hasAttribute(\"aria-selected\")) {\n item.setAttribute(\"aria-selected\", \"true\");\n this.currentMulti =\n this.currentMulti && this.currentMulti.length > 0 ? [...this.currentMulti, option] : [option];\n return;\n }\n if (item.dataset.id === option.id && item.hasAttribute(\"aria-selected\")) {\n item.removeAttribute(\"aria-selected\");\n if (this.currentMulti.length > 0) {\n const index = this.currentMulti.indexOf(option);\n this.currentMulti = this.currentMulti.splice(index, 1);\n }\n return;\n }\n return null;\n });\n }\n\n private handleSingleClick(event, option) {\n if (!this.single || !this.isPanelOpen) return;\n const dropdownPanelCheckboxElements = this.el.getElementsByClassName(\"hy-dropdown__checkbox\") as HTMLCollectionOf<\n HTMLInputElement\n >;\n event.stopPropagation();\n\n Array.from(dropdownPanelCheckboxElements).filter((i) => {\n const item = i.closest(\"li\");\n if (item.dataset.id == option.id) {\n if (item.hasAttribute(\"aria-selected\")) {\n item.removeAttribute(\"aria-selected\");\n this.currentSingle = [{id: null, label: this.defaultLabel, value: null}];\n return;\n }\n item.setAttribute(\"aria-selected\", \"true\");\n this.currentSingle = this._dropdownOptions.filter((o) => o.id == option.id) as any;\n return;\n }\n if (item.dataset.id !== option.id && item.hasAttribute(\"aria-selected\")) {\n item.removeAttribute(\"aria-selected\");\n return;\n }\n return null;\n });\n }\n\n @Listen(\"keydown\", {capture: false})\n handleKeyDown(event: KeyboardEvent) {\n event.stopPropagation();\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n if (!this.isPanelOpen) {\n this.handlePanelToggle(event);\n return;\n }\n this.focusedOptionIndex = (this.focusedOptionIndex + 1) % this._dropdownOptions.length;\n break;\n case \"ArrowUp\":\n this.focusedOptionIndex =\n (this.focusedOptionIndex - 1 + this._dropdownOptions.length) % this._dropdownOptions.length;\n event.preventDefault();\n break;\n case \"Enter\":\n case \" \":\n if (!this.isPanelOpen) {\n event.preventDefault();\n this.handlePanelToggle(event);\n return;\n }\n if (this.single) {\n this.handleOptionSingleClick(event, this._dropdownOptions[this.focusedOptionIndex]);\n } else {\n this.handleMultiOptionClick(event, this._dropdownOptions[this.focusedOptionIndex]);\n }\n const emitDetails = {\n id: this.dropdownId,\n type: this.type,\n data: this._dropdownOptions[this.focusedOptionIndex],\n };\n this.dropdownKeyPress.emit(emitDetails);\n event.preventDefault();\n break;\n case \"Escape\":\n case \"Tab\":\n this.isPanelOpen = false;\n break;\n default:\n break;\n }\n }\n\n private handlePanelToggle(e) {\n e.stopPropagation();\n this.isPanelOpen = !this.isPanelOpen;\n\n const emitDetails = {\n dropdownId: this.dropdownId,\n panelOpen: this.isPanelOpen,\n };\n this.dropdownPanelToggled.emit(emitDetails);\n }\n\n @Listen(\"click\", {target: \"window\"})\n handlePanelClickOutside(e) {\n e.stopPropagation();\n const dropdownToggleButtonElement = this.el.querySelector(`#${this.dropdownId}`) as HTMLButtonElement;\n const dropdownPanelElement = this.el.querySelector(\".hy-dropdown__panel\") as HTMLElement;\n const dropdownPanelCheckboxElements = this.el.querySelectorAll(\".hy-dropdown__panel-item\");\n const dropdownPanelCheckboxes = this.el.querySelectorAll(\".hy-dropdown__checkbox\");\n const dropdownToggleButtonIconElement = this.el.querySelectorAll(\".hy-dropdown__icon\");\n\n const {target} = e;\n\n const allowedElements = [\n this.el,\n dropdownToggleButtonElement,\n dropdownPanelElement,\n ...dropdownPanelCheckboxes,\n dropdownToggleButtonIconElement,\n ...dropdownPanelCheckboxElements, // Spread (\"copy\") items to allowedElement array.\n ];\n\n if (this.isPanelOpen && !allowedElements.includes(target)) {\n this.isPanelOpen = false;\n }\n }\n\n private handleOptionSingleClick(event, option) {\n event.stopPropagation();\n this.handleSingleClick(event, option);\n const emitDetails = {\n id: this.dropdownId,\n type: this.type,\n data: option,\n };\n this.dropdropValueChange.emit(emitDetails);\n }\n\n private handleMultiOptionClick(event, option) {\n event.stopPropagation();\n this.handleMultiClick(event, option);\n const emitDetails = {\n id: this.dropdownId,\n type: this.type,\n data: this.currentMulti,\n };\n this.dropdropMultiValueChange.emit(emitDetails);\n }\n\n private handleOptionHover(index) {\n this.focusedOptionIndex = index;\n }\n\n render() {\n const {label: currentLabel, id: currentId, value: currentValue} = this.currentSingle[0];\n const classAttributes = [\"hy-dropdown\", this.single ? \"hy-dropdown--single\" : \"\"].join(\" \");\n if (this.single) {\n return (\n <Host class={classAttributes}>\n {this.dropdownLabel && (\n <label class=\"hy-dropdown__button-label\" htmlFor={this.dropdownId}>\n {this.dropdownLabel}\n </label>\n )}\n <div\n id={this.dropdownId}\n class={`hy-dropdown__toggle ${this.isPanelOpen ? \"is-open\" : \"\"}`}\n aria-expanded={`${this.isPanelOpen || false}`}\n aria-controls=\"dropdownPanel\"\n aria-haspopup=\"listbox\"\n role=\"combobox\"\n onClick={(event) => this.handlePanelToggle(event)}\n onKeyDown={(event) => this.handleKeyDown(event)}\n aria-label={this.dropdownLabel}\n data-current-id={currentId}\n data-current-value={currentValue}\n data-value={currentId}\n tabIndex={0}\n >\n <input aria-hidden=\"true\" class=\"hy-dropdown__hidden-input\" type=\"hidden\" value={currentId}></input>\n {currentLabel}\n <hy-icon class=\"hy-dropdown__icon\" icon={\"hy-icon-caret-down\"} size={14} aria-hidden=\"true\" />\n </div>\n <ul\n checkbox-checked={this.isChecked ? \"true\" : \"false\"}\n id=\"dropdownPanel\"\n class={`hy-dropdown__panel ${!this.isPanelOpen ? \"is-hidden\" : \"\"}`}\n aria-expanded={`${!this.isPanelOpen || false}`}\n role=\"listbox\"\n aria-labelledby=\"dropdownToggle\"\n >\n {this._dropdownOptions.map(({id, label, value}, index, items) => (\n <li\n key={id}\n data-id={`${id}`}\n role=\"option\"\n class={`hy-dropdown__panel-item ${this._dropdownOptions.length - 1 === index ? \"is-last\" : \"\"}\n ${this.focusedOptionIndex === index ? \"hy-dropdown__panel-item--focused\" : \"\"}`}\n onClick={(event) => this.handleOptionSingleClick(event, items[index])}\n onMouseEnter={() => this.handleOptionHover(index)}\n >\n <span data-id={`${id}`} class=\"hy-dropdown__checkbox\" data-value={`${value}`}>\n {label}\n <hy-icon class=\"hy-dropdown__label-icon\" icon={\"hy-icon-done\"} size={14} aria-hidden=\"true\" />\n </span>\n </li>\n ))}\n </ul>\n </Host>\n );\n } else {\n return (\n <Host class={classAttributes}>\n <button\n id={this.dropdownId}\n class={`hy-dropdown__toggle ${this.isPanelOpen ? \"is-open\" : \"\"}`}\n aria-expanded={`${this.isPanelOpen || false}`}\n aria-controls=\"dropdownPanel\"\n aria-haspopup=\"listbox\"\n role=\"combobox\"\n onClick={(event) => this.handlePanelToggle(event)}\n aria-label={this.dropdownLabel}\n type=\"button\"\n >\n {this.dropdownLabel && this.dropdownLabel}\n <hy-icon class=\"hy-dropdown__icon\" icon={\"hy-icon-caret-down\"} size={14} aria-hidden=\"true\" />\n </button>\n <ul\n checkbox-checked={this.isChecked ? \"true\" : \"false\"}\n id=\"dropdownPanel\"\n class={`hy-dropdown__panel ${!this.isPanelOpen ? \"is-hidden\" : \"\"}`}\n aria-expanded={`${!this.isPanelOpen || false}`}\n role=\"listbox\"\n aria-labelledby=\"dropdownToggle\"\n >\n {this._dropdownOptions.map(({id, label, value}, index, items) => (\n <li\n key={id}\n data-id={`${id}`}\n role=\"option\"\n class={`hy-dropdown__panel-item ${this._dropdownOptions.length - 1 === index ? \"is-last\" : \"\"}\n ${this.focusedOptionIndex === index ? \"hy-dropdown__panel-item--focused\" : \"\"}`}\n onClick={(event) => this.handleMultiOptionClick(event, items[index])}\n onMouseEnter={() => this.handleOptionHover(index)}\n >\n <span data-id={`${id}`} class=\"hy-dropdown__checkbox\" data-value={`${value}`}>\n {label}\n <hy-icon class=\"hy-dropdown__label-icon\" icon={\"hy-icon-done\"} size={14} aria-hidden=\"true\" />\n </span>\n </li>\n ))}\n </ul>\n </Host>\n );\n }\n }\n}\n"],"mappings":"mHAAA,MAAMA,EAAgB,+hM,MCoBTC,EAAU,M,iRAGK,M,mBACM,K,gBACH,iB,iDAEE,M,UACR,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AO,2BAA2BjF,KAAKI,iBAAiBoC,OAAS,IAAME,EAAQ,UAAY,yBACvF1C,KAAKmD,qBAAuBT,EAAQ,mCAAqC,KAC7E2C,QAAUrD,GAAUhC,KAAKqD,uBAAuBrB,EAAOxB,EAAMkC,IAC7DiD,aAAc,IAAM3F,KAAKwE,kBAAkB9B,IAE3CqC,EAAA,kBAAe,GAAGjF,IAAMmF,MAAM,wBAAuB,aAAa,GAAG/E,KAClEH,EACDgF,EAAA,WAASE,MAAM,0BAA0BO,KAAM,eAAgBC,KAAM,GAAE,cAAc,c"}
@@ -1,3 +1,4 @@
1
+ import { EventEmitter } from "../../stencil-public-runtime";
1
2
  export interface IDropdownItem {
2
3
  id: string | number;
3
4
  label: string;
@@ -16,15 +17,28 @@ export declare class HyDropdown {
16
17
  dropdownId: string;
17
18
  dropdownOptions: IDropdownItem[] | string;
18
19
  defaultLabel: string;
20
+ type: string;
19
21
  defaultOption: string | number;
20
22
  isPanelOpen: boolean;
21
23
  isChecked: boolean;
22
24
  currentSingle: DefaultValue[];
25
+ currentMulti: IDropdownItem[];
26
+ focusedOptionIndex: number;
27
+ dropdownPanelToggled: EventEmitter;
28
+ dropdropValueChange: EventEmitter;
29
+ dropdropMultiValueChange: EventEmitter;
30
+ dropdownKeyPress: EventEmitter;
23
31
  componentWillLoad(): Promise<void>;
24
32
  componentWillUpdate(): void;
25
33
  watchPropHandler(newValue: string | number, oldValue: string | number): void;
26
- handlePanelToggle(): void;
27
- handleClick(event: any): void;
28
- handleSingleClick(event: any): void;
34
+ panelListener(e: any): void;
35
+ private handleMultiClick;
36
+ private handleSingleClick;
37
+ handleKeyDown(event: KeyboardEvent): void;
38
+ private handlePanelToggle;
39
+ handlePanelClickOutside(e: any): void;
40
+ private handleOptionSingleClick;
41
+ private handleMultiOptionClick;
42
+ private handleOptionHover;
29
43
  render(): any;
30
44
  }
@@ -278,15 +278,7 @@ export namespace Components {
278
278
  "dropdownLabel": string;
279
279
  "dropdownOptions": IDropdownItem[] | string;
280
280
  "single": boolean;
281
- }
282
- interface HyDropdownPanel {
283
- "isHidden": boolean;
284
- }
285
- interface HyDropdownPanelItem {
286
- "dropdownItemId": string | number;
287
- "dropdownItemLabel": string;
288
- "dropdownItemValue": string | number;
289
- "isLast"?: boolean;
281
+ "type": string;
290
282
  }
291
283
  interface HyEventItem {
292
284
  "dateLong": string;
@@ -932,6 +924,10 @@ export namespace Components {
932
924
  "viewsLabel": string;
933
925
  }
934
926
  }
927
+ export interface HyDropdownCustomEvent<T> extends CustomEvent<T> {
928
+ detail: T;
929
+ target: HTMLHyDropdownElement;
930
+ }
935
931
  export interface HyMenuLanguageCustomEvent<T> extends CustomEvent<T> {
936
932
  detail: T;
937
933
  target: HTMLHyMenuLanguageElement;
@@ -1045,18 +1041,6 @@ declare global {
1045
1041
  prototype: HTMLHyDropdownElement;
1046
1042
  new (): HTMLHyDropdownElement;
1047
1043
  };
1048
- interface HTMLHyDropdownPanelElement extends Components.HyDropdownPanel, HTMLStencilElement {
1049
- }
1050
- var HTMLHyDropdownPanelElement: {
1051
- prototype: HTMLHyDropdownPanelElement;
1052
- new (): HTMLHyDropdownPanelElement;
1053
- };
1054
- interface HTMLHyDropdownPanelItemElement extends Components.HyDropdownPanelItem, HTMLStencilElement {
1055
- }
1056
- var HTMLHyDropdownPanelItemElement: {
1057
- prototype: HTMLHyDropdownPanelItemElement;
1058
- new (): HTMLHyDropdownPanelItemElement;
1059
- };
1060
1044
  interface HTMLHyEventItemElement extends Components.HyEventItem, HTMLStencilElement {
1061
1045
  }
1062
1046
  var HTMLHyEventItemElement: {
@@ -1482,8 +1466,6 @@ declare global {
1482
1466
  "hy-cta-button": HTMLHyCtaButtonElement;
1483
1467
  "hy-cta-link": HTMLHyCtaLinkElement;
1484
1468
  "hy-dropdown": HTMLHyDropdownElement;
1485
- "hy-dropdown-panel": HTMLHyDropdownPanelElement;
1486
- "hy-dropdown-panel-item": HTMLHyDropdownPanelItemElement;
1487
1469
  "hy-event-item": HTMLHyEventItemElement;
1488
1470
  "hy-events": HTMLHyEventsElement;
1489
1471
  "hy-filter-group": HTMLHyFilterGroupElement;
@@ -1764,16 +1746,12 @@ declare namespace LocalJSX {
1764
1746
  "dropdownId"?: string;
1765
1747
  "dropdownLabel"?: string;
1766
1748
  "dropdownOptions"?: IDropdownItem[] | string;
1749
+ "onDropdownKeyPress"?: (event: HyDropdownCustomEvent<any>) => void;
1750
+ "onDropdownMultiValueChanged"?: (event: HyDropdownCustomEvent<any>) => void;
1751
+ "onDropdownPanelToggled"?: (event: HyDropdownCustomEvent<any>) => void;
1752
+ "onDropdownValueChanged"?: (event: HyDropdownCustomEvent<any>) => void;
1767
1753
  "single"?: boolean;
1768
- }
1769
- interface HyDropdownPanel {
1770
- "isHidden"?: boolean;
1771
- }
1772
- interface HyDropdownPanelItem {
1773
- "dropdownItemId"?: string | number;
1774
- "dropdownItemLabel"?: string;
1775
- "dropdownItemValue"?: string | number;
1776
- "isLast"?: boolean;
1754
+ "type"?: string;
1777
1755
  }
1778
1756
  interface HyEventItem {
1779
1757
  "dateLong"?: string;
@@ -2443,8 +2421,6 @@ declare namespace LocalJSX {
2443
2421
  "hy-cta-button": HyCtaButton;
2444
2422
  "hy-cta-link": HyCtaLink;
2445
2423
  "hy-dropdown": HyDropdown;
2446
- "hy-dropdown-panel": HyDropdownPanel;
2447
- "hy-dropdown-panel-item": HyDropdownPanelItem;
2448
2424
  "hy-event-item": HyEventItem;
2449
2425
  "hy-events": HyEvents;
2450
2426
  "hy-filter-group": HyFilterGroup;
@@ -2535,8 +2511,6 @@ declare module "@stencil/core" {
2535
2511
  "hy-cta-button": LocalJSX.HyCtaButton & JSXBase.HTMLAttributes<HTMLHyCtaButtonElement>;
2536
2512
  "hy-cta-link": LocalJSX.HyCtaLink & JSXBase.HTMLAttributes<HTMLHyCtaLinkElement>;
2537
2513
  "hy-dropdown": LocalJSX.HyDropdown & JSXBase.HTMLAttributes<HTMLHyDropdownElement>;
2538
- "hy-dropdown-panel": LocalJSX.HyDropdownPanel & JSXBase.HTMLAttributes<HTMLHyDropdownPanelElement>;
2539
- "hy-dropdown-panel-item": LocalJSX.HyDropdownPanelItem & JSXBase.HTMLAttributes<HTMLHyDropdownPanelItemElement>;
2540
2514
  "hy-event-item": LocalJSX.HyEventItem & JSXBase.HTMLAttributes<HTMLHyEventItemElement>;
2541
2515
  "hy-events": LocalJSX.HyEvents & JSXBase.HTMLAttributes<HTMLHyEventsElement>;
2542
2516
  "hy-filter-group": LocalJSX.HyFilterGroup & JSXBase.HTMLAttributes<HTMLHyFilterGroupElement>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcenteratunihelsinki/huds-lib",
3
- "version": "0.8.69",
3
+ "version": "0.8.70",
4
4
  "description": "Helsinki University Design System library",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -68,5 +68,5 @@
68
68
  "pre-commit": "pretty-quick --staged"
69
69
  }
70
70
  },
71
- "gitHead": "6db78439796ed46213531878763b896e9dc7c423"
71
+ "gitHead": "c8eb758490d770f9294d7bfce2481a4dc67a961f"
72
72
  }
@@ -1,11 +0,0 @@
1
- import type { Components, JSX } from "../dist/types/components";
2
-
3
- interface HyDropdownPanelItem extends Components.HyDropdownPanelItem, HTMLElement {}
4
- export const HyDropdownPanelItem: {
5
- prototype: HyDropdownPanelItem;
6
- new (): HyDropdownPanelItem;
7
- };
8
- /**
9
- * Used to define this component and all nested components recursively.
10
- */
11
- export const defineCustomElement: () => void;
@@ -1,8 +0,0 @@
1
- import { H as HyDropdownPanelItem$1, d as defineCustomElement$1 } from './hy-dropdown.panel.item.js';
2
-
3
- const HyDropdownPanelItem = HyDropdownPanelItem$1;
4
- const defineCustomElement = defineCustomElement$1;
5
-
6
- export { HyDropdownPanelItem, defineCustomElement };
7
-
8
- //# sourceMappingURL=hy-dropdown-panel-item.js.map
@@ -1 +0,0 @@
1
- {"file":"hy-dropdown-panel-item.js","mappings":";;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -1,11 +0,0 @@
1
- import type { Components, JSX } from "../dist/types/components";
2
-
3
- interface HyDropdownPanel extends Components.HyDropdownPanel, HTMLElement {}
4
- export const HyDropdownPanel: {
5
- prototype: HyDropdownPanel;
6
- new (): HyDropdownPanel;
7
- };
8
- /**
9
- * Used to define this component and all nested components recursively.
10
- */
11
- export const defineCustomElement: () => void;
@@ -1,8 +0,0 @@
1
- import { H as HyDropdownPanel$1, d as defineCustomElement$1 } from './hy-dropdown.panel.js';
2
-
3
- const HyDropdownPanel = HyDropdownPanel$1;
4
- const defineCustomElement = defineCustomElement$1;
5
-
6
- export { HyDropdownPanel, defineCustomElement };
7
-
8
- //# sourceMappingURL=hy-dropdown-panel.js.map
@@ -1 +0,0 @@
1
- {"file":"hy-dropdown-panel.js","mappings":";;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -1,43 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
- import { d as defineCustomElement$1 } from './icon.js';
3
-
4
- const HyDropdownPanelItem = /*@__PURE__*/ proxyCustomElement(class HyDropdownPanelItem extends HTMLElement {
5
- constructor() {
6
- super();
7
- this.__registerHost();
8
- this.isLast = false;
9
- this.dropdownItemId = undefined;
10
- this.dropdownItemValue = undefined;
11
- this.dropdownItemLabel = undefined;
12
- }
13
- render() {
14
- return (h("li", { class: `hy-dropdown__panel-item ${this.isLast ? "is-last" : ""}` }, h("input", { type: "checkbox", class: "hy-dropdown__checkbox", id: `${this.dropdownItemId}`, value: `${this.dropdownItemValue}` }), h("label", { class: "hy-dropdown__label", htmlFor: `${this.dropdownItemId}` }, this.dropdownItemLabel, h("hy-icon", { class: "hy-dropdown__label-icon", icon: "hy-icon-done", size: 14, "aria-hidden": "true" }))));
15
- }
16
- }, [0, "hy-dropdown-panel-item", {
17
- "isLast": [4, "is-last"],
18
- "dropdownItemId": [8, "dropdown-item-id"],
19
- "dropdownItemValue": [8, "dropdown-item-value"],
20
- "dropdownItemLabel": [1, "dropdown-item-label"]
21
- }]);
22
- function defineCustomElement() {
23
- if (typeof customElements === "undefined") {
24
- return;
25
- }
26
- const components = ["hy-dropdown-panel-item", "hy-icon"];
27
- components.forEach(tagName => { switch (tagName) {
28
- case "hy-dropdown-panel-item":
29
- if (!customElements.get(tagName)) {
30
- customElements.define(tagName, HyDropdownPanelItem);
31
- }
32
- break;
33
- case "hy-icon":
34
- if (!customElements.get(tagName)) {
35
- defineCustomElement$1();
36
- }
37
- break;
38
- } });
39
- }
40
-
41
- export { HyDropdownPanelItem as H, defineCustomElement as d };
42
-
43
- //# sourceMappingURL=hy-dropdown.panel.item.js.map
@@ -1 +0,0 @@
1
- {"file":"hy-dropdown.panel.item.js","mappings":";;;MAMa,mBAAmB;;;;kBACH,KAAK;;;;;EAKhC,MAAM;IACJ,QACE,UAAI,KAAK,EAAE,2BAA2B,IAAI,CAAC,MAAM,GAAG,SAAS,GAAG,EAAE,EAAE,IAClE,aACE,IAAI,EAAC,UAAU,EACf,KAAK,EAAC,uBAAuB,EAC7B,EAAE,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,EAC5B,KAAK,EAAE,GAAG,IAAI,CAAC,iBAAiB,EAAE,GAClC,EACF,aAAO,KAAK,EAAC,oBAAoB,EAAC,OAAO,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,IAChE,IAAI,CAAC,iBAAiB,EACvB,eAAS,KAAK,EAAC,yBAAyB,EAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE,iBAAc,MAAM,GAAG,CACxF,CACL,EACL;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/hy-dropdown/hy-dropdown.panel.item.tsx"],"sourcesContent":["import {Component, h, Prop} from \"@stencil/core\";\n\n@Component({\n tag: \"hy-dropdown-panel-item\",\n shadow: false,\n})\nexport class HyDropdownPanelItem {\n @Prop() isLast?: boolean = false;\n @Prop() dropdownItemId: string | number;\n @Prop() dropdownItemValue: string | number;\n @Prop() dropdownItemLabel: string;\n\n render() {\n return (\n <li class={`hy-dropdown__panel-item ${this.isLast ? \"is-last\" : \"\"}`}>\n <input\n type=\"checkbox\"\n class=\"hy-dropdown__checkbox\"\n id={`${this.dropdownItemId}`}\n value={`${this.dropdownItemValue}`}\n />\n <label class=\"hy-dropdown__label\" htmlFor={`${this.dropdownItemId}`}>\n {this.dropdownItemLabel}\n <hy-icon class=\"hy-dropdown__label-icon\" icon={\"hy-icon-done\"} size={14} aria-hidden=\"true\" />\n </label>\n </li>\n );\n }\n}\n"],"version":3}
@@ -1,31 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
-
3
- const HyDropdownPanel = /*@__PURE__*/ proxyCustomElement(class HyDropdownPanel extends HTMLElement {
4
- constructor() {
5
- super();
6
- this.__registerHost();
7
- this.isHidden = undefined;
8
- }
9
- render() {
10
- return (h("ul", { id: "dropdownPanel", class: `hy-dropdown__panel ${this.isHidden ? "is-hidden" : ""}`, "aria-hidden": `${this.isHidden || false}`, role: "region", "aria-labelledby": "dropdownToggle" }, h("slot", null)));
11
- }
12
- }, [4, "hy-dropdown-panel", {
13
- "isHidden": [4, "is-hidden"]
14
- }]);
15
- function defineCustomElement() {
16
- if (typeof customElements === "undefined") {
17
- return;
18
- }
19
- const components = ["hy-dropdown-panel"];
20
- components.forEach(tagName => { switch (tagName) {
21
- case "hy-dropdown-panel":
22
- if (!customElements.get(tagName)) {
23
- customElements.define(tagName, HyDropdownPanel);
24
- }
25
- break;
26
- } });
27
- }
28
-
29
- export { HyDropdownPanel as H, defineCustomElement as d };
30
-
31
- //# sourceMappingURL=hy-dropdown.panel.js.map
@@ -1 +0,0 @@
1
- {"file":"hy-dropdown.panel.js","mappings":";;MAMa,eAAe;;;;;;EAG1B,MAAM;IACJ,QACE,UACE,EAAE,EAAC,eAAe,EAClB,KAAK,EAAE,sBAAsB,IAAI,CAAC,QAAQ,GAAG,WAAW,GAAG,EAAE,EAAE,iBAClD,GAAG,IAAI,CAAC,QAAQ,IAAI,KAAK,EAAE,EACxC,IAAI,EAAC,QAAQ,qBACG,gBAAgB,IAEhC,eAAQ,CACL,EACL;GACH;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/hy-dropdown/hy-dropdown.panel.tsx"],"sourcesContent":["import {Component, h, Prop} from \"@stencil/core\";\n\n@Component({\n tag: \"hy-dropdown-panel\",\n shadow: false,\n})\nexport class HyDropdownPanel {\n @Prop() isHidden: boolean;\n\n render() {\n return (\n <ul\n id=\"dropdownPanel\"\n class={`hy-dropdown__panel ${this.isHidden ? \"is-hidden\" : \"\"}`}\n aria-hidden={`${this.isHidden || false}`}\n role=\"region\"\n aria-labelledby=\"dropdownToggle\"\n >\n <slot />\n </ul>\n );\n }\n}\n"],"version":3}
@@ -1,141 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-32830401.js');
6
- const globalScript = require('./globalScript-9994473d.js');
7
-
8
- const hyDropdownCss = ":root{--brand-main:#0e688b;--brand-main-soft:#b1e7ff;--brand-main-bright:#48c5f8;--brand-main-light:#107eab;--brand-main-active:#005379;--brand-main-dark:#003146;--brand-main-nearly-black:#000222;--link-blue:#0479a4;--link-disabled:#767676;--grayscale-white:#fff;--grayscale-slightly-gray:#fefefe;--grayscale-light:#f8f8f8;--grayscale-medium:#d2d2d2;--grayscale-background-box:#f5f5f5;--grayscale-tabs-border:#e6e6e6;--grayscale-background-arrow:#dfdfdf;--grayscale-medium-dark:#979797;--grayscale-dark:#555555;--grayscale-dark-text:#222222;--grayscale-black:#000000;--additional-red-light:#e5053a;--additional-red-dark:#a31621;--additional-purple-light:#420039;--additional-yellow-light:#f9a21a;--additional-yellow:#c47f1b;--additional-skyblue:#48c5f8;--additional-orange:#d14600;--additional-green-light:#96ba3c;--additional-green-dark:#006400;--hover-gray:#eaeaea}*{-webkit-box-sizing:border-box;box-sizing:border-box}:root{--gutter-mobile:16px;--gutter-narrow:24px;--gutter-medium:24px;--gutter-wide:24px;--gutter-extrawide:32px}:root{--breakpoint-extrawide:75.0625rem;--breakpoint-max-width:75.0625rem;--breakpoint-medium:48rem;--breakpoint-narrow:30rem;--breakpoint-wide:60rem}.hy-dropdown{display:inline-block;min-width:100%;position:relative}@media (min-width: 30rem){.hy-dropdown{min-width:48.3%}}@media (min-width: 75.0625rem){.hy-dropdown{min-width:23.03%}}.hy-dropdown label.hy-dropdown__button-label{font-size:1rem;line-height:20px;font-weight:700;display:block;font-family:var(--main-font-family);letter-spacing:-0.32px;margin-bottom:8px}.hy-dropdown--single .hy-dropdown__panel{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:330px;min-width:100%}.hy-dropdown__toggle{font-size:0.875rem;line-height:24px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--grayscale-white);border-radius:0;border:1px solid var(--grayscale-medium-dark);color:var(--link-blue);display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-family:var(--main-font-family);font-weight:600;min-height:40px;height:auto;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;letter-spacing:normal;padding:0 0 0 16px;text-align:left;max-width:280px;width:100%}@media (min-width: 30rem){.hy-dropdown__toggle{font-size:1rem;line-height:24px;min-height:44px}}@media (min-width: 75.0625rem){.hy-dropdown__toggle{min-height:48px}}.hy-dropdown__toggle:hover{border-color:var(--brand-main-light);cursor:pointer}.hy-dropdown__toggle:focus{border-color:var(--brand-main-light);border-style:solid inset solid solid;border-width:2px;outline:0;text-indent:-1px}.hy-dropdown__toggle svg{pointer-events:none}.hy-dropdown__toggle.is-open .hy-dropdown__icon{background-color:var(--brand-main-light);-webkit-transform:rotate(180deg);transform:rotate(180deg)}.hy-dropdown__toggle.is-open .hy-dropdown__icon::before{display:none}.hy-dropdown__toggle.is-open .hy-dropdown__icon svg{fill:var(--grayscale-white)}.hy-dropdown__icon{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-negative:0;flex-shrink:0;height:40px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin:0 0 0 16px;position:relative;width:40px}.hy-dropdown__icon::before{border-left:0.5px solid var(--grayscale-medium-dark);content:\"\";display:inline-block;height:65%;left:0;position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}@media (min-width: 30rem){.hy-dropdown__icon{height:44px;width:44px}}@media (min-width: 75.0625rem){.hy-dropdown__icon{height:48px;width:48px}}.hy-dropdown__icon svg{fill:var(--link-blue)}@media (min-width: 30rem){.hy-dropdown__icon svg{height:16px;width:16px}}.hy-dropdown__panel{background-color:var(--grayscale-white);-webkit-box-shadow:0 10px 20px 0 rgba(0, 49, 70, 0.2);box-shadow:0 10px 20px 0 rgba(0, 49, 70, 0.2);list-style:none;margin:0;padding:6px;position:absolute;width:100%;z-index:11}.hy-dropdown__panel.is-hidden{display:none;visibility:hidden}.hy-dropdown__panel-item{position:relative}.hy-dropdown__panel-item:not(.is-last){margin-bottom:6px}.hy-dropdown__label{font-size:0.875rem;line-height:24px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--grayscale-white);border-radius:0;border:1px solid var(--grayscale-medium-dark);color:var(--link-blue);display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-family:var(--main-font-family);font-weight:600;min-height:40px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;letter-spacing:normal;padding:0 16px;text-align:left;width:100%}@media (min-width: 30rem){.hy-dropdown__label{font-size:1rem;line-height:24px}}.hy-dropdown__label-icon{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:none !important;-ms-flex-negative:0;flex-shrink:0;height:40px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;position:relative;visibility:hidden;width:40px}.hy-dropdown__checkbox{height:100%;margin:0;opacity:0;position:absolute;width:100%;z-index:10}.hy-dropdown__checkbox:checked+label{border-color:var(--grayscale-black);border-style:solid inset solid solid;border-width:2px;color:var(--grayscale-black);outline:0;text-indent:-1px}.hy-dropdown__checkbox:checked+label .hy-dropdown__label-icon{display:-webkit-inline-box !important;display:-ms-inline-flexbox !important;display:inline-flex !important;visibility:visible}.hy-dropdown__checkbox:hover{cursor:pointer}.hy-dropdown__checkbox:hover+label{border-color:var(--brand-main-light)}.hy-dropdown__checkbox:focus+label{border-color:var(--brand-main-light);border-style:solid inset solid solid;border-width:2px;outline:0;text-indent:-1px}";
9
-
10
- const HyDropdown = class {
11
- constructor(hostRef) {
12
- index.registerInstance(this, hostRef);
13
- this.single = false;
14
- this.dropdownLabel = null;
15
- this.dropdownId = "dropdownToggle";
16
- this.dropdownOptions = undefined;
17
- this.defaultLabel = "All";
18
- this.defaultOption = null;
19
- this.isPanelOpen = false;
20
- this.isChecked = false;
21
- this.currentSingle = [{ id: 0, label: this.defaultLabel, value: 0 }];
22
- }
23
- async componentWillLoad() {
24
- this._dropdownOptions = await globalScript.jsonParserWorker(this.dropdownOptions);
25
- }
26
- componentWillUpdate() {
27
- const items = this.el.querySelectorAll(".hy-dropdown__checkbox");
28
- if (items) {
29
- if ([...items].some((item) => item.checked == true)) {
30
- this.isChecked = true;
31
- }
32
- else {
33
- this.isChecked = false;
34
- }
35
- }
36
- }
37
- watchPropHandler(newValue, oldValue) {
38
- if (!this.single)
39
- return;
40
- if (newValue !== oldValue) {
41
- const dropdownPanelCheckboxElements = this.el.getElementsByClassName("hy-dropdown__checkbox");
42
- Array.from(dropdownPanelCheckboxElements).filter((item) => {
43
- if (item.id == newValue) {
44
- item.checked = true;
45
- this.currentSingle = this._dropdownOptions.filter((option) => option.id == newValue);
46
- return;
47
- }
48
- return null;
49
- });
50
- }
51
- }
52
- handlePanelToggle() {
53
- this.isPanelOpen = !this.isPanelOpen;
54
- }
55
- handleClick(event) {
56
- const dropdownToggleButtonElement = this.el.querySelector(`#${this.dropdownId}`);
57
- const dropdownPanelElement = this.el.querySelector(".hy-dropdown__panel");
58
- const dropdownPanelCheckboxElements = this.el.querySelectorAll(".hy-dropdown__checkbox");
59
- const dropdownToggleButtonIconElement = this.el.querySelector(".hy-dropdown__icon");
60
- const { target } = event;
61
- const allowedElements = [
62
- dropdownToggleButtonElement,
63
- dropdownPanelElement,
64
- dropdownToggleButtonIconElement,
65
- ...dropdownPanelCheckboxElements, // Spread ("copy") items to allowedElement array.
66
- ];
67
- if (this.isPanelOpen && !allowedElements.includes(target)) {
68
- this.isPanelOpen = false;
69
- }
70
- event.stopPropagation();
71
- }
72
- handleSingleClick(event) {
73
- if (!this.single || !this.isPanelOpen)
74
- return;
75
- const dropdownPanelCheckboxElements = this.el.getElementsByClassName("hy-dropdown__checkbox");
76
- const allowedElements = [...dropdownPanelCheckboxElements];
77
- const { target } = event;
78
- if (!allowedElements.includes(target))
79
- return;
80
- Array.from(dropdownPanelCheckboxElements).filter((item) => {
81
- if (item.id == target.id) {
82
- if (!item.checked) {
83
- this.currentSingle = [{ id: null, label: this.defaultLabel, value: null }];
84
- return;
85
- }
86
- this.currentSingle = this._dropdownOptions.filter((option) => option.id == target.id);
87
- return;
88
- }
89
- if (item.id !== target.id && item.checked) {
90
- item.checked = false;
91
- return;
92
- }
93
- return null;
94
- });
95
- event.stopPropagation();
96
- }
97
- render() {
98
- const { label: currentLabel, id: currentId, value: currentValue } = this.currentSingle[0];
99
- const classAttributes = ["hy-dropdown", this.single ? "hy-dropdown--single" : ""].join(" ");
100
- if (this.single) {
101
- return (index.h(index.Host, { class: classAttributes }, this.dropdownLabel && (index.h("label", { class: "hy-dropdown__button-label", htmlFor: this.dropdownId }, this.dropdownLabel)), index.h("button", { id: this.dropdownId, class: `hy-dropdown__toggle ${this.isPanelOpen ? "is-open" : ""}`, "aria-expanded": `${this.isPanelOpen || false}`, "aria-controls": "dropdownPanel", onClick: () => this.handlePanelToggle(), "aria-label": this.dropdownLabel, "data-current-id": currentId, "data-current-value": currentValue, value: currentId, type: "button" }, currentLabel, index.h("hy-icon", { class: "hy-dropdown__icon", icon: "hy-icon-caret-down", size: 14, "aria-hidden": "true" })), index.h("hy-dropdown-panel", { "checkbox-checked": this.isChecked ? "true" : "false", "is-hidden": !this.isPanelOpen }, this._dropdownOptions.map(({ id, label, value }, index$1) => (index.h("hy-dropdown-panel-item", { "dropdown-item-id": id, "dropdown-item-label": label, "dropdown-item-value": value, "is-last": this._dropdownOptions.length - 1 === index$1 }))))));
102
- }
103
- else {
104
- return (index.h(index.Host, { class: classAttributes }, index.h("button", { id: this.dropdownId, class: `hy-dropdown__toggle ${this.isPanelOpen ? "is-open" : ""}`, "aria-expanded": `${this.isPanelOpen || false}`, "aria-controls": "dropdownPanel", onClick: () => this.handlePanelToggle(), "aria-label": this.dropdownLabel, type: "button" }, this.dropdownLabel && this.dropdownLabel, index.h("hy-icon", { class: "hy-dropdown__icon", icon: "hy-icon-caret-down", size: 14, "aria-hidden": "true" })), index.h("hy-dropdown-panel", { "checkbox-checked": this.isChecked ? "true" : "false", "is-hidden": !this.isPanelOpen }, this._dropdownOptions.map(({ id, label, value }, index$1) => (index.h("hy-dropdown-panel-item", { "dropdown-item-id": id, "dropdown-item-label": label, "dropdown-item-value": value, "is-last": this._dropdownOptions.length - 1 === index$1 }))))));
105
- }
106
- }
107
- get el() { return index.getElement(this); }
108
- static get watchers() { return {
109
- "defaultOption": ["watchPropHandler"]
110
- }; }
111
- };
112
- HyDropdown.style = hyDropdownCss;
113
-
114
- const HyDropdownPanel = class {
115
- constructor(hostRef) {
116
- index.registerInstance(this, hostRef);
117
- this.isHidden = undefined;
118
- }
119
- render() {
120
- return (index.h("ul", { id: "dropdownPanel", class: `hy-dropdown__panel ${this.isHidden ? "is-hidden" : ""}`, "aria-hidden": `${this.isHidden || false}`, role: "region", "aria-labelledby": "dropdownToggle" }, index.h("slot", null)));
121
- }
122
- };
123
-
124
- const HyDropdownPanelItem = class {
125
- constructor(hostRef) {
126
- index.registerInstance(this, hostRef);
127
- this.isLast = false;
128
- this.dropdownItemId = undefined;
129
- this.dropdownItemValue = undefined;
130
- this.dropdownItemLabel = undefined;
131
- }
132
- render() {
133
- return (index.h("li", { class: `hy-dropdown__panel-item ${this.isLast ? "is-last" : ""}` }, index.h("input", { type: "checkbox", class: "hy-dropdown__checkbox", id: `${this.dropdownItemId}`, value: `${this.dropdownItemValue}` }), index.h("label", { class: "hy-dropdown__label", htmlFor: `${this.dropdownItemId}` }, this.dropdownItemLabel, index.h("hy-icon", { class: "hy-dropdown__label-icon", icon: "hy-icon-done", size: 14, "aria-hidden": "true" }))));
134
- }
135
- };
136
-
137
- exports.hy_dropdown = HyDropdown;
138
- exports.hy_dropdown_panel = HyDropdownPanel;
139
- exports.hy_dropdown_panel_item = HyDropdownPanelItem;
140
-
141
- //# sourceMappingURL=hy-dropdown_3.cjs.entry.js.map