@arbetsformedlingen/yrkesvaljaren 2.0.12 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -21
- package/dist/cjs/{af-validation-message-Cy89nVEv.js → af-validation-message-BdR9X_qh.js} +1 -1
- package/dist/cjs/core-selector.cjs.entry.js +342 -23
- package/dist/cjs/digi-service-job-selector.cjs.entry.js +352 -61
- package/dist/cjs/{index-hZgOvC17.js → index-DMQDFAL7.js} +0 -22
- package/dist/cjs/index.cjs.js +4 -7
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/{esm/fuse-BPnhMTul.js → cjs/types-DdzCbiye.js} +965 -1
- package/dist/cjs/yrkesvaljaren.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +0 -1
- package/dist/collection/components/core-selector/core-selector.css +70 -49
- package/dist/collection/components/core-selector/core-selector.js +309 -14
- package/dist/collection/components/design-compat/af-icon.js +8 -7
- package/dist/collection/components/job-selector/job-selector-controller.js +13 -3
- package/dist/collection/components/job-selector/job-selector.css +188 -34
- package/dist/collection/components/job-selector/job-selector.js +199 -10
- package/dist/components/core-selector2.js +1 -1
- package/dist/components/digi-service-job-selector.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/types.js +1 -1
- package/dist/esm/{af-validation-message-BgoGzzBf.js → af-validation-message-DMoOu-0k.js} +1 -1
- package/dist/esm/core-selector.entry.js +342 -23
- package/dist/esm/digi-service-job-selector.entry.js +310 -19
- package/dist/esm/{index-HNd02eQb.js → index-vJ-tamti.js} +1 -22
- package/dist/esm/index.js +2 -4
- package/dist/esm/loader.js +3 -3
- package/dist/{cjs/fuse-BTLNKxuL.js → esm/types-DVos4HHS.js} +948 -2
- package/dist/esm/yrkesvaljaren.js +3 -3
- package/dist/types/components/core-selector/core-selector.d.ts +68 -0
- package/dist/types/components/job-selector/job-selector-controller.d.ts +5 -0
- package/dist/types/components/job-selector/job-selector.d.ts +21 -3
- package/dist/types/components/job-selector/types.d.ts +12 -0
- package/dist/types/components.d.ts +20 -99
- package/dist/types/index.d.ts +1 -1
- package/dist/vendor/taxonomy-core/af-data-layer.d.ts +16 -0
- package/dist/vendor/taxonomy-core/af-data-layer.js +24 -0
- package/dist/vendor/taxonomy-core/index.d.ts +1 -1
- package/dist/vendor/taxonomy-core/index.js +1 -1
- package/dist/vendor/taxonomy-core/pii-sanitizer.d.ts +25 -0
- package/dist/vendor/taxonomy-core/pii-sanitizer.js +137 -0
- package/dist/vendor/taxonomy-core/selector-navigation.d.ts +9 -1
- package/dist/vendor/taxonomy-core/selector-navigation.js +28 -1
- package/dist/vendor/taxonomy-core/selector-types.d.ts +12 -0
- package/dist/yrkesvaljaren/index.esm.js +1 -1
- package/dist/yrkesvaljaren/p-0f19a308.entry.js +1 -0
- package/dist/yrkesvaljaren/{p-BUviBbwX.js → p-DHK95AvZ.js} +1 -1
- package/dist/yrkesvaljaren/p-DVos4HHS.js +1 -0
- package/dist/yrkesvaljaren/p-b81496c8.entry.js +1 -0
- package/dist/yrkesvaljaren/p-vJ-tamti.js +3 -0
- package/dist/yrkesvaljaren/yrkesvaljaren.esm.js +1 -1
- package/package.json +12 -10
- package/dist/cjs/geo-valjaren.cjs.entry.js +0 -14910
- package/dist/cjs/job-selector-demo.cjs.entry.js +0 -690
- package/dist/cjs/neobrutal-search.cjs.entry.js +0 -171
- package/dist/cjs/search.engine-D4cpbVzd.js +0 -504
- package/dist/cjs/taxonomy-registry-Dzt0SPzT.js +0 -454
- package/dist/cjs/types-CtHBl6Ra.js +0 -14
- package/dist/collection/components/geovaljaren/geovaljaren.css +0 -21
- package/dist/collection/components/geovaljaren/geovaljaren.js +0 -304
- package/dist/collection/components/geovaljaren/logic/adapter.utils.js +0 -20
- package/dist/collection/components/geovaljaren/logic/data.utils.js +0 -12
- package/dist/collection/components/geovaljaren/logic/history-service.js +0 -25
- package/dist/collection/components/geovaljaren/logic/search.engine.js +0 -28
- package/dist/collection/verkstad/verkstad.js +0 -408
- package/dist/components/fuse.js +0 -1
- package/dist/components/geo-valjaren.d.ts +0 -11
- package/dist/components/geo-valjaren.js +0 -1
- package/dist/components/job-selector-demo.d.ts +0 -11
- package/dist/components/job-selector-demo.js +0 -1
- package/dist/components/job-selector.js +0 -1
- package/dist/components/neobrutal-search.d.ts +0 -11
- package/dist/components/neobrutal-search.js +0 -1
- package/dist/components/search.engine.js +0 -1
- package/dist/esm/geo-valjaren.entry.js +0 -14908
- package/dist/esm/job-selector-demo.entry.js +0 -688
- package/dist/esm/neobrutal-search.entry.js +0 -169
- package/dist/esm/search.engine-BaWUTc3r.js +0 -493
- package/dist/esm/taxonomy-registry-C-pSh51L.js +0 -449
- package/dist/esm/types-DHUftoZJ.js +0 -12
- package/dist/types/components/geovaljaren/geovaljaren.d.ts +0 -24
- package/dist/types/components/geovaljaren/logic/adapter.utils.d.ts +0 -7
- package/dist/types/components/geovaljaren/logic/data.utils.d.ts +0 -7
- package/dist/types/components/geovaljaren/logic/history-service.d.ts +0 -6
- package/dist/types/components/geovaljaren/logic/search.engine.d.ts +0 -7
- package/dist/types/components/job-selector-demo/job-selector-demo.d.ts +0 -65
- package/dist/types/components/neobrutal-search/neobrutal-search.d.ts +0 -18
- package/dist/types/verkstad/verkstad.d.ts +0 -1
- package/dist/types/vitest-globals.d.ts +0 -1
- package/dist/yrkesvaljaren/p-5c3a5308.entry.js +0 -1
- package/dist/yrkesvaljaren/p-9ecd5177.entry.js +0 -1
- package/dist/yrkesvaljaren/p-BPnhMTul.js +0 -1
- package/dist/yrkesvaljaren/p-C-pSh51L.js +0 -1
- package/dist/yrkesvaljaren/p-CjMoDiZD.js +0 -1
- package/dist/yrkesvaljaren/p-DHUftoZJ.js +0 -1
- package/dist/yrkesvaljaren/p-HNd02eQb.js +0 -3
- package/dist/yrkesvaljaren/p-b6130085.entry.js +0 -1
- package/dist/yrkesvaljaren/p-dbbea724.entry.js +0 -1
- package/dist/yrkesvaljaren/p-df3fa43b.entry.js +0 -1
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var afValidationMessage = require('./af-validation-message-
|
|
3
|
+
var index = require('./index-DMQDFAL7.js');
|
|
4
|
+
var afValidationMessage = require('./af-validation-message-BdR9X_qh.js');
|
|
5
5
|
|
|
6
6
|
const svgMarkup = {
|
|
7
7
|
search: '<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" style="width:100%;height:100%"><path d="M25.645 22.437l-5.063-5.053a1.22 1.22 0 00-.864-.355h-.827a10.477 10.477 0 002.234-6.487C21.125 4.719 16.397 0 10.562 0 4.729 0 0 4.719 0 10.542c0 5.823 4.728 10.542 10.563 10.542 2.452 0 4.707-.831 6.5-2.23v.826c0 .324.126.633.355.862l5.063 5.053c.477.476 1.25.476 1.721 0l1.437-1.435a1.22 1.22 0 00.006-1.723zm-15.082-5.408c-3.59 0-6.5-2.899-6.5-6.487a6.49 6.49 0 016.5-6.487c3.59 0 6.5 2.899 6.5 6.487a6.49 6.49 0 01-6.5 6.487z" fill="currentColor" fill-rule="nonzero"/></svg>',
|
|
8
8
|
check: '<svg width="23" height="18" viewBox="0 0 23 18" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" style="width:100%;height:100%"><path d="M20.547.18L7.315 13.627 2.453 8.686a.597.597 0 00-.853 0L.177 10.132a.62.62 0 000 .868l6.711 6.82c.236.24.618.24.854 0L22.823 2.493a.62.62 0 000-.867L21.4.18a.597.597 0 00-.853 0z" fill="currentColor"/></svg>',
|
|
9
9
|
x: '<svg width="12" height="12" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" style="width:100%;height:100%"><g stroke="currentColor" stroke-width="2" fill="none" fill-rule="evenodd" stroke-linecap="square"><path d="M2 2l7.986 7.986M9.986 2L2 9.986"/></g></svg>',
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
// Utseendet ligger i klasserna af-icon och af-icon--default-size i af-design-tokens.css.
|
|
12
|
+
// Använd inte style-objekt här: Stencil ser dem bara i @Component-filer, och utan en
|
|
13
|
+
// sådan komponent i bygget saknar runtime stöd för style-objekt.
|
|
14
|
+
const AfIcon = ({ name, class: className }) => (index.h("span", { class: {
|
|
15
|
+
'af-icon': true,
|
|
16
|
+
'af-icon--default-size': !className,
|
|
17
|
+
...(typeof className === 'string' ? { [className]: true } : className),
|
|
18
|
+
}, "aria-hidden": "true", innerHTML: svgMarkup[name] }));
|
|
18
19
|
|
|
19
20
|
const AfLabel = ({ label, forId, description, required = false }) => (index.h("div", { class: "af-form-label" }, index.h("label", { class: "af-form-label__label", htmlFor: forId }, label, required ? ' *' : ''), description && index.h("span", { class: "af-form-label__description" }, description)));
|
|
20
21
|
|
|
@@ -26,13 +27,40 @@ const AfTag = ({ text, breakWords = false, onRemove }) => (index.h("span", { cla
|
|
|
26
27
|
/** Max antal tecken i sökfältet och därmed i ett manuellt val. Längsta begrepp i taxonomin är 90 tecken. */
|
|
27
28
|
const SELECTOR_INPUT_MAX_LENGTH = 120;
|
|
28
29
|
function shouldShowManualInput(state, requireSelection = false) {
|
|
29
|
-
if (!state || requireSelection)
|
|
30
|
+
if (!state || requireSelection || state.manualInputBlocked)
|
|
30
31
|
return false;
|
|
31
32
|
const inputValue = state.inputValue.trim();
|
|
32
33
|
if (inputValue === '')
|
|
33
34
|
return false;
|
|
34
35
|
return !state.suggestions.some((suggestion) => suggestion.label.toLowerCase() === inputValue.toLowerCase());
|
|
35
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Text som skärmläsare får om antalet träffar när användaren har skrivit i fältet.
|
|
39
|
+
* Bara valbara förslag räknas: fritextalternativet och redan valda förslag räknas inte.
|
|
40
|
+
* När det finns fler träffar än som visas (hasMoreResults, annars när taket maxResults är nått)
|
|
41
|
+
* sägs "Minst N".
|
|
42
|
+
* Tom sträng när fältet är tomt.
|
|
43
|
+
*/
|
|
44
|
+
function describeResultCount(state, config = {}) {
|
|
45
|
+
if (!state || state.inputValue.trim() === '')
|
|
46
|
+
return '';
|
|
47
|
+
const count = state.suggestions.filter((suggestion) => !suggestion.isSelected).length;
|
|
48
|
+
if (count > 0) {
|
|
49
|
+
const isCapped = state.hasMoreResults
|
|
50
|
+
?? (!!config.maxResults && state.suggestions.length >= config.maxResults);
|
|
51
|
+
return `${isCapped ? 'Minst ' : ''}${count} förslag. Använd pil ned för att välja.`;
|
|
52
|
+
}
|
|
53
|
+
if (!shouldShowManualInput(state, config.requireSelection))
|
|
54
|
+
return 'Inga förslag.';
|
|
55
|
+
switch (config.manualInputMode) {
|
|
56
|
+
case 'feedback':
|
|
57
|
+
return 'Inga förslag. Använd pil ned för att skicka in texten som förslag.';
|
|
58
|
+
case 'combined':
|
|
59
|
+
return 'Inga förslag. Använd pil ned för att använda texten och skicka in den som förslag.';
|
|
60
|
+
default:
|
|
61
|
+
return 'Inga förslag. Använd pil ned för att använda texten.';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
36
64
|
function getNextActiveIndex(direction, currentIndex, totalOptions) {
|
|
37
65
|
if (totalOptions <= 0)
|
|
38
66
|
return -1;
|
|
@@ -81,7 +109,7 @@ function reconcileActiveIndex({ activeIndex, newState, oldState, requireSelectio
|
|
|
81
109
|
};
|
|
82
110
|
}
|
|
83
111
|
|
|
84
|
-
const coreSelectorCss = () => `:host{--digi--grayscale-0:#ffffff;--digi--grayscale-50:#fbfbfb;--digi--grayscale-100:#f4f4f4;--digi--grayscale-200:#ededed;--digi--grayscale-300:#e4e4e4;--digi--grayscale-400:#dddddd;--digi--grayscale-500:#cacaca;--digi--grayscale-600:#acacac;--digi--grayscale-700:#757575;--digi--grayscale-800:#5c5c5c;--digi--grayscale-900:#333333;--digi--grayscale-1000:#000000;--digi--global--color--cta--link--base:#1616b2;--digi--global--color--function--danger--base:#da0000;--digi--global--color--function--success--base:#008a20;--digi--global--color--function--success--lightest-3:#d4edda;--digi--global--color--function--warning--base:#ffe200;--digi--color--text--primary:var(--digi--grayscale-900);--digi--color--text--secondary:var(--digi--grayscale-700);--digi--color--text--link:var(--digi--global--color--cta--link--base);--digi--color--icons--success:var(--digi--global--color--function--success--base);--digi--color--icons--warning:#8a7a00;--digi--color--icons--danger:var(--digi--global--color--function--danger--base);--digi--global--typography--font-family--default:"Open Sans", Arial, sans-serif;--digi--global--typography--font-size--base:1rem;--digi--global--typography--font-size--small:0.875rem;--digi--global--typography--font-weight--regular:400;--digi--global--typography--font-weight--semibold:600;--digi--global--typography--font-weight--bold:700;--digi--global--typography--line-height--base:1.5;--digi--typography--label--font-size--desktop:1rem;--digi--typography--label--font-weight--desktop:600;--digi--typography--label--line-height--desktop:1.5;--digi--typography--label-description--font-size--desktop:1rem;--digi--typography--label-description--line-height--desktop:1.5;--digi--typography--tag--font-size--desktop:0.875rem;--digi--gutter--icon:0.625rem;--digi--gutter--smaller:0.75rem;--digi--gutter--small:0.875rem;--digi--gutter--medium:1rem;--digi--border-width--primary:1px;--digi--border-style--primary:solid;--digi--border-radius--primary:0;--digi--border-radius--secondary:6px;--af-tag-color:#091d54;--af-tag-hover-background:#ddf1fc}.af-form-label{color:var(--digi--color--text--primary);display:flex;flex-direction:column;font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--label--font-size--desktop);margin-bottom:0.5rem}.af-form-label__label{cursor:pointer;display:block;font-weight:var(--digi--typography--label--font-weight--desktop);line-height:var(--digi--typography--label--line-height--desktop)}.af-form-label__description{display:block;font-size:var(--digi--typography--label-description--font-size--desktop);line-height:var(--digi--typography--label-description--line-height--desktop);max-width:35rem}.af-validation-message{align-items:center;display:flex;flex-wrap:wrap}.af-validation-message__icon{flex:0 0 auto;height:1.25em;margin-inline-end:var(--digi--gutter--icon);width:1.25em}.af-validation-message__icon--success,.af-validation-message__icon--error{background-color:var(--af-validation-icon-color, currentColor);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain}.af-validation-message__icon--success{--af-validation-icon-color:var(--digi--color--icons--success);-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 25 25'%3E%3Cpath d='M25 12.5C25 19.404 19.404 25 12.5 25S0 19.404 0 12.5 5.596 0 12.5 0 25 5.596 25 12.5zm-13.946 6.619l9.274-9.275a.806.806 0 000-1.14l-1.14-1.14a.806.806 0 00-1.14 0l-7.564 7.563-3.531-3.531a.807.807 0 00-1.14 0l-1.141 1.14a.806.806 0 000 1.14l5.242 5.243a.806.806 0 001.14 0z'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 25 25'%3E%3Cpath d='M25 12.5C25 19.404 19.404 25 12.5 25S0 19.404 0 12.5 5.596 0 12.5 0 25 5.596 25 12.5zm-13.946 6.619l9.274-9.275a.806.806 0 000-1.14l-1.14-1.14a.806.806 0 00-1.14 0l-7.564 7.563-3.531-3.531a.807.807 0 00-1.14 0l-1.141 1.14a.806.806 0 000 1.14l5.242 5.243a.806.806 0 001.14 0z'/%3E%3C/svg%3E")}.af-validation-message__icon--error{--af-validation-icon-color:var(--digi--color--icons--danger);-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M34.4328058,0 C35.5494848,0 36.5900526,0.609146757 37.1483921,1.58958113 L47.5812454,19.9104189 C48.1395849,20.8909496 48.1395849,22.1090504 47.5812454,23.0895811 L37.1483921,41.4104189 C36.5900526,42.3908532 35.5494848,43 34.4328058,43 L13.5671942,43 C12.4505152,43 11.4099474,42.3908532 10.8516079,41.4104189 L0.41875464,23.0895811 C-0.13958488,22.1090504 -0.13958488,20.8909496 0.41875464,19.9104189 L10.8516079,1.58958113 C11.4099474,0.609146757 12.4505152,0 13.5671942,0 Z M18.6736823,12.3728178 C18.2711762,11.964729 17.6203819,11.964729 17.2178757,12.3728178 L15.2825964,14.334939 C14.8800903,14.7430278 14.8800903,15.4028485 15.2825964,15.8109373 L20.6089616,21.2111779 L15.2825964,26.6114185 C14.8800903,27.0195074 14.8800903,27.6793281 15.2825964,28.0874169 L17.2178757,30.049538 C17.6203819,30.4576269 18.2711762,30.4576269 18.6736823,30.049538 L24.0000475,24.6492974 L29.3264127,30.049538 C29.7289188,30.4576269 30.3797132,30.4576269 30.7822193,30.049538 L32.7174986,28.0874169 C33.1200048,27.6793281 33.1200048,27.0195074 32.7174986,26.6114185 L27.3911334,21.2111779 L32.7174986,15.8109373 C33.1200048,15.4028485 33.1200048,14.7430278 32.7174986,14.334939 L30.7822193,12.3728178 C30.3797132,11.964729 29.7289188,11.964729 29.3264127,12.3728178 L24.0000475,17.7730584 Z'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M34.4328058,0 C35.5494848,0 36.5900526,0.609146757 37.1483921,1.58958113 L47.5812454,19.9104189 C48.1395849,20.8909496 48.1395849,22.1090504 47.5812454,23.0895811 L37.1483921,41.4104189 C36.5900526,42.3908532 35.5494848,43 34.4328058,43 L13.5671942,43 C12.4505152,43 11.4099474,42.3908532 10.8516079,41.4104189 L0.41875464,23.0895811 C-0.13958488,22.1090504 -0.13958488,20.8909496 0.41875464,19.9104189 L10.8516079,1.58958113 C11.4099474,0.609146757 12.4505152,0 13.5671942,0 Z M18.6736823,12.3728178 C18.2711762,11.964729 17.6203819,11.964729 17.2178757,12.3728178 L15.2825964,14.334939 C14.8800903,14.7430278 14.8800903,15.4028485 15.2825964,15.8109373 L20.6089616,21.2111779 L15.2825964,26.6114185 C14.8800903,27.0195074 14.8800903,27.6793281 15.2825964,28.0874169 L17.2178757,30.049538 C17.6203819,30.4576269 18.2711762,30.4576269 18.6736823,30.049538 L24.0000475,24.6492974 L29.3264127,30.049538 C29.7289188,30.4576269 30.3797132,30.4576269 30.7822193,30.049538 L32.7174986,28.0874169 C33.1200048,27.6793281 33.1200048,27.0195074 32.7174986,26.6114185 L27.3911334,21.2111779 L32.7174986,15.8109373 C33.1200048,15.4028485 33.1200048,14.7430278 32.7174986,14.334939 L30.7822193,12.3728178 C30.3797132,11.964729 29.7289188,11.964729 29.3264127,12.3728178 L24.0000475,17.7730584 Z'/%3E%3C/svg%3E")}.af-validation-message__icon--warning{background:center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Ccircle cx='9' cy='9' r='6.75' fill='%23333'/%3E%3Cpath d='m18 9c0 4.9717-4.0298 9-9 9-4.9702 0-9-4.0283-9-9 0-4.9688 4.0298-9 9-9 4.9702 0 9 4.0312 9 9zm-9 1.8145c-0.92196 0-1.6694 0.7474-1.6694 1.6694 0 0.92196 0.7474 1.6694 1.6694 1.6694s1.6694-0.7474 1.6694-1.6694c0-0.92196-0.7474-1.6694-1.6694-1.6694zm-1.3157-1.065c0.012593 0.23095 0.20355 0.41175 0.43483 0.41175h1.7618c0.23128 0 0.42224-0.1808 0.43483-0.41175l0.2692-4.9355c0.013609-0.24946-0.18501-0.45922-0.43483-0.45922h-2.3002c-0.24982 0-0.4484 0.20976-0.43479 0.45922l0.2692 4.9355z' fill='%23FFE200'/%3E%3C/svg%3E");position:relative;top:3px}.af-validation-message__text{color:var(--digi--color--text--primary);flex:1;font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--tag--font-size--desktop);transform:translateY(1px)}.af-tag{display:block;max-width:100%;min-width:0}.af-tag__button{align-items:center;background:var(--digi--grayscale-0);border:var(--digi--border-width--primary) var(--digi--border-style--primary) var(--af-tag-color);border-radius:var(--digi--border-radius--secondary);color:var(--af-tag-color);cursor:pointer;display:inline-flex;font-family:var(--digi--global--typography--font-family--default);font-size:0.875rem;font-weight:var(--digi--global--typography--font-weight--semibold);gap:10px;height:auto;max-width:100%;min-height:unset;min-width:0;padding:6px 8px;text-align:left;white-space:normal}.af-tag__button:hover{background:var(--af-tag-hover-background)}.af-tag__button:focus-visible{background:var(--af-tag-hover-background);border-color:var(--af-tag-color);outline:2px solid var(--digi--grayscale-1000);outline-offset:2px;box-shadow:0 0 0 5px var(--digi--grayscale-0)}.af-tag__button:active{background:var(--af-tag-hover-background)}.af-tag__text{display:inline-block;max-width:100%;min-width:0;white-space:normal}.af-tag__text--break{overflow-wrap:anywhere;word-break:break-word}.af-tag__remove-icon{flex:0 0 auto;height:1em;min-height:0 !important;width:1em}:host{--selector-width:var(--cs-width, 100%);--selector-min-width:var(--cs-min-width, 200px);--selector-max-width:var(--cs-max-width, none);--selector-height:var(--cs-height, auto);--selector-min-height:var(--cs-min-height, auto);--selector-max-height:var(--cs-max-height, none);--selector-font-family:var(--global-font-family, 'Open Sans', sans-serif);--selector-font-size:var(--cs-font-size, 1rem);--selector-text-color:var(--cs-text-color, #212529);--selector-placeholder-color:var(--cs-placeholder-color, #6c757d);--selector-border-color:var(--cs-border-color, #d1d5db);--selector-focus-border-color:var(--cs-focus-border-color, #86b7fe);--selector-focus-shadow:var(--cs-focus-shadow, 0 0 0 0.25rem rgba(13, 110, 253, 0.25));--selector-background-color:var(--cs-background-color, #fff);--selector-icon-color:var(--cs-icon-color, #6c757d);--selector-clear-button-color:var(--cs-clear-button-color, #6c757d);--selector-clear-button-hover-color:var(--cs-clear-button-hover-color, #212529);--selector-suggestion-background-color:var(--cs-suggestion-background-color, #fff);--selector-suggestion-border-color:var(--cs-suggestion-border-color, #ced4da);--selector-suggestion-hover-background:var(--cs-suggestion-hover-background, #e9ecef);--selector-suggestion-active-background:var(--cs-suggestion-active-background, #dde4eb);--selector-suggestion-text-color:var(--cs-suggestion-text-color, #212529);--selector-suggestion-highlight-weight:var(--cs-suggestion-highlight-weight, bold);--selector-error-color:var(--cs-error-color, #dc3545);--selector-loading-color:var(--cs-loading-color, #6c757d);--selector-container-min-height:40px;--selector-padding-y:6px;--selector-padding-x:10px;--selector-icon-size:1.1em;--selector-gap:6px;--cs-row-height:32px;display:flex;flex-direction:column;width:var(--selector-width);min-width:var(--selector-min-width);max-width:var(--selector-max-width);height:var(--selector-height);min-height:var(--selector-min-height);max-height:var(--selector-max-height);font-family:var(--selector-font-family);font-size:var(--selector-font-size);color:var(--selector-text-color);position:relative}:host([cs-size="small"]){--selector-container-min-height:32px;--selector-padding-y:2px;--selector-icon-size:1em;--selector-gap:4px;--cs-row-height:28px}:host([cs-size="medium"]){--selector-container-min-height:40px;--selector-padding-y:6px;--cs-row-height:32px}:host([cs-size="large"]){--selector-container-min-height:48px;--selector-padding-y:10px;--selector-icon-size:1.25em;--selector-gap:8px;--cs-row-height:40px}*{box-sizing:border-box}.core-selector-wrapper{display:flex;flex-direction:column;flex:1;min-height:inherit}.af-form-label{margin-bottom:0.5rem}.search-container{display:flex;align-items:center;flex-wrap:wrap;gap:6px;border:1px solid #757575;border-radius:0px;padding:var(--selector-padding-y) var(--selector-padding-x);flex:1;min-height:var(--selector-container-min-height);cursor:text;background-color:var(--selector-background-color);position:relative;overflow:hidden}.search-container:focus-within{outline:2px solid black;outline-offset:2px}.search-container.is-inactive-selected .selector-input-field{caret-color:transparent;cursor:default}.is-inactive-selected+.suggestions-box-container{display:none !important}.search-container.is-inactive-selected .search-icon-container{display:none}.search-container.is-inactive-selected .input-area{padding-left:0}.input-controls-wrapper{position:relative;width:100%;display:flex;align-items:center}.search-icon-container{position:absolute;left:0;top:50%;width:20px;height:20px;transform:translateY(-50%);z-index:1;pointer-events:none;display:flex;align-items:center;justify-content:center;transition:transform 0.2s ease-in-out, opacity 0.2s ease-in-out;opacity:1;max-height:100%}.search-icon-container.is-hidden{opacity:0;transform:translateY(-50%) scale(0.7)}.selector-search-icon{color:var(--digi--color--icon--primary, #333);display:block;flex:0 0 auto;width:20px;height:20px}.clear-button>span{color:var(--digi--color--icon--primary, #333)}.input-area{position:relative;flex:1;min-width:0;padding-left:27px;display:flex;align-items:center;transition:padding-left 0.2s ease-in-out}.input-area.has-value{padding-left:0}.selector-placeholder-overlay{position:absolute;left:27px;right:0;top:50%;transform:translateY(-50%);color:var(--selector-placeholder-color);font-family:inherit;font-size:var(--selector-font-size);line-height:normal;padding:1px 2px;pointer-events:none;user-select:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:left 0.2s ease-in-out}.input-area.has-value .selector-placeholder-overlay{left:0}.selector-input-field{position:relative;z-index:1;width:100%;font-family:inherit;font-size:var(--selector-font-size);color:inherit;border:none;outline:none;background:transparent;transition:padding-right 0.2s ease-in-out}.search-container.has-input .selector-input-field{padding-right:0}.selector-input-field::placeholder{color:var(--selector-placeholder-color);opacity:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.clear-button{position:static;flex-shrink:0;opacity:0;pointer-events:none;z-index:2;background:none;border:none;padding:0;margin:0;height:20px;width:20px;cursor:pointer;color:var(--selector-clear-button-color);line-height:1;display:flex;align-items:center;transition:color 0.2s ease-in-out, opacity 0.2s ease-in-out}.clear-button.is-visible{opacity:1;pointer-events:auto}.clear-button:hover,.clear-button:focus{color:var(--selector-clear-button-hover-color);outline:none}.search-container.multi-search-container{display:flex;flex-direction:column;gap:0.5rem;align-items:stretch;padding-top:var(--selector-padding-y);padding-bottom:var(--selector-padding-y);width:100%;max-width:100%}.selected-tags-wrapper{display:flex;flex-wrap:wrap;gap:0.5rem;width:100%;max-width:100%;box-sizing:border-box}.selected-tags-wrapper .af-tag{display:block;max-width:100%;min-width:0}.selected-tags-wrapper .af-tag__button{white-space:normal !important;height:auto !important;text-align:left !important;word-break:break-word !important;overflow-wrap:anywhere !important;max-width:100% !important}.search-container.single-value-display{display:flex;align-items:center;flex-wrap:nowrap;gap:0.5rem;min-height:var(--selector-container-min-height);padding:var(--selector-padding-y) var(--selector-padding-x)}.selected-text-in-box{flex-grow:1;white-space:normal;word-break:break-word;min-width:0;line-height:inherit}.search-container.single-value-display .clear-button{position:static;transform:none;opacity:1;pointer-events:auto;flex-shrink:0}.combobox-container{position:relative;margin-top:0;display:flex;flex-direction:column;flex:1}.suggestions-box-container{position:absolute;top:100%;left:0;right:0;z-index:100}.suggestions-box-container.is-hidden-list{z-index:101;pointer-events:none}.suggestions-box{position:relative;background-color:white;border:1px solid var(--selector-suggestion-border-color);border-radius:4px;box-shadow:0 4px 12px rgba(0, 0, 0, 0.15);overflow-y:auto;margin:2px 0px;max-height:calc(var(--max-visible-rows, 10) * var(--cs-row-height) + 40px)}.suggestion-item{display:flex;align-items:center;min-height:var(--cs-row-height);height:auto;padding:6px 1rem;font-size:inherit;line-height:1.25;cursor:pointer;color:var(--selector-suggestion-text-color);list-style:none;transition:background-color 0.15s ease, color 0.15s ease;white-space:normal !important;word-break:break-word !important;overflow-wrap:anywhere !important;position:relative;z-index:1;box-sizing:border-box}.suggestion-item>span{transition:font-weight 0.2s ease, transform 0.2s ease;display:inline;vertical-align:middle;white-space:normal;word-break:break-word;overflow-wrap:anywhere}.suggestion-item:hover,.suggestion-item.active-suggestion{background-color:var(--selector-suggestion-active-background)}.suggestions-box.is-keyboard-nav .suggestion-item:hover:not(.active-suggestion){background-color:transparent}.suggestion-item.active-suggestion.is-keyboard-focus{outline:1px solid black;outline-offset:-1px}.suggestion-item.is-selected{color:var(--selector-suggestion-text-color) !important;cursor:default;background-color:#f2f2f2 !important}.suggestion-item.is-selected span{font-weight:600}.selection-indicator-icon{width:0;height:20px;opacity:0;transform:scale(0.5);margin-right:0;transition:width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), margin-right 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);color:var(--digi--grayscale-800, #333);flex-shrink:0;display:flex;align-items:center;justify-content:center;overflow:hidden}.suggestion-item.is-selected .selection-indicator-icon{width:24px;opacity:1;transform:scale(1);margin-right:8px}.suggestion-item.is-selected.active-suggestion{background-color:#f2f2f2 !important}.suggestion-item .suggestion-text strong,.suggestion-item .match-highlight{font-weight:var(--selector-suggestion-highlight-weight);color:inherit;display:inline}.metadata-dimmed,.occupation-variant-label{font-size:1rem;color:var(--digi--grayscale-700, #757575);margin-left:0.25rem;display:inline;vertical-align:baseline;line-height:inherit;white-space:normal}.suggestion-item.no-results{color:var(--selector-placeholder-color);cursor:default;padding:0.5rem 1rem;font-style:italic;text-align:center;height:auto}.search-container.has-validation-error{border-color:var(--selector-error-color);border-width:2px;background-color:#fef3f2}.search-container.has-positive-validation{border-color:#155724;background-color:#d4edda}.status-message{margin-top:0.5rem}.selector-validation-message{margin-top:0.5rem;display:block}.visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}input::-webkit-search-decoration,input::-webkit-search-cancel-button,input::-webkit-search-results-button,input::-webkit-search-results-decoration{-webkit-appearance:none;display:none}input::-ms-clear{display:none;width:0;height:0}.list-header-container{position:sticky;top:0;z-index:10;background-color:#f8f9fa;border-bottom:1px solid var(--selector-suggestion-border-color);min-height:auto;display:flex;flex-direction:column}.list-header-container ::slotted([slot="suggestions-overlay"]){position:absolute !important;top:0;left:0;width:100%;height:100%;z-index:20}.suggestions-box>::slotted([slot="suggestions-overlay"]){position:sticky !important;top:0;left:0;width:100%;z-index:20}.list-header{display:flex;align-items:center;min-height:var(--cs-row-height);padding:6px 1rem;font-size:0.875rem;line-height:1.25;color:var(--digi--grayscale-700, #757575);border-bottom:1px solid var(--selector-suggestion-border-color, #ced4da)}.list-header span{font-size:0.875rem;font-weight:normal}.history-clear-link{color:var(--digi--grayscale-700, #757575);text-decoration:underline;cursor:pointer;margin-left:0.25rem;background:transparent;border:0;padding:0;font:inherit}.history-clear-link:hover{color:var(--digi--grayscale-900, #222)}@keyframes cs-shrink-fade{from{opacity:1}to{opacity:1}}@keyframes cs-collapse{from{height:auto}to{height:auto}}.cs-toast{position:absolute;top:0;left:0;width:100%;height:100%;z-index:20;display:flex;align-items:center;justify-content:center;gap:8px;background-color:#f8fdf0;animation:cs-toastSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;pointer-events:none;box-sizing:border-box}.cs-toast.is-closing{animation:cs-toastSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards}.cs-toast-text{margin:0;font-size:0.875rem;font-weight:500;color:#2e7d32}@keyframes cs-toastSlideDown{from{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes cs-toastSlideUp{from{transform:translateY(0)}to{transform:translateY(-100%)}}.selector-input-field.visually-hidden-selected{position:absolute;opacity:0;pointer-events:none;width:1px;height:1px;overflow:hidden}`;
|
|
112
|
+
const coreSelectorCss = () => `:host{--digi--grayscale-0:#ffffff;--digi--grayscale-50:#fbfbfb;--digi--grayscale-100:#f4f4f4;--digi--grayscale-200:#ededed;--digi--grayscale-300:#e4e4e4;--digi--grayscale-400:#dddddd;--digi--grayscale-500:#cacaca;--digi--grayscale-600:#acacac;--digi--grayscale-700:#757575;--digi--grayscale-800:#5c5c5c;--digi--grayscale-900:#333333;--digi--grayscale-1000:#000000;--digi--global--color--cta--link--base:#1616b2;--digi--global--color--function--danger--base:#da0000;--digi--global--color--function--success--base:#008a20;--digi--global--color--function--success--lightest-3:#d4edda;--digi--global--color--function--warning--base:#ffe200;--af-text-color:var(--digi--color--text--primary, var(--digi--grayscale-900));--digi--global--typography--font-family--default:"Open Sans", Arial, sans-serif;--digi--global--typography--font-size--base:1rem;--digi--global--typography--font-size--small:0.875rem;--digi--global--typography--font-weight--regular:400;--digi--global--typography--font-weight--semibold:600;--digi--global--typography--font-weight--bold:700;--digi--global--typography--line-height--base:1.5;--digi--typography--label--font-size--desktop:1rem;--digi--typography--label--font-weight--desktop:600;--digi--typography--label--line-height--desktop:1.5;--digi--typography--label-description--font-size--desktop:1rem;--digi--typography--label-description--line-height--desktop:1.5;--digi--typography--tag--font-size--desktop:0.875rem;--digi--gutter--icon:0.625rem;--digi--gutter--smaller:0.75rem;--digi--gutter--small:0.875rem;--digi--gutter--medium:1rem;--digi--border-width--primary:1px;--digi--border-style--primary:solid;--digi--border-radius--primary:0;--digi--border-radius--secondary:6px;--af-tag-color:var(--digi--color--text--interactive--brand-primary, #091d54);--af-tag-background:var(--digi--color--background--interactive--default--secondary, var(--digi--grayscale-0));--af-tag-hover-background:var(--digi--color--background--interactive--hover--secondary, #ddf1fc)}.af-form-label{color:var(--af-text-color);display:flex;flex-direction:column;font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--label--font-size--desktop);margin-bottom:0.5rem}.af-form-label__label{cursor:pointer;display:block;font-weight:var(--digi--typography--label--font-weight--desktop);line-height:var(--digi--typography--label--line-height--desktop)}.af-form-label__description{display:block;font-size:var(--digi--typography--label-description--font-size--desktop);line-height:var(--digi--typography--label-description--line-height--desktop);max-width:35rem}.af-validation-message{align-items:center;display:flex;flex-wrap:wrap}.af-validation-message__icon{flex:0 0 auto;height:1.25em;margin-inline-end:var(--digi--gutter--icon);width:1.25em}.af-validation-message__icon--success,.af-validation-message__icon--error{background-color:var(--af-validation-icon-color, currentColor);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain}.af-validation-message__icon--success{--af-validation-icon-color:var(--digi--color--icon--validation--success, var(--digi--global--color--function--success--base));-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 25 25'%3E%3Cpath d='M25 12.5C25 19.404 19.404 25 12.5 25S0 19.404 0 12.5 5.596 0 12.5 0 25 5.596 25 12.5zm-13.946 6.619l9.274-9.275a.806.806 0 000-1.14l-1.14-1.14a.806.806 0 00-1.14 0l-7.564 7.563-3.531-3.531a.807.807 0 00-1.14 0l-1.141 1.14a.806.806 0 000 1.14l5.242 5.243a.806.806 0 001.14 0z'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 25 25'%3E%3Cpath d='M25 12.5C25 19.404 19.404 25 12.5 25S0 19.404 0 12.5 5.596 0 12.5 0 25 5.596 25 12.5zm-13.946 6.619l9.274-9.275a.806.806 0 000-1.14l-1.14-1.14a.806.806 0 00-1.14 0l-7.564 7.563-3.531-3.531a.807.807 0 00-1.14 0l-1.141 1.14a.806.806 0 000 1.14l5.242 5.243a.806.806 0 001.14 0z'/%3E%3C/svg%3E")}.af-validation-message__icon--error{--af-validation-icon-color:var(--digi--color--icon--validation--error, var(--digi--global--color--function--danger--base));-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M34.4328058,0 C35.5494848,0 36.5900526,0.609146757 37.1483921,1.58958113 L47.5812454,19.9104189 C48.1395849,20.8909496 48.1395849,22.1090504 47.5812454,23.0895811 L37.1483921,41.4104189 C36.5900526,42.3908532 35.5494848,43 34.4328058,43 L13.5671942,43 C12.4505152,43 11.4099474,42.3908532 10.8516079,41.4104189 L0.41875464,23.0895811 C-0.13958488,22.1090504 -0.13958488,20.8909496 0.41875464,19.9104189 L10.8516079,1.58958113 C11.4099474,0.609146757 12.4505152,0 13.5671942,0 Z M18.6736823,12.3728178 C18.2711762,11.964729 17.6203819,11.964729 17.2178757,12.3728178 L15.2825964,14.334939 C14.8800903,14.7430278 14.8800903,15.4028485 15.2825964,15.8109373 L20.6089616,21.2111779 L15.2825964,26.6114185 C14.8800903,27.0195074 14.8800903,27.6793281 15.2825964,28.0874169 L17.2178757,30.049538 C17.6203819,30.4576269 18.2711762,30.4576269 18.6736823,30.049538 L24.0000475,24.6492974 L29.3264127,30.049538 C29.7289188,30.4576269 30.3797132,30.4576269 30.7822193,30.049538 L32.7174986,28.0874169 C33.1200048,27.6793281 33.1200048,27.0195074 32.7174986,26.6114185 L27.3911334,21.2111779 L32.7174986,15.8109373 C33.1200048,15.4028485 33.1200048,14.7430278 32.7174986,14.334939 L30.7822193,12.3728178 C30.3797132,11.964729 29.7289188,11.964729 29.3264127,12.3728178 L24.0000475,17.7730584 Z'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M34.4328058,0 C35.5494848,0 36.5900526,0.609146757 37.1483921,1.58958113 L47.5812454,19.9104189 C48.1395849,20.8909496 48.1395849,22.1090504 47.5812454,23.0895811 L37.1483921,41.4104189 C36.5900526,42.3908532 35.5494848,43 34.4328058,43 L13.5671942,43 C12.4505152,43 11.4099474,42.3908532 10.8516079,41.4104189 L0.41875464,23.0895811 C-0.13958488,22.1090504 -0.13958488,20.8909496 0.41875464,19.9104189 L10.8516079,1.58958113 C11.4099474,0.609146757 12.4505152,0 13.5671942,0 Z M18.6736823,12.3728178 C18.2711762,11.964729 17.6203819,11.964729 17.2178757,12.3728178 L15.2825964,14.334939 C14.8800903,14.7430278 14.8800903,15.4028485 15.2825964,15.8109373 L20.6089616,21.2111779 L15.2825964,26.6114185 C14.8800903,27.0195074 14.8800903,27.6793281 15.2825964,28.0874169 L17.2178757,30.049538 C17.6203819,30.4576269 18.2711762,30.4576269 18.6736823,30.049538 L24.0000475,24.6492974 L29.3264127,30.049538 C29.7289188,30.4576269 30.3797132,30.4576269 30.7822193,30.049538 L32.7174986,28.0874169 C33.1200048,27.6793281 33.1200048,27.0195074 32.7174986,26.6114185 L27.3911334,21.2111779 L32.7174986,15.8109373 C33.1200048,15.4028485 33.1200048,14.7430278 32.7174986,14.334939 L30.7822193,12.3728178 C30.3797132,11.964729 29.7289188,11.964729 29.3264127,12.3728178 L24.0000475,17.7730584 Z'/%3E%3C/svg%3E")}.af-validation-message__icon--warning{background:center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Ccircle cx='9' cy='9' r='6.75' fill='%23333'/%3E%3Cpath d='m18 9c0 4.9717-4.0298 9-9 9-4.9702 0-9-4.0283-9-9 0-4.9688 4.0298-9 9-9 4.9702 0 9 4.0312 9 9zm-9 1.8145c-0.92196 0-1.6694 0.7474-1.6694 1.6694 0 0.92196 0.7474 1.6694 1.6694 1.6694s1.6694-0.7474 1.6694-1.6694c0-0.92196-0.7474-1.6694-1.6694-1.6694zm-1.3157-1.065c0.012593 0.23095 0.20355 0.41175 0.43483 0.41175h1.7618c0.23128 0 0.42224-0.1808 0.43483-0.41175l0.2692-4.9355c0.013609-0.24946-0.18501-0.45922-0.43483-0.45922h-2.3002c-0.24982 0-0.4484 0.20976-0.43479 0.45922l0.2692 4.9355z' fill='%23FFE200'/%3E%3C/svg%3E");position:relative;top:3px}.af-validation-message__text{color:var(--af-text-color);flex:1;font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--tag--font-size--desktop);transform:translateY(1px)}.af-validation-message__placeholder{visibility:hidden}.af-tag{display:block;max-width:100%;min-width:0}.af-tag__button{align-items:center;background:var(--af-tag-background);border:var(--digi--border-width--primary) var(--digi--border-style--primary) var(--af-tag-color);border-radius:var(--digi--border-radius--secondary);color:var(--af-tag-color);cursor:pointer;display:inline-flex;font-family:var(--digi--global--typography--font-family--default);font-size:0.875rem;font-weight:var(--digi--global--typography--font-weight--semibold);gap:10px;height:auto;max-width:100%;min-height:unset;min-width:0;padding:6px 8px;text-align:left;white-space:normal}.af-tag__button:hover{background:var(--af-tag-hover-background)}.af-tag__button:focus-visible{background:var(--af-tag-hover-background);border-color:var(--af-tag-color);outline:2px solid var(--digi--color--text--primary, var(--digi--grayscale-1000));outline-offset:2px;box-shadow:0 0 0 5px var(--digi--color--background--primary, var(--digi--grayscale-0))}.af-tag__button:active{background:var(--af-tag-hover-background)}.af-tag__text{display:inline-block;max-width:100%;min-width:0;white-space:normal}.af-tag__text--break{overflow-wrap:anywhere;word-break:break-word}.af-icon{display:flex !important;min-height:1.4em !important;align-items:center !important}.af-icon--default-size{width:12px !important;height:12px !important}.af-tag__remove-icon{flex:0 0 auto;height:1em;width:1em}.af-icon.af-tag__remove-icon{min-height:0 !important}:host{--selector-width:var(--cs-width, 100%);--selector-min-width:var(--cs-min-width, 200px);--selector-max-width:var(--cs-max-width, none);--selector-height:var(--cs-height, auto);--selector-min-height:var(--cs-min-height, auto);--selector-max-height:var(--cs-max-height, none);--selector-font-family:var(--global-font-family, 'Open Sans', sans-serif);--selector-font-size:var(--cs-font-size, 1rem);--selector-text-color:var(--cs-text-color, var(--digi--color--text--primary, #212529));--selector-placeholder-color:var(--cs-placeholder-color, var(--digi--color--text--description, #6c757d));--selector-border-color:var(--cs-border-color, var(--digi--color--border--interactive--default--on-input, #d1d5db));--selector-focus-border-color:var(--cs-focus-border-color, #86b7fe);--selector-focus-shadow:var(--cs-focus-shadow, 0 0 0 0.25rem rgba(13, 110, 253, 0.25));--selector-background-color:var(--cs-background-color, var(--digi--color--background--interactive--default--input-elements, #fff));--selector-icon-color:var(--cs-icon-color, var(--digi--color--icon--primary, #6c757d));--selector-clear-button-color:var(--cs-clear-button-color, var(--digi--color--icon--primary, #6c757d));--selector-clear-button-hover-color:var(--cs-clear-button-hover-color, var(--digi--color--icon--primary, #212529));--selector-suggestion-background-color:var(--cs-suggestion-background-color, var(--digi--color--background--dropdown, #fff));--selector-suggestion-border-color:var(--cs-suggestion-border-color, var(--digi--color--divider--primary, #ced4da));--selector-suggestion-hover-background:var(--cs-suggestion-hover-background, var(--digi--color--background--interactive--hover--quarternary, #e9ecef));--selector-suggestion-active-background:var(--cs-suggestion-active-background, var(--digi--color--background--interactive--hover--quarternary, #dde4eb));--selector-suggestion-text-color:var(--cs-suggestion-text-color, var(--digi--color--text--primary, #212529));--selector-suggestion-highlight-weight:var(--cs-suggestion-highlight-weight, bold);--selector-error-color:var(--cs-error-color, var(--digi--color--border--interactive--validation--error, #dc3545));--selector-loading-color:var(--cs-loading-color, var(--digi--color--text--description, #6c757d));--selector-container-min-height:40px;--selector-padding-y:6px;--selector-padding-x:10px;--selector-icon-size:1.1em;--selector-gap:6px;--cs-row-height:32px;display:flex;flex-direction:column;width:var(--selector-width);min-width:var(--selector-min-width);max-width:var(--selector-max-width);height:var(--selector-height);min-height:var(--selector-min-height);max-height:var(--selector-max-height);font-family:var(--selector-font-family);font-size:var(--selector-font-size);color:var(--selector-text-color);position:relative}:host([cs-size="small"]){--selector-container-min-height:32px;--selector-padding-y:2px;--selector-icon-size:1em;--selector-gap:4px;--cs-row-height:28px}:host([cs-size="medium"]){--selector-container-min-height:40px;--selector-padding-y:6px;--cs-row-height:32px}:host([cs-size="large"]){--selector-container-min-height:48px;--selector-padding-y:10px;--selector-icon-size:1.25em;--selector-gap:8px;--cs-row-height:40px}*{box-sizing:border-box}.core-selector-wrapper{display:flex;flex-direction:column;flex:1;min-height:inherit}.af-form-label{margin-bottom:0.5rem}.search-container{display:flex;align-items:center;flex-wrap:wrap;gap:6px;border:1px solid var(--digi--color--border--interactive--default--on-input, #757575);border-radius:0px;padding:var(--selector-padding-y) var(--selector-padding-x);flex:1;min-height:var(--selector-container-min-height);cursor:text;background-color:var(--selector-background-color);position:relative;overflow:hidden}.search-container:focus-within{outline:2px solid var(--digi--color--text--primary, black);outline-offset:2px}.search-container.is-inactive-selected .selector-input-field{caret-color:transparent;cursor:default}.is-inactive-selected+.suggestions-box-container{display:none !important}.search-container.is-inactive-selected .search-icon-container{display:none}.search-container.is-inactive-selected .input-area{padding-left:0}.input-controls-wrapper{position:relative;width:100%;display:flex;align-items:center}.search-icon-container{position:absolute;left:0;top:50%;width:20px;height:20px;transform:translateY(-50%);z-index:1;pointer-events:none;display:flex;align-items:center;justify-content:center;transition:transform 0.2s ease-in-out, opacity 0.2s ease-in-out;opacity:1;max-height:100%}.search-icon-container.is-hidden{opacity:0;transform:translateY(-50%) scale(0.7)}.selector-search-icon{color:var(--digi--color--icon--primary, #333);display:block;flex:0 0 auto;width:20px;height:20px}.clear-button>span{color:var(--digi--color--icon--primary, #333)}.input-area{position:relative;flex:1;min-width:0;padding-left:27px;display:flex;align-items:center;transition:padding-left 0.2s ease-in-out}.input-area.has-value{padding-left:0}.selector-placeholder-overlay{position:absolute;left:27px;right:0;top:50%;transform:translateY(-50%);color:var(--selector-placeholder-color);font-family:inherit;font-size:var(--selector-font-size);line-height:normal;padding:1px 2px;pointer-events:none;user-select:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:left 0.2s ease-in-out}.input-area.has-value .selector-placeholder-overlay{left:0}.selector-input-field{position:relative;z-index:1;width:100%;font-family:inherit;font-size:var(--selector-font-size);color:inherit;border:none;outline:none;background:transparent;transition:padding-right 0.2s ease-in-out}.search-container.has-input .selector-input-field{padding-right:0}.selector-input-field::placeholder{color:var(--selector-placeholder-color);opacity:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.clear-button{position:static;flex-shrink:0;opacity:0;pointer-events:none;z-index:2;background:none;border:none;padding:0;margin:0;height:20px;width:20px;cursor:pointer;color:var(--selector-clear-button-color);line-height:1;display:flex;align-items:center;transition:color 0.2s ease-in-out, opacity 0.2s ease-in-out}.clear-button.is-visible{opacity:1;pointer-events:auto}.clear-button:hover,.clear-button:focus{color:var(--selector-clear-button-hover-color);outline:none}.search-container.multi-search-container{display:flex;flex-direction:column;gap:0.5rem;align-items:stretch;padding-top:var(--selector-padding-y);padding-bottom:var(--selector-padding-y);width:100%;max-width:100%}.selected-tags-wrapper{display:flex;flex-wrap:wrap;gap:0.5rem;width:100%;max-width:100%;box-sizing:border-box}.selected-tags-wrapper .af-tag{display:block;max-width:100%;min-width:0}.selected-tags-wrapper .af-tag__button{white-space:normal !important;height:auto !important;text-align:left !important;word-break:break-word !important;overflow-wrap:anywhere !important;max-width:100% !important}.search-container.single-value-display{display:flex;align-items:center;flex-wrap:nowrap;gap:0.5rem;min-height:var(--selector-container-min-height);padding:var(--selector-padding-y) var(--selector-padding-x)}.selected-text-in-box{flex-grow:1;white-space:normal;word-break:break-word;min-width:0;line-height:inherit}.search-container.single-value-display .clear-button{position:static;transform:none;opacity:1;pointer-events:auto;flex-shrink:0}.combobox-container{position:relative;margin-top:0;display:flex;flex-direction:column;flex:1}.suggestions-box-container{position:absolute;top:100%;left:0;right:0;z-index:100}.suggestions-box-container.is-hidden-list{z-index:101;pointer-events:none}.suggestions-box{position:relative;background-color:var(--digi--color--background--dropdown, white);border:1px solid var(--selector-suggestion-border-color);border-radius:4px;box-shadow:0 2px 6px 0 var(--digi--color--misc--dropshadow, rgba(0, 0, 0, 0.15));overflow-y:auto;margin:2px 0px;max-height:calc(var(--max-visible-rows, 10) * var(--cs-row-height) + 40px)}.suggestion-item{display:flex;align-items:center;min-height:var(--cs-row-height);height:auto;padding:6px 1rem;font-size:inherit;line-height:1.25;cursor:pointer;color:var(--selector-suggestion-text-color);list-style:none;transition:background-color 0.15s ease, color 0.15s ease;white-space:normal !important;word-break:break-word !important;overflow-wrap:anywhere !important;position:relative;z-index:1;box-sizing:border-box}.suggestion-item>span{transition:font-weight 0.2s ease, transform 0.2s ease;display:inline;vertical-align:middle;white-space:normal;word-break:break-word;overflow-wrap:anywhere}.suggestion-item:hover,.suggestion-item.active-suggestion{background-color:var(--selector-suggestion-active-background)}.suggestions-box.is-keyboard-nav .suggestion-item:hover:not(.active-suggestion){background-color:transparent}.suggestion-item.active-suggestion.is-keyboard-focus{outline:1px solid var(--digi--color--text--primary, black);outline-offset:-1px}.suggestion-item.is-selected{color:var(--selector-suggestion-text-color) !important;cursor:default;background-color:var(--digi--color--background--interactive--selected--tertiary, #f2f2f2) !important}.suggestion-item.is-selected span{font-weight:600}.selection-indicator-icon{width:0;height:20px;opacity:0;transform:scale(0.5);margin-right:0;transition:width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), margin-right 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);color:var(--digi--color--icon--primary, var(--digi--grayscale-800, #333));flex-shrink:0;display:flex;align-items:center;justify-content:center;overflow:hidden}.suggestion-item.is-selected .selection-indicator-icon{width:24px;opacity:1;transform:scale(1);margin-right:8px}.suggestion-item.is-selected.active-suggestion{background-color:var(--digi--color--background--interactive--selected--tertiary, #f2f2f2) !important}.suggestion-item .suggestion-text strong,.suggestion-item .match-highlight{font-weight:var(--selector-suggestion-highlight-weight);color:inherit;display:inline}.metadata-dimmed,.occupation-variant-label{font-size:1rem;color:var(--digi--color--text--description, var(--digi--grayscale-700, #757575));margin-left:0.25rem;display:inline;vertical-align:baseline;line-height:inherit;white-space:normal}.suggestion-item.no-results{color:var(--selector-placeholder-color);cursor:default;padding:0.5rem 1rem;font-style:italic;text-align:center;height:auto}.search-container.has-validation-error{border-color:var(--selector-error-color);border-width:2px;background-color:var(--digi--color--background--interactive--validation--error, #fef3f2)}.search-container.has-positive-validation{border-color:var(--digi--color--border--interactive--validation--success, #155724);background-color:var(--digi--color--background--interactive--validation--success, #d4edda)}.status-message{margin-top:0.5rem}.selector-validation-message{margin-top:0.5rem;display:block}.visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}input::-webkit-search-decoration,input::-webkit-search-cancel-button,input::-webkit-search-results-button,input::-webkit-search-results-decoration{-webkit-appearance:none;display:none}input::-ms-clear{display:none;width:0;height:0}.list-header-container{position:sticky;top:0;z-index:10;background-color:var(--digi--color--background--secondary-muted, #f8f9fa);border-bottom:1px solid var(--selector-suggestion-border-color);min-height:auto;display:flex;flex-direction:column}.list-header-container ::slotted([slot="suggestions-overlay"]){position:absolute !important;top:0;left:0;width:100%;height:100%;z-index:20}.suggestions-box>::slotted([slot="suggestions-overlay"]){position:sticky !important;top:0;left:0;width:100%;z-index:20}.list-header{display:flex;align-items:center;min-height:var(--cs-row-height);padding:6px 1rem;font-size:0.875rem;line-height:1.25;color:var(--digi--color--text--description, var(--digi--grayscale-700, #757575));border-bottom:1px solid var(--selector-suggestion-border-color, #ced4da)}.list-header span{font-size:0.875rem;font-weight:normal}.history-clear-link{color:var(--digi--color--text--interactive--tertiary, var(--digi--grayscale-900, #333333));text-decoration:underline;cursor:pointer;margin-left:0.25rem;background:transparent;border:0;padding:0;font:inherit}.history-clear-link:hover{color:var(--digi--color--text--primary, var(--digi--grayscale-900, #222))}@keyframes cs-shrink-fade{from{opacity:1}to{opacity:1}}@keyframes cs-collapse{from{height:auto}to{height:auto}}.cs-toast{position:absolute;top:0;left:0;width:100%;height:100%;z-index:20;display:flex;align-items:center;justify-content:center;gap:8px;background-color:var(--digi--color--background--pop-out, #f8fdf0);animation:cs-toastSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;pointer-events:none;box-sizing:border-box}.cs-toast.is-closing{animation:cs-toastSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards}.cs-toast-text{margin:0;font-size:0.875rem;font-weight:500;color:var(--digi--color--text--primary, #2e7d32)}@keyframes cs-toastSlideDown{from{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes cs-toastSlideUp{from{transform:translateY(0)}to{transform:translateY(-100%)}}.selector-input-field.visually-hidden-selected{position:absolute;opacity:0;pointer-events:none;width:1px;height:1px;overflow:hidden}`;
|
|
85
113
|
|
|
86
114
|
const CoreSelector = class {
|
|
87
115
|
constructor(hostRef) {
|
|
@@ -97,10 +125,37 @@ const CoreSelector = class {
|
|
|
97
125
|
this.csClearHistory = index.createEvent(this, "csClearHistory");
|
|
98
126
|
this.csRequestHistory = index.createEvent(this, "csRequestHistory");
|
|
99
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Väntetid efter att ett nytt resultat har renderats innan antalet träffar läses upp.
|
|
130
|
+
* Lång nog för att VoiceOver ska ha läst klart det användaren skrev (jfr GOV.UK:s autocomplete).
|
|
131
|
+
*/
|
|
132
|
+
static RESULT_ANNOUNCEMENT_DELAY_MS = 1200;
|
|
133
|
+
/** Väntetid innan felet visas när spärren samtidigt stänger listan (skärmläsaren säger "hopfälld"). */
|
|
134
|
+
static ERROR_AFTER_COLLAPSE_DELAY_MS = 400;
|
|
135
|
+
/**
|
|
136
|
+
* När listan expanderas av första piltrycket sätts aria-activedescendant först efter denna
|
|
137
|
+
* väntetid. VoiceOver i Safari tappar annars första raden när aria-expanded ändras samtidigt.
|
|
138
|
+
*/
|
|
139
|
+
static ACTIVE_DESCENDANT_DELAY_MS = 75;
|
|
140
|
+
/** Hur länge en live-region står tom innan samma text sätts tillbaka och läses upp igen. */
|
|
141
|
+
static LIVE_REGION_RESTORE_DELAY_MS = 100;
|
|
100
142
|
historyRequestTimer;
|
|
143
|
+
resultAnnouncementTimer;
|
|
144
|
+
resultRestoreTimer;
|
|
145
|
+
validationRestoreTimer;
|
|
146
|
+
/** Fördröjningen som felets text väntar på just nu; 0 när ingen pågår. */
|
|
147
|
+
validationRestoreDelayMs = 0;
|
|
148
|
+
activeDescendantTimer;
|
|
101
149
|
disconnectedCallback() {
|
|
102
150
|
clearTimeout(this.historyRequestTimer);
|
|
103
151
|
this.historyRequestTimer = undefined;
|
|
152
|
+
this.clearResultAnnouncement();
|
|
153
|
+
clearTimeout(this.validationRestoreTimer);
|
|
154
|
+
this.validationRestoreTimer = undefined;
|
|
155
|
+
this.validationRestoreDelayMs = 0;
|
|
156
|
+
// Annars kan felets text bli kvar dold om elementet flyttas i DOM:en under fördröjningen.
|
|
157
|
+
this.isValidationMessageHidden = false;
|
|
158
|
+
this.clearDeferredActiveDescendant();
|
|
104
159
|
}
|
|
105
160
|
static nextId = 0;
|
|
106
161
|
get hostElement() { return index.getElement(this); }
|
|
@@ -133,7 +188,21 @@ const CoreSelector = class {
|
|
|
133
188
|
activeIndex = -1;
|
|
134
189
|
isFocusedInternal = false;
|
|
135
190
|
isNavigatingWithKeyboard = false;
|
|
191
|
+
/** Text i live-regionen som läser upp antalet träffar. */
|
|
192
|
+
resultAnnouncement = '';
|
|
193
|
+
/** Felmeddelandet töms en kort stund så att role="alert" läses upp igen. */
|
|
194
|
+
isValidationMessageHidden = false;
|
|
195
|
+
/** aria-activedescendant väntar tills aria-expanded="true" har hunnit läsas in. */
|
|
196
|
+
isActiveDescendantDeferred = false;
|
|
197
|
+
/** Användaren har skrivit i fältet sedan det fick fokus (inte bara att fältet har text). */
|
|
198
|
+
hasTypedSinceFocus = false;
|
|
136
199
|
isKeyboardNavigationActive = false;
|
|
200
|
+
/** Användaren har skrivit och antalet träffar ska läsas upp när resultatet har kommit. */
|
|
201
|
+
hasPendingResultAnnouncement = false;
|
|
202
|
+
/** aria-expanded i den senaste renderingen. */
|
|
203
|
+
renderedExpanded = false;
|
|
204
|
+
/** aria-expanded när fritextalternativet valdes; listan kan ha stängts innan spärren kommer. */
|
|
205
|
+
expandedAtManualSelect = false;
|
|
137
206
|
async setFocus() {
|
|
138
207
|
if (this.inputRef) {
|
|
139
208
|
this.inputRef.focus();
|
|
@@ -154,6 +223,10 @@ const CoreSelector = class {
|
|
|
154
223
|
}
|
|
155
224
|
if (!this.state)
|
|
156
225
|
return;
|
|
226
|
+
// Tab flyttar fokus (även inom komponenten, t.ex. till rensaknappen); när fokus kommer
|
|
227
|
+
// tillbaka till fältet gäller [10.03] som vid ny fokus.
|
|
228
|
+
if (event.key === 'Tab')
|
|
229
|
+
this.hasTypedSinceFocus = false;
|
|
157
230
|
if (event.target?.tagName === 'BUTTON')
|
|
158
231
|
return;
|
|
159
232
|
if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown' && event.key !== 'Enter' && event.key !== 'Escape') {
|
|
@@ -175,9 +248,17 @@ const CoreSelector = class {
|
|
|
175
248
|
case 'ArrowDown':
|
|
176
249
|
if (totalOptions > 0) {
|
|
177
250
|
event.preventDefault();
|
|
251
|
+
// Regionen lämnas orörd: en ändring i den samtidigt som aria-activedescendant
|
|
252
|
+
// pekar ut första alternativet kan få VoiceOver att läsa regionen i stället.
|
|
253
|
+
this.cancelPendingResultAnnouncement();
|
|
254
|
+
const wasExpanded = this.renderedExpanded;
|
|
255
|
+
// Listan kan vara stängd medan fältet har fokus, t.ex. efter en spärrad förslagstext.
|
|
256
|
+
this.isFocusedInternal = true;
|
|
178
257
|
this.isKeyboardNavigationActive = true;
|
|
179
258
|
this.isNavigatingWithKeyboard = true;
|
|
180
259
|
this.activeIndex = getNextActiveIndex('down', this.activeIndex, totalOptions);
|
|
260
|
+
if (!wasExpanded)
|
|
261
|
+
this.deferActiveDescendant();
|
|
181
262
|
this.scrollToActive();
|
|
182
263
|
if (this.activeIndex >= suggestions.length - 3) {
|
|
183
264
|
this.csLoadMore.emit();
|
|
@@ -190,15 +271,26 @@ const CoreSelector = class {
|
|
|
190
271
|
case 'ArrowUp':
|
|
191
272
|
if (totalOptions > 0) {
|
|
192
273
|
event.preventDefault();
|
|
274
|
+
// Pil upp i fältet flyttar ingenting och ska inte avbryta någon uppläsning.
|
|
275
|
+
if (this.activeIndex >= 0)
|
|
276
|
+
this.cancelPendingResultAnnouncement();
|
|
277
|
+
const wasExpanded = this.renderedExpanded;
|
|
278
|
+
const previousIndex = this.activeIndex;
|
|
279
|
+
const wasNavigating = this.isNavigatingWithKeyboard;
|
|
193
280
|
this.isKeyboardNavigationActive = true;
|
|
194
281
|
this.isNavigatingWithKeyboard = true;
|
|
195
282
|
this.activeIndex = getNextActiveIndex('up', this.activeIndex, totalOptions);
|
|
196
283
|
if (this.activeIndex >= 0) {
|
|
284
|
+
if (!wasExpanded)
|
|
285
|
+
this.deferActiveDescendant();
|
|
197
286
|
this.scrollToActive();
|
|
198
287
|
}
|
|
199
288
|
else {
|
|
200
289
|
this.isKeyboardNavigationActive = false;
|
|
201
290
|
this.isNavigatingWithKeyboard = false;
|
|
291
|
+
// Bara när en rad var utpekad med tangentbordet (inte t.ex. under musen).
|
|
292
|
+
if (previousIndex >= 0 && wasNavigating)
|
|
293
|
+
this.announceReturnToInput();
|
|
202
294
|
}
|
|
203
295
|
}
|
|
204
296
|
break;
|
|
@@ -209,7 +301,13 @@ const CoreSelector = class {
|
|
|
209
301
|
if (event.key === ' ' && this.activeIndex === -1) {
|
|
210
302
|
return;
|
|
211
303
|
}
|
|
212
|
-
if (
|
|
304
|
+
if (event.key === 'Enter' && this.state.manualInputBlocked
|
|
305
|
+
&& !(this.activeIndex >= 0 && this.activeIndex < suggestions.length)) {
|
|
306
|
+
// Nytt försök med spärrad text: läs upp felet igen.
|
|
307
|
+
event.preventDefault();
|
|
308
|
+
this.reannounceValidationMessage();
|
|
309
|
+
}
|
|
310
|
+
else if (this.activeIndex >= 0 && this.activeIndex < suggestions.length) {
|
|
213
311
|
event.preventDefault();
|
|
214
312
|
const item = suggestions[this.activeIndex];
|
|
215
313
|
this.shouldFocusAfterRender = true;
|
|
@@ -236,10 +334,146 @@ const CoreSelector = class {
|
|
|
236
334
|
break;
|
|
237
335
|
case 'Escape':
|
|
238
336
|
this.activeIndex = -1;
|
|
337
|
+
this.clearDeferredActiveDescendant();
|
|
338
|
+
this.clearResultAnnouncement();
|
|
239
339
|
this.csClear.emit();
|
|
240
340
|
break;
|
|
241
341
|
}
|
|
242
342
|
};
|
|
343
|
+
/** En ny inmatning: antalet läses upp först när resultatet för den nya texten har kommit. */
|
|
344
|
+
markResultAnnouncementPending(value) {
|
|
345
|
+
if (value.trim() === '') {
|
|
346
|
+
this.clearResultAnnouncement();
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
clearTimeout(this.resultAnnouncementTimer);
|
|
350
|
+
this.resultAnnouncementTimer = undefined;
|
|
351
|
+
// En pågående återfyllning gäller den gamla texten.
|
|
352
|
+
clearTimeout(this.resultRestoreTimer);
|
|
353
|
+
this.resultRestoreTimer = undefined;
|
|
354
|
+
this.hasPendingResultAnnouncement = true;
|
|
355
|
+
}
|
|
356
|
+
/** Startar fördröjningen när ett nytt resultat för den aktuella texten har renderats. */
|
|
357
|
+
scheduleResultAnnouncement(newState, oldState) {
|
|
358
|
+
if (!this.hasPendingResultAnnouncement || !newState || newState.inputValue.trim() === '')
|
|
359
|
+
return;
|
|
360
|
+
// Ingen uppläsning medan användaren navigerar i listan med tangentbordet. (activeIndex
|
|
361
|
+
// räcker inte: det ligger kvar efter ny inmatning och sätts även när musen är över listan.)
|
|
362
|
+
if (this.isNavigatingWithKeyboard)
|
|
363
|
+
return;
|
|
364
|
+
// Resultatet gäller en äldre söktext (t.ex. medan en asynkron sökning pågår).
|
|
365
|
+
if (newState.resultsQuery !== undefined && newState.resultsQuery !== newState.inputValue)
|
|
366
|
+
return;
|
|
367
|
+
// Värdkomponenterna skapar nya arrayer vid varje rendering; jämför innehållet.
|
|
368
|
+
if (oldState && !CoreSelector.hasNewResult(oldState, newState))
|
|
369
|
+
return;
|
|
370
|
+
clearTimeout(this.resultAnnouncementTimer);
|
|
371
|
+
this.resultAnnouncementTimer = setTimeout(() => {
|
|
372
|
+
this.resultAnnouncementTimer = undefined;
|
|
373
|
+
this.announceResultCount();
|
|
374
|
+
}, CoreSelector.RESULT_ANNOUNCEMENT_DELAY_MS);
|
|
375
|
+
}
|
|
376
|
+
static hasNewResult(oldState, newState) {
|
|
377
|
+
if (oldState.inputValue !== newState.inputValue
|
|
378
|
+
|| oldState.resultsQuery !== newState.resultsQuery
|
|
379
|
+
|| oldState.hasMoreResults !== newState.hasMoreResults
|
|
380
|
+
|| oldState.suggestions.length !== newState.suggestions.length) {
|
|
381
|
+
return true;
|
|
382
|
+
}
|
|
383
|
+
return newState.suggestions.some((suggestion, index) => {
|
|
384
|
+
const old = oldState.suggestions[index];
|
|
385
|
+
return suggestion.id !== old.id || suggestion.label !== old.label || !!suggestion.isSelected !== !!old.isSelected;
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
deferActiveDescendant() {
|
|
389
|
+
clearTimeout(this.activeDescendantTimer);
|
|
390
|
+
this.isActiveDescendantDeferred = true;
|
|
391
|
+
this.activeDescendantTimer = setTimeout(() => {
|
|
392
|
+
this.activeDescendantTimer = undefined;
|
|
393
|
+
this.isActiveDescendantDeferred = false;
|
|
394
|
+
}, CoreSelector.ACTIVE_DESCENDANT_DELAY_MS);
|
|
395
|
+
}
|
|
396
|
+
clearDeferredActiveDescendant() {
|
|
397
|
+
clearTimeout(this.activeDescendantTimer);
|
|
398
|
+
this.activeDescendantTimer = undefined;
|
|
399
|
+
this.isActiveDescendantDeferred = false;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Tillbaka i fältet från första raden: aria-activedescendant tas bort, och då läser VoiceOver
|
|
403
|
+
* annars upp raden igen. Fältets etikett och text läses upp i stället.
|
|
404
|
+
*/
|
|
405
|
+
announceReturnToInput() {
|
|
406
|
+
this.clearDeferredActiveDescendant();
|
|
407
|
+
const value = this.state.inputValue.trim();
|
|
408
|
+
const text = [this.label, value].filter(Boolean).join(', ');
|
|
409
|
+
if (text)
|
|
410
|
+
this.setResultAnnouncement(text);
|
|
411
|
+
}
|
|
412
|
+
/** Avbryter en väntande uppläsning men låter live-regionen vara. */
|
|
413
|
+
cancelPendingResultAnnouncement() {
|
|
414
|
+
clearTimeout(this.resultAnnouncementTimer);
|
|
415
|
+
this.resultAnnouncementTimer = undefined;
|
|
416
|
+
// En pågående återfyllning av samma text ska inte heller komma under navigeringen.
|
|
417
|
+
clearTimeout(this.resultRestoreTimer);
|
|
418
|
+
this.resultRestoreTimer = undefined;
|
|
419
|
+
this.hasPendingResultAnnouncement = false;
|
|
420
|
+
}
|
|
421
|
+
announceResultCount() {
|
|
422
|
+
this.hasPendingResultAnnouncement = false;
|
|
423
|
+
// Ingen uppläsning när listan är stängd eller användaren redan navigerar i den.
|
|
424
|
+
const isListOpen = !!this.state && this.isFocusedInternal && this.state.status !== 'itemSelected';
|
|
425
|
+
if (!isListOpen || this.isNavigatingWithKeyboard) {
|
|
426
|
+
this.clearResultAnnouncement();
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
this.setResultAnnouncement(describeResultCount(this.state, this.config));
|
|
430
|
+
}
|
|
431
|
+
/** Samma text som förra gången töms först och sätts tillbaka, så att den läses upp igen. */
|
|
432
|
+
setResultAnnouncement(text) {
|
|
433
|
+
clearTimeout(this.resultRestoreTimer);
|
|
434
|
+
this.resultRestoreTimer = undefined;
|
|
435
|
+
if (text !== '' && text === this.resultAnnouncement) {
|
|
436
|
+
this.resultAnnouncement = '';
|
|
437
|
+
this.resultRestoreTimer = setTimeout(() => {
|
|
438
|
+
this.resultRestoreTimer = undefined;
|
|
439
|
+
this.resultAnnouncement = text;
|
|
440
|
+
}, CoreSelector.LIVE_REGION_RESTORE_DELAY_MS);
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
this.resultAnnouncement = text;
|
|
444
|
+
}
|
|
445
|
+
clearResultAnnouncement() {
|
|
446
|
+
clearTimeout(this.resultAnnouncementTimer);
|
|
447
|
+
this.resultAnnouncementTimer = undefined;
|
|
448
|
+
clearTimeout(this.resultRestoreTimer);
|
|
449
|
+
this.resultRestoreTimer = undefined;
|
|
450
|
+
this.hasPendingResultAnnouncement = false;
|
|
451
|
+
this.resultAnnouncement = '';
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Läser upp felmeddelandet igen: texten tas ur role="alert" en kort stund och sätts
|
|
455
|
+
* tillbaka. Rutan behåller sin höjd eftersom texten ligger kvar osynligt och aria-hidden.
|
|
456
|
+
*/
|
|
457
|
+
reannounceValidationMessage() {
|
|
458
|
+
if (this.state.validation !== 'error' || !this.state.message)
|
|
459
|
+
return;
|
|
460
|
+
this.showValidationMessageAfter(CoreSelector.LIVE_REGION_RESTORE_DELAY_MS);
|
|
461
|
+
}
|
|
462
|
+
/** Felrutan visas direkt, men texten läggs i role="alert" först efter delayMs. */
|
|
463
|
+
showValidationMessageAfter(delayMs) {
|
|
464
|
+
// En pågående längre fördröjning (t.ex. efter "hopfälld") förkortas inte av ett nytt försök;
|
|
465
|
+
// texten är redan dold och kommer tillbaka när den är slut.
|
|
466
|
+
if (this.validationRestoreTimer && delayMs <= this.validationRestoreDelayMs)
|
|
467
|
+
return;
|
|
468
|
+
clearTimeout(this.validationRestoreTimer);
|
|
469
|
+
this.isValidationMessageHidden = true;
|
|
470
|
+
this.validationRestoreDelayMs = delayMs;
|
|
471
|
+
this.validationRestoreTimer = setTimeout(() => {
|
|
472
|
+
this.validationRestoreTimer = undefined;
|
|
473
|
+
this.validationRestoreDelayMs = 0;
|
|
474
|
+
this.isValidationMessageHidden = false;
|
|
475
|
+
}, delayMs);
|
|
476
|
+
}
|
|
243
477
|
onWrapperFocusIn = () => {
|
|
244
478
|
if (this.config.disabled)
|
|
245
479
|
return;
|
|
@@ -247,6 +481,10 @@ const CoreSelector = class {
|
|
|
247
481
|
if (this.state) {
|
|
248
482
|
this.isFocusedInternal = true;
|
|
249
483
|
this.activeIndex = -1;
|
|
484
|
+
// Ny fokus: listan ska inte vara expanderad förrän användaren navigerar ([10.03]).
|
|
485
|
+
this.isNavigatingWithKeyboard = false;
|
|
486
|
+
this.isKeyboardNavigationActive = false;
|
|
487
|
+
this.hasTypedSinceFocus = false;
|
|
250
488
|
this.csFocus.emit();
|
|
251
489
|
if (this.state.inputValue.trim() === '') {
|
|
252
490
|
this.csRequestHistory.emit();
|
|
@@ -268,13 +506,21 @@ const CoreSelector = class {
|
|
|
268
506
|
if (!isInside) {
|
|
269
507
|
this.isFocusedInternal = false;
|
|
270
508
|
this.activeIndex = -1;
|
|
509
|
+
this.clearResultAnnouncement();
|
|
510
|
+
this.clearDeferredActiveDescendant();
|
|
511
|
+
// Annars är listan expanderad redan vid nästa fokus ([10.03]).
|
|
512
|
+
this.isNavigatingWithKeyboard = false;
|
|
513
|
+
this.isKeyboardNavigationActive = false;
|
|
514
|
+
this.hasTypedSinceFocus = false;
|
|
271
515
|
this.csBlur.emit();
|
|
272
516
|
}
|
|
273
517
|
});
|
|
274
518
|
};
|
|
275
519
|
handleAfFocusedChange(newValue) {
|
|
276
520
|
this.isFocusedInternal = newValue;
|
|
277
|
-
|
|
521
|
+
// Fokus återställs bara om fältet inte redan har det. Ett onödigt focus() får
|
|
522
|
+
// skärmläsaren att läsa upp fältet igen, och det tränger undan live-regionerna.
|
|
523
|
+
if (newValue && this.hostElement.shadowRoot?.activeElement !== this.inputRef) {
|
|
278
524
|
this.shouldFocusAfterRender = true;
|
|
279
525
|
}
|
|
280
526
|
}
|
|
@@ -283,6 +529,9 @@ const CoreSelector = class {
|
|
|
283
529
|
this.isFocusedInternal = false;
|
|
284
530
|
this.activeIndex = -1;
|
|
285
531
|
this.shouldFocusAfterRender = false;
|
|
532
|
+
this.isNavigatingWithKeyboard = false;
|
|
533
|
+
this.isKeyboardNavigationActive = false;
|
|
534
|
+
this.hasTypedSinceFocus = false;
|
|
286
535
|
}
|
|
287
536
|
}
|
|
288
537
|
handleStateChange(newState, oldState) {
|
|
@@ -296,6 +545,16 @@ const CoreSelector = class {
|
|
|
296
545
|
if (result.shouldRestoreFocus) {
|
|
297
546
|
this.shouldFocusAfterRender = true;
|
|
298
547
|
}
|
|
548
|
+
this.scheduleResultAnnouncement(newState, oldState);
|
|
549
|
+
// Spärren stänger en expanderad lista: skärmläsaren säger "hopfälld" och tränger undan
|
|
550
|
+
// ett fel som visas samtidigt. Texten sätts därför in en stund efter att listan har stängts.
|
|
551
|
+
if (newState?.manualInputBlocked && !oldState?.manualInputBlocked && newState.validation === 'error') {
|
|
552
|
+
const wasExpanded = this.renderedExpanded || this.expandedAtManualSelect;
|
|
553
|
+
this.expandedAtManualSelect = false;
|
|
554
|
+
if (wasExpanded && !this.isComboboxExpanded()) {
|
|
555
|
+
this.showValidationMessageAfter(CoreSelector.ERROR_AFTER_COLLAPSE_DELAY_MS);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
299
558
|
}
|
|
300
559
|
componentDidUpdate() {
|
|
301
560
|
if (this.shouldFocusAfterRender) {
|
|
@@ -321,6 +580,28 @@ const CoreSelector = class {
|
|
|
321
580
|
}
|
|
322
581
|
}
|
|
323
582
|
}
|
|
583
|
+
/**
|
|
584
|
+
* aria-expanded: bara när listan faktiskt renderas. Vid fokus först vid tangentbordsnavigering,
|
|
585
|
+
* så att etiketten hinner läsas upp ([10.03]), även om fältet redan har text. När användaren har
|
|
586
|
+
* skrivit sedan fältet fick fokus är listan expanderad direkt, så att första pil ned bara ändrar
|
|
587
|
+
* aria-activedescendant och skärmläsaren läser upp raden.
|
|
588
|
+
*/
|
|
589
|
+
isComboboxExpanded() {
|
|
590
|
+
if (!this.state || this.state.status === 'itemSelected')
|
|
591
|
+
return false;
|
|
592
|
+
const hasSuggestions = this.state.suggestions.length > 0 || shouldShowManualInput(this.state, this.config.requireSelection);
|
|
593
|
+
const hasTypedSinceFocus = this.hasTypedSinceFocus && this.state.inputValue.trim().length > 0;
|
|
594
|
+
return hasSuggestions && this.isSuggestionsListRendered() && (this.isNavigatingWithKeyboard || hasTypedSinceFocus);
|
|
595
|
+
}
|
|
596
|
+
/** Om förslagslistan renderas just nu (se render och renderSuggestionsList). */
|
|
597
|
+
isSuggestionsListRendered() {
|
|
598
|
+
if (!this.state || !this.isFocusedInternal || this.state.status === 'itemSelected')
|
|
599
|
+
return false;
|
|
600
|
+
const hasSearchInput = this.state.inputValue.trim().length > 0;
|
|
601
|
+
return this.state.suggestions.length > 0
|
|
602
|
+
|| shouldShowManualInput(this.state, this.config.requireSelection)
|
|
603
|
+
|| hasSearchInput;
|
|
604
|
+
}
|
|
324
605
|
handleScroll(event) {
|
|
325
606
|
if (!this.config.enableInfiniteScroll)
|
|
326
607
|
return;
|
|
@@ -370,7 +651,19 @@ const CoreSelector = class {
|
|
|
370
651
|
}
|
|
371
652
|
handleManualSelect() {
|
|
372
653
|
const item = { id: '', label: this.state.inputValue.trim(), metadata: { type: 'ManualInput' } };
|
|
373
|
-
this.
|
|
654
|
+
this.expandedAtManualSelect = this.renderedExpanded;
|
|
655
|
+
if (this.config.isFeedback) {
|
|
656
|
+
// Listan stängs. Ingen rad får vara kvar markerad, så att aria-expanded och
|
|
657
|
+
// aria-activedescendant inte pekar på en lista som inte renderas (t.ex. vid spärren).
|
|
658
|
+
this.isFocusedInternal = false;
|
|
659
|
+
this.shouldFocusAfterRender = false;
|
|
660
|
+
this.activeIndex = -1;
|
|
661
|
+
this.isKeyboardNavigationActive = false;
|
|
662
|
+
this.isNavigatingWithKeyboard = false;
|
|
663
|
+
}
|
|
664
|
+
else {
|
|
665
|
+
this.shouldFocusAfterRender = true;
|
|
666
|
+
}
|
|
374
667
|
this.csSelect.emit(item);
|
|
375
668
|
if (this.config.enableMultiple && this.state?.inputValue?.trim() === '') {
|
|
376
669
|
this.csRequestHistory.emit();
|
|
@@ -380,7 +673,9 @@ const CoreSelector = class {
|
|
|
380
673
|
if (!this.state)
|
|
381
674
|
return null;
|
|
382
675
|
const isSelected = this.state.status === 'itemSelected';
|
|
383
|
-
return (index.h("div", { class: { 'core-selector-wrapper': true, 'is-disabled': !!this.config.disabled }, "aria-disabled": this.config.disabled ? 'true' : 'false', onKeyDown: (e) => this.handleKeyDown(e), onMouseMove: this.handleMouseMove, onFocusin: this.onWrapperFocusIn, onFocusout: this.onWrapperFocusOut }, this.label && (index.h(AfLabel, { label: this.label, forId: `${this.componentId}-input`, description: this.labelDescription })), this.labelDescription && (index.h("div", { id: `${this.componentId}-description`, class: "visually-hidden" }, this.labelDescription)), this.state && this.state.status === 'loading' && index.h("div", { class: "loading-indicator" }, "Laddar..."), this.state && this.state.status === 'error' && index.h("div", { class: "error-message" }, this.state.message), this.state && ['searching', 'itemSelected', 'multiSelect'].includes(this.state.status) && (index.h("div", { class: "combobox-container" }, this.renderSearchContainer(), this.isFocusedInternal && !isSelected && this.renderSuggestionsList())), this.state && this.state.validation
|
|
676
|
+
return (index.h("div", { class: { 'core-selector-wrapper': true, 'is-disabled': !!this.config.disabled }, "aria-disabled": this.config.disabled ? 'true' : 'false', onKeyDown: (e) => this.handleKeyDown(e), onMouseMove: this.handleMouseMove, onFocusin: this.onWrapperFocusIn, onFocusout: this.onWrapperFocusOut }, this.label && (index.h(AfLabel, { label: this.label, forId: `${this.componentId}-input`, description: this.labelDescription })), this.labelDescription && (index.h("div", { id: `${this.componentId}-description`, class: "visually-hidden" }, this.labelDescription)), this.state && this.state.status === 'loading' && index.h("div", { class: "loading-indicator" }, "Laddar..."), this.state && this.state.status === 'error' && index.h("div", { class: "error-message" }, this.state.message), this.state && ['searching', 'itemSelected', 'multiSelect'].includes(this.state.status) && (index.h("div", { class: "combobox-container" }, this.renderSearchContainer(), this.isFocusedInternal && !isSelected && this.renderSuggestionsList())), index.h("div", { id: `${this.componentId}-validation-alert`, role: "alert" }, this.state && this.state.validation === 'error' && this.state.status !== 'itemSelected' && (index.h(afValidationMessage.AfValidationMessage, { id: `${this.componentId}-validation-message`, variant: "error", class: "selector-validation-message" }, this.isValidationMessageHidden
|
|
677
|
+
? index.h("span", { class: "af-validation-message__placeholder", "aria-hidden": "true" }, this.state.message)
|
|
678
|
+
: this.state.message))), this.state && this.state.validation === 'success' && this.state.status !== 'itemSelected' && (index.h(afValidationMessage.AfValidationMessage, { id: `${this.componentId}-validation-message`, variant: "success", class: "selector-validation-message" }, this.state.message)), index.h("div", { id: `${this.componentId}-result-count`, class: "visually-hidden", role: "status", "aria-live": "polite", "aria-atomic": "true" }, this.resultAnnouncement)));
|
|
384
679
|
}
|
|
385
680
|
renderSearchContainer() {
|
|
386
681
|
const isSelected = this.state.status === 'itemSelected';
|
|
@@ -388,8 +683,9 @@ const CoreSelector = class {
|
|
|
388
683
|
const isMulti = this.state.status === 'multiSelect';
|
|
389
684
|
const hasInput = displayValue.length > 0;
|
|
390
685
|
const hasTags = isMulti && this.state.selectedItems.length > 0;
|
|
391
|
-
const
|
|
392
|
-
|
|
686
|
+
const isExpanded = this.isComboboxExpanded();
|
|
687
|
+
this.renderedExpanded = isExpanded;
|
|
688
|
+
const activeDescendantId = (isExpanded && this.activeIndex >= 0 && this.isNavigatingWithKeyboard && !this.isActiveDescendantDeferred)
|
|
393
689
|
? (this.activeIndex === this.state.suggestions.length
|
|
394
690
|
? `${this.componentId}-list-option-manual-input`
|
|
395
691
|
: `${this.componentId}-list-option-${this.activeIndex}`)
|
|
@@ -430,15 +726,38 @@ const CoreSelector = class {
|
|
|
430
726
|
} }), index.h("div", { class: { 'input-area': true, 'has-value': !this.config.showSearchIcon || hasInput || hasTags } }, isSelected && (index.h("span", { class: "selected-text-in-box" }, displayValue)), !isSelected && !hasInput && this.config.placeholder && (index.h("span", { class: "selector-placeholder-overlay", "aria-hidden": "true" }, this.config.placeholder)), index.h("input", { class: {
|
|
431
727
|
'selector-input-field': true,
|
|
432
728
|
'visually-hidden-selected': isSelected
|
|
433
|
-
}, ref: (el) => this.inputRef = el, id: `${this.componentId}-input`, type: "text", value: displayValue, maxLength: SELECTOR_INPUT_MAX_LENGTH,
|
|
729
|
+
}, ref: (el) => this.inputRef = el, id: `${this.componentId}-input`, type: "text", value: displayValue, maxLength: SELECTOR_INPUT_MAX_LENGTH, onFocus: () => {
|
|
730
|
+
if (this.config.disabled)
|
|
731
|
+
return;
|
|
732
|
+
if (this.isFocusedInternal)
|
|
733
|
+
return;
|
|
734
|
+
this.isFocusedInternal = true;
|
|
735
|
+
this.activeIndex = -1;
|
|
736
|
+
this.isNavigatingWithKeyboard = false;
|
|
737
|
+
this.isKeyboardNavigationActive = false;
|
|
738
|
+
this.hasTypedSinceFocus = false;
|
|
739
|
+
this.csFocus.emit();
|
|
740
|
+
if (this.state && this.state.inputValue.trim() === '') {
|
|
741
|
+
this.csRequestHistory.emit();
|
|
742
|
+
}
|
|
743
|
+
}, onInput: (e) => {
|
|
434
744
|
if (this.config.disabled)
|
|
435
745
|
return;
|
|
436
746
|
this.isKeyboardNavigationActive = false;
|
|
437
747
|
this.isNavigatingWithKeyboard = false;
|
|
438
|
-
|
|
439
|
-
|
|
748
|
+
// Listan kan ha stängts medan fältet behöll fokus, t.ex. efter en spärrad förslagstext.
|
|
749
|
+
this.isFocusedInternal = true;
|
|
750
|
+
const value = e.target.value;
|
|
751
|
+
this.hasTypedSinceFocus = true;
|
|
752
|
+
this.clearDeferredActiveDescendant();
|
|
753
|
+
this.markResultAnnouncementPending(value);
|
|
754
|
+
this.csInput.emit(value);
|
|
755
|
+
}, autocomplete: "off", role: "combobox", "aria-label": this.label, "aria-autocomplete": "list", "aria-haspopup": "listbox", "aria-expanded": isExpanded ? 'true' : 'false', "aria-controls": isExpanded ? `${this.componentId}-listbox` : undefined, "aria-activedescendant": activeDescendantId, "aria-invalid": hasError ? 'true' : 'false', "aria-describedby": ariaDescribedBy, readOnly: isSelected, disabled: !!this.config.disabled })), index.h("button", { type: "button", class: { 'clear-button': true, 'is-visible': hasInput || isSelected }, tabIndex: hasInput || isSelected ? 0 : -1, disabled: !!this.config.disabled, "aria-label": "Rensa inmatad text", onMouseDown: (e) => e.preventDefault(), onClick: (e) => {
|
|
756
|
+
e.stopPropagation();
|
|
440
757
|
if (this.config.disabled)
|
|
441
758
|
return;
|
|
759
|
+
this.isFocusedInternal = true;
|
|
760
|
+
this.clearResultAnnouncement();
|
|
442
761
|
this.csInput.emit('');
|
|
443
762
|
this.shouldFocusAfterRender = true;
|
|
444
763
|
this.csClear.emit();
|
|
@@ -463,7 +782,7 @@ const CoreSelector = class {
|
|
|
463
782
|
}, ref: (el) => (this.listRef = el), onScroll: (e) => this.handleScroll(e), onMouseLeave: this.handleMouseLeave }, (listHeader || showHistoryHeader) && (index.h("div", { class: "list-header-container" }, index.h("slot", { name: "suggestions-overlay" }), listHeader && (index.h("div", { class: "list-header" }, index.h("span", null, listHeader))), showHistoryHeader && (index.h("div", { class: "list-header history-header" }, index.h("span", null, "Din privata historik"), " - ", index.h("button", { type: "button", class: "history-clear-link", "aria-label": "Rensa historik", disabled: !!this.config.disabled, onMouseDown: (e) => e.preventDefault(), onClick: () => {
|
|
464
783
|
if (!this.config.disabled)
|
|
465
784
|
this.csClearHistory.emit();
|
|
466
|
-
} }, "Rensa"))))), !listHeader && !showHistoryHeader && index.h("slot", { name: "suggestions-overlay" }), index.h("div", { id: `${this.componentId}-listbox`, role: "listbox" }, noResults && (index.h("div", { class: "suggestion-item no-results" }, "Inga resultat matchade din s\u00F6kning")),
|
|
785
|
+
} }, "Rensa"))))), !listHeader && !showHistoryHeader && index.h("slot", { name: "suggestions-overlay" }), index.h("div", { id: `${this.componentId}-listbox`, role: "listbox" }, noResults && (index.h("div", { class: "suggestion-item no-results" }, "Inga resultat matchade din s\u00F6kning")), this.state.suggestions.map((item, index$1) => (index.h("div", { key: item.id ? `${item.id}|${item.label}` : index$1, role: "option", id: `${this.componentId}-list-option-${index$1}`, "aria-selected": !!item.isSelected, "aria-current": index$1 === this.activeIndex ? 'true' : 'false', class: {
|
|
467
786
|
'suggestion-item': true,
|
|
468
787
|
'active-suggestion': index$1 === this.activeIndex,
|
|
469
788
|
'is-selected': !!item.isSelected,
|
|
@@ -497,7 +816,7 @@ const CoreSelector = class {
|
|
|
497
816
|
} }, index.h(AfIcon, { name: "check", class: "selection-indicator-icon" }), item.displaySegments ? (index.h("span", null, item.displaySegments.map((segment, segmentIndex) => (index.h("span", { key: segmentIndex, class: {
|
|
498
817
|
'match-highlight': !!segment.isMatch,
|
|
499
818
|
'metadata-dimmed': !!segment.isMetadata
|
|
500
|
-
} }, segment.text))))) : (index.h("span", null, item.label))))),
|
|
819
|
+
} }, segment.text))))) : (index.h("span", null, item.label))))), shouldShowManualInput(this.state, this.config.requireSelection) && (index.h("div", { role: "option", id: `${this.componentId}-list-option-manual-input`, class: {
|
|
501
820
|
'suggestion-item': true,
|
|
502
821
|
'active-suggestion': this.activeIndex === this.state.suggestions.length,
|
|
503
822
|
'is-keyboard-focus': this.activeIndex === this.state.suggestions.length && this.isNavigatingWithKeyboard
|
|
@@ -510,7 +829,7 @@ const CoreSelector = class {
|
|
|
510
829
|
return;
|
|
511
830
|
this.isNavigatingWithKeyboard = false;
|
|
512
831
|
this.activeIndex = this.state.suggestions.length;
|
|
513
|
-
} }, index.h("span", null, "Anv\u00E4nd \"", index.h("strong", null, this.state.inputValue.trim()), "\"")))))));
|
|
832
|
+
} }, index.h("span", null, this.config.manualInputMode === 'feedback' ? (index.h("span", null, "Skicka in \"", index.h("strong", null, this.state.inputValue.trim()), "\" som f\u00F6rslag p\u00E5 ", this.config.feedbackTargetName || 'yrke', " som saknas.")) : this.config.manualInputMode === 'combined' ? (index.h("span", null, "Anv\u00E4nd \"", index.h("strong", null, this.state.inputValue.trim()), "\" och skicka in f\u00F6rslaget till Arbetsf\u00F6rmedlingen")) : (index.h("span", null, "Anv\u00E4nd \"", index.h("strong", null, this.state.inputValue.trim()), "\"")))))))));
|
|
514
833
|
}
|
|
515
834
|
static get delegatesFocus() { return true; }
|
|
516
835
|
static get watchers() { return {
|