@abgov/web-components 1.0.0-alpha.48 → 1.0.0-alpha.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/web-components.es.js +233 -158
- package/web-components.umd.js +10 -10
package/package.json
CHANGED
package/web-components.es.js
CHANGED
|
@@ -1070,7 +1070,7 @@ function create_else_block$2(ctx) {
|
|
|
1070
1070
|
}
|
|
1071
1071
|
|
|
1072
1072
|
// (35:2) {#if showIcon}
|
|
1073
|
-
function create_if_block_1$
|
|
1073
|
+
function create_if_block_1$8(ctx) {
|
|
1074
1074
|
let goa_icon;
|
|
1075
1075
|
|
|
1076
1076
|
return {
|
|
@@ -1123,7 +1123,7 @@ function create_fragment$u(ctx) {
|
|
|
1123
1123
|
let div_class_value;
|
|
1124
1124
|
|
|
1125
1125
|
function select_block_type(ctx, dirty) {
|
|
1126
|
-
if (/*showIcon*/ ctx[4]) return create_if_block_1$
|
|
1126
|
+
if (/*showIcon*/ ctx[4]) return create_if_block_1$8;
|
|
1127
1127
|
return create_else_block$2;
|
|
1128
1128
|
}
|
|
1129
1129
|
|
|
@@ -2156,7 +2156,7 @@ customElements.define("goa-card-image", CardImage);
|
|
|
2156
2156
|
|
|
2157
2157
|
/* libs/web-components/src/components/checkbox/Checkbox.svelte generated by Svelte v3.44.3 */
|
|
2158
2158
|
|
|
2159
|
-
function create_if_block_1$
|
|
2159
|
+
function create_if_block_1$7(ctx) {
|
|
2160
2160
|
let svg;
|
|
2161
2161
|
let path;
|
|
2162
2162
|
|
|
@@ -2221,7 +2221,7 @@ function create_fragment$l(ctx) {
|
|
|
2221
2221
|
|
|
2222
2222
|
function select_block_type(ctx, dirty) {
|
|
2223
2223
|
if (/*isIndeterminate*/ ctx[5]) return create_if_block$b;
|
|
2224
|
-
if (/*isChecked*/ ctx[4]) return create_if_block_1$
|
|
2224
|
+
if (/*isChecked*/ ctx[4]) return create_if_block_1$7;
|
|
2225
2225
|
}
|
|
2226
2226
|
|
|
2227
2227
|
let current_block_type = select_block_type(ctx);
|
|
@@ -2747,12 +2747,13 @@ const BIND$1 = "bind";
|
|
|
2747
2747
|
|
|
2748
2748
|
function get_each_context$1(ctx, list, i) {
|
|
2749
2749
|
const child_ctx = ctx.slice();
|
|
2750
|
-
child_ctx[
|
|
2750
|
+
child_ctx[29] = list[i];
|
|
2751
|
+
child_ctx[31] = i;
|
|
2751
2752
|
return child_ctx;
|
|
2752
2753
|
}
|
|
2753
2754
|
|
|
2754
|
-
// (
|
|
2755
|
-
function
|
|
2755
|
+
// (137:2) {#if isMenuVisible}
|
|
2756
|
+
function create_if_block$a(ctx) {
|
|
2756
2757
|
let div;
|
|
2757
2758
|
let div_data_testid_value;
|
|
2758
2759
|
let mounted;
|
|
@@ -2768,12 +2769,12 @@ function create_if_block_1$7(ctx) {
|
|
|
2768
2769
|
insert(target, div, anchor);
|
|
2769
2770
|
|
|
2770
2771
|
if (!mounted) {
|
|
2771
|
-
dispose = listen(div, "click", /*closeMenu*/ ctx[
|
|
2772
|
+
dispose = listen(div, "click", /*closeMenu*/ ctx[15]);
|
|
2772
2773
|
mounted = true;
|
|
2773
2774
|
}
|
|
2774
2775
|
},
|
|
2775
2776
|
p(ctx, dirty) {
|
|
2776
|
-
if (dirty & /*name*/ 2 && div_data_testid_value !== (div_data_testid_value = `${/*name*/ ctx[1]}-dropdown-background`)) {
|
|
2777
|
+
if (dirty[0] & /*name*/ 2 && div_data_testid_value !== (div_data_testid_value = `${/*name*/ ctx[1]}-dropdown-background`)) {
|
|
2777
2778
|
attr(div, "data-testid", div_data_testid_value);
|
|
2778
2779
|
}
|
|
2779
2780
|
},
|
|
@@ -2785,82 +2786,20 @@ function create_if_block_1$7(ctx) {
|
|
|
2785
2786
|
};
|
|
2786
2787
|
}
|
|
2787
2788
|
|
|
2788
|
-
// (
|
|
2789
|
-
function create_if_block$a(ctx) {
|
|
2790
|
-
let div;
|
|
2791
|
-
let ul;
|
|
2792
|
-
let slot;
|
|
2793
|
-
let t;
|
|
2794
|
-
let each_blocks = [];
|
|
2795
|
-
let each_1_lookup = new Map();
|
|
2796
|
-
let ul_style_value;
|
|
2797
|
-
let each_value = /*options*/ ctx[7];
|
|
2798
|
-
const get_key = ctx => /*option*/ ctx[19].value;
|
|
2799
|
-
|
|
2800
|
-
for (let i = 0; i < each_value.length; i += 1) {
|
|
2801
|
-
let child_ctx = get_each_context$1(ctx, each_value, i);
|
|
2802
|
-
let key = get_key(child_ctx);
|
|
2803
|
-
each_1_lookup.set(key, each_blocks[i] = create_each_block$1(key, child_ctx));
|
|
2804
|
-
}
|
|
2805
|
-
|
|
2806
|
-
return {
|
|
2807
|
-
c() {
|
|
2808
|
-
div = element("div");
|
|
2809
|
-
ul = element("ul");
|
|
2810
|
-
slot = element("slot");
|
|
2811
|
-
t = space();
|
|
2812
|
-
|
|
2813
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2814
|
-
each_blocks[i].c();
|
|
2815
|
-
}
|
|
2816
|
-
|
|
2817
|
-
attr(ul, "class", "goa-dropdown-list");
|
|
2818
|
-
attr(ul, "style", ul_style_value = `overflow-y: auto; max-height: ${/*maxheight*/ ctx[3]}px`);
|
|
2819
|
-
attr(div, "class", "menu");
|
|
2820
|
-
},
|
|
2821
|
-
m(target, anchor) {
|
|
2822
|
-
insert(target, div, anchor);
|
|
2823
|
-
append(div, ul);
|
|
2824
|
-
append(ul, slot);
|
|
2825
|
-
append(ul, t);
|
|
2826
|
-
|
|
2827
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2828
|
-
each_blocks[i].m(ul, null);
|
|
2829
|
-
}
|
|
2830
|
-
},
|
|
2831
|
-
p(ctx, dirty) {
|
|
2832
|
-
if (dirty & /*options, value, onSelect*/ 4225) {
|
|
2833
|
-
each_value = /*options*/ ctx[7];
|
|
2834
|
-
each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, ul, destroy_block, create_each_block$1, null, get_each_context$1);
|
|
2835
|
-
}
|
|
2836
|
-
|
|
2837
|
-
if (dirty & /*maxheight*/ 8 && ul_style_value !== (ul_style_value = `overflow-y: auto; max-height: ${/*maxheight*/ ctx[3]}px`)) {
|
|
2838
|
-
attr(ul, "style", ul_style_value);
|
|
2839
|
-
}
|
|
2840
|
-
},
|
|
2841
|
-
d(detaching) {
|
|
2842
|
-
if (detaching) detach(div);
|
|
2843
|
-
|
|
2844
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2845
|
-
each_blocks[i].d();
|
|
2846
|
-
}
|
|
2847
|
-
}
|
|
2848
|
-
};
|
|
2849
|
-
}
|
|
2850
|
-
|
|
2851
|
-
// (102:10) {#each options as option (option.value)}
|
|
2789
|
+
// (171:4) {#each options as option, index (option.value)}
|
|
2852
2790
|
function create_each_block$1(key_1, ctx) {
|
|
2853
2791
|
let li;
|
|
2854
|
-
let t0_value = /*option*/ ctx[
|
|
2792
|
+
let t0_value = /*option*/ ctx[29].label + "";
|
|
2855
2793
|
let t0;
|
|
2856
2794
|
let t1;
|
|
2857
2795
|
let li_data_testid_value;
|
|
2796
|
+
let li_data_index_value;
|
|
2858
2797
|
let li_style_value;
|
|
2859
2798
|
let mounted;
|
|
2860
2799
|
let dispose;
|
|
2861
2800
|
|
|
2862
2801
|
function click_handler() {
|
|
2863
|
-
return /*click_handler*/ ctx[
|
|
2802
|
+
return /*click_handler*/ ctx[18](/*option*/ ctx[29]);
|
|
2864
2803
|
}
|
|
2865
2804
|
|
|
2866
2805
|
return {
|
|
@@ -2870,11 +2809,13 @@ function create_each_block$1(key_1, ctx) {
|
|
|
2870
2809
|
li = element("li");
|
|
2871
2810
|
t0 = text(t0_value);
|
|
2872
2811
|
t1 = space();
|
|
2873
|
-
attr(li, "data-testid", li_data_testid_value = `${/*option*/ ctx[
|
|
2812
|
+
attr(li, "data-testid", li_data_testid_value = `${/*option*/ ctx[29].value}-dropdown-item`);
|
|
2813
|
+
attr(li, "data-index", li_data_index_value = /*index*/ ctx[31]);
|
|
2874
2814
|
attr(li, "class", "goa-dropdown-option");
|
|
2875
2815
|
attr(li, "style", li_style_value = `display: ${"block"}`);
|
|
2876
2816
|
toggle_class(li, "goa-dropdown-option--disabled", false);
|
|
2877
|
-
toggle_class(li, "goa-dropdown-option--
|
|
2817
|
+
toggle_class(li, "goa-dropdown-option--tabbed", /*index*/ ctx[31] === /*highlightedIndex*/ ctx[10]);
|
|
2818
|
+
toggle_class(li, "goa-dropdown-option--selected", /*option*/ ctx[29].value === /*value*/ ctx[0]);
|
|
2878
2819
|
this.first = li;
|
|
2879
2820
|
},
|
|
2880
2821
|
m(target, anchor) {
|
|
@@ -2889,14 +2830,22 @@ function create_each_block$1(key_1, ctx) {
|
|
|
2889
2830
|
},
|
|
2890
2831
|
p(new_ctx, dirty) {
|
|
2891
2832
|
ctx = new_ctx;
|
|
2892
|
-
if (dirty & /*options*/ 128 && t0_value !== (t0_value = /*option*/ ctx[
|
|
2833
|
+
if (dirty[0] & /*options*/ 128 && t0_value !== (t0_value = /*option*/ ctx[29].label + "")) set_data(t0, t0_value);
|
|
2893
2834
|
|
|
2894
|
-
if (dirty & /*options*/ 128 && li_data_testid_value !== (li_data_testid_value = `${/*option*/ ctx[
|
|
2835
|
+
if (dirty[0] & /*options*/ 128 && li_data_testid_value !== (li_data_testid_value = `${/*option*/ ctx[29].value}-dropdown-item`)) {
|
|
2895
2836
|
attr(li, "data-testid", li_data_testid_value);
|
|
2896
2837
|
}
|
|
2897
2838
|
|
|
2898
|
-
if (dirty & /*options
|
|
2899
|
-
|
|
2839
|
+
if (dirty[0] & /*options*/ 128 && li_data_index_value !== (li_data_index_value = /*index*/ ctx[31])) {
|
|
2840
|
+
attr(li, "data-index", li_data_index_value);
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2843
|
+
if (dirty[0] & /*options, highlightedIndex*/ 1152) {
|
|
2844
|
+
toggle_class(li, "goa-dropdown-option--tabbed", /*index*/ ctx[31] === /*highlightedIndex*/ ctx[10]);
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
if (dirty[0] & /*options, value*/ 129) {
|
|
2848
|
+
toggle_class(li, "goa-dropdown-option--selected", /*option*/ ctx[29].value === /*value*/ ctx[0]);
|
|
2900
2849
|
}
|
|
2901
2850
|
},
|
|
2902
2851
|
d(detaching) {
|
|
@@ -2908,31 +2857,49 @@ function create_each_block$1(key_1, ctx) {
|
|
|
2908
2857
|
}
|
|
2909
2858
|
|
|
2910
2859
|
function create_fragment$j(ctx) {
|
|
2911
|
-
let div2;
|
|
2912
|
-
let t0;
|
|
2913
2860
|
let div1;
|
|
2861
|
+
let t0;
|
|
2914
2862
|
let div0;
|
|
2915
2863
|
let goa_input;
|
|
2916
2864
|
let goa_input_id_value;
|
|
2917
2865
|
let div0_data_testid_value;
|
|
2918
2866
|
let t1;
|
|
2867
|
+
let ul;
|
|
2868
|
+
let slot;
|
|
2869
|
+
let t2;
|
|
2870
|
+
let each_blocks = [];
|
|
2871
|
+
let each_1_lookup = new Map();
|
|
2872
|
+
let ul_style_value;
|
|
2919
2873
|
let mounted;
|
|
2920
2874
|
let dispose;
|
|
2921
|
-
let
|
|
2922
|
-
let
|
|
2875
|
+
let if_block = /*isMenuVisible*/ ctx[9] && create_if_block$a(ctx);
|
|
2876
|
+
let each_value = /*options*/ ctx[7];
|
|
2877
|
+
const get_key = ctx => /*option*/ ctx[29].value;
|
|
2878
|
+
|
|
2879
|
+
for (let i = 0; i < each_value.length; i += 1) {
|
|
2880
|
+
let child_ctx = get_each_context$1(ctx, each_value, i);
|
|
2881
|
+
let key = get_key(child_ctx);
|
|
2882
|
+
each_1_lookup.set(key, each_blocks[i] = create_each_block$1(key, child_ctx));
|
|
2883
|
+
}
|
|
2923
2884
|
|
|
2924
2885
|
return {
|
|
2925
2886
|
c() {
|
|
2926
|
-
div2 = element("div");
|
|
2927
|
-
if (if_block0) if_block0.c();
|
|
2928
|
-
t0 = space();
|
|
2929
2887
|
div1 = element("div");
|
|
2888
|
+
if (if_block) if_block.c();
|
|
2889
|
+
t0 = space();
|
|
2930
2890
|
div0 = element("div");
|
|
2931
2891
|
goa_input = element("goa-input");
|
|
2932
2892
|
t1 = space();
|
|
2933
|
-
|
|
2893
|
+
ul = element("ul");
|
|
2894
|
+
slot = element("slot");
|
|
2895
|
+
t2 = space();
|
|
2896
|
+
|
|
2897
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2898
|
+
each_blocks[i].c();
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2934
2901
|
this.c = noop;
|
|
2935
|
-
set_custom_element_data(goa_input, "error", /*isError*/ ctx[
|
|
2902
|
+
set_custom_element_data(goa_input, "error", /*isError*/ ctx[13]);
|
|
2936
2903
|
set_custom_element_data(goa_input, "disabled", /*disabled*/ ctx[5]);
|
|
2937
2904
|
set_custom_element_data(goa_input, "leadingicon", /*leadingicon*/ ctx[2]);
|
|
2938
2905
|
set_custom_element_data(goa_input, "placeholder", /*placeholder*/ ctx[4]);
|
|
@@ -2943,91 +2910,107 @@ function create_fragment$j(ctx) {
|
|
|
2943
2910
|
set_custom_element_data(goa_input, "type", "text");
|
|
2944
2911
|
set_custom_element_data(goa_input, "value", /*selectedLabel*/ ctx[8]);
|
|
2945
2912
|
attr(div0, "data-testid", div0_data_testid_value = `${/*name*/ ctx[1]}-dropdown`);
|
|
2946
|
-
attr(
|
|
2947
|
-
attr(
|
|
2913
|
+
attr(ul, "tabindex", "0");
|
|
2914
|
+
attr(ul, "class", "goa-dropdown-list");
|
|
2915
|
+
attr(ul, "style", ul_style_value = `overflow-y: auto; max-height: ${/*maxheight*/ ctx[3]}px`);
|
|
2916
|
+
toggle_class(ul, "dropdown-active", /*isMenuVisible*/ ctx[9]);
|
|
2917
|
+
attr(div1, "data-testid", /*testid*/ ctx[6]);
|
|
2918
|
+
attr(div1, "class", "goa-dropdown-box");
|
|
2948
2919
|
},
|
|
2949
2920
|
m(target, anchor) {
|
|
2950
|
-
insert(target,
|
|
2951
|
-
if (
|
|
2952
|
-
append(
|
|
2953
|
-
append(div2, div1);
|
|
2921
|
+
insert(target, div1, anchor);
|
|
2922
|
+
if (if_block) if_block.m(div1, null);
|
|
2923
|
+
append(div1, t0);
|
|
2954
2924
|
append(div1, div0);
|
|
2955
2925
|
append(div0, goa_input);
|
|
2956
2926
|
append(div1, t1);
|
|
2957
|
-
|
|
2958
|
-
|
|
2927
|
+
append(div1, ul);
|
|
2928
|
+
append(ul, slot);
|
|
2929
|
+
append(ul, t2);
|
|
2930
|
+
|
|
2931
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2932
|
+
each_blocks[i].m(ul, null);
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2935
|
+
/*ul_binding*/ ctx[19](ul);
|
|
2936
|
+
/*div1_binding*/ ctx[20](div1);
|
|
2959
2937
|
|
|
2960
2938
|
if (!mounted) {
|
|
2961
|
-
dispose = listen(goa_input, "click", /*showMenu*/ ctx[
|
|
2939
|
+
dispose = listen(goa_input, "click", /*showMenu*/ ctx[14]);
|
|
2962
2940
|
mounted = true;
|
|
2963
2941
|
}
|
|
2964
2942
|
},
|
|
2965
|
-
p(ctx,
|
|
2943
|
+
p(ctx, dirty) {
|
|
2966
2944
|
if (/*isMenuVisible*/ ctx[9]) {
|
|
2967
|
-
if (
|
|
2968
|
-
|
|
2945
|
+
if (if_block) {
|
|
2946
|
+
if_block.p(ctx, dirty);
|
|
2969
2947
|
} else {
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2948
|
+
if_block = create_if_block$a(ctx);
|
|
2949
|
+
if_block.c();
|
|
2950
|
+
if_block.m(div1, t0);
|
|
2973
2951
|
}
|
|
2974
|
-
} else if (
|
|
2975
|
-
|
|
2976
|
-
|
|
2952
|
+
} else if (if_block) {
|
|
2953
|
+
if_block.d(1);
|
|
2954
|
+
if_block = null;
|
|
2977
2955
|
}
|
|
2978
2956
|
|
|
2979
|
-
if (dirty & /*isError*/
|
|
2980
|
-
set_custom_element_data(goa_input, "error", /*isError*/ ctx[
|
|
2957
|
+
if (dirty[0] & /*isError*/ 8192) {
|
|
2958
|
+
set_custom_element_data(goa_input, "error", /*isError*/ ctx[13]);
|
|
2981
2959
|
}
|
|
2982
2960
|
|
|
2983
|
-
if (dirty & /*disabled*/ 32) {
|
|
2961
|
+
if (dirty[0] & /*disabled*/ 32) {
|
|
2984
2962
|
set_custom_element_data(goa_input, "disabled", /*disabled*/ ctx[5]);
|
|
2985
2963
|
}
|
|
2986
2964
|
|
|
2987
|
-
if (dirty & /*leadingicon*/ 4) {
|
|
2965
|
+
if (dirty[0] & /*leadingicon*/ 4) {
|
|
2988
2966
|
set_custom_element_data(goa_input, "leadingicon", /*leadingicon*/ ctx[2]);
|
|
2989
2967
|
}
|
|
2990
2968
|
|
|
2991
|
-
if (dirty & /*placeholder*/ 16) {
|
|
2969
|
+
if (dirty[0] & /*placeholder*/ 16) {
|
|
2992
2970
|
set_custom_element_data(goa_input, "placeholder", /*placeholder*/ ctx[4]);
|
|
2993
2971
|
}
|
|
2994
2972
|
|
|
2995
|
-
if (dirty & /*name*/ 2 && goa_input_id_value !== (goa_input_id_value = `${/*name*/ ctx[1]}-dropdown-input`)) {
|
|
2973
|
+
if (dirty[0] & /*name*/ 2 && goa_input_id_value !== (goa_input_id_value = `${/*name*/ ctx[1]}-dropdown-input`)) {
|
|
2996
2974
|
set_custom_element_data(goa_input, "id", goa_input_id_value);
|
|
2997
2975
|
}
|
|
2998
2976
|
|
|
2999
|
-
if (dirty & /*selectedLabel*/ 256) {
|
|
2977
|
+
if (dirty[0] & /*selectedLabel*/ 256) {
|
|
3000
2978
|
set_custom_element_data(goa_input, "value", /*selectedLabel*/ ctx[8]);
|
|
3001
2979
|
}
|
|
3002
2980
|
|
|
3003
|
-
if (dirty & /*name*/ 2 && div0_data_testid_value !== (div0_data_testid_value = `${/*name*/ ctx[1]}-dropdown`)) {
|
|
2981
|
+
if (dirty[0] & /*name*/ 2 && div0_data_testid_value !== (div0_data_testid_value = `${/*name*/ ctx[1]}-dropdown`)) {
|
|
3004
2982
|
attr(div0, "data-testid", div0_data_testid_value);
|
|
3005
2983
|
}
|
|
3006
2984
|
|
|
3007
|
-
if (/*
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
} else {
|
|
3011
|
-
if_block1 = create_if_block$a(ctx);
|
|
3012
|
-
if_block1.c();
|
|
3013
|
-
if_block1.m(div1, null);
|
|
3014
|
-
}
|
|
3015
|
-
} else if (if_block1) {
|
|
3016
|
-
if_block1.d(1);
|
|
3017
|
-
if_block1 = null;
|
|
2985
|
+
if (dirty[0] & /*options, highlightedIndex, value, onSelect*/ 66689) {
|
|
2986
|
+
each_value = /*options*/ ctx[7];
|
|
2987
|
+
each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, ul, destroy_block, create_each_block$1, null, get_each_context$1);
|
|
3018
2988
|
}
|
|
3019
2989
|
|
|
3020
|
-
if (dirty & /*
|
|
3021
|
-
attr(
|
|
2990
|
+
if (dirty[0] & /*maxheight*/ 8 && ul_style_value !== (ul_style_value = `overflow-y: auto; max-height: ${/*maxheight*/ ctx[3]}px`)) {
|
|
2991
|
+
attr(ul, "style", ul_style_value);
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
if (dirty[0] & /*isMenuVisible*/ 512) {
|
|
2995
|
+
toggle_class(ul, "dropdown-active", /*isMenuVisible*/ ctx[9]);
|
|
2996
|
+
}
|
|
2997
|
+
|
|
2998
|
+
if (dirty[0] & /*testid*/ 64) {
|
|
2999
|
+
attr(div1, "data-testid", /*testid*/ ctx[6]);
|
|
3022
3000
|
}
|
|
3023
3001
|
},
|
|
3024
3002
|
i: noop,
|
|
3025
3003
|
o: noop,
|
|
3026
3004
|
d(detaching) {
|
|
3027
|
-
if (detaching) detach(
|
|
3028
|
-
if (
|
|
3029
|
-
|
|
3030
|
-
|
|
3005
|
+
if (detaching) detach(div1);
|
|
3006
|
+
if (if_block) if_block.d();
|
|
3007
|
+
|
|
3008
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
3009
|
+
each_blocks[i].d();
|
|
3010
|
+
}
|
|
3011
|
+
|
|
3012
|
+
/*ul_binding*/ ctx[19](null);
|
|
3013
|
+
/*div1_binding*/ ctx[20](null);
|
|
3031
3014
|
mounted = false;
|
|
3032
3015
|
dispose();
|
|
3033
3016
|
}
|
|
@@ -3052,17 +3035,26 @@ function instance$i($$self, $$props, $$invalidate) {
|
|
|
3052
3035
|
|
|
3053
3036
|
let selectedLabel = "";
|
|
3054
3037
|
let isMenuVisible = false;
|
|
3038
|
+
let highlightedIndex = 0;
|
|
3055
3039
|
let el;
|
|
3040
|
+
let menuEl;
|
|
3056
3041
|
let ctx;
|
|
3057
3042
|
|
|
3058
|
-
|
|
3059
|
-
$$invalidate(8, selectedLabel = label);
|
|
3060
|
-
$$invalidate(0, value = val);
|
|
3061
|
-
$$invalidate(9, isMenuVisible = false);
|
|
3062
|
-
el.dispatchEvent(new CustomEvent("_change", { composed: true, detail: { name, value } }));
|
|
3063
|
-
}
|
|
3064
|
-
|
|
3043
|
+
// Hooks
|
|
3065
3044
|
onMount(async () => {
|
|
3045
|
+
el.addEventListener("focus", onFocus, true);
|
|
3046
|
+
el.addEventListener("blur", onBlur, true);
|
|
3047
|
+
bindContext();
|
|
3048
|
+
});
|
|
3049
|
+
|
|
3050
|
+
onDestroy(() => {
|
|
3051
|
+
el.removeEventListener("focus", onFocus, true);
|
|
3052
|
+
el.removeEventListener("blur", onBlur, true);
|
|
3053
|
+
deleteContext(name);
|
|
3054
|
+
});
|
|
3055
|
+
|
|
3056
|
+
// Functions
|
|
3057
|
+
function bindContext() {
|
|
3066
3058
|
ctx = createContext(name);
|
|
3067
3059
|
|
|
3068
3060
|
ctx.subscribe(data => {
|
|
@@ -3077,35 +3069,114 @@ function instance$i($$self, $$props, $$invalidate) {
|
|
|
3077
3069
|
$$invalidate(8, selectedLabel = _data.label);
|
|
3078
3070
|
}
|
|
3079
3071
|
|
|
3072
|
+
setHighlightedIndexToSelected();
|
|
3080
3073
|
break;
|
|
3081
3074
|
}
|
|
3082
3075
|
}
|
|
3083
3076
|
});
|
|
3084
|
-
}
|
|
3085
|
-
|
|
3086
|
-
onDestroy(() => {
|
|
3087
|
-
deleteContext(name);
|
|
3088
|
-
});
|
|
3077
|
+
}
|
|
3089
3078
|
|
|
3090
|
-
// Functions
|
|
3091
3079
|
async function showMenu() {
|
|
3092
|
-
if (disabled) {
|
|
3080
|
+
if (disabled || isMenuVisible) {
|
|
3093
3081
|
return;
|
|
3094
3082
|
}
|
|
3095
3083
|
|
|
3096
3084
|
$$invalidate(9, isMenuVisible = true);
|
|
3085
|
+
await tick();
|
|
3086
|
+
|
|
3087
|
+
// hide menu on blur
|
|
3088
|
+
menuEl.addEventListener("blur", closeMenu);
|
|
3089
|
+
|
|
3090
|
+
menuEl.focus();
|
|
3091
|
+
|
|
3092
|
+
// bind up/down arrows to navigate options
|
|
3093
|
+
menuEl.addEventListener("keydown", onMenuKeyDown);
|
|
3094
|
+
|
|
3095
|
+
menuEl.addEventListener("mouseover", onHighlight);
|
|
3097
3096
|
}
|
|
3098
3097
|
|
|
3099
3098
|
function closeMenu() {
|
|
3099
|
+
menuEl.removeEventListener("blur", closeMenu);
|
|
3100
|
+
menuEl.removeEventListener("keydown", onMenuKeyDown);
|
|
3101
|
+
menuEl.removeEventListener("mouseover", onHighlight);
|
|
3102
|
+
setHighlightedIndexToSelected();
|
|
3100
3103
|
$$invalidate(9, isMenuVisible = false);
|
|
3101
3104
|
}
|
|
3102
3105
|
|
|
3106
|
+
function setHighlightedIndexToSelected() {
|
|
3107
|
+
$$invalidate(10, highlightedIndex = options.findIndex(option => option.value === value));
|
|
3108
|
+
}
|
|
3109
|
+
|
|
3110
|
+
// Event handlers
|
|
3111
|
+
function onSelect(name, val, label) {
|
|
3112
|
+
$$invalidate(8, selectedLabel = label);
|
|
3113
|
+
$$invalidate(0, value = val);
|
|
3114
|
+
closeMenu();
|
|
3115
|
+
el.dispatchEvent(new CustomEvent("_change", { composed: true, detail: { name, value } }));
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3118
|
+
const onInputKeyDown = e => {
|
|
3119
|
+
switch (e.key) {
|
|
3120
|
+
case " ":
|
|
3121
|
+
showMenu();
|
|
3122
|
+
e.preventDefault();
|
|
3123
|
+
break;
|
|
3124
|
+
}
|
|
3125
|
+
};
|
|
3126
|
+
|
|
3127
|
+
// add required bindings to component
|
|
3128
|
+
function onFocus() {
|
|
3129
|
+
el.addEventListener("keydown", onInputKeyDown);
|
|
3130
|
+
}
|
|
3131
|
+
|
|
3132
|
+
// remove all bindings from component
|
|
3133
|
+
function onBlur() {
|
|
3134
|
+
el.removeEventListener("keydown", onInputKeyDown);
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
function onMenuKeyDown(e) {
|
|
3138
|
+
switch (e.key) {
|
|
3139
|
+
case "ArrowUp":
|
|
3140
|
+
if (highlightedIndex === 0) {
|
|
3141
|
+
$$invalidate(10, highlightedIndex = options.length - 1);
|
|
3142
|
+
} else {
|
|
3143
|
+
$$invalidate(10, highlightedIndex--, highlightedIndex);
|
|
3144
|
+
}
|
|
3145
|
+
e.preventDefault();
|
|
3146
|
+
break;
|
|
3147
|
+
case "ArrowDown":
|
|
3148
|
+
$$invalidate(10, highlightedIndex = (highlightedIndex + 1) % options.length);
|
|
3149
|
+
e.preventDefault();
|
|
3150
|
+
break;
|
|
3151
|
+
case "Tab":
|
|
3152
|
+
case "Enter":
|
|
3153
|
+
onSelect(name, options[highlightedIndex].value, options[highlightedIndex].label);
|
|
3154
|
+
e.preventDefault();
|
|
3155
|
+
break;
|
|
3156
|
+
case "Escape":
|
|
3157
|
+
closeMenu();
|
|
3158
|
+
e.preventDefault();
|
|
3159
|
+
break;
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
|
|
3163
|
+
function onHighlight(e) {
|
|
3164
|
+
$$invalidate(10, highlightedIndex = Number(e.target.dataset.index));
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3103
3167
|
const click_handler = option => onSelect(option.name, option.value, option.label);
|
|
3104
3168
|
|
|
3105
|
-
function
|
|
3169
|
+
function ul_binding($$value) {
|
|
3170
|
+
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
3171
|
+
menuEl = $$value;
|
|
3172
|
+
$$invalidate(12, menuEl);
|
|
3173
|
+
});
|
|
3174
|
+
}
|
|
3175
|
+
|
|
3176
|
+
function div1_binding($$value) {
|
|
3106
3177
|
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
3107
3178
|
el = $$value;
|
|
3108
|
-
$$invalidate(
|
|
3179
|
+
$$invalidate(11, el);
|
|
3109
3180
|
});
|
|
3110
3181
|
}
|
|
3111
3182
|
|
|
@@ -3116,14 +3187,14 @@ function instance$i($$self, $$props, $$invalidate) {
|
|
|
3116
3187
|
if ('maxheight' in $$props) $$invalidate(3, maxheight = $$props.maxheight);
|
|
3117
3188
|
if ('placeholder' in $$props) $$invalidate(4, placeholder = $$props.placeholder);
|
|
3118
3189
|
if ('disabled' in $$props) $$invalidate(5, disabled = $$props.disabled);
|
|
3119
|
-
if ('error' in $$props) $$invalidate(
|
|
3190
|
+
if ('error' in $$props) $$invalidate(17, error = $$props.error);
|
|
3120
3191
|
if ('testid' in $$props) $$invalidate(6, testid = $$props.testid);
|
|
3121
3192
|
};
|
|
3122
3193
|
|
|
3123
3194
|
$$self.$$.update = () => {
|
|
3124
|
-
if ($$self.$$.dirty & /*error*/
|
|
3195
|
+
if ($$self.$$.dirty[0] & /*error*/ 131072) {
|
|
3125
3196
|
// TODO: remove this once goa-input has the toBoolean method removed
|
|
3126
|
-
$$invalidate(
|
|
3197
|
+
$$invalidate(13, isError = error ? "true" : "false");
|
|
3127
3198
|
}
|
|
3128
3199
|
};
|
|
3129
3200
|
|
|
@@ -3138,21 +3209,24 @@ function instance$i($$self, $$props, $$invalidate) {
|
|
|
3138
3209
|
options,
|
|
3139
3210
|
selectedLabel,
|
|
3140
3211
|
isMenuVisible,
|
|
3212
|
+
highlightedIndex,
|
|
3141
3213
|
el,
|
|
3214
|
+
menuEl,
|
|
3142
3215
|
isError,
|
|
3143
|
-
onSelect,
|
|
3144
3216
|
showMenu,
|
|
3145
3217
|
closeMenu,
|
|
3218
|
+
onSelect,
|
|
3146
3219
|
error,
|
|
3147
3220
|
click_handler,
|
|
3148
|
-
|
|
3221
|
+
ul_binding,
|
|
3222
|
+
div1_binding
|
|
3149
3223
|
];
|
|
3150
3224
|
}
|
|
3151
3225
|
|
|
3152
3226
|
class Dropdown extends SvelteElement {
|
|
3153
3227
|
constructor(options) {
|
|
3154
3228
|
super();
|
|
3155
|
-
this.shadowRoot.innerHTML = `<style>:host{box-sizing:border-box;font-family:var(--font-family)}.goa-dropdown-box{position:relative;cursor:pointer}.goa-dropdown-background{position:fixed;z-index:98;inset:0}.goa-dropdown-list{position:absolute;left:0;right:0;padding:0;margin:0;margin-top:3px;list-style-type:none;background:var(--color-white);border-radius:var(--input-border-radius);box-shadow:var(--shadow-1);z-index:99
|
|
3229
|
+
this.shadowRoot.innerHTML = `<style>:host{box-sizing:border-box;font-family:var(--font-family)}.goa-dropdown-box{position:relative;cursor:pointer}.goa-dropdown-background{cursor:default;position:fixed;z-index:98;inset:0}.goa-dropdown-list{position:absolute;left:0;right:0;padding:0;margin:0;margin-top:3px;list-style-type:none;background:var(--color-white);border-radius:var(--input-border-radius);outline:none;box-shadow:var(--shadow-1);z-index:99;scroll-behavior:smooth;scrollbar-width:thin;display:none}.dropdown-active{display:block}.goa-dropdown-list::-webkit-scrollbar{width:6px}.goa-dropdown-list::-webkit-scrollbar-track{background:#f1f1f1}.goa-dropdown-list::-webkit-scrollbar-thumb{background:#888}.goa-dropdown-list::-webkit-scrollbar-thumb:hover{background:#555}.goa-dropdown-option{margin:0;padding:0.5rem;cursor:pointer;color:var(--color-black)}.goa-dropdown-option--tabbed{background:var(--color-gray-100);color:var(--goa-color-interactive--hover)}.goa-dropdown-option--disabled{opacity:0.5;cursor:default}.goa-dropdown-option--disabled:hover{cursor:default;color:var(--color-gray-600)}.goa-dropdown-option--selected{background:var(--goa-color-interactive);color:var(--color-white)}.goa-dropdown-option--tabbed.goa-dropdown-option--selected,.goa-dropdown-option--selected:hover{background:var(--goa-color-interactive--hover);color:var(--color-white)}</style>`;
|
|
3156
3230
|
|
|
3157
3231
|
init(
|
|
3158
3232
|
this,
|
|
@@ -3171,10 +3245,11 @@ class Dropdown extends SvelteElement {
|
|
|
3171
3245
|
maxheight: 3,
|
|
3172
3246
|
placeholder: 4,
|
|
3173
3247
|
disabled: 5,
|
|
3174
|
-
error:
|
|
3248
|
+
error: 17,
|
|
3175
3249
|
testid: 6
|
|
3176
3250
|
},
|
|
3177
|
-
null
|
|
3251
|
+
null,
|
|
3252
|
+
[-1, -1]
|
|
3178
3253
|
);
|
|
3179
3254
|
|
|
3180
3255
|
if (options) {
|
|
@@ -3257,7 +3332,7 @@ class Dropdown extends SvelteElement {
|
|
|
3257
3332
|
}
|
|
3258
3333
|
|
|
3259
3334
|
get error() {
|
|
3260
|
-
return this.$$.ctx[
|
|
3335
|
+
return this.$$.ctx[17];
|
|
3261
3336
|
}
|
|
3262
3337
|
|
|
3263
3338
|
set error(error) {
|