@abgov/web-components 1.0.0-alpha.182 → 1.0.0-alpha.184
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/html.html-data.json +1 -1
- package/package.json +1 -1
- package/web-components.es.js +150 -25
- package/web-components.umd.js +49 -49
package/web-components.es.js
CHANGED
|
@@ -7493,7 +7493,7 @@ function instance$r($$self, $$props, $$invalidate) {
|
|
|
7493
7493
|
class FooterNavSection extends SvelteElement {
|
|
7494
7494
|
constructor(options) {
|
|
7495
7495
|
super();
|
|
7496
|
-
this.shadowRoot.innerHTML = `<style>:host{flex:auto}.title{font-size:var(--goa-font-size-7);line-height:var(--goa-line-height-4)}.hidden{display:none}.links{display:block;list-style-type:none;padding-left:0}@media(min-width: 720px){.links{display:var(--narrow-display-type);list-style-type:none;padding-left:0;flex-direction:column;column-count:var(--narrow-column-count)}}@media(min-width: 1024px){.links{display:var(--wide-display-type);list-style-type:none;padding-left:0;flex-direction:column;column-count:var(--wide-column-count)}}li{padding:0.75rem 0}a{color:var(--goa-color-text-default)}</style>`;
|
|
7496
|
+
this.shadowRoot.innerHTML = `<style>:host{flex:auto}.title{font-size:var(--goa-font-size-7);line-height:var(--goa-line-height-4);padding-bottom:var(--goa-space-l)}.hidden{display:none}.links{display:block;list-style-type:none;padding-left:0}@media(min-width: 720px){.links{display:var(--narrow-display-type);list-style-type:none;padding-left:0;flex-direction:column;column-count:var(--narrow-column-count)}}@media(min-width: 1024px){.links{display:var(--wide-display-type);list-style-type:none;padding-left:0;flex-direction:column;column-count:var(--wide-column-count)}}li{padding:0.75rem 0}a{color:var(--goa-color-text-default)}</style>`;
|
|
7497
7497
|
|
|
7498
7498
|
init(
|
|
7499
7499
|
this,
|
|
@@ -11905,9 +11905,9 @@ function create_if_block$7(ctx) {
|
|
|
11905
11905
|
attr(section, "data-testid", "popover-content");
|
|
11906
11906
|
attr(section, "class", "popover-content");
|
|
11907
11907
|
set_style(section, "max-width", /*maxwidth*/ ctx[1]);
|
|
11908
|
-
set_style(section, "padding", /*paddedContent*/ ctx[
|
|
11908
|
+
set_style(section, "padding", /*paddedContent*/ ctx[9] ? 'var(--goa-space-m)' : '0');
|
|
11909
11909
|
attr(div1, "class", "popover-container");
|
|
11910
|
-
set_custom_element_data(goa_focus_trap, "active", /*_isContentVisible*/ ctx[
|
|
11910
|
+
set_custom_element_data(goa_focus_trap, "active", /*_isContentVisible*/ ctx[6]);
|
|
11911
11911
|
},
|
|
11912
11912
|
m(target, anchor) {
|
|
11913
11913
|
insert(target, goa_focus_trap, anchor);
|
|
@@ -11916,9 +11916,10 @@ function create_if_block$7(ctx) {
|
|
|
11916
11916
|
append(goa_focus_trap, div1);
|
|
11917
11917
|
append(div1, section);
|
|
11918
11918
|
append(section, slot);
|
|
11919
|
+
/*section_binding*/ ctx[14](section);
|
|
11919
11920
|
|
|
11920
11921
|
if (!mounted) {
|
|
11921
|
-
dispose = listen(div0, "click", /*closePopover*/ ctx[
|
|
11922
|
+
dispose = listen(div0, "click", /*closePopover*/ ctx[11]);
|
|
11922
11923
|
mounted = true;
|
|
11923
11924
|
}
|
|
11924
11925
|
},
|
|
@@ -11927,16 +11928,17 @@ function create_if_block$7(ctx) {
|
|
|
11927
11928
|
set_style(section, "max-width", /*maxwidth*/ ctx[1]);
|
|
11928
11929
|
}
|
|
11929
11930
|
|
|
11930
|
-
if (dirty & /*paddedContent*/
|
|
11931
|
-
set_style(section, "padding", /*paddedContent*/ ctx[
|
|
11931
|
+
if (dirty & /*paddedContent*/ 512) {
|
|
11932
|
+
set_style(section, "padding", /*paddedContent*/ ctx[9] ? 'var(--goa-space-m)' : '0');
|
|
11932
11933
|
}
|
|
11933
11934
|
|
|
11934
|
-
if (dirty & /*_isContentVisible*/
|
|
11935
|
-
set_custom_element_data(goa_focus_trap, "active", /*_isContentVisible*/ ctx[
|
|
11935
|
+
if (dirty & /*_isContentVisible*/ 64) {
|
|
11936
|
+
set_custom_element_data(goa_focus_trap, "active", /*_isContentVisible*/ ctx[6]);
|
|
11936
11937
|
}
|
|
11937
11938
|
},
|
|
11938
11939
|
d(detaching) {
|
|
11939
11940
|
if (detaching) detach(goa_focus_trap);
|
|
11941
|
+
/*section_binding*/ ctx[14](null);
|
|
11940
11942
|
mounted = false;
|
|
11941
11943
|
dispose();
|
|
11942
11944
|
}
|
|
@@ -11947,9 +11949,10 @@ function create_fragment$h(ctx) {
|
|
|
11947
11949
|
let div1;
|
|
11948
11950
|
let div0;
|
|
11949
11951
|
let t;
|
|
11952
|
+
let div1_style_value;
|
|
11950
11953
|
let mounted;
|
|
11951
11954
|
let dispose;
|
|
11952
|
-
let if_block = /*_isContentVisible*/ ctx[
|
|
11955
|
+
let if_block = /*_isContentVisible*/ ctx[6] && create_if_block$7(ctx);
|
|
11953
11956
|
|
|
11954
11957
|
return {
|
|
11955
11958
|
c() {
|
|
@@ -11963,21 +11966,22 @@ function create_fragment$h(ctx) {
|
|
|
11963
11966
|
attr(div0, "tabindex", "0");
|
|
11964
11967
|
attr(div0, "data-testid", "popover-target");
|
|
11965
11968
|
attr(div1, "data-testid", /*testid*/ ctx[0]);
|
|
11969
|
+
attr(div1, "style", div1_style_value = calculateMargin(/*mt*/ ctx[2], /*mr*/ ctx[3], /*mb*/ ctx[4], /*ml*/ ctx[5]));
|
|
11966
11970
|
},
|
|
11967
11971
|
m(target, anchor) {
|
|
11968
11972
|
insert(target, div1, anchor);
|
|
11969
11973
|
append(div1, div0);
|
|
11970
|
-
/*div0_binding*/ ctx[
|
|
11974
|
+
/*div0_binding*/ ctx[13](div0);
|
|
11971
11975
|
append(div1, t);
|
|
11972
11976
|
if (if_block) if_block.m(div1, null);
|
|
11973
11977
|
|
|
11974
11978
|
if (!mounted) {
|
|
11975
|
-
dispose = listen(div0, "click", /*showPopover*/ ctx[
|
|
11979
|
+
dispose = listen(div0, "click", /*showPopover*/ ctx[10]);
|
|
11976
11980
|
mounted = true;
|
|
11977
11981
|
}
|
|
11978
11982
|
},
|
|
11979
11983
|
p(ctx, [dirty]) {
|
|
11980
|
-
if (/*_isContentVisible*/ ctx[
|
|
11984
|
+
if (/*_isContentVisible*/ ctx[6]) {
|
|
11981
11985
|
if (if_block) {
|
|
11982
11986
|
if_block.p(ctx, dirty);
|
|
11983
11987
|
} else {
|
|
@@ -11993,12 +11997,16 @@ function create_fragment$h(ctx) {
|
|
|
11993
11997
|
if (dirty & /*testid*/ 1) {
|
|
11994
11998
|
attr(div1, "data-testid", /*testid*/ ctx[0]);
|
|
11995
11999
|
}
|
|
12000
|
+
|
|
12001
|
+
if (dirty & /*mt, mr, mb, ml*/ 60 && div1_style_value !== (div1_style_value = calculateMargin(/*mt*/ ctx[2], /*mr*/ ctx[3], /*mb*/ ctx[4], /*ml*/ ctx[5]))) {
|
|
12002
|
+
attr(div1, "style", div1_style_value);
|
|
12003
|
+
}
|
|
11996
12004
|
},
|
|
11997
12005
|
i: noop,
|
|
11998
12006
|
o: noop,
|
|
11999
12007
|
d(detaching) {
|
|
12000
12008
|
if (detaching) detach(div1);
|
|
12001
|
-
/*div0_binding*/ ctx[
|
|
12009
|
+
/*div0_binding*/ ctx[13](null);
|
|
12002
12010
|
if (if_block) if_block.d();
|
|
12003
12011
|
mounted = false;
|
|
12004
12012
|
dispose();
|
|
@@ -12006,6 +12014,26 @@ function create_fragment$h(ctx) {
|
|
|
12006
12014
|
};
|
|
12007
12015
|
}
|
|
12008
12016
|
|
|
12017
|
+
function getBoundingClientRectWithMargins(el) {
|
|
12018
|
+
const rect = el.getBoundingClientRect();
|
|
12019
|
+
const style = window.getComputedStyle(el);
|
|
12020
|
+
const mTop = parseInt(style.marginTop, 10) || 0;
|
|
12021
|
+
const mRight = parseInt(style.marginRight, 10) || 0;
|
|
12022
|
+
const mBottom = parseInt(style.marginBottom, 10) || 0;
|
|
12023
|
+
const mLeft = parseInt(style.marginLeft, 10) || 0;
|
|
12024
|
+
|
|
12025
|
+
return {
|
|
12026
|
+
top: rect.top - mTop,
|
|
12027
|
+
right: rect.right + mRight,
|
|
12028
|
+
bottom: rect.bottom + mBottom,
|
|
12029
|
+
left: rect.left - mLeft,
|
|
12030
|
+
width: rect.width + mLeft + mRight,
|
|
12031
|
+
height: rect.height + mTop + mBottom,
|
|
12032
|
+
x: rect.x - mLeft,
|
|
12033
|
+
y: rect.y - mTop
|
|
12034
|
+
};
|
|
12035
|
+
}
|
|
12036
|
+
|
|
12009
12037
|
function instance$f($$self, $$props, $$invalidate) {
|
|
12010
12038
|
let paddedContent;
|
|
12011
12039
|
let { testid = "" } = $$props;
|
|
@@ -12013,6 +12041,11 @@ function instance$f($$self, $$props, $$invalidate) {
|
|
|
12013
12041
|
let { padded = "true" } = $$props;
|
|
12014
12042
|
let _isContentVisible = false;
|
|
12015
12043
|
let _targetEl;
|
|
12044
|
+
let _popoverEl;
|
|
12045
|
+
let { mt = null } = $$props;
|
|
12046
|
+
let { mr = null } = $$props;
|
|
12047
|
+
let { mb = null } = $$props;
|
|
12048
|
+
let { ml = null } = $$props;
|
|
12016
12049
|
|
|
12017
12050
|
onMount(async () => {
|
|
12018
12051
|
await tick();
|
|
@@ -12023,12 +12056,14 @@ function instance$f($$self, $$props, $$invalidate) {
|
|
|
12023
12056
|
removeEventListeners();
|
|
12024
12057
|
});
|
|
12025
12058
|
|
|
12026
|
-
function showPopover() {
|
|
12027
|
-
$$invalidate(
|
|
12059
|
+
async function showPopover() {
|
|
12060
|
+
$$invalidate(6, _isContentVisible = true);
|
|
12061
|
+
await tick();
|
|
12062
|
+
setPopoverPosition();
|
|
12028
12063
|
}
|
|
12029
12064
|
|
|
12030
12065
|
function closePopover() {
|
|
12031
|
-
$$invalidate(
|
|
12066
|
+
$$invalidate(6, _isContentVisible = false);
|
|
12032
12067
|
}
|
|
12033
12068
|
|
|
12034
12069
|
const onInputKeyDown = e => {
|
|
@@ -12045,6 +12080,35 @@ function instance$f($$self, $$props, $$invalidate) {
|
|
|
12045
12080
|
}
|
|
12046
12081
|
};
|
|
12047
12082
|
|
|
12083
|
+
function setPopoverPosition() {
|
|
12084
|
+
// Get target and content rectangles
|
|
12085
|
+
const targetRect = getBoundingClientRectWithMargins(_targetEl);
|
|
12086
|
+
|
|
12087
|
+
const contentRect = getBoundingClientRectWithMargins(_popoverEl);
|
|
12088
|
+
|
|
12089
|
+
// Calculate available space above and below the target element
|
|
12090
|
+
const spaceAbove = targetRect.top;
|
|
12091
|
+
|
|
12092
|
+
const spaceBelow = window.innerHeight - targetRect.bottom;
|
|
12093
|
+
|
|
12094
|
+
// Determine if there's more space above or below the target element
|
|
12095
|
+
const displayAbove = spaceAbove > contentRect.height && spaceAbove > spaceBelow && spaceBelow < contentRect.height;
|
|
12096
|
+
|
|
12097
|
+
// If there's more space above, display the popover above the target element
|
|
12098
|
+
if (displayAbove) {
|
|
12099
|
+
$$invalidate(8, _popoverEl.style.top = `${-contentRect.height - targetRect.height - 4}px`, _popoverEl);
|
|
12100
|
+
} else {
|
|
12101
|
+
$$invalidate(8, _popoverEl.style.top = '0px', _popoverEl);
|
|
12102
|
+
}
|
|
12103
|
+
|
|
12104
|
+
// Move the popover to the left if it is too far to the right and only if there is space to the left
|
|
12105
|
+
if (window.innerWidth - targetRect.right < contentRect.width && targetRect.left > contentRect.width) {
|
|
12106
|
+
$$invalidate(8, _popoverEl.style.left = `-${contentRect.width - targetRect.width}px`, _popoverEl);
|
|
12107
|
+
} else {
|
|
12108
|
+
$$invalidate(8, _popoverEl.style.left = '0px', _popoverEl);
|
|
12109
|
+
}
|
|
12110
|
+
}
|
|
12111
|
+
|
|
12048
12112
|
function addFocusEventListener() {
|
|
12049
12113
|
_targetEl.addEventListener("focus", onFocus, true);
|
|
12050
12114
|
}
|
|
@@ -12062,39 +12126,56 @@ function instance$f($$self, $$props, $$invalidate) {
|
|
|
12062
12126
|
function div0_binding($$value) {
|
|
12063
12127
|
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
12064
12128
|
_targetEl = $$value;
|
|
12065
|
-
$$invalidate(
|
|
12129
|
+
$$invalidate(7, _targetEl);
|
|
12130
|
+
});
|
|
12131
|
+
}
|
|
12132
|
+
|
|
12133
|
+
function section_binding($$value) {
|
|
12134
|
+
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
12135
|
+
_popoverEl = $$value;
|
|
12136
|
+
$$invalidate(8, _popoverEl);
|
|
12066
12137
|
});
|
|
12067
12138
|
}
|
|
12068
12139
|
|
|
12069
12140
|
$$self.$$set = $$props => {
|
|
12070
12141
|
if ('testid' in $$props) $$invalidate(0, testid = $$props.testid);
|
|
12071
12142
|
if ('maxwidth' in $$props) $$invalidate(1, maxwidth = $$props.maxwidth);
|
|
12072
|
-
if ('padded' in $$props) $$invalidate(
|
|
12143
|
+
if ('padded' in $$props) $$invalidate(12, padded = $$props.padded);
|
|
12144
|
+
if ('mt' in $$props) $$invalidate(2, mt = $$props.mt);
|
|
12145
|
+
if ('mr' in $$props) $$invalidate(3, mr = $$props.mr);
|
|
12146
|
+
if ('mb' in $$props) $$invalidate(4, mb = $$props.mb);
|
|
12147
|
+
if ('ml' in $$props) $$invalidate(5, ml = $$props.ml);
|
|
12073
12148
|
};
|
|
12074
12149
|
|
|
12075
12150
|
$$self.$$.update = () => {
|
|
12076
|
-
if ($$self.$$.dirty & /*padded*/
|
|
12077
|
-
$$invalidate(
|
|
12151
|
+
if ($$self.$$.dirty & /*padded*/ 4096) {
|
|
12152
|
+
$$invalidate(9, paddedContent = toBoolean(padded));
|
|
12078
12153
|
}
|
|
12079
12154
|
};
|
|
12080
12155
|
|
|
12081
12156
|
return [
|
|
12082
12157
|
testid,
|
|
12083
12158
|
maxwidth,
|
|
12159
|
+
mt,
|
|
12160
|
+
mr,
|
|
12161
|
+
mb,
|
|
12162
|
+
ml,
|
|
12084
12163
|
_isContentVisible,
|
|
12085
12164
|
_targetEl,
|
|
12165
|
+
_popoverEl,
|
|
12086
12166
|
paddedContent,
|
|
12087
12167
|
showPopover,
|
|
12088
12168
|
closePopover,
|
|
12089
12169
|
padded,
|
|
12090
|
-
div0_binding
|
|
12170
|
+
div0_binding,
|
|
12171
|
+
section_binding
|
|
12091
12172
|
];
|
|
12092
12173
|
}
|
|
12093
12174
|
|
|
12094
12175
|
class Popover extends SvelteElement {
|
|
12095
12176
|
constructor(options) {
|
|
12096
12177
|
super();
|
|
12097
|
-
this.shadowRoot.innerHTML = `<style>:host{box-sizing:border-box;font-family:var(--goa-font-family-sans);font-size:var(--goa-font-size-4)}.popover-target{width:fit-content;cursor:pointer}.popover-target:focus{outline:var(--goa-border-width-l) solid var(--goa-color-interactive-focus)}.popover-content{position:absolute;left:0;right:0;margin-top:3px;list-style-type:none;background:var(--goa-color-greyscale-white);
|
|
12178
|
+
this.shadowRoot.innerHTML = `<style>:host{box-sizing:border-box;font-family:var(--goa-font-family-sans);font-size:var(--goa-font-size-4)}.popover-target{width:fit-content;cursor:pointer}.popover-target:focus{outline:var(--goa-border-width-l) solid var(--goa-color-interactive-focus)}.popover-content{position:absolute;left:0;right:0;margin-top:3px;list-style-type:none;background:var(--goa-color-greyscale-white);outline:none;filter:drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.2));z-index:99;width:max-content}.popover-background{cursor:default;position:fixed;z-index:98;inset:0}.popover-container{position:relative}</style>`;
|
|
12098
12179
|
|
|
12099
12180
|
init(
|
|
12100
12181
|
this,
|
|
@@ -12106,7 +12187,15 @@ class Popover extends SvelteElement {
|
|
|
12106
12187
|
instance$f,
|
|
12107
12188
|
create_fragment$h,
|
|
12108
12189
|
safe_not_equal,
|
|
12109
|
-
{
|
|
12190
|
+
{
|
|
12191
|
+
testid: 0,
|
|
12192
|
+
maxwidth: 1,
|
|
12193
|
+
padded: 12,
|
|
12194
|
+
mt: 2,
|
|
12195
|
+
mr: 3,
|
|
12196
|
+
mb: 4,
|
|
12197
|
+
ml: 5
|
|
12198
|
+
},
|
|
12110
12199
|
null
|
|
12111
12200
|
);
|
|
12112
12201
|
|
|
@@ -12123,7 +12212,7 @@ class Popover extends SvelteElement {
|
|
|
12123
12212
|
}
|
|
12124
12213
|
|
|
12125
12214
|
static get observedAttributes() {
|
|
12126
|
-
return ["testid", "maxwidth", "padded"];
|
|
12215
|
+
return ["testid", "maxwidth", "padded", "mt", "mr", "mb", "ml"];
|
|
12127
12216
|
}
|
|
12128
12217
|
|
|
12129
12218
|
get testid() {
|
|
@@ -12145,13 +12234,49 @@ class Popover extends SvelteElement {
|
|
|
12145
12234
|
}
|
|
12146
12235
|
|
|
12147
12236
|
get padded() {
|
|
12148
|
-
return this.$$.ctx[
|
|
12237
|
+
return this.$$.ctx[12];
|
|
12149
12238
|
}
|
|
12150
12239
|
|
|
12151
12240
|
set padded(padded) {
|
|
12152
12241
|
this.$$set({ padded });
|
|
12153
12242
|
flush();
|
|
12154
12243
|
}
|
|
12244
|
+
|
|
12245
|
+
get mt() {
|
|
12246
|
+
return this.$$.ctx[2];
|
|
12247
|
+
}
|
|
12248
|
+
|
|
12249
|
+
set mt(mt) {
|
|
12250
|
+
this.$$set({ mt });
|
|
12251
|
+
flush();
|
|
12252
|
+
}
|
|
12253
|
+
|
|
12254
|
+
get mr() {
|
|
12255
|
+
return this.$$.ctx[3];
|
|
12256
|
+
}
|
|
12257
|
+
|
|
12258
|
+
set mr(mr) {
|
|
12259
|
+
this.$$set({ mr });
|
|
12260
|
+
flush();
|
|
12261
|
+
}
|
|
12262
|
+
|
|
12263
|
+
get mb() {
|
|
12264
|
+
return this.$$.ctx[4];
|
|
12265
|
+
}
|
|
12266
|
+
|
|
12267
|
+
set mb(mb) {
|
|
12268
|
+
this.$$set({ mb });
|
|
12269
|
+
flush();
|
|
12270
|
+
}
|
|
12271
|
+
|
|
12272
|
+
get ml() {
|
|
12273
|
+
return this.$$.ctx[5];
|
|
12274
|
+
}
|
|
12275
|
+
|
|
12276
|
+
set ml(ml) {
|
|
12277
|
+
this.$$set({ ml });
|
|
12278
|
+
flush();
|
|
12279
|
+
}
|
|
12155
12280
|
}
|
|
12156
12281
|
|
|
12157
12282
|
customElements.define("goa-popover", Popover);
|